From 3efe133115bdc6108353d4597b95badeb8ab1252 Mon Sep 17 00:00:00 2001 From: support Date: Tue, 18 Oct 2022 12:27:40 +0000 Subject: [PATCH] Built motion from commit 7a6deb60.|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, 185251 insertions(+), 6749 deletions(-) delete mode 100644 snippet/3.5.0/scripts/app.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/app.js.map delete mode 100644 snippet/3.5.0/scripts/chat.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/mobile.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-58d021f3.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-58d021f3.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-76f2ed34.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-76f2ed34.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-76f2ed34.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-animate.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-animate.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-animate.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-local-storage.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-local-storage.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-local-storage.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-material.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-material.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-material.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-messages.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-messages.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-messages.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-resource.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-resource.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-resource.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-angular-sanitize.js delete mode 100644 snippet/3.5.0/scripts/vendor-angular-sanitize.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-angular-sanitize.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-emojione.js delete mode 100644 snippet/3.5.0/scripts/vendor-emojione.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-emojionearea.js delete mode 100644 snippet/3.5.0/scripts/vendor-emojionearea.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-emojionearea.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-flow.js delete mode 100644 snippet/3.5.0/scripts/vendor-flow.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-flow.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-index.js delete mode 100644 snippet/3.5.0/scripts/vendor-index.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-jquery.js delete mode 100644 snippet/3.5.0/scripts/vendor-jquery.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-jquery.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-jquery.textcomplete.js delete mode 100644 snippet/3.5.0/scripts/vendor-jquery.textcomplete.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-jquery.textcomplete.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-moment.js delete mode 100644 snippet/3.5.0/scripts/vendor-moment.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/vendor-moment.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-ng-embed.js delete mode 100644 snippet/3.5.0/scripts/vendor-ng-embed.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-stateDirectives.js delete mode 100644 snippet/3.5.0/scripts/vendor-stateDirectives.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-stateService.js delete mode 100644 snippet/3.5.0/scripts/vendor-stateService.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-transition.js delete mode 100644 snippet/3.5.0/scripts/vendor-transition.js.map delete mode 100644 snippet/3.5.0/scripts/vendor-urlMatcher.js delete mode 100644 snippet/3.5.0/scripts/vendor-urlMatcher.js.map delete mode 100644 snippet/3.5.0/styles/vendor.css delete mode 100644 snippet/3.5.0/styles/vendor.css.map delete mode 100644 snippet/3.5.0/templates/00860aee362cdeeb1080.html create mode 100644 snippet/3.5.0/templates/2444367602029f7ce07b.html delete mode 100644 snippet/3.5.0/templates/3f18dac5f545add792db.html delete mode 100644 snippet/3.5.0/templates/6043a16afdb829ba5934.html create mode 100644 snippet/3.5.0/templates/66a0b4b6e8658e97c814.html delete mode 100644 snippet/3.5.0/templates/9962474df74f9405ac72.html create mode 100644 snippet/3.5.0/templates/c1e929900f2af303341f.html create mode 100644 snippet/3.5.0/templates/c6696015a1b93372d614.html delete mode 100644 snippet/3.5.0/templates/caf0e553108b226443aa.html create mode 100644 snippet/3.5.0/templates/cd310ba2c496545551ae.html delete mode 100644 snippet/3.5.0/templates/dc49a9ba939f8c099868.html create mode 100644 snippet/3.5.0/templates/f4b04fc57c34408c2d9e.html diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 88d299e..ed01f3a 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-17T13:40:59.572Z", + "time": "2022-10-18T12:15:45.303Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d27b778..4fdb429 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-17T13:40:59.572Z", + "time": "2022-10-18T12:15:45.303Z", "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 ebb2427..5baf726 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 _0xe565=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','integration','jscripty','urlForward','browser','bot'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe565,0x1b2));var _0x5e56=function(_0x32aeb4,_0x6a3162){_0x32aeb4=_0x32aeb4-0x0;var _0x37384d=_0xe565[_0x32aeb4];return _0x37384d;};'use strict';var Sequelize=require('sequelize');module[_0x5e56('0x0')]={'name':{'type':Sequelize[_0x5e56('0x1')],'get':function(_0x564c70){return this[_0x5e56('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x5e56('0x3'),'motionbar',_0x5e56('0x4'),_0x5e56('0x5'),_0x5e56('0x6'),_0x5e56('0x7'),_0x5e56('0x8')]],'msg':_0x5e56('0x9')}},'comment':_0x5e56('0x9')},'data1':{'type':Sequelize[_0x5e56('0xa')](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[_0x5e56('0xa')](0x1000),'comment':_0x5e56('0xb')},'data3':{'type':Sequelize[_0x5e56('0xa')](0x1000),'comment':_0x5e56('0xc')},'data4':{'type':Sequelize[_0x5e56('0xa')](0x1000),'comments':_0x5e56('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x5e56('0xe')},'data6':{'type':Sequelize[_0x5e56('0xa')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x5e56('0xf')],'comments':_0x5e56('0x10')}}; \ No newline at end of file +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 diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 33a0845..9bf3554 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 _0xc805=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','update','body','Action','params','find','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4194be,_0x54e109){var _0x1fe0c6=function(_0x5ee41a){while(--_0x5ee41a){_0x4194be['push'](_0x4194be['shift']());}};_0x1fe0c6(++_0x54e109);}(_0xc805,0x108));var _0x5c80=function(_0x23c54c,_0x3fabca){_0x23c54c=_0x23c54c-0x0;var _0x3b06d7=_0xc805[_0x23c54c];return _0x3b06d7;};'use strict';var emlformat=require(_0x5c80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c80('0x1'));var jsonpatch=require(_0x5c80('0x2'));var rp=require(_0x5c80('0x3'));var moment=require(_0x5c80('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c80('0x5'));var sox=require('sox');var csv=require(_0x5c80('0x6'));var ejs=require(_0x5c80('0x7'));var fs=require('fs');var fs_extra=require(_0x5c80('0x8'));var _=require(_0x5c80('0x9'));var squel=require(_0x5c80('0xa'));var crypto=require(_0x5c80('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5c80('0xc'));var toCsv=require(_0x5c80('0x6'));var querystring=require(_0x5c80('0xd'));var Papa=require('papaparse');var Redis=require(_0x5c80('0xe'));var authService=require(_0x5c80('0xf'));var qs=require(_0x5c80('0x10'));var as=require(_0x5c80('0x11'));var hardwareService=require(_0x5c80('0x12'));var logger=require(_0x5c80('0x13'))(_0x5c80('0x14'));var utils=require(_0x5c80('0x15'));var config=require(_0x5c80('0x16'));var licenseUtil=require(_0x5c80('0x17'));var db=require(_0x5c80('0x18'))['db'];function respondWithStatusCode(_0x23898e,_0x11bb11){_0x11bb11=_0x11bb11||0xcc;return function(_0x5eeb2c){if(_0x5eeb2c){return _0x23898e[_0x5c80('0x19')](_0x11bb11);}return _0x23898e[_0x5c80('0x1a')](_0x11bb11)[_0x5c80('0x1b')]();};}function respondWithResult(_0xd5aecc,_0x157d04){_0x157d04=_0x157d04||0xc8;return function(_0x56239d){if(_0x56239d){return _0xd5aecc[_0x5c80('0x1a')](_0x157d04)[_0x5c80('0x1c')](_0x56239d);}};}function respondWithFilteredResult(_0x2059a5,_0x404921){return function(_0x2981ce){if(_0x2981ce){var _0x5ee836=typeof _0x404921[_0x5c80('0x1d')]===_0x5c80('0x1e')&&typeof _0x404921[_0x5c80('0x1f')]==='undefined';var _0x375e99=_0x2981ce[_0x5c80('0x20')];var _0x48febf=_0x5ee836?0x0:_0x404921[_0x5c80('0x1d')];var _0x4babb2=_0x5ee836?_0x2981ce[_0x5c80('0x20')]:_0x404921[_0x5c80('0x1d')]+_0x404921[_0x5c80('0x1f')];var _0x2729ae;if(_0x4babb2>=_0x375e99){_0x4babb2=_0x375e99;_0x2729ae=0xc8;}else{_0x2729ae=0xce;}_0x2059a5[_0x5c80('0x1a')](_0x2729ae);return _0x2059a5[_0x5c80('0x21')](_0x5c80('0x22'),_0x48febf+'-'+_0x4babb2+'/'+_0x375e99)[_0x5c80('0x1c')](_0x2981ce);}return null;};}function patchUpdates(_0x2288d7){return function(_0x209164){try{jsonpatch[_0x5c80('0x23')](_0x209164,_0x2288d7,!![]);}catch(_0x230912){return BPromise[_0x5c80('0x24')](_0x230912);}return _0x209164['save']();};}function saveUpdates(_0x5d3896,_0x3b5dcd){return function(_0x2c7ba6){if(_0x2c7ba6){return _0x2c7ba6['update'](_0x5d3896)[_0x5c80('0x25')](function(_0xf53b){return _0xf53b;});}return null;};}function removeEntity(_0x47929e,_0x2f765a){return function(_0x1578e8){if(_0x1578e8){return _0x1578e8[_0x5c80('0x26')]()['then'](function(){_0x47929e[_0x5c80('0x1a')](0xcc)[_0x5c80('0x1b')]();});}};}function handleEntityNotFound(_0xb7c4d3,_0x5423df){return function(_0x19f85d){if(!_0x19f85d){_0xb7c4d3['sendStatus'](0x194);}return _0x19f85d;};}function handleError(_0x24ba2a,_0x55e8ee){_0x55e8ee=_0x55e8ee||0x1f4;return function(_0x28c87c){logger[_0x5c80('0x27')](_0x28c87c['stack']);if(_0x28c87c['name']){delete _0x28c87c[_0x5c80('0x28')];}_0x24ba2a['status'](_0x55e8ee)[_0x5c80('0x29')](_0x28c87c);};}exports[_0x5c80('0x2a')]=function(_0x17ec9c,_0x3f9d44){if(_0x17ec9c['body']['id']){delete _0x17ec9c[_0x5c80('0x2b')]['id'];}return db[_0x5c80('0x2c')]['find']({'where':{'id':_0x17ec9c[_0x5c80('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3f9d44,null))[_0x5c80('0x25')](saveUpdates(_0x17ec9c[_0x5c80('0x2b')],null))[_0x5c80('0x25')](respondWithResult(_0x3f9d44,null))['catch'](handleError(_0x3f9d44,null));};exports[_0x5c80('0x26')]=function(_0x4e633b,_0x40c513){return db[_0x5c80('0x2c')][_0x5c80('0x2e')]({'where':{'id':_0x4e633b['params']['id']}})[_0x5c80('0x25')](handleEntityNotFound(_0x40c513,null))['then'](removeEntity(_0x40c513,null))[_0x5c80('0x2f')](handleError(_0x40c513,null));}; \ No newline at end of file +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 diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 94af9c9..1f42a8a 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 _0x7e73=['./action.attributes','define','Action','tools_actions','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x16f073,_0x5ff7ae){var _0x22a577=function(_0x30ea3a){while(--_0x30ea3a){_0x16f073['push'](_0x16f073['shift']());}};_0x22a577(++_0x5ff7ae);}(_0x7e73,0xbf));var _0x37e7=function(_0x1585e3,_0x40e36e){_0x1585e3=_0x1585e3-0x0;var _0x59c3ef=_0x7e73[_0x1585e3];return _0x59c3ef;};'use strict';var _=require(_0x37e7('0x0'));var util=require('util');var logger=require(_0x37e7('0x1'))(_0x37e7('0x2'));var moment=require('moment');var BPromise=require(_0x37e7('0x3'));var rp=require(_0x37e7('0x4'));var fs=require('fs');var path=require(_0x37e7('0x5'));var rimraf=require('rimraf');var config=require(_0x37e7('0x6'));var attributes=require(_0x37e7('0x7'));module['exports']=function(_0x178b26,_0x5e3323){return _0x178b26[_0x37e7('0x8')](_0x37e7('0x9'),attributes,{'tableName':_0x37e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index d565696..7f18cbf 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2de704,_0x1e02e7){_0x2de704=_0x2de704-0x0;var _0x32d02d=_0x1cb9[_0x2de704];return _0x32d02d;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 11fd85a..1729510 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 _0xb78e=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xb78e,0x1c0));var _0xeb78=function(_0x421d6a,_0x269b79){_0x421d6a=_0x421d6a-0x0;var _0x3d2ddc=_0xb78e[_0x421d6a];return _0x3d2ddc;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require(_0xeb78('0x2'));var timeout=require(_0xeb78('0x3'));var express=require('express');var router=express[_0xeb78('0x4')]();var fs_extra=require(_0xeb78('0x5'));var auth=require(_0xeb78('0x6'));var interaction=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var controller=require(_0xeb78('0x9'));router[_0xeb78('0xa')](_0xeb78('0xb'),auth[_0xeb78('0xc')](),controller[_0xeb78('0xd')]);router[_0xeb78('0xe')](_0xeb78('0xb'),auth[_0xeb78('0xc')](),controller[_0xeb78('0xf')]);module[_0xeb78('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 10e8a17..c65b427 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 _0x2eb2=['TEXT','exports','STRING'];(function(_0x2486be,_0x5d7dd2){var _0x24042b=function(_0x171418){while(--_0x171418){_0x2486be['push'](_0x2486be['shift']());}};_0x24042b(++_0x5d7dd2);}(_0x2eb2,0x19f));var _0x22eb=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x2eb2[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 883431e..f86c30a 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 _0x257c=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','rows','catch','show','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','COUNT(%s)','MIN(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','condition','AnalyticMetric','findAll','output','fullPath','%s-%s.%s','randomstring','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','countTable','QueryTypes','SELECT','run','runReport','metric','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','end','error','stack','name','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x204981,_0x3a678e){var _0x1876c1=function(_0x10f620){while(--_0x10f620){_0x204981['push'](_0x204981['shift']());}};_0x1876c1(++_0x3a678e);}(_0x257c,0x111));var _0xc257=function(_0x1b0899,_0x179c99){_0x1b0899=_0x1b0899-0x0;var _0x30273f=_0x257c[_0x1b0899];return _0x30273f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc257('0x0'));var zipdir=require(_0xc257('0x1'));var jsonpatch=require(_0xc257('0x2'));var rp=require(_0xc257('0x3'));var moment=require(_0xc257('0x4'));var BPromise=require(_0xc257('0x5'));var Mustache=require(_0xc257('0x6'));var util=require('util');var path=require(_0xc257('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc257('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc257('0x9'));var jsforce=require(_0xc257('0xa'));var deskjs=require(_0xc257('0xb'));var toCsv=require(_0xc257('0xc'));var querystring=require(_0xc257('0xd'));var Papa=require(_0xc257('0xe'));var Redis=require('ioredis');var authService=require(_0xc257('0xf'));var qs=require(_0xc257('0x10'));var as=require(_0xc257('0x11'));var hardwareService=require(_0xc257('0x12'));var logger=require(_0xc257('0x13'))(_0xc257('0x14'));var utils=require(_0xc257('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc257('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc257('0x17'))[_0xc257('0x18')];function respondWithStatusCode(_0x5eacf7,_0x432f86){_0x432f86=_0x432f86||0xcc;return function(_0x1fb8ea){if(_0x1fb8ea){return _0x5eacf7[_0xc257('0x19')](_0x432f86);}return _0x5eacf7[_0xc257('0x1a')](_0x432f86)['end']();};}function respondWithResult(_0x46c74e,_0x3676ba){_0x3676ba=_0x3676ba||0xc8;return function(_0x23fc3f){if(_0x23fc3f){return _0x46c74e[_0xc257('0x1a')](_0x3676ba)[_0xc257('0x1b')](_0x23fc3f);}};}function respondWithFilteredResult(_0x3d6e26,_0x3aadea){return function(_0x4cdb6b){if(_0x4cdb6b){var _0x2a3490=typeof _0x3aadea[_0xc257('0x1c')]===_0xc257('0x1d')&&typeof _0x3aadea[_0xc257('0x1e')]===_0xc257('0x1d');var _0x5295f6=_0x4cdb6b[_0xc257('0x1f')];var _0x5b8a5e=_0x2a3490?0x0:_0x3aadea[_0xc257('0x1c')];var _0x29ba7d=_0x2a3490?_0x4cdb6b[_0xc257('0x1f')]:_0x3aadea['offset']+_0x3aadea[_0xc257('0x1e')];var _0x82376a;if(_0x29ba7d>=_0x5295f6){_0x29ba7d=_0x5295f6;_0x82376a=0xc8;}else{_0x82376a=0xce;}_0x3d6e26[_0xc257('0x1a')](_0x82376a);return _0x3d6e26[_0xc257('0x20')](_0xc257('0x21'),_0x5b8a5e+'-'+_0x29ba7d+'/'+_0x5295f6)[_0xc257('0x1b')](_0x4cdb6b);}return null;};}function patchUpdates(_0x5861e3){return function(_0x121729){try{jsonpatch[_0xc257('0x22')](_0x121729,_0x5861e3,!![]);}catch(_0x5e2e82){return BPromise[_0xc257('0x23')](_0x5e2e82);}return _0x121729[_0xc257('0x24')]();};}function saveUpdates(_0x50f6cc,_0x143ed8){return function(_0xa00630){if(_0xa00630){return _0xa00630[_0xc257('0x25')](_0x50f6cc)[_0xc257('0x26')](function(_0x5f65c4){return _0x5f65c4;});}return null;};}function removeEntity(_0x2853f7,_0x2aa9dc){return function(_0x20e153){if(_0x20e153){return _0x20e153[_0xc257('0x27')]()[_0xc257('0x26')](function(){var _0x4b9aee=_0x20e153[_0xc257('0x28')]({'plain':!![]});var _0x3b51e5=_0xc257('0x29');return db['UserProfileResource'][_0xc257('0x27')]({'where':{'type':_0x3b51e5,'resourceId':_0x4b9aee['id']}})[_0xc257('0x26')](function(){return _0x20e153;});})[_0xc257('0x26')](function(){_0x2853f7[_0xc257('0x1a')](0xcc)[_0xc257('0x2a')]();});}};}function handleEntityNotFound(_0x591e80,_0x22e295){return function(_0x5c3d72){if(!_0x5c3d72){_0x591e80[_0xc257('0x19')](0x194);}return _0x5c3d72;};}function handleError(_0x4d5963,_0x35afde){_0x35afde=_0x35afde||0x1f4;return function(_0x491422){logger[_0xc257('0x2b')](_0x491422[_0xc257('0x2c')]);if(_0x491422[_0xc257('0x2d')]){delete _0x491422[_0xc257('0x2d')];}_0x4d5963[_0xc257('0x1a')](_0x35afde)['send'](_0x491422);};}exports['index']=function(_0x554901,_0x584b79){var _0x11b708={},_0x1aad68={},_0x34329f={'count':0x0,'rows':[]};var _0x5285e5=_[_0xc257('0x2e')](db[_0xc257('0x2f')][_0xc257('0x30')],function(_0x10770e){return{'name':_0x10770e[_0xc257('0x31')],'type':_0x10770e[_0xc257('0x32')][_0xc257('0x33')]};});_0x1aad68[_0xc257('0x34')]=_['map'](_0x5285e5,_0xc257('0x2d'));_0x1aad68[_0xc257('0x35')]=_[_0xc257('0x36')](_0x554901[_0xc257('0x35')]);_0x1aad68[_0xc257('0x37')]=_['intersection'](_0x1aad68[_0xc257('0x34')],_0x1aad68[_0xc257('0x35')]);_0x11b708['attributes']=_[_0xc257('0x38')](_0x1aad68[_0xc257('0x34')],qs['fields'](_0x554901['query'][_0xc257('0x39')]));_0x11b708[_0xc257('0x3a')]=_0x11b708['attributes'][_0xc257('0x3b')]?_0x11b708[_0xc257('0x3a')]:_0x1aad68['model'];if(!_0x554901['query'][_0xc257('0x3c')](_0xc257('0x3d'))){_0x11b708[_0xc257('0x1e')]=qs[_0xc257('0x1e')](_0x554901[_0xc257('0x35')][_0xc257('0x1e')]);_0x11b708[_0xc257('0x1c')]=qs[_0xc257('0x1c')](_0x554901[_0xc257('0x35')][_0xc257('0x1c')]);}_0x11b708[_0xc257('0x3e')]=qs[_0xc257('0x3f')](_0x554901[_0xc257('0x35')][_0xc257('0x3f')]);_0x11b708[_0xc257('0x40')]=qs['filters'](_[_0xc257('0x41')](_0x554901[_0xc257('0x35')],_0x1aad68[_0xc257('0x37')]),_0x5285e5);if(_0x554901[_0xc257('0x35')]['filter']){_0x11b708[_0xc257('0x40')]=_['merge'](_0x11b708[_0xc257('0x40')],{'$or':_[_0xc257('0x2e')](_0x5285e5,function(_0x584705){if(_0x584705[_0xc257('0x32')]!==_0xc257('0x42')){var _0x588a2a={};_0x588a2a[_0x584705[_0xc257('0x2d')]]={'$like':'%'+_0x554901[_0xc257('0x35')]['filter']+'%'};return _0x588a2a;}})});}_0x11b708=_['merge']({},_0x11b708,_0x554901[_0xc257('0x43')]);var _0x4ac102={'where':_0x11b708[_0xc257('0x40')]};return db[_0xc257('0x2f')][_0xc257('0x1f')](_0x4ac102)[_0xc257('0x26')](function(_0x58bcc1){_0x34329f[_0xc257('0x1f')]=_0x58bcc1;if(_0x554901[_0xc257('0x35')][_0xc257('0x44')]){_0x11b708['include']=[{'all':!![]}];}return db[_0xc257('0x2f')]['findAll'](_0x11b708);})[_0xc257('0x26')](function(_0x4313d5){_0x34329f[_0xc257('0x45')]=_0x4313d5;return _0x34329f;})[_0xc257('0x26')](respondWithFilteredResult(_0x584b79,_0x11b708))[_0xc257('0x46')](handleError(_0x584b79,null));};exports[_0xc257('0x47')]=function(_0x679ac7,_0x3cf012){var _0x3dc7bf={'raw':![],'where':{'id':_0x679ac7['params']['id']}},_0x40efd3={};_0x40efd3['model']=_[_0xc257('0x36')](db[_0xc257('0x2f')]['rawAttributes']);_0x40efd3[_0xc257('0x35')]=_[_0xc257('0x36')](_0x679ac7[_0xc257('0x35')]);_0x40efd3[_0xc257('0x37')]=_[_0xc257('0x38')](_0x40efd3[_0xc257('0x34')],_0x40efd3['query']);_0x3dc7bf[_0xc257('0x3a')]=_[_0xc257('0x38')](_0x40efd3[_0xc257('0x34')],qs[_0xc257('0x39')](_0x679ac7['query'][_0xc257('0x39')]));_0x3dc7bf[_0xc257('0x3a')]=_0x3dc7bf[_0xc257('0x3a')][_0xc257('0x3b')]?_0x3dc7bf[_0xc257('0x3a')]:_0x40efd3[_0xc257('0x34')];if(_0x679ac7[_0xc257('0x35')][_0xc257('0x44')]){_0x3dc7bf['include']=[{'all':!![]}];}_0x3dc7bf=_[_0xc257('0x48')]({},_0x3dc7bf,_0x679ac7[_0xc257('0x43')]);return db[_0xc257('0x2f')][_0xc257('0x49')](_0x3dc7bf)[_0xc257('0x26')](handleEntityNotFound(_0x3cf012,null))[_0xc257('0x26')](respondWithResult(_0x3cf012,null))[_0xc257('0x46')](handleError(_0x3cf012,null));};exports[_0xc257('0x4a')]=function(_0x254ed3,_0x50e117){return db[_0xc257('0x2f')][_0xc257('0x4a')](_0x254ed3[_0xc257('0x4b')],{})['then'](function(_0x3b6abc){var _0xd90b2f=_0x254ed3[_0xc257('0x4c')]['get']({'plain':!![]});if(!_0xd90b2f)throw new Error(_0xc257('0x4d'));if(_0xd90b2f[_0xc257('0x4e')]===_0xc257('0x4c')){var _0x3f9595=_0x3b6abc['get']({'plain':!![]});var _0x241294='Reports';return db[_0xc257('0x4f')]['find']({'where':{'name':_0x241294,'userProfileId':_0xd90b2f[_0xc257('0x50')]},'raw':!![]})['then'](function(_0x32d503){if(_0x32d503&&_0x32d503[_0xc257('0x51')]===0x0){return db[_0xc257('0x52')][_0xc257('0x4a')]({'name':_0x3f9595[_0xc257('0x2d')],'resourceId':_0x3f9595['id'],'type':_0xc257('0x29'),'sectionId':_0x32d503['id']},{})[_0xc257('0x26')](function(){return _0x3b6abc;});}else{return _0x3b6abc;}})[_0xc257('0x46')](function(_0x543c5e){logger[_0xc257('0x2b')](_0xc257('0x53'),_0x543c5e);throw _0x543c5e;});}return _0x3b6abc;})[_0xc257('0x26')](respondWithResult(_0x50e117,0xc9))['catch'](handleError(_0x50e117,null));};exports['update']=function(_0x29afd2,_0x415084){if(_0x29afd2[_0xc257('0x4b')]['id']){delete _0x29afd2['body']['id'];}return db['AnalyticCustomReport'][_0xc257('0x49')]({'where':{'id':_0x29afd2[_0xc257('0x54')]['id']}})[_0xc257('0x26')](handleEntityNotFound(_0x415084,null))[_0xc257('0x26')](saveUpdates(_0x29afd2[_0xc257('0x4b')],null))['then'](respondWithResult(_0x415084,null))[_0xc257('0x46')](handleError(_0x415084,null));};exports[_0xc257('0x27')]=function(_0x28081e,_0x108c11){return db[_0xc257('0x2f')][_0xc257('0x49')]({'where':{'id':_0x28081e[_0xc257('0x54')]['id']}})[_0xc257('0x26')](handleEntityNotFound(_0x108c11,null))['then'](removeEntity(_0x108c11,null))[_0xc257('0x46')](handleError(_0x108c11,null));};exports[_0xc257('0x55')]=function(_0x246754,_0x3403d2){var _0x550c0f=0xa;var _0x487208=[_0xc257('0x56'),_0xc257('0x57'),_0xc257('0x58'),_0xc257('0x59')];var _0x6b9dbc={'SUM':_0xc257('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc257('0x5b'),'MAX':_0xc257('0x5c'),'MIN':'MIN(%s)','AVG':_0xc257('0x5d'),'GROUP_CONCAT':_0xc257('0x5e'),'GROUP_CONCAT ASC':_0xc257('0x5f'),'GROUP_CONCAT DESC':_0xc257('0x60')};var _0x22c074={'SEC_TO_TIME':_0xc257('0x61'),'DATE':_0xc257('0x62'),'HOUR':_0xc257('0x63'),'ROUND':_0xc257('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x35885f=function(_0x2977dd){return!_[_0xc257('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xc257('0x66'),_0xc257('0x67')],_0x2977dd);};var _0x210ba7=function(_0x24075c){if(!_0x24075c||!_0x24075c[_0xc257('0x68')][_0xc257('0x3b')]){return'';}for(var _0x1945fa='(',_0x25eae5=0x0;_0x25eae5<_0x24075c[_0xc257('0x68')][_0xc257('0x3b')];_0x25eae5+=0x1){_0x25eae5>0x0&&(_0x1945fa+='\x20'+_0x24075c[_0xc257('0x69')]+'\x20');_0x1945fa+=_0x24075c[_0xc257('0x68')][_0x25eae5]['group']?_0x210ba7(_0x24075c[_0xc257('0x68')][_0x25eae5][_0xc257('0x6a')]):_0x24075c[_0xc257('0x68')][_0x25eae5][_0xc257('0x6b')]+'\x20'+_0x24075c[_0xc257('0x68')][_0x25eae5]['condition']+(_0x35885f(_0x24075c[_0xc257('0x68')][_0x25eae5]['condition'])?'\x20'+_0x24075c[_0xc257('0x68')][_0x25eae5][_0xc257('0x6c')]:'');}return _0x1945fa+')';};var _0x1bb89e={'where':{'id':_0x246754[_0xc257('0x54')]['id']}},_0x291ef1,_0x558f73,_0x1e5def,_0x22ce49,_0x682f61;_0x1bb89e=_[_0xc257('0x48')]({},_0x1bb89e,_0x246754[_0xc257('0x43')]);return db[_0xc257('0x2f')][_0xc257('0x49')](_0x1bb89e)[_0xc257('0x26')](function(_0x39627c){if(_0x39627c){_0x291ef1=_0x39627c;return _0x39627c[_0xc257('0x6d')]();}return null;})[_0xc257('0x26')](function(_0x46f0a6){if(_0x46f0a6){if(!_0x46f0a6[_0xc257('0x3b')]){throw new db[(_0xc257('0x6e'))][(_0xc257('0x6f'))](_0xc257('0x70'),0x193);}_0x558f73=_0x46f0a6;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xc257('0x26')](function(_0x2a038d){if(_0x2a038d){_0x1e5def=_[_0xc257('0x71')](_0x2a038d,'id');var _0x3b3c16;var _0x4f529f=squel[_0xc257('0x72')]();_0x4f529f[_0xc257('0x73')](_0x291ef1[_0xc257('0x74')]);for(var _0x2ef080=0x0;_0x2ef080<_0x558f73['length'];_0x2ef080+=0x1){_0x3b3c16=_0x558f73[_0x2ef080][_0xc257('0x75')]?_0x1e5def[_0x558f73[_0x2ef080][_0xc257('0x75')]]['metric']:_0x558f73[_0x2ef080][_0xc257('0x6b')];_0x3b3c16=_0x558f73[_0x2ef080][_0xc257('0x76')]?_[_0xc257('0x77')](_0x6b9dbc[_0x558f73[_0x2ef080][_0xc257('0x76')]],'%s',_0x3b3c16):_0x3b3c16;_0x3b3c16=_0x558f73[_0x2ef080][_0xc257('0x78')]?_[_0xc257('0x77')](_0x22c074[_0x558f73[_0x2ef080][_0xc257('0x78')]],'%s',_0x3b3c16):_0x3b3c16;if(_0x558f73[_0x2ef080][_0xc257('0x79')]){_0x4f529f[_0xc257('0x6a')](_0x3b3c16);}_0x558f73[_0x2ef080][_0xc257('0x7a')]&&_0x4f529f[_0xc257('0x3e')](_0x3b3c16,_0x558f73[_0x2ef080][_0xc257('0x7a')]===_0xc257('0x7b')?![]:!![]);_0x4f529f[_0xc257('0x6b')](_0x3b3c16,_0x558f73[_0x2ef080][_0xc257('0x7c')]||_0x3b3c16);}if(_0x291ef1[_0xc257('0x7d')]){_0x291ef1['joins']=JSON[_0xc257('0x7e')](_0x291ef1[_0xc257('0x7d')]);for(var _0x4945ff=0x0;_0x4945ff<_0x291ef1['joins'][_0xc257('0x3b')];_0x4945ff+=0x1){if(_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x32')]&&_[_0xc257('0x65')](_0x487208,_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x32')])&&_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x7f')]&&_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x80')]&&_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x81')]){_0x4f529f[_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x32')]](_0x291ef1['joins'][_0x4945ff][_0xc257('0x80')],null,util[_0xc257('0x78')](_0xc257('0x82'),_0x291ef1[_0xc257('0x74')],_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x7f')],_0x291ef1[_0xc257('0x7d')][_0x4945ff][_0xc257('0x80')],_0x291ef1[_0xc257('0x7d')][_0x4945ff]['foreignKey']));}}}if(_0x291ef1['conditions']){_0x291ef1[_0xc257('0x83')]=JSON[_0xc257('0x7e')](_0x291ef1[_0xc257('0x83')]);_0x4f529f[_0xc257('0x40')](_0x210ba7(_0x291ef1[_0xc257('0x83')][_0xc257('0x6a')]));}_0x682f61=_0x4f529f[_0xc257('0x84')]();_0x4f529f[_0xc257('0x1e')](_0x550c0f);_0x4f529f['offset'](0x0);logger[_0xc257('0x85')]('Limited\x20Query:',_0x4f529f[_0xc257('0x86')]());return dbH[_0xc257('0x87')][_0xc257('0x35')](_0x4f529f[_0xc257('0x86')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x3403d2,null))[_0xc257('0x46')](handleError(_0x3403d2,null));};function runReport(_0x3e48f1,_0x10c414,_0x487a2b){var _0x5ee0b2=_0x10c414[_0xc257('0x2d')];var _0x31f82d=0xa;var _0x588c2c=[_0xc257('0x56'),_0xc257('0x57'),_0xc257('0x58'),_0xc257('0x59')];var _0x3192e8={'SUM':_0xc257('0x5a'),'COUNT':_0xc257('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xc257('0x89'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc257('0x5e'),'GROUP_CONCAT ASC':_0xc257('0x5f'),'GROUP_CONCAT DESC':_0xc257('0x60')};var _0x4b4add={'SEC_TO_TIME':_0xc257('0x61'),'DATE':_0xc257('0x62'),'HOUR':_0xc257('0x63'),'ROUND':_0xc257('0x64'),'UNIX_TIMESTAMP':_0xc257('0x8a')};var _0x20b73d=function(_0x55d4fa){return!_['includes']([_0xc257('0x8b'),_0xc257('0x8c'),_0xc257('0x66'),_0xc257('0x67')],_0x55d4fa);};var _0x149cdb=function(_0x8db7a7){if(!_0x8db7a7||!_0x8db7a7[_0xc257('0x68')]['length']){return'';}for(var _0x2dc09a='(',_0x275b67=0x0;_0x275b67<_0x8db7a7['rules'][_0xc257('0x3b')];_0x275b67+=0x1){_0x275b67>0x0&&(_0x2dc09a+='\x20'+_0x8db7a7[_0xc257('0x69')]+'\x20');_0x2dc09a+=_0x8db7a7[_0xc257('0x68')][_0x275b67][_0xc257('0x6a')]?_0x149cdb(_0x8db7a7[_0xc257('0x68')][_0x275b67]['group']):_0x8db7a7[_0xc257('0x68')][_0x275b67]['field']+'\x20'+_0x8db7a7[_0xc257('0x68')][_0x275b67][_0xc257('0x8d')]+(_0x20b73d(_0x8db7a7[_0xc257('0x68')][_0x275b67][_0xc257('0x8d')])?'\x20'+_0x8db7a7[_0xc257('0x68')][_0x275b67]['value']:'');}return _0x2dc09a+')';};var _0x37f680={'where':{'id':_0x3e48f1['id']}},_0x1e2545,_0x487a77,_0x1875af,_0x569e49,_0x52d5a0;_0x37f680=_['merge']({},_0x37f680,_0x487a2b);return db['AnalyticCustomReport']['find'](_0x37f680)[_0xc257('0x26')](function(_0xaf9cb5){if(_0xaf9cb5){_0x1e2545=_0xaf9cb5;return _0xaf9cb5[_0xc257('0x6d')]();}return null;})[_0xc257('0x26')](function(_0x5f0112){if(_0x5f0112){if(!_0x5f0112[_0xc257('0x3b')]){throw new db[(_0xc257('0x6e'))]['ValidationErrorItem'](_0xc257('0x70'),0x193);}_0x487a77=_0x5f0112;return db[_0xc257('0x8e')][_0xc257('0x8f')]({'raw':!![]});}return null;})['then'](function(_0x418a74){if(_0x418a74){_0x1875af=_[_0xc257('0x71')](_0x418a74,'id');var _0x72c8ab;var _0x4deacc=squel[_0xc257('0x72')]();_0x4deacc[_0xc257('0x73')](_0x1e2545[_0xc257('0x74')]);for(var _0x546f91=0x0;_0x546f91<_0x487a77[_0xc257('0x3b')];_0x546f91+=0x1){_0x72c8ab=_0x487a77[_0x546f91]['MetricId']?_0x1875af[_0x487a77[_0x546f91][_0xc257('0x75')]]['metric']:_0x487a77[_0x546f91][_0xc257('0x6b')];_0x72c8ab=_0x487a77[_0x546f91]['function']?_[_0xc257('0x77')](_0x3192e8[_0x487a77[_0x546f91][_0xc257('0x76')]],'%s',_0x72c8ab):_0x72c8ab;_0x72c8ab=_0x487a77[_0x546f91][_0xc257('0x78')]?_['replace'](_0x4b4add[_0x487a77[_0x546f91][_0xc257('0x78')]],'%s',_0x72c8ab):_0x72c8ab;if(_0x487a77[_0x546f91]['groupBy']){_0x4deacc[_0xc257('0x6a')](_0x72c8ab);}_0x487a77[_0x546f91][_0xc257('0x7a')]&&_0x4deacc[_0xc257('0x3e')](_0x72c8ab,_0x487a77[_0x546f91][_0xc257('0x7a')]==='DESC'?![]:!![]);_0x4deacc['field'](_0x72c8ab,_0x487a77[_0x546f91][_0xc257('0x7c')]||_0x72c8ab);}if(_0x1e2545[_0xc257('0x7d')]){_0x1e2545[_0xc257('0x7d')]=JSON[_0xc257('0x7e')](_0x1e2545[_0xc257('0x7d')]);for(var _0x171819=0x0;_0x171819<_0x1e2545[_0xc257('0x7d')][_0xc257('0x3b')];_0x171819+=0x1){if(_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x32')]&&_[_0xc257('0x65')](_0x588c2c,_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x32')])&&_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x7f')]&&_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x80')]&&_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x81')]){_0x4deacc[_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x32')]](_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x80')],null,util[_0xc257('0x78')]('%s.%s\x20=\x20%s.%s',_0x1e2545['table'],_0x1e2545[_0xc257('0x7d')][_0x171819]['parentKey'],_0x1e2545[_0xc257('0x7d')][_0x171819][_0xc257('0x80')],_0x1e2545['joins'][_0x171819][_0xc257('0x81')]));}}}if(_0x1e2545[_0xc257('0x83')]){_0x1e2545[_0xc257('0x83')]=JSON[_0xc257('0x7e')](_0x1e2545['conditions']);_0x4deacc[_0xc257('0x40')](_0x149cdb(_0x1e2545[_0xc257('0x83')][_0xc257('0x6a')]));}_0x52d5a0=_0x4deacc[_0xc257('0x84')]();_0x4deacc[_0xc257('0x1e')](_0x31f82d);_0x4deacc[_0xc257('0x1c')](0x0);return;}})[_0xc257('0x26')](function(){if(_0x10c414[_0xc257('0x90')]==='web'){return null;}var _0x14e253=_[_0xc257('0x48')](_0x10c414,{'name':_0x10c414[_0xc257('0x91')]||_0x10c414[_0xc257('0x2d')]||_0x1e2545['name'],'basename':_0x5ee0b2,'savename':util[_0xc257('0x78')](_0xc257('0x92'),_0x10c414[_0xc257('0x2d')]||_0x1e2545[_0xc257('0x2d')],require(_0xc257('0x93'))['generate'](0x4),_0x10c414[_0xc257('0x90')]||_0xc257('0x94')),'reportId':_0x1e2545['id'],'reportType':_0xc257('0x95')});return db['AnalyticExtractedReport'][_0xc257('0x4a')](_0x14e253,{'raw':!![]});})[_0xc257('0x26')](function(_0xf88c8c){if(_0x1e2545[_0xc257('0x74')]===_0xc257('0x96')){_0x52d5a0[_0xc257('0x40')](_0x1e2545['table']+_0xc257('0x97'),_0x10c414[_0xc257('0x98')],_0x10c414[_0xc257('0x99')]);}else{_0x52d5a0[_0xc257('0x40')](_0x1e2545[_0xc257('0x74')]+_0xc257('0x9a'),_0x10c414[_0xc257('0x98')],_0x10c414[_0xc257('0x99')]);}if(_0xf88c8c){logger[_0xc257('0x9b')]('Run\x20Query:',_0x52d5a0[_0xc257('0x86')]());require(_0xc257('0x9c'))['fork'](path[_0xc257('0x56')](__dirname,_0xc257('0x9d'),_0xf88c8c[_0xc257('0x90')]),[_0xf88c8c['id'],_0x52d5a0['toString'](),path[_0xc257('0x56')](__dirname,'../../files/reports',_0xf88c8c['savename']),_0x5ee0b2]);return _0xf88c8c;}else{var _0x245c47=squel['select']();_0x245c47[_0xc257('0x73')]('('+_0x52d5a0[_0xc257('0x86')]()+')',_0xc257('0x9e'));_0x245c47[_0xc257('0x6b')]('COUNT(*)','count');_0x52d5a0[_0xc257('0x1e')](_0x10c414[_0xc257('0x1e')]||_0x31f82d);_0x52d5a0[_0xc257('0x1c')](_0x10c414[_0xc257('0x1c')]||0x0);return dbH[_0xc257('0x87')][_0xc257('0x35')](_0x245c47['toString'](),{'type':dbH[_0xc257('0x87')][_0xc257('0x9f')]['SELECT']})[_0xc257('0x26')](function(_0x361e65){if(!_0x361e65['length']){_0x569e49=0x0;}else{_0x569e49=_0x361e65[0x0][_0xc257('0x1f')]||0x0;}return dbH['sequelize']['query'](_0x52d5a0[_0xc257('0x86')](),{'type':dbH[_0xc257('0x87')]['QueryTypes'][_0xc257('0xa0')]});})['then'](function(_0x548b0d){return{'rows':_0x548b0d||[],'count':_0x569e49};});}});}exports[_0xc257('0xa1')]=function(_0x101dd1,_0x2f6340){return runReport(_0x101dd1['params'],_0x101dd1[_0xc257('0x35')],_0x101dd1[_0xc257('0x43')])[_0xc257('0x26')](respondWithResult(_0x2f6340,null))[_0xc257('0x46')](handleError(_0x2f6340,null));};exports[_0xc257('0xa2')]=runReport;exports['query']=function(_0x5034e2,_0x4be061){var _0x3cd569=0xa;var _0x3bbe3e=[_0xc257('0x56'),_0xc257('0x57'),_0xc257('0x58'),'cross_join'];var _0x5cf15e={'SUM':_0xc257('0x5a'),'COUNT':_0xc257('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xc257('0x89'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc257('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc257('0x60')};var _0x28790c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc257('0x62'),'HOUR':_0xc257('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc257('0x8a')};var _0x17eb4c=function(_0x37887f){return!_['includes']([_0xc257('0x8b'),_0xc257('0x8c'),_0xc257('0x66'),_0xc257('0x67')],_0x37887f);};var _0x5640b7=function(_0x52a23c){if(!_0x52a23c||!_0x52a23c[_0xc257('0x68')][_0xc257('0x3b')]){return'';}for(var _0x439eb3='(',_0x16dd61=0x0;_0x16dd61<_0x52a23c[_0xc257('0x68')][_0xc257('0x3b')];_0x16dd61+=0x1){_0x16dd61>0x0&&(_0x439eb3+='\x20'+_0x52a23c[_0xc257('0x69')]+'\x20');_0x439eb3+=_0x52a23c['rules'][_0x16dd61]['group']?_0x5640b7(_0x52a23c['rules'][_0x16dd61][_0xc257('0x6a')]):_0x52a23c[_0xc257('0x68')][_0x16dd61]['field']+'\x20'+_0x52a23c['rules'][_0x16dd61][_0xc257('0x8d')]+(_0x17eb4c(_0x52a23c['rules'][_0x16dd61][_0xc257('0x8d')])?'\x20'+_0x52a23c[_0xc257('0x68')][_0x16dd61]['value']:'');}return _0x439eb3+')';};var _0x11dfc0={'where':{'id':_0x5034e2[_0xc257('0x54')]['id']}},_0x4b5423,_0x34ac11,_0x55f1d0,_0x427c66,_0x74f0cc;_0x11dfc0=_[_0xc257('0x48')]({},_0x11dfc0,_0x5034e2[_0xc257('0x43')]);return db[_0xc257('0x2f')][_0xc257('0x49')](_0x11dfc0)[_0xc257('0x26')](function(_0x5d77e3){if(_0x5d77e3){_0x4b5423=_0x5d77e3;return _0x5d77e3[_0xc257('0x6d')]();}return null;})[_0xc257('0x26')](function(_0x4156aa){if(_0x4156aa){if(!_0x4156aa[_0xc257('0x3b')]){throw new db[(_0xc257('0x6e'))][(_0xc257('0x6f'))](_0xc257('0x70'),0x193);}_0x34ac11=_0x4156aa;return db[_0xc257('0x8e')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1a93ff){if(_0x1a93ff){_0x55f1d0=_[_0xc257('0x71')](_0x1a93ff,'id');var _0x3a4fde;var _0x9fa223=squel[_0xc257('0x72')]();_0x9fa223[_0xc257('0x73')](_0x4b5423[_0xc257('0x74')]);for(var _0x24b230=0x0;_0x24b230<_0x34ac11['length'];_0x24b230+=0x1){_0x3a4fde=_0x34ac11[_0x24b230][_0xc257('0x75')]?_0x55f1d0[_0x34ac11[_0x24b230]['MetricId']][_0xc257('0xa3')]:_0x34ac11[_0x24b230][_0xc257('0x6b')];_0x3a4fde=_0x34ac11[_0x24b230][_0xc257('0x76')]?_['replace'](_0x5cf15e[_0x34ac11[_0x24b230][_0xc257('0x76')]],'%s',_0x3a4fde):_0x3a4fde;_0x3a4fde=_0x34ac11[_0x24b230][_0xc257('0x78')]?_[_0xc257('0x77')](_0x28790c[_0x34ac11[_0x24b230][_0xc257('0x78')]],'%s',_0x3a4fde):_0x3a4fde;if(_0x34ac11[_0x24b230]['groupBy']){_0x9fa223[_0xc257('0x6a')](_0x3a4fde);}_0x34ac11[_0x24b230][_0xc257('0x7a')]&&_0x9fa223[_0xc257('0x3e')](_0x3a4fde,_0x34ac11[_0x24b230][_0xc257('0x7a')]==='DESC'?![]:!![]);_0x9fa223[_0xc257('0x6b')](_0x3a4fde,_0x34ac11[_0x24b230][_0xc257('0x7c')]||_0x3a4fde);}if(_0x4b5423[_0xc257('0x7d')]){_0x4b5423[_0xc257('0x7d')]=JSON[_0xc257('0x7e')](_0x4b5423[_0xc257('0x7d')]);for(var _0x151e2e=0x0;_0x151e2e<_0x4b5423[_0xc257('0x7d')][_0xc257('0x3b')];_0x151e2e+=0x1){if(_0x4b5423['joins'][_0x151e2e][_0xc257('0x32')]&&_['includes'](_0x3bbe3e,_0x4b5423[_0xc257('0x7d')][_0x151e2e][_0xc257('0x32')])&&_0x4b5423[_0xc257('0x7d')][_0x151e2e][_0xc257('0x7f')]&&_0x4b5423['joins'][_0x151e2e][_0xc257('0x80')]&&_0x4b5423['joins'][_0x151e2e][_0xc257('0x81')]){_0x9fa223[_0x4b5423[_0xc257('0x7d')][_0x151e2e][_0xc257('0x32')]](_0x4b5423[_0xc257('0x7d')][_0x151e2e][_0xc257('0x80')],null,util[_0xc257('0x78')](_0xc257('0x82'),_0x4b5423[_0xc257('0x74')],_0x4b5423['joins'][_0x151e2e][_0xc257('0x7f')],_0x4b5423[_0xc257('0x7d')][_0x151e2e][_0xc257('0x80')],_0x4b5423[_0xc257('0x7d')][_0x151e2e][_0xc257('0x81')]));}}}if(_0x4b5423[_0xc257('0x83')]){_0x4b5423[_0xc257('0x83')]=JSON['parse'](_0x4b5423[_0xc257('0x83')]);_0x9fa223['where'](_0x5640b7(_0x4b5423[_0xc257('0x83')][_0xc257('0x6a')]));}_0x74f0cc=_0x9fa223['clone']();_0x9fa223[_0xc257('0x1e')](_0x3cd569);_0x9fa223[_0xc257('0x1c')](0x0);logger[_0xc257('0x85')]('Limited\x20Query:',_0x9fa223['toString']());return dbH[_0xc257('0x87')]['query'](_0x9fa223[_0xc257('0x86')](),{'type':dbH[_0xc257('0x87')][_0xc257('0x9f')][_0xc257('0xa0')]});}})[_0xc257('0x26')](function(){return{'sql':_0x74f0cc[_0xc257('0x86')]()};})['then'](respondWithResult(_0x4be061,null))[_0xc257('0x46')](handleError(_0x4be061,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a21bc59..133e18f 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 _0x35ec=['util','api','moment','request-promise','rimraf','exports','define','analytics_custom_reports'];(function(_0x19b2f2,_0x1541d9){var _0x54a80f=function(_0x2ea311){while(--_0x2ea311){_0x19b2f2['push'](_0x19b2f2['shift']());}};_0x54a80f(++_0x1541d9);}(_0x35ec,0x88));var _0xc35e=function(_0x5d0efe,_0xb47676){_0x5d0efe=_0x5d0efe-0x0;var _0x1e0abc=_0x35ec[_0x5d0efe];return _0x1e0abc;};'use strict';var _=require('lodash');var util=require(_0xc35e('0x0'));var logger=require('../../config/logger')(_0xc35e('0x1'));var moment=require(_0xc35e('0x2'));var BPromise=require('bluebird');var rp=require(_0xc35e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc35e('0x4'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xc35e('0x5')]=function(_0x304685,_0x597187){return _0x304685[_0xc35e('0x6')]('AnalyticCustomReport',attributes,{'tableName':_0xc35e('0x7'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 1c6afc2..e24872e 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 _0x4a6a=['error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x4a6a,0x154));var _0xa4a6=function(_0xa21642,_0x30b364){_0xa21642=_0xa21642-0x0;var _0x19fb3e=_0x4a6a[_0xa21642];return _0x19fb3e;};'use strict';var _=require(_0xa4a6('0x0'));var util=require(_0xa4a6('0x1'));var moment=require('moment');var BPromise=require(_0xa4a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a6('0x3'));var db=require(_0xa4a6('0x4'))['db'];var utils=require(_0xa4a6('0x5'));var logger=require(_0xa4a6('0x6'))(_0xa4a6('0x7'));var config=require(_0xa4a6('0x8'));var jayson=require(_0xa4a6('0x9'));var client=jayson[_0xa4a6('0xa')][_0xa4a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x583d69,_0x17c261,_0x11d48e){return new BPromise(function(_0xb9a728,_0x4337d9){return client[_0xa4a6('0xc')](_0x583d69,_0x11d48e)[_0xa4a6('0xd')](function(_0x525c57){logger[_0xa4a6('0xe')](_0xa4a6('0xf'),_0x17c261,_0xa4a6('0x10'));logger[_0xa4a6('0x11')](_0xa4a6('0x12'),_0x17c261,_0xa4a6('0x10'),JSON[_0xa4a6('0x13')](_0x525c57));if(_0x525c57[_0xa4a6('0x14')]){if(_0x525c57['error'][_0xa4a6('0x15')]===0x1f4){logger[_0xa4a6('0x14')](_0xa4a6('0xf'),_0x17c261,_0x525c57[_0xa4a6('0x14')][_0xa4a6('0x16')]);return _0x4337d9(_0x525c57[_0xa4a6('0x14')]['message']);}logger[_0xa4a6('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x17c261,_0x525c57['error'][_0xa4a6('0x16')]);return _0xb9a728(_0x525c57[_0xa4a6('0x14')][_0xa4a6('0x16')]);}else{logger[_0xa4a6('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x17c261,_0xa4a6('0x10'));_0xb9a728(_0x525c57[_0xa4a6('0x17')][_0xa4a6('0x16')]);}})['catch'](function(_0x5a6def){logger[_0xa4a6('0x14')](_0xa4a6('0xf'),_0x17c261,_0x5a6def);_0x4337d9(_0x5a6def);});});} \ No newline at end of file +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 diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index aae3f84..48d673d 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 _0x07ea=['/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','/:id/query','query','create','put'];(function(_0xb06b23,_0x309bb1){var _0x2ee782=function(_0x4f7639){while(--_0x4f7639){_0xb06b23['push'](_0xb06b23['shift']());}};_0x2ee782(++_0x309bb1);}(_0x07ea,0x116));var _0xa07e=function(_0x20b2ee,_0x2f5f73){_0x20b2ee=_0x20b2ee-0x0;var _0xa9ec2e=_0x07ea[_0x20b2ee];return _0xa9ec2e;};'use strict';var multer=require('multer');var util=require(_0xa07e('0x0'));var path=require('path');var timeout=require(_0xa07e('0x1'));var express=require('express');var router=express[_0xa07e('0x2')]();var fs_extra=require(_0xa07e('0x3'));var auth=require(_0xa07e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa07e('0x5'));router[_0xa07e('0x6')]('/',auth[_0xa07e('0x7')](),controller[_0xa07e('0x8')]);router[_0xa07e('0x6')]('/:id',auth[_0xa07e('0x7')](),controller['show']);router[_0xa07e('0x6')](_0xa07e('0x9'),auth[_0xa07e('0x7')](),controller[_0xa07e('0xa')]);router[_0xa07e('0x6')](_0xa07e('0xb'),auth[_0xa07e('0x7')](),controller['run']);router[_0xa07e('0x6')](_0xa07e('0xc'),auth[_0xa07e('0x7')](),controller[_0xa07e('0xd')]);router['post']('/',auth[_0xa07e('0x7')](),controller[_0xa07e('0xe')]);router[_0xa07e('0xf')](_0xa07e('0x10'),auth[_0xa07e('0x7')](),controller[_0xa07e('0x11')]);router[_0xa07e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa07e('0x13')]);module[_0xa07e('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 30772e4..8baf56d 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x46e18f,_0xd952a7){_0x46e18f=_0x46e18f-0x0;var _0xc979ea=_0xdc97[_0x46e18f];return _0xc979ea;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9725813..17b5c64 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 _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','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','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x37d5d2,_0x176920){var _0x46fe98=function(_0x35252f){while(--_0x35252f){_0x37d5d2['push'](_0x37d5d2['shift']());}};_0x46fe98(++_0x176920);}(_0x31f0,0xb7));var _0x031f=function(_0x14f3f7,_0x4b4c39){_0x14f3f7=_0x14f3f7-0x0;var _0x5b2d13=_0x31f0[_0x14f3f7];return _0x5b2d13;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 61c0a3b..8117b67 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 _0x8f02=['../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x3e478c,_0x3afee8){var _0x3a0906=function(_0x580d99){while(--_0x580d99){_0x3e478c['push'](_0x3e478c['shift']());}};_0x3a0906(++_0x3afee8);}(_0x8f02,0x7e));var _0x28f0=function(_0x35501d,_0x2e059f){_0x35501d=_0x35501d-0x0;var _0x1aa63a=_0x8f02[_0x35501d];return _0x1aa63a;};'use strict';var _=require(_0x28f0('0x0'));var util=require(_0x28f0('0x1'));var logger=require(_0x28f0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x28f0('0x3'));var rp=require(_0x28f0('0x4'));var fs=require('fs');var path=require(_0x28f0('0x5'));var rimraf=require('rimraf');var config=require(_0x28f0('0x6'));var attributes=require(_0x28f0('0x7'));module['exports']=function(_0x270689,_0x1a83a8){return _0x270689[_0x28f0('0x8')](_0x28f0('0x9'),attributes,{'tableName':_0x28f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 6e14479..393a015 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 _0xef33=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','randomstring'];(function(_0x13eac5,_0x1e08c0){var _0x1c3715=function(_0x576e4c){while(--_0x576e4c){_0x13eac5['push'](_0x13eac5['shift']());}};_0x1c3715(++_0x1e08c0);}(_0xef33,0xd5));var _0x3ef3=function(_0x505eb7,_0x2f5468){_0x505eb7=_0x505eb7-0x0;var _0x2d3152=_0xef33[_0x505eb7];return _0x2d3152;};'use strict';var _=require('lodash');var util=require(_0x3ef3('0x0'));var moment=require(_0x3ef3('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ef3('0x2'));var fs=require('fs');var Redis=require(_0x3ef3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ef3('0x4'));var logger=require(_0x3ef3('0x5'))(_0x3ef3('0x6'));var config=require(_0x3ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3ef3('0x8')][_0x3ef3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3a87,_0x2e2d6d,_0x3bb34f){return new BPromise(function(_0x25131a,_0x266aa6){return client['request'](_0x2b3a87,_0x3bb34f)['then'](function(_0x3f068d){logger[_0x3ef3('0xa')](_0x3ef3('0xb'),_0x2e2d6d,_0x3ef3('0xc'));logger[_0x3ef3('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2e2d6d,'request\x20sent',JSON[_0x3ef3('0xe')](_0x3f068d));if(_0x3f068d[_0x3ef3('0xf')]){if(_0x3f068d[_0x3ef3('0xf')][_0x3ef3('0x10')]===0x1f4){logger[_0x3ef3('0xf')](_0x3ef3('0xb'),_0x2e2d6d,_0x3f068d['error']['message']);return _0x266aa6(_0x3f068d[_0x3ef3('0xf')]['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e2d6d,_0x3f068d[_0x3ef3('0xf')]['message']);return _0x25131a(_0x3f068d[_0x3ef3('0xf')][_0x3ef3('0x11')]);}else{logger[_0x3ef3('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e2d6d,_0x3ef3('0xc'));_0x25131a(_0x3f068d['result']['message']);}})['catch'](function(_0x4931c3){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e2d6d,_0x4931c3);_0x266aa6(_0x4931c3);});});} \ No newline at end of file +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 diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e19eeb5..aaf5dd5 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 _0xf319=['../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0xf319,0xe8));var _0x9f31=function(_0x5ad958,_0x17b04f){_0x5ad958=_0x5ad958-0x0;var _0x4bec98=_0xf319[_0x5ad958];return _0x4bec98;};'use strict';var multer=require(_0x9f31('0x0'));var util=require(_0x9f31('0x1'));var path=require(_0x9f31('0x2'));var timeout=require(_0x9f31('0x3'));var express=require(_0x9f31('0x4'));var router=express[_0x9f31('0x5')]();var fs_extra=require(_0x9f31('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9f31('0x7'));var config=require(_0x9f31('0x8'));var controller=require(_0x9f31('0x9'));router['get']('/',auth[_0x9f31('0xa')](),controller['index']);router[_0x9f31('0xb')]('/:id',auth[_0x9f31('0xa')](),controller[_0x9f31('0xc')]);router[_0x9f31('0xb')](_0x9f31('0xd'),auth[_0x9f31('0xa')](),controller['preview']);router[_0x9f31('0xb')](_0x9f31('0xe'),auth[_0x9f31('0xa')](),controller[_0x9f31('0xf')]);router[_0x9f31('0xb')](_0x9f31('0x10'),auth[_0x9f31('0xa')](),controller[_0x9f31('0x11')]);router[_0x9f31('0x12')]('/',auth[_0x9f31('0xa')](),controller[_0x9f31('0x13')]);router[_0x9f31('0x14')](_0x9f31('0x15'),auth[_0x9f31('0xa')](),controller['update']);router[_0x9f31('0x16')](_0x9f31('0x15'),auth[_0x9f31('0xa')](),controller['destroy']);module[_0x9f31('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 623a65c..44806c4 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 _0x7772=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','xlsx','csv','DATE','Loading','manual','INTEGER'];(function(_0x19550e,_0x45e4c4){var _0x18cfca=function(_0x2e254c){while(--_0x2e254c){_0x19550e['push'](_0x19550e['shift']());}};_0x18cfca(++_0x45e4c4);}(_0x7772,0x139));var _0x2777=function(_0x173c88,_0x1d39c9){_0x173c88=_0x173c88-0x0;var _0x5e92d8=_0x7772[_0x173c88];return _0x5e92d8;};'use strict';var Sequelize=require(_0x2777('0x0'));var moment=require(_0x2777('0x1'));module[_0x2777('0x2')]={'name':{'type':Sequelize[_0x2777('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x2777('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x2777('0x4')]('csv','pdf',_0x2777('0x5')),'allowNull':![],'defaultValue':_0x2777('0x6')},'savename':{'type':Sequelize[_0x2777('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x2777('0x7')]},'endDate':{'type':Sequelize[_0x2777('0x7')]},'status':{'type':Sequelize[_0x2777('0x3')],'defaultValue':_0x2777('0x8')},'type':{'type':Sequelize['ENUM'](_0x2777('0x9'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x2777('0xa')](0xb)[_0x2777('0xb')]},'reportType':{'type':Sequelize[_0x2777('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5ee9db2..c7acbf2 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 _0xd835=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd835,0x139));var _0x5d83=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0xd835[_0x40b3f2];return _0x4ce90c;};'use strict';var emlformat=require(_0x5d83('0x0'));var rimraf=require(_0x5d83('0x1'));var zipdir=require(_0x5d83('0x2'));var jsonpatch=require(_0x5d83('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d83('0x4'));var util=require(_0x5d83('0x5'));var path=require(_0x5d83('0x6'));var sox=require(_0x5d83('0x7'));var csv=require(_0x5d83('0x8'));var ejs=require(_0x5d83('0x9'));var fs=require('fs');var fs_extra=require(_0x5d83('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d83('0xb'));var deskjs=require(_0x5d83('0xc'));var toCsv=require(_0x5d83('0x8'));var querystring=require(_0x5d83('0xd'));var Papa=require(_0x5d83('0xe'));var Redis=require('ioredis');var authService=require(_0x5d83('0xf'));var qs=require(_0x5d83('0x10'));var as=require(_0x5d83('0x11'));var hardwareService=require(_0x5d83('0x12'));var logger=require(_0x5d83('0x13'))(_0x5d83('0x14'));var utils=require(_0x5d83('0x15'));var config=require(_0x5d83('0x16'));var licenseUtil=require(_0x5d83('0x17'));var db=require(_0x5d83('0x18'))['db'];function respondWithStatusCode(_0x158d13,_0x437b6f){_0x437b6f=_0x437b6f||0xcc;return function(_0x149fcd){if(_0x149fcd){return _0x158d13[_0x5d83('0x19')](_0x437b6f);}return _0x158d13[_0x5d83('0x1a')](_0x437b6f)[_0x5d83('0x1b')]();};}function respondWithResult(_0x3bb0cf,_0x5c8985){_0x5c8985=_0x5c8985||0xc8;return function(_0x4cccaa){if(_0x4cccaa){return _0x3bb0cf[_0x5d83('0x1a')](_0x5c8985)[_0x5d83('0x1c')](_0x4cccaa);}};}function respondWithFilteredResult(_0x40a85e,_0x51fb08){return function(_0x1617eb){if(_0x1617eb){var _0x2fc181=typeof _0x51fb08[_0x5d83('0x1d')]==='undefined'&&typeof _0x51fb08[_0x5d83('0x1e')]===_0x5d83('0x1f');var _0x4914e5=_0x1617eb['count'];var _0xcc90a9=_0x2fc181?0x0:_0x51fb08[_0x5d83('0x1d')];var _0x4f3f17=_0x2fc181?_0x1617eb[_0x5d83('0x20')]:_0x51fb08['offset']+_0x51fb08[_0x5d83('0x1e')];var _0x101f5b;if(_0x4f3f17>=_0x4914e5){_0x4f3f17=_0x4914e5;_0x101f5b=0xc8;}else{_0x101f5b=0xce;}_0x40a85e[_0x5d83('0x1a')](_0x101f5b);return _0x40a85e[_0x5d83('0x21')]('Content-Range',_0xcc90a9+'-'+_0x4f3f17+'/'+_0x4914e5)['json'](_0x1617eb);}return null;};}function patchUpdates(_0x23a56d){return function(_0x2e1d60){try{jsonpatch['apply'](_0x2e1d60,_0x23a56d,!![]);}catch(_0x36516a){return BPromise[_0x5d83('0x22')](_0x36516a);}return _0x2e1d60[_0x5d83('0x23')]();};}function saveUpdates(_0x354de4,_0x1fcce1){return function(_0x19c47e){if(_0x19c47e){return _0x19c47e[_0x5d83('0x24')](_0x354de4)['then'](function(_0x56f5a0){return _0x56f5a0;});}return null;};}function removeEntity(_0x1afc48,_0x316978){return function(_0x41c6b6){if(_0x41c6b6){return _0x41c6b6[_0x5d83('0x25')]()[_0x5d83('0x26')](function(){var _0x45c8e7=_0x41c6b6[_0x5d83('0x27')]({'plain':!![]});var _0x5f009d='ExtractedReports';return db[_0x5d83('0x28')]['destroy']({'where':{'type':_0x5f009d,'resourceId':_0x45c8e7['id']}})['then'](function(){return _0x41c6b6;});})['then'](function(){_0x1afc48[_0x5d83('0x1a')](0xcc)[_0x5d83('0x1b')]();});}};}function handleEntityNotFound(_0xaceffb,_0x5c5293){return function(_0x2130b3){if(!_0x2130b3){_0xaceffb['sendStatus'](0x194);}return _0x2130b3;};}function handleError(_0x14d7ee,_0x5e655a){_0x5e655a=_0x5e655a||0x1f4;return function(_0x400af9){logger[_0x5d83('0x29')](_0x400af9[_0x5d83('0x2a')]);if(_0x400af9[_0x5d83('0x2b')]){delete _0x400af9[_0x5d83('0x2b')];}_0x14d7ee[_0x5d83('0x1a')](_0x5e655a)[_0x5d83('0x2c')](_0x400af9);};}exports['index']=function(_0x25a22d,_0x535f70){var _0x4fcc6b={},_0x439b33={},_0x35216d={'count':0x0,'rows':[]};var _0x248c8f=_[_0x5d83('0x2d')](db[_0x5d83('0x2e')][_0x5d83('0x2f')],function(_0x108cad){return{'name':_0x108cad[_0x5d83('0x30')],'type':_0x108cad['type']['key']};});_0x439b33[_0x5d83('0x31')]=_[_0x5d83('0x2d')](_0x248c8f,_0x5d83('0x2b'));_0x439b33[_0x5d83('0x32')]=_[_0x5d83('0x33')](_0x25a22d['query']);_0x439b33['filters']=_[_0x5d83('0x34')](_0x439b33[_0x5d83('0x31')],_0x439b33[_0x5d83('0x32')]);_0x4fcc6b[_0x5d83('0x35')]=_[_0x5d83('0x34')](_0x439b33['model'],qs['fields'](_0x25a22d[_0x5d83('0x32')][_0x5d83('0x36')]));_0x4fcc6b[_0x5d83('0x35')]=_0x4fcc6b[_0x5d83('0x35')][_0x5d83('0x37')]?_0x4fcc6b['attributes']:_0x439b33[_0x5d83('0x31')];if(!_0x25a22d['query'][_0x5d83('0x38')](_0x5d83('0x39'))){_0x4fcc6b[_0x5d83('0x1e')]=qs['limit'](_0x25a22d[_0x5d83('0x32')][_0x5d83('0x1e')]);_0x4fcc6b['offset']=qs['offset'](_0x25a22d['query'][_0x5d83('0x1d')]);}_0x4fcc6b['order']=qs[_0x5d83('0x3a')](_0x25a22d[_0x5d83('0x32')][_0x5d83('0x3a')]);_0x4fcc6b[_0x5d83('0x3b')]=qs[_0x5d83('0x3c')](_[_0x5d83('0x3d')](_0x25a22d[_0x5d83('0x32')],_0x439b33[_0x5d83('0x3c')]),_0x248c8f);if(_0x25a22d[_0x5d83('0x32')][_0x5d83('0x3e')]){_0x4fcc6b['where']=_[_0x5d83('0x3f')](_0x4fcc6b['where'],{'$or':_[_0x5d83('0x2d')](_0x248c8f,function(_0x18e4e3){if(_0x18e4e3[_0x5d83('0x40')]!==_0x5d83('0x41')){var _0x4aa5ac={};_0x4aa5ac[_0x18e4e3[_0x5d83('0x2b')]]={'$like':'%'+_0x25a22d[_0x5d83('0x32')]['filter']+'%'};return _0x4aa5ac;}})});}_0x4fcc6b=_['merge']({},_0x4fcc6b,_0x25a22d[_0x5d83('0x42')]);var _0x9a783c={'where':_0x4fcc6b['where']};return db[_0x5d83('0x2e')][_0x5d83('0x20')](_0x9a783c)[_0x5d83('0x26')](function(_0x5f04b5){_0x35216d[_0x5d83('0x20')]=_0x5f04b5;if(_0x25a22d[_0x5d83('0x32')][_0x5d83('0x43')]){_0x4fcc6b[_0x5d83('0x44')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x5d83('0x45')](_0x4fcc6b);})['then'](function(_0x1c9707){_0x35216d[_0x5d83('0x46')]=_0x1c9707;return _0x35216d;})[_0x5d83('0x26')](respondWithFilteredResult(_0x535f70,_0x4fcc6b))[_0x5d83('0x47')](handleError(_0x535f70,null));};exports[_0x5d83('0x48')]=function(_0x1ea1e5,_0x2913ac){var _0x1fff6f={'raw':!![],'where':{'id':_0x1ea1e5[_0x5d83('0x49')]['id']}},_0x59522f={};_0x59522f[_0x5d83('0x31')]=_[_0x5d83('0x33')](db[_0x5d83('0x2e')][_0x5d83('0x2f')]);_0x59522f[_0x5d83('0x32')]=_[_0x5d83('0x33')](_0x1ea1e5[_0x5d83('0x32')]);_0x59522f[_0x5d83('0x3c')]=_[_0x5d83('0x34')](_0x59522f[_0x5d83('0x31')],_0x59522f['query']);_0x1fff6f[_0x5d83('0x35')]=_[_0x5d83('0x34')](_0x59522f['model'],qs[_0x5d83('0x36')](_0x1ea1e5[_0x5d83('0x32')][_0x5d83('0x36')]));_0x1fff6f[_0x5d83('0x35')]=_0x1fff6f[_0x5d83('0x35')][_0x5d83('0x37')]?_0x1fff6f[_0x5d83('0x35')]:_0x59522f[_0x5d83('0x31')];if(_0x1ea1e5[_0x5d83('0x32')]['includeAll']){_0x1fff6f[_0x5d83('0x44')]=[{'all':!![]}];}_0x1fff6f=_['merge']({},_0x1fff6f,_0x1ea1e5[_0x5d83('0x42')]);return db[_0x5d83('0x2e')]['find'](_0x1fff6f)['then'](handleEntityNotFound(_0x2913ac,null))['then'](respondWithResult(_0x2913ac,null))['catch'](handleError(_0x2913ac,null));};exports['create']=function(_0xbaa5d5,_0x1c4fec){return db[_0x5d83('0x2e')][_0x5d83('0x4a')](_0xbaa5d5['body'],{})[_0x5d83('0x26')](function(_0x1b14c3){var _0x2deada=_0xbaa5d5['user'][_0x5d83('0x27')]({'plain':!![]});if(!_0x2deada)throw new Error(_0x5d83('0x4b'));if(_0x2deada[_0x5d83('0x4c')]===_0x5d83('0x4d')){var _0x3b3b08=_0x1b14c3[_0x5d83('0x27')]({'plain':!![]});var _0x473541=_0x5d83('0x4e');return db[_0x5d83('0x4f')][_0x5d83('0x50')]({'where':{'name':_0x473541,'userProfileId':_0x2deada[_0x5d83('0x51')]},'raw':!![]})[_0x5d83('0x26')](function(_0x3e051f){if(_0x3e051f&&_0x3e051f[_0x5d83('0x52')]===0x0){return db[_0x5d83('0x28')]['create']({'name':_0x3b3b08['name'],'resourceId':_0x3b3b08['id'],'type':_0x3e051f['name'],'sectionId':_0x3e051f['id']},{})[_0x5d83('0x26')](function(){return _0x1b14c3;});}else{return _0x1b14c3;}})['catch'](function(_0x56bd9d){logger[_0x5d83('0x29')](_0x5d83('0x53'),_0x56bd9d);throw _0x56bd9d;});}return _0x1b14c3;})[_0x5d83('0x26')](respondWithResult(_0x1c4fec,0xc9))[_0x5d83('0x47')](handleError(_0x1c4fec,null));};exports[_0x5d83('0x24')]=function(_0x2d23ca,_0x576460){if(_0x2d23ca[_0x5d83('0x54')]['id']){delete _0x2d23ca[_0x5d83('0x54')]['id'];}return db[_0x5d83('0x2e')][_0x5d83('0x50')]({'where':{'id':_0x2d23ca['params']['id']}})['then'](handleEntityNotFound(_0x576460,null))[_0x5d83('0x26')](saveUpdates(_0x2d23ca[_0x5d83('0x54')],null))[_0x5d83('0x26')](respondWithResult(_0x576460,null))[_0x5d83('0x47')](handleError(_0x576460,null));};exports['destroy']=function(_0x1fd30d,_0x179cc1){return db[_0x5d83('0x2e')]['find']({'where':{'id':_0x1fd30d[_0x5d83('0x49')]['id']}})[_0x5d83('0x26')](handleEntityNotFound(_0x179cc1,null))[_0x5d83('0x26')](removeEntity(_0x179cc1,null))['catch'](handleError(_0x179cc1,null));};exports[_0x5d83('0x55')]=function(_0x37f9d7,_0xdf15ca,_0x255972){return db[_0x5d83('0x2e')][_0x5d83('0x50')]({'where':{'id':_0x37f9d7['params']['id']},'attributes':[_0x5d83('0x2b'),_0x5d83('0x56'),_0x5d83('0x57'),_0x5d83('0x58')],'raw':!![]})[_0x5d83('0x26')](handleEntityNotFound(_0xdf15ca,null))[_0x5d83('0x26')](function(_0x305ae2){if(_0x305ae2){if(!fs['existsSync'](path[_0x5d83('0x59')](config[_0x5d83('0x5a')],'server/files/reports',_0x305ae2[_0x5d83('0x57')]))){throw new db['Sequelize'][(_0x5d83('0x5b'))](_0x5d83('0x5c'));}if(_0x37f9d7[_0x5d83('0x32')][_0x5d83('0x5d')]){return _0xdf15ca[_0x5d83('0x19')](0xc8);}return _0xdf15ca[_0x5d83('0x55')](path[_0x5d83('0x59')](config[_0x5d83('0x5a')],'server/files/reports',_0x305ae2[_0x5d83('0x57')]),util[_0x5d83('0x5e')](_0x5d83('0x5f'),_0x305ae2[_0x5d83('0x56')]||_0x305ae2[_0x5d83('0x2b')],_0x305ae2['output'][_0x5d83('0x60')]()));}})['catch'](handleError(_0xdf15ca,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 6003423..24ce7a1 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 _0xeadc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports'];(function(_0x3a4cb6,_0x526438){var _0x125bca=function(_0x4b591b){while(--_0x4b591b){_0x3a4cb6['push'](_0x3a4cb6['shift']());}};_0x125bca(++_0x526438);}(_0xeadc,0x17a));var _0xcead=function(_0x31b9e6,_0x5d4d22){_0x31b9e6=_0x31b9e6-0x0;var _0x107c70=_0xeadc[_0x31b9e6];return _0x107c70;};'use strict';var _=require(_0xcead('0x0'));var util=require(_0xcead('0x1'));var logger=require(_0xcead('0x2'))(_0xcead('0x3'));var moment=require(_0xcead('0x4'));var BPromise=require(_0xcead('0x5'));var rp=require(_0xcead('0x6'));var fs=require('fs');var path=require(_0xcead('0x7'));var rimraf=require(_0xcead('0x8'));var config=require(_0xcead('0x9'));var attributes=require(_0xcead('0xa'));module[_0xcead('0xb')]=function(_0x4409d2,_0x9c9c0d){return _0x4409d2[_0xcead('0xc')]('AnalyticExtractedReport',attributes,{'tableName':_0xcead('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 2f215ca..221004f 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 _0x9b11=['code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5dec4c,_0x5ae5f9){var _0x131fb5=function(_0x58960d){while(--_0x58960d){_0x5dec4c['push'](_0x5dec4c['shift']());}};_0x131fb5(++_0x5ae5f9);}(_0x9b11,0x12b));var _0x19b1=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0x9b11[_0x557f5f];return _0x196eba;};'use strict';var _=require(_0x19b1('0x0'));var util=require(_0x19b1('0x1'));var moment=require('moment');var BPromise=require(_0x19b1('0x2'));var rs=require(_0x19b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x19b1('0x4'));var logger=require(_0x19b1('0x5'))(_0x19b1('0x6'));var config=require(_0x19b1('0x7'));var jayson=require(_0x19b1('0x8'));var client=jayson[_0x19b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1717a4,_0x16baf0,_0x419c82){return new BPromise(function(_0x564617,_0xfe0da7){return client['request'](_0x1717a4,_0x419c82)['then'](function(_0x49b7d3){logger[_0x19b1('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x16baf0,_0x19b1('0xb'));logger[_0x19b1('0xc')](_0x19b1('0xd'),_0x16baf0,_0x19b1('0xb'),JSON[_0x19b1('0xe')](_0x49b7d3));if(_0x49b7d3[_0x19b1('0xf')]){if(_0x49b7d3['error'][_0x19b1('0x10')]===0x1f4){logger['error'](_0x19b1('0x11'),_0x16baf0,_0x49b7d3[_0x19b1('0xf')]['message']);return _0xfe0da7(_0x49b7d3[_0x19b1('0xf')][_0x19b1('0x12')]);}logger[_0x19b1('0xf')](_0x19b1('0x11'),_0x16baf0,_0x49b7d3[_0x19b1('0xf')]['message']);return _0x564617(_0x49b7d3[_0x19b1('0xf')][_0x19b1('0x12')]);}else{logger[_0x19b1('0xa')](_0x19b1('0x11'),_0x16baf0,_0x19b1('0xb'));_0x564617(_0x49b7d3[_0x19b1('0x13')][_0x19b1('0x12')]);}})[_0x19b1('0x14')](function(_0x370de1){logger[_0x19b1('0xf')](_0x19b1('0x11'),_0x16baf0,_0x370de1);_0xfe0da7(_0x370de1);});});} \ No newline at end of file +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 diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 39b6076..34db31f 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 _0xa1b6=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put'];(function(_0x1a5946,_0x426991){var _0x25e9d5=function(_0x44e1ce){while(--_0x44e1ce){_0x1a5946['push'](_0x1a5946['shift']());}};_0x25e9d5(++_0x426991);}(_0xa1b6,0x174));var _0x6a1b=function(_0x5be116,_0x1f8089){_0x5be116=_0x5be116-0x0;var _0x3214cd=_0xa1b6[_0x5be116];return _0x3214cd;};'use strict';var multer=require(_0x6a1b('0x0'));var util=require(_0x6a1b('0x1'));var path=require(_0x6a1b('0x2'));var timeout=require(_0x6a1b('0x3'));var express=require(_0x6a1b('0x4'));var router=express[_0x6a1b('0x5')]();var fs_extra=require(_0x6a1b('0x6'));var auth=require(_0x6a1b('0x7'));var interaction=require(_0x6a1b('0x8'));var config=require('../../config/environment');var controller=require(_0x6a1b('0x9'));router[_0x6a1b('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a1b('0xb')]);router[_0x6a1b('0xa')](_0x6a1b('0xc'),auth[_0x6a1b('0xd')](),controller[_0x6a1b('0xe')]);router[_0x6a1b('0xa')](_0x6a1b('0xf'),auth[_0x6a1b('0xd')](),controller['download']);router[_0x6a1b('0x10')]('/',auth[_0x6a1b('0xd')](),controller[_0x6a1b('0x11')]);router[_0x6a1b('0x12')](_0x6a1b('0xc'),auth[_0x6a1b('0xd')](),controller[_0x6a1b('0x13')]);router[_0x6a1b('0x14')](_0x6a1b('0xc'),auth[_0x6a1b('0xd')](),controller[_0x6a1b('0x15')]);module[_0x6a1b('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 2b22677..4e14d61 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 _0xca00=['sequelize','exports','TEXT','STRING'];(function(_0x1a6aab,_0xf85d2f){var _0x3d933e=function(_0x3dccb4){while(--_0x3dccb4){_0x1a6aab['push'](_0x1a6aab['shift']());}};_0x3d933e(++_0xf85d2f);}(_0xca00,0x78));var _0x0ca0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca00[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0ca0('0x0'));module[_0x0ca0('0x1')]={'field':{'type':Sequelize[_0x0ca0('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x0ca0('0x3')]},'format':{'type':Sequelize[_0x0ca0('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0ca0('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e2ba3ae..6e75715 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 _0xea61=['AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','bulkCreate','bulkDestroy','ids','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index'];(function(_0x4ca3e3,_0x11b189){var _0x2d0de7=function(_0x1f1d63){while(--_0x1f1d63){_0x4ca3e3['push'](_0x4ca3e3['shift']());}};_0x2d0de7(++_0x11b189);}(_0xea61,0x16e));var _0x1ea6=function(_0x27f77a,_0x2c5d10){_0x27f77a=_0x27f77a-0x0;var _0x118e86=_0xea61[_0x27f77a];return _0x118e86;};'use strict';var emlformat=require(_0x1ea6('0x0'));var rimraf=require(_0x1ea6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1ea6('0x2'));var moment=require('moment');var BPromise=require(_0x1ea6('0x3'));var Mustache=require(_0x1ea6('0x4'));var util=require(_0x1ea6('0x5'));var path=require('path');var sox=require(_0x1ea6('0x6'));var csv=require(_0x1ea6('0x7'));var ejs=require(_0x1ea6('0x8'));var fs=require('fs');var fs_extra=require(_0x1ea6('0x9'));var _=require(_0x1ea6('0xa'));var squel=require(_0x1ea6('0xb'));var crypto=require(_0x1ea6('0xc'));var jsforce=require(_0x1ea6('0xd'));var deskjs=require(_0x1ea6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ea6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1ea6('0x10'));var qs=require(_0x1ea6('0x11'));var as=require(_0x1ea6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ea6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1ea6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d04b2,_0x415fe7){_0x415fe7=_0x415fe7||0xcc;return function(_0xa3c8e1){if(_0xa3c8e1){return _0x2d04b2[_0x1ea6('0x15')](_0x415fe7);}return _0x2d04b2[_0x1ea6('0x16')](_0x415fe7)[_0x1ea6('0x17')]();};}function respondWithResult(_0x443e3f,_0x1750a1){_0x1750a1=_0x1750a1||0xc8;return function(_0x1dc9a6){if(_0x1dc9a6){return _0x443e3f[_0x1ea6('0x16')](_0x1750a1)[_0x1ea6('0x18')](_0x1dc9a6);}};}function respondWithFilteredResult(_0x3966bb,_0x417f71){return function(_0x31ff35){if(_0x31ff35){var _0x23ae3d=typeof _0x417f71[_0x1ea6('0x19')]===_0x1ea6('0x1a')&&typeof _0x417f71['limit']==='undefined';var _0x4b9fc5=_0x31ff35['count'];var _0x4b4053=_0x23ae3d?0x0:_0x417f71['offset'];var _0x1225bd=_0x23ae3d?_0x31ff35['count']:_0x417f71[_0x1ea6('0x19')]+_0x417f71[_0x1ea6('0x1b')];var _0x474e5e;if(_0x1225bd>=_0x4b9fc5){_0x1225bd=_0x4b9fc5;_0x474e5e=0xc8;}else{_0x474e5e=0xce;}_0x3966bb[_0x1ea6('0x16')](_0x474e5e);return _0x3966bb[_0x1ea6('0x1c')](_0x1ea6('0x1d'),_0x4b4053+'-'+_0x1225bd+'/'+_0x4b9fc5)[_0x1ea6('0x18')](_0x31ff35);}return null;};}function patchUpdates(_0x7f398a){return function(_0x55f185){try{jsonpatch[_0x1ea6('0x1e')](_0x55f185,_0x7f398a,!![]);}catch(_0x52f324){return BPromise[_0x1ea6('0x1f')](_0x52f324);}return _0x55f185[_0x1ea6('0x20')]();};}function saveUpdates(_0x243b6a,_0x20d669){return function(_0x42c761){if(_0x42c761){return _0x42c761[_0x1ea6('0x21')](_0x243b6a)[_0x1ea6('0x22')](function(_0x2cc8b7){return _0x2cc8b7;});}return null;};}function removeEntity(_0x172e0c,_0x5a2c51){return function(_0x3eda7b){if(_0x3eda7b){return _0x3eda7b[_0x1ea6('0x23')]()[_0x1ea6('0x22')](function(){_0x172e0c[_0x1ea6('0x16')](0xcc)[_0x1ea6('0x17')]();});}};}function handleEntityNotFound(_0x2b23b6,_0x1f7694){return function(_0x11c93a){if(!_0x11c93a){_0x2b23b6[_0x1ea6('0x15')](0x194);}return _0x11c93a;};}function handleError(_0x59b153,_0x990c96){_0x990c96=_0x990c96||0x1f4;return function(_0x12250e){logger['error'](_0x12250e[_0x1ea6('0x24')]);if(_0x12250e[_0x1ea6('0x25')]){delete _0x12250e[_0x1ea6('0x25')];}_0x59b153[_0x1ea6('0x16')](_0x990c96)['send'](_0x12250e);};}exports[_0x1ea6('0x26')]=function(_0x35c5f9,_0x3c5bdf){var _0x4a5b65={},_0x265fdd={},_0x276f40={'count':0x0,'rows':[]};var _0x406944=_['map'](db[_0x1ea6('0x27')][_0x1ea6('0x28')],function(_0x3657e9){return{'name':_0x3657e9[_0x1ea6('0x29')],'type':_0x3657e9[_0x1ea6('0x2a')][_0x1ea6('0x2b')]};});_0x265fdd['model']=_['map'](_0x406944,_0x1ea6('0x25'));_0x265fdd[_0x1ea6('0x2c')]=_[_0x1ea6('0x2d')](_0x35c5f9['query']);_0x265fdd[_0x1ea6('0x2e')]=_['intersection'](_0x265fdd['model'],_0x265fdd[_0x1ea6('0x2c')]);_0x4a5b65[_0x1ea6('0x2f')]=_[_0x1ea6('0x30')](_0x265fdd[_0x1ea6('0x31')],qs[_0x1ea6('0x32')](_0x35c5f9[_0x1ea6('0x2c')][_0x1ea6('0x32')]));_0x4a5b65[_0x1ea6('0x2f')]=_0x4a5b65['attributes']['length']?_0x4a5b65[_0x1ea6('0x2f')]:_0x265fdd[_0x1ea6('0x31')];if(!_0x35c5f9[_0x1ea6('0x2c')][_0x1ea6('0x33')](_0x1ea6('0x34'))){_0x4a5b65[_0x1ea6('0x1b')]=qs[_0x1ea6('0x1b')](_0x35c5f9[_0x1ea6('0x2c')]['limit']);_0x4a5b65['offset']=qs[_0x1ea6('0x19')](_0x35c5f9['query'][_0x1ea6('0x19')]);}_0x4a5b65[_0x1ea6('0x35')]=qs[_0x1ea6('0x36')](_0x35c5f9['query'][_0x1ea6('0x36')]);_0x4a5b65['where']=qs['filters'](_[_0x1ea6('0x37')](_0x35c5f9[_0x1ea6('0x2c')],_0x265fdd['filters']),_0x406944);if(_0x35c5f9[_0x1ea6('0x2c')]['filter']){_0x4a5b65[_0x1ea6('0x38')]=_[_0x1ea6('0x39')](_0x4a5b65['where'],{'$or':_[_0x1ea6('0x3a')](_0x406944,function(_0x1ad805){if(_0x1ad805[_0x1ea6('0x2a')]!==_0x1ea6('0x3b')){var _0x33e436={};_0x33e436[_0x1ad805['name']]={'$like':'%'+_0x35c5f9['query'][_0x1ea6('0x3c')]+'%'};return _0x33e436;}})});}_0x4a5b65=_['merge']({},_0x4a5b65,_0x35c5f9[_0x1ea6('0x3d')]);var _0x225d10={'where':_0x4a5b65[_0x1ea6('0x38')]};return db[_0x1ea6('0x27')][_0x1ea6('0x3e')](_0x225d10)[_0x1ea6('0x22')](function(_0x3e0099){_0x276f40['count']=_0x3e0099;if(_0x35c5f9[_0x1ea6('0x2c')][_0x1ea6('0x3f')]){_0x4a5b65[_0x1ea6('0x40')]=[{'all':!![]}];}return db[_0x1ea6('0x27')][_0x1ea6('0x41')](_0x4a5b65);})[_0x1ea6('0x22')](function(_0x5260e4){_0x276f40[_0x1ea6('0x42')]=_0x5260e4;return _0x276f40;})[_0x1ea6('0x22')](respondWithFilteredResult(_0x3c5bdf,_0x4a5b65))[_0x1ea6('0x43')](handleError(_0x3c5bdf,null));};exports[_0x1ea6('0x44')]=function(_0x21ba60,_0x972c3e){var _0x383694={'raw':![],'where':{'id':_0x21ba60[_0x1ea6('0x45')]['id']}},_0x1be915={};_0x1be915[_0x1ea6('0x31')]=_[_0x1ea6('0x2d')](db[_0x1ea6('0x27')]['rawAttributes']);_0x1be915['query']=_['keys'](_0x21ba60['query']);_0x1be915[_0x1ea6('0x2e')]=_['intersection'](_0x1be915[_0x1ea6('0x31')],_0x1be915[_0x1ea6('0x2c')]);_0x383694[_0x1ea6('0x2f')]=_[_0x1ea6('0x30')](_0x1be915[_0x1ea6('0x31')],qs[_0x1ea6('0x32')](_0x21ba60[_0x1ea6('0x2c')][_0x1ea6('0x32')]));_0x383694[_0x1ea6('0x2f')]=_0x383694['attributes'][_0x1ea6('0x46')]?_0x383694['attributes']:_0x1be915[_0x1ea6('0x31')];if(_0x21ba60['query'][_0x1ea6('0x3f')]){_0x383694[_0x1ea6('0x40')]=[{'all':!![]}];}_0x383694=_[_0x1ea6('0x39')]({},_0x383694,_0x21ba60[_0x1ea6('0x3d')]);return db[_0x1ea6('0x27')][_0x1ea6('0x47')](_0x383694)[_0x1ea6('0x22')](handleEntityNotFound(_0x972c3e,null))['then'](respondWithResult(_0x972c3e,null))[_0x1ea6('0x43')](handleError(_0x972c3e,null));};exports[_0x1ea6('0x48')]=function(_0x47a3f6,_0x1954d2){return db[_0x1ea6('0x27')][_0x1ea6('0x48')](_0x47a3f6[_0x1ea6('0x49')],{})[_0x1ea6('0x22')](respondWithResult(_0x1954d2,0xc9))[_0x1ea6('0x43')](handleError(_0x1954d2,null));};exports[_0x1ea6('0x4a')]=function(_0x22c8bb,_0x1c5889){return db[_0x1ea6('0x27')][_0x1ea6('0x4a')](_0x22c8bb[_0x1ea6('0x49')],{'raw':![],'individualHooks':!![]})[_0x1ea6('0x22')](respondWithResult(_0x1c5889,0xc9))[_0x1ea6('0x43')](handleError(_0x1c5889,null));};exports[_0x1ea6('0x21')]=function(_0x30d916,_0x146147){if(_0x30d916['body']['id']){delete _0x30d916[_0x1ea6('0x49')]['id'];}return db[_0x1ea6('0x27')]['find']({'where':{'id':_0x30d916['params']['id']}})[_0x1ea6('0x22')](handleEntityNotFound(_0x146147,null))[_0x1ea6('0x22')](saveUpdates(_0x30d916[_0x1ea6('0x49')],null))['then'](respondWithResult(_0x146147,null))[_0x1ea6('0x43')](handleError(_0x146147,null));};exports[_0x1ea6('0x23')]=function(_0x3c1f79,_0x4078a1){return db[_0x1ea6('0x27')][_0x1ea6('0x47')]({'where':{'id':_0x3c1f79[_0x1ea6('0x45')]['id']}})['then'](handleEntityNotFound(_0x4078a1,null))[_0x1ea6('0x22')](removeEntity(_0x4078a1,null))['catch'](handleError(_0x4078a1,null));};exports[_0x1ea6('0x4b')]=function(_0x5584b4,_0x381e6e){return db[_0x1ea6('0x27')][_0x1ea6('0x23')]({'where':{'id':_0x5584b4[_0x1ea6('0x2c')][_0x1ea6('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x1ea6('0x22')](respondWithResult(_0x381e6e,0xcc))[_0x1ea6('0x43')](handleError(_0x381e6e,null));};exports['addFields']=function(_0x112a44,_0x32993f,_0x51a611){return db['AnalyticCustomReport'][_0x1ea6('0x4d')]({'where':{'id':_0x112a44[_0x1ea6('0x45')]['id']}})['then'](handleEntityNotFound(_0x32993f,null))[_0x1ea6('0x22')](function(_0x33d198){if(_0x33d198){return db[_0x1ea6('0x4e')][_0x1ea6('0x4f')](function(_0x7c217f){return db[_0x1ea6('0x27')][_0x1ea6('0x23')]({'where':{'CustomReportId':_0x112a44[_0x1ea6('0x45')]['id']},'transaction':_0x7c217f})[_0x1ea6('0x22')](function(_0x4ec93b){var _0x531371=_['map'](_0x112a44['body'],function(_0x2c7256){delete _0x2c7256['id'];_0x2c7256[_0x1ea6('0x50')]=_0x112a44['params']['id'];return _0x2c7256;});return db[_0x1ea6('0x27')][_0x1ea6('0x4a')](_0x531371,{'transaction':_0x7c217f});});})[_0x1ea6('0x22')](function(){return db[_0x1ea6('0x27')][_0x1ea6('0x41')]({'where':{'CustomReportId':_0x112a44[_0x1ea6('0x45')]['id']}});});}})[_0x1ea6('0x22')](respondWithResult(_0x32993f,null))[_0x1ea6('0x43')](handleError(_0x32993f,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 796e8c1..d3e188e 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 _0xfa2c=['../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x251d69,_0xb6a1eb){var _0x2502cd=function(_0x405573){while(--_0x405573){_0x251d69['push'](_0x251d69['shift']());}};_0x2502cd(++_0xb6a1eb);}(_0xfa2c,0x7c));var _0xcfa2=function(_0x37eee1,_0x542cdf){_0x37eee1=_0x37eee1-0x0;var _0x4bd209=_0xfa2c[_0x37eee1];return _0x4bd209;};'use strict';var _=require(_0xcfa2('0x0'));var util=require('util');var logger=require(_0xcfa2('0x1'))(_0xcfa2('0x2'));var moment=require(_0xcfa2('0x3'));var BPromise=require(_0xcfa2('0x4'));var rp=require(_0xcfa2('0x5'));var fs=require('fs');var path=require(_0xcfa2('0x6'));var rimraf=require(_0xcfa2('0x7'));var config=require(_0xcfa2('0x8'));var attributes=require(_0xcfa2('0x9'));module['exports']=function(_0x540c3b,_0x23262a){return _0x540c3b[_0xcfa2('0xa')](_0xcfa2('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index cd90aba..6538665 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 _0xcaf2=['catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticFieldReport,\x20%s,\x20%s','result'];(function(_0x5efb20,_0x2a5f8f){var _0x2ec91c=function(_0x4d5921){while(--_0x4d5921){_0x5efb20['push'](_0x5efb20['shift']());}};_0x2ec91c(++_0x2a5f8f);}(_0xcaf2,0x190));var _0x2caf=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0xcaf2[_0x27c25f];return _0x2da4c4;};'use strict';var _=require('lodash');var util=require(_0x2caf('0x0'));var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require(_0x2caf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2caf('0x4'));var logger=require(_0x2caf('0x5'))(_0x2caf('0x6'));var config=require(_0x2caf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2caf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51f016,_0x54d830,_0x5486dd){return new BPromise(function(_0xf6e492,_0x43424f){return client[_0x2caf('0x9')](_0x51f016,_0x5486dd)[_0x2caf('0xa')](function(_0x43a982){logger[_0x2caf('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x54d830,_0x2caf('0xc'));logger[_0x2caf('0xd')](_0x2caf('0xe'),_0x54d830,'request\x20sent',JSON[_0x2caf('0xf')](_0x43a982));if(_0x43a982[_0x2caf('0x10')]){if(_0x43a982[_0x2caf('0x10')]['code']===0x1f4){logger[_0x2caf('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x54d830,_0x43a982[_0x2caf('0x10')][_0x2caf('0x11')]);return _0x43424f(_0x43a982['error']['message']);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x54d830,_0x43a982['error']['message']);return _0xf6e492(_0x43a982['error'][_0x2caf('0x11')]);}else{logger[_0x2caf('0xb')](_0x2caf('0x12'),_0x54d830,'request\x20sent');_0xf6e492(_0x43a982[_0x2caf('0x13')]['message']);}})[_0x2caf('0x14')](function(_0x370da1){logger[_0x2caf('0x10')](_0x2caf('0x12'),_0x54d830,_0x370da1);_0x43424f(_0x370da1);});});} \ No newline at end of file +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 diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7bdc346..da1f792 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(_0x35c326,_0x386987){var _0x59c796=function(_0x5d84f8){while(--_0x5d84f8){_0x35c326['push'](_0x35c326['shift']());}};_0x59c796(++_0x386987);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9d2cf24..11b269d 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 _0x39c4=['exports','STRING','TEXT'];(function(_0x135310,_0x313225){var _0x4dfc57=function(_0x58d523){while(--_0x58d523){_0x135310['push'](_0x135310['shift']());}};_0x4dfc57(++_0x313225);}(_0x39c4,0x174));var _0x439c=function(_0xbc379e,_0x2b1967){_0xbc379e=_0xbc379e-0x0;var _0x3aa206=_0x39c4[_0xbc379e];return _0x3aa206;};'use strict';var Sequelize=require('sequelize');module[_0x439c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x439c('0x1')]},'metric':{'type':Sequelize[_0x439c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6b5ea26..ca4f5a9 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 _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x39dd62,_0x2ede4f){var _0x2e73b8=function(_0x244449){while(--_0x244449){_0x39dd62['push'](_0x39dd62['shift']());}};_0x2e73b8(++_0x2ede4f);}(_0x425d,0x1e0));var _0xd425=function(_0x42dd53,_0xec94a){_0x42dd53=_0x42dd53-0x0;var _0x3d77cb=_0x425d[_0x42dd53];return _0x3d77cb;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 38b14f8..aa930fd 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 _0x647c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x4bd0b1,_0x56f9e1){var _0x201417=function(_0xb54361){while(--_0xb54361){_0x4bd0b1['push'](_0x4bd0b1['shift']());}};_0x201417(++_0x56f9e1);}(_0x647c,0x1d3));var _0xc647=function(_0x8ec947,_0x444fa2){_0x8ec947=_0x8ec947-0x0;var _0x115d2b=_0x647c[_0x8ec947];return _0x115d2b;};'use strict';var _=require(_0xc647('0x0'));var util=require('util');var logger=require(_0xc647('0x1'))(_0xc647('0x2'));var moment=require('moment');var BPromise=require(_0xc647('0x3'));var rp=require(_0xc647('0x4'));var fs=require('fs');var path=require(_0xc647('0x5'));var rimraf=require(_0xc647('0x6'));var config=require(_0xc647('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xc647('0x8')]=function(_0x202fea,_0x19bfae){return _0x202fea[_0xc647('0x9')](_0xc647('0xa'),attributes,{'tableName':_0xc647('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 126db1e..64abffd 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 _0xc220=['request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0xc220,0xb2));var _0x0c22=function(_0x3d7c29,_0x2f2125){_0x3d7c29=_0x3d7c29-0x0;var _0x3520b9=_0xc220[_0x3d7c29];return _0x3520b9;};'use strict';var _=require(_0x0c22('0x0'));var util=require(_0x0c22('0x1'));var moment=require(_0x0c22('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c22('0x3'));var fs=require('fs');var Redis=require(_0x0c22('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0c22('0x5'))(_0x0c22('0x6'));var config=require(_0x0c22('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c22('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34bcd5,_0x626f67,_0x509045){return new BPromise(function(_0xf85910,_0x57b959){return client['request'](_0x34bcd5,_0x509045)[_0x0c22('0x9')](function(_0x96cd7f){logger[_0x0c22('0xa')](_0x0c22('0xb'),_0x626f67,_0x0c22('0xc'));logger[_0x0c22('0xd')](_0x0c22('0xe'),_0x626f67,'request\x20sent',JSON['stringify'](_0x96cd7f));if(_0x96cd7f[_0x0c22('0xf')]){if(_0x96cd7f[_0x0c22('0xf')][_0x0c22('0x10')]===0x1f4){logger[_0x0c22('0xf')](_0x0c22('0xb'),_0x626f67,_0x96cd7f[_0x0c22('0xf')]['message']);return _0x57b959(_0x96cd7f['error']['message']);}logger[_0x0c22('0xf')](_0x0c22('0xb'),_0x626f67,_0x96cd7f[_0x0c22('0xf')][_0x0c22('0x11')]);return _0xf85910(_0x96cd7f[_0x0c22('0xf')][_0x0c22('0x11')]);}else{logger[_0x0c22('0xa')](_0x0c22('0xb'),_0x626f67,_0x0c22('0xc'));_0xf85910(_0x96cd7f[_0x0c22('0x12')][_0x0c22('0x11')]);}})['catch'](function(_0x517633){logger[_0x0c22('0xf')](_0x0c22('0xb'),_0x626f67,_0x517633);_0x57b959(_0x517633);});});} \ No newline at end of file +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 diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index bb21bdb..05cfe7b 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 _0xc838=['../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x47ecdc,_0xbed7bd){var _0x333fa9=function(_0xec83c0){while(--_0xec83c0){_0x47ecdc['push'](_0x47ecdc['shift']());}};_0x333fa9(++_0xbed7bd);}(_0xc838,0xbd));var _0x8c83=function(_0x5e6690,_0x45b08b){_0x5e6690=_0x5e6690-0x0;var _0x56ea8d=_0xc838[_0x5e6690];return _0x56ea8d;};'use strict';var multer=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var path=require(_0x8c83('0x2'));var timeout=require(_0x8c83('0x3'));var express=require(_0x8c83('0x4'));var router=express[_0x8c83('0x5')]();var fs_extra=require(_0x8c83('0x6'));var auth=require(_0x8c83('0x7'));var interaction=require(_0x8c83('0x8'));var config=require(_0x8c83('0x9'));var controller=require(_0x8c83('0xa'));router[_0x8c83('0xb')]('/',auth[_0x8c83('0xc')](),controller[_0x8c83('0xd')]);router[_0x8c83('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x8c83('0xe')]);router['post']('/',auth[_0x8c83('0xc')](),controller[_0x8c83('0xf')]);router[_0x8c83('0x10')](_0x8c83('0x11'),auth[_0x8c83('0xc')](),controller[_0x8c83('0x12')]);router[_0x8c83('0x13')](_0x8c83('0x11'),auth[_0x8c83('0xc')](),controller[_0x8c83('0x14')]);module[_0x8c83('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f612b41..6abc8f8 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 _0x19b3=['exports','TEXT'];(function(_0x19edb8,_0xa71a76){var _0x5d8698=function(_0x19bbcd){while(--_0x19bbcd){_0x19edb8['push'](_0x19edb8['shift']());}};_0x5d8698(++_0xa71a76);}(_0x19b3,0x194));var _0x319b=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x19b3[_0x4aa838];return _0x3abff0;};'use strict';var Sequelize=require('sequelize');module[_0x319b('0x0')]={'tree':{'type':Sequelize[_0x319b('0x1')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 0af1e88..8ab6738 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 _0x312f=['sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','params','fields','includeAll','options','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','order'];(function(_0x24d4af,_0x1e8338){var _0x9ddec5=function(_0x1f9d61){while(--_0x1f9d61){_0x24d4af['push'](_0x24d4af['shift']());}};_0x9ddec5(++_0x1e8338);}(_0x312f,0x1e1));var _0xf312=function(_0x506196,_0x5847ed){_0x506196=_0x506196-0x0;var _0x4cb42b=_0x312f[_0x506196];return _0x4cb42b;};'use strict';var emlformat=require(_0xf312('0x0'));var rimraf=require(_0xf312('0x1'));var zipdir=require(_0xf312('0x2'));var jsonpatch=require(_0xf312('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf312('0x4'));var Mustache=require(_0xf312('0x5'));var util=require('util');var path=require(_0xf312('0x6'));var sox=require(_0xf312('0x7'));var csv=require(_0xf312('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf312('0x9'));var _=require(_0xf312('0xa'));var squel=require(_0xf312('0xb'));var crypto=require('crypto');var jsforce=require(_0xf312('0xc'));var deskjs=require(_0xf312('0xd'));var toCsv=require(_0xf312('0x8'));var querystring=require(_0xf312('0xe'));var Papa=require('papaparse');var Redis=require(_0xf312('0xf'));var authService=require(_0xf312('0x10'));var qs=require(_0xf312('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf312('0x12'));var logger=require(_0xf312('0x13'))(_0xf312('0x14'));var utils=require(_0xf312('0x15'));var config=require(_0xf312('0x16'));var licenseUtil=require(_0xf312('0x17'));var db=require(_0xf312('0x18'))['db'];function respondWithStatusCode(_0x40a376,_0x30d20c){_0x30d20c=_0x30d20c||0xcc;return function(_0x2ab123){if(_0x2ab123){return _0x40a376[_0xf312('0x19')](_0x30d20c);}return _0x40a376['status'](_0x30d20c)[_0xf312('0x1a')]();};}function respondWithResult(_0x4d538f,_0x1edf71){_0x1edf71=_0x1edf71||0xc8;return function(_0x33d036){if(_0x33d036){return _0x4d538f['status'](_0x1edf71)[_0xf312('0x1b')](_0x33d036);}};}function respondWithFilteredResult(_0x530294,_0x28cf2c){return function(_0x5a59b4){if(_0x5a59b4){var _0x5ef91d=typeof _0x28cf2c[_0xf312('0x1c')]===_0xf312('0x1d')&&typeof _0x28cf2c[_0xf312('0x1e')]==='undefined';var _0x1a97e5=_0x5a59b4[_0xf312('0x1f')];var _0x3c1b7e=_0x5ef91d?0x0:_0x28cf2c['offset'];var _0x290a1f=_0x5ef91d?_0x5a59b4['count']:_0x28cf2c[_0xf312('0x1c')]+_0x28cf2c[_0xf312('0x1e')];var _0x5dd652;if(_0x290a1f>=_0x1a97e5){_0x290a1f=_0x1a97e5;_0x5dd652=0xc8;}else{_0x5dd652=0xce;}_0x530294[_0xf312('0x20')](_0x5dd652);return _0x530294[_0xf312('0x21')](_0xf312('0x22'),_0x3c1b7e+'-'+_0x290a1f+'/'+_0x1a97e5)['json'](_0x5a59b4);}return null;};}function patchUpdates(_0x1015e3){return function(_0x4e9072){try{jsonpatch[_0xf312('0x23')](_0x4e9072,_0x1015e3,!![]);}catch(_0x38da44){return BPromise[_0xf312('0x24')](_0x38da44);}return _0x4e9072[_0xf312('0x25')]();};}function saveUpdates(_0x5c90e7,_0x435f0e){return function(_0x4aee21){if(_0x4aee21){return _0x4aee21['update'](_0x5c90e7)[_0xf312('0x26')](function(_0x11e2f7){return _0x11e2f7;});}return null;};}function removeEntity(_0x378a65,_0xd2215a){return function(_0x2568eb){if(_0x2568eb){return _0x2568eb[_0xf312('0x27')]()[_0xf312('0x26')](function(){_0x378a65[_0xf312('0x20')](0xcc)[_0xf312('0x1a')]();});}};}function handleEntityNotFound(_0x4715fe,_0x559a12){return function(_0xec4843){if(!_0xec4843){_0x4715fe['sendStatus'](0x194);}return _0xec4843;};}function handleError(_0x5ade78,_0x10e693){_0x10e693=_0x10e693||0x1f4;return function(_0x1b680b){logger[_0xf312('0x28')](_0x1b680b[_0xf312('0x29')]);if(_0x1b680b[_0xf312('0x2a')]){delete _0x1b680b[_0xf312('0x2a')];}_0x5ade78['status'](_0x10e693)['send'](_0x1b680b);};}exports[_0xf312('0x2b')]=function(_0x8a7077,_0x4cf57b){var _0xc55a6a={},_0x282b18={},_0xc0d007={'count':0x0,'rows':[]};var _0x4cddf9=_[_0xf312('0x2c')](db[_0xf312('0x2d')][_0xf312('0x2e')],function(_0x210fc8){return{'name':_0x210fc8[_0xf312('0x2f')],'type':_0x210fc8['type'][_0xf312('0x30')]};});_0x282b18[_0xf312('0x31')]=_[_0xf312('0x2c')](_0x4cddf9,_0xf312('0x2a'));_0x282b18[_0xf312('0x32')]=_[_0xf312('0x33')](_0x8a7077[_0xf312('0x32')]);_0x282b18[_0xf312('0x34')]=_[_0xf312('0x35')](_0x282b18[_0xf312('0x31')],_0x282b18[_0xf312('0x32')]);_0xc55a6a[_0xf312('0x36')]=_[_0xf312('0x35')](_0x282b18[_0xf312('0x31')],qs['fields'](_0x8a7077[_0xf312('0x32')]['fields']));_0xc55a6a[_0xf312('0x36')]=_0xc55a6a[_0xf312('0x36')][_0xf312('0x37')]?_0xc55a6a[_0xf312('0x36')]:_0x282b18[_0xf312('0x31')];if(!_0x8a7077[_0xf312('0x32')]['hasOwnProperty'](_0xf312('0x38'))){_0xc55a6a['limit']=qs[_0xf312('0x1e')](_0x8a7077[_0xf312('0x32')][_0xf312('0x1e')]);_0xc55a6a[_0xf312('0x1c')]=qs['offset'](_0x8a7077[_0xf312('0x32')]['offset']);}_0xc55a6a[_0xf312('0x39')]=qs[_0xf312('0x3a')](_0x8a7077[_0xf312('0x32')][_0xf312('0x3a')]);_0xc55a6a[_0xf312('0x3b')]=qs['filters'](_[_0xf312('0x3c')](_0x8a7077[_0xf312('0x32')],_0x282b18[_0xf312('0x34')]),_0x4cddf9);if(_0x8a7077[_0xf312('0x32')][_0xf312('0x3d')]){_0xc55a6a['where']=_[_0xf312('0x3e')](_0xc55a6a[_0xf312('0x3b')],{'$or':_[_0xf312('0x2c')](_0x4cddf9,function(_0xbdc351){if(_0xbdc351[_0xf312('0x3f')]!=='VIRTUAL'){var _0x20611c={};_0x20611c[_0xbdc351['name']]={'$like':'%'+_0x8a7077[_0xf312('0x32')][_0xf312('0x3d')]+'%'};return _0x20611c;}})});}_0xc55a6a=_[_0xf312('0x3e')]({},_0xc55a6a,_0x8a7077['options']);var _0x1f1930={'where':_0xc55a6a[_0xf312('0x3b')]};return db[_0xf312('0x2d')][_0xf312('0x1f')](_0x1f1930)['then'](function(_0x5971fd){_0xc0d007['count']=_0x5971fd;if(_0x8a7077[_0xf312('0x32')]['includeAll']){_0xc55a6a[_0xf312('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xf312('0x41')](_0xc55a6a);})[_0xf312('0x26')](function(_0x43ff43){_0xc0d007[_0xf312('0x42')]=_0x43ff43;return _0xc0d007;})[_0xf312('0x26')](respondWithFilteredResult(_0x4cf57b,_0xc55a6a))[_0xf312('0x43')](handleError(_0x4cf57b,null));};exports[_0xf312('0x44')]=function(_0x1bff18,_0x55ddc3){var _0x441397={'raw':!![],'where':{'id':_0x1bff18[_0xf312('0x45')]['id']}},_0x213972={};_0x213972[_0xf312('0x31')]=_[_0xf312('0x33')](db[_0xf312('0x2d')]['rawAttributes']);_0x213972[_0xf312('0x32')]=_[_0xf312('0x33')](_0x1bff18['query']);_0x213972['filters']=_['intersection'](_0x213972[_0xf312('0x31')],_0x213972['query']);_0x441397[_0xf312('0x36')]=_[_0xf312('0x35')](_0x213972[_0xf312('0x31')],qs['fields'](_0x1bff18[_0xf312('0x32')][_0xf312('0x46')]));_0x441397[_0xf312('0x36')]=_0x441397['attributes'][_0xf312('0x37')]?_0x441397[_0xf312('0x36')]:_0x213972[_0xf312('0x31')];if(_0x1bff18[_0xf312('0x32')][_0xf312('0x47')]){_0x441397[_0xf312('0x40')]=[{'all':!![]}];}_0x441397=_[_0xf312('0x3e')]({},_0x441397,_0x1bff18[_0xf312('0x48')]);return db[_0xf312('0x2d')][_0xf312('0x49')](_0x441397)['then'](handleEntityNotFound(_0x55ddc3,null))[_0xf312('0x26')](respondWithResult(_0x55ddc3,null))['catch'](handleError(_0x55ddc3,null));};exports[_0xf312('0x4a')]=function(_0x2747f9,_0x25fd91){return db['AnalyticTreeReport']['create'](_0x2747f9['body'],{})[_0xf312('0x26')](respondWithResult(_0x25fd91,0xc9))[_0xf312('0x43')](handleError(_0x25fd91,null));};exports[_0xf312('0x4b')]=function(_0xa81f70,_0x4fcfcc){if(_0xa81f70[_0xf312('0x4c')]['id']){delete _0xa81f70[_0xf312('0x4c')]['id'];}return db[_0xf312('0x2d')][_0xf312('0x49')]({'where':{'id':_0xa81f70[_0xf312('0x45')]['id']}})[_0xf312('0x26')](handleEntityNotFound(_0x4fcfcc,null))['then'](saveUpdates(_0xa81f70[_0xf312('0x4c')],null))['then'](respondWithResult(_0x4fcfcc,null))[_0xf312('0x43')](handleError(_0x4fcfcc,null));};exports[_0xf312('0x27')]=function(_0x330b5b,_0x52765b){return db[_0xf312('0x2d')]['find']({'where':{'id':_0x330b5b['params']['id']}})[_0xf312('0x26')](handleEntityNotFound(_0x52765b,null))[_0xf312('0x26')](removeEntity(_0x52765b,null))[_0xf312('0x43')](handleError(_0x52765b,null));}; \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index aa146dd..a1d0e31 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 _0xce42=['AnalyticTreeReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports'];(function(_0x5ca42a,_0xaed5ad){var _0x11b7ea=function(_0x8cb957){while(--_0x8cb957){_0x5ca42a['push'](_0x5ca42a['shift']());}};_0x11b7ea(++_0xaed5ad);}(_0xce42,0x140));var _0x2ce4=function(_0x4819e3,_0x5dcdb1){_0x4819e3=_0x4819e3-0x0;var _0x3255c8=_0xce42[_0x4819e3];return _0x3255c8;};'use strict';var _=require(_0x2ce4('0x0'));var util=require(_0x2ce4('0x1'));var logger=require('../../config/logger')(_0x2ce4('0x2'));var moment=require(_0x2ce4('0x3'));var BPromise=require(_0x2ce4('0x4'));var rp=require(_0x2ce4('0x5'));var fs=require('fs');var path=require(_0x2ce4('0x6'));var rimraf=require(_0x2ce4('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ce4('0x8'));module[_0x2ce4('0x9')]=function(_0x4fd5fe,_0x2e324){return _0x4fd5fe['define'](_0x2ce4('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 45e0bb8..665788d 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x360cf4,_0x5913d6){var _0x5176c4=function(_0x3e4849){while(--_0x3e4849){_0x360cf4['push'](_0x360cf4['shift']());}};_0x5176c4(++_0x5913d6);}(_0x2ef3,0xba));var _0x32ef=function(_0x372b34,_0x2862ca){_0x372b34=_0x372b34-0x0;var _0x3e4984=_0x2ef3[_0x372b34];return _0x3e4984;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3874cd8..18c9b3f 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 _0x990f=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','put','update'];(function(_0x4ebde3,_0x40a632){var _0x3a5d79=function(_0x2e2ebd){while(--_0x2e2ebd){_0x4ebde3['push'](_0x4ebde3['shift']());}};_0x3a5d79(++_0x40a632);}(_0x990f,0x1c5));var _0xf990=function(_0x1d98bb,_0x42cc4c){_0x1d98bb=_0x1d98bb-0x0;var _0x2b76ba=_0x990f[_0x1d98bb];return _0x2b76ba;};'use strict';var multer=require(_0xf990('0x0'));var util=require(_0xf990('0x1'));var path=require(_0xf990('0x2'));var timeout=require(_0xf990('0x3'));var express=require(_0xf990('0x4'));var router=express['Router']();var fs_extra=require(_0xf990('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf990('0x6'));var config=require('../../config/environment');var controller=require(_0xf990('0x7'));router[_0xf990('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf990('0x8')](_0xf990('0x9'),auth[_0xf990('0xa')](),controller[_0xf990('0xb')]);router[_0xf990('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf990('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf990('0xe')]);router[_0xf990('0xf')](_0xf990('0x9'),auth['isAuthenticated'](),controller[_0xf990('0x10')]);module[_0xf990('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 13062de..59366f7 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 _0x2d17=['STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2d17,0x17e));var _0x72d1=function(_0x5c9f66,_0xe022b1){_0x5c9f66=_0x5c9f66-0x0;var _0xa566fd=_0x2d17[_0x5c9f66];return _0xa566fd;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x72d1('0x2')]},'type':{'type':Sequelize[_0x72d1('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 7157747..fb3bd63 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 _0x4819=['createdAt','updatedAt','body','omit','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','error','send','Attachment','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','keys','find','clone','get'];(function(_0x5945d3,_0x42c4a1){var _0xe3819a=function(_0x41c155){while(--_0x41c155){_0x5945d3['push'](_0x5945d3['shift']());}};_0xe3819a(++_0x42c4a1);}(_0x4819,0x12e));var _0x9481=function(_0x3e64ed,_0x491816){_0x3e64ed=_0x3e64ed-0x0;var _0x14d8bc=_0x4819[_0x3e64ed];return _0x14d8bc;};'use strict';var emlformat=require(_0x9481('0x0'));var rimraf=require(_0x9481('0x1'));var zipdir=require(_0x9481('0x2'));var jsonpatch=require(_0x9481('0x3'));var rp=require(_0x9481('0x4'));var moment=require(_0x9481('0x5'));var BPromise=require(_0x9481('0x6'));var Mustache=require(_0x9481('0x7'));var util=require(_0x9481('0x8'));var path=require(_0x9481('0x9'));var sox=require(_0x9481('0xa'));var csv=require(_0x9481('0xb'));var ejs=require(_0x9481('0xc'));var fs=require('fs');var fs_extra=require(_0x9481('0xd'));var _=require(_0x9481('0xe'));var squel=require(_0x9481('0xf'));var crypto=require(_0x9481('0x10'));var jsforce=require(_0x9481('0x11'));var deskjs=require(_0x9481('0x12'));var toCsv=require('to-csv');var querystring=require(_0x9481('0x13'));var Papa=require(_0x9481('0x14'));var Redis=require(_0x9481('0x15'));var authService=require(_0x9481('0x16'));var qs=require(_0x9481('0x17'));var as=require(_0x9481('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9481('0x19'));var utils=require(_0x9481('0x1a'));var config=require(_0x9481('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9481('0x1c'))['db'];function respondWithStatusCode(_0x29ccb9,_0x569239){_0x569239=_0x569239||0xcc;return function(_0x10d301){if(_0x10d301){return _0x29ccb9[_0x9481('0x1d')](_0x569239);}return _0x29ccb9['status'](_0x569239)['end']();};}function respondWithResult(_0x145e53,_0x5abbf5){_0x5abbf5=_0x5abbf5||0xc8;return function(_0x23c1e3){if(_0x23c1e3){return _0x145e53[_0x9481('0x1e')](_0x5abbf5)['json'](_0x23c1e3);}};}function respondWithFilteredResult(_0x36e216,_0x2da2f7){return function(_0x9c31ea){if(_0x9c31ea){var _0x483a44=typeof _0x2da2f7[_0x9481('0x1f')]==='undefined'&&typeof _0x2da2f7['limit']===_0x9481('0x20');var _0x335f8f=_0x9c31ea[_0x9481('0x21')];var _0x149dcf=_0x483a44?0x0:_0x2da2f7[_0x9481('0x1f')];var _0x22d83d=_0x483a44?_0x9c31ea[_0x9481('0x21')]:_0x2da2f7[_0x9481('0x1f')]+_0x2da2f7[_0x9481('0x22')];var _0x36bc2a;if(_0x22d83d>=_0x335f8f){_0x22d83d=_0x335f8f;_0x36bc2a=0xc8;}else{_0x36bc2a=0xce;}_0x36e216[_0x9481('0x1e')](_0x36bc2a);return _0x36e216[_0x9481('0x23')](_0x9481('0x24'),_0x149dcf+'-'+_0x22d83d+'/'+_0x335f8f)[_0x9481('0x25')](_0x9c31ea);}return null;};}function patchUpdates(_0xa59971){return function(_0x3ad61f){try{jsonpatch[_0x9481('0x26')](_0x3ad61f,_0xa59971,!![]);}catch(_0x27d1df){return BPromise[_0x9481('0x27')](_0x27d1df);}return _0x3ad61f[_0x9481('0x28')]();};}function saveUpdates(_0x2b3fae,_0x5d66c0){return function(_0x41cbda){if(_0x41cbda){return _0x41cbda[_0x9481('0x29')](_0x2b3fae)['then'](function(_0x2e1d57){return _0x2e1d57;});}return null;};}function removeEntity(_0x54703b,_0x422f99){return function(_0x303053){if(_0x303053){return _0x303053['destroy']()['then'](function(){_0x54703b[_0x9481('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1304ab,_0x10dc5a){return function(_0x5958af){if(!_0x5958af){_0x1304ab['sendStatus'](0x194);}return _0x5958af;};}function handleError(_0x2ad1a5,_0x4e7039){_0x4e7039=_0x4e7039||0x1f4;return function(_0x1fdbda){logger[_0x9481('0x2a')](_0x1fdbda['stack']);if(_0x1fdbda['name']){delete _0x1fdbda['name'];}_0x2ad1a5[_0x9481('0x1e')](_0x4e7039)[_0x9481('0x2b')](_0x1fdbda);};}exports['index']=function(_0x186c23,_0x3f2422){var _0x195e58={},_0x4d1340={},_0x41e00c={'count':0x0,'rows':[]};var _0x2a1d03=_['map'](db[_0x9481('0x2c')][_0x9481('0x2d')],function(_0x17a722){return{'name':_0x17a722[_0x9481('0x2e')],'type':_0x17a722[_0x9481('0x2f')][_0x9481('0x30')]};});_0x4d1340[_0x9481('0x31')]=_[_0x9481('0x32')](_0x2a1d03,_0x9481('0x33'));_0x4d1340[_0x9481('0x34')]=_['keys'](_0x186c23[_0x9481('0x34')]);_0x4d1340[_0x9481('0x35')]=_[_0x9481('0x36')](_0x4d1340[_0x9481('0x31')],_0x4d1340['query']);_0x195e58[_0x9481('0x37')]=_[_0x9481('0x36')](_0x4d1340[_0x9481('0x31')],qs[_0x9481('0x38')](_0x186c23['query'][_0x9481('0x38')]));_0x195e58[_0x9481('0x37')]=_0x195e58['attributes'][_0x9481('0x39')]?_0x195e58[_0x9481('0x37')]:_0x4d1340[_0x9481('0x31')];if(!_0x186c23[_0x9481('0x34')][_0x9481('0x3a')](_0x9481('0x3b'))){_0x195e58[_0x9481('0x22')]=qs[_0x9481('0x22')](_0x186c23[_0x9481('0x34')][_0x9481('0x22')]);_0x195e58['offset']=qs[_0x9481('0x1f')](_0x186c23[_0x9481('0x34')][_0x9481('0x1f')]);}_0x195e58[_0x9481('0x3c')]=qs[_0x9481('0x3d')](_0x186c23[_0x9481('0x34')][_0x9481('0x3d')]);_0x195e58[_0x9481('0x3e')]=qs[_0x9481('0x35')](_['pick'](_0x186c23[_0x9481('0x34')],_0x4d1340[_0x9481('0x35')]),_0x2a1d03);if(_0x186c23[_0x9481('0x34')][_0x9481('0x3f')]){_0x195e58[_0x9481('0x3e')]=_[_0x9481('0x40')](_0x195e58[_0x9481('0x3e')],{'$or':_['map'](_0x2a1d03,function(_0xe2eed3){if(_0xe2eed3[_0x9481('0x2f')]!=='VIRTUAL'){var _0x9f44f5={};_0x9f44f5[_0xe2eed3[_0x9481('0x33')]]={'$like':'%'+_0x186c23[_0x9481('0x34')][_0x9481('0x3f')]+'%'};return _0x9f44f5;}})});}_0x195e58=_[_0x9481('0x40')]({},_0x195e58,_0x186c23[_0x9481('0x41')]);var _0xb97eaf={'where':_0x195e58[_0x9481('0x3e')]};return db[_0x9481('0x2c')][_0x9481('0x21')](_0xb97eaf)['then'](function(_0x1bbb37){_0x41e00c[_0x9481('0x21')]=_0x1bbb37;if(_0x186c23[_0x9481('0x34')][_0x9481('0x42')]){_0x195e58[_0x9481('0x43')]=[{'all':!![]}];}return db[_0x9481('0x2c')][_0x9481('0x44')](_0x195e58);})[_0x9481('0x45')](function(_0x50d83e){_0x41e00c[_0x9481('0x46')]=_0x50d83e;return _0x41e00c;})[_0x9481('0x45')](respondWithFilteredResult(_0x3f2422,_0x195e58))[_0x9481('0x47')](handleError(_0x3f2422,null));};exports[_0x9481('0x48')]=function(_0x5b0aeb,_0x7fb898){var _0x415a69={'raw':!![],'where':{'id':_0x5b0aeb[_0x9481('0x49')]['id']}},_0x4a9cfc={};_0x4a9cfc['model']=_['keys'](db[_0x9481('0x2c')][_0x9481('0x2d')]);_0x4a9cfc['query']=_[_0x9481('0x4a')](_0x5b0aeb[_0x9481('0x34')]);_0x4a9cfc[_0x9481('0x35')]=_[_0x9481('0x36')](_0x4a9cfc['model'],_0x4a9cfc[_0x9481('0x34')]);_0x415a69['attributes']=_['intersection'](_0x4a9cfc[_0x9481('0x31')],qs[_0x9481('0x38')](_0x5b0aeb[_0x9481('0x34')][_0x9481('0x38')]));_0x415a69['attributes']=_0x415a69[_0x9481('0x37')][_0x9481('0x39')]?_0x415a69[_0x9481('0x37')]:_0x4a9cfc[_0x9481('0x31')];if(_0x5b0aeb[_0x9481('0x34')][_0x9481('0x42')]){_0x415a69[_0x9481('0x43')]=[{'all':!![]}];}_0x415a69=_[_0x9481('0x40')]({},_0x415a69,_0x5b0aeb[_0x9481('0x41')]);return db['Attachment'][_0x9481('0x4b')](_0x415a69)['then'](handleEntityNotFound(_0x7fb898,null))[_0x9481('0x45')](respondWithResult(_0x7fb898,null))['catch'](handleError(_0x7fb898,null));};exports[_0x9481('0x4c')]=function(_0x4b204f,_0x18ae95){var _0x59a960={'where':{'id':_0x4b204f[_0x9481('0x49')]['id']}},_0x41e9a7={};_0x41e9a7['model']=_[_0x9481('0x4a')](db[_0x9481('0x2c')][_0x9481('0x2d')]);_0x59a960['attributes']=_['intersection'](_0x41e9a7[_0x9481('0x31')],qs[_0x9481('0x38')](_0x4b204f['query']['fields']));_0x59a960[_0x9481('0x37')]=_0x59a960[_0x9481('0x37')][_0x9481('0x39')]?_0x59a960['attributes']:_0x41e9a7[_0x9481('0x31')];if(_0x4b204f[_0x9481('0x34')][_0x9481('0x42')]){_0x59a960[_0x9481('0x43')]=[{'all':!![]}];}_0x59a960=_[_0x9481('0x40')]({},_0x59a960,_0x4b204f['options']);return db[_0x9481('0x2c')][_0x9481('0x4b')](_0x59a960)['then'](handleEntityNotFound(_0x18ae95,null))[_0x9481('0x45')](function(_0x1a2165){if(_0x1a2165){var _0x3b175e=_0x1a2165[_0x9481('0x4d')]({'plain':!![]});_0x3b175e=qs['omit'](_0x3b175e,['id',_0x9481('0x4e'),_0x9481('0x4f')]);_0x4b204f[_0x9481('0x50')]=_[_0x9481('0x51')](_0x4b204f[_0x9481('0x50')],['id',_0x9481('0x4e'),_0x9481('0x4f')]);return db['Attachment'][_0x9481('0x52')](_[_0x9481('0x40')](_0x3b175e,_0x4b204f['body']),{'include':_0x4b204f[_0x9481('0x34')][_0x9481('0x42')]?[{'all':!![]}]:undefined});}})[_0x9481('0x45')](respondWithResult(_0x18ae95,0xc9))[_0x9481('0x47')](handleError(_0x18ae95,null));};exports['update']=function(_0xa0ec6c,_0x19b5e2){if(_0xa0ec6c['body']['id']){delete _0xa0ec6c[_0x9481('0x50')]['id'];}return db[_0x9481('0x2c')][_0x9481('0x4b')]({'where':{'id':_0xa0ec6c[_0x9481('0x49')]['id']}})[_0x9481('0x45')](handleEntityNotFound(_0x19b5e2,null))[_0x9481('0x45')](saveUpdates(_0xa0ec6c[_0x9481('0x50')],null))[_0x9481('0x45')](respondWithResult(_0x19b5e2,null))['catch'](handleError(_0x19b5e2,null));};exports[_0x9481('0x53')]=function(_0x3c4f66,_0x792d00){return db[_0x9481('0x2c')][_0x9481('0x4b')]({'where':{'id':_0x3c4f66['params']['id']}})[_0x9481('0x45')](handleEntityNotFound(_0x792d00,null))[_0x9481('0x45')](removeEntity(_0x792d00,null))[_0x9481('0x47')](handleError(_0x792d00,null));};exports[_0x9481('0x52')]=function(_0x5b3229,_0x446d67,_0x51f740){_0x5b3229[_0x9481('0x50')]['name']=_0x5b3229[_0x9481('0x54')][_0x9481('0x55')];_0x5b3229[_0x9481('0x50')][_0x9481('0x56')]=_0x5b3229[_0x9481('0x54')][_0x9481('0x57')];_0x5b3229['body']['type']=_0x5b3229['file'][_0x9481('0x58')];return db[_0x9481('0x2c')]['create'](_0x5b3229[_0x9481('0x50')])[_0x9481('0x45')](respondWithResult(_0x446d67,0xc9))[_0x9481('0x47')](handleError(_0x446d67,null));};exports[_0x9481('0x59')]=function(_0x2e26ce,_0x2a54e1,_0x2baf33){return db[_0x9481('0x2c')][_0x9481('0x5a')]({'where':{'id':_0x2e26ce[_0x9481('0x49')]['id']},'raw':!![]})[_0x9481('0x45')](handleEntityNotFound(_0x2a54e1,null))[_0x9481('0x45')](function(_0x49afb3){if(_0x49afb3){var _0x3c6236=_0x49afb3[_0x9481('0x5b')]!==null;var _0x2f0013=path[_0x9481('0x5c')](config[_0x9481('0x5d')],_0x9481('0x5e'));if(_0x3c6236){_0x2f0013=path[_0x9481('0x5c')](_0x2f0013,'offline-chat/');}var _0x3782db=path[_0x9481('0x5c')](_0x2f0013,_0x49afb3[_0x9481('0x56')]);return _0x2a54e1['download'](_0x3782db);}})[_0x9481('0x47')](handleError(_0x2a54e1,null));}; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 65c783f..4dc70e7 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 _0xd176=['Attachment','attachments','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xd176,0x18e));var _0x6d17=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0xd176[_0xf10840];return _0x1fdf7e;};'use strict';var _=require(_0x6d17('0x0'));var util=require('util');var logger=require(_0x6d17('0x1'))(_0x6d17('0x2'));var moment=require('moment');var BPromise=require(_0x6d17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d17('0x4'));var rimraf=require(_0x6d17('0x5'));var config=require(_0x6d17('0x6'));var attributes=require('./attachment.attributes');module[_0x6d17('0x7')]=function(_0x5d1bed,_0x8bf0f5){return _0x5d1bed[_0x6d17('0x8')](_0x6d17('0x9'),attributes,{'tableName':_0x6d17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index c058ff5..f708175 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 _0x8868=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8868,0x1ca));var _0x8886=function(_0x323506,_0x3a9eef){_0x323506=_0x323506-0x0;var _0x4d821b=_0x8868[_0x323506];return _0x4d821b;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var moment=require(_0x8886('0x2'));var BPromise=require(_0x8886('0x3'));var rs=require(_0x8886('0x4'));var fs=require('fs');var Redis=require(_0x8886('0x5'));var db=require(_0x8886('0x6'))['db'];var utils=require(_0x8886('0x7'));var logger=require(_0x8886('0x8'))(_0x8886('0x9'));var config=require(_0x8886('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b94d,_0x5e2a73,_0x1a85e1){return new BPromise(function(_0x56b9fa,_0x147fc9){return client[_0x8886('0xc')](_0x26b94d,_0x1a85e1)[_0x8886('0xd')](function(_0x39036d){logger[_0x8886('0xe')](_0x8886('0xf'),_0x5e2a73,'request\x20sent');logger[_0x8886('0x10')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5e2a73,'request\x20sent',JSON[_0x8886('0x11')](_0x39036d));if(_0x39036d['error']){if(_0x39036d[_0x8886('0x12')][_0x8886('0x13')]===0x1f4){logger[_0x8886('0x12')](_0x8886('0xf'),_0x5e2a73,_0x39036d['error'][_0x8886('0x14')]);return _0x147fc9(_0x39036d[_0x8886('0x12')]['message']);}logger[_0x8886('0x12')]('Attachment,\x20%s,\x20%s',_0x5e2a73,_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);return _0x56b9fa(_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x5e2a73,_0x8886('0x15'));_0x56b9fa(_0x39036d[_0x8886('0x16')]['message']);}})['catch'](function(_0x563a82){logger['error'](_0x8886('0xf'),_0x5e2a73,_0x563a82);_0x147fc9(_0x563a82);});});}exports[_0x8886('0x17')]=function(_0x1d47a6){var _0x5504ab=this;return new Promise(function(_0xb13c62,_0x20072e){return db[_0x8886('0x18')][_0x8886('0x19')](_0x1d47a6[_0x8886('0x1a')],{'raw':_0x1d47a6[_0x8886('0x1b')]?_0x1d47a6[_0x8886('0x1b')][_0x8886('0x1c')]===undefined?!![]:![]:!![]})[_0x8886('0xd')](function(_0x19f0ef){logger['info'](_0x8886('0x17'),_0x1d47a6);logger['debug'](_0x8886('0x17'),_0x1d47a6,JSON[_0x8886('0x11')](_0x19f0ef));_0xb13c62(_0x19f0ef);})['catch'](function(_0x3894a0){logger[_0x8886('0x12')](_0x8886('0x17'),_0x3894a0[_0x8886('0x14')],_0x1d47a6);_0x20072e(_0x5504ab[_0x8886('0x12')](0x1f4,_0x3894a0[_0x8886('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f892eae..aee2f4c 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x506670,_0x314ef8){var _0x3c3e58=function(_0x72d3d7){while(--_0x72d3d7){_0x506670['push'](_0x506670['shift']());}};_0x3c3e58(++_0x314ef8);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e754a,_0x6d4db5){_0x3e754a=_0x3e754a-0x0;var _0x12325b=_0xb10b[_0x3e754a];return _0x12325b;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +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 diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 89ca4ea..5ba1da6 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 _0xb111=['../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','then','add','minutes','getLicense','catch','status','send','message','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service'];(function(_0x5b85ea,_0xb36d15){var _0x226222=function(_0x1f578d){while(--_0x1f578d){_0x5b85ea['push'](_0x5b85ea['shift']());}};_0x226222(++_0xb36d15);}(_0xb111,0x189));var _0x1b11=function(_0x357d3f,_0x4ce165){_0x357d3f=_0x357d3f-0x0;var _0x2cd796=_0xb111[_0x357d3f];return _0x2cd796;};'use strict';var passport=require(_0x1b11('0x0'));var LocalStrategy=require(_0x1b11('0x1'))['Strategy'];var moment=require(_0x1b11('0x2'));var ActiveDirectory=require(_0x1b11('0x3'));var BPromise=require(_0x1b11('0x4'));var util=require('util');var db=require(_0x1b11('0x5'))['db'];var authService=require(_0x1b11('0x6'));var utils=require('../../config/utils');var config=require(_0x1b11('0x7'));var logger=require(_0x1b11('0x8'))(_0x1b11('0x9'));function isActiveDirectoryConfigured(_0x48c583){var _0x18c2dd=![];if(typeof _0x48c583[_0x1b11('0xa')]!==_0x1b11('0xb')){_0x18c2dd=_0x48c583[_0x1b11('0xa')]['baseDN']&&_0x48c583[_0x1b11('0xa')][_0x1b11('0xc')]&&_0x48c583[_0x1b11('0xa')][_0x1b11('0xd')];}return _0x18c2dd;}function adAuthenticate(_0x1e5518,_0x3bb29d,_0x2e7ed4){return new BPromise(function(_0x4a50e1,_0x572b8e){try{var _0x146e76=new ActiveDirectory(_0x1e5518);_0x146e76['authenticate'](_0x3bb29d,_0x2e7ed4,function(_0x3ddab4,_0x4a0b30){if(_0x3ddab4){logger[_0x1b11('0xe')](_0x1b11('0xf'),_0x3bb29d,util[_0x1b11('0x10')](_0x3ddab4,{'showHidden':![],'depth':null}));_0x572b8e(_0x1b11('0x11'));}else if(!_0x4a0b30){logger[_0x1b11('0xe')](_0x1b11('0x12'),_0x3bb29d);_0x572b8e(_0x1b11('0x11'));}else{_0x4a50e1(_0x4a0b30);}});}catch(_0x4776a7){_0x572b8e(_0x4776a7);}});}function ActiveDirectoryAuthenticate(_0x3b7eb9,_0x12a217,_0x5d83dd,_0x2c8b34){var _0x2337a9,_0x3eef3a;if(!isActiveDirectoryConfigured(config)){logger[_0x1b11('0xe')](_0x1b11('0x13'),_0x12a217);return _0x2c8b34(null,![],{'message':_0x1b11('0x11')});}return db[_0x1b11('0x14')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x1b11('0x15')],'raw':!![]})['then'](function(_0xee94a9){_0x2337a9=_0xee94a9;if(!_0x2337a9[_0x1b11('0x16')]){logger[_0x1b11('0xe')](_0x1b11('0x17'),_0x12a217);throw new Error(_0x1b11('0x11'));}return _0x3b7eb9[_0x1b11('0x18')]({'attributes':['id',_0x1b11('0x19'),_0x1b11('0x1a'),_0x1b11('0x1b'),_0x1b11('0x1c'),_0x1b11('0x1d'),_0x1b11('0x1e'),_0x1b11('0x1f'),_0x1b11('0x20')],'where':{'name':_0x12a217,'role':{'$or':[_0x1b11('0x21'),'user',_0x1b11('0x22')]},'adSsoEnabled':!![]}});})[_0x1b11('0x23')](function(_0x634515){if(!_0x634515||_0x634515&&_0x634515[_0x1b11('0x19')]!==_0x12a217){throw new Error(_0x1b11('0x11'));}_0x3eef3a=_0x634515;var _0x5be006=_0x3eef3a['name']+'@'+config[_0x1b11('0xa')][_0x1b11('0xd')];return adAuthenticate(config[_0x1b11('0xa')],_0x5be006,_0x5d83dd);})[_0x1b11('0x23')](function(_0x312118){if(_0x3eef3a[_0x1b11('0x1d')]){throw new Error(_0x1b11('0x11'));}if(_0x2337a9[_0x1b11('0x15')]>0x0){if(_0x3eef3a[_0x1b11('0x1e')]){if(moment(_0x3eef3a[_0x1b11('0x1f')])[_0x1b11('0x24')](_0x2337a9[_0x1b11('0x15')],_0x1b11('0x25'))>moment()){throw new Error(_0x1b11('0x11'));}return utils['clearBlockUser'](_0x3eef3a,0x0,![],null)[_0x1b11('0x23')](function(){return utils[_0x1b11('0x26')](_0x3eef3a);})[_0x1b11('0x23')](function(){return _0x2c8b34(null,_0x3eef3a);});}else{return utils[_0x1b11('0x26')](_0x3eef3a)[_0x1b11('0x23')](function(){return _0x2c8b34(null,_0x3eef3a);});}}else{return utils[_0x1b11('0x26')](_0x3eef3a)[_0x1b11('0x23')](function(){return _0x2c8b34(null,_0x3eef3a);});}})[_0x1b11('0x27')](function(_0x5909b5){return _0x2c8b34(null,![],_0x5909b5);});}function handleError(_0x6c5324,_0x5ae12a,_0x1d77c7){return _0x6c5324[_0x1b11('0x28')](_0x5ae12a||0x1f4)[_0x1b11('0x29')]({'message':_0x1d77c7?_0x1d77c7[_0x1b11('0x2a')]||_0x1d77c7:''});}exports['login']=function(_0xaf934b,_0x3eb756,_0x3678f2){passport[_0x1b11('0x2b')](_0x1b11('0x2c'),function(_0x53941a,_0x150201,_0x202e7b){var _0x261dd9=_0x53941a||_0x202e7b;if(_0x261dd9){return handleError(_0x3eb756,0x191,_0x261dd9);}if(!_0x150201){return handleError(_0x3eb756,0x194,{'message':_0x1b11('0x2d')});}else{var _0x5ae104={'payload':{'id':_0x150201['id'],'role':_0x150201['role']},'options':{'expiresIn':0x15180}};return authService[_0x1b11('0x2e')](_0x5ae104)[_0x1b11('0x23')](function(_0x45897a){_0x3eb756[_0x1b11('0x2f')]({'id':_0x150201['id'],'token':_0x45897a,'statusCall':'','isAlreadyLogged':_0x150201['online']});});}})(_0xaf934b,_0x3eb756,_0x3678f2);};passport[_0x1b11('0x30')](_0x1b11('0x2c'),new LocalStrategy({'usernameField':_0x1b11('0x19'),'passwordField':'password'},function(_0x28710c,_0x1cb896,_0x5e7fe3){return ActiveDirectoryAuthenticate(db[_0x1b11('0x31')],_0x28710c,_0x1cb896,_0x5e7fe3);})); \ No newline at end of file +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 diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index b7f9090..3d2b63f 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 _0x9d44=['login','express','post'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0x9d44,0x19f));var _0x49d4=function(_0x2484c6,_0x17dbbd){_0x2484c6=_0x2484c6-0x0;var _0x3d09a6=_0x9d44[_0x2484c6];return _0x3d09a6;};'use strict';var express=require(_0x49d4('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0x49d4('0x1')]('/',controller[_0x49d4('0x2')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index da0ec60..7fb855c 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(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x7a54,0x106));var _0x47a5=function(_0x2abf58,_0x3fc66c){_0x2abf58=_0x2abf58-0x0;var _0x250b6d=_0x7a54[_0x2abf58];return _0x250b6d;};'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(_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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 7bb2f7b..a27198e 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 _0xb769=['isMiddleware','express','Router','./authGoogle.controller','get','login','/callback'];(function(_0x5e2355,_0x1954a5){var _0xed2278=function(_0x2e65fa){while(--_0x2e65fa){_0x5e2355['push'](_0x5e2355['shift']());}};_0xed2278(++_0x1954a5);}(_0xb769,0x19e));var _0x9b76=function(_0x4d2fba,_0xe48894){_0x4d2fba=_0x4d2fba-0x0;var _0x554b0a=_0xb769[_0x4d2fba];return _0x554b0a;};'use strict';var express=require(_0x9b76('0x0'));var passport=require('passport');var router=express[_0x9b76('0x1')]();var controller=require(_0x9b76('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x9b76('0x3')]('/',controller[_0x9b76('0x4')]);router[_0x9b76('0x3')](_0x9b76('0x5'),controller['callback'],authService[_0x9b76('0x6')],userController[_0x9b76('0x4')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 1a83f53..c523cb1 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 _0xf1b6=['getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','send','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','use','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','blockDuration','then','password','role','disabled','blocked','blockedAt','loginAttempts','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','clearBlockUser','minutes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf1b6,0x129));var _0x6f1b=function(_0x56bed1,_0x44ce8f){_0x56bed1=_0x56bed1-0x0;var _0xcd14fa=_0xf1b6[_0x56bed1];return _0xcd14fa;};'use strict';var util=require(_0x6f1b('0x0'));var passport=require(_0x6f1b('0x1'));var LocalStrategy=require(_0x6f1b('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x6f1b('0x3'));var rs=require(_0x6f1b('0x4'));var moment=require(_0x6f1b('0x5'));var db=require(_0x6f1b('0x6'))['db'];var authService=require(_0x6f1b('0x7'));var utils=require(_0x6f1b('0x8'));var client=jayson[_0x6f1b('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x29b054,_0x33576e,_0xc607e6,_0x2ae297){var _0x484a84,_0x5f58d7;return db['Setting'][_0x6f1b('0xa')]({'where':{'id':0x1},'attributes':[_0x6f1b('0xb'),_0x6f1b('0xc')],'raw':!![]})[_0x6f1b('0xd')](function(_0x6a611c){_0x484a84=_0x6a611c;return _0x29b054[_0x6f1b('0xa')]({'attributes':['id','name',_0x6f1b('0xe'),'salt',_0x6f1b('0xf'),_0x6f1b('0x10'),_0x6f1b('0x11'),_0x6f1b('0x12'),_0x6f1b('0x13')],'where':{'name':_0x33576e,'role':{'$or':['admin',_0x6f1b('0x14'),'agent']}}});})['then'](function(_0x442465){if(!_0x442465||_0x442465&&_0x442465[_0x6f1b('0x15')]!==_0x33576e){throw new Error(_0x6f1b('0x16'));}else{_0x5f58d7=_0x442465;return _0x5f58d7;}})[_0x6f1b('0xd')](function(){_0x5f58d7[_0x6f1b('0x17')](_0xc607e6,function(_0x192e9c,_0x31daff){var _0x16942b=_0x5f58d7['loginAttempts']+0x1;if(_0x192e9c){return _0x2ae297(_0x192e9c);}else if(!_0x31daff){if(_0x5f58d7[_0x6f1b('0x10')]){return _0x2ae297(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x484a84[_0x6f1b('0xb')]>0x0){if(_0x5f58d7[_0x6f1b('0x11')]){if(_0x484a84[_0x6f1b('0xc')]>0x0){if(moment(_0x5f58d7['blockedAt'])[_0x6f1b('0x18')](_0x484a84[_0x6f1b('0xc')],'minutes')>moment()){return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});}else{return utils['clearBlockUser'](_0x5f58d7,_0x16942b,![],null)['then'](function(){return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});});}}else{return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});}}else{if(_0x16942b>=_0x484a84[_0x6f1b('0xb')]){return utils[_0x6f1b('0x19')](_0x5f58d7,0x0,!![],moment())[_0x6f1b('0xd')](function(){return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});});}else{return utils[_0x6f1b('0x19')](_0x5f58d7,_0x16942b,![],null)[_0x6f1b('0xd')](function(){return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});});}}}else{return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});}}else{if(_0x5f58d7[_0x6f1b('0x10')]){return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});}else if(_0x484a84[_0x6f1b('0xb')]>0x0){if(_0x5f58d7[_0x6f1b('0x11')]){if(_0x484a84[_0x6f1b('0xc')]>0x0){if(moment(_0x5f58d7[_0x6f1b('0x12')])[_0x6f1b('0x18')](_0x484a84[_0x6f1b('0xc')],_0x6f1b('0x1a'))>moment()){return _0x2ae297(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x6f1b('0x19')](_0x5f58d7,0x0,![],null)[_0x6f1b('0xd')](function(){return utils['getLicense'](_0x5f58d7);})[_0x6f1b('0xd')](function(){return _0x2ae297(null,_0x5f58d7);});}}else{return _0x2ae297(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x6f1b('0x19')](_0x5f58d7,0x0,![],null)['then'](function(){return utils[_0x6f1b('0x1b')](_0x5f58d7);})[_0x6f1b('0xd')](function(){return _0x2ae297(null,_0x5f58d7);})[_0x6f1b('0x1c')](function(_0x532af7){return _0x2ae297(null,![],_0x532af7);});}}else{if(_0x5f58d7['blocked']){return _0x2ae297(null,![],{'message':_0x6f1b('0x16')});}else{return utils['getLicense'](_0x5f58d7)['then'](function(){return _0x2ae297(null,_0x5f58d7);});}}}});})[_0x6f1b('0x1c')](function(_0x30ef61){return _0x2ae297(null,![],_0x30ef61);});}function sendServiceMail(_0x4f592e){return db[_0x6f1b('0x1d')][_0x6f1b('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x6f1b('0x1f')],'include':[{'model':db[_0x6f1b('0x20')],'as':_0x6f1b('0x21'),'include':[{'model':db['CloudProvider'],'as':_0x6f1b('0x22')}]}]})[_0x6f1b('0xd')](function(_0x381ef2){if(!_0x381ef2){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x119ccc=_0x381ef2[_0x6f1b('0x23')]();var _0x4cbb81={'account':_0x119ccc,'message':_[_0x6f1b('0x24')]({'from':util[_0x6f1b('0x25')](_0x6f1b('0x26'),_0x381ef2[_0x6f1b('0x15')],_0x381ef2['email']||_0x381ef2[_0x6f1b('0x21')][_0x6f1b('0x14')])},_0x4f592e)};return client[_0x6f1b('0x27')]('SendMail',_0x4cbb81);})[_0x6f1b('0xd')](function(_0x2c164f){if(_0x2c164f[_0x6f1b('0x28')]){throw new Error(util[_0x6f1b('0x25')](_0x6f1b('0x29'),_0x2c164f[_0x6f1b('0x28')][_0x6f1b('0x2a')]||JSON[_0x6f1b('0x2b')](_0x2c164f[_0x6f1b('0x28')])));}return!![];});}function handleError(_0x3ce646,_0x4e4f1b,_0x487413){return _0x3ce646[_0x6f1b('0x2c')](_0x4e4f1b||0x1f4)['send']({'message':_0x487413?_0x487413[_0x6f1b('0x2a')]||_0x487413:''});}exports[_0x6f1b('0x2d')]=function(_0x1e4ba8,_0x2c16b5,_0x3cea9f){passport['authenticate'](_0x6f1b('0x2e'),function(_0x3f6621,_0x25a8a6,_0x1abe63){var _0x3ced1b=_0x3f6621||_0x1abe63;if(_0x3ced1b){return handleError(_0x2c16b5,0x191,_0x3ced1b);}if(!_0x25a8a6){return handleError(_0x2c16b5,0x194,{'message':_0x6f1b('0x2f')});}else{var _0x177ef7={'payload':{'id':_0x25a8a6['id'],'role':_0x25a8a6[_0x6f1b('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x6f1b('0x30')](_0x177ef7)[_0x6f1b('0xd')](function(_0x2ad951){_0x2c16b5[_0x6f1b('0x31')]({'id':_0x25a8a6['id'],'token':_0x2ad951,'statusCall':'','isAlreadyLogged':_0x25a8a6[_0x6f1b('0x32')]});});}})(_0x1e4ba8,_0x2c16b5,_0x3cea9f);};exports[_0x6f1b('0x33')]=function(_0x40080a,_0xfaaf58){if(!_0x40080a[_0x6f1b('0x34')]['email']){return handleError(_0xfaaf58,0x1f4,{'message':_0x6f1b('0x35')});}var _0x298764=rs['generate']();_0x40080a[_0x6f1b('0x34')][_0x6f1b('0x1f')]=_0x40080a[_0x6f1b('0x34')][_0x6f1b('0x1f')][_0x6f1b('0x36')]()[_0x6f1b('0x37')]();var _0x18a1d6;return db['Setting'][_0x6f1b('0xa')]({'where':{'id':0x1},'attributes':[_0x6f1b('0xb'),_0x6f1b('0xc')],'raw':!![]})['then'](function(_0x45e5f8){_0x18a1d6=_0x45e5f8;return db[_0x6f1b('0x38')]['find']({'where':{'email':_0x40080a['body']['email']}});})[_0x6f1b('0xd')](function(_0x13e607){if(!_0x13e607){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x13e607[_0x6f1b('0x10')]){throw new Error(_0x6f1b('0x39'));}if(_0x13e607[_0x6f1b('0x11')]){if(moment(_0x13e607[_0x6f1b('0x12')])['add'](_0x18a1d6[_0x6f1b('0xc')],'minutes')>moment()){throw new Error(_0x6f1b('0x3a'));}else{_0x13e607['blocked']=![];_0x13e607['blockedAt']=null;}}_0x13e607['resetPasswordToken']=_0x298764;_0x13e607[_0x6f1b('0x3b')]=Date[_0x6f1b('0x3c')]()+0x36ee80;return _0x13e607[_0x6f1b('0x3d')]();})[_0x6f1b('0xd')](function(){return sendServiceMail({'to':_0x40080a['body'][_0x6f1b('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x6f1b('0x3e')+_0x6f1b('0x3f')+_0x6f1b('0x40')+_0x40080a[_0x6f1b('0x41')][_0x6f1b('0x42')]+_0x6f1b('0x43')+_0x298764+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x6f1b('0xd')](function(){_0xfaaf58['status'](0xc8)[_0x6f1b('0x44')]({'message':'Reset\x20Email\x20sent!'});})[_0x6f1b('0x1c')](function(_0x39eeb2){return handleError(_0xfaaf58,0x1f4,_0x39eeb2);});};exports[_0x6f1b('0x45')]=function(_0x52b2e4,_0x38355a){return db[_0x6f1b('0x38')][_0x6f1b('0x1e')]({'where':{'resetPasswordToken':_0x52b2e4[_0x6f1b('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0x6f1b('0x3c')]()}}})[_0x6f1b('0xd')](function(_0x325df2){if(!_0x325df2){throw new Error(_0x6f1b('0x47'));}return db[_0x6f1b('0x48')][_0x6f1b('0xa')]({'attributes':['id',_0x6f1b('0x49'),_0x6f1b('0x4a'),'passwordHistoryLimit']})[_0x6f1b('0xd')](function(_0x16c1cf){if(_0x16c1cf[_0x6f1b('0x49')])authService[_0x6f1b('0x4b')](_0x52b2e4[_0x6f1b('0x34')]['password']);if(!_0x16c1cf['enforcePasswordHistory']||!_0x325df2[_0x6f1b('0x4c')])return _0x325df2;authService[_0x6f1b('0x4d')](_0x52b2e4['body'][_0x6f1b('0xe')],_0x325df2[_0x6f1b('0x4c')],_0x16c1cf[_0x6f1b('0x4e')]);return _0x325df2;})[_0x6f1b('0xd')](function(){_0x325df2[_0x6f1b('0xe')]=_0x52b2e4['body'][_0x6f1b('0xe')];_0x325df2[_0x6f1b('0x4f')]=null;_0x325df2[_0x6f1b('0x3b')]=null;return _0x325df2[_0x6f1b('0x3d')]();});})['then'](function(){_0x38355a['status'](0xc8)[_0x6f1b('0x44')]({'message':'Password\x20reset!'});})[_0x6f1b('0x1c')](function(_0x477937){return handleError(_0x38355a,0x1f4,_0x477937);});};passport[_0x6f1b('0x50')](_0x6f1b('0x2e'),new LocalStrategy({'usernameField':_0x6f1b('0x15'),'passwordField':_0x6f1b('0xe')},function(_0x151f77,_0x26496,_0x53936a){return localAuthenticate(db[_0x6f1b('0x38')],_0x151f77,_0x26496,_0x53936a);})); \ No newline at end of file +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 diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index cf312f0..a82732c 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 _0xf2c0=['post','login','forgot','exports','express','Router'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xf2c0,0x17e));var _0x0f2c=function(_0xe34787,_0x2af577){_0xe34787=_0xe34787-0x0;var _0x1111ba=_0xf2c0[_0xe34787];return _0x1111ba;};'use strict';var express=require(_0x0f2c('0x0'));var router=express[_0x0f2c('0x1')]();var controller=require('./authLocal.controller');router[_0x0f2c('0x2')]('/',controller[_0x0f2c('0x3')]);router[_0x0f2c('0x2')]('/forgot',controller[_0x0f2c('0x4')]);router[_0x0f2c('0x2')]('/reset/:token',controller['reset']);module[_0x0f2c('0x5')]=router; \ No newline at end of file +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 diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c7e61dc..0b83173 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 _0xf973=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xf973,0x1a7));var _0x3f97=function(_0x227cfb,_0x4f42cf){_0x227cfb=_0x227cfb-0x0;var _0x131407=_0xf973[_0x227cfb];return _0x131407;};'use strict';var Sequelize=require('sequelize');module[_0x3f97('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x3f97('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x3f97('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3f97('0x3')],'defaultValue':0xa}}; \ No newline at end of file +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 diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 34f6196..712f8bb 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 _0x5653=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','addConditions','Condition','ids','omit','getConditions','pick','addActions','Action','findOne','getActions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x264999,_0x44639f){var _0x3f8990=function(_0x38fa99){while(--_0x38fa99){_0x264999['push'](_0x264999['shift']());}};_0x3f8990(++_0x44639f);}(_0x5653,0x1a4));var _0x3565=function(_0x17a9d8,_0x47164c){_0x17a9d8=_0x17a9d8-0x0;var _0x346311=_0x5653[_0x17a9d8];return _0x346311;};'use strict';var emlformat=require(_0x3565('0x0'));var rimraf=require(_0x3565('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3565('0x2'));var rp=require(_0x3565('0x3'));var moment=require('moment');var BPromise=require(_0x3565('0x4'));var Mustache=require(_0x3565('0x5'));var util=require(_0x3565('0x6'));var path=require(_0x3565('0x7'));var sox=require(_0x3565('0x8'));var csv=require(_0x3565('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3565('0xa'));var _=require(_0x3565('0xb'));var squel=require(_0x3565('0xc'));var crypto=require(_0x3565('0xd'));var jsforce=require(_0x3565('0xe'));var deskjs=require(_0x3565('0xf'));var toCsv=require(_0x3565('0x9'));var querystring=require(_0x3565('0x10'));var Papa=require(_0x3565('0x11'));var Redis=require(_0x3565('0x12'));var authService=require(_0x3565('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3565('0x14'));var hardwareService=require(_0x3565('0x15'));var logger=require(_0x3565('0x16'))(_0x3565('0x17'));var utils=require(_0x3565('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3565('0x19'));var db=require(_0x3565('0x1a'))['db'];function respondWithStatusCode(_0x29b94a,_0x1d0fcf){_0x1d0fcf=_0x1d0fcf||0xcc;return function(_0x3a3f94){if(_0x3a3f94){return _0x29b94a[_0x3565('0x1b')](_0x1d0fcf);}return _0x29b94a[_0x3565('0x1c')](_0x1d0fcf)[_0x3565('0x1d')]();};}function respondWithResult(_0x41d29f,_0x16a91d){_0x16a91d=_0x16a91d||0xc8;return function(_0x5e36d0){if(_0x5e36d0){return _0x41d29f[_0x3565('0x1c')](_0x16a91d)[_0x3565('0x1e')](_0x5e36d0);}};}function respondWithFilteredResult(_0x1ca1a0,_0x556f37){return function(_0x3e7dfc){if(_0x3e7dfc){var _0x543a4c=typeof _0x556f37[_0x3565('0x1f')]===_0x3565('0x20')&&typeof _0x556f37[_0x3565('0x21')]==='undefined';var _0x575264=_0x3e7dfc[_0x3565('0x22')];var _0x8ead4=_0x543a4c?0x0:_0x556f37['offset'];var _0x14dfa3=_0x543a4c?_0x3e7dfc[_0x3565('0x22')]:_0x556f37[_0x3565('0x1f')]+_0x556f37[_0x3565('0x21')];var _0x1f9aeb;if(_0x14dfa3>=_0x575264){_0x14dfa3=_0x575264;_0x1f9aeb=0xc8;}else{_0x1f9aeb=0xce;}_0x1ca1a0[_0x3565('0x1c')](_0x1f9aeb);return _0x1ca1a0['set'](_0x3565('0x23'),_0x8ead4+'-'+_0x14dfa3+'/'+_0x575264)[_0x3565('0x1e')](_0x3e7dfc);}return null;};}function patchUpdates(_0x12c8cd){return function(_0xe0826f){try{jsonpatch[_0x3565('0x24')](_0xe0826f,_0x12c8cd,!![]);}catch(_0x38b405){return BPromise['reject'](_0x38b405);}return _0xe0826f[_0x3565('0x25')]();};}function saveUpdates(_0x13d64c,_0x1c9ff9){return function(_0x1f779b){if(_0x1f779b){return _0x1f779b[_0x3565('0x26')](_0x13d64c)[_0x3565('0x27')](function(_0xccd091){return _0xccd091;});}return null;};}function removeEntity(_0xa1f4c7,_0x5e6a6b){return function(_0x3decc2){if(_0x3decc2){return _0x3decc2['destroy']()[_0x3565('0x27')](function(){_0xa1f4c7[_0x3565('0x1c')](0xcc)[_0x3565('0x1d')]();});}};}function handleEntityNotFound(_0x1cd05f,_0x1ba75d){return function(_0x3bde63){if(!_0x3bde63){_0x1cd05f[_0x3565('0x1b')](0x194);}return _0x3bde63;};}function handleError(_0x54b1c0,_0x547474){_0x547474=_0x547474||0x1f4;return function(_0x236ac2){logger[_0x3565('0x28')](_0x236ac2[_0x3565('0x29')]);if(_0x236ac2['name']){delete _0x236ac2[_0x3565('0x2a')];}_0x54b1c0[_0x3565('0x1c')](_0x547474)[_0x3565('0x2b')](_0x236ac2);};}exports[_0x3565('0x2c')]=function(_0x2330d8,_0x2a5de4){var _0x9a38f={},_0x8d5c05={},_0x1674f5={'count':0x0,'rows':[]};var _0x568d4b=_[_0x3565('0x2d')](db[_0x3565('0x2e')][_0x3565('0x2f')],function(_0x5be5de){return{'name':_0x5be5de[_0x3565('0x30')],'type':_0x5be5de[_0x3565('0x31')]['key']};});_0x8d5c05['model']=_['map'](_0x568d4b,_0x3565('0x2a'));_0x8d5c05[_0x3565('0x32')]=_['keys'](_0x2330d8['query']);_0x8d5c05[_0x3565('0x33')]=_[_0x3565('0x34')](_0x8d5c05[_0x3565('0x35')],_0x8d5c05[_0x3565('0x32')]);_0x9a38f[_0x3565('0x36')]=_[_0x3565('0x34')](_0x8d5c05[_0x3565('0x35')],qs['fields'](_0x2330d8['query'][_0x3565('0x37')]));_0x9a38f['attributes']=_0x9a38f[_0x3565('0x36')][_0x3565('0x38')]?_0x9a38f[_0x3565('0x36')]:_0x8d5c05[_0x3565('0x35')];if(!_0x2330d8[_0x3565('0x32')][_0x3565('0x39')](_0x3565('0x3a'))){_0x9a38f['limit']=qs['limit'](_0x2330d8[_0x3565('0x32')]['limit']);_0x9a38f[_0x3565('0x1f')]=qs[_0x3565('0x1f')](_0x2330d8[_0x3565('0x32')][_0x3565('0x1f')]);}_0x9a38f[_0x3565('0x3b')]=qs[_0x3565('0x3c')](_0x2330d8['query'][_0x3565('0x3c')]);_0x9a38f[_0x3565('0x3d')]=qs['filters'](_['pick'](_0x2330d8[_0x3565('0x32')],_0x8d5c05['filters']),_0x568d4b);if(_0x2330d8[_0x3565('0x32')][_0x3565('0x3e')]){_0x9a38f['where']=_[_0x3565('0x3f')](_0x9a38f[_0x3565('0x3d')],{'$or':_[_0x3565('0x2d')](_0x568d4b,function(_0x244e08){if(_0x244e08[_0x3565('0x31')]!=='VIRTUAL'){var _0x563db7={};_0x563db7[_0x244e08['name']]={'$like':'%'+_0x2330d8[_0x3565('0x32')][_0x3565('0x3e')]+'%'};return _0x563db7;}})});}_0x9a38f=_[_0x3565('0x3f')]({},_0x9a38f,_0x2330d8[_0x3565('0x40')]);var _0x256d2e={'where':_0x9a38f[_0x3565('0x3d')]};return db[_0x3565('0x2e')][_0x3565('0x22')](_0x256d2e)[_0x3565('0x27')](function(_0x51a0ec){_0x1674f5[_0x3565('0x22')]=_0x51a0ec;if(_0x2330d8['query'][_0x3565('0x41')]){_0x9a38f[_0x3565('0x42')]=[{'all':!![]}];}return db[_0x3565('0x2e')][_0x3565('0x43')](_0x9a38f);})[_0x3565('0x27')](function(_0x76aa0b){_0x1674f5[_0x3565('0x44')]=_0x76aa0b;return _0x1674f5;})['then'](respondWithFilteredResult(_0x2a5de4,_0x9a38f))[_0x3565('0x45')](handleError(_0x2a5de4,null));};exports[_0x3565('0x46')]=function(_0x9f84e6,_0x339029){var _0x48a0b1={'raw':![],'where':{'id':_0x9f84e6[_0x3565('0x47')]['id']}},_0x172d18={};_0x172d18[_0x3565('0x35')]=_['keys'](db[_0x3565('0x2e')][_0x3565('0x2f')]);_0x172d18['query']=_[_0x3565('0x48')](_0x9f84e6[_0x3565('0x32')]);_0x172d18[_0x3565('0x33')]=_['intersection'](_0x172d18[_0x3565('0x35')],_0x172d18[_0x3565('0x32')]);_0x48a0b1[_0x3565('0x36')]=_[_0x3565('0x34')](_0x172d18[_0x3565('0x35')],qs[_0x3565('0x37')](_0x9f84e6[_0x3565('0x32')][_0x3565('0x37')]));_0x48a0b1[_0x3565('0x36')]=_0x48a0b1[_0x3565('0x36')][_0x3565('0x38')]?_0x48a0b1[_0x3565('0x36')]:_0x172d18[_0x3565('0x35')];if(_0x9f84e6[_0x3565('0x32')]['includeAll']){_0x48a0b1['include']=[{'all':!![]}];}_0x48a0b1=_['merge']({},_0x48a0b1,_0x9f84e6[_0x3565('0x40')]);return db[_0x3565('0x2e')][_0x3565('0x49')](_0x48a0b1)[_0x3565('0x27')](handleEntityNotFound(_0x339029,null))['then'](respondWithResult(_0x339029,null))[_0x3565('0x45')](handleError(_0x339029,null));};exports[_0x3565('0x4a')]=function(_0x28c96b,_0xa8b794){return db[_0x3565('0x2e')][_0x3565('0x4a')](_0x28c96b[_0x3565('0x4b')],{})[_0x3565('0x27')](respondWithResult(_0xa8b794,0xc9))['catch'](handleError(_0xa8b794,null));};exports['update']=function(_0x32e97b,_0x28e5f0){if(_0x32e97b['body']['id']){delete _0x32e97b['body']['id'];}return db[_0x3565('0x2e')]['find']({'where':{'id':_0x32e97b[_0x3565('0x47')]['id']}})[_0x3565('0x27')](handleEntityNotFound(_0x28e5f0,null))[_0x3565('0x27')](saveUpdates(_0x32e97b[_0x3565('0x4b')],null))[_0x3565('0x27')](respondWithResult(_0x28e5f0,null))[_0x3565('0x45')](handleError(_0x28e5f0,null));};exports['destroy']=function(_0x4f7395,_0x134747){return db['Automation'][_0x3565('0x49')]({'where':{'id':_0x4f7395['params']['id']}})[_0x3565('0x27')](handleEntityNotFound(_0x134747,null))[_0x3565('0x27')](removeEntity(_0x134747,null))['catch'](handleError(_0x134747,null));};exports[_0x3565('0x4c')]=function(_0x330b0f,_0x5cfc88,_0xbcc214){return db[_0x3565('0x4d')][_0x3565('0x49')]({'where':{'id':_0x330b0f['params']['id']}})['then'](handleEntityNotFound(_0x5cfc88,null))[_0x3565('0x27')](function(_0x2c996f){if(_0x2c996f){return _0x2c996f[_0x3565('0x4c')](_0x330b0f[_0x3565('0x4b')][_0x3565('0x4e')],_[_0x3565('0x4f')](_0x330b0f[_0x3565('0x4b')],[_0x3565('0x4e'),'id'])||{});}})[_0x3565('0x27')](respondWithResult(_0x5cfc88,null))[_0x3565('0x45')](handleError(_0x5cfc88,null));};exports[_0x3565('0x50')]=function(_0x2b488c,_0x517035,_0xdb86a1){var _0x59aad3={};var _0x12fa49={};var _0x1b5efa;var _0x4f7c06;return db[_0x3565('0x2e')]['findOne']({'where':{'id':_0x2b488c[_0x3565('0x47')]['id']}})[_0x3565('0x27')](handleEntityNotFound(_0x517035,null))['then'](function(_0x2db511){if(_0x2db511){_0x1b5efa=_0x2db511;_0x12fa49['model']=_[_0x3565('0x48')](db['Condition']['rawAttributes']);_0x12fa49[_0x3565('0x32')]=_[_0x3565('0x48')](_0x2b488c[_0x3565('0x32')]);_0x12fa49[_0x3565('0x33')]=_['intersection'](_0x12fa49[_0x3565('0x35')],_0x12fa49[_0x3565('0x32')]);_0x59aad3[_0x3565('0x36')]=_[_0x3565('0x34')](_0x12fa49['model'],qs[_0x3565('0x37')](_0x2b488c[_0x3565('0x32')]['fields']));_0x59aad3[_0x3565('0x36')]=_0x59aad3['attributes']['length']?_0x59aad3[_0x3565('0x36')]:_0x12fa49[_0x3565('0x35')];_0x59aad3[_0x3565('0x3b')]=qs[_0x3565('0x3c')](_0x2b488c['query'][_0x3565('0x3c')]);_0x59aad3[_0x3565('0x3d')]=qs['filters'](_[_0x3565('0x51')](_0x2b488c['query'],_0x12fa49['filters']));if(_0x2b488c['query'][_0x3565('0x3e')]){_0x59aad3[_0x3565('0x3d')]=_[_0x3565('0x3f')](_0x59aad3[_0x3565('0x3d')],{'$or':_[_0x3565('0x2d')](_0x59aad3['attributes'],function(_0x450e0d){var _0x2769b5={};_0x2769b5[_0x450e0d]={'$like':'%'+_0x2b488c[_0x3565('0x32')][_0x3565('0x3e')]+'%'};return _0x2769b5;})});}_0x59aad3=_['merge']({},_0x59aad3,_0x2b488c[_0x3565('0x40')]);return _0x1b5efa[_0x3565('0x50')](_0x59aad3);}})[_0x3565('0x27')](function(_0x3876ca){if(_0x3876ca){_0x4f7c06=_0x3876ca[_0x3565('0x38')];if(!_0x2b488c[_0x3565('0x32')][_0x3565('0x39')](_0x3565('0x3a'))){_0x59aad3[_0x3565('0x21')]=qs['limit'](_0x2b488c[_0x3565('0x32')][_0x3565('0x21')]);_0x59aad3[_0x3565('0x1f')]=qs['offset'](_0x2b488c[_0x3565('0x32')][_0x3565('0x1f')]);}return _0x1b5efa[_0x3565('0x50')](_0x59aad3);}})[_0x3565('0x27')](function(_0x5af6ed){if(_0x5af6ed){return _0x5af6ed?{'count':_0x4f7c06,'rows':_0x5af6ed}:null;}})[_0x3565('0x27')](respondWithResult(_0x517035,null))[_0x3565('0x45')](handleError(_0x517035,null));};exports[_0x3565('0x52')]=function(_0x54bf64,_0x50c621,_0x5df0f5){return db[_0x3565('0x53')][_0x3565('0x49')]({'where':{'id':_0x54bf64['params']['id']}})[_0x3565('0x27')](handleEntityNotFound(_0x50c621,null))[_0x3565('0x27')](function(_0x53f2a9){if(_0x53f2a9){return _0x53f2a9[_0x3565('0x52')](_0x54bf64[_0x3565('0x4b')][_0x3565('0x4e')],_[_0x3565('0x4f')](_0x54bf64[_0x3565('0x4b')],[_0x3565('0x4e'),'id'])||{});}})[_0x3565('0x27')](respondWithResult(_0x50c621,null))['catch'](handleError(_0x50c621,null));};exports['getActions']=function(_0x377fd5,_0x10f4de,_0x3b9cb8){var _0x125caf={};var _0x9c0f7e={};var _0x234163;var _0x487c25;return db['Automation'][_0x3565('0x54')]({'where':{'id':_0x377fd5[_0x3565('0x47')]['id']}})[_0x3565('0x27')](handleEntityNotFound(_0x10f4de,null))['then'](function(_0x473f73){if(_0x473f73){_0x234163=_0x473f73;_0x9c0f7e[_0x3565('0x35')]=_[_0x3565('0x48')](db[_0x3565('0x53')][_0x3565('0x2f')]);_0x9c0f7e[_0x3565('0x32')]=_[_0x3565('0x48')](_0x377fd5['query']);_0x9c0f7e[_0x3565('0x33')]=_[_0x3565('0x34')](_0x9c0f7e[_0x3565('0x35')],_0x9c0f7e[_0x3565('0x32')]);_0x125caf[_0x3565('0x36')]=_[_0x3565('0x34')](_0x9c0f7e[_0x3565('0x35')],qs[_0x3565('0x37')](_0x377fd5[_0x3565('0x32')][_0x3565('0x37')]));_0x125caf[_0x3565('0x36')]=_0x125caf['attributes'][_0x3565('0x38')]?_0x125caf[_0x3565('0x36')]:_0x9c0f7e[_0x3565('0x35')];_0x125caf['order']=qs[_0x3565('0x3c')](_0x377fd5[_0x3565('0x32')][_0x3565('0x3c')]);_0x125caf[_0x3565('0x3d')]=qs[_0x3565('0x33')](_[_0x3565('0x51')](_0x377fd5[_0x3565('0x32')],_0x9c0f7e[_0x3565('0x33')]));if(_0x377fd5[_0x3565('0x32')]['filter']){_0x125caf[_0x3565('0x3d')]=_['merge'](_0x125caf[_0x3565('0x3d')],{'$or':_[_0x3565('0x2d')](_0x125caf[_0x3565('0x36')],function(_0x8d61d7){var _0x200767={};_0x200767[_0x8d61d7]={'$like':'%'+_0x377fd5['query'][_0x3565('0x3e')]+'%'};return _0x200767;})});}_0x125caf=_[_0x3565('0x3f')]({},_0x125caf,_0x377fd5['options']);return _0x234163[_0x3565('0x55')](_0x125caf);}})['then'](function(_0x41bc34){if(_0x41bc34){_0x487c25=_0x41bc34['length'];if(!_0x377fd5[_0x3565('0x32')][_0x3565('0x39')](_0x3565('0x3a'))){_0x125caf[_0x3565('0x21')]=qs[_0x3565('0x21')](_0x377fd5[_0x3565('0x32')][_0x3565('0x21')]);_0x125caf[_0x3565('0x1f')]=qs[_0x3565('0x1f')](_0x377fd5[_0x3565('0x32')][_0x3565('0x1f')]);}return _0x234163[_0x3565('0x55')](_0x125caf);}})[_0x3565('0x27')](function(_0x29198d){if(_0x29198d){return _0x29198d?{'count':_0x487c25,'rows':_0x29198d}:null;}})[_0x3565('0x27')](respondWithResult(_0x10f4de,null))['catch'](handleError(_0x10f4de,null));}; \ No newline at end of file +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 diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6889317..7866611 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 _0xc769=['path','../../config/environment','./automation.attributes','define','tools_automations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x317646,_0x264fea){var _0x59476c=function(_0x38cdce){while(--_0x38cdce){_0x317646['push'](_0x317646['shift']());}};_0x59476c(++_0x264fea);}(_0xc769,0xb5));var _0x9c76=function(_0x5e9207,_0x19933e){_0x5e9207=_0x5e9207-0x0;var _0x31dd5c=_0xc769[_0x5e9207];return _0x31dd5c;};'use strict';var _=require(_0x9c76('0x0'));var util=require('util');var logger=require(_0x9c76('0x1'))(_0x9c76('0x2'));var moment=require(_0x9c76('0x3'));var BPromise=require(_0x9c76('0x4'));var rp=require(_0x9c76('0x5'));var fs=require('fs');var path=require(_0x9c76('0x6'));var rimraf=require('rimraf');var config=require(_0x9c76('0x7'));var attributes=require(_0x9c76('0x8'));module['exports']=function(_0x2ee3b0,_0xa0f407){return _0x2ee3b0[_0x9c76('0x9')]('Automation',attributes,{'tableName':_0x9c76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 77860cf..4cac613 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 _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x51dd76,_0x2d9266){var _0xe5641f=function(_0xc4070b){while(--_0xc4070b){_0x51dd76['push'](_0x51dd76['shift']());}};_0xe5641f(++_0x2d9266);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x155547,_0x594e68){_0x155547=_0x155547-0x0;var _0x2945a9=_0xdd4f[_0x155547];return _0x2945a9;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file +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 diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 59917cd..547577f 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 _0xba33=['post','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xba33,0xf1));var _0x3ba3=function(_0x1330dc,_0x3b058f){_0x1330dc=_0x1330dc-0x0;var _0x31e1da=_0xba33[_0x1330dc];return _0x31e1da;};'use strict';var multer=require(_0x3ba3('0x0'));var util=require(_0x3ba3('0x1'));var path=require(_0x3ba3('0x2'));var timeout=require(_0x3ba3('0x3'));var express=require('express');var router=express[_0x3ba3('0x4')]();var fs_extra=require(_0x3ba3('0x5'));var auth=require(_0x3ba3('0x6'));var interaction=require(_0x3ba3('0x7'));var config=require(_0x3ba3('0x8'));var controller=require(_0x3ba3('0x9'));router[_0x3ba3('0xa')]('/',auth[_0x3ba3('0xb')](),controller[_0x3ba3('0xc')]);router[_0x3ba3('0xa')](_0x3ba3('0xd'),auth['isAuthenticated'](),controller[_0x3ba3('0xe')]);router[_0x3ba3('0xa')](_0x3ba3('0xf'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x10')]);router['get'](_0x3ba3('0x11'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3ba3('0x13')](_0x3ba3('0xf'),auth[_0x3ba3('0xb')](),controller['addConditions']);router[_0x3ba3('0x13')](_0x3ba3('0x11'),auth['isAuthenticated'](),controller[_0x3ba3('0x14')]);router[_0x3ba3('0x15')](_0x3ba3('0xd'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x16')]);router[_0x3ba3('0x17')](_0x3ba3('0xd'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x18')]);module[_0x3ba3('0x19')]=router; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5d7e218..01c960b 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 _0x8f5b=['#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)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x1f009c,_0x508898){var _0x461de4=function(_0x5a23be){while(--_0x5a23be){_0x1f009c['push'](_0x1f009c['shift']());}};_0x461de4(++_0x508898);}(_0x8f5b,0x129));var _0xb8f5=function(_0x520758,_0x5113b7){_0x520758=_0x520758-0x0;var _0x49b8c3=_0x8f5b[_0x520758];return _0x49b8c3;};'use strict';var Sequelize=require(_0xb8f5('0x0'));module[_0xb8f5('0x1')]={'name':{'type':Sequelize[_0xb8f5('0x2')],'unique':_0xb8f5('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb8f5('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xb8f5('0x5')},'description':{'type':Sequelize[_0xb8f5('0x2')]},'active':{'type':Sequelize[_0xb8f5('0x6')],'defaultValue':0x0,'comment':_0xb8f5('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xb8f5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xb8f5('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb8f5('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb8f5('0x9')](0x5)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb8f5('0x9')](0x5)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb8f5('0x9')](0x5)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb8f5('0xd')},'dialTimezone':{'type':Sequelize[_0xb8f5('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb8f5('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xb8f5('0x4')](_0xb8f5('0xe'),_0xb8f5('0xf'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb8f5('0x6')],'defaultValue':0x0,'comment':_0xb8f5('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0xb8f5('0x9')](0x9)[_0xb8f5('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb8f5('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xb8f5('0x9')](0x9)[_0xb8f5('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb8f5('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb8f5('0x9')](0x9)[_0xb8f5('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xb8f5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb8f5('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xb8f5('0x9')](0x9)[_0xb8f5('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb8f5('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb8f5('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb8f5('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb8f5('0x9')](0x9)[_0xb8f5('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb8f5('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb8f5('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb8f5('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb8f5('0x9')](0x9)[_0xb8f5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xb8f5('0x18'),_0xb8f5('0x19')),'defaultValue':_0xb8f5('0x18')},'dialPrefix':{'type':Sequelize[_0xb8f5('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb8f5('0x1a')},'dialCutDigit':{'type':Sequelize[_0xb8f5('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb8f5('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb8f5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8f5('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xb8f5('0x9')](0x5)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8f5('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb8f5('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8f5('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)[_0xb8f5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb8f5('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb8f5('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8f5('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb8f5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b8cd938..cd34bc2 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 _0x1c7c=['user','role','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','ListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Campaign','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body'];(function(_0x2338c6,_0x59e67b){var _0x516b83=function(_0x42f047){while(--_0x42f047){_0x2338c6['push'](_0x2338c6['shift']());}};_0x516b83(++_0x59e67b);}(_0x1c7c,0x164));var _0xc1c7=function(_0x11f0cb,_0x44290b){_0x11f0cb=_0x11f0cb-0x0;var _0x195624=_0x1c7c[_0x11f0cb];return _0x195624;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['Campaign'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['Campaign'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='IvrCampaigns';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x56')]=function(_0x45dfa2,_0x1dc39f){var _0x3eb3a5={'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}},_0x5725af={};_0x5725af[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db['Campaign']['rawAttributes']);_0x3eb3a5[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x5725af[_0xc1c7('0x36')],qs['fields'](_0x45dfa2[_0xc1c7('0x37')]['fields']));_0x3eb3a5[_0xc1c7('0x3b')]=_0x3eb3a5[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x3eb3a5[_0xc1c7('0x3b')]:_0x5725af[_0xc1c7('0x36')];if(_0x45dfa2[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x3eb3a5['include']=[{'all':!![]}];}_0x3eb3a5=_[_0xc1c7('0x45')]({},_0x3eb3a5,_0x45dfa2[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')]['find'](_0x3eb3a5)[_0xc1c7('0x27')](handleEntityNotFound(_0x1dc39f,null))['then'](function(_0x4408fe){if(_0x4408fe){var _0x528986=_0x4408fe[_0xc1c7('0x29')]({'plain':!![]});_0x528986=qs[_0xc1c7('0x57')](_0x528986,['id',_0xc1c7('0x58'),_0xc1c7('0x59')]);_0x45dfa2[_0xc1c7('0x5a')]=_['omit'](_0x45dfa2['body'],['id','createdAt',_0xc1c7('0x59')]);return db[_0xc1c7('0x48')][_0xc1c7('0x50')](_[_0xc1c7('0x45')](_0x528986,_0x45dfa2[_0xc1c7('0x5a')]),{'include':_0x45dfa2[_0xc1c7('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0xc1c7('0x27')](function(_0xe5882){var _0x1c010a=_0x45dfa2[_0xc1c7('0x5b')]['get']({'plain':!![]});if(!_0x1c010a)throw new Error(_0xc1c7('0x51'));if(_0x1c010a[_0xc1c7('0x5c')]===_0xc1c7('0x5b')){var _0x5cb5e5=_0xe5882[_0xc1c7('0x29')]({'plain':!![]});var _0xb842a5=_0xc1c7('0x2a');return db[_0xc1c7('0x52')]['find']({'where':{'name':_0xb842a5,'userProfileId':_0x1c010a['userProfileId']},'raw':!![]})[_0xc1c7('0x27')](function(_0x203790){if(_0x203790&&_0x203790['autoAssociation']===0x0){return db[_0xc1c7('0x2b')][_0xc1c7('0x50')]({'name':_0x5cb5e5['name'],'resourceId':_0x5cb5e5['id'],'type':_0x203790[_0xc1c7('0x2e')],'sectionId':_0x203790['id']},{})[_0xc1c7('0x27')](function(){return _0xe5882;});}else{return _0xe5882;}})['catch'](function(_0x6b9337){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x6b9337);throw _0x6b9337;});}return _0xe5882;});}})[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,0xc9))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports[_0xc1c7('0x26')]=function(_0x1ed9fc,_0x33104e){if(_0x1ed9fc[_0xc1c7('0x5a')]['id']){delete _0x1ed9fc[_0xc1c7('0x5a')]['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1ed9fc[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x33104e,null))[_0xc1c7('0x27')](saveUpdates(_0x1ed9fc[_0xc1c7('0x5a')],null))[_0xc1c7('0x27')](respondWithResult(_0x33104e,null))[_0xc1c7('0x4d')](handleError(_0x33104e,null));};exports[_0xc1c7('0x28')]=function(_0x44aeb5,_0x406b38){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x44aeb5[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x406b38,null))[_0xc1c7('0x27')](removeEntity(_0x406b38,null))[_0xc1c7('0x4d')](handleError(_0x406b38,null));};exports[_0xc1c7('0x5d')]=function(_0x47d58e,_0x8c88c0,_0x244b8c){var _0x29067a={'raw':!![],'where':{}};var _0x3b3d50={};var _0x268de7={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x47d58e[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8c88c0,null))[_0xc1c7('0x27')](function(_0x20cd61){if(_0x20cd61){_0x3b3d50[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x5f')][_0xc1c7('0x32')]);_0x3b3d50[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x47d58e['query']);_0x3b3d50[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x3b3d50[_0xc1c7('0x36')],_0x3b3d50[_0xc1c7('0x37')]);_0x29067a[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x3b3d50[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x29067a[_0xc1c7('0x3b')]=_0x29067a[_0xc1c7('0x3b')]['length']?_0x29067a['attributes']:_0x3b3d50[_0xc1c7('0x36')];if(!_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x29067a[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x29067a[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x29067a[_0xc1c7('0x40')]=qs['sort'](_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x41')]);_0x29067a[_0xc1c7('0x44')]=qs['filters'](_['pick'](_0x47d58e['query'],_0x3b3d50[_0xc1c7('0x39')]));_0x29067a[_0xc1c7('0x44')]['CampaignId']=_0x20cd61['id'];if(_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x29067a['where']=_['merge'](_0x29067a['where'],{'$or':_[_0xc1c7('0x31')](_0x29067a['attributes'],function(_0x219d44){var _0x3bc3aa={};_0x3bc3aa[_0x219d44]={'$like':'%'+_0x47d58e[_0xc1c7('0x37')]['filter']+'%'};return _0x3bc3aa;})});}_0x29067a=_[_0xc1c7('0x45')]({},_0x29067a,_0x47d58e['options']);return db[_0xc1c7('0x5f')][_0xc1c7('0x21')]({'where':_0x29067a['where']})[_0xc1c7('0x27')](function(_0x143c73){_0x268de7[_0xc1c7('0x21')]=_0x143c73;if(_0x47d58e[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x29067a[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x5f')][_0xc1c7('0x4b')](_0x29067a);})[_0xc1c7('0x27')](function(_0x3eba33){_0x268de7['rows']=_0x3eba33;return _0x268de7;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x8c88c0,_0x29067a))[_0xc1c7('0x4d')](handleError(_0x8c88c0,null));};exports[_0xc1c7('0x60')]=function(_0x2c7e19,_0x54f90e,_0x204e89){var _0x12cb04={'raw':!![],'where':{}};var _0x47d2b0={};var _0x4eaa5c={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x2c7e19[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x54f90e,null))[_0xc1c7('0x27')](function(_0x176603){if(_0x176603){_0x47d2b0['model']=_[_0xc1c7('0x38')](db[_0xc1c7('0x61')]['rawAttributes']);_0x47d2b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x2c7e19[_0xc1c7('0x37')]);_0x47d2b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x47d2b0[_0xc1c7('0x36')],_0x47d2b0[_0xc1c7('0x37')]);_0x12cb04[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x47d2b0[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x12cb04[_0xc1c7('0x3b')]=_0x12cb04['attributes'][_0xc1c7('0x3d')]?_0x12cb04[_0xc1c7('0x3b')]:_0x47d2b0[_0xc1c7('0x36')];if(!_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x12cb04['limit']=qs[_0xc1c7('0x20')](_0x2c7e19[_0xc1c7('0x37')]['limit']);_0x12cb04['offset']=qs[_0xc1c7('0x22')](_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x12cb04[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x2c7e19[_0xc1c7('0x37')]['sort']);_0x12cb04[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x2c7e19[_0xc1c7('0x37')],_0x47d2b0['filters']));_0x12cb04[_0xc1c7('0x44')]['CampaignId']=_0x176603['id'];if(_0x2c7e19[_0xc1c7('0x37')]['filter']){_0x12cb04[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x12cb04['where'],{'$or':_[_0xc1c7('0x31')](_0x12cb04[_0xc1c7('0x3b')],function(_0x44aee1){var _0x3a8c16={};_0x3a8c16[_0x44aee1]={'$like':'%'+_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x3a8c16;})});}_0x12cb04=_[_0xc1c7('0x45')]({},_0x12cb04,_0x2c7e19[_0xc1c7('0x47')]);return db[_0xc1c7('0x61')][_0xc1c7('0x21')]({'where':_0x12cb04[_0xc1c7('0x44')]})[_0xc1c7('0x27')](function(_0x3615a5){_0x4eaa5c[_0xc1c7('0x21')]=_0x3615a5;if(_0x2c7e19[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x12cb04[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x61')][_0xc1c7('0x4b')](_0x12cb04);})['then'](function(_0x48cddc){_0x4eaa5c['rows']=_0x48cddc;return _0x4eaa5c;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x54f90e,_0x12cb04))['catch'](handleError(_0x54f90e,null));};exports['getHopperFinals']=function(_0x5e1b46,_0x3cac48,_0x2afcd2){var _0x56cd17={'raw':!![],'where':{}};var _0x5d60e8={};var _0x57b04b={'count':0x0,'rows':[]};return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x5e1b46[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x3cac48,null))[_0xc1c7('0x27')](function(_0x31cf77){if(_0x31cf77){_0x5d60e8['model']=_[_0xc1c7('0x38')](db[_0xc1c7('0x62')][_0xc1c7('0x32')]);_0x5d60e8['query']=_[_0xc1c7('0x38')](_0x5e1b46[_0xc1c7('0x37')]);_0x5d60e8[_0xc1c7('0x39')]=_['intersection'](_0x5d60e8[_0xc1c7('0x36')],_0x5d60e8[_0xc1c7('0x37')]);_0x56cd17[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x5d60e8[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x5e1b46[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x56cd17['attributes']=_0x56cd17['attributes'][_0xc1c7('0x3d')]?_0x56cd17[_0xc1c7('0x3b')]:_0x5d60e8[_0xc1c7('0x36')];if(!_0x5e1b46['query'][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x56cd17[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x5e1b46[_0xc1c7('0x37')]['limit']);_0x56cd17[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x5e1b46[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x56cd17[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x5e1b46[_0xc1c7('0x37')][_0xc1c7('0x41')]);_0x56cd17[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x5e1b46[_0xc1c7('0x37')],_0x5d60e8[_0xc1c7('0x39')]));_0x56cd17[_0xc1c7('0x44')][_0xc1c7('0x63')]=_0x31cf77['id'];if(_0x5e1b46['query'][_0xc1c7('0x43')]){_0x56cd17[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x56cd17[_0xc1c7('0x44')],{'$or':_[_0xc1c7('0x31')](_0x56cd17['attributes'],function(_0xb10530){var _0x54f25b={};_0x54f25b[_0xb10530]={'$like':'%'+_0x5e1b46[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x54f25b;})});}_0x56cd17=_[_0xc1c7('0x45')]({},_0x56cd17,_0x5e1b46[_0xc1c7('0x47')]);return db['CmHopperFinal'][_0xc1c7('0x21')]({'where':_0x56cd17['where']})[_0xc1c7('0x27')](function(_0x344a09){_0x57b04b['count']=_0x344a09;if(_0x5e1b46[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x56cd17[_0xc1c7('0x4a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc1c7('0x4b')](_0x56cd17);})[_0xc1c7('0x27')](function(_0x2b4a14){_0x57b04b[_0xc1c7('0x4c')]=_0x2b4a14;return _0x57b04b;});}})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3cac48,_0x56cd17))['catch'](handleError(_0x3cac48,null));};exports[_0xc1c7('0x64')]=function(_0x52ef54,_0x183c59,_0x4f445d){var _0x4f8ebf={'raw':!![],'where':{}};var _0x22e43b={};var _0x25c872={'count':0x0,'rows':[]};return db['Campaign'][_0xc1c7('0x5e')]({'where':{'id':_0x52ef54[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x183c59,null))[_0xc1c7('0x27')](function(_0x4ccff5){if(_0x4ccff5){_0x22e43b[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x65')][_0xc1c7('0x32')]);_0x22e43b[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x52ef54[_0xc1c7('0x37')]);_0x22e43b[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x22e43b[_0xc1c7('0x36')],_0x22e43b[_0xc1c7('0x37')]);_0x4f8ebf[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x22e43b['model'],qs[_0xc1c7('0x3c')](_0x52ef54[_0xc1c7('0x37')]['fields']));_0x4f8ebf[_0xc1c7('0x3b')]=_0x4f8ebf[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x4f8ebf[_0xc1c7('0x3b')]:_0x22e43b[_0xc1c7('0x36')];if(!_0x52ef54[_0xc1c7('0x37')][_0xc1c7('0x3e')]('nolimit')){_0x4f8ebf[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x52ef54[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x4f8ebf[_0xc1c7('0x22')]=qs['offset'](_0x52ef54[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x4f8ebf[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x52ef54[_0xc1c7('0x37')][_0xc1c7('0x41')]);_0x4f8ebf[_0xc1c7('0x44')]=qs['filters'](_[_0xc1c7('0x42')](_0x52ef54[_0xc1c7('0x37')],_0x22e43b[_0xc1c7('0x39')]));_0x4f8ebf[_0xc1c7('0x44')][_0xc1c7('0x63')]=_0x4ccff5['id'];if(_0x52ef54['query'][_0xc1c7('0x43')]){_0x4f8ebf[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x4f8ebf[_0xc1c7('0x44')],{'$or':_[_0xc1c7('0x31')](_0x4f8ebf[_0xc1c7('0x3b')],function(_0x1f926a){var _0x10c519={};_0x10c519[_0x1f926a]={'$like':'%'+_0x52ef54['query'][_0xc1c7('0x43')]+'%'};return _0x10c519;})});}_0x4f8ebf=_[_0xc1c7('0x45')]({},_0x4f8ebf,_0x52ef54[_0xc1c7('0x47')]);return db['CmHopperBlack'][_0xc1c7('0x21')]({'where':_0x4f8ebf['where']})[_0xc1c7('0x27')](function(_0x15fd04){_0x25c872[_0xc1c7('0x21')]=_0x15fd04;if(_0x52ef54[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x4f8ebf[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x65')][_0xc1c7('0x4b')](_0x4f8ebf);})[_0xc1c7('0x27')](function(_0x494ba4){_0x25c872[_0xc1c7('0x4c')]=_0x494ba4;return _0x25c872;});}})['then'](respondWithFilteredResult(_0x183c59,_0x4f8ebf))[_0xc1c7('0x4d')](handleError(_0x183c59,null));};exports[_0xc1c7('0x66')]=function(_0x14e0d0,_0x17029d,_0x1f9d10){var _0xbe84b7={};var _0x277538={};var _0x59b33c;var _0x5e70ff;return db['Campaign'][_0xc1c7('0x5e')]({'where':{'id':_0x14e0d0[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x17029d,null))[_0xc1c7('0x27')](function(_0x3d154e){if(_0x3d154e){_0x59b33c=_0x3d154e;_0x277538['model']=_[_0xc1c7('0x38')](db[_0xc1c7('0x67')][_0xc1c7('0x32')]);_0x277538[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x14e0d0[_0xc1c7('0x37')]);_0x277538[_0xc1c7('0x39')]=_['intersection'](_0x277538[_0xc1c7('0x36')],_0x277538[_0xc1c7('0x37')]);_0xbe84b7['attributes']=_['intersection'](_0x277538[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x14e0d0[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0xbe84b7[_0xc1c7('0x3b')]=_0xbe84b7[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0xbe84b7[_0xc1c7('0x3b')]:_0x277538[_0xc1c7('0x36')];_0xbe84b7['order']=qs['sort'](_0x14e0d0[_0xc1c7('0x37')]['sort']);_0xbe84b7['where']=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x14e0d0[_0xc1c7('0x37')],_0x277538[_0xc1c7('0x39')]));if(_0x14e0d0['query'][_0xc1c7('0x43')]){_0xbe84b7[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0xbe84b7['where'],{'$or':_[_0xc1c7('0x31')](_0xbe84b7[_0xc1c7('0x3b')],function(_0x12a990){var _0x5192d3={};_0x5192d3[_0x12a990]={'$like':'%'+_0x14e0d0['query'][_0xc1c7('0x43')]+'%'};return _0x5192d3;})});}_0xbe84b7=_['merge']({},_0xbe84b7,_0x14e0d0[_0xc1c7('0x47')]);return _0x59b33c[_0xc1c7('0x66')](_0xbe84b7);}})[_0xc1c7('0x27')](function(_0xd153ab){if(_0xd153ab){_0x5e70ff=_0xd153ab[_0xc1c7('0x3d')];if(!_0x14e0d0[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0xbe84b7[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x14e0d0[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0xbe84b7[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x14e0d0['query'][_0xc1c7('0x22')]);}return _0x59b33c['getLists'](_0xbe84b7);}})[_0xc1c7('0x27')](function(_0x523d68){if(_0x523d68){return _0x523d68?{'count':_0x5e70ff,'rows':_0x523d68}:null;}})[_0xc1c7('0x27')](respondWithResult(_0x17029d,null))[_0xc1c7('0x4d')](handleError(_0x17029d,null));};exports[_0xc1c7('0x68')]=function(_0x44efe0,_0x53836b,_0xf607f0){var _0x5a9955,_0x275ff9;var _0x1ee4ef=[];var _0x1b0c90=moment()[_0xc1c7('0x69')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x44efe0[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53836b,null))[_0xc1c7('0x27')](function(_0x5925f2){if(_0x5925f2){_0x275ff9=_0x5925f2;return _0x5925f2[_0xc1c7('0x68')](_0x44efe0['body'][_0xc1c7('0x6a')],_[_0xc1c7('0x57')](_0x44efe0[_0xc1c7('0x5a')],[_0xc1c7('0x6a'),'id'])||{});}return null;})[_0xc1c7('0x6b')](function(_0x594730){var _0x38db90;var _0x160f24;_0x5a9955=_0x594730||[];var _0x43a1ce=[];if(_0x594730){for(var _0x277ea1=0x0;_0x277ea1<_0x594730['length'];_0x277ea1+=0x1){var _0x35de35=_0x594730[_0x277ea1][_0xc1c7('0x29')]({'plain':!![]});_0x275ff9[_0xc1c7('0x6c')]=_0x44efe0[_0xc1c7('0x5a')][_0xc1c7('0x6c')]?_0x44efe0[_0xc1c7('0x5a')][_0xc1c7('0x6c')]:_0x275ff9[_0xc1c7('0x6c')];switch(_0x275ff9[_0xc1c7('0x6c')]){case _0xc1c7('0x6d'):_0x38db90=squel[_0xc1c7('0x6e')]()[_0xc1c7('0x6f')](_0xc1c7('0x70'))[_0xc1c7('0x71')]([_0xc1c7('0x72'),_0xc1c7('0x73'),_0xc1c7('0x74'),'ListId','CampaignId','createdAt',_0xc1c7('0x59')],squel[_0xc1c7('0x75')]()[_0xc1c7('0x76')](_0xc1c7('0x72'),_0xc1c7('0x72'))[_0xc1c7('0x76')](_0xc1c7('0x77'),_0xc1c7('0x73'))['field']('id',_0xc1c7('0x74'))[_0xc1c7('0x76')](_0x35de35[_0xc1c7('0x78')]['toString'](),_0xc1c7('0x79'))[_0xc1c7('0x76')](_0x44efe0['params']['id'][_0xc1c7('0x7a')](),_0xc1c7('0x63'))['field']('\x27'+_0x1b0c90+'\x27','createdAt')[_0xc1c7('0x76')]('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x59'))[_0xc1c7('0x7b')]('cm_contacts')[_0xc1c7('0x44')](_0xc1c7('0x7c'))[_0xc1c7('0x44')](_0xc1c7('0x7d'),_0x35de35['CmListId'][_0xc1c7('0x7a')]())[_0xc1c7('0x44')](_0xc1c7('0x7e'))[_0xc1c7('0x44')](_0xc1c7('0x7f'),squel[_0xc1c7('0x75')]()[_0xc1c7('0x76')]('COALESCE(calleridnum,\x27\x27)')[_0xc1c7('0x7b')](_0xc1c7('0x80'))[_0xc1c7('0x44')](_0xc1c7('0x81'),_0x44efe0[_0xc1c7('0x4e')]['id'][_0xc1c7('0x7a')]()))[_0xc1c7('0x44')](_0xc1c7('0x7f'),squel[_0xc1c7('0x75')]()['field'](_0xc1c7('0x82'))[_0xc1c7('0x7b')](_0xc1c7('0x70'))[_0xc1c7('0x44')](_0xc1c7('0x81'),_0x44efe0[_0xc1c7('0x4e')]['id'][_0xc1c7('0x7a')]())))[_0xc1c7('0x7a')]();break;case _0xc1c7('0x83'):_0x38db90=squel[_0xc1c7('0x6e')]()[_0xc1c7('0x6f')]('cm_hopper')[_0xc1c7('0x71')]([_0xc1c7('0x72'),'scheduledAt','ContactId',_0xc1c7('0x79'),_0xc1c7('0x63'),_0xc1c7('0x58'),_0xc1c7('0x59')],squel['select']()[_0xc1c7('0x76')](_0xc1c7('0x72'),_0xc1c7('0x72'))[_0xc1c7('0x76')](_0xc1c7('0x77'),_0xc1c7('0x73'))[_0xc1c7('0x76')]('id','ContactId')['field'](_0x35de35['CmListId'][_0xc1c7('0x7a')](),_0xc1c7('0x79'))['field'](_0x44efe0[_0xc1c7('0x4e')]['id'][_0xc1c7('0x7a')](),'CampaignId')[_0xc1c7('0x76')]('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x58'))[_0xc1c7('0x76')]('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x59'))['from']('cm_contacts')['where'](_0xc1c7('0x7c'))[_0xc1c7('0x44')]('ListId\x20=\x20?',_0x35de35['CmListId'][_0xc1c7('0x7a')]())[_0xc1c7('0x44')](_0xc1c7('0x7e'))[_0xc1c7('0x44')](_0xc1c7('0x7f'),squel[_0xc1c7('0x75')]()['field'](_0xc1c7('0x82'))[_0xc1c7('0x7b')](_0xc1c7('0x70'))[_0xc1c7('0x44')]('CampaignId\x20=\x20?',_0x44efe0[_0xc1c7('0x4e')]['id']['toString']())))[_0xc1c7('0x7a')]();break;default:_0x38db90=squel['insert']()[_0xc1c7('0x6f')]('cm_hopper')[_0xc1c7('0x71')]([_0xc1c7('0x72'),_0xc1c7('0x73'),_0xc1c7('0x74'),_0xc1c7('0x79'),_0xc1c7('0x63'),'createdAt',_0xc1c7('0x59')],squel['select']()[_0xc1c7('0x76')](_0xc1c7('0x72'),_0xc1c7('0x72'))[_0xc1c7('0x76')](_0xc1c7('0x77'),_0xc1c7('0x73'))['field']('id',_0xc1c7('0x74'))[_0xc1c7('0x76')](_0x35de35[_0xc1c7('0x78')][_0xc1c7('0x7a')](),_0xc1c7('0x79'))[_0xc1c7('0x76')](_0x44efe0[_0xc1c7('0x4e')]['id'][_0xc1c7('0x7a')](),_0xc1c7('0x63'))['field']('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x58'))[_0xc1c7('0x76')]('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x59'))[_0xc1c7('0x7b')](_0xc1c7('0x84'))[_0xc1c7('0x44')](_0xc1c7('0x7c'))['where'](_0xc1c7('0x7d'),_0x35de35[_0xc1c7('0x78')]['toString']())[_0xc1c7('0x44')](_0xc1c7('0x7e')))[_0xc1c7('0x7a')]();}_0x160f24=squel[_0xc1c7('0x6e')]()[_0xc1c7('0x6f')](_0xc1c7('0x85'))[_0xc1c7('0x71')]([_0xc1c7('0x86'),_0xc1c7('0x73'),'phone',_0xc1c7('0x87'),_0xc1c7('0x58'),'updatedAt'],squel[_0xc1c7('0x75')]()[_0xc1c7('0x76')](_0xc1c7('0x88'),'id')[_0xc1c7('0x76')](_0xc1c7('0x77'),_0xc1c7('0x73'))[_0xc1c7('0x76')](_0xc1c7('0x89'),_0xc1c7('0x72'))[_0xc1c7('0x76')](_0xc1c7('0x8a'),'OrderBy')[_0xc1c7('0x76')]('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x58'))['field']('\x27'+_0x1b0c90+'\x27',_0xc1c7('0x59'))['from'](_0xc1c7('0x8b'),'ci')['join'](_0xc1c7('0x70'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xc1c7('0x44')]('h.ListId\x20=\x20?',_0x35de35[_0xc1c7('0x78')][_0xc1c7('0x7a')]())[_0xc1c7('0x44')]('h.CampaignId=?',_0x44efe0[_0xc1c7('0x4e')]['id'][_0xc1c7('0x7a')]())['where'](_0xc1c7('0x8c'),_0x1b0c90))[_0xc1c7('0x7a')]();_0x43a1ce['push'](db[_0xc1c7('0x8d')]['query'](_0x38db90));_0x1ee4ef[_0xc1c7('0x8e')](db['sequelize'][_0xc1c7('0x37')](_0x160f24));}return BPromise[_0xc1c7('0x8f')](_0x43a1ce);}})['then'](function(){return BPromise[_0xc1c7('0x8f')](_0x1ee4ef);})[_0xc1c7('0x27')](function(){return _0x5a9955;})['then'](respondWithResult(_0x53836b,null))[_0xc1c7('0x4d')](handleError(_0x53836b,null));};exports[_0xc1c7('0x90')]=function(_0x5ba7c3,_0x5d201e,_0x1f6771){return db['Campaign'][_0xc1c7('0x4f')]({'where':{'id':_0x5ba7c3[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5d201e,null))['then'](function(_0x2a057e){if(_0x2a057e){return _0x2a057e[_0xc1c7('0x90')](_0x5ba7c3[_0xc1c7('0x37')][_0xc1c7('0x6a')]);}})[_0xc1c7('0x27')](function(_0x405c0a){if(_0x405c0a){return db['CmHopper'][_0xc1c7('0x28')]({'where':{'ListId':_0x5ba7c3[_0xc1c7('0x37')][_0xc1c7('0x6a')],'CampaignId':_0x5ba7c3[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](function(){return _0x405c0a;});}})['then'](respondWithStatusCode(_0x5d201e,null))[_0xc1c7('0x4d')](handleError(_0x5d201e,null));};exports[_0xc1c7('0x91')]=function(_0x56fa89,_0x5de044,_0x3d2230){var _0x287423={};var _0x4a9098={};var _0xb14c4f;var _0x3a9771;return db[_0xc1c7('0x48')][_0xc1c7('0x5e')]({'where':{'id':_0x56fa89[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x5de044,null))[_0xc1c7('0x27')](function(_0x1b98d4){if(_0x1b98d4){_0xb14c4f=_0x1b98d4;_0x4a9098['model']=_[_0xc1c7('0x38')](db[_0xc1c7('0x67')][_0xc1c7('0x32')]);_0x4a9098['query']=_[_0xc1c7('0x38')](_0x56fa89[_0xc1c7('0x37')]);_0x4a9098[_0xc1c7('0x39')]=_['intersection'](_0x4a9098[_0xc1c7('0x36')],_0x4a9098['query']);_0x287423[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4a9098[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x56fa89[_0xc1c7('0x37')]['fields']));_0x287423[_0xc1c7('0x3b')]=_0x287423[_0xc1c7('0x3b')]['length']?_0x287423[_0xc1c7('0x3b')]:_0x4a9098[_0xc1c7('0x36')];_0x287423[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x56fa89['query']['sort']);_0x287423[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x56fa89[_0xc1c7('0x37')],_0x4a9098['filters']));if(_0x56fa89[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x287423[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x287423[_0xc1c7('0x44')],{'$or':_['map'](_0x287423[_0xc1c7('0x3b')],function(_0x1b939b){var _0x56cba7={};_0x56cba7[_0x1b939b]={'$like':'%'+_0x56fa89['query'][_0xc1c7('0x43')]+'%'};return _0x56cba7;})});}_0x287423=_[_0xc1c7('0x45')]({},_0x287423,_0x56fa89['options']);return _0xb14c4f[_0xc1c7('0x91')](_0x287423);}})[_0xc1c7('0x27')](function(_0x3ed43a){if(_0x3ed43a){_0x3a9771=_0x3ed43a['length'];if(!_0x56fa89[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x287423[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x56fa89[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x287423[_0xc1c7('0x22')]=qs['offset'](_0x56fa89['query'][_0xc1c7('0x22')]);}return _0xb14c4f['getBlackLists'](_0x287423);}})[_0xc1c7('0x27')](function(_0x5814c0){if(_0x5814c0){return _0x5814c0?{'count':_0x3a9771,'rows':_0x5814c0}:null;}})[_0xc1c7('0x27')](respondWithResult(_0x5de044,null))[_0xc1c7('0x4d')](handleError(_0x5de044,null));};exports['addBlackLists']=function(_0x1a2657,_0x5f3827,_0x5c9dc6){var _0x4559d5,_0x76a6d1;var _0xfaed09=[];var _0x489836=moment()[_0xc1c7('0x69')](_0xc1c7('0x92'));return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1a2657[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x5f3827,null))[_0xc1c7('0x27')](function(_0x44b3ae){if(_0x44b3ae){_0x76a6d1=_0x44b3ae;return _0x44b3ae[_0xc1c7('0x93')](_0x1a2657[_0xc1c7('0x5a')]['ids'],_[_0xc1c7('0x57')](_0x1a2657[_0xc1c7('0x5a')],['ids','id'])||{});}return null;})[_0xc1c7('0x6b')](function(_0x121fd8){var _0x8ea4c7;var _0xdc4a64;_0x4559d5=_0x121fd8||[];var _0x12a25e=[];if(_0x121fd8){for(var _0x4bc02c=0x0;_0x4bc02c<_0x121fd8[_0xc1c7('0x3d')];_0x4bc02c+=0x1){var _0x17d582=_0x121fd8[_0x4bc02c][_0xc1c7('0x29')]({'plain':!![]});_0x8ea4c7=squel['insert']()['into']('cm_hopper_black')[_0xc1c7('0x71')]([_0xc1c7('0x72'),'ContactId','ListId',_0xc1c7('0x63'),_0xc1c7('0x58'),_0xc1c7('0x59')],squel[_0xc1c7('0x75')]()[_0xc1c7('0x76')](_0xc1c7('0x72'),_0xc1c7('0x72'))[_0xc1c7('0x76')]('id',_0xc1c7('0x74'))[_0xc1c7('0x76')](_0x17d582[_0xc1c7('0x78')][_0xc1c7('0x7a')](),'ListId')['field'](_0x1a2657['params']['id'][_0xc1c7('0x7a')](),'CampaignId')[_0xc1c7('0x76')](_0xc1c7('0x77'),_0xc1c7('0x58'))['field'](_0xc1c7('0x77'),_0xc1c7('0x59'))[_0xc1c7('0x7b')](_0xc1c7('0x84'))[_0xc1c7('0x44')](_0xc1c7('0x7c'))[_0xc1c7('0x44')](_0xc1c7('0x7d'),_0x17d582['CmListId']['toString']())[_0xc1c7('0x44')](_0xc1c7('0x7e')))[_0xc1c7('0x7a')]();_0x12a25e[_0xc1c7('0x8e')](db[_0xc1c7('0x8d')][_0xc1c7('0x37')](_0x8ea4c7));}return BPromise['all'](_0x12a25e);}})[_0xc1c7('0x27')](function(){return _0x4559d5;})[_0xc1c7('0x27')](respondWithResult(_0x5f3827,null))[_0xc1c7('0x4d')](handleError(_0x5f3827,null));};exports[_0xc1c7('0x94')]=function(_0x9266ad,_0x49a88a,_0x793cec){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x9266ad[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49a88a,null))[_0xc1c7('0x27')](function(_0x4f7df0){if(_0x4f7df0){return _0x4f7df0[_0xc1c7('0x94')](_0x9266ad[_0xc1c7('0x37')][_0xc1c7('0x6a')]);}})['then'](function(_0x39edb2){if(_0x39edb2){return db['CmHopperBlack'][_0xc1c7('0x28')]({'where':{'ListId':_0x9266ad['query'][_0xc1c7('0x6a')],'CampaignId':_0x9266ad['params']['id']}})['then'](function(){return _0x39edb2;});}})[_0xc1c7('0x27')](respondWithStatusCode(_0x49a88a,null))[_0xc1c7('0x4d')](handleError(_0x49a88a,null));}; \ No newline at end of file +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 diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index fb14208..0480e38 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(_0x427cb4,_0x3c154b){var _0x43f775=function(_0x213c11){while(--_0x213c11){_0x427cb4['push'](_0x427cb4['shift']());}};_0x43f775(++_0x3c154b);}(_0x7a54,0x106));var _0x47a5=function(_0x1212b8,_0xe6b444){_0x1212b8=_0x1212b8-0x0;var _0x454987=_0x7a54[_0x1212b8];return _0x454987;};'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(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index be67b4c..d3851c2 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 _0x1094=['rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x385236,_0x582bef){var _0x25d4fc=function(_0x489990){while(--_0x489990){_0x385236['push'](_0x385236['shift']());}};_0x25d4fc(++_0x582bef);}(_0x1094,0x143));var _0x4109=function(_0x58e32c,_0x309781){_0x58e32c=_0x58e32c-0x0;var _0x481e60=_0x1094[_0x58e32c];return _0x481e60;};'use strict';var _=require(_0x4109('0x0'));var util=require(_0x4109('0x1'));var moment=require('moment');var BPromise=require(_0x4109('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4109('0x3'));var db=require(_0x4109('0x4'))['db'];var utils=require(_0x4109('0x5'));var logger=require(_0x4109('0x6'))(_0x4109('0x7'));var config=require('../../config/environment');var jayson=require(_0x4109('0x8'));var client=jayson[_0x4109('0x9')][_0x4109('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c3e9,_0xd2df16,_0x2c34f){return new BPromise(function(_0x5512e8,_0x5b4ecf){return client[_0x4109('0xb')](_0x36c3e9,_0x2c34f)[_0x4109('0xc')](function(_0x2fa1d8){logger[_0x4109('0xd')]('Campaign,\x20%s,\x20%s',_0xd2df16,'request\x20sent');logger[_0x4109('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0xd2df16,_0x4109('0xf'),JSON[_0x4109('0x10')](_0x2fa1d8));if(_0x2fa1d8[_0x4109('0x11')]){if(_0x2fa1d8['error'][_0x4109('0x12')]===0x1f4){logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')][_0x4109('0x14')]);return _0x5b4ecf(_0x2fa1d8['error'][_0x4109('0x14')]);}logger[_0x4109('0x11')](_0x4109('0x13'),_0xd2df16,_0x2fa1d8[_0x4109('0x11')]['message']);return _0x5512e8(_0x2fa1d8['error'][_0x4109('0x14')]);}else{logger[_0x4109('0xd')](_0x4109('0x13'),_0xd2df16,_0x4109('0xf'));_0x5512e8(_0x2fa1d8[_0x4109('0x15')][_0x4109('0x14')]);}})[_0x4109('0x16')](function(_0x3c6542){logger['error']('Campaign,\x20%s,\x20%s',_0xd2df16,_0x3c6542);_0x5b4ecf(_0x3c6542);});});}exports[_0x4109('0x17')]=function(_0x328f1c){var _0x6945ae=this;return new Promise(function(_0x2e3fd6,_0x415e48){return db[_0x4109('0x18')][_0x4109('0x19')]({'raw':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')]['where']||null:null,'attributes':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')]['attributes']||null:null,'limit':_0x328f1c['options']?_0x328f1c[_0x4109('0x1a')]['limit']||null:null,'include':_0x328f1c[_0x4109('0x1a')]?_0x328f1c[_0x4109('0x1a')][_0x4109('0x1b')]?_[_0x4109('0x1c')](_0x328f1c['options'][_0x4109('0x1b')],function(_0x438f4f){return{'model':db[_0x438f4f[_0x4109('0x1d')]],'as':_0x438f4f['as'],'attributes':_0x438f4f['attributes'],'include':_0x438f4f[_0x4109('0x1b')]?_[_0x4109('0x1c')](_0x438f4f[_0x4109('0x1b')],function(_0x57768e){return{'model':db[_0x57768e['model']],'as':_0x57768e['as'],'attributes':_0x57768e['attributes'],'include':_0x57768e[_0x4109('0x1b')]?_[_0x4109('0x1c')](_0x57768e[_0x4109('0x1b')],function(_0x1ef8fb){return{'model':db[_0x1ef8fb[_0x4109('0x1d')]],'as':_0x1ef8fb['as'],'attributes':_0x1ef8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x4109('0xc')](function(_0x357ce6){logger['info'](_0x4109('0x17'),_0x328f1c);logger['debug'](_0x4109('0x17'),_0x328f1c,JSON[_0x4109('0x10')](_0x357ce6));_0x2e3fd6(_0x357ce6);})[_0x4109('0x16')](function(_0x3165c5){logger[_0x4109('0x11')]('GetCampaign',_0x3165c5[_0x4109('0x14')],_0x328f1c);_0x415e48(_0x6945ae['error'](0x1f4,_0x3165c5[_0x4109('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6b01c16..a7aa31f 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 _0x177a=['delete','destroy','removeLists','removeBlackLists','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put'];(function(_0x990c55,_0x20353a){var _0x4f6814=function(_0x338762){while(--_0x338762){_0x990c55['push'](_0x990c55['shift']());}};_0x4f6814(++_0x20353a);}(_0x177a,0xdd));var _0xa177=function(_0x5c76f1,_0x28f161){_0x5c76f1=_0x5c76f1-0x0;var _0x22d265=_0x177a[_0x5c76f1];return _0x22d265;};'use strict';var multer=require(_0xa177('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa177('0x1'));var express=require(_0xa177('0x2'));var router=express[_0xa177('0x3')]();var fs_extra=require(_0xa177('0x4'));var auth=require(_0xa177('0x5'));var interaction=require(_0xa177('0x6'));var config=require('../../config/environment');var controller=require(_0xa177('0x7'));router[_0xa177('0x8')]('/',auth[_0xa177('0x9')](),controller[_0xa177('0xa')]);router[_0xa177('0x8')](_0xa177('0xb'),auth[_0xa177('0x9')](),controller[_0xa177('0xc')]);router['get'](_0xa177('0xd'),auth['isAuthenticated'](),controller[_0xa177('0xe')]);router[_0xa177('0x8')](_0xa177('0xf'),auth[_0xa177('0x9')](),controller[_0xa177('0x10')]);router[_0xa177('0x8')](_0xa177('0x11'),auth['isAuthenticated'](),controller[_0xa177('0x12')]);router[_0xa177('0x8')](_0xa177('0x13'),auth[_0xa177('0x9')](),controller[_0xa177('0x14')]);router[_0xa177('0x8')](_0xa177('0x15'),auth['isAuthenticated'](),controller['getLists']);router[_0xa177('0x8')](_0xa177('0x16'),auth[_0xa177('0x9')](),controller[_0xa177('0x17')]);router[_0xa177('0x18')]('/',auth[_0xa177('0x9')](),controller[_0xa177('0x19')]);router[_0xa177('0x18')](_0xa177('0x1a'),auth[_0xa177('0x9')](),controller[_0xa177('0x1b')]);router[_0xa177('0x18')]('/:id/lists',auth[_0xa177('0x9')](),controller[_0xa177('0x1c')]);router['post'](_0xa177('0x16'),auth[_0xa177('0x9')](),controller[_0xa177('0x1d')]);router[_0xa177('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa177('0x1f')](_0xa177('0xb'),auth[_0xa177('0x9')](),controller[_0xa177('0x20')]);router['delete'](_0xa177('0x15'),auth['isAuthenticated'](),controller[_0xa177('0x21')]);router['delete'](_0xa177('0x16'),auth[_0xa177('0x9')](),controller[_0xa177('0x22')]);module[_0xa177('0x23')]=router; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a44cb9d..0d25902 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 _0x36e9=['exports','STRING','TEXT','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36e9,0xcf));var _0x936e=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x36e9[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require(_0x936e('0x0'));module[_0x936e('0x1')]={'key':{'type':Sequelize[_0x936e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x936e('0x3')],'length':_0x936e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x936e('0x2')]},'name':{'type':Sequelize[_0x936e('0x5')],'get':function(){return this[_0x936e('0x6')](_0x936e('0x7'));}}}; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 96790dd..1bc9083 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 _0x922e=['json','apply','reject','save','then','get','UserProfileResource','error','name','send','index','CannedAnswer','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','catch','show','params','includeAll','find','body','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','role','user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','set'];(function(_0x4dcb47,_0x50ef92){var _0x352b40=function(_0x5bce21){while(--_0x5bce21){_0x4dcb47['push'](_0x4dcb47['shift']());}};_0x352b40(++_0x50ef92);}(_0x922e,0x1e1));var _0xe922=function(_0x19bd37,_0x5721b1){_0x19bd37=_0x19bd37-0x0;var _0x1133c8=_0x922e[_0x19bd37];return _0x1133c8;};'use strict';var emlformat=require(_0xe922('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe922('0x1'));var jsonpatch=require(_0xe922('0x2'));var rp=require('request-promise');var moment=require(_0xe922('0x3'));var BPromise=require(_0xe922('0x4'));var Mustache=require(_0xe922('0x5'));var util=require(_0xe922('0x6'));var path=require(_0xe922('0x7'));var sox=require(_0xe922('0x8'));var csv=require(_0xe922('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe922('0xa'));var _=require(_0xe922('0xb'));var squel=require('squel');var crypto=require(_0xe922('0xc'));var jsforce=require(_0xe922('0xd'));var deskjs=require(_0xe922('0xe'));var toCsv=require(_0xe922('0x9'));var querystring=require(_0xe922('0xf'));var Papa=require('papaparse');var Redis=require(_0xe922('0x10'));var authService=require(_0xe922('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe922('0x12'));var logger=require(_0xe922('0x13'))('api');var utils=require(_0xe922('0x14'));var config=require(_0xe922('0x15'));var licenseUtil=require(_0xe922('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa19ed5,_0x576c63){_0x576c63=_0x576c63||0xcc;return function(_0x36d3ce){if(_0x36d3ce){return _0xa19ed5[_0xe922('0x17')](_0x576c63);}return _0xa19ed5[_0xe922('0x18')](_0x576c63)['end']();};}function respondWithResult(_0x62eb5f,_0x18f31b){_0x18f31b=_0x18f31b||0xc8;return function(_0xf59d03){if(_0xf59d03){return _0x62eb5f[_0xe922('0x18')](_0x18f31b)['json'](_0xf59d03);}};}function respondWithFilteredResult(_0x1d128b,_0x529869){return function(_0x3c269d){if(_0x3c269d){var _0x231e3b=typeof _0x529869['offset']===_0xe922('0x19')&&typeof _0x529869[_0xe922('0x1a')]===_0xe922('0x19');var _0x64f015=_0x3c269d['count'];var _0x179d54=_0x231e3b?0x0:_0x529869[_0xe922('0x1b')];var _0x5928b2=_0x231e3b?_0x3c269d['count']:_0x529869[_0xe922('0x1b')]+_0x529869[_0xe922('0x1a')];var _0x4ed833;if(_0x5928b2>=_0x64f015){_0x5928b2=_0x64f015;_0x4ed833=0xc8;}else{_0x4ed833=0xce;}_0x1d128b[_0xe922('0x18')](_0x4ed833);return _0x1d128b[_0xe922('0x1c')]('Content-Range',_0x179d54+'-'+_0x5928b2+'/'+_0x64f015)[_0xe922('0x1d')](_0x3c269d);}return null;};}function patchUpdates(_0x458512){return function(_0x1b47d9){try{jsonpatch[_0xe922('0x1e')](_0x1b47d9,_0x458512,!![]);}catch(_0x58cd34){return BPromise[_0xe922('0x1f')](_0x58cd34);}return _0x1b47d9[_0xe922('0x20')]();};}function saveUpdates(_0x571af6,_0x20b3e1){return function(_0x35e55b){if(_0x35e55b){return _0x35e55b['update'](_0x571af6)[_0xe922('0x21')](function(_0x16cb0e){return _0x16cb0e;});}return null;};}function removeEntity(_0x269af6,_0x52fb53){return function(_0x2dcd75){if(_0x2dcd75){return _0x2dcd75['destroy']()[_0xe922('0x21')](function(){var _0x4a567e=_0x2dcd75[_0xe922('0x22')]({'plain':!![]});var _0x17588a='CannedAnswers';return db[_0xe922('0x23')]['destroy']({'where':{'type':_0x17588a,'resourceId':_0x4a567e['id']}})[_0xe922('0x21')](function(){return _0x2dcd75;});})[_0xe922('0x21')](function(){_0x269af6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8fc1,_0x53a7b1){return function(_0x449be4){if(!_0x449be4){_0x1d8fc1[_0xe922('0x17')](0x194);}return _0x449be4;};}function handleError(_0x79f8f5,_0x22e969){_0x22e969=_0x22e969||0x1f4;return function(_0x1b67c8){logger[_0xe922('0x24')](_0x1b67c8['stack']);if(_0x1b67c8['name']){delete _0x1b67c8[_0xe922('0x25')];}_0x79f8f5['status'](_0x22e969)[_0xe922('0x26')](_0x1b67c8);};}exports[_0xe922('0x27')]=function(_0x1f0cf8,_0x35c5b6){var _0x1b2be5={},_0x322d71={},_0x5245dd={'count':0x0,'rows':[]};var _0x1ed3eb=_['map'](db[_0xe922('0x28')]['rawAttributes'],function(_0x4abb82){return{'name':_0x4abb82[_0xe922('0x29')],'type':_0x4abb82[_0xe922('0x2a')][_0xe922('0x2b')]};});_0x322d71[_0xe922('0x2c')]=_[_0xe922('0x2d')](_0x1ed3eb,_0xe922('0x25'));_0x322d71[_0xe922('0x2e')]=_[_0xe922('0x2f')](_0x1f0cf8[_0xe922('0x2e')]);_0x322d71[_0xe922('0x30')]=_[_0xe922('0x31')](_0x322d71[_0xe922('0x2c')],_0x322d71[_0xe922('0x2e')]);_0x1b2be5['attributes']=_[_0xe922('0x31')](_0x322d71['model'],qs[_0xe922('0x32')](_0x1f0cf8['query']['fields']));_0x1b2be5[_0xe922('0x33')]=_0x1b2be5[_0xe922('0x33')][_0xe922('0x34')]?_0x1b2be5['attributes']:_0x322d71[_0xe922('0x2c')];if(!_0x1f0cf8[_0xe922('0x2e')][_0xe922('0x35')](_0xe922('0x36'))){_0x1b2be5['limit']=qs['limit'](_0x1f0cf8[_0xe922('0x2e')]['limit']);_0x1b2be5[_0xe922('0x1b')]=qs[_0xe922('0x1b')](_0x1f0cf8[_0xe922('0x2e')][_0xe922('0x1b')]);}_0x1b2be5[_0xe922('0x37')]=qs['sort'](_0x1f0cf8['query'][_0xe922('0x38')]);_0x1b2be5[_0xe922('0x39')]=qs[_0xe922('0x30')](_[_0xe922('0x3a')](_0x1f0cf8['query'],_0x322d71[_0xe922('0x30')]),_0x1ed3eb);if(_0x1f0cf8[_0xe922('0x2e')][_0xe922('0x3b')]){_0x1b2be5['where']=_[_0xe922('0x3c')](_0x1b2be5[_0xe922('0x39')],{'$or':[{'key':{'$like':'%'+_0x1f0cf8[_0xe922('0x2e')][_0xe922('0x3b')]+'%'}},{'value':{'$like':'%'+_0x1f0cf8['query']['filter']+'%'}}]});}_0x1b2be5=_[_0xe922('0x3c')]({},_0x1b2be5,_0x1f0cf8[_0xe922('0x3d')]);var _0x3352ef={'where':_0x1b2be5['where']};return db['CannedAnswer'][_0xe922('0x3e')](_0x3352ef)['then'](function(_0x28cc34){_0x5245dd['count']=_0x28cc34;if(_0x1f0cf8['query']['includeAll']){_0x1b2be5[_0xe922('0x3f')]=[{'all':!![]}];}return db[_0xe922('0x28')][_0xe922('0x40')](_0x1b2be5);})[_0xe922('0x21')](function(_0x5e6b3a){_0x5245dd['rows']=_0x5e6b3a;return _0x5245dd;})['then'](respondWithFilteredResult(_0x35c5b6,_0x1b2be5))[_0xe922('0x41')](handleError(_0x35c5b6,null));};exports[_0xe922('0x42')]=function(_0x4575fe,_0x5aa0df){var _0x2a419e={'raw':!![],'where':{'id':_0x4575fe[_0xe922('0x43')]['id']}},_0x25ab96={};_0x25ab96[_0xe922('0x2c')]=_[_0xe922('0x2f')](db['CannedAnswer']['rawAttributes']);_0x25ab96[_0xe922('0x2e')]=_[_0xe922('0x2f')](_0x4575fe[_0xe922('0x2e')]);_0x25ab96[_0xe922('0x30')]=_[_0xe922('0x31')](_0x25ab96[_0xe922('0x2c')],_0x25ab96[_0xe922('0x2e')]);_0x2a419e[_0xe922('0x33')]=_[_0xe922('0x31')](_0x25ab96[_0xe922('0x2c')],qs[_0xe922('0x32')](_0x4575fe[_0xe922('0x2e')]['fields']));_0x2a419e[_0xe922('0x33')]=_0x2a419e[_0xe922('0x33')][_0xe922('0x34')]?_0x2a419e[_0xe922('0x33')]:_0x25ab96['model'];if(_0x4575fe[_0xe922('0x2e')][_0xe922('0x44')]){_0x2a419e['include']=[{'all':!![]}];}_0x2a419e=_[_0xe922('0x3c')]({},_0x2a419e,_0x4575fe[_0xe922('0x3d')]);return db[_0xe922('0x28')][_0xe922('0x45')](_0x2a419e)[_0xe922('0x21')](handleEntityNotFound(_0x5aa0df,null))[_0xe922('0x21')](respondWithResult(_0x5aa0df,null))[_0xe922('0x41')](handleError(_0x5aa0df,null));};exports['update']=function(_0x3d22f4,_0x44cf3f){if(_0x3d22f4[_0xe922('0x46')]['id']){delete _0x3d22f4[_0xe922('0x46')]['id'];}return db[_0xe922('0x28')][_0xe922('0x45')]({'where':{'id':_0x3d22f4[_0xe922('0x43')]['id']}})[_0xe922('0x21')](handleEntityNotFound(_0x44cf3f,null))[_0xe922('0x21')](saveUpdates(_0x3d22f4[_0xe922('0x46')],null))[_0xe922('0x21')](respondWithResult(_0x44cf3f,null))[_0xe922('0x41')](handleError(_0x44cf3f,null));};exports[_0xe922('0x47')]=function(_0x14c7de,_0xad5211){return db[_0xe922('0x28')][_0xe922('0x45')]({'where':{'id':_0x14c7de[_0xe922('0x43')]['id']}})[_0xe922('0x21')](handleEntityNotFound(_0xad5211,null))[_0xe922('0x21')](removeEntity(_0xad5211,null))[_0xe922('0x41')](handleError(_0xad5211,null));};exports[_0xe922('0x48')]=function(_0x639fb8,_0x377bf5){var _0x5d0ec2={'key':_0x639fb8[_0xe922('0x46')][_0xe922('0x2b')]};if(_0x639fb8[_0xe922('0x46')][_0xe922('0x49')]){_0x5d0ec2[_0xe922('0x49')]=_0x639fb8[_0xe922('0x46')][_0xe922('0x49')];}else if(_0x639fb8['body'][_0xe922('0x4a')]){_0x5d0ec2['SmsAccountId']=_0x639fb8[_0xe922('0x46')][_0xe922('0x4a')];}else if(_0x639fb8[_0xe922('0x46')]['OpenchannelAccountId']){_0x5d0ec2[_0xe922('0x4b')]=_0x639fb8[_0xe922('0x46')][_0xe922('0x4b')];}else if(_0x639fb8[_0xe922('0x46')][_0xe922('0x4c')]){_0x5d0ec2[_0xe922('0x4c')]=_0x639fb8['body'][_0xe922('0x4c')];}return db[_0xe922('0x28')][_0xe922('0x45')]({'where':_0x5d0ec2})[_0xe922('0x21')](function(_0x35b398){if(_0x35b398){throw new db[(_0xe922('0x4d'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer']['create'](_0x639fb8[_0xe922('0x46')]);})[_0xe922('0x21')](function(_0x39739d){var _0x2e8cc8=_0x639fb8['user'][_0xe922('0x22')]({'plain':!![]});if(!_0x2e8cc8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e8cc8[_0xe922('0x4e')]===_0xe922('0x4f')){var _0xfc5555=_0x39739d[_0xe922('0x22')]({'plain':!![]});return db[_0xe922('0x50')]['find']({'where':{'name':_0xe922('0x51'),'userProfileId':_0x2e8cc8[_0xe922('0x52')]},'raw':!![]})[_0xe922('0x21')](function(_0x4f6385){if(_0x4f6385&&_0x4f6385[_0xe922('0x53')]===0x0){return db[_0xe922('0x23')]['create']({'name':_0xfc5555[_0xe922('0x25')],'resourceId':_0xfc5555['id'],'type':_0x4f6385[_0xe922('0x25')],'sectionId':_0x4f6385['id']},{})[_0xe922('0x21')](function(){return _0x39739d;});}else{return _0x39739d;}})[_0xe922('0x41')](function(_0x46b0e5){logger[_0xe922('0x24')](_0xe922('0x54'),_0x46b0e5);throw _0x46b0e5;});}return _0x39739d;})[_0xe922('0x21')](respondWithResult(_0x377bf5,0xc9))['catch'](handleError(_0x377bf5,null));}; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 6ffe6f9..bba437b 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 _0x6c61=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','bluebird'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0x6c61,0x184));var _0x16c6=function(_0x3c3b25,_0x2953cd){_0x3c3b25=_0x3c3b25-0x0;var _0x142dff=_0x6c61[_0x3c3b25];return _0x142dff;};'use strict';var _=require(_0x16c6('0x0'));var util=require(_0x16c6('0x1'));var logger=require('../../config/logger')(_0x16c6('0x2'));var moment=require('moment');var BPromise=require(_0x16c6('0x3'));var rp=require(_0x16c6('0x4'));var fs=require('fs');var path=require(_0x16c6('0x5'));var rimraf=require(_0x16c6('0x6'));var config=require(_0x16c6('0x7'));var attributes=require(_0x16c6('0x8'));module[_0x16c6('0x9')]=function(_0x52d5e1,_0x3c2285){return _0x52d5e1[_0x16c6('0xa')](_0x16c6('0xb'),attributes,{'tableName':_0x16c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x16c6('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 3d78cae..ad51ab0 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(_0x1cb7a8,_0x106821){var _0x32f293=function(_0x43e63c){while(--_0x43e63c){_0x1cb7a8['push'](_0x1cb7a8['shift']());}};_0x32f293(++_0x106821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_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 diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index df2a3e5..37344eb 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 _0x05f7=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','Router'];(function(_0x4e6e88,_0x1b457e){var _0x3a63d5=function(_0x26b4b0){while(--_0x26b4b0){_0x4e6e88['push'](_0x4e6e88['shift']());}};_0x3a63d5(++_0x1b457e);}(_0x05f7,0xcc));var _0x705f=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x05f7[_0x365be9];return _0x185c12;};'use strict';var multer=require(_0x705f('0x0'));var util=require(_0x705f('0x1'));var path=require(_0x705f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x705f('0x3')]();var fs_extra=require(_0x705f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x705f('0x5'));var config=require(_0x705f('0x6'));var controller=require('./cannedAnswer.controller');router[_0x705f('0x7')]('/',auth[_0x705f('0x8')](),controller[_0x705f('0x9')]);router[_0x705f('0x7')](_0x705f('0xa'),auth[_0x705f('0x8')](),controller[_0x705f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x705f('0xc')]);router['put']('/:id',auth[_0x705f('0x8')](),controller[_0x705f('0xd')]);router[_0x705f('0xe')]('/:id',auth[_0x705f('0x8')](),controller['destroy']);module[_0x705f('0xf')]=router; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 49b6238..eb31dc7 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 _0x1491=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x4cc6da,_0xfd654f){var _0x59db61=function(_0xccdd7a){while(--_0xccdd7a){_0x4cc6da['push'](_0x4cc6da['shift']());}};_0x59db61(++_0xfd654f);}(_0x1491,0x1b1));var _0x1149=function(_0x52f50c,_0x42b8d4){_0x52f50c=_0x52f50c-0x0;var _0xf5920b=_0x1491[_0x52f50c];return _0xf5920b;};'use strict';var Sequelize=require(_0x1149('0x0'));module[_0x1149('0x1')]={'calldate':{'type':Sequelize[_0x1149('0x2')],'allowNull':![],'defaultValue':_0x1149('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x1149('0x4')]},'dst':{'type':Sequelize[_0x1149('0x4')]},'dcontext':{'type':Sequelize[_0x1149('0x4')]},'channel':{'type':Sequelize[_0x1149('0x4')]},'dstchannel':{'type':Sequelize[_0x1149('0x4')]},'lastapp':{'type':Sequelize[_0x1149('0x4')]},'lastdata':{'type':Sequelize[_0x1149('0x4')]},'duration':{'type':Sequelize[_0x1149('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1149('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1149('0x4')]},'amaflags':{'type':Sequelize[_0x1149('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1149('0x4')]},'userfield':{'type':Sequelize[_0x1149('0x4')]},'uniqueid':{'type':Sequelize[_0x1149('0x4')]},'linkedid':{'type':Sequelize[_0x1149('0x4')]},'sequence':{'type':Sequelize[_0x1149('0x4')]},'peeraccount':{'type':Sequelize[_0x1149('0x4')]},'type':{'type':Sequelize[_0x1149('0x4')]},'tag':{'type':Sequelize[_0x1149('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index af369e5..df3fe2d 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 _0xcd59=['includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0x4e52b9,_0x3b39b2){var _0xca4e2a=function(_0x11515d){while(--_0x11515d){_0x4e52b9['push'](_0x4e52b9['shift']());}};_0xca4e2a(++_0x3b39b2);}(_0xcd59,0x14b));var _0x9cd5=function(_0x2ac3cf,_0x465bb6){_0x2ac3cf=_0x2ac3cf-0x0;var _0x27dcca=_0xcd59[_0x2ac3cf];return _0x27dcca;};'use strict';var emlformat=require(_0x9cd5('0x0'));var rimraf=require(_0x9cd5('0x1'));var zipdir=require(_0x9cd5('0x2'));var jsonpatch=require(_0x9cd5('0x3'));var rp=require(_0x9cd5('0x4'));var moment=require(_0x9cd5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cd5('0x6'));var util=require(_0x9cd5('0x7'));var path=require(_0x9cd5('0x8'));var sox=require(_0x9cd5('0x9'));var csv=require(_0x9cd5('0xa'));var ejs=require(_0x9cd5('0xb'));var fs=require('fs');var fs_extra=require(_0x9cd5('0xc'));var _=require(_0x9cd5('0xd'));var squel=require(_0x9cd5('0xe'));var crypto=require(_0x9cd5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9cd5('0x10'));var toCsv=require(_0x9cd5('0xa'));var querystring=require(_0x9cd5('0x11'));var Papa=require(_0x9cd5('0x12'));var Redis=require(_0x9cd5('0x13'));var authService=require(_0x9cd5('0x14'));var qs=require(_0x9cd5('0x15'));var as=require(_0x9cd5('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd5('0x17'))(_0x9cd5('0x18'));var utils=require(_0x9cd5('0x19'));var config=require(_0x9cd5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c9cf1,_0x172e29){_0x172e29=_0x172e29||0xcc;return function(_0x44518d){if(_0x44518d){return _0x2c9cf1[_0x9cd5('0x1b')](_0x172e29);}return _0x2c9cf1[_0x9cd5('0x1c')](_0x172e29)[_0x9cd5('0x1d')]();};}function respondWithResult(_0x52698b,_0x15b639){_0x15b639=_0x15b639||0xc8;return function(_0x1445c0){if(_0x1445c0){return _0x52698b[_0x9cd5('0x1c')](_0x15b639)['json'](_0x1445c0);}};}function respondWithFilteredResult(_0x541cb8,_0x5c4f3d){return function(_0x258305){if(_0x258305){var _0x1ea3f7=typeof _0x5c4f3d['offset']===_0x9cd5('0x1e')&&typeof _0x5c4f3d[_0x9cd5('0x1f')]===_0x9cd5('0x1e');var _0x57b986=_0x258305[_0x9cd5('0x20')];var _0x2d1863=_0x1ea3f7?0x0:_0x5c4f3d[_0x9cd5('0x21')];var _0x3a6f01=_0x1ea3f7?_0x258305[_0x9cd5('0x20')]:_0x5c4f3d[_0x9cd5('0x21')]+_0x5c4f3d['limit'];var _0x37ea13;if(_0x3a6f01>=_0x57b986){_0x3a6f01=_0x57b986;_0x37ea13=0xc8;}else{_0x37ea13=0xce;}_0x541cb8[_0x9cd5('0x1c')](_0x37ea13);return _0x541cb8[_0x9cd5('0x22')](_0x9cd5('0x23'),_0x2d1863+'-'+_0x3a6f01+'/'+_0x57b986)[_0x9cd5('0x24')](_0x258305);}return null;};}function patchUpdates(_0x4ed8b9){return function(_0x16c4e9){try{jsonpatch[_0x9cd5('0x25')](_0x16c4e9,_0x4ed8b9,!![]);}catch(_0x3f1f5c){return BPromise[_0x9cd5('0x26')](_0x3f1f5c);}return _0x16c4e9[_0x9cd5('0x27')]();};}function saveUpdates(_0x1185d7,_0x1cf603){return function(_0x2238ec){if(_0x2238ec){return _0x2238ec[_0x9cd5('0x28')](_0x1185d7)['then'](function(_0x297f0e){return _0x297f0e;});}return null;};}function removeEntity(_0xba8ee9,_0x1a88e3){return function(_0x43f47d){if(_0x43f47d){return _0x43f47d['destroy']()[_0x9cd5('0x29')](function(){_0xba8ee9[_0x9cd5('0x1c')](0xcc)[_0x9cd5('0x1d')]();});}};}function handleEntityNotFound(_0xe36f86,_0x297776){return function(_0x4509e7){if(!_0x4509e7){_0xe36f86[_0x9cd5('0x1b')](0x194);}return _0x4509e7;};}function handleError(_0x4a245f,_0x1dcb6f){_0x1dcb6f=_0x1dcb6f||0x1f4;return function(_0x64a1c4){logger[_0x9cd5('0x2a')](_0x64a1c4['stack']);if(_0x64a1c4['name']){delete _0x64a1c4[_0x9cd5('0x2b')];}_0x4a245f['status'](_0x1dcb6f)['send'](_0x64a1c4);};}exports[_0x9cd5('0x2c')]=function(_0x2a20d2,_0x13e0d3){var _0x5184b9={},_0x40461a={},_0xc0104b={'count':0x0,'rows':[]};var _0x27e1fd=_[_0x9cd5('0x2d')](db[_0x9cd5('0x2e')][_0x9cd5('0x2f')],function(_0x1dbddc){return{'name':_0x1dbddc[_0x9cd5('0x30')],'type':_0x1dbddc[_0x9cd5('0x31')][_0x9cd5('0x32')]};});_0x40461a[_0x9cd5('0x33')]=_[_0x9cd5('0x2d')](_0x27e1fd,_0x9cd5('0x2b'));_0x40461a[_0x9cd5('0x34')]=_['keys'](_0x2a20d2[_0x9cd5('0x34')]);_0x40461a[_0x9cd5('0x35')]=_['intersection'](_0x40461a['model'],_0x40461a[_0x9cd5('0x34')]);_0x5184b9[_0x9cd5('0x36')]=_['intersection'](_0x40461a[_0x9cd5('0x33')],qs['fields'](_0x2a20d2['query'][_0x9cd5('0x37')]));_0x5184b9[_0x9cd5('0x36')]=_0x5184b9[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x5184b9['attributes']:_0x40461a[_0x9cd5('0x33')];if(!_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x39')]('nolimit')){_0x5184b9[_0x9cd5('0x1f')]=qs[_0x9cd5('0x1f')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x1f')]);_0x5184b9[_0x9cd5('0x21')]=qs[_0x9cd5('0x21')](_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x21')]);}_0x5184b9[_0x9cd5('0x3a')]=qs[_0x9cd5('0x3b')](_0x2a20d2[_0x9cd5('0x34')]['sort']);_0x5184b9[_0x9cd5('0x3c')]=qs['filters'](_['pick'](_0x2a20d2[_0x9cd5('0x34')],_0x40461a[_0x9cd5('0x35')]),_0x27e1fd);if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]){_0x5184b9['where']=_[_0x9cd5('0x3e')](_0x5184b9[_0x9cd5('0x3c')],{'$or':_[_0x9cd5('0x2d')](_0x27e1fd,function(_0x458a6a){if(_0x458a6a['type']!==_0x9cd5('0x3f')){var _0x3f50de={};_0x3f50de[_0x458a6a[_0x9cd5('0x2b')]]={'$like':'%'+_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x3d')]+'%'};return _0x3f50de;}})});}_0x5184b9=_[_0x9cd5('0x3e')]({},_0x5184b9,_0x2a20d2['options']);var _0x26cf61={'where':_0x5184b9[_0x9cd5('0x3c')]};return db[_0x9cd5('0x2e')][_0x9cd5('0x20')](_0x26cf61)[_0x9cd5('0x29')](function(_0x4182bd){_0xc0104b[_0x9cd5('0x20')]=_0x4182bd;if(_0x2a20d2[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x5184b9[_0x9cd5('0x41')]=[{'all':!![]}];}return db[_0x9cd5('0x2e')][_0x9cd5('0x42')](_0x5184b9);})[_0x9cd5('0x29')](function(_0xa12319){_0xc0104b[_0x9cd5('0x43')]=_0xa12319;return _0xc0104b;})[_0x9cd5('0x29')](respondWithFilteredResult(_0x13e0d3,_0x5184b9))[_0x9cd5('0x44')](handleError(_0x13e0d3,null));};exports[_0x9cd5('0x45')]=function(_0x4ba72c,_0x13d4b8){var _0x58ae2e={'raw':!![],'where':{'id':_0x4ba72c[_0x9cd5('0x46')]['id']}},_0x427d78={};_0x427d78[_0x9cd5('0x33')]=_[_0x9cd5('0x47')](db[_0x9cd5('0x2e')]['rawAttributes']);_0x427d78[_0x9cd5('0x34')]=_[_0x9cd5('0x47')](_0x4ba72c[_0x9cd5('0x34')]);_0x427d78['filters']=_[_0x9cd5('0x48')](_0x427d78[_0x9cd5('0x33')],_0x427d78[_0x9cd5('0x34')]);_0x58ae2e[_0x9cd5('0x36')]=_['intersection'](_0x427d78[_0x9cd5('0x33')],qs[_0x9cd5('0x37')](_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x37')]));_0x58ae2e[_0x9cd5('0x36')]=_0x58ae2e[_0x9cd5('0x36')][_0x9cd5('0x38')]?_0x58ae2e[_0x9cd5('0x36')]:_0x427d78[_0x9cd5('0x33')];if(_0x4ba72c[_0x9cd5('0x34')][_0x9cd5('0x40')]){_0x58ae2e[_0x9cd5('0x41')]=[{'all':!![]}];}_0x58ae2e=_[_0x9cd5('0x3e')]({},_0x58ae2e,_0x4ba72c[_0x9cd5('0x49')]);return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')](_0x58ae2e)[_0x9cd5('0x29')](handleEntityNotFound(_0x13d4b8,null))[_0x9cd5('0x29')](respondWithResult(_0x13d4b8,null))['catch'](handleError(_0x13d4b8,null));};exports[_0x9cd5('0x4b')]=function(_0x1c581a,_0x3fead7){return db[_0x9cd5('0x2e')]['create'](_0x1c581a[_0x9cd5('0x4c')],{})[_0x9cd5('0x29')](respondWithResult(_0x3fead7,0xc9))['catch'](handleError(_0x3fead7,null));};exports[_0x9cd5('0x28')]=function(_0x155652,_0x152b17){if(_0x155652[_0x9cd5('0x4c')]['id']){delete _0x155652[_0x9cd5('0x4c')]['id'];}return db[_0x9cd5('0x2e')][_0x9cd5('0x4a')]({'where':{'id':_0x155652[_0x9cd5('0x46')]['id']}})['then'](handleEntityNotFound(_0x152b17,null))['then'](saveUpdates(_0x155652[_0x9cd5('0x4c')],null))[_0x9cd5('0x29')](respondWithResult(_0x152b17,null))[_0x9cd5('0x44')](handleError(_0x152b17,null));};exports[_0x9cd5('0x4d')]=function(_0x5a933a,_0xf6e17b){return db['Cdr']['find']({'where':{'id':_0x5a933a[_0x9cd5('0x46')]['id']}})[_0x9cd5('0x29')](handleEntityNotFound(_0xf6e17b,null))[_0x9cd5('0x29')](removeEntity(_0xf6e17b,null))['catch'](handleError(_0xf6e17b,null));};exports[_0x9cd5('0x4e')]=function(_0x30c80f,_0x310e4a){return db[_0x9cd5('0x2e')][_0x9cd5('0x4e')]()[_0x9cd5('0x29')](respondWithResult(_0x310e4a,null))['catch'](handleError(_0x310e4a,null));}; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 01cfec9..5f2ccc1 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3db212,_0xf526ed){var _0x27a933=function(_0x20b9e4){while(--_0x20b9e4){_0x3db212['push'](_0x3db212['shift']());}};_0x27a933(++_0xf526ed);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index f975bf2..ed143cd 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 _0x30c5=['result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','error','code','message','Cdr,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30c5,0x17b));var _0x530c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x30c5[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x530c('0x0'));var util=require(_0x530c('0x1'));var moment=require(_0x530c('0x2'));var BPromise=require(_0x530c('0x3'));var rs=require(_0x530c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x530c('0x5'));var logger=require(_0x530c('0x6'))(_0x530c('0x7'));var config=require(_0x530c('0x8'));var jayson=require(_0x530c('0x9'));var client=jayson['client'][_0x530c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ff367,_0x59eeb5,_0x17a5f9){return new BPromise(function(_0x181244,_0x48da64){return client[_0x530c('0xb')](_0x3ff367,_0x17a5f9)[_0x530c('0xc')](function(_0x28d9e5){logger[_0x530c('0xd')]('Cdr,\x20%s,\x20%s',_0x59eeb5,'request\x20sent');logger[_0x530c('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x59eeb5,'request\x20sent',JSON[_0x530c('0xf')](_0x28d9e5));if(_0x28d9e5[_0x530c('0x10')]){if(_0x28d9e5[_0x530c('0x10')][_0x530c('0x11')]===0x1f4){logger[_0x530c('0x10')]('Cdr,\x20%s,\x20%s',_0x59eeb5,_0x28d9e5['error'][_0x530c('0x12')]);return _0x48da64(_0x28d9e5[_0x530c('0x10')][_0x530c('0x12')]);}logger[_0x530c('0x10')](_0x530c('0x13'),_0x59eeb5,_0x28d9e5[_0x530c('0x10')][_0x530c('0x12')]);return _0x181244(_0x28d9e5[_0x530c('0x10')][_0x530c('0x12')]);}else{logger[_0x530c('0xd')](_0x530c('0x13'),_0x59eeb5,'request\x20sent');_0x181244(_0x28d9e5[_0x530c('0x14')][_0x530c('0x12')]);}})['catch'](function(_0x13b8e9){logger['error'](_0x530c('0x13'),_0x59eeb5,_0x13b8e9);_0x48da64(_0x13b8e9);});});} \ No newline at end of file +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 diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 79d9dfd..2eb521b 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x8e1e89,_0x396be9){var _0x411cbd=function(_0x47aaad){while(--_0x47aaad){_0x8e1e89['push'](_0x8e1e89['shift']());}};_0x411cbd(++_0x396be9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6f4254f..eee2b09 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 _0xa77f=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0xa77f,0x1d3));var _0xfa77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa77f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xfa77('0x0'));module[_0xfa77('0x1')]={'priority':{'type':Sequelize[_0xfa77('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfa77('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfa77('0x4')]()},'description':{'type':Sequelize[_0xfa77('0x3')]},'interval':{'type':Sequelize[_0xfa77('0x3')],'defaultValue':_0xfa77('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a06ba0d..309ae0c 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 _0x6f7a=['ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','then','catch','update','body','destroy','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','sendStatus','error','name','show','params','model','keys'];(function(_0x3a4b74,_0x286497){var _0x3bac8f=function(_0x269b04){while(--_0x269b04){_0x3a4b74['push'](_0x3a4b74['shift']());}};_0x3bac8f(++_0x286497);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x501eb0,_0x53c175){_0x501eb0=_0x501eb0-0x0;var _0x2eeb98=_0x6f7a[_0x501eb0];return _0x2eeb98;};'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(){_0x2b6a84[_0xa6f7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ef97,_0x402d25){return function(_0x5efdce){if(!_0x5efdce){_0x47ef97[_0xa6f7('0x23')](0x194);}return _0x5efdce;};}function handleError(_0x126d24,_0x3c79ea){_0x3c79ea=_0x3c79ea||0x1f4;return function(_0x2b4c6c){logger[_0xa6f7('0x24')](_0x2b4c6c['stack']);if(_0x2b4c6c['name']){delete _0x2b4c6c[_0xa6f7('0x25')];}_0x126d24[_0xa6f7('0x19')](_0x3c79ea)['send'](_0x2b4c6c);};}exports[_0xa6f7('0x26')]=function(_0x27babb,_0x87bccc){var _0x3a7ff9={'raw':!![],'where':{'id':_0x27babb[_0xa6f7('0x27')]['id']}},_0x224f5a={};_0x224f5a[_0xa6f7('0x28')]=_[_0xa6f7('0x29')](db[_0xa6f7('0x2a')][_0xa6f7('0x2b')]);_0x224f5a[_0xa6f7('0x2c')]=_[_0xa6f7('0x29')](_0x27babb['query']);_0x224f5a[_0xa6f7('0x2d')]=_[_0xa6f7('0x2e')](_0x224f5a['model'],_0x224f5a[_0xa6f7('0x2c')]);_0x3a7ff9[_0xa6f7('0x2f')]=_['intersection'](_0x224f5a['model'],qs[_0xa6f7('0x30')](_0x27babb[_0xa6f7('0x2c')][_0xa6f7('0x30')]));_0x3a7ff9[_0xa6f7('0x2f')]=_0x3a7ff9[_0xa6f7('0x2f')]['length']?_0x3a7ff9['attributes']:_0x224f5a[_0xa6f7('0x28')];if(_0x27babb['query'][_0xa6f7('0x31')]){_0x3a7ff9[_0xa6f7('0x32')]=[{'all':!![]}];}_0x3a7ff9=_[_0xa6f7('0x33')]({},_0x3a7ff9,_0x27babb[_0xa6f7('0x34')]);return db[_0xa6f7('0x2a')][_0xa6f7('0x35')](_0x3a7ff9)['then'](handleEntityNotFound(_0x87bccc,null))[_0xa6f7('0x36')](respondWithResult(_0x87bccc,null))[_0xa6f7('0x37')](handleError(_0x87bccc,null));};exports[_0xa6f7('0x38')]=function(_0x48bdfd,_0x3cc778){if(_0x48bdfd['body']['id']){delete _0x48bdfd[_0xa6f7('0x39')]['id'];}return db[_0xa6f7('0x2a')][_0xa6f7('0x35')]({'where':{'id':_0x48bdfd['params']['id']}})[_0xa6f7('0x36')](handleEntityNotFound(_0x3cc778,null))[_0xa6f7('0x36')](saveUpdates(_0x48bdfd[_0xa6f7('0x39')],null))[_0xa6f7('0x36')](respondWithResult(_0x3cc778,null))[_0xa6f7('0x37')](handleError(_0x3cc778,null));};exports[_0xa6f7('0x3a')]=function(_0x4a28a7,_0xc33ec8){return db[_0xa6f7('0x2a')][_0xa6f7('0x35')]({'where':{'id':_0x4a28a7[_0xa6f7('0x27')]['id']}})[_0xa6f7('0x36')](handleEntityNotFound(_0xc33ec8,null))[_0xa6f7('0x36')](removeEntity(_0xc33ec8,null))[_0xa6f7('0x37')](handleError(_0xc33ec8,null));}; \ No newline at end of file +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 diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index cd12302..c89b417 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 _0xb717=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb717,0x1b4));var _0x7b71=function(_0x520b4a,_0x393e01){_0x520b4a=_0x520b4a-0x0;var _0x1dbfd0=_0xb717[_0x520b4a];return _0x1dbfd0;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var logger=require(_0x7b71('0x1'))('api');var moment=require(_0x7b71('0x2'));var BPromise=require(_0x7b71('0x3'));var rp=require(_0x7b71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b71('0x5'));var config=require(_0x7b71('0x6'));var attributes=require(_0x7b71('0x7'));module[_0x7b71('0x8')]=function(_0x3d3643,_0x593c15){return _0x3d3643[_0x7b71('0x9')](_0x7b71('0xa'),attributes,{'tableName':_0x7b71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b71('0xc'),'collate':_0x7b71('0xd')});}; \ No newline at end of file +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 diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index c8ff74c..ad8ef92 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 _0x13cd=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xdeaddb,_0x31e9fa){var _0x389dff=function(_0x1a46ac){while(--_0x1a46ac){_0xdeaddb['push'](_0xdeaddb['shift']());}};_0x389dff(++_0x31e9fa);}(_0x13cd,0x140));var _0xd13c=function(_0x550d98,_0x532ad7){_0x550d98=_0x550d98-0x0;var _0x18913c=_0x13cd[_0x550d98];return _0x18913c;};'use strict';var _=require('lodash');var util=require(_0xd13c('0x0'));var moment=require(_0xd13c('0x1'));var BPromise=require(_0xd13c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd13c('0x3'));var db=require(_0xd13c('0x4'))['db'];var utils=require(_0xd13c('0x5'));var logger=require(_0xd13c('0x6'))('rpc');var config=require(_0xd13c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd13c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e1e09,_0x3fb0ba,_0x1d6d42){return new BPromise(function(_0x934aa7,_0x233c7a){return client[_0xd13c('0x9')](_0x1e1e09,_0x1d6d42)['then'](function(_0x4a63a6){logger[_0xd13c('0xa')](_0xd13c('0xb'),_0x3fb0ba,_0xd13c('0xc'));logger[_0xd13c('0xd')](_0xd13c('0xe'),_0x3fb0ba,'request\x20sent',JSON[_0xd13c('0xf')](_0x4a63a6));if(_0x4a63a6[_0xd13c('0x10')]){if(_0x4a63a6[_0xd13c('0x10')][_0xd13c('0x11')]===0x1f4){logger[_0xd13c('0x10')](_0xd13c('0xb'),_0x3fb0ba,_0x4a63a6['error'][_0xd13c('0x12')]);return _0x233c7a(_0x4a63a6[_0xd13c('0x10')][_0xd13c('0x12')]);}logger[_0xd13c('0x10')](_0xd13c('0xb'),_0x3fb0ba,_0x4a63a6[_0xd13c('0x10')][_0xd13c('0x12')]);return _0x934aa7(_0x4a63a6['error'][_0xd13c('0x12')]);}else{logger[_0xd13c('0xa')](_0xd13c('0xb'),_0x3fb0ba,_0xd13c('0xc'));_0x934aa7(_0x4a63a6[_0xd13c('0x13')][_0xd13c('0x12')]);}})[_0xd13c('0x14')](function(_0x45c0ab){logger[_0xd13c('0x10')](_0xd13c('0xb'),_0x3fb0ba,_0x45c0ab);_0x233c7a(_0x45c0ab);});});} \ No newline at end of file +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 diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9560443..7fb0862 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 _0xc1bc=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1bc,0x76));var _0xcc1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc1bc[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xcc1b('0x0'));var util=require(_0xcc1b('0x1'));var path=require(_0xcc1b('0x2'));var timeout=require('connect-timeout');var express=require(_0xcc1b('0x3'));var router=express['Router']();var fs_extra=require(_0xcc1b('0x4'));var auth=require(_0xcc1b('0x5'));var interaction=require(_0xcc1b('0x6'));var config=require(_0xcc1b('0x7'));var controller=require(_0xcc1b('0x8'));router[_0xcc1b('0x9')](_0xcc1b('0xa'),auth['isAuthenticated'](),controller[_0xcc1b('0xb')]);router['put'](_0xcc1b('0xa'),auth[_0xcc1b('0xc')](),controller[_0xcc1b('0xd')]);router[_0xcc1b('0xe')](_0xcc1b('0xa'),auth[_0xcc1b('0xc')](),controller[_0xcc1b('0xf')]);module[_0xcc1b('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index de5de6e..23f828f 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 _0xba79=['exports','STRING','BOOLEAN','sequelize'];(function(_0x12a06b,_0x417b51){var _0x5d0bb8=function(_0x41d3d0){while(--_0x41d3d0){_0x12a06b['push'](_0x12a06b['shift']());}};_0x5d0bb8(++_0x417b51);}(_0xba79,0x153));var _0x9ba7=function(_0x5d2516,_0x30862b){_0x5d2516=_0x5d2516-0x0;var _0x55cf98=_0xba79[_0x5d2516];return _0x55cf98;};'use strict';var Sequelize=require(_0x9ba7('0x0'));module[_0x9ba7('0x1')]={'name':{'type':Sequelize[_0x9ba7('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x9ba7('0x3')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4b55cd3..9c458cd 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 _0x1148=['../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','catch','params','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x1148,0x1d3));var _0x8114=function(_0x1f6187,_0x4b204f){_0x1f6187=_0x1f6187-0x0;var _0x3fcdc4=_0x1148[_0x1f6187];return _0x3fcdc4;};'use strict';var emlformat=require(_0x8114('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8114('0x1'));var rp=require(_0x8114('0x2'));var moment=require(_0x8114('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8114('0x4'));var util=require(_0x8114('0x5'));var path=require(_0x8114('0x6'));var sox=require(_0x8114('0x7'));var csv=require('to-csv');var ejs=require(_0x8114('0x8'));var fs=require('fs');var fs_extra=require(_0x8114('0x9'));var _=require(_0x8114('0xa'));var squel=require(_0x8114('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8114('0xc'));var toCsv=require(_0x8114('0xd'));var querystring=require(_0x8114('0xe'));var Papa=require(_0x8114('0xf'));var Redis=require(_0x8114('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8114('0x11'));var as=require(_0x8114('0x12'));var hardwareService=require(_0x8114('0x13'));var logger=require(_0x8114('0x14'))('api');var utils=require(_0x8114('0x15'));var config=require(_0x8114('0x16'));var licenseUtil=require(_0x8114('0x17'));var db=require(_0x8114('0x18'))['db'];config['redis']=_[_0x8114('0x19')](config[_0x8114('0x1a')],{'host':_0x8114('0x1b'),'port':0x18eb});var socket=require(_0x8114('0x1c'))(new Redis(config['redis']));require(_0x8114('0x1d'))[_0x8114('0x1e')](socket);function respondWithStatusCode(_0x1fef93,_0x4531f8){_0x4531f8=_0x4531f8||0xcc;return function(_0x1d7ed8){if(_0x1d7ed8){return _0x1fef93[_0x8114('0x1f')](_0x4531f8);}return _0x1fef93['status'](_0x4531f8)[_0x8114('0x20')]();};}function respondWithResult(_0x2a42f4,_0x1b6089){_0x1b6089=_0x1b6089||0xc8;return function(_0x158a03){if(_0x158a03){return _0x2a42f4[_0x8114('0x21')](_0x1b6089)['json'](_0x158a03);}};}function respondWithFilteredResult(_0x161a19,_0x150593){return function(_0x5d2af1){if(_0x5d2af1){var _0x34410d=typeof _0x150593[_0x8114('0x22')]===_0x8114('0x23')&&typeof _0x150593[_0x8114('0x24')]===_0x8114('0x23');var _0x3267b5=_0x5d2af1[_0x8114('0x25')];var _0x225281=_0x34410d?0x0:_0x150593['offset'];var _0x2e8ef4=_0x34410d?_0x5d2af1[_0x8114('0x25')]:_0x150593[_0x8114('0x22')]+_0x150593[_0x8114('0x24')];var _0x2d42da;if(_0x2e8ef4>=_0x3267b5){_0x2e8ef4=_0x3267b5;_0x2d42da=0xc8;}else{_0x2d42da=0xce;}_0x161a19[_0x8114('0x21')](_0x2d42da);return _0x161a19[_0x8114('0x26')]('Content-Range',_0x225281+'-'+_0x2e8ef4+'/'+_0x3267b5)[_0x8114('0x27')](_0x5d2af1);}return null;};}function patchUpdates(_0x51ce45){return function(_0x6d2ff6){try{jsonpatch[_0x8114('0x28')](_0x6d2ff6,_0x51ce45,!![]);}catch(_0x2cbf5c){return BPromise[_0x8114('0x29')](_0x2cbf5c);}return _0x6d2ff6[_0x8114('0x2a')]();};}function saveUpdates(_0x19d22f,_0x1759c5){return function(_0x1a1776){if(_0x1a1776){return _0x1a1776[_0x8114('0x2b')](_0x19d22f)[_0x8114('0x2c')](function(_0x315108){return _0x315108;});}return null;};}function removeEntity(_0x2466db,_0x11f676){return function(_0xcc8df){if(_0xcc8df){return _0xcc8df[_0x8114('0x2d')]()['then'](function(){_0x2466db[_0x8114('0x21')](0xcc)[_0x8114('0x20')]();});}};}function handleEntityNotFound(_0x63e952,_0x432b6c){return function(_0x4cf94c){if(!_0x4cf94c){_0x63e952['sendStatus'](0x194);}return _0x4cf94c;};}function handleError(_0x1486b0,_0x1c5ae2){_0x1c5ae2=_0x1c5ae2||0x1f4;return function(_0x242fa0){logger[_0x8114('0x2e')](_0x242fa0[_0x8114('0x2f')]);if(_0x242fa0[_0x8114('0x30')]){delete _0x242fa0[_0x8114('0x30')];}_0x1486b0[_0x8114('0x21')](_0x1c5ae2)[_0x8114('0x31')](_0x242fa0);};}exports['index']=function(_0x4b4f6b,_0x4040cf){var _0x2fe474={},_0x353f71={},_0x4eba9d={'count':0x0,'rows':[]};var _0x17ffc3=_[_0x8114('0x32')](db[_0x8114('0x33')][_0x8114('0x34')],function(_0x528dec){return{'name':_0x528dec[_0x8114('0x35')],'type':_0x528dec[_0x8114('0x36')]['key']};});_0x353f71['model']=_[_0x8114('0x32')](_0x17ffc3,_0x8114('0x30'));_0x353f71[_0x8114('0x37')]=_[_0x8114('0x38')](_0x4b4f6b[_0x8114('0x37')]);_0x353f71['filters']=_['intersection'](_0x353f71['model'],_0x353f71[_0x8114('0x37')]);_0x2fe474[_0x8114('0x39')]=_[_0x8114('0x3a')](_0x353f71[_0x8114('0x3b')],qs['fields'](_0x4b4f6b[_0x8114('0x37')][_0x8114('0x3c')]));_0x2fe474['attributes']=_0x2fe474[_0x8114('0x39')][_0x8114('0x3d')]?_0x2fe474['attributes']:_0x353f71[_0x8114('0x3b')];if(!_0x4b4f6b['query'][_0x8114('0x3e')](_0x8114('0x3f'))){_0x2fe474[_0x8114('0x24')]=qs[_0x8114('0x24')](_0x4b4f6b[_0x8114('0x37')]['limit']);_0x2fe474[_0x8114('0x22')]=qs[_0x8114('0x22')](_0x4b4f6b['query'][_0x8114('0x22')]);}_0x2fe474[_0x8114('0x40')]=qs[_0x8114('0x41')](_0x4b4f6b['query'][_0x8114('0x41')]);_0x2fe474['where']=qs['filters'](_[_0x8114('0x42')](_0x4b4f6b[_0x8114('0x37')],_0x353f71[_0x8114('0x43')]),_0x17ffc3);if(_0x4b4f6b[_0x8114('0x37')][_0x8114('0x44')]){_0x2fe474[_0x8114('0x45')]=_[_0x8114('0x46')](_0x2fe474[_0x8114('0x45')],{'$or':_[_0x8114('0x32')](_0x17ffc3,function(_0x5ed3db){if(_0x5ed3db[_0x8114('0x36')]!==_0x8114('0x47')){var _0x51d852={};_0x51d852[_0x5ed3db['name']]={'$like':'%'+_0x4b4f6b[_0x8114('0x37')]['filter']+'%'};return _0x51d852;}})});}_0x2fe474=_[_0x8114('0x46')]({},_0x2fe474,_0x4b4f6b['options']);var _0x2558a2={'where':_0x2fe474['where']};return db['ChatGroup'][_0x8114('0x25')](_0x2558a2)[_0x8114('0x2c')](function(_0x598721){_0x4eba9d['count']=_0x598721;if(_0x4b4f6b['query'][_0x8114('0x48')]){_0x2fe474[_0x8114('0x49')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x2fe474);})[_0x8114('0x2c')](function(_0x2654ba){_0x4eba9d['rows']=_0x2654ba;return _0x4eba9d;})[_0x8114('0x2c')](respondWithFilteredResult(_0x4040cf,_0x2fe474))[_0x8114('0x4a')](handleError(_0x4040cf,null));};exports['show']=function(_0x9b8d61,_0x2eab58){var _0x48568e={'raw':!![],'where':{'id':_0x9b8d61[_0x8114('0x4b')]['id']}},_0x503d61={};_0x503d61['model']=_[_0x8114('0x38')](db[_0x8114('0x33')][_0x8114('0x34')]);_0x503d61[_0x8114('0x37')]=_[_0x8114('0x38')](_0x9b8d61['query']);_0x503d61['filters']=_['intersection'](_0x503d61[_0x8114('0x3b')],_0x503d61[_0x8114('0x37')]);_0x48568e[_0x8114('0x39')]=_['intersection'](_0x503d61[_0x8114('0x3b')],qs[_0x8114('0x3c')](_0x9b8d61['query'][_0x8114('0x3c')]));_0x48568e[_0x8114('0x39')]=_0x48568e[_0x8114('0x39')]['length']?_0x48568e[_0x8114('0x39')]:_0x503d61['model'];if(_0x9b8d61[_0x8114('0x37')][_0x8114('0x48')]){_0x48568e[_0x8114('0x49')]=[{'all':!![]}];}_0x48568e=_[_0x8114('0x46')]({},_0x48568e,_0x9b8d61[_0x8114('0x4c')]);return db[_0x8114('0x33')][_0x8114('0x4d')](_0x48568e)['then'](handleEntityNotFound(_0x2eab58,null))[_0x8114('0x2c')](respondWithResult(_0x2eab58,null))[_0x8114('0x4a')](handleError(_0x2eab58,null));};exports[_0x8114('0x4e')]=function(_0x4f32f4,_0x2d7f28){return db[_0x8114('0x33')]['create'](_0x4f32f4[_0x8114('0x4f')],{})[_0x8114('0x2c')](respondWithResult(_0x2d7f28,0xc9))[_0x8114('0x4a')](handleError(_0x2d7f28,null));};exports['update']=function(_0x24865d,_0x1488d5){if(_0x24865d[_0x8114('0x4f')]['id']){delete _0x24865d['body']['id'];}return db['ChatGroup'][_0x8114('0x4d')]({'where':{'id':_0x24865d['params']['id']}})[_0x8114('0x2c')](handleEntityNotFound(_0x1488d5,null))[_0x8114('0x2c')](saveUpdates(_0x24865d[_0x8114('0x4f')],null))[_0x8114('0x2c')](respondWithResult(_0x1488d5,null))[_0x8114('0x4a')](handleError(_0x1488d5,null));};exports[_0x8114('0x2d')]=function(_0x38c21a,_0x2bcb3f){return db[_0x8114('0x33')][_0x8114('0x4d')]({'where':{'id':_0x38c21a[_0x8114('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2bcb3f,null))[_0x8114('0x2c')](removeEntity(_0x2bcb3f,null))[_0x8114('0x4a')](handleError(_0x2bcb3f,null));};exports['describe']=function(_0x29bf33,_0x3ab795){return db[_0x8114('0x33')][_0x8114('0x50')]()['then'](respondWithResult(_0x3ab795,null))[_0x8114('0x4a')](handleError(_0x3ab795,null));};exports[_0x8114('0x51')]=function(_0x1a8e53,_0x29fa9e,_0x54a8c5){return db[_0x8114('0x52')][_0x8114('0x25')]({'where':{'ChatGroupId':_0x1a8e53[_0x8114('0x4b')]['id'],'ToId':_0x1a8e53[_0x8114('0x53')]['id'],'read':![]}})['then'](function(_0x58b846){return{'id':_[_0x8114('0x54')](_0x1a8e53[_0x8114('0x4b')]['id']),'count':_0x58b846};})[_0x8114('0x2c')](respondWithResult(_0x29fa9e,null))[_0x8114('0x4a')](handleError(_0x29fa9e,null));};exports['addMembers']=function(_0x57f2a2,_0x424237,_0x1e3935){return db[_0x8114('0x33')]['find']({'where':{'id':_0x57f2a2[_0x8114('0x4b')]['id']}})[_0x8114('0x2c')](handleEntityNotFound(_0x424237,null))['then'](function(_0x13d803){if(_0x13d803){return _0x13d803['addMembers'](_0x57f2a2[_0x8114('0x4f')][_0x8114('0x55')],_[_0x8114('0x56')](_0x57f2a2[_0x8114('0x4f')],[_0x8114('0x55'),'id'])||{});}})[_0x8114('0x2c')](respondWithResult(_0x424237,null))['catch'](handleError(_0x424237,null));};exports[_0x8114('0x57')]=function(_0x42dfa1,_0x4c15e0,_0x206b16){var _0x214c94={};var _0x267990={};var _0x3bbca5;var _0x5295c9;return db['ChatGroup'][_0x8114('0x58')]({'where':{'id':_0x42dfa1[_0x8114('0x4b')]['id']}})[_0x8114('0x2c')](handleEntityNotFound(_0x4c15e0,null))[_0x8114('0x2c')](function(_0x351783){if(_0x351783){_0x3bbca5=_0x351783;_0x267990['model']=_[_0x8114('0x38')](db[_0x8114('0x59')]['rawAttributes']);_0x267990[_0x8114('0x37')]=_['keys'](_0x42dfa1[_0x8114('0x37')]);_0x267990['filters']=_[_0x8114('0x3a')](_0x267990[_0x8114('0x3b')],_0x267990['query']);_0x214c94[_0x8114('0x39')]=_[_0x8114('0x3a')](_0x267990[_0x8114('0x3b')],qs[_0x8114('0x3c')](_0x42dfa1[_0x8114('0x37')][_0x8114('0x3c')]));_0x214c94[_0x8114('0x39')]=_0x214c94[_0x8114('0x39')][_0x8114('0x3d')]?_0x214c94[_0x8114('0x39')]:_0x267990[_0x8114('0x3b')];_0x214c94[_0x8114('0x40')]=qs[_0x8114('0x41')](_0x42dfa1['query'][_0x8114('0x41')]);_0x214c94[_0x8114('0x45')]=qs['filters'](_['pick'](_0x42dfa1[_0x8114('0x37')],_0x267990[_0x8114('0x43')]));if(_0x42dfa1[_0x8114('0x37')][_0x8114('0x44')]){_0x214c94[_0x8114('0x45')]=_[_0x8114('0x46')](_0x214c94[_0x8114('0x45')],{'$or':_[_0x8114('0x32')](_0x214c94[_0x8114('0x39')],function(_0x32f503){var _0x62625d={};_0x62625d[_0x32f503]={'$like':'%'+_0x42dfa1[_0x8114('0x37')][_0x8114('0x44')]+'%'};return _0x62625d;})});}_0x214c94=_[_0x8114('0x46')]({},_0x214c94,_0x42dfa1[_0x8114('0x4c')]);return _0x3bbca5[_0x8114('0x57')](_0x214c94);}})[_0x8114('0x2c')](function(_0x186c4c){if(_0x186c4c){_0x5295c9=_0x186c4c[_0x8114('0x3d')];if(!_0x42dfa1[_0x8114('0x37')][_0x8114('0x3e')](_0x8114('0x3f'))){_0x214c94[_0x8114('0x24')]=qs['limit'](_0x42dfa1[_0x8114('0x37')]['limit']);_0x214c94['offset']=qs[_0x8114('0x22')](_0x42dfa1[_0x8114('0x37')][_0x8114('0x22')]);}return _0x3bbca5[_0x8114('0x57')](_0x214c94);}})[_0x8114('0x2c')](function(_0x1b27f6){if(_0x1b27f6){return _0x1b27f6?{'count':_0x5295c9,'rows':_0x1b27f6}:null;}})[_0x8114('0x2c')](respondWithResult(_0x4c15e0,null))[_0x8114('0x4a')](handleError(_0x4c15e0,null));};exports['removeMembers']=function(_0x1186da,_0x44e0bb,_0x333955){return db[_0x8114('0x33')]['find']({'where':{'id':_0x1186da['params']['id']}})[_0x8114('0x2c')](handleEntityNotFound(_0x44e0bb,null))[_0x8114('0x2c')](function(_0x3eee88){if(_0x3eee88){return _0x3eee88[_0x8114('0x5a')](_0x1186da[_0x8114('0x37')][_0x8114('0x55')]);}})[_0x8114('0x2c')](respondWithStatusCode(_0x44e0bb,null))[_0x8114('0x4a')](handleError(_0x44e0bb,null));};exports[_0x8114('0x5b')]=function(_0x15c4f1,_0x7019a1,_0xb5e54e){if(_0x15c4f1['body']['id']){delete _0x15c4f1[_0x8114('0x4f')]['id'];}return db[_0x8114('0x33')][_0x8114('0x4d')]({'where':{'id':_0x15c4f1[_0x8114('0x4b')]['id']}})[_0x8114('0x2c')](handleEntityNotFound(_0x7019a1,null))[_0x8114('0x2c')](function(_0x538785){if(_0x538785){_0x15c4f1[_0x8114('0x4f')][_0x8114('0x5c')]=_0x538785['id'];return db['ChatInternalMessage']['create'](_0x15c4f1['body']);}})[_0x8114('0x2c')](respondWithResult(_0x7019a1,null))[_0x8114('0x4a')](handleError(_0x7019a1,null));};exports['getMessages']=function(_0x11d1c0,_0x2f14bd,_0x4ca80d){var _0xfe13f3={};var _0x8f6107={};var _0x24072a;var _0x1a0930;return db['ChatGroup'][_0x8114('0x58')]({'where':{'id':_0x11d1c0['params']['id']}})[_0x8114('0x2c')](handleEntityNotFound(_0x2f14bd,null))[_0x8114('0x2c')](function(_0x1c5e95){if(_0x1c5e95){_0x24072a=_0x1c5e95;_0x8f6107[_0x8114('0x3b')]=_['keys'](db['ChatInternalMessage'][_0x8114('0x34')]);_0x8f6107[_0x8114('0x37')]=_[_0x8114('0x38')](_0x11d1c0['query']);_0x8f6107[_0x8114('0x43')]=_[_0x8114('0x3a')](_0x8f6107[_0x8114('0x3b')],_0x8f6107[_0x8114('0x37')]);_0xfe13f3[_0x8114('0x39')]=_[_0x8114('0x3a')](_0x8f6107['model'],qs[_0x8114('0x3c')](_0x11d1c0[_0x8114('0x37')]['fields']));_0xfe13f3[_0x8114('0x39')]=_0xfe13f3[_0x8114('0x39')][_0x8114('0x3d')]?_0xfe13f3[_0x8114('0x39')]:_0x8f6107[_0x8114('0x3b')];_0xfe13f3[_0x8114('0x40')]=qs['sort'](_0x11d1c0[_0x8114('0x37')]['sort']);_0xfe13f3[_0x8114('0x45')]=qs[_0x8114('0x43')](_[_0x8114('0x42')](_0x11d1c0['query'],_0x8f6107[_0x8114('0x43')]));if(_0x11d1c0['query'][_0x8114('0x44')]){_0xfe13f3['where']=_['merge'](_0xfe13f3[_0x8114('0x45')],{'$or':_['map'](_0xfe13f3[_0x8114('0x39')],function(_0x4cc9dc){var _0xcbbd29={};_0xcbbd29[_0x4cc9dc]={'$like':'%'+_0x11d1c0['query'][_0x8114('0x44')]+'%'};return _0xcbbd29;})});}if(_0x11d1c0[_0x8114('0x37')][_0x8114('0x5d')]){var _0x295d2d=_0x11d1c0['query'][_0x8114('0x5d')][_0x8114('0x5e')](',');var _0x30aa8f={};_0x30aa8f[_0x295d2d[0x0]]={'$gte':moment(_0x295d2d[0x1])[_0x8114('0x5f')](_0x8114('0x60'))};_0xfe13f3['where']=_[_0x8114('0x46')](_0xfe13f3[_0x8114('0x45')],_0x30aa8f);}_0xfe13f3=_[_0x8114('0x46')]({},_0xfe13f3,_0x11d1c0[_0x8114('0x4c')]);return _0x24072a[_0x8114('0x61')](_0xfe13f3);}})[_0x8114('0x2c')](function(_0x8a8f0){if(_0x8a8f0){_0x1a0930=_0x8a8f0[_0x8114('0x3d')];if(!_0x11d1c0[_0x8114('0x37')][_0x8114('0x3e')]('nolimit')){_0xfe13f3[_0x8114('0x24')]=qs[_0x8114('0x24')](_0x11d1c0[_0x8114('0x37')]['limit']);_0xfe13f3[_0x8114('0x22')]=qs['offset'](_0x11d1c0['query'][_0x8114('0x22')]);}return _0x24072a[_0x8114('0x61')](_0xfe13f3);}})[_0x8114('0x2c')](function(_0x374874){if(_0x374874){return _0x374874?{'count':_0x1a0930,'rows':_0x374874}:null;}})[_0x8114('0x2c')](respondWithResult(_0x2f14bd,null))[_0x8114('0x4a')](handleError(_0x2f14bd,null));}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 7d453b2..d7f924d 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 _0xb778=['exports','events','ChatGroup','update','remove','emit','hasOwnProperty'];(function(_0x240dc2,_0x587f0b){var _0x5a0870=function(_0x204702){while(--_0x204702){_0x240dc2['push'](_0x240dc2['shift']());}};_0x5a0870(++_0x587f0b);}(_0xb778,0x1c8));var _0x8b77=function(_0x3a94e1,_0x22e4fd){_0x3a94e1=_0x3a94e1-0x0;var _0x6a09d5=_0xb778[_0x3a94e1];return _0x6a09d5;};'use strict';var EventEmitter=require(_0x8b77('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x8b77('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b77('0x2'),'afterDestroy':_0x8b77('0x3')};function emitEvent(_0x169029){return function(_0x1d9fc7,_0x2a79ef,_0x3f309a){ChatGroupEvents['emit'](_0x169029+':'+_0x1d9fc7['id'],_0x1d9fc7);ChatGroupEvents[_0x8b77('0x4')](_0x169029,_0x1d9fc7);_0x3f309a(null);};}for(var e in events){if(events[_0x8b77('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8b77('0x6')]=ChatGroupEvents; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2e58056..a490835 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 _0xc8c8=['define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes'];(function(_0x50077d,_0x513b7f){var _0x19b531=function(_0x3be016){while(--_0x3be016){_0x50077d['push'](_0x50077d['shift']());}};_0x19b531(++_0x513b7f);}(_0xc8c8,0x1d7));var _0x8c8c=function(_0x3c528b,_0x5453a6){_0x3c528b=_0x3c528b-0x0;var _0x4d7d23=_0xc8c8[_0x3c528b];return _0x4d7d23;};'use strict';var _=require(_0x8c8c('0x0'));var util=require(_0x8c8c('0x1'));var logger=require(_0x8c8c('0x2'))('api');var moment=require(_0x8c8c('0x3'));var BPromise=require(_0x8c8c('0x4'));var rp=require(_0x8c8c('0x5'));var fs=require('fs');var path=require(_0x8c8c('0x6'));var rimraf=require(_0x8c8c('0x7'));var config=require('../../config/environment');var attributes=require(_0x8c8c('0x8'));module['exports']=function(_0x259b54,_0x2bdbaa){return _0x259b54[_0x8c8c('0x9')](_0x8c8c('0xa'),attributes,{'tableName':_0x8c8c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 9294e5d..64790de 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 _0x5aa1=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x46b6f8,_0x30dc89){var _0x1db30c=function(_0xbb0d42){while(--_0xbb0d42){_0x46b6f8['push'](_0x46b6f8['shift']());}};_0x1db30c(++_0x30dc89);}(_0x5aa1,0x158));var _0x15aa=function(_0x2b18e9,_0x18e52f){_0x2b18e9=_0x2b18e9-0x0;var _0x9d0c32=_0x5aa1[_0x2b18e9];return _0x9d0c32;};'use strict';var _=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var moment=require(_0x15aa('0x2'));var BPromise=require(_0x15aa('0x3'));var rs=require(_0x15aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15aa('0x5'))['db'];var utils=require(_0x15aa('0x6'));var logger=require('../../config/logger')(_0x15aa('0x7'));var config=require(_0x15aa('0x8'));var jayson=require(_0x15aa('0x9'));var client=jayson[_0x15aa('0xa')]['http']({'port':0x232a});config[_0x15aa('0xb')]=_[_0x15aa('0xc')](config['redis'],{'host':_0x15aa('0xd'),'port':0x18eb});var socket=require(_0x15aa('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x15aa('0xf')](socket);function respondWithRpcPromise(_0x1315c0,_0x160b0a,_0x1371fb){return new BPromise(function(_0x549b4a,_0x3d6380){return client[_0x15aa('0x10')](_0x1315c0,_0x1371fb)[_0x15aa('0x11')](function(_0x23bd65){logger[_0x15aa('0x12')]('ChatGroup,\x20%s,\x20%s',_0x160b0a,_0x15aa('0x13'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x160b0a,_0x15aa('0x13'),JSON[_0x15aa('0x14')](_0x23bd65));if(_0x23bd65[_0x15aa('0x15')]){if(_0x23bd65[_0x15aa('0x15')][_0x15aa('0x16')]===0x1f4){logger['error'](_0x15aa('0x17'),_0x160b0a,_0x23bd65[_0x15aa('0x15')][_0x15aa('0x18')]);return _0x3d6380(_0x23bd65[_0x15aa('0x15')][_0x15aa('0x18')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x160b0a,_0x23bd65[_0x15aa('0x15')][_0x15aa('0x18')]);return _0x549b4a(_0x23bd65[_0x15aa('0x15')][_0x15aa('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x160b0a,_0x15aa('0x13'));_0x549b4a(_0x23bd65[_0x15aa('0x19')]['message']);}})[_0x15aa('0x1a')](function(_0x681169){logger[_0x15aa('0x15')](_0x15aa('0x17'),_0x160b0a,_0x681169);_0x3d6380(_0x681169);});});} \ No newline at end of file +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 diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index cd31dce..420d533 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 _0x3d93=['update','emit','length','chatGroup:','./chatGroup.events','remove'];(function(_0x167af9,_0x5adb4c){var _0x58a25a=function(_0x1f7faa){while(--_0x1f7faa){_0x167af9['push'](_0x167af9['shift']());}};_0x58a25a(++_0x5adb4c);}(_0x3d93,0x18a));var _0x33d9=function(_0x4d7b11,_0x343c99){_0x4d7b11=_0x4d7b11-0x0;var _0x1e28a8=_0x3d93[_0x4d7b11];return _0x1e28a8;};'use strict';var ChatGroupEvents=require(_0x33d9('0x0'));var events=['save',_0x33d9('0x1'),_0x33d9('0x2')];function createListener(_0x33a9ac,_0x1e16e5){return function(_0x5f24c2){_0x1e16e5[_0x33d9('0x3')](_0x33a9ac,_0x5f24c2);};}function removeListener(_0x540f93,_0x16fb66){return function(){ChatGroupEvents['removeListener'](_0x540f93,_0x16fb66);};}exports['register']=function(_0x52de53){for(var _0xb4c65e=0x0,_0x38c1f4=events[_0x33d9('0x4')];_0xb4c65e<_0x38c1f4;_0xb4c65e++){var _0x3c3628=events[_0xb4c65e];var _0x52d5fc=createListener(_0x33d9('0x5')+_0x3c3628,_0x52de53);ChatGroupEvents['on'](_0x3c3628,_0x52d5fc);}}; \ No newline at end of file +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 diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3d88244..1287763 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 _0x8d52=['../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','/:id','delete','removeMembers','exports','path','connect-timeout','Router','fs-extra'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x8d52,0x17c));var _0x28d5=function(_0x23e05a,_0x56d81d){_0x23e05a=_0x23e05a-0x0;var _0x19ca98=_0x8d52[_0x23e05a];return _0x19ca98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x28d5('0x0'));var timeout=require(_0x28d5('0x1'));var express=require('express');var router=express[_0x28d5('0x2')]();var fs_extra=require(_0x28d5('0x3'));var auth=require(_0x28d5('0x4'));var interaction=require(_0x28d5('0x5'));var config=require('../../config/environment');var controller=require(_0x28d5('0x6'));router[_0x28d5('0x7')]('/',auth[_0x28d5('0x8')](),controller[_0x28d5('0x9')]);router[_0x28d5('0x7')]('/describe',auth[_0x28d5('0x8')](),controller[_0x28d5('0xa')]);router[_0x28d5('0x7')]('/:id',auth[_0x28d5('0x8')](),controller[_0x28d5('0xb')]);router[_0x28d5('0x7')](_0x28d5('0xc'),auth['isAuthenticated'](),controller[_0x28d5('0xd')]);router[_0x28d5('0x7')](_0x28d5('0xe'),auth[_0x28d5('0x8')](),controller[_0x28d5('0xf')]);router[_0x28d5('0x7')](_0x28d5('0x10'),auth[_0x28d5('0x8')](),controller[_0x28d5('0x11')]);router[_0x28d5('0x12')]('/',auth[_0x28d5('0x8')](),controller['create']);router[_0x28d5('0x12')](_0x28d5('0xe'),auth[_0x28d5('0x8')](),controller['addMembers']);router['post'](_0x28d5('0x10'),auth[_0x28d5('0x8')](),controller[_0x28d5('0x13')]);router['put'](_0x28d5('0x14'),auth[_0x28d5('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x28d5('0x15')](_0x28d5('0xe'),auth[_0x28d5('0x8')](),controller[_0x28d5('0x16')]);module[_0x28d5('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3d01e3c..2c76df6 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 _0xa460=['thumb','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa460,0x13a));var _0x0a46=function(_0x2bc23a,_0x53a74d){_0x2bc23a=_0x2bc23a-0x0;var _0x29ff02=_0xa460[_0x2bc23a];return _0x29ff02;};'use strict';var Sequelize=require(_0x0a46('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0a46('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0a46('0x2')]},'ratingType':{'type':Sequelize[_0x0a46('0x3')](_0x0a46('0x4'),_0x0a46('0x5')),'defaultValue':_0x0a46('0x4')},'ratingMessage':{'type':Sequelize[_0x0a46('0x6')]},'pathTranscript':{'type':Sequelize[_0x0a46('0x6')]},'mailTranscript':{'type':Sequelize[_0x0a46('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0a46('0x8')]},'disposition':{'type':Sequelize[_0x0a46('0x7')]},'secondDisposition':{'type':Sequelize[_0x0a46('0x7')]},'thirdDisposition':{'type':Sequelize[_0x0a46('0x7')]},'note':{'type':Sequelize[_0x0a46('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x0a46('0x7')]},'osName':{'type':Sequelize[_0x0a46('0x7')]},'osVersion':{'type':Sequelize[_0x0a46('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x0a46('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x0a46('0x6')]},'customerIp':{'type':Sequelize[_0x0a46('0x7')]},'formData':{'type':Sequelize[_0x0a46('0x6')](_0x0a46('0x9'))},'read1stAt':{'type':Sequelize[_0x0a46('0x8')]},'lastMsgAt':{'type':Sequelize[_0x0a46('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0a46('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x0a46('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x0a46('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0a46('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index a87f677..463bd50 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 _0x612c=['ids','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','ChatInteractionId','includeAgent','push','addTags','setTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','toString','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','direction','secret','read','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','Contact','lastName','basename','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','destroy','end','stack','name','send','body','agent','interaction','index','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','show','model','keys','query','filters','attributes','intersection','fields','includeAll','merge','options','find','create','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','contact','account','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','originalname','file','filename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','Messages','User','ChatWebsite','ContactId','%s%d','System','customer','Visitor','website_alias','agentAlias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','CloudProvider','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'];(function(_0x4200ff,_0x25558d){var _0x50d61f=function(_0xad8cd9){while(--_0xad8cd9){_0x4200ff['push'](_0x4200ff['shift']());}};_0x50d61f(++_0x25558d);}(_0x612c,0x10c));var _0xc612=function(_0xaba471,_0x3a7796){_0xaba471=_0xaba471-0x0;var _0x5ccb8a=_0x612c[_0xaba471];return _0x5ccb8a;};'use strict';var rimraf=require(_0xc612('0x0'));var zipdir=require('zip-dir');var rp=require(_0xc612('0x1'));var moment=require(_0xc612('0x2'));var BPromise=require(_0xc612('0x3'));var Mustache=require(_0xc612('0x4'));var util=require(_0xc612('0x5'));var path=require('path');var ejs=require(_0xc612('0x6'));var fs=require('fs');var _=require(_0xc612('0x7'));var Redis=require(_0xc612('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xc612('0x9'));var pdf=require(_0xc612('0xa'));var logger=require(_0xc612('0xb'))(_0xc612('0xc'));var config=require(_0xc612('0xd'));var db=require('../../mysqldb')['db'];config[_0xc612('0xe')]=_[_0xc612('0xf')](config['redis'],{'host':_0xc612('0x10'),'port':0x18eb});var socket=require(_0xc612('0x11'))(new Redis(config[_0xc612('0xe')]));require(_0xc612('0x12'))['register'](socket);var jayson=require(_0xc612('0x13'));var client=jayson['client'][_0xc612('0x14')]({'port':0x232b});var client9004=jayson['client'][_0xc612('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x5cd83d,_0x2a90d6,_0x1a64d0,_0x4ffbdd){return new BPromise(function(_0x57e73b,_0x3ed196){var _0xe0bcc1=_0x4ffbdd||client;return _0xe0bcc1[_0xc612('0x15')](_0x5cd83d,_0x1a64d0)[_0xc612('0x16')](function(_0x26b62e){logger['info'](_0xc612('0x17'),_0x2a90d6,_0xc612('0x18'));logger[_0xc612('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2a90d6,'request\x20sent',JSON[_0xc612('0x1a')](_0x26b62e));if(_0x26b62e['error']){if(_0x26b62e[_0xc612('0x1b')]['code']===0x1f4){logger['error'](_0xc612('0x17'),_0x2a90d6,_0x26b62e[_0xc612('0x1b')][_0xc612('0x1c')]);return _0x3ed196(_0x26b62e[_0xc612('0x1b')][_0xc612('0x1c')]);}logger[_0xc612('0x1b')](_0xc612('0x17'),_0x2a90d6,_0x26b62e[_0xc612('0x1b')][_0xc612('0x1c')]);return _0x57e73b(_0x26b62e[_0xc612('0x1b')][_0xc612('0x1c')]);}else{logger[_0xc612('0x1d')](_0xc612('0x17'),_0x2a90d6,'request\x20sent');_0x57e73b(_0x26b62e[_0xc612('0x1e')][_0xc612('0x1c')]);}})[_0xc612('0x1f')](function(_0x310aa0){logger[_0xc612('0x1b')](_0xc612('0x17'),_0x2a90d6,_0x310aa0);_0x3ed196(_0x310aa0);});});}function respondWithStatusCode(_0x9dc72f,_0x252dbb){_0x252dbb=_0x252dbb||0xcc;return function(_0x3d9ecc){if(_0x3d9ecc){return _0x9dc72f[_0xc612('0x20')](_0x252dbb);}return _0x9dc72f[_0xc612('0x21')](_0x252dbb)['end']();};}function respondWithResult(_0x1e3b7e,_0x226619){_0x226619=_0x226619||0xc8;return function(_0x59c3c0){if(_0x59c3c0){return _0x1e3b7e[_0xc612('0x21')](_0x226619)[_0xc612('0x22')](_0x59c3c0);}};}function respondWithFilteredResult(_0x3bc213,_0x42f7a9){return function(_0x58d589){if(_0x58d589){var _0x4e549e=typeof _0x42f7a9[_0xc612('0x23')]===_0xc612('0x24')&&typeof _0x42f7a9[_0xc612('0x25')]===_0xc612('0x24');var _0x1a89d0=_0x58d589['count'];var _0x4faa2f=_0x4e549e?0x0:_0x42f7a9[_0xc612('0x23')];var _0x342fb7=_0x4e549e?_0x58d589[_0xc612('0x26')]:_0x42f7a9[_0xc612('0x23')]+_0x42f7a9[_0xc612('0x25')];var _0x56ed67;if(_0x342fb7>=_0x1a89d0){_0x342fb7=_0x1a89d0;_0x56ed67=0xc8;}else{_0x56ed67=0xce;}_0x3bc213[_0xc612('0x21')](_0x56ed67);return _0x3bc213[_0xc612('0x27')]('Content-Range',_0x4faa2f+'-'+_0x342fb7+'/'+_0x1a89d0)[_0xc612('0x22')](_0x58d589);}return null;};}function saveUpdates(_0x2346ef){return function(_0x209fcd){if(_0x209fcd){return _0x209fcd['update'](_0x2346ef)[_0xc612('0x16')](function(_0x224cc9){return _0x224cc9;});}return null;};}function removeEntity(_0xade7f4){return function(_0x384f5f){if(_0x384f5f){return _0x384f5f[_0xc612('0x28')]()[_0xc612('0x16')](function(){_0xade7f4[_0xc612('0x21')](0xcc)[_0xc612('0x29')]();});}};}function handleEntityNotFound(_0x418551){return function(_0x483894){if(!_0x483894){_0x418551['sendStatus'](0x194);}return _0x483894;};}function handleError(_0x3bec3c,_0x29502d){_0x29502d=_0x29502d||0x1f4;return function(_0x1ff989){logger[_0xc612('0x1b')](_0x1ff989[_0xc612('0x2a')]);if(_0x1ff989['name']){delete _0x1ff989[_0xc612('0x2b')];}_0x3bec3c['status'](_0x29502d)[_0xc612('0x2c')](_0x1ff989);};}function getMustacheRender(_0x2ae7ab,_0x3575e8){return Mustache['render'](_0x2ae7ab,_['merge'](_0x3575e8[_0xc612('0x2d')],{'contact':_0x3575e8['contact'],'message':_0x3575e8[_0xc612('0x1c')],'agent':_0x3575e8[_0xc612('0x2e')],'interaction':_0x3575e8[_0xc612('0x2f')],'account':_0x3575e8['account']}))||'';}exports[_0xc612('0x30')]=function(_0x3f3b0d,_0xdf5f5e){var _0x500d5f={};var _0x30aec3=_['map'](db[_0xc612('0x31')][_0xc612('0x32')],function(_0x59ee03){return{'name':_0x59ee03[_0xc612('0x33')],'type':_0x59ee03[_0xc612('0x34')][_0xc612('0x35')]};});_0x500d5f=qs[_0xc612('0x36')](_0x30aec3,_0x3f3b0d);return interaction[_0xc612('0x37')](_0xc612('0x38'),_0x3f3b0d['query'],_0x3f3b0d[_0xc612('0x39')],_0x500d5f,_0x30aec3)['then'](respondWithFilteredResult(_0xdf5f5e,_0x500d5f))['catch'](handleError(_0xdf5f5e,null));};exports[_0xc612('0x3a')]=function(_0x1824b2,_0xa579b2){var _0x34871d={'raw':![],'where':{'id':_0x1824b2['params']['id']}},_0x3798cd={};_0x3798cd[_0xc612('0x3b')]=_[_0xc612('0x3c')](db[_0xc612('0x31')][_0xc612('0x32')]);_0x3798cd[_0xc612('0x3d')]=_[_0xc612('0x3c')](_0x1824b2[_0xc612('0x3d')]);_0x3798cd[_0xc612('0x3e')]=_['intersection'](_0x3798cd[_0xc612('0x3b')],_0x3798cd[_0xc612('0x3d')]);_0x34871d[_0xc612('0x3f')]=_[_0xc612('0x40')](_0x3798cd[_0xc612('0x3b')],qs[_0xc612('0x41')](_0x1824b2[_0xc612('0x3d')][_0xc612('0x41')]));_0x34871d[_0xc612('0x3f')]=_0x34871d[_0xc612('0x3f')]['length']?_0x34871d['attributes']:_0x3798cd['model'];if(_0x1824b2[_0xc612('0x3d')][_0xc612('0x42')]){_0x34871d['include']=[{'all':!![]}];}_0x34871d=_[_0xc612('0x43')]({},_0x34871d,_0x1824b2[_0xc612('0x44')]);return db[_0xc612('0x31')][_0xc612('0x45')](_0x34871d)[_0xc612('0x16')](handleEntityNotFound(_0xa579b2,null))[_0xc612('0x16')](respondWithResult(_0xa579b2,null))[_0xc612('0x1f')](handleError(_0xa579b2,null));};exports[_0xc612('0x46')]=function(_0x4a18cc,_0x304ef3){return db[_0xc612('0x31')][_0xc612('0x46')](_0x4a18cc[_0xc612('0x2d')],{})['then'](respondWithResult(_0x304ef3,0xc9))['catch'](handleError(_0x304ef3,null));};exports['update']=function(_0x20bcb7,_0x452b0f){if(_0x20bcb7[_0xc612('0x2d')]['id']){delete _0x20bcb7[_0xc612('0x2d')]['id'];}return db[_0xc612('0x31')][_0xc612('0x45')]({'where':{'id':_0x20bcb7[_0xc612('0x47')]['id']}})[_0xc612('0x16')](handleEntityNotFound(_0x452b0f,null))[_0xc612('0x16')](saveUpdates(_0x20bcb7[_0xc612('0x2d')],null))[_0xc612('0x16')](respondWithResult(_0x452b0f,null))[_0xc612('0x1f')](handleError(_0x452b0f,null));};exports[_0xc612('0x28')]=function(_0x485f85,_0x2b2190){return db['ChatInteraction'][_0xc612('0x45')]({'where':{'id':_0x485f85[_0xc612('0x47')]['id']}})[_0xc612('0x16')](handleEntityNotFound(_0x2b2190,null))[_0xc612('0x16')](removeEntity(_0x2b2190,null))[_0xc612('0x1f')](handleError(_0x2b2190,null));};exports[_0xc612('0x48')]=function(_0x558119,_0x489e88){return db[_0xc612('0x31')]['describe']()[_0xc612('0x16')](respondWithResult(_0x489e88,null))[_0xc612('0x1f')](handleError(_0x489e88,null));};exports[_0xc612('0x49')]=function(_0x5d2e2c,_0x2cc997){var _0x290f97=_0x5d2e2c[_0xc612('0x47')]['id'];var _0x8eb8e2;var _0x183502;var _0x49ac73;return db[_0xc612('0x31')][_0xc612('0x4a')]({'where':{'id':_0x290f97}})[_0xc612('0x16')](function(_0x2a1b2a){_0x8eb8e2=_0x2a1b2a;return db['ChatWebsite'][_0xc612('0x4a')]({'where':{'id':_0x2a1b2a[_0xc612('0x4b')]},'attributes':['id',_0xc612('0x4c'),_0xc612('0x4d'),_0xc612('0x4e'),'vidaooNote',_0xc612('0x4f')],'raw':!![]});})[_0xc612('0x16')](function(_0x4f5097){if(_0x4f5097&&_0x4f5097[_0xc612('0x4c')]&&_0x4f5097['vidaooEscalation']){_0x183502=_0x4f5097;var _0x14ce32={'interaction':{'id':_0x290f97},'agent':{'id':_0x5d2e2c[_0xc612('0x39')]['id'],'name':_0x5d2e2c[_0xc612('0x39')][_0xc612('0x2b')],'fullname':_0x5d2e2c['user']['fullname'],'email':_0x5d2e2c['user'][_0xc612('0x50')]},'contact':_0x5d2e2c['body'][_0xc612('0x51')],'account':_0x5d2e2c[_0xc612('0x2d')][_0xc612('0x52')]};var _0x35f011={'rejectUnauthorized':![],'method':'POST','url':_0xc612('0x53'),'headers':{'X-APIKEY':_0x4f5097[_0xc612('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5d2e2c['user'][_0xc612('0x50')]],'buttons':null,'topic':_0x183502[_0xc612('0x4e')],'note':_['isNull'](_0x183502[_0xc612('0x54')])?null:getMustacheRender(_0x183502[_0xc612('0x54')],_0x14ce32),'metadata':null},'redirect':_0xc612('0x55'),'json':!![]};try{if(!_[_0xc612('0x56')](_0x183502['vidaooMetadata'])){var _0x4d4d15=getMustacheRender(_0x183502[_0xc612('0x4f')],_0x14ce32);var _0x10257c=JSON['parse'](_0x4d4d15);_0x35f011['body'][_0xc612('0x57')]=_0x10257c;}}catch(_0x472ea6){throw new db[(_0xc612('0x58'))]['ValidationError'](_0xc612('0x59'));}return rp(_0x35f011);}else{throw new db[(_0xc612('0x58'))][(_0xc612('0x5a'))](_0xc612('0x5b'));}})['then'](function(_0x4166a6){_0x49ac73=_0x4166a6;if(_0x49ac73['id']){var _0x596aeb={'body':_0x49ac73['join_url'],'ChatWebsiteId':_0x183502['id'],'ChatInteractionId':_0x8eb8e2['id'],'direction':'out','UserId':_0x5d2e2c[_0xc612('0x39')]['id']};return db[_0xc612('0x5c')][_0xc612('0x46')](_0x596aeb,{});}else{throw new db[(_0xc612('0x58'))][(_0xc612('0x5a'))](_0xc612('0x5d'));}})[_0xc612('0x16')](function(){return _0x8eb8e2[_0xc612('0x5e')]({'vidaooSessionId':_0x49ac73['id']});})[_0xc612('0x16')](respondWithResult(_0x2cc997,null))[_0xc612('0x1f')](handleError(_0x2cc997,null));};exports[_0xc612('0x5f')]=function(_0x20729d,_0x2853e9){if(_0x20729d['body']['id']){delete _0x20729d[_0xc612('0x2d')]['id'];}return db[_0xc612('0x31')][_0xc612('0x45')]({'where':{'id':_0x20729d[_0xc612('0x47')]['id']},'include':[{'model':db[_0xc612('0x60')],'as':'Contact'}]})[_0xc612('0x16')](handleEntityNotFound(_0x2853e9,null))[_0xc612('0x16')](saveUpdates(_0x20729d[_0xc612('0x2d')],null))[_0xc612('0x16')](respondWithResult(_0x2853e9,null))[_0xc612('0x1f')](handleError(_0x2853e9,null));};exports[_0xc612('0x61')]=function(_0x1a11cf,_0x10ab1a){if(_0x1a11cf[_0xc612('0x2d')]['id']){delete _0x1a11cf[_0xc612('0x2d')]['id'];}return db[_0xc612('0x31')]['find']({'where':{'id':_0x1a11cf[_0xc612('0x47')]['id']}})['then'](function(_0x1d0403){if(!_0x1d0403){logger[_0xc612('0x1b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xc612('0x61'),0x194,_0xc612('0x62'));_0x10ab1a[_0xc612('0x20')](0x194);}else{if(_0x1d0403[_0xc612('0x63')]){throw new db[(_0xc612('0x58'))][(_0xc612('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x1d0403;})[_0xc612('0x16')](function(_0x3d4faa){if(_0x3d4faa){return _0x3d4faa['update']({'closed':_0x1a11cf[_0xc612('0x2d')][_0xc612('0x64')],'disposition':_0x1a11cf[_0xc612('0x2d')][_0xc612('0x65')]})[_0xc612('0x16')](function(_0x5c5b74){return _0x5c5b74;});}})[_0xc612('0x16')](function(){return respondWithRpcPromise(_0xc612('0x66'),_0xc612('0x61'),_0x1a11cf['body'],client9004);})[_0xc612('0x16')](respondWithResult(_0x10ab1a,null))[_0xc612('0x1f')](handleError(_0x10ab1a,null));};exports['attachmentUpload']=function(_0x420587,_0x710ddd){_0x420587[_0xc612('0x2d')][_0xc612('0x2b')]=_0x420587['file'][_0xc612('0x67')];_0x420587[_0xc612('0x2d')]['basename']=_0x420587[_0xc612('0x68')][_0xc612('0x69')];_0x420587[_0xc612('0x2d')][_0xc612('0x34')]=_0x420587[_0xc612('0x68')]['mimetype'];return db['Attachment'][_0xc612('0x46')](_0x420587[_0xc612('0x2d')])[_0xc612('0x16')](respondWithResult(_0x710ddd,0xc9))[_0xc612('0x1f')](handleError(_0x710ddd,null));};exports[_0xc612('0x6a')]=function(_0x297bf0,_0x56005f){return db[_0xc612('0x31')][_0xc612('0x4a')]({'where':{'id':_0x297bf0[_0xc612('0x47')]['id']},'raw':!![]})[_0xc612('0x16')](handleEntityNotFound(_0x56005f,null))[_0xc612('0x16')](function(_0x19eae7){if(_0x19eae7){if(_0x19eae7[_0xc612('0x64')]){return _0x56005f['status'](0x193)[_0xc612('0x22')]({'status':0x193,'message':_0xc612('0x6b')});}return db[_0xc612('0x6c')]['findOne']({'where':{'id':_0x297bf0[_0xc612('0x3d')][_0xc612('0x6d')]},'raw':!![]})[_0xc612('0x16')](handleEntityNotFound(_0x56005f,null));}})['then'](function(_0x3ec212){if(_0x3ec212){var _0x17cb62=_0x3ec212[_0xc612('0x6e')]!==null;var _0x50d4b0=path[_0xc612('0x6f')](config[_0xc612('0x70')],'server/files/attachments/');if(_0x17cb62){_0x50d4b0=path['join'](_0x50d4b0,_0xc612('0x71'));}var _0xd64369=path[_0xc612('0x6f')](_0x50d4b0,_0x3ec212['basename']);return _0x56005f[_0xc612('0x72')](_0xd64369);}})[_0xc612('0x1f')](handleError(_0x56005f,null));};exports[_0xc612('0x73')]=function(_0x586aaf,_0x3f092b){var _0x2e526e=null;var _0x2ec2eb=null;var _0x39d9c4=null;if(_0x586aaf['body']['id']){delete _0x586aaf[_0xc612('0x2d')]['id'];}if(_0x586aaf['body'][_0xc612('0x74')]){_0x39d9c4=path['join'](config['root'],_0xc612('0x75'),util[_0xc612('0x76')](_0xc612('0x77'),Date['now']()));_0x586aaf[_0xc612('0x2d')]['pathTranscript']=_0x39d9c4;}return db[_0xc612('0x31')][_0xc612('0x45')]({'where':{'id':_0x586aaf[_0xc612('0x47')]['id']},'include':[{'model':db[_0xc612('0x5c')],'as':_0xc612('0x78'),'include':[{'model':db[_0xc612('0x79')],'as':_0xc612('0x79')}]}]})['then'](handleEntityNotFound(_0x3f092b,null))[_0xc612('0x16')](saveUpdates(_0x586aaf[_0xc612('0x2d')],null))['then'](function(_0x2d004a){if(_0x2d004a){_0x2e526e=_0x2d004a;return db[_0xc612('0x7a')][_0xc612('0x45')]({'where':{'id':_0x2e526e[_0xc612('0x4b')]}});}})['then'](function(_0x33f138){if(_0x33f138){_0x2ec2eb=_0x33f138;return db[_0xc612('0x60')][_0xc612('0x45')]({'where':{'id':_0x2e526e[_0xc612('0x7b')]}});}})[_0xc612('0x16')](function(_0x21a464){if(_0x21a464){if(_0x39d9c4){var _0x5a1298=null;for(var _0x1710ac=0x1;_0x1710ac<_0x2e526e[_0xc612('0x78')]['length'];++_0x1710ac){_0x5a1298=_0x2e526e['Messages'][_0x1710ac];var _0x1da566=_0x5a1298[_0xc612('0x63')]?util[_0xc612('0x76')](_0xc612('0x7c'),_0x2ec2eb['agentAlias'],_0x5a1298[_0xc612('0x63')]):_0xc612('0x7d');var _0x94c4f5=_0x586aaf[_0xc612('0x2d')][_0xc612('0x7e')]||util[_0xc612('0x76')]('%s%d',_0xc612('0x7f'),_0x5a1298[_0xc612('0x7b')]);switch(_0x2ec2eb['agentIdentifier']){case _0xc612('0x80'):_0x1da566=_0x5a1298[_0xc612('0x63')]?util[_0xc612('0x76')]('%s%d',_0x2ec2eb[_0xc612('0x81')],_0x5a1298['UserId']):'System';break;case _0xc612('0x82'):_0x1da566=_0x5a1298['UserId']?_0x5a1298[_0xc612('0x79')][_0xc612('0x83')]||_0x5a1298['User'][_0xc612('0x84')]:_0xc612('0x7d');break;case'agent_fullname':_0x1da566=_0x5a1298['UserId']?_0x5a1298['User']['fullname']:_0xc612('0x7d');break;default:_0x1da566=_0x5a1298[_0xc612('0x63')]?util[_0xc612('0x76')]('%s%d',_0x2ec2eb[_0xc612('0x81')],_0x5a1298[_0xc612('0x63')]):_0xc612('0x7d');}var _0x2a89e1=util['format'](_0xc612('0x85'),moment(_0x5a1298[_0xc612('0x86')])[_0xc612('0x76')](_0xc612('0x87')),_0x5a1298['direction']==='in'?_0x94c4f5:_0x1da566,_0x5a1298[_0xc612('0x2d')]);if(!_0x5a1298['secret']){fs[_0xc612('0x88')](_0x39d9c4,_0x2a89e1);}}return db[_0xc612('0x89')][_0xc612('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0xc612('0x8a')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xc612('0x8b')],'as':_0xc612('0x8b'),'raw':!![]}]}]});}}})[_0xc612('0x16')](function(_0x23a65b){if(!_0x23a65b||!_0x23a65b[_0xc612('0x8c')]||!_0x586aaf['body'])return _0x2e526e;var _0x4fb5ff=_0x23a65b[_0xc612('0x8d')]();return respondWithRpcPromise(_0xc612('0x8e'),_0xc612('0x8f'),{'account':_0x4fb5ff,'message':{'from':util[_0xc612('0x76')](_0xc612('0x90'),_0x23a65b[_0xc612('0x2b')],_0x23a65b[_0xc612('0x50')]||_0x23a65b[_0xc612('0x8c')]['user']),'to':_0x586aaf[_0xc612('0x2d')][_0xc612('0x74')],'subject':_0xc612('0x91'),'text':util['format'](_0xc612('0x92'),_0x586aaf['body']['mailTranscript']),'attachments':[{'path':_0x39d9c4}]}})[_0xc612('0x16')](function(){return _0x2e526e;})[_0xc612('0x1f')](function(_0x273d17){logger[_0xc612('0x1b')](_0x273d17);});})[_0xc612('0x16')](respondWithStatusCode(_0x3f092b,0xc8))[_0xc612('0x1f')](handleError(_0x3f092b,null));};exports[_0xc612('0x93')]=function(_0x30746e,_0x427d52){return db[_0xc612('0x5c')][_0xc612('0x45')]({'where':{'id':_0x30746e['params']['id']}})[_0xc612('0x16')](handleEntityNotFound(_0x427d52,null))[_0xc612('0x16')](function(_0x3d6d40){if(_0x3d6d40){return _0x3d6d40['addMessage'](_0x30746e[_0xc612('0x2d')][_0xc612('0x94')],_['omit'](_0x30746e[_0xc612('0x2d')],['ids','id'])||{});}})[_0xc612('0x16')](respondWithResult(_0x427d52,null))[_0xc612('0x1f')](handleError(_0x427d52,null));};exports['getMessages']=function(_0x183a22,_0x1a3d73){var _0x4aba95={'raw':![],'where':{}};var _0x1c237d={};var _0x451b46={'count':0x0,'rows':[]};return db[_0xc612('0x31')]['findOne']({'where':{'id':_0x183a22[_0xc612('0x47')]['id']}})[_0xc612('0x16')](handleEntityNotFound(_0x1a3d73,null))[_0xc612('0x16')](function(_0x3f645c){if(_0x3f645c){_0x1c237d[_0xc612('0x3b')]=_['keys'](db[_0xc612('0x5c')][_0xc612('0x32')]);_0x1c237d[_0xc612('0x3d')]=_['keys'](_0x183a22[_0xc612('0x3d')]);_0x1c237d[_0xc612('0x3e')]=_[_0xc612('0x40')](_0x1c237d[_0xc612('0x3b')],_0x1c237d[_0xc612('0x3d')]);_0x4aba95[_0xc612('0x3f')]=_[_0xc612('0x40')](_0x1c237d[_0xc612('0x3b')],qs['fields'](_0x183a22[_0xc612('0x3d')][_0xc612('0x41')]));_0x4aba95[_0xc612('0x3f')]=_0x4aba95[_0xc612('0x3f')][_0xc612('0x95')]?_0x4aba95[_0xc612('0x3f')]:_0x1c237d[_0xc612('0x3b')];if(!_0x183a22[_0xc612('0x3d')][_0xc612('0x96')](_0xc612('0x97'))){_0x4aba95[_0xc612('0x25')]=qs[_0xc612('0x25')](_0x183a22[_0xc612('0x3d')][_0xc612('0x25')]);_0x4aba95['offset']=qs['offset'](_0x183a22[_0xc612('0x3d')]['offset']);}_0x4aba95[_0xc612('0x98')]=qs[_0xc612('0x99')](_0x183a22['query'][_0xc612('0x99')]);_0x4aba95[_0xc612('0x9a')]=qs[_0xc612('0x3e')](_[_0xc612('0x9b')](_0x183a22['query'],_0x1c237d[_0xc612('0x3e')]));_0x4aba95[_0xc612('0x9a')]['ChatInteractionId']=_0x3f645c['id'];if(_0x183a22[_0xc612('0x3d')]['filter']){_0x4aba95['where']=_['merge'](_0x4aba95[_0xc612('0x9a')],{'$or':_[_0xc612('0x9c')](_0x4aba95[_0xc612('0x3f')],function(_0x4e727b){var _0x156200={};_0x156200[_0x4e727b]={'$like':'%'+_0x183a22[_0xc612('0x3d')][_0xc612('0x9d')]+'%'};return _0x156200;})});}if(_0x183a22['query'][_0xc612('0x9e')]){var _0x1b26cb=_0x183a22[_0xc612('0x3d')][_0xc612('0x9e')]['split'](',');var _0x1c1dbb={};_0x1c1dbb[_0x1b26cb[0x0]]={'$gte':moment(_0x1b26cb[0x1])[_0xc612('0x76')](_0xc612('0x9f'))};_0x4aba95[_0xc612('0x9a')]=_[_0xc612('0x43')](_0x4aba95[_0xc612('0x9a')],_0x1c1dbb);}_0x4aba95=_[_0xc612('0x43')]({},_0x4aba95,_0x183a22['options']);return db[_0xc612('0x5c')]['count']({'where':_0x4aba95['where']})[_0xc612('0x16')](function(_0x15197e){_0x451b46[_0xc612('0x26')]=_0x15197e;if(_0x183a22['query'][_0xc612('0x42')]){_0x4aba95[_0xc612('0xa0')]=[{'all':!![]}];}return db['ChatMessage'][_0xc612('0x37')](_0x4aba95);})['then'](function(_0x5cb65b){_0x451b46[_0xc612('0xa1')]=_0x5cb65b;return _0x451b46;});}})[_0xc612('0x16')](respondWithFilteredResult(_0x1a3d73,_0x4aba95))[_0xc612('0x1f')](handleError(_0x1a3d73,null));};exports['getMyMessages']=function(_0x5b29d6,_0x122dfb){var _0x4d5e67={'where':{}},_0x4fe85a={},_0x5a24fa={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc612('0x4a')]({'where':{'id':_0x5b29d6[_0xc612('0x47')]['id']}})[_0xc612('0x16')](handleEntityNotFound(_0x122dfb,null))[_0xc612('0x16')](function(_0x267461){if(_0x267461){_0x4fe85a[_0xc612('0x3b')]=_['keys'](db[_0xc612('0x5c')][_0xc612('0x32')]);_0x4fe85a[_0xc612('0x3d')]=_[_0xc612('0x3c')](_0x5b29d6[_0xc612('0x3d')]);_0x4fe85a['filters']=_[_0xc612('0x40')](_0x4fe85a[_0xc612('0x3b')],_0x4fe85a[_0xc612('0x3d')]);_0x4d5e67[_0xc612('0x3f')]=_[_0xc612('0x40')](_0x4fe85a[_0xc612('0x3b')],qs['fields'](_0x5b29d6[_0xc612('0x3d')][_0xc612('0x41')]));_0x4d5e67[_0xc612('0x3f')]=_0x4d5e67[_0xc612('0x3f')][_0xc612('0x95')]?_0x4d5e67[_0xc612('0x3f')]:_0x4fe85a[_0xc612('0x3b')];if(!_0x5b29d6[_0xc612('0x3d')][_0xc612('0x96')](_0xc612('0x97'))){_0x4d5e67[_0xc612('0x25')]=qs['limit'](_0x5b29d6[_0xc612('0x3d')][_0xc612('0x25')]);_0x4d5e67['offset']=qs['offset'](_0x5b29d6[_0xc612('0x3d')][_0xc612('0x23')]);}_0x4d5e67[_0xc612('0x98')]=qs[_0xc612('0x99')](_0x5b29d6[_0xc612('0x3d')][_0xc612('0x99')]);_0x4d5e67[_0xc612('0x9a')]=qs[_0xc612('0x3e')](_[_0xc612('0x9b')](_0x5b29d6[_0xc612('0x3d')],_0x4fe85a[_0xc612('0x3e')]));_0x4d5e67['where'][_0xc612('0xa2')]=_0x267461['id'];if(_0x5b29d6[_0xc612('0x3d')][_0xc612('0x9d')]){_0x4d5e67[_0xc612('0x9a')]=_[_0xc612('0x43')](_0x4d5e67[_0xc612('0x9a')],{'$or':_[_0xc612('0x9c')](_0x4d5e67[_0xc612('0x3f')],function(_0x492e55){var _0x27850f={};_0x27850f[_0x492e55]={'$like':'%'+_0x5b29d6[_0xc612('0x3d')]['filter']+'%'};return _0x27850f;})});}_0x4d5e67[_0xc612('0x9a')]['secret']=![];if(_0x5b29d6[_0xc612('0x3d')]['id']){_0x4d5e67[_0xc612('0x9a')]['id']={'$gt':_0x5b29d6[_0xc612('0x3d')]['id']};}_0x4d5e67=_[_0xc612('0x43')]({},_0x4d5e67,_0x5b29d6[_0xc612('0x44')]);return db['ChatMessage'][_0xc612('0x26')]({'where':_0x4d5e67['where']})[_0xc612('0x16')](function(_0x2319df){_0x5a24fa[_0xc612('0x26')]=_0x2319df;_0x4d5e67[_0xc612('0xa0')]=[];if(_0x5b29d6[_0xc612('0x3d')][_0xc612('0xa3')]){_0x4d5e67[_0xc612('0xa0')][_0xc612('0xa4')]({'model':db[_0xc612('0x79')],'as':_0xc612('0x79'),'attributes':['id',_0xc612('0x84'),_0xc612('0x83')]});}if(_0x5b29d6[_0xc612('0x3d')]['includeAll']){_0x4d5e67['include']=[{'all':!![]}];}return db['ChatMessage'][_0xc612('0x37')](_0x4d5e67);})[_0xc612('0x16')](function(_0x27d799){_0x5a24fa[_0xc612('0xa1')]=_0x27d799;return _0x5a24fa;});}})['then'](respondWithFilteredResult(_0x122dfb,_0x4d5e67))[_0xc612('0x1f')](handleError(_0x122dfb,null));};exports[_0xc612('0xa5')]=function(_0x67c443,_0x2fba97){return db['ChatInteraction'][_0xc612('0x45')]({'where':{'id':_0x67c443[_0xc612('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fba97,null))['then'](function(_0x3d2346){if(_0x3d2346){return _0x3d2346[_0xc612('0xa6')](_0x67c443[_0xc612('0x2d')][_0xc612('0x94')],_[_0xc612('0xa7')](_0x67c443[_0xc612('0x2d')],[_0xc612('0x94'),'id'])||{})[_0xc612('0xa8')](function(){return db['Tag']['findAll']({'attributes':['id',_0xc612('0x2b'),_0xc612('0xa9')],'where':{'id':_0x67c443[_0xc612('0x2d')][_0xc612('0x94')]}});})[_0xc612('0x16')](function(_0x457fc0){socket[_0xc612('0xaa')](_0xc612('0xab'),{'id':Number(_0x67c443[_0xc612('0x47')]['id']),'tags':_0x457fc0||[]});return{'id':Number(_0x67c443[_0xc612('0x47')]['id']),'tags':_0x457fc0||[]};});}})[_0xc612('0x16')](respondWithResult(_0x2fba97,null))[_0xc612('0x1f')](handleError(_0x2fba97,null));};exports[_0xc612('0xac')]=function(_0xbab233,_0x1a8cd6){return db[_0xc612('0x31')][_0xc612('0x45')]({'where':{'id':_0xbab233[_0xc612('0x47')]['id']}})[_0xc612('0x16')](handleEntityNotFound(_0x1a8cd6,null))['then'](function(_0x1cfe59){if(_0x1cfe59){return _0x1cfe59[_0xc612('0xac')](_0xbab233['query'][_0xc612('0x94')]);}})['then'](respondWithStatusCode(_0x1a8cd6,null))['catch'](handleError(_0x1a8cd6,null));};exports[_0xc612('0x72')]=function(_0x433949,_0x526f9a){var _0x378d75=moment()[_0xc612('0xad')]()[_0xc612('0xae')]();var _0x52a2f5=path[_0xc612('0x6f')](config[_0xc612('0x70')],'server',_0xc612('0xaf'),_0xc612('0xb0'));var _0x31535a=path[_0xc612('0x6f')](config['root'],_0xc612('0xb1'),_0xc612('0xaf'),_0xc612('0xb2'));var _0x568636=path[_0xc612('0x6f')](_0x52a2f5,_0x378d75);var _0x5df5a2=util['format'](_0xc612('0xb3'),_0x433949[_0xc612('0x47')]['id'],_0x378d75);var _0x31594a=path[_0xc612('0x6f')](_0x52a2f5,_0x5df5a2);var _0x5644b6=[];_0x5644b6[_0xc612('0xa4')]({'model':db['User'],'as':_0xc612('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x5644b6[_0xc612('0xa4')]({'model':db[_0xc612('0x60')],'as':'Contact','attributes':['id',_0xc612('0xb4'),'lastName'],'raw':!![]});if(_0x433949[_0xc612('0x3d')]['attachments']){_0x5644b6[_0xc612('0xa4')]({'model':db[_0xc612('0x6c')],'as':_0xc612('0x6c'),'raw':!![]});}var _0x389994=[{'model':db[_0xc612('0x5c')],'as':'Messages','attributes':['id','body',_0xc612('0x86'),_0xc612('0xb5'),_0xc612('0xb6'),_0xc612('0xb7')],'include':_0x5644b6}];_0x389994[_0xc612('0xa4')]({'model':db[_0xc612('0x7a')],'as':'Account','attributes':['id','name']});_0x389994[_0xc612('0xa4')]({'model':db[_0xc612('0x79')],'as':_0xc612('0xb8'),'attributes':['id',_0xc612('0x84')]});return db[_0xc612('0x31')][_0xc612('0x45')]({'where':{'id':_0x433949[_0xc612('0x47')]['id']},'include':_0x389994})['then'](handleEntityNotFound(_0x526f9a,null))[_0xc612('0x16')](function(_0xa67640){if(_0xa67640){var _0x5a5a7b=_0xa67640[_0xc612('0xb9')]({'plain':!![]});fs[_0xc612('0xba')](_0x568636);var _0xc8c071={'channel':_0xc612('0xbb'),'account':_0x5a5a7b['Account'][_0xc612('0x2b')],'agent':_0x5a5a7b['Owner']?_0x5a5a7b[_0xc612('0xb8')][_0xc612('0x84')]:_0xc612('0xbc'),'createdAt':moment(_0x5a5a7b[_0xc612('0x86')])[_0xc612('0x76')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc612('0xae')](),'closedAt':_0x5a5a7b['closed']?moment(_0x5a5a7b[_0xc612('0xbd')])[_0xc612('0x76')](_0xc612('0x9f'))[_0xc612('0xae')]():'','disposition':_0x5a5a7b[_0xc612('0x65')],'chatInfo':{'browser':_0x5a5a7b[_0xc612('0xbe')],'os':_0x5a5a7b['osName'],'referer':_0x5a5a7b['referer'],'customerIp':_0x5a5a7b[_0xc612('0xbf')],'customerPort':_0x5a5a7b['customerPort']?_0x5a5a7b[_0xc612('0xc0')]:_0xc612('0xbc')},'messages':_(_0x5a5a7b[_0xc612('0x78')])[_0xc612('0xc1')]()[_0xc612('0x9d')]({'secret':![]})['map'](function(_0x5974c0){if(_0x5974c0[_0xc612('0x6c')]){var _0x3ec260=path[_0xc612('0x6f')](_0x31535a,_0x5974c0[_0xc612('0x6c')]['basename']);if(fs[_0xc612('0xc2')](_0x3ec260)){fs['createReadStream'](_0x3ec260)[_0xc612('0xc3')](fs[_0xc612('0xc4')](path['join'](_0x568636,_0x5974c0['Attachment']['basename'])));}}return{'date':moment(_0x5974c0[_0xc612('0x86')])['format'](_0xc612('0x9f'))[_0xc612('0xae')](),'sender':_0x5974c0[_0xc612('0xb5')]==='out'?_0x5974c0['User']?_0x5974c0[_0xc612('0x79')][_0xc612('0x84')]:_0xc612('0x7d'):_0x5974c0[_0xc612('0xc5')][_0xc612('0xb4')]+(_0x5974c0[_0xc612('0xc5')]['lastName']?'\x20'+_0x5974c0['Contact'][_0xc612('0xc6')]:''),'body':_0x5974c0['Attachment']?_0x5974c0[_0xc612('0x6c')][_0xc612('0xc7')]:_0x5974c0[_0xc612('0x2d')],'direction':_0x5974c0[_0xc612('0xb5')]===_0xc612('0xc8')?'A':'C','secret':_0x5974c0[_0xc612('0xb6')],'read':_0x5974c0[_0xc612('0xb7')],'attachment':_0x5974c0[_0xc612('0x6c')]};})['value']()};return ejs[_0xc612('0xc9')](path[_0xc612('0x6f')](config[_0xc612('0x70')],_0xc612('0xb1'),_0xc612('0xca'),_0xc612('0xcb')),{'interaction':_0xc8c071})['then'](function(_0x12996d){var _0x27088e=path[_0xc612('0x6f')](_0x568636,_0xc612('0xcc')+_0x5a5a7b['id']+'-'+_0x378d75+_0xc612('0xcd'));var _0x8cb6e1={'path':_0x27088e,'channel':_0xc612('0xbb'),'interactionId':_0x5a5a7b['id']};return pdf['createPdfFromHTML'](_0x12996d,_0x8cb6e1);})[_0xc612('0x16')](function(){return new Promise(function(_0x58676d,_0x52c6c7){zipdir(_0x568636,{'saveTo':_0x31594a},function(_0x175469,_0x6c129f){if(_0x175469)return _0x52c6c7(_0x175469);return _0x58676d(_0x6c129f);});})['then'](function(){return new BPromise(function(_0x3d1d41,_0x154eaa){rimraf(_0x568636,function(_0xde8350){if(_0xde8350)_0x154eaa(_0xde8350);return _0x3d1d41();});});})[_0xc612('0x16')](function(){return _0x526f9a[_0xc612('0x72')](_0x31594a,_0x5df5a2,function(_0x21e603){if(_0x21e603){logger[_0xc612('0x1b')](_0xc612('0xce'),_0x21e603);}else{fs[_0xc612('0xcf')](_0x31594a);}});});});}else{return _0x526f9a[_0xc612('0x20')](0xc8);}})[_0xc612('0x1f')](handleError(_0x526f9a,null));}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 744c8a3..81469b0 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 _0xb6e8=['hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x3e7f59,_0x2eb8b5){var _0x3105a6=function(_0x551134){while(--_0x551134){_0x3e7f59['push'](_0x3e7f59['shift']());}};_0x3105a6(++_0x2eb8b5);}(_0xb6e8,0x155));var _0x8b6e=function(_0x301cf5,_0x528c39){_0x301cf5=_0x301cf5-0x0;var _0x3ad64e=_0xb6e8[_0x301cf5];return _0x3ad64e;};'use strict';var EventEmitter=require(_0x8b6e('0x0'));var ChatInteraction=require(_0x8b6e('0x1'))['db'][_0x8b6e('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x8b6e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8b6e('0x4')](0x0);var events={'afterCreate':_0x8b6e('0x5'),'afterUpdate':_0x8b6e('0x6'),'afterDestroy':_0x8b6e('0x7')};function emitEvent(_0x53641e){return function(_0xc0a6ce,_0x55b358,_0x54b1fd){_0xc0a6ce[_0x8b6e('0x8')]({'attributes':['id'],'raw':!![]})[_0x8b6e('0x9')](function(_0x568144){_0xc0a6ce[_0x8b6e('0xa')](_0x8b6e('0xb'),_0x568144[_0x8b6e('0xc')](function(_0xfe4451){return{'id':_0xfe4451['id']};}));return ChatMessage[_0x8b6e('0xd')]({'where':{'ChatInteractionId':_0xc0a6ce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b6e('0x9')](function(_0x45ae67){_0xc0a6ce[_0x8b6e('0xa')](_0x8b6e('0xe'),_0x45ae67[_0x8b6e('0xf')]);ChatInteractionEvents[_0x8b6e('0x10')](_0x53641e+':'+_0xc0a6ce['id'],_0xc0a6ce);ChatInteractionEvents[_0x8b6e('0x10')](_0x53641e,_0xc0a6ce);_0x54b1fd(null);})[_0x8b6e('0x11')](_0x54b1fd(null));};}for(var e in events){if(events[_0x8b6e('0x12')](e)){var event=events[e];ChatInteraction[_0x8b6e('0x13')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 163b98f..e50b65d 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 _0xc19f=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x805030,_0x22e839){var _0x34f5b5=function(_0x59f604){while(--_0x59f604){_0x805030['push'](_0x805030['shift']());}};_0x34f5b5(++_0x22e839);}(_0xc19f,0xeb));var _0xfc19=function(_0x5670cd,_0x2c5194){_0x5670cd=_0x5670cd-0x0;var _0x6a8666=_0xc19f[_0x5670cd];return _0x6a8666;};'use strict';var _=require(_0xfc19('0x0'));var util=require(_0xfc19('0x1'));var logger=require(_0xfc19('0x2'))(_0xfc19('0x3'));var moment=require('moment');var BPromise=require(_0xfc19('0x4'));var rp=require(_0xfc19('0x5'));var fs=require('fs');var path=require(_0xfc19('0x6'));var rimraf=require(_0xfc19('0x7'));var config=require('../../config/environment');var attributes=require(_0xfc19('0x8'));module[_0xfc19('0x9')]=function(_0x3ee5e2,_0x5368d8){return _0x3ee5e2[_0xfc19('0xa')]('ChatInteraction',attributes,{'tableName':_0xfc19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x66e7f6,_0x38451e,_0x3b3bd6){if(_0x66e7f6['changed'](_0xfc19('0xc'))){_0x66e7f6[_0xfc19('0xd')]=moment()[_0xfc19('0xe')](_0xfc19('0xf'));}_0x3b3bd6(null,_0x66e7f6);}},'charset':_0xfc19('0x10'),'collate':_0xfc19('0x11')});}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2c0591c..d48a3f5 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 _0x4c09=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x1f2736,_0x1c56f4){var _0x3cff60=function(_0x2a2d44){while(--_0x2a2d44){_0x1f2736['push'](_0x1f2736['shift']());}};_0x3cff60(++_0x1c56f4);}(_0x4c09,0x1c3));var _0x94c0=function(_0x1a89e4,_0x252986){_0x1a89e4=_0x1a89e4-0x0;var _0x25befe=_0x4c09[_0x1a89e4];return _0x25befe;};'use strict';var _=require(_0x94c0('0x0'));var util=require(_0x94c0('0x1'));var moment=require('moment');var BPromise=require(_0x94c0('0x2'));var rs=require(_0x94c0('0x3'));var fs=require('fs');var Redis=require(_0x94c0('0x4'));var db=require(_0x94c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x94c0('0x6'));var client=jayson[_0x94c0('0x7')][_0x94c0('0x8')]({'port':0x232a});config[_0x94c0('0x9')]=_['defaults'](config[_0x94c0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x94c0('0xa'))(new Redis(config[_0x94c0('0x9')]));require(_0x94c0('0xb'))['register'](socket);function respondWithRpcPromise(_0x4cc101,_0x43df73,_0x107a8d){return new BPromise(function(_0x3e59b8,_0x548c2a){return client[_0x94c0('0xc')](_0x4cc101,_0x107a8d)[_0x94c0('0xd')](function(_0x5be46a){logger[_0x94c0('0xe')](_0x94c0('0xf'),_0x43df73,_0x94c0('0x10'));logger[_0x94c0('0x11')](_0x94c0('0x12'),_0x43df73,_0x94c0('0x10'),JSON[_0x94c0('0x13')](_0x5be46a));if(_0x5be46a['error']){if(_0x5be46a[_0x94c0('0x14')][_0x94c0('0x15')]===0x1f4){logger[_0x94c0('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x43df73,_0x5be46a[_0x94c0('0x14')][_0x94c0('0x16')]);return _0x548c2a(_0x5be46a['error'][_0x94c0('0x16')]);}logger[_0x94c0('0x14')](_0x94c0('0xf'),_0x43df73,_0x5be46a[_0x94c0('0x14')][_0x94c0('0x16')]);return _0x3e59b8(_0x5be46a[_0x94c0('0x14')][_0x94c0('0x16')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x43df73,_0x94c0('0x10'));_0x3e59b8(_0x5be46a[_0x94c0('0x17')]['message']);}})[_0x94c0('0x18')](function(_0x583c85){logger[_0x94c0('0x14')](_0x94c0('0xf'),_0x43df73,_0x583c85);_0x548c2a(_0x583c85);});});}exports[_0x94c0('0x19')]=function(_0x5c63e2){var _0xffbcf2=this;return new Promise(function(_0x956cb6,_0x47fdc9){return db[_0x94c0('0x1a')][_0x94c0('0x1b')](_0x5c63e2[_0x94c0('0x1c')],{'raw':_0x5c63e2[_0x94c0('0x1d')]?_0x5c63e2[_0x94c0('0x1d')][_0x94c0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c63e2[_0x94c0('0x1d')]?_0x5c63e2[_0x94c0('0x1d')]['where']||null:null,'attributes':_0x5c63e2['options']?_0x5c63e2[_0x94c0('0x1d')][_0x94c0('0x1f')]||null:null,'limit':_0x5c63e2['options']?_0x5c63e2['options'][_0x94c0('0x20')]||null:null})[_0x94c0('0xd')](function(_0x4c0131){logger[_0x94c0('0xe')](_0x94c0('0x19'),_0x5c63e2);logger[_0x94c0('0x11')](_0x94c0('0x19'),_0x5c63e2,JSON[_0x94c0('0x13')](_0x4c0131));_0x956cb6(_0x4c0131);})[_0x94c0('0x18')](function(_0x1930ad){logger[_0x94c0('0x14')](_0x94c0('0x19'),_0x1930ad['message'],_0x5c63e2);_0x47fdc9(_0xffbcf2[_0x94c0('0x14')](0x1f4,_0x1930ad[_0x94c0('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0xac12b1){return new Promise(function(_0x34a9ac,_0x3bebd3){return db['ChatInteraction'][_0x94c0('0x21')]({'where':_0xac12b1[_0x94c0('0x1d')]?_0xac12b1[_0x94c0('0x1d')]['where']||null:null})['then'](function(_0x43bf6e){if(_0x43bf6e){return _0x43bf6e[_0x94c0('0x22')](_0xac12b1[_0x94c0('0x1c')][_0x94c0('0x23')],_[_0x94c0('0x24')](_0xac12b1[_0x94c0('0x1c')],[_0x94c0('0x23'),'id'])||{});}})[_0x94c0('0x25')](function(_0x125d31){logger[_0x94c0('0xe')](_0x94c0('0x26'),_0xac12b1);logger[_0x94c0('0x11')](_0x94c0('0x26'),_0xac12b1,JSON[_0x94c0('0x13')](_0x125d31));_0x34a9ac(_0x125d31);})['catch'](function(_0x4675b2){logger[_0x94c0('0x14')](_0x94c0('0x26'),_0x4675b2['message'],_0xac12b1);_0x3bebd3(_this[_0x94c0('0x14')](0x1f4,_0x4675b2[_0x94c0('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3c0d1cc..1794a58 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 _0x0b78=['removeListener','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b78,0x1ad));var _0x80b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0b78[_0x42cae2];return _0x5f256f;};'use strict';var ChatInteractionEvents=require(_0x80b7('0x0'));var events=[_0x80b7('0x1'),'remove',_0x80b7('0x2')];function createListener(_0x4f55ab,_0x4bffac){return function(_0x261012){_0x4bffac['emit'](_0x4f55ab,_0x261012);};}function removeListener(_0x6a187e,_0x89d4d7){return function(){ChatInteractionEvents[_0x80b7('0x3')](_0x6a187e,_0x89d4d7);};}exports['register']=function(_0x49bc7f){for(var _0x167ddd=0x0,_0x584401=events[_0x80b7('0x4')];_0x167ddd<_0x584401;_0x167ddd++){var _0x122ebe=events[_0x167ddd];var _0x3c248d=createListener(_0x80b7('0x5')+_0x122ebe,_0x49bc7f);ChatInteractionEvents['on'](_0x122ebe,_0x3c248d);}}; \ No newline at end of file +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 diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index ec16e2a..e6c08b9 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 _0x2dfc=['/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/my_messages','/:id/download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','customUpdate','/:id/abandon'];(function(_0x2ccfdc,_0x231df6){var _0x31431d=function(_0x33bb9f){while(--_0x33bb9f){_0x2ccfdc['push'](_0x2ccfdc['shift']());}};_0x31431d(++_0x231df6);}(_0x2dfc,0x1f1));var _0xc2df=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dfc[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xc2df('0x0'));var path=require('path');var timeout=require(_0xc2df('0x1'));var express=require(_0xc2df('0x2'));var router=express[_0xc2df('0x3')]();var fs_extra=require(_0xc2df('0x4'));var auth=require(_0xc2df('0x5'));var interaction=require(_0xc2df('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xc2df('0x7')]('/',auth[_0xc2df('0x8')](),controller[_0xc2df('0x9')]);router['get'](_0xc2df('0xa'),auth['isAuthenticated'](),controller[_0xc2df('0xb')]);router['get'](_0xc2df('0xc'),auth[_0xc2df('0xd')](),controller['show']);router[_0xc2df('0x7')](_0xc2df('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xc2df('0xf')]);router[_0xc2df('0x7')]('/:id/messages',auth[_0xc2df('0x8')](),controller['getMessages']);router['get'](_0xc2df('0x10'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xc2df('0x7')](_0xc2df('0x11'),auth[_0xc2df('0x8')](),controller['download']);router[_0xc2df('0x12')]('/',auth[_0xc2df('0x8')](),controller[_0xc2df('0x13')]);router[_0xc2df('0x12')](_0xc2df('0x14'),auth[_0xc2df('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xc2df('0x15')]({'destination':function(_0x20cab9,_0xf27225,_0x57759b){_0x57759b(null,path['join'](config[_0xc2df('0x16')],_0xc2df('0x17')));},'filename':function(_0x178d56,_0x57d68a,_0x441fd9){_0x441fd9(null,util[_0xc2df('0x18')]('%s-%s',Date[_0xc2df('0x19')](),_0x57d68a[_0xc2df('0x1a')][_0xc2df('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc2df('0x12')](_0xc2df('0x1c'),upload['single'](_0xc2df('0x1d')),controller[_0xc2df('0x1e')]);router[_0xc2df('0x12')](_0xc2df('0x1f'),auth[_0xc2df('0xd')](),controller[_0xc2df('0x20')]);router['post'](_0xc2df('0x21'),auth[_0xc2df('0x8')](),interaction[_0xc2df('0x22')](_0xc2df('0x23'),_0xc2df('0x24')),controller[_0xc2df('0x25')]);router[_0xc2df('0x26')](_0xc2df('0xc'),auth[_0xc2df('0x8')](),interaction[_0xc2df('0x22')]('chat','chatinteraction:update'),controller[_0xc2df('0x27')]);router[_0xc2df('0x26')]('/:id/custom_update',controller[_0xc2df('0x28')]);router[_0xc2df('0x26')](_0xc2df('0x29'),auth[_0xc2df('0xd')](),controller['abandon']);router[_0xc2df('0x26')](_0xc2df('0x2a'),controller[_0xc2df('0x2b')]);router[_0xc2df('0x2c')]('/:id',auth[_0xc2df('0x8')](),interaction['tracked'](_0xc2df('0x23'),_0xc2df('0x2d')),controller[_0xc2df('0x2e')]);router[_0xc2df('0x2c')]('/:id/tags',auth[_0xc2df('0x8')](),controller[_0xc2df('0x2f')]);module[_0xc2df('0x30')]=router; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index eb04ba5..ba801bd 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 _0xe042=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xe042,0x1c9));var _0x2e04=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0xe042[_0x3825a8];return _0xabc9bc;};'use strict';var Sequelize=require(_0x2e04('0x0'));module[_0x2e04('0x1')]={'body':{'type':Sequelize[_0x2e04('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2e04('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x2e04('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1ac569c..078d2f3 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 _0xdbda=['read','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','rawAttributes','find','create','body','describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','fullname','lastLoginAt','allowmessenger','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','isEmpty','push','FromId','ToId'];(function(_0x3bf9b6,_0x55bb64){var _0x368975=function(_0x184214){while(--_0x184214){_0x3bf9b6['push'](_0x3bf9b6['shift']());}};_0x368975(++_0x55bb64);}(_0xdbda,0x6f));var _0xadbd=function(_0xf18c1d,_0xfe1d3e){_0xf18c1d=_0xf18c1d-0x0;var _0x59a26d=_0xdbda[_0xf18c1d];return _0x59a26d;};'use strict';var emlformat=require(_0xadbd('0x0'));var rimraf=require(_0xadbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xadbd('0x2'));var rp=require(_0xadbd('0x3'));var moment=require(_0xadbd('0x4'));var BPromise=require(_0xadbd('0x5'));var Mustache=require(_0xadbd('0x6'));var util=require(_0xadbd('0x7'));var path=require(_0xadbd('0x8'));var sox=require(_0xadbd('0x9'));var csv=require('to-csv');var ejs=require(_0xadbd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadbd('0xb'));var squel=require(_0xadbd('0xc'));var crypto=require(_0xadbd('0xd'));var jsforce=require(_0xadbd('0xe'));var deskjs=require(_0xadbd('0xf'));var toCsv=require(_0xadbd('0x10'));var querystring=require('querystring');var Papa=require(_0xadbd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xadbd('0x12'));var as=require(_0xadbd('0x13'));var hardwareService=require(_0xadbd('0x14'));var logger=require('../../config/logger')(_0xadbd('0x15'));var utils=require(_0xadbd('0x16'));var config=require(_0xadbd('0x17'));var licenseUtil=require(_0xadbd('0x18'));var db=require(_0xadbd('0x19'))['db'];config['redis']=_['defaults'](config[_0xadbd('0x1a')],{'host':_0xadbd('0x1b'),'port':0x18eb});var socket=require(_0xadbd('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xadbd('0x1d')](socket);function respondWithStatusCode(_0x31fcfd,_0x1ccb5d){_0x1ccb5d=_0x1ccb5d||0xcc;return function(_0x31edae){if(_0x31edae){return _0x31fcfd[_0xadbd('0x1e')](_0x1ccb5d);}return _0x31fcfd[_0xadbd('0x1f')](_0x1ccb5d)[_0xadbd('0x20')]();};}function respondWithResult(_0x3a8ea1,_0x49c997){_0x49c997=_0x49c997||0xc8;return function(_0x2c5141){if(_0x2c5141){return _0x3a8ea1['status'](_0x49c997)[_0xadbd('0x21')](_0x2c5141);}};}function respondWithFilteredResult(_0x2c444b,_0x46992e){return function(_0x201806){if(_0x201806){var _0x2400fc=typeof _0x46992e[_0xadbd('0x22')]===_0xadbd('0x23')&&typeof _0x46992e[_0xadbd('0x24')]===_0xadbd('0x23');var _0x17c966=_0x201806[_0xadbd('0x25')];var _0x41c450=_0x2400fc?0x0:_0x46992e[_0xadbd('0x22')];var _0x74376b=_0x2400fc?_0x201806[_0xadbd('0x25')]:_0x46992e[_0xadbd('0x22')]+_0x46992e['limit'];var _0x241a46;if(_0x74376b>=_0x17c966){_0x74376b=_0x17c966;_0x241a46=0xc8;}else{_0x241a46=0xce;}_0x2c444b['status'](_0x241a46);return _0x2c444b[_0xadbd('0x26')](_0xadbd('0x27'),_0x41c450+'-'+_0x74376b+'/'+_0x17c966)[_0xadbd('0x21')](_0x201806);}return null;};}function patchUpdates(_0x4952aa){return function(_0xc80b29){try{jsonpatch[_0xadbd('0x28')](_0xc80b29,_0x4952aa,!![]);}catch(_0x19423a){return BPromise['reject'](_0x19423a);}return _0xc80b29[_0xadbd('0x29')]();};}function saveUpdates(_0x3204f6,_0x421d57){return function(_0x430d04){if(_0x430d04){return _0x430d04[_0xadbd('0x2a')](_0x3204f6)['then'](function(_0x17ca40){return _0x17ca40;});}return null;};}function removeEntity(_0x4d86b4,_0x40540a){return function(_0xc1923b){if(_0xc1923b){return _0xc1923b[_0xadbd('0x2b')]()['then'](function(){_0x4d86b4[_0xadbd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1371a9,_0x6bc763){return function(_0x5bcc89){if(!_0x5bcc89){_0x1371a9[_0xadbd('0x1e')](0x194);}return _0x5bcc89;};}function handleError(_0x1fce11,_0x330980){_0x330980=_0x330980||0x1f4;return function(_0x1fb773){logger[_0xadbd('0x2c')](_0x1fb773[_0xadbd('0x2d')]);if(_0x1fb773[_0xadbd('0x2e')]){delete _0x1fb773['name'];}_0x1fce11[_0xadbd('0x1f')](_0x330980)[_0xadbd('0x2f')](_0x1fb773);};}exports['index']=function(_0x439be6,_0x59527f){var _0x41c9c={},_0x28ea17={},_0x3f1941={'count':0x0,'rows':[]};var _0x51b7cf=_[_0xadbd('0x30')](db[_0xadbd('0x31')]['rawAttributes'],function(_0x7f273e){return{'name':_0x7f273e[_0xadbd('0x32')],'type':_0x7f273e[_0xadbd('0x33')][_0xadbd('0x34')]};});_0x28ea17[_0xadbd('0x35')]=_[_0xadbd('0x30')](_0x51b7cf,_0xadbd('0x2e'));_0x28ea17[_0xadbd('0x36')]=_[_0xadbd('0x37')](_0x439be6[_0xadbd('0x36')]);_0x28ea17[_0xadbd('0x38')]=_[_0xadbd('0x39')](_0x28ea17[_0xadbd('0x35')],_0x28ea17[_0xadbd('0x36')]);_0x41c9c[_0xadbd('0x3a')]=_[_0xadbd('0x39')](_0x28ea17[_0xadbd('0x35')],qs['fields'](_0x439be6[_0xadbd('0x36')][_0xadbd('0x3b')]));_0x41c9c[_0xadbd('0x3a')]=_0x41c9c['attributes'][_0xadbd('0x3c')]?_0x41c9c[_0xadbd('0x3a')]:_0x28ea17['model'];if(!_0x439be6[_0xadbd('0x36')][_0xadbd('0x3d')](_0xadbd('0x3e'))){_0x41c9c['limit']=qs[_0xadbd('0x24')](_0x439be6[_0xadbd('0x36')][_0xadbd('0x24')]);_0x41c9c[_0xadbd('0x22')]=qs[_0xadbd('0x22')](_0x439be6[_0xadbd('0x36')][_0xadbd('0x22')]);}_0x41c9c['order']=qs[_0xadbd('0x3f')](_0x439be6[_0xadbd('0x36')][_0xadbd('0x3f')]);_0x41c9c[_0xadbd('0x40')]=qs[_0xadbd('0x38')](_[_0xadbd('0x41')](_0x439be6['query'],_0x28ea17[_0xadbd('0x38')]),_0x51b7cf);if(_0x439be6[_0xadbd('0x36')][_0xadbd('0x42')]){_0x41c9c[_0xadbd('0x40')]=_[_0xadbd('0x43')](_0x41c9c[_0xadbd('0x40')],{'$or':_['map'](_0x51b7cf,function(_0x3048ce){if(_0x3048ce[_0xadbd('0x33')]!==_0xadbd('0x44')){var _0x51143c={};_0x51143c[_0x3048ce[_0xadbd('0x2e')]]={'$like':'%'+_0x439be6[_0xadbd('0x36')]['filter']+'%'};return _0x51143c;}})});}_0x41c9c=_[_0xadbd('0x43')]({},_0x41c9c,_0x439be6[_0xadbd('0x45')]);var _0x55e864={'where':_0x41c9c[_0xadbd('0x40')]};return db[_0xadbd('0x31')]['count'](_0x55e864)['then'](function(_0x5e5ded){_0x3f1941[_0xadbd('0x25')]=_0x5e5ded;if(_0x439be6['query'][_0xadbd('0x46')]){_0x41c9c[_0xadbd('0x47')]=[{'all':!![]}];}return db[_0xadbd('0x31')][_0xadbd('0x48')](_0x41c9c);})[_0xadbd('0x49')](function(_0x5959ae){_0x3f1941[_0xadbd('0x4a')]=_0x5959ae;return _0x3f1941;})[_0xadbd('0x49')](respondWithFilteredResult(_0x59527f,_0x41c9c))[_0xadbd('0x4b')](handleError(_0x59527f,null));};exports[_0xadbd('0x4c')]=function(_0x14f51f,_0xcda19){var _0x3f545a={'raw':!![],'where':{'id':_0x14f51f[_0xadbd('0x4d')]['id']}},_0x4221fd={};_0x4221fd[_0xadbd('0x35')]=_['keys'](db[_0xadbd('0x31')][_0xadbd('0x4e')]);_0x4221fd[_0xadbd('0x36')]=_[_0xadbd('0x37')](_0x14f51f['query']);_0x4221fd[_0xadbd('0x38')]=_[_0xadbd('0x39')](_0x4221fd[_0xadbd('0x35')],_0x4221fd['query']);_0x3f545a['attributes']=_[_0xadbd('0x39')](_0x4221fd[_0xadbd('0x35')],qs[_0xadbd('0x3b')](_0x14f51f[_0xadbd('0x36')]['fields']));_0x3f545a[_0xadbd('0x3a')]=_0x3f545a[_0xadbd('0x3a')][_0xadbd('0x3c')]?_0x3f545a[_0xadbd('0x3a')]:_0x4221fd[_0xadbd('0x35')];if(_0x14f51f[_0xadbd('0x36')][_0xadbd('0x46')]){_0x3f545a[_0xadbd('0x47')]=[{'all':!![]}];}_0x3f545a=_[_0xadbd('0x43')]({},_0x3f545a,_0x14f51f[_0xadbd('0x45')]);return db[_0xadbd('0x31')][_0xadbd('0x4f')](_0x3f545a)[_0xadbd('0x49')](handleEntityNotFound(_0xcda19,null))[_0xadbd('0x49')](respondWithResult(_0xcda19,null))['catch'](handleError(_0xcda19,null));};exports[_0xadbd('0x50')]=function(_0x1920f4,_0x48110d){return db[_0xadbd('0x31')][_0xadbd('0x50')](_0x1920f4[_0xadbd('0x51')],{})[_0xadbd('0x49')](respondWithResult(_0x48110d,0xc9))['catch'](handleError(_0x48110d,null));};exports['update']=function(_0x5a0c72,_0x2723e4){if(_0x5a0c72[_0xadbd('0x51')]['id']){delete _0x5a0c72[_0xadbd('0x51')]['id'];}return db[_0xadbd('0x31')][_0xadbd('0x4f')]({'where':{'id':_0x5a0c72[_0xadbd('0x4d')]['id']}})[_0xadbd('0x49')](handleEntityNotFound(_0x2723e4,null))['then'](saveUpdates(_0x5a0c72[_0xadbd('0x51')],null))[_0xadbd('0x49')](respondWithResult(_0x2723e4,null))[_0xadbd('0x4b')](handleError(_0x2723e4,null));};exports[_0xadbd('0x2b')]=function(_0x23b373,_0x10eb3b){return db[_0xadbd('0x31')][_0xadbd('0x4f')]({'where':{'id':_0x23b373[_0xadbd('0x4d')]['id']}})[_0xadbd('0x49')](handleEntityNotFound(_0x10eb3b,null))[_0xadbd('0x49')](removeEntity(_0x10eb3b,null))[_0xadbd('0x4b')](handleError(_0x10eb3b,null));};exports[_0xadbd('0x52')]=function(_0x2a07f9,_0x418070){return db[_0xadbd('0x31')][_0xadbd('0x52')]()[_0xadbd('0x49')](respondWithResult(_0x418070,null))[_0xadbd('0x4b')](handleError(_0x418070,null));};function wrapUser(_0x64f78d){return function(_0x2d26d8){var _0x2e5675=_0x64f78d['get']({'plain':!![]});_0x2e5675[_0xadbd('0x53')]=[];if(_0x2d26d8){_0x2e5675[_0xadbd('0x54')]=_0x2d26d8[_0xadbd('0x55')];_0x2e5675['lastMessage']=_0x2d26d8;}else{_0x2e5675[_0xadbd('0x54')]=moment(0x0)[_0xadbd('0x56')](_0xadbd('0x57'));_0x2e5675[_0xadbd('0x58')]={};}return _0x2e5675;};}exports['getUsers']=function(_0x4ba401,_0x38e60b,_0x52d67f){var _0x9be85b=[];return db[_0xadbd('0x59')]['findAll']({'where':{'role':[_0xadbd('0x5a'),_0xadbd('0x5b'),_0xadbd('0x5c')]},'attributes':['id',_0xadbd('0x5d'),_0xadbd('0x2e'),'role','userpic','internal','online',_0xadbd('0x5e'),_0xadbd('0x5f'),'showWebBar'],'order':qs[_0xadbd('0x3f')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xadbd('0x60'),'attributes':['id',_0xadbd('0x2e'),_0xadbd('0x33')],'through':{'attributes':[]}}]})['then'](function(_0xd3ea27){if(_0xd3ea27){var _0x57ec71=_0x4ba401[_0xadbd('0x5c')][_0xadbd('0x61')]({'plain':!![]});if(!_0x57ec71)throw new Error(_0xadbd('0x62'));if(_0x57ec71[_0xadbd('0x63')]===_0xadbd('0x5c')){return db[_0xadbd('0x64')][_0xadbd('0x4f')]({'where':{'name':_0xadbd('0x65'),'userProfileId':_0x57ec71[_0xadbd('0x66')]},'raw':!![]})[_0xadbd('0x49')](function(_0x998264){if(_0x998264){if(_0x998264['autoAssociation']===0x0){return db['UserProfileResource'][_0xadbd('0x48')]({'where':{'sectionId':_0x998264['id']},'raw':!![]})[_0xadbd('0x49')](function(_0x236a70){var _0x1f85be=[];if(_[_0xadbd('0x67')](_0x236a70)){_0x1f85be=_['filter'](_0xd3ea27,function(_0x3f21c3){if(_0x3f21c3['role']!==_0xadbd('0x5a')){return _0x3f21c3;}});return _0x1f85be;}else{for(var _0x535ec1=0x0;_0x535ec1<_0xd3ea27[_0xadbd('0x3c')];_0x535ec1++){var _0x491f51=_0xd3ea27[_0x535ec1];if(_0x491f51[_0xadbd('0x63')]===_0xadbd('0x5a')){var _0x4510b4=_[_0xadbd('0x4f')](_0x236a70,function(_0x245f53){return _0x245f53['resourceId']===_0x491f51['id'];});if(_0x4510b4)_0x1f85be[_0xadbd('0x68')](_0x491f51);}else{_0x1f85be[_0xadbd('0x68')](_0x491f51);}}return _0x1f85be;}});}else{return _0xd3ea27;}}else{var _0x1d71a3=_[_0xadbd('0x42')](_0xd3ea27,function(_0x440911){if(_0x440911[_0xadbd('0x63')]!==_0xadbd('0x5a')){return _0x440911;}});return _0x1d71a3;}});}else{return _0xd3ea27;}}})[_0xadbd('0x49')](function(_0x28a4af){var _0x2a0027=[];if(_0x28a4af){_0x9be85b=_0x28a4af;for(var _0x3be7fb=0x0;_0x3be7fb<_0x28a4af[_0xadbd('0x3c')];_0x3be7fb+=0x1){_0x9be85b[_0x3be7fb][_0xadbd('0x53')]=[];_0x2a0027[_0xadbd('0x68')](db['ChatInternalMessage'][_0xadbd('0x4f')]({'where':{'FromId':[_0x4ba401[_0xadbd('0x5c')]['id'],_0x28a4af[_0x3be7fb]['id']],'ToId':[_0x4ba401[_0xadbd('0x5c')]['id'],_0x28a4af[_0x3be7fb]['id']],'ChatGroupId':null},'attributes':['id',_0xadbd('0x55'),_0xadbd('0x69'),_0xadbd('0x6a'),_0xadbd('0x6b'),_0xadbd('0x51')],'order':qs[_0xadbd('0x3f')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xadbd('0x49')](wrapUser(_0x28a4af[_0x3be7fb])));}return BPromise[_0xadbd('0x6c')](_0x2a0027);}return[];})[_0xadbd('0x49')](function(_0x50741d){return{'rows':_0x50741d,'count':_0x50741d['length']};})['then'](respondWithResult(_0x38e60b,null))['catch'](handleError(_0x38e60b,null));}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 7319874..c068524 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 _0xb6ff=['ChatInternalMessage','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb6ff,0x106));var _0xfb6f=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0xb6ff[_0x351b46];return _0x1515df;};'use strict';var EventEmitter=require(_0xfb6f('0x0'));var ChatInternalMessage=require(_0xfb6f('0x1'))['db'][_0xfb6f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfb6f('0x3')](0x0);var events={'afterCreate':_0xfb6f('0x4'),'afterUpdate':'update','afterDestroy':_0xfb6f('0x5')};function emitEvent(_0x4b6b3b){return function(_0x25323a,_0xc47cad,_0x5c1656){ChatInternalMessageEvents[_0xfb6f('0x6')](_0x4b6b3b+':'+_0x25323a['id'],_0x25323a);ChatInternalMessageEvents[_0xfb6f('0x6')](_0x4b6b3b,_0x25323a);_0x5c1656(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xfb6f('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3871c7b..cc9aefc 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 _0x0c30=['./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xdb9629,_0x429b7a){var _0x25cf3d=function(_0x1a33f4){while(--_0x1a33f4){_0xdb9629['push'](_0xdb9629['shift']());}};_0x25cf3d(++_0x429b7a);}(_0x0c30,0x102));var _0x00c3=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x0c30[_0x574617];return _0x29de90;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x00c3('0x0'));var moment=require(_0x00c3('0x1'));var BPromise=require(_0x00c3('0x2'));var rp=require(_0x00c3('0x3'));var fs=require('fs');var path=require(_0x00c3('0x4'));var rimraf=require('rimraf');var config=require(_0x00c3('0x5'));var attributes=require(_0x00c3('0x6'));module['exports']=function(_0x49975d,_0x2b82f6){return _0x49975d[_0x00c3('0x7')](_0x00c3('0x8'),attributes,{'tableName':_0x00c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x00c3('0xa'),'collate':_0x00c3('0xb')});}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e6a8831..b599a95 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 _0x4a5e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x56f5cd,_0x4350fd){var _0x4aa5bc=function(_0x4a89f1){while(--_0x4a89f1){_0x56f5cd['push'](_0x56f5cd['shift']());}};_0x4aa5bc(++_0x4350fd);}(_0x4a5e,0x158));var _0xe4a5=function(_0x5c16ad,_0x24312a){_0x5c16ad=_0x5c16ad-0x0;var _0xf9d36e=_0x4a5e[_0x5c16ad];return _0xf9d36e;};'use strict';var _=require(_0xe4a5('0x0'));var util=require(_0xe4a5('0x1'));var moment=require(_0xe4a5('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4a5('0x3'));var fs=require('fs');var Redis=require(_0xe4a5('0x4'));var db=require(_0xe4a5('0x5'))['db'];var utils=require(_0xe4a5('0x6'));var logger=require(_0xe4a5('0x7'))(_0xe4a5('0x8'));var config=require(_0xe4a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe4a5('0xa')][_0xe4a5('0xb')]({'port':0x232a});config[_0xe4a5('0xc')]=_[_0xe4a5('0xd')](config[_0xe4a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe4a5('0xe'))(new Redis(config[_0xe4a5('0xc')]));require('./chatInternalMessage.socket')[_0xe4a5('0xf')](socket);function respondWithRpcPromise(_0x25773d,_0x5dca12,_0xf5c87e){return new BPromise(function(_0x1a279c,_0x211f8d){return client[_0xe4a5('0x10')](_0x25773d,_0xf5c87e)[_0xe4a5('0x11')](function(_0x23250a){logger['info'](_0xe4a5('0x12'),_0x5dca12,_0xe4a5('0x13'));logger[_0xe4a5('0x14')](_0xe4a5('0x15'),_0x5dca12,'request\x20sent',JSON[_0xe4a5('0x16')](_0x23250a));if(_0x23250a[_0xe4a5('0x17')]){if(_0x23250a[_0xe4a5('0x17')][_0xe4a5('0x18')]===0x1f4){logger[_0xe4a5('0x17')](_0xe4a5('0x12'),_0x5dca12,_0x23250a[_0xe4a5('0x17')][_0xe4a5('0x19')]);return _0x211f8d(_0x23250a['error'][_0xe4a5('0x19')]);}logger[_0xe4a5('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5dca12,_0x23250a['error'][_0xe4a5('0x19')]);return _0x1a279c(_0x23250a[_0xe4a5('0x17')][_0xe4a5('0x19')]);}else{logger[_0xe4a5('0x1a')](_0xe4a5('0x12'),_0x5dca12,'request\x20sent');_0x1a279c(_0x23250a[_0xe4a5('0x1b')][_0xe4a5('0x19')]);}})[_0xe4a5('0x1c')](function(_0x2f2b5a){logger[_0xe4a5('0x17')](_0xe4a5('0x12'),_0x5dca12,_0x2f2b5a);_0x211f8d(_0x2f2b5a);});});} \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index d7dfbae..52a896c 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 _0x55e4=['chatInternalMessage:','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55e4,0x101));var _0x455e=function(_0x45225b,_0x30bdbd){_0x45225b=_0x45225b-0x0;var _0x41f26a=_0x55e4[_0x45225b];return _0x41f26a;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x455e('0x0'),_0x455e('0x1'),_0x455e('0x2')];function createListener(_0x5cc6b7,_0x21f2d3){return function(_0x1b5bff){_0x21f2d3[_0x455e('0x3')](_0x5cc6b7,_0x1b5bff);};}function removeListener(_0x5ba60b,_0x502c1d){return function(){ChatInternalMessageEvents[_0x455e('0x4')](_0x5ba60b,_0x502c1d);};}exports[_0x455e('0x5')]=function(_0x320457){for(var _0x3671c1=0x0,_0x87b2cb=events[_0x455e('0x6')];_0x3671c1<_0x87b2cb;_0x3671c1++){var _0xbd7ecc=events[_0x3671c1];var _0x5ee369=createListener(_0x455e('0x7')+_0xbd7ecc,_0x320457);ChatInternalMessageEvents['on'](_0xbd7ecc,_0x5ee369);}}; \ No newline at end of file +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 diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8fa3cbe..d535a72 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 _0x64d8=['create','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','/describe','describe','/users','isAuthenticated','getUsers','/:id','show','post'];(function(_0x57dd51,_0x2cfc29){var _0x149ae3=function(_0x5f5101){while(--_0x5f5101){_0x57dd51['push'](_0x57dd51['shift']());}};_0x149ae3(++_0x2cfc29);}(_0x64d8,0xf4));var _0x864d=function(_0xc973f8,_0x1759ec){_0xc973f8=_0xc973f8-0x0;var _0x5cd9d5=_0x64d8[_0xc973f8];return _0x5cd9d5;};'use strict';var multer=require(_0x864d('0x0'));var util=require(_0x864d('0x1'));var path=require(_0x864d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x864d('0x3'));var interaction=require(_0x864d('0x4'));var config=require(_0x864d('0x5'));var controller=require(_0x864d('0x6'));router[_0x864d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x864d('0x7')](_0x864d('0x8'),auth['isAuthenticated'](),controller[_0x864d('0x9')]);router['get'](_0x864d('0xa'),auth[_0x864d('0xb')](),controller[_0x864d('0xc')]);router[_0x864d('0x7')](_0x864d('0xd'),auth[_0x864d('0xb')](),controller[_0x864d('0xe')]);router[_0x864d('0xf')]('/',auth[_0x864d('0xb')](),controller[_0x864d('0x10')]);router['put']('/:id',controller[_0x864d('0x11')]);router['delete']('/:id',auth[_0x864d('0xb')](),controller[_0x864d('0x12')]);module[_0x864d('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b3eb7a7..7d3fff2 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 _0x6cb4=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x6cb4,0xff));var _0x46cb=function(_0x4fc9d1,_0x24172f){_0x4fc9d1=_0x4fc9d1-0x0;var _0x5e1872=_0x6cb4[_0x4fc9d1];return _0x5e1872;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'body':{'type':Sequelize[_0x46cb('0x2')](_0x46cb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x46cb('0x5')]('in',_0x46cb('0x6')),'defaultValue':_0x46cb('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x46cb('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 92ec673..74f45b6 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 _0x01a3=['rimraf','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','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','localhost','./chatMessage.socket','register','http','client','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','intersection','length','find','create','body','params','describe','chat-interactions','chat','read','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','merge','parse','RejectMessage','ContactId','contact','fullname','event','formData'];(function(_0x280640,_0x70386a){var _0x2bf568=function(_0x2d63d6){while(--_0x2d63d6){_0x280640['push'](_0x280640['shift']());}};_0x2bf568(++_0x70386a);}(_0x01a3,0x106));var _0x301a=function(_0x5a8400,_0x218b4c){_0x5a8400=_0x5a8400-0x0;var _0x28b15d=_0x01a3[_0x5a8400];return _0x28b15d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x301a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x301a('0x1'));var rp=require('request-promise');var moment=require(_0x301a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x301a('0x3'));var path=require(_0x301a('0x4'));var sox=require('sox');var csv=require(_0x301a('0x5'));var ejs=require(_0x301a('0x6'));var fs=require('fs');var fs_extra=require(_0x301a('0x7'));var _=require(_0x301a('0x8'));var squel=require('squel');var crypto=require(_0x301a('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x301a('0x5'));var querystring=require(_0x301a('0xa'));var Papa=require(_0x301a('0xb'));var Redis=require(_0x301a('0xc'));var authService=require(_0x301a('0xd'));var qs=require(_0x301a('0xe'));var as=require(_0x301a('0xf'));var hardwareService=require(_0x301a('0x10'));var logger=require(_0x301a('0x11'))('api');var utils=require(_0x301a('0x12'));var config=require(_0x301a('0x13'));var licenseUtil=require(_0x301a('0x14'));var db=require(_0x301a('0x15'))['db'];config[_0x301a('0x16')]=_['defaults'](config[_0x301a('0x16')],{'host':_0x301a('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x301a('0x16')]));require(_0x301a('0x18'))[_0x301a('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x301a('0x1a')]({'port':0x232c});var client9002=jayson[_0x301a('0x1b')][_0x301a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x25b584,_0x213f31,_0x2552a4,_0x4e826f){return new BPromise(function(_0x5a3701,_0x2e48ea){var _0x4f14ff=_0x4e826f||client;return _0x4f14ff['request'](_0x25b584,_0x2552a4)[_0x301a('0x1c')](function(_0x47ef11){logger[_0x301a('0x1d')](_0x301a('0x1e'),_0x213f31,_0x301a('0x1f'));logger[_0x301a('0x20')](_0x301a('0x21'),_0x213f31,'request\x20sent',JSON['stringify'](_0x47ef11));if(_0x47ef11[_0x301a('0x22')]){if(_0x47ef11[_0x301a('0x22')][_0x301a('0x23')]===0x1f4){logger[_0x301a('0x22')]('ChatMessage,\x20%s,\x20%s',_0x213f31,_0x47ef11[_0x301a('0x22')][_0x301a('0x24')]);return _0x2e48ea(_0x47ef11['error'][_0x301a('0x24')]);}logger[_0x301a('0x22')](_0x301a('0x1e'),_0x213f31,_0x47ef11[_0x301a('0x22')][_0x301a('0x24')]);return _0x5a3701(_0x47ef11['error']['message']);}else{logger[_0x301a('0x1d')](_0x301a('0x1e'),_0x213f31,_0x301a('0x1f'));_0x5a3701(_0x47ef11[_0x301a('0x25')][_0x301a('0x24')]);}})[_0x301a('0x26')](function(_0x1bcdd9){logger['error']('ChatMessage,\x20%s,\x20%s',_0x213f31,_0x1bcdd9);_0x2e48ea(_0x1bcdd9);});});}function respondWithStatusCode(_0x56d844,_0x36e202){_0x36e202=_0x36e202||0xcc;return function(_0x409f02){if(_0x409f02){return _0x56d844[_0x301a('0x27')](_0x36e202);}return _0x56d844[_0x301a('0x28')](_0x36e202)[_0x301a('0x29')]();};}function respondWithResult(_0x5e99e9,_0x67672e){_0x67672e=_0x67672e||0xc8;return function(_0x48a6d1){if(_0x48a6d1){return _0x5e99e9[_0x301a('0x28')](_0x67672e)[_0x301a('0x2a')](_0x48a6d1);}};}function respondWithFilteredResult(_0x2c346d,_0x4dbbe1){return function(_0x2ebb62){if(_0x2ebb62){var _0x40e1e6=typeof _0x4dbbe1['offset']===_0x301a('0x2b')&&typeof _0x4dbbe1[_0x301a('0x2c')]===_0x301a('0x2b');var _0x584cdf=_0x2ebb62[_0x301a('0x2d')];var _0x4553c4=_0x40e1e6?0x0:_0x4dbbe1['offset'];var _0x2acd71=_0x40e1e6?_0x2ebb62[_0x301a('0x2d')]:_0x4dbbe1[_0x301a('0x2e')]+_0x4dbbe1[_0x301a('0x2c')];var _0xaf9523;if(_0x2acd71>=_0x584cdf){_0x2acd71=_0x584cdf;_0xaf9523=0xc8;}else{_0xaf9523=0xce;}_0x2c346d[_0x301a('0x28')](_0xaf9523);return _0x2c346d[_0x301a('0x2f')](_0x301a('0x30'),_0x4553c4+'-'+_0x2acd71+'/'+_0x584cdf)[_0x301a('0x2a')](_0x2ebb62);}return null;};}function patchUpdates(_0x1e2524){return function(_0x4439af){try{jsonpatch[_0x301a('0x31')](_0x4439af,_0x1e2524,!![]);}catch(_0x2a6424){return BPromise[_0x301a('0x32')](_0x2a6424);}return _0x4439af[_0x301a('0x33')]();};}function saveUpdates(_0x5060c4,_0x3fb931){return function(_0xea66d6){if(_0xea66d6){return _0xea66d6[_0x301a('0x34')](_0x5060c4)[_0x301a('0x1c')](function(_0x254c2e){return _0x254c2e;});}return null;};}function removeEntity(_0x109062,_0x214533){return function(_0x14aa56){if(_0x14aa56){return _0x14aa56[_0x301a('0x35')]()[_0x301a('0x1c')](function(){_0x109062[_0x301a('0x28')](0xcc)[_0x301a('0x29')]();});}};}function handleEntityNotFound(_0x2075b1,_0x19d882){return function(_0x250219){if(!_0x250219){_0x2075b1[_0x301a('0x27')](0x194);}return _0x250219;};}function handleError(_0x5e6c11,_0x211004){_0x211004=_0x211004||0x1f4;return function(_0x3a751a){logger[_0x301a('0x22')](_0x3a751a[_0x301a('0x36')]);if(_0x3a751a[_0x301a('0x37')]){delete _0x3a751a[_0x301a('0x37')];}_0x5e6c11[_0x301a('0x28')](_0x211004)[_0x301a('0x38')](_0x3a751a);};}exports[_0x301a('0x39')]=function(_0xffd99d,_0x3d99a9){var _0x339b9d={},_0x4eded8={},_0xbb8769={'count':0x0,'rows':[]};var _0x49d486=_[_0x301a('0x3a')](db[_0x301a('0x3b')][_0x301a('0x3c')],function(_0x33cd07){return{'name':_0x33cd07[_0x301a('0x3d')],'type':_0x33cd07[_0x301a('0x3e')][_0x301a('0x3f')]};});_0x4eded8[_0x301a('0x40')]=_[_0x301a('0x3a')](_0x49d486,_0x301a('0x37'));_0x4eded8['query']=_[_0x301a('0x41')](_0xffd99d[_0x301a('0x42')]);_0x4eded8[_0x301a('0x43')]=_['intersection'](_0x4eded8[_0x301a('0x40')],_0x4eded8['query']);_0x339b9d[_0x301a('0x44')]=_['intersection'](_0x4eded8[_0x301a('0x40')],qs[_0x301a('0x45')](_0xffd99d['query']['fields']));_0x339b9d[_0x301a('0x44')]=_0x339b9d[_0x301a('0x44')]['length']?_0x339b9d[_0x301a('0x44')]:_0x4eded8[_0x301a('0x40')];if(!_0xffd99d[_0x301a('0x42')][_0x301a('0x46')](_0x301a('0x47'))){_0x339b9d[_0x301a('0x2c')]=qs[_0x301a('0x2c')](_0xffd99d['query'][_0x301a('0x2c')]);_0x339b9d[_0x301a('0x2e')]=qs[_0x301a('0x2e')](_0xffd99d['query'][_0x301a('0x2e')]);}_0x339b9d[_0x301a('0x48')]=qs[_0x301a('0x49')](_0xffd99d[_0x301a('0x42')][_0x301a('0x49')]);_0x339b9d['where']=qs[_0x301a('0x43')](_[_0x301a('0x4a')](_0xffd99d['query'],_0x4eded8['filters']),_0x49d486);if(_0xffd99d[_0x301a('0x42')][_0x301a('0x4b')]){_0x339b9d[_0x301a('0x4c')]=_['merge'](_0x339b9d[_0x301a('0x4c')],{'$or':_[_0x301a('0x3a')](_0x49d486,function(_0x2b03f3){if(_0x2b03f3['type']!=='VIRTUAL'){var _0xe88bbd={};_0xe88bbd[_0x2b03f3['name']]={'$like':'%'+_0xffd99d[_0x301a('0x42')][_0x301a('0x4b')]+'%'};return _0xe88bbd;}})});}_0x339b9d=_['merge']({},_0x339b9d,_0xffd99d[_0x301a('0x4d')]);var _0x12ffa7={'where':_0x339b9d[_0x301a('0x4c')]};return db['ChatMessage'][_0x301a('0x2d')](_0x12ffa7)['then'](function(_0x162edb){_0xbb8769[_0x301a('0x2d')]=_0x162edb;if(_0xffd99d[_0x301a('0x42')][_0x301a('0x4e')]){_0x339b9d[_0x301a('0x4f')]=[{'all':!![]}];}return db['ChatMessage'][_0x301a('0x50')](_0x339b9d);})[_0x301a('0x1c')](function(_0x5d74f2){_0xbb8769[_0x301a('0x51')]=_0x5d74f2;return _0xbb8769;})['then'](respondWithFilteredResult(_0x3d99a9,_0x339b9d))[_0x301a('0x26')](handleError(_0x3d99a9,null));};exports['show']=function(_0x48c4e0,_0x41486b){var _0x229f9e={'raw':!![],'where':{'id':_0x48c4e0['params']['id']}},_0x2a5fe6={};_0x2a5fe6[_0x301a('0x40')]=_[_0x301a('0x41')](db['ChatMessage'][_0x301a('0x3c')]);_0x2a5fe6[_0x301a('0x42')]=_[_0x301a('0x41')](_0x48c4e0[_0x301a('0x42')]);_0x2a5fe6['filters']=_[_0x301a('0x52')](_0x2a5fe6[_0x301a('0x40')],_0x2a5fe6[_0x301a('0x42')]);_0x229f9e[_0x301a('0x44')]=_[_0x301a('0x52')](_0x2a5fe6[_0x301a('0x40')],qs[_0x301a('0x45')](_0x48c4e0[_0x301a('0x42')][_0x301a('0x45')]));_0x229f9e[_0x301a('0x44')]=_0x229f9e[_0x301a('0x44')][_0x301a('0x53')]?_0x229f9e[_0x301a('0x44')]:_0x2a5fe6[_0x301a('0x40')];if(_0x48c4e0['query']['includeAll']){_0x229f9e['include']=[{'all':!![]}];}_0x229f9e=_['merge']({},_0x229f9e,_0x48c4e0[_0x301a('0x4d')]);return db[_0x301a('0x3b')][_0x301a('0x54')](_0x229f9e)[_0x301a('0x1c')](handleEntityNotFound(_0x41486b,null))[_0x301a('0x1c')](respondWithResult(_0x41486b,null))[_0x301a('0x26')](handleError(_0x41486b,null));};exports[_0x301a('0x55')]=function(_0x3a641f,_0x582fd9){return db[_0x301a('0x3b')]['create'](_0x3a641f[_0x301a('0x56')],{})[_0x301a('0x1c')](respondWithResult(_0x582fd9,0xc9))[_0x301a('0x26')](handleError(_0x582fd9,null));};exports[_0x301a('0x34')]=function(_0x35ad9b,_0x48c001){if(_0x35ad9b['body']['id']){delete _0x35ad9b[_0x301a('0x56')]['id'];}return db[_0x301a('0x3b')][_0x301a('0x54')]({'where':{'id':_0x35ad9b['params']['id']}})[_0x301a('0x1c')](handleEntityNotFound(_0x48c001,null))[_0x301a('0x1c')](saveUpdates(_0x35ad9b[_0x301a('0x56')],null))[_0x301a('0x1c')](respondWithResult(_0x48c001,null))[_0x301a('0x26')](handleError(_0x48c001,null));};exports[_0x301a('0x35')]=function(_0x5027b0,_0x52df10){return db[_0x301a('0x3b')][_0x301a('0x54')]({'where':{'id':_0x5027b0[_0x301a('0x57')]['id']}})[_0x301a('0x1c')](handleEntityNotFound(_0x52df10,null))[_0x301a('0x1c')](removeEntity(_0x52df10,null))[_0x301a('0x26')](handleError(_0x52df10,null));};exports[_0x301a('0x58')]=function(_0x5e51af,_0x53b681){return db[_0x301a('0x3b')][_0x301a('0x58')]()[_0x301a('0x1c')](respondWithResult(_0x53b681,null))['catch'](handleError(_0x53b681,null));};var interaction_log=require(_0x301a('0x11'))(_0x301a('0x59'));exports['accept']=function(_0x39ce46,_0x5525fa,_0x31a322){var _0xf323ca={'agent':{},'channel':_0x301a('0x5a')};if(_0x39ce46[_0x301a('0x56')]['id']){delete _0x39ce46['body']['id'];}_0x39ce46[_0x301a('0x56')][_0x301a('0x5b')]=!![];_0x39ce46[_0x301a('0x56')]['readAt']=moment()[_0x301a('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x39ce46[_0x301a('0x56')][_0x301a('0x5d')]=_0x39ce46['body'][_0x301a('0x5d')]||_0x39ce46[_0x301a('0x5e')]['id'];_0xf323ca[_0x301a('0x5f')]['id']=_0x39ce46[_0x301a('0x56')][_0x301a('0x5d')];return db[_0x301a('0x3b')][_0x301a('0x54')]({'where':{'id':_0x39ce46[_0x301a('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5525fa,null))[_0x301a('0x1c')](saveUpdates(_0x39ce46['body'],null))['then'](function(_0x4476e9){if(_0x4476e9){_0xf323ca[_0x301a('0x24')]=_0x4476e9[_0x301a('0x60')]({'plain':!![]});return db[_0x301a('0x61')][_0x301a('0x54')]({'where':{'id':_0x4476e9[_0x301a('0x62')]}});}return null;})[_0x301a('0x1c')](handleEntityNotFound(_0x5525fa,null))['then'](function(_0x53385d){if(_0x53385d){return _0x53385d[_0x301a('0x34')]({'UserId':_0x39ce46[_0x301a('0x56')][_0x301a('0x5d')],'read1stAt':_[_0x301a('0x63')](_0x53385d[_0x301a('0x64')])?moment()[_0x301a('0x5c')](_0x301a('0x65')):undefined});}return null;})[_0x301a('0x1c')](function(_0x1ba557){if(_0x1ba557){_0xf323ca[_0x301a('0x66')]=_0x1ba557[_0x301a('0x60')]({'plain':!![]});interaction_log[_0x301a('0x1d')](_0x301a('0x67'),_0x39ce46[_0x301a('0x5e')]['id'],_0x39ce46[_0x301a('0x5e')][_0x301a('0x37')],_0x39ce46['user'][_0x301a('0x68')],_0xf323ca[_0x301a('0x66')]['id'],_0x39ce46[_0x301a('0x56')]?JSON['stringify'](_0x39ce46[_0x301a('0x56')]):_0x301a('0x69'));return respondWithRpcPromise(_0x301a('0x6a'),_0x301a('0x6b'),_0xf323ca);}return null;})[_0x301a('0x1c')](function(_0x2f8d6c){var _0x2a56f9=_0x301a('0x6c')+_0x2f8d6c[_0x301a('0x24')]['ContactId'];return db[_0x301a('0x6d')][_0x301a('0x42')](_0x2a56f9,{'type':db[_0x301a('0x6e')][_0x301a('0x6f')][_0x301a('0x70')],'raw':!![]})[_0x301a('0x1c')](function(_0x461176){return _0x461176;});})[_0x301a('0x1c')](function(_0x11a63a){if(_0x11a63a){_0xf323ca['message']['contact']=_0x11a63a[0x0];if(!_0x39ce46[_0x301a('0x56')][_0x301a('0x5d')])return;return db[_0x301a('0x71')][_0x301a('0x54')]({'where':{'id':_0x39ce46['body'][_0x301a('0x5d')],'role':'agent'},'attributes':['id',_0x301a('0x37'),'fullname',_0x301a('0x72'),_0x301a('0x73')],'raw':!![]});}return null;})[_0x301a('0x1c')](function(_0x4ca537){if(!_0x4ca537)return null;_0xf323ca[_0x301a('0x24')]['agent']=_0x4ca537;return _0xf323ca;})[_0x301a('0x1c')](function(_0xc7aad7){if(_0xc7aad7){if(_0x39ce46['body'][_0x301a('0x74')]){_0xf323ca['message'][_0x301a('0x75')]=util['format'](_0x301a('0x76'),_0x39ce46['user'][_0x301a('0x37')]);_0xf323ca[_0x301a('0x24')][_0x301a('0x77')]=_0xf323ca[_0x301a('0x77')];_0xf323ca[_0x301a('0x24')][_0x301a('0x78')]=_0xf323ca['channel'];_0xf323ca['message']['event']='accept';return respondWithRpcPromise(_0x301a('0x79'),'EventManager',{'event':_0x301a('0x7a'),'message':_[_0x301a('0x7b')](_0xf323ca['message'],JSON[_0x301a('0x7c')](_0xf323ca[_0x301a('0x66')]['formData']))},client9002)[_0x301a('0x1c')](function(){return _0xf323ca;});}return _0xf323ca;}return null;})['then'](respondWithResult(_0x5525fa,null))['catch'](handleError(_0x5525fa,null));};var interaction_log=require(_0x301a('0x11'))(_0x301a('0x59'));exports[_0x301a('0x32')]=function(_0xa51536,_0x5dd5d1,_0x41b030){var _0x3fc91e={'agent':{},'channel':_0x301a('0x5a')};if(_0xa51536[_0x301a('0x56')]['id']){delete _0xa51536[_0x301a('0x56')]['id'];}_0xa51536[_0x301a('0x56')][_0x301a('0x5d')]=_0xa51536[_0x301a('0x56')][_0x301a('0x5d')]||_0xa51536[_0x301a('0x5e')]['id'];_0x3fc91e[_0x301a('0x5f')]['id']=_0xa51536[_0x301a('0x56')][_0x301a('0x5d')];return db[_0x301a('0x3b')][_0x301a('0x54')]({'where':{'id':_0xa51536['params']['id'],'UserId':null}})[_0x301a('0x1c')](handleEntityNotFound(_0x5dd5d1,null))[_0x301a('0x1c')](function(_0x536ef7){if(_0x536ef7){_0x3fc91e[_0x301a('0x24')]=_0x536ef7[_0x301a('0x60')]({'plain':!![]});return db[_0x301a('0x61')]['find']({'where':{'id':_0x536ef7['ChatInteractionId']}});}return null;})[_0x301a('0x1c')](handleEntityNotFound(_0x5dd5d1,null))['then'](function(_0x296ab6){if(_0x296ab6){_0x3fc91e['interaction']=_0x296ab6[_0x301a('0x60')]({'plain':!![]});interaction_log[_0x301a('0x1d')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa51536[_0x301a('0x5e')]['id'],_0xa51536[_0x301a('0x5e')][_0x301a('0x37')],_0xa51536[_0x301a('0x5e')][_0x301a('0x68')],_0x3fc91e[_0x301a('0x66')]['id'],_0xa51536[_0x301a('0x56')]?JSON['stringify'](_0xa51536[_0x301a('0x56')]):_0x301a('0x69'));return respondWithRpcPromise(_0x301a('0x7d'),'rejectMessage',_0x3fc91e);}return null;})[_0x301a('0x1c')](function(_0x13b850){var _0x23f13a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x13b850[_0x301a('0x24')][_0x301a('0x7e')];return db[_0x301a('0x6d')][_0x301a('0x42')](_0x23f13a,{'type':db[_0x301a('0x6e')]['QueryTypes'][_0x301a('0x70')],'raw':!![]})[_0x301a('0x1c')](function(_0x58944e){return _0x58944e;});})['then'](function(_0x36d56c){if(_0x36d56c){_0x3fc91e[_0x301a('0x24')][_0x301a('0x7f')]=_0x36d56c[0x0];if(!_0xa51536['body'][_0x301a('0x5d')])return;return db[_0x301a('0x71')][_0x301a('0x54')]({'where':{'id':_0xa51536[_0x301a('0x56')]['UserId'],'role':_0x301a('0x5f')},'attributes':['id','name',_0x301a('0x80'),_0x301a('0x72'),_0x301a('0x73')],'raw':!![]});}return null;})['then'](function(_0x15d6a1){if(!_0x15d6a1)return null;_0x3fc91e['message'][_0x301a('0x5f')]=_0x15d6a1;return _0x3fc91e;})[_0x301a('0x1c')](function(_0x540a69){if(_0x540a69){_0x540a69[_0x301a('0x24')][_0x301a('0x75')]=util['format'](_0x301a('0x76'),_0xa51536[_0x301a('0x5e')][_0x301a('0x37')]);_0x540a69[_0x301a('0x24')]['channel']=_0x3fc91e[_0x301a('0x77')];_0x540a69[_0x301a('0x24')][_0x301a('0x78')]=_0x3fc91e['channel'];_0x540a69[_0x301a('0x24')][_0x301a('0x81')]=_0x301a('0x32');respondWithRpcPromise(_0x301a('0x79'),_0x301a('0x79'),{'event':'rejectmessage','message':_[_0x301a('0x7b')](_0x3fc91e[_0x301a('0x24')],JSON['parse'](_0x3fc91e[_0x301a('0x66')][_0x301a('0x82')]))},client9002);return _0x3fc91e;}return null;})[_0x301a('0x1c')](respondWithResult(_0x5dd5d1,null))[_0x301a('0x26')](handleError(_0x5dd5d1,null));}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index ec16272..55c4a6f 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 _0x92c5=['ChatMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x92c5,0x1be));var _0x592c=function(_0x7f38f1,_0x5f10e4){_0x7f38f1=_0x7f38f1-0x0;var _0xf7aec5=_0x92c5[_0x7f38f1];return _0xf7aec5;};'use strict';var EventEmitter=require(_0x592c('0x0'));var ChatMessage=require(_0x592c('0x1'))['db'][_0x592c('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x592c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x592c('0x4'),'afterDestroy':_0x592c('0x5')};function emitEvent(_0x2040ef){return function(_0x2c3b38,_0x4b0206,_0x2193f5){ChatMessageEvents[_0x592c('0x6')](_0x2040ef+':'+_0x2c3b38['id'],_0x2c3b38);ChatMessageEvents['emit'](_0x2040ef,_0x2c3b38);_0x2193f5(null);};}for(var e in events){if(events[_0x592c('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 58b8f01..8890043 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 _0x2b0a=['./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54ece5,_0x5345c9){var _0x2fa883=function(_0x1bc2a3){while(--_0x1bc2a3){_0x54ece5['push'](_0x54ece5['shift']());}};_0x2fa883(++_0x5345c9);}(_0x2b0a,0x73));var _0xa2b0=function(_0x518559,_0x3cd56b){_0x518559=_0x518559-0x0;var _0x308d6e=_0x2b0a[_0x518559];return _0x308d6e;};'use strict';var _=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var logger=require(_0xa2b0('0x2'))('api');var moment=require(_0xa2b0('0x3'));var BPromise=require(_0xa2b0('0x4'));var rp=require(_0xa2b0('0x5'));var fs=require('fs');var path=require(_0xa2b0('0x6'));var rimraf=require(_0xa2b0('0x7'));var config=require(_0xa2b0('0x8'));var attributes=require(_0xa2b0('0x9'));module[_0xa2b0('0xa')]=function(_0x293b0e,_0x485b7d){return _0x293b0e[_0xa2b0('0xb')](_0xa2b0('0xc'),attributes,{'tableName':_0xa2b0('0xd'),'paranoid':![],'indexes':[{'name':_0xa2b0('0xe'),'fields':[_0xa2b0('0xf')],'type':_0xa2b0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37de22,_0xbaeeaf,_0x5036bc){var _0xe2187c=_0x293b0e[_0xa2b0('0x11')];var _0x359108=_0x37de22[_0xa2b0('0x12')]({'plain':!![]});if(_0x359108[_0xa2b0('0x13')][_0xa2b0('0x14')]()==='in'||_0x359108['direction'][_0xa2b0('0x14')]()===_0xa2b0('0x15')&&!_0x359108[_0xa2b0('0x16')]&&!_['isNil'](_0x359108[_0xa2b0('0x17')])){_0xe2187c['ChatInteraction']['findOne']({'where':{'id':_0x359108[_0xa2b0('0x18')]}})[_0xa2b0('0x19')](function(_0x39d87b){if(_0x39d87b){_0x39d87b[_0xa2b0('0x1a')]({'lastMsgAt':_0x359108[_0xa2b0('0x1b')],'lastMsgDirection':_0x359108[_0xa2b0('0x13')][_0xa2b0('0x14')]()});}})['catch'](function(_0x5f03ba){console[_0xa2b0('0x1c')](_0x5f03ba);});}_0x5036bc();}},'charset':_0xa2b0('0x1d'),'collate':_0xa2b0('0x1e')});}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4762fcc..b5b3de8 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 _0xee12=['catch','CreateChatMessage','body','options','raw','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x51710d,_0x7f115f){var _0x4529c2=function(_0x238a4f){while(--_0x238a4f){_0x51710d['push'](_0x51710d['shift']());}};_0x4529c2(++_0x7f115f);}(_0xee12,0x86));var _0x2ee1=function(_0x333232,_0x4584cc){_0x333232=_0x333232-0x0;var _0x2852f5=_0xee12[_0x333232];return _0x2852f5;};'use strict';var _=require(_0x2ee1('0x0'));var util=require('util');var moment=require(_0x2ee1('0x1'));var BPromise=require(_0x2ee1('0x2'));var rs=require(_0x2ee1('0x3'));var fs=require('fs');var Redis=require(_0x2ee1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ee1('0x5'));var logger=require(_0x2ee1('0x6'))(_0x2ee1('0x7'));var config=require(_0x2ee1('0x8'));var jayson=require(_0x2ee1('0x9'));var client=jayson[_0x2ee1('0xa')][_0x2ee1('0xb')]({'port':0x232a});config['redis']=_[_0x2ee1('0xc')](config['redis'],{'host':_0x2ee1('0xd'),'port':0x18eb});var socket=require(_0x2ee1('0xe'))(new Redis(config[_0x2ee1('0xf')]));require('./chatMessage.socket')[_0x2ee1('0x10')](socket);function respondWithRpcPromise(_0x54f80e,_0x3d17f5,_0x16a9cc){return new BPromise(function(_0x428943,_0x22c7f9){return client[_0x2ee1('0x11')](_0x54f80e,_0x16a9cc)[_0x2ee1('0x12')](function(_0x50248e){logger[_0x2ee1('0x13')](_0x2ee1('0x14'),_0x3d17f5,_0x2ee1('0x15'));logger['debug'](_0x2ee1('0x16'),_0x3d17f5,_0x2ee1('0x15'),JSON['stringify'](_0x50248e));if(_0x50248e[_0x2ee1('0x17')]){if(_0x50248e[_0x2ee1('0x17')]['code']===0x1f4){logger['error'](_0x2ee1('0x14'),_0x3d17f5,_0x50248e[_0x2ee1('0x17')]['message']);return _0x22c7f9(_0x50248e[_0x2ee1('0x17')][_0x2ee1('0x18')]);}logger[_0x2ee1('0x17')](_0x2ee1('0x14'),_0x3d17f5,_0x50248e[_0x2ee1('0x17')][_0x2ee1('0x18')]);return _0x428943(_0x50248e['error'][_0x2ee1('0x18')]);}else{logger[_0x2ee1('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3d17f5,'request\x20sent');_0x428943(_0x50248e[_0x2ee1('0x19')][_0x2ee1('0x18')]);}})[_0x2ee1('0x1a')](function(_0x108b91){logger['error'](_0x2ee1('0x14'),_0x3d17f5,_0x108b91);_0x22c7f9(_0x108b91);});});}exports[_0x2ee1('0x1b')]=function(_0x311ccc){var _0x5dba89=this;return new Promise(function(_0x5a7089,_0x4cc1d8){return db['ChatMessage']['create'](_0x311ccc[_0x2ee1('0x1c')],{'raw':_0x311ccc[_0x2ee1('0x1d')]?_0x311ccc[_0x2ee1('0x1d')][_0x2ee1('0x1e')]===undefined?!![]:![]:!![]})[_0x2ee1('0x12')](function(_0x4dd05f){logger['info'](_0x2ee1('0x1b'),_0x311ccc);logger['debug'](_0x2ee1('0x1b'),_0x311ccc,JSON[_0x2ee1('0x1f')](_0x4dd05f));_0x5a7089(_0x4dd05f);})[_0x2ee1('0x1a')](function(_0x314bf2){logger[_0x2ee1('0x17')](_0x2ee1('0x1b'),_0x314bf2[_0x2ee1('0x18')],_0x311ccc);_0x4cc1d8(_0x5dba89[_0x2ee1('0x17')](0x1f4,_0x314bf2[_0x2ee1('0x18')]));});});}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index fc35ca9..1823d3c 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 _0xd8a7=['removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x38166b,_0x15a44e){_0x38166b=_0x38166b-0x0;var _0x377b31=_0xd8a7[_0x38166b];return _0x377b31;};'use strict';var ChatMessageEvents=require(_0x7d8a('0x0'));var events=['save','remove','update'];function createListener(_0xd1df7e,_0x32df06){return function(_0x465d0f){_0x32df06['emit'](_0xd1df7e,_0x465d0f);};}function removeListener(_0xc1a093,_0x5e2db5){return function(){ChatMessageEvents[_0x7d8a('0x1')](_0xc1a093,_0x5e2db5);};}exports['register']=function(_0x27ef8e){for(var _0x530308=0x0,_0x1cf673=events[_0x7d8a('0x2')];_0x530308<_0x1cf673;_0x530308++){var _0x240123=events[_0x530308];var _0x58ead1=createListener(_0x7d8a('0x3')+_0x240123,_0x27ef8e);ChatMessageEvents['on'](_0x240123,_0x58ead1);}}; \ No newline at end of file +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 diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c3c171a..41e3578 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 _0xb68d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','index','get','/describe','describe','/:id','show','post','isAuthenticated','tracked','chatmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xb68d,0x6c));var _0xdb68=function(_0x22d6cf,_0x222a69){_0x22d6cf=_0x22d6cf-0x0;var _0x3158e2=_0xb68d[_0x22d6cf];return _0x3158e2;};'use strict';var multer=require(_0xdb68('0x0'));var util=require(_0xdb68('0x1'));var path=require('path');var timeout=require(_0xdb68('0x2'));var express=require(_0xdb68('0x3'));var router=express[_0xdb68('0x4')]();var fs_extra=require(_0xdb68('0x5'));var auth=require(_0xdb68('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdb68('0x7')]);router[_0xdb68('0x8')](_0xdb68('0x9'),auth['isAuthenticated'](),controller[_0xdb68('0xa')]);router[_0xdb68('0x8')](_0xdb68('0xb'),auth['isAuthenticated'](),controller[_0xdb68('0xc')]);router[_0xdb68('0xd')]('/',auth[_0xdb68('0xe')](),interaction[_0xdb68('0xf')]('chat',_0xdb68('0x10')),controller[_0xdb68('0x11')]);router['put'](_0xdb68('0xb'),controller[_0xdb68('0x12')]);router[_0xdb68('0x13')](_0xdb68('0x14'),auth[_0xdb68('0xe')](),controller[_0xdb68('0x15')]);router[_0xdb68('0x13')](_0xdb68('0x16'),auth[_0xdb68('0xe')](),controller[_0xdb68('0x17')]);router[_0xdb68('0x18')](_0xdb68('0xb'),auth[_0xdb68('0xe')](),controller[_0xdb68('0x19')]);module[_0xdb68('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 500a689..1bab6a1 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x4d087e,_0x1fcf94){var _0x49b232=function(_0x5cbdd5){while(--_0x5cbdd5){_0x4d087e['push'](_0x4d087e['shift']());}};_0x49b232(++_0x1fcf94);}(_0xdb28,0x106));var _0x8db2=function(_0x59ed92,_0x17598d){_0x59ed92=_0x59ed92-0x0;var _0x3be490=_0xdb28[_0x59ed92];return _0x3be490;};'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 +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index f4f786c..534e929 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7a54,0x106));var _0x47a5=function(_0x5d2b88,_0x2a3d79){_0x5d2b88=_0x5d2b88-0x0;var _0x2fe76a=_0x7a54[_0x5d2b88];return _0x2fe76a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 57f6ec8..5d25811 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 _0xb815=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3f35d0,_0x453ed5){var _0x4a4f8e=function(_0x5051cf){while(--_0x5051cf){_0x3f35d0['push'](_0x3f35d0['shift']());}};_0x4a4f8e(++_0x453ed5);}(_0xb815,0x160));var _0x5b81=function(_0x34827d,_0x216e99){_0x34827d=_0x34827d-0x0;var _0x7a060a=_0xb815[_0x34827d];return _0x7a060a;};'use strict';var EventEmitter=require(_0x5b81('0x0'));var ChatOfflineMessage=require(_0x5b81('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b81('0x2'),'afterUpdate':'update','afterDestroy':_0x5b81('0x3')};function emitEvent(_0x6f2865){return function(_0x24aaec,_0x114114,_0x57df86){ChatOfflineMessageEvents[_0x5b81('0x4')](_0x6f2865+':'+_0x24aaec['id'],_0x24aaec);ChatOfflineMessageEvents[_0x5b81('0x4')](_0x6f2865,_0x24aaec);_0x57df86(null);};}for(var e in events){if(events[_0x5b81('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x5b81('0x6')](e,emitEvent(event));}}module[_0x5b81('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fff3971..add68d7 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 _0xf478=['define','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x429d4f,_0x3ab829){var _0x2c6fb0=function(_0x12c5cd){while(--_0x12c5cd){_0x429d4f['push'](_0x429d4f['shift']());}};_0x2c6fb0(++_0x3ab829);}(_0xf478,0x1f2));var _0x8f47=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xf478[_0x1cfa0d];return _0xe33279;};'use strict';var attributes=require(_0x8f47('0x0'));module[_0x8f47('0x1')]=function(_0x4e34e2){return _0x4e34e2[_0x8f47('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x8f47('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8f47('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 88755c8..6e739ce 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 _0x8e09=['result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x8e09,0x1e6));var _0x98e0=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x8e09[_0x754ab4];return _0x34079a;};'use strict';var _=require(_0x98e0('0x0'));var util=require(_0x98e0('0x1'));var moment=require('moment');var BPromise=require(_0x98e0('0x2'));var rs=require(_0x98e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98e0('0x4'));var logger=require(_0x98e0('0x5'))(_0x98e0('0x6'));var config=require(_0x98e0('0x7'));var jayson=require(_0x98e0('0x8'));var client=jayson[_0x98e0('0x9')][_0x98e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f6ae4,_0x1399e5,_0x12672a){return new BPromise(function(_0x1d7457,_0x8a2084){return client[_0x98e0('0xb')](_0x2f6ae4,_0x12672a)[_0x98e0('0xc')](function(_0x585521){logger[_0x98e0('0xd')](_0x98e0('0xe'),_0x1399e5,'request\x20sent');logger[_0x98e0('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1399e5,'request\x20sent',JSON[_0x98e0('0x10')](_0x585521));if(_0x585521[_0x98e0('0x11')]){if(_0x585521[_0x98e0('0x11')][_0x98e0('0x12')]===0x1f4){logger[_0x98e0('0x11')](_0x98e0('0xe'),_0x1399e5,_0x585521[_0x98e0('0x11')]['message']);return _0x8a2084(_0x585521[_0x98e0('0x11')][_0x98e0('0x13')]);}logger[_0x98e0('0x11')](_0x98e0('0xe'),_0x1399e5,_0x585521['error'][_0x98e0('0x13')]);return _0x1d7457(_0x585521[_0x98e0('0x11')][_0x98e0('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x1399e5,'request\x20sent');_0x1d7457(_0x585521[_0x98e0('0x14')][_0x98e0('0x13')]);}})[_0x98e0('0x15')](function(_0x37c364){logger['error'](_0x98e0('0xe'),_0x1399e5,_0x37c364);_0x8a2084(_0x37c364);});});} \ No newline at end of file +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 diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5c9359f..74054fd 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 _0xf562=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','post','create','put','update','delete'];(function(_0x45fea9,_0x3abe4d){var _0x3e9501=function(_0x562ae9){while(--_0x562ae9){_0x45fea9['push'](_0x45fea9['shift']());}};_0x3e9501(++_0x3abe4d);}(_0xf562,0xd9));var _0x2f56=function(_0xb3dbfd,_0x25dd16){_0xb3dbfd=_0xb3dbfd-0x0;var _0x1cd1ac=_0xf562[_0xb3dbfd];return _0x1cd1ac;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2f56('0x5'));var config=require(_0x2f56('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x2f56('0x7')](),controller[_0x2f56('0x8')]);router[_0x2f56('0x9')]('/describe',auth[_0x2f56('0x7')](),controller[_0x2f56('0xa')]);router[_0x2f56('0x9')](_0x2f56('0xb'),auth[_0x2f56('0x7')](),controller['show']);router[_0x2f56('0xc')]('/',auth['isAuthenticated'](),controller[_0x2f56('0xd')]);router[_0x2f56('0xe')](_0x2f56('0xb'),auth[_0x2f56('0x7')](),controller[_0x2f56('0xf')]);router[_0x2f56('0x10')](_0x2f56('0xb'),auth[_0x2f56('0x7')](),controller['destroy']);module[_0x2f56('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7fe2f67..2971063 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 _0xa178=['ENUM','mouseOver','timeout','STRING','INTEGER'];(function(_0x5bcb74,_0x25078c){var _0x16a8ff=function(_0x4855d8){while(--_0x4855d8){_0x5bcb74['push'](_0x5bcb74['shift']());}};_0x16a8ff(++_0x25078c);}(_0xa178,0xd7));var _0x8a17=function(_0x5ded7f,_0x15baa7){_0x5ded7f=_0x5ded7f-0x0;var _0x594060=_0xa178[_0x5ded7f];return _0x594060;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8a17('0x0')](_0x8a17('0x1'),_0x8a17('0x2')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x8a17('0x3')]},'timeout':{'type':Sequelize[_0x8a17('0x4')]}}; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 97b36ed..a76ddb0 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 _0x302c=['query','intersection','fields','attributes','length','includeAll','include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x302c,0x15c));var _0xc302=function(_0x1d1c35,_0x11a922){_0x1d1c35=_0x1d1c35-0x0;var _0x4cc280=_0x302c[_0x1d1c35];return _0x4cc280;};'use strict';var emlformat=require(_0xc302('0x0'));var rimraf=require(_0xc302('0x1'));var zipdir=require(_0xc302('0x2'));var jsonpatch=require(_0xc302('0x3'));var rp=require(_0xc302('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc302('0x5'));var util=require(_0xc302('0x6'));var path=require(_0xc302('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc302('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc302('0x9'));var squel=require(_0xc302('0xa'));var crypto=require(_0xc302('0xb'));var jsforce=require(_0xc302('0xc'));var deskjs=require(_0xc302('0xd'));var toCsv=require(_0xc302('0xe'));var querystring=require('querystring');var Papa=require(_0xc302('0xf'));var Redis=require(_0xc302('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc302('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc302('0x12'));var config=require(_0xc302('0x13'));var licenseUtil=require(_0xc302('0x14'));var db=require(_0xc302('0x15'))['db'];function respondWithStatusCode(_0x3cf0f5,_0x25f167){_0x25f167=_0x25f167||0xcc;return function(_0xd3236b){if(_0xd3236b){return _0x3cf0f5[_0xc302('0x16')](_0x25f167);}return _0x3cf0f5[_0xc302('0x17')](_0x25f167)[_0xc302('0x18')]();};}function respondWithResult(_0x5bea5f,_0x4092d6){_0x4092d6=_0x4092d6||0xc8;return function(_0x2f9a3a){if(_0x2f9a3a){return _0x5bea5f['status'](_0x4092d6)[_0xc302('0x19')](_0x2f9a3a);}};}function respondWithFilteredResult(_0x3184d3,_0x271e83){return function(_0x29ce77){if(_0x29ce77){var _0x381759=typeof _0x271e83['offset']===_0xc302('0x1a')&&typeof _0x271e83['limit']===_0xc302('0x1a');var _0x337d22=_0x29ce77['count'];var _0x17093a=_0x381759?0x0:_0x271e83[_0xc302('0x1b')];var _0x34260a=_0x381759?_0x29ce77[_0xc302('0x1c')]:_0x271e83[_0xc302('0x1b')]+_0x271e83[_0xc302('0x1d')];var _0x5eb0e4;if(_0x34260a>=_0x337d22){_0x34260a=_0x337d22;_0x5eb0e4=0xc8;}else{_0x5eb0e4=0xce;}_0x3184d3[_0xc302('0x17')](_0x5eb0e4);return _0x3184d3[_0xc302('0x1e')]('Content-Range',_0x17093a+'-'+_0x34260a+'/'+_0x337d22)[_0xc302('0x19')](_0x29ce77);}return null;};}function patchUpdates(_0x291528){return function(_0x51537c){try{jsonpatch[_0xc302('0x1f')](_0x51537c,_0x291528,!![]);}catch(_0x34c28b){return BPromise[_0xc302('0x20')](_0x34c28b);}return _0x51537c['save']();};}function saveUpdates(_0x3e19fe,_0x3f7a84){return function(_0x27ff4a){if(_0x27ff4a){return _0x27ff4a['update'](_0x3e19fe)[_0xc302('0x21')](function(_0x5c2909){return _0x5c2909;});}return null;};}function removeEntity(_0x1cbe6c,_0x54e224){return function(_0x4a6b73){if(_0x4a6b73){return _0x4a6b73['destroy']()['then'](function(){_0x1cbe6c[_0xc302('0x17')](0xcc)[_0xc302('0x18')]();});}};}function handleEntityNotFound(_0x13b524,_0x5cdcbc){return function(_0x424788){if(!_0x424788){_0x13b524['sendStatus'](0x194);}return _0x424788;};}function handleError(_0x58f09f,_0x52eee2){_0x52eee2=_0x52eee2||0x1f4;return function(_0x5d2efc){logger[_0xc302('0x22')](_0x5d2efc[_0xc302('0x23')]);if(_0x5d2efc[_0xc302('0x24')]){delete _0x5d2efc[_0xc302('0x24')];}_0x58f09f[_0xc302('0x17')](_0x52eee2)[_0xc302('0x25')](_0x5d2efc);};}exports[_0xc302('0x26')]=function(_0x4109bb,_0x121398){var _0xc05f4f={'raw':!![],'where':{'id':_0x4109bb[_0xc302('0x27')]['id']}},_0x3a0dc0={};_0x3a0dc0[_0xc302('0x28')]=_[_0xc302('0x29')](db[_0xc302('0x2a')][_0xc302('0x2b')]);_0x3a0dc0[_0xc302('0x2c')]=_[_0xc302('0x29')](_0x4109bb[_0xc302('0x2c')]);_0x3a0dc0['filters']=_[_0xc302('0x2d')](_0x3a0dc0[_0xc302('0x28')],_0x3a0dc0['query']);_0xc05f4f['attributes']=_[_0xc302('0x2d')](_0x3a0dc0['model'],qs[_0xc302('0x2e')](_0x4109bb[_0xc302('0x2c')]['fields']));_0xc05f4f[_0xc302('0x2f')]=_0xc05f4f['attributes'][_0xc302('0x30')]?_0xc05f4f['attributes']:_0x3a0dc0['model'];if(_0x4109bb[_0xc302('0x2c')][_0xc302('0x31')]){_0xc05f4f[_0xc302('0x32')]=[{'all':!![]}];}_0xc05f4f=_[_0xc302('0x33')]({},_0xc05f4f,_0x4109bb['options']);return db[_0xc302('0x2a')][_0xc302('0x34')](_0xc05f4f)[_0xc302('0x21')](handleEntityNotFound(_0x121398,null))[_0xc302('0x21')](respondWithResult(_0x121398,null))[_0xc302('0x35')](handleError(_0x121398,null));};exports[_0xc302('0x36')]=function(_0x5faceb,_0x3a4ed9){return db[_0xc302('0x2a')][_0xc302('0x36')](_0x5faceb[_0xc302('0x37')],{})[_0xc302('0x21')](respondWithResult(_0x3a4ed9,0xc9))[_0xc302('0x35')](handleError(_0x3a4ed9,null));};exports['update']=function(_0x3914d8,_0x586c85){if(_0x3914d8[_0xc302('0x37')]['id']){delete _0x3914d8[_0xc302('0x37')]['id'];}return db['ChatProactiveAction'][_0xc302('0x34')]({'where':{'id':_0x3914d8[_0xc302('0x27')]['id']}})[_0xc302('0x21')](handleEntityNotFound(_0x586c85,null))[_0xc302('0x21')](saveUpdates(_0x3914d8[_0xc302('0x37')],null))[_0xc302('0x21')](respondWithResult(_0x586c85,null))[_0xc302('0x35')](handleError(_0x586c85,null));};exports['destroy']=function(_0x345396,_0x39fd7b){return db['ChatProactiveAction'][_0xc302('0x34')]({'where':{'id':_0x345396['params']['id']}})['then'](handleEntityNotFound(_0x39fd7b,null))[_0xc302('0x21')](removeEntity(_0x39fd7b,null))['catch'](handleError(_0x39fd7b,null));}; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8cf86a0..dd9eb5f 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 _0x8a14=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x54bef0,_0x17c064){var _0x50d130=function(_0x100dfe){while(--_0x100dfe){_0x54bef0['push'](_0x54bef0['shift']());}};_0x50d130(++_0x17c064);}(_0x8a14,0x1cc));var _0x48a1=function(_0x3d9961,_0x1a9519){_0x3d9961=_0x3d9961-0x0;var _0x4f3065=_0x8a14[_0x3d9961];return _0x4f3065;};'use strict';var _=require(_0x48a1('0x0'));var util=require(_0x48a1('0x1'));var logger=require(_0x48a1('0x2'))(_0x48a1('0x3'));var moment=require(_0x48a1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48a1('0x5'));var rimraf=require(_0x48a1('0x6'));var config=require(_0x48a1('0x7'));var attributes=require(_0x48a1('0x8'));module[_0x48a1('0x9')]=function(_0x5d811a,_0x366f08){return _0x5d811a[_0x48a1('0xa')](_0x48a1('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 852e7a4..e8a88e7 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 _0xe170=['error','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x459ee0,_0x1e950d){var _0x1b87c8=function(_0x377855){while(--_0x377855){_0x459ee0['push'](_0x459ee0['shift']());}};_0x1b87c8(++_0x1e950d);}(_0xe170,0x1ea));var _0x0e17=function(_0x449a38,_0x3f8271){_0x449a38=_0x449a38-0x0;var _0x38a415=_0xe170[_0x449a38];return _0x38a415;};'use strict';var _=require(_0x0e17('0x0'));var util=require(_0x0e17('0x1'));var moment=require('moment');var BPromise=require(_0x0e17('0x2'));var rs=require(_0x0e17('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e17('0x4'))['db'];var utils=require(_0x0e17('0x5'));var logger=require(_0x0e17('0x6'))(_0x0e17('0x7'));var config=require(_0x0e17('0x8'));var jayson=require(_0x0e17('0x9'));var client=jayson['client'][_0x0e17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d650,_0x5f2d51,_0x5a53c0){return new BPromise(function(_0x939d4a,_0x53ae83){return client['request'](_0x41d650,_0x5a53c0)[_0x0e17('0xb')](function(_0x21ed96){logger['info'](_0x0e17('0xc'),_0x5f2d51,'request\x20sent');logger[_0x0e17('0xd')](_0x0e17('0xe'),_0x5f2d51,'request\x20sent',JSON[_0x0e17('0xf')](_0x21ed96));if(_0x21ed96[_0x0e17('0x10')]){if(_0x21ed96['error']['code']===0x1f4){logger[_0x0e17('0x10')](_0x0e17('0xc'),_0x5f2d51,_0x21ed96[_0x0e17('0x10')][_0x0e17('0x11')]);return _0x53ae83(_0x21ed96[_0x0e17('0x10')][_0x0e17('0x11')]);}logger[_0x0e17('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x5f2d51,_0x21ed96[_0x0e17('0x10')][_0x0e17('0x11')]);return _0x939d4a(_0x21ed96[_0x0e17('0x10')][_0x0e17('0x11')]);}else{logger[_0x0e17('0x12')](_0x0e17('0xc'),_0x5f2d51,_0x0e17('0x13'));_0x939d4a(_0x21ed96[_0x0e17('0x14')][_0x0e17('0x11')]);}})[_0x0e17('0x15')](function(_0x3edd5d){logger[_0x0e17('0x10')](_0x0e17('0xc'),_0x5f2d51,_0x3edd5d);_0x53ae83(_0x3edd5d);});});} \ No newline at end of file +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 diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 5ae757a..fdfdf00 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 _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','show','post','isAuthenticated','put','/:id','update','delete'];(function(_0x1cd037,_0x4d368f){var _0x51f3b8=function(_0x33c8b0){while(--_0x33c8b0){_0x1cd037['push'](_0x1cd037['shift']());}};_0x51f3b8(++_0x4d368f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3b7f1c,_0x2f9206){_0x3b7f1c=_0x3b7f1c-0x0;var _0x9a35c9=_0x8ef6[_0x3b7f1c];return _0x9a35c9;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x68ef('0xb')]);router[_0x68ef('0xc')]('/',auth[_0x68ef('0xd')](),controller['create']);router[_0x68ef('0xe')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file +var _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_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 diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 261ec7a..8ad4918 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 _0xdfad=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x26a906,_0x3d135c){var _0x495575=function(_0x2365af){while(--_0x2365af){_0x26a906['push'](_0x26a906['shift']());}};_0x495575(++_0x3d135c);}(_0xdfad,0x91));var _0xddfa=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xdfad[_0x2136a6];return _0x55b948;};'use strict';var Sequelize=require(_0xddfa('0x0'));module[_0xddfa('0x1')]={'name':{'type':Sequelize[_0xddfa('0x2')],'unique':_0xddfa('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xddfa('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xddfa('0x5'),_0xddfa('0x6'),_0xddfa('0x7'))}}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b1b34ce..e5389b3 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 _0x62f1=['send','index','map','ChatQueue','rawAttributes','type','key','getOptions','where','findAll','rows','catch','show','params','keys','query','filters','model','attributes','intersection','fields','length','includeAll','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','merge','filter','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userChatQueue:save','removeTeams','User','select','field','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','then','get','ChatQueues','UserProfileResource','error','stack','name'];(function(_0x3e95d5,_0x5de945){var _0x39b688=function(_0xe97bce){while(--_0xe97bce){_0x3e95d5['push'](_0x3e95d5['shift']());}};_0x39b688(++_0x5de945);}(_0x62f1,0xd6));var _0x162f=function(_0x3c8ba1,_0x1b1f51){_0x3c8ba1=_0x3c8ba1-0x0;var _0x24ff83=_0x62f1[_0x3c8ba1];return _0x24ff83;};'use strict';var BPromise=require(_0x162f('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0x162f('0x1'));var Redis=require(_0x162f('0x2'));var qs=require(_0x162f('0x3'));var logger=require(_0x162f('0x4'))(_0x162f('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x162f('0x6')],{'host':_0x162f('0x7'),'port':0x18eb});var socket=require(_0x162f('0x8'))(new Redis(config[_0x162f('0x6')]));require(_0x162f('0x9'))[_0x162f('0xa')](socket);function respondWithStatusCode(_0x35e78f,_0x2f0262){_0x2f0262=_0x2f0262||0xcc;return function(_0x2bdf41){if(_0x2bdf41){return _0x35e78f[_0x162f('0xb')](_0x2f0262);}return _0x35e78f['status'](_0x2f0262)[_0x162f('0xc')]();};}function respondWithResult(_0x5f2b93,_0x2a8109){_0x2a8109=_0x2a8109||0xc8;return function(_0x1a78c2){if(_0x1a78c2){return _0x5f2b93[_0x162f('0xd')](_0x2a8109)['json'](_0x1a78c2);}};}function respondWithFilteredResult(_0x5a316d,_0x5ae9b4){return function(_0xf4a5f9){if(_0xf4a5f9){var _0x3a9ef7=typeof _0x5ae9b4[_0x162f('0xe')]==='undefined'&&typeof _0x5ae9b4[_0x162f('0xf')]===_0x162f('0x10');var _0x205198=_0xf4a5f9['count'];var _0x3ad97c=_0x3a9ef7?0x0:_0x5ae9b4[_0x162f('0xe')];var _0x1160cd=_0x3a9ef7?_0xf4a5f9[_0x162f('0x11')]:_0x5ae9b4[_0x162f('0xe')]+_0x5ae9b4[_0x162f('0xf')];var _0x4479ad;if(_0x1160cd>=_0x205198){_0x1160cd=_0x205198;_0x4479ad=0xc8;}else{_0x4479ad=0xce;}_0x5a316d['status'](_0x4479ad);return _0x5a316d[_0x162f('0x12')](_0x162f('0x13'),_0x3ad97c+'-'+_0x1160cd+'/'+_0x205198)[_0x162f('0x14')](_0xf4a5f9);}return null;};}function saveUpdates(_0x428651){return function(_0x171575){if(_0x171575){return _0x171575[_0x162f('0x15')](_0x428651)['then'](function(_0x3e9c6a){return _0x3e9c6a;});}return null;};}function removeEntity(_0x1310c1){return function(_0x281116){if(_0x281116){return _0x281116[_0x162f('0x16')]()[_0x162f('0x17')](function(){var _0x1426ca=_0x281116[_0x162f('0x18')]({'plain':!![]});var _0x547511=_0x162f('0x19');return db[_0x162f('0x1a')]['destroy']({'where':{'type':_0x547511,'resourceId':_0x1426ca['id']}})['then'](function(){return _0x281116;});})['then'](function(){_0x1310c1[_0x162f('0xd')](0xcc)[_0x162f('0xc')]();});}};}function handleEntityNotFound(_0x37dccc){return function(_0x4c9c65){if(!_0x4c9c65){_0x37dccc[_0x162f('0xb')](0x194);}return _0x4c9c65;};}function handleError(_0x711893,_0x56f815){_0x56f815=_0x56f815||0x1f4;return function(_0xfd29b4){logger[_0x162f('0x1b')](_0xfd29b4[_0x162f('0x1c')]);if(_0xfd29b4[_0x162f('0x1d')]){delete _0xfd29b4[_0x162f('0x1d')];}_0x711893['status'](_0x56f815)[_0x162f('0x1e')](_0xfd29b4);};}exports[_0x162f('0x1f')]=function(_0xe709d7,_0x18d3f0){var _0x35195d={};var _0x2a9f35={'count':0x0,'rows':[]};var _0x565146=_[_0x162f('0x20')](db[_0x162f('0x21')][_0x162f('0x22')],function(_0x4a2ad9){return{'name':_0x4a2ad9['fieldName'],'type':_0x4a2ad9[_0x162f('0x23')][_0x162f('0x24')]};});_0x35195d=qs[_0x162f('0x25')](_0x565146,_0xe709d7);var _0x4fc8ff={'where':_0x35195d[_0x162f('0x26')]};return db[_0x162f('0x21')][_0x162f('0x11')](_0x4fc8ff)[_0x162f('0x17')](function(_0xbbda0b){_0x2a9f35['count']=_0xbbda0b;_0x35195d['include']=qs['include'](_0xe709d7['query']);return db[_0x162f('0x21')][_0x162f('0x27')](_0x35195d);})['then'](function(_0x263c3e){_0x2a9f35[_0x162f('0x28')]=_0x263c3e;return _0x2a9f35;})[_0x162f('0x17')](respondWithFilteredResult(_0x18d3f0,_0x35195d))[_0x162f('0x29')](handleError(_0x18d3f0,null));};exports[_0x162f('0x2a')]=function(_0x3fb4d1,_0x12ec93){var _0x39389f={'raw':!![],'where':{'id':_0x3fb4d1[_0x162f('0x2b')]['id']}},_0x1bee82={};_0x1bee82['model']=_['keys'](db[_0x162f('0x21')][_0x162f('0x22')]);_0x1bee82['query']=_[_0x162f('0x2c')](_0x3fb4d1[_0x162f('0x2d')]);_0x1bee82[_0x162f('0x2e')]=_['intersection'](_0x1bee82[_0x162f('0x2f')],_0x1bee82[_0x162f('0x2d')]);_0x39389f[_0x162f('0x30')]=_[_0x162f('0x31')](_0x1bee82['model'],qs[_0x162f('0x32')](_0x3fb4d1['query'][_0x162f('0x32')]));_0x39389f[_0x162f('0x30')]=_0x39389f[_0x162f('0x30')][_0x162f('0x33')]?_0x39389f[_0x162f('0x30')]:_0x1bee82['model'];if(_0x3fb4d1[_0x162f('0x2d')][_0x162f('0x34')]){_0x39389f[_0x162f('0x35')]=[{'all':!![]}];}_0x39389f=_['merge']({},_0x39389f,_0x3fb4d1[_0x162f('0x36')]);return db[_0x162f('0x21')][_0x162f('0x37')](_0x39389f)[_0x162f('0x17')](handleEntityNotFound(_0x12ec93,null))[_0x162f('0x17')](respondWithResult(_0x12ec93,null))['catch'](handleError(_0x12ec93,null));};exports[_0x162f('0x38')]=function(_0x59c82a,_0x39c44e){return db[_0x162f('0x21')]['create'](_0x59c82a['body'],{})[_0x162f('0x17')](function(_0x4c6dbe){var _0x352efd=_0x59c82a[_0x162f('0x39')]['get']({'plain':!![]});if(!_0x352efd)throw new Error(_0x162f('0x3a'));if(_0x352efd[_0x162f('0x3b')]===_0x162f('0x39')){var _0x174509=_0x4c6dbe[_0x162f('0x18')]({'plain':!![]});var _0x2cff21=_0x162f('0x19');return db[_0x162f('0x3c')]['find']({'where':{'name':_0x2cff21,'userProfileId':_0x352efd[_0x162f('0x3d')]},'raw':!![]})[_0x162f('0x17')](function(_0x1792d8){if(_0x1792d8&&_0x1792d8[_0x162f('0x3e')]===0x0){return db[_0x162f('0x1a')][_0x162f('0x38')]({'name':_0x174509['name'],'resourceId':_0x174509['id'],'type':_0x1792d8[_0x162f('0x1d')],'sectionId':_0x1792d8['id']},{})[_0x162f('0x17')](function(){return _0x4c6dbe;});}else{return _0x4c6dbe;}})[_0x162f('0x29')](function(_0x1100fd){logger['error'](_0x162f('0x3f'),_0x1100fd);throw _0x1100fd;});}return _0x4c6dbe;})['then'](respondWithResult(_0x39c44e,0xc9))[_0x162f('0x29')](handleError(_0x39c44e,null));};exports['update']=function(_0xf1f331,_0x24cb5c){if(_0xf1f331[_0x162f('0x40')]['id']){delete _0xf1f331[_0x162f('0x40')]['id'];}return db[_0x162f('0x21')][_0x162f('0x37')]({'where':{'id':_0xf1f331['params']['id']}})['then'](handleEntityNotFound(_0x24cb5c,null))[_0x162f('0x17')](saveUpdates(_0xf1f331[_0x162f('0x40')],null))['then'](respondWithResult(_0x24cb5c,null))['catch'](handleError(_0x24cb5c,null));};exports[_0x162f('0x16')]=function(_0x13c0cd,_0x343991){return db[_0x162f('0x21')][_0x162f('0x37')]({'where':{'id':_0x13c0cd[_0x162f('0x2b')]['id']}})[_0x162f('0x17')](handleEntityNotFound(_0x343991,null))['then'](removeEntity(_0x343991,null))[_0x162f('0x29')](handleError(_0x343991,null));};exports[_0x162f('0x41')]=function(_0x36b7fc,_0x15f591){return db[_0x162f('0x21')]['describe']()[_0x162f('0x17')](respondWithResult(_0x15f591,null))['catch'](handleError(_0x15f591,null));};exports['getMembers']=function(_0x7e2095,_0x34dba8){var _0x541549={'raw':!![],'where':{}},_0x54ef33={},_0x371653;return db[_0x162f('0x21')][_0x162f('0x42')]({'where':{'id':_0x7e2095[_0x162f('0x2b')]['id']}})[_0x162f('0x17')](handleEntityNotFound(_0x34dba8,null))['then'](function(_0x4f4b11){if(_0x4f4b11){_0x371653=_0x4f4b11[_0x162f('0x18')]({'plain':!![]});_0x54ef33[_0x162f('0x2f')]=_[_0x162f('0x2c')](db[_0x162f('0x43')][_0x162f('0x22')]);_0x54ef33[_0x162f('0x2d')]=_['keys'](_0x7e2095[_0x162f('0x2d')]);_0x54ef33[_0x162f('0x2e')]=_[_0x162f('0x31')](_0x54ef33[_0x162f('0x2f')],_0x54ef33[_0x162f('0x2d')]);_0x541549[_0x162f('0x30')]=_['intersection'](_0x54ef33['model'],qs[_0x162f('0x32')](_0x7e2095[_0x162f('0x2d')][_0x162f('0x32')]));_0x541549[_0x162f('0x30')]=_0x541549[_0x162f('0x30')]['length']?_0x541549[_0x162f('0x30')]:_0x54ef33[_0x162f('0x2f')];if(!_0x7e2095['query'][_0x162f('0x44')](_0x162f('0x45'))){_0x541549['limit']=qs[_0x162f('0xf')](_0x7e2095['query'][_0x162f('0xf')]);_0x541549['offset']=qs[_0x162f('0xe')](_0x7e2095[_0x162f('0x2d')][_0x162f('0xe')]);}_0x541549[_0x162f('0x46')]=qs[_0x162f('0x47')](_0x7e2095[_0x162f('0x2d')]['sort']);_0x541549[_0x162f('0x26')]=qs[_0x162f('0x2e')](_[_0x162f('0x48')](_0x7e2095['query'],_0x54ef33['filters']));_0x541549[_0x162f('0x26')][_0x162f('0x49')]=_0x4f4b11['id'];if(_0x7e2095[_0x162f('0x2d')]['filter']){_0x541549[_0x162f('0x26')]=_[_0x162f('0x4a')](_0x541549[_0x162f('0x26')],{'$or':_[_0x162f('0x20')](_0x541549[_0x162f('0x30')],function(_0x4dd0bc){var _0x3dd1d0={};_0x3dd1d0[_0x4dd0bc]={'$like':'%'+_0x7e2095[_0x162f('0x2d')][_0x162f('0x4b')]+'%'};return _0x3dd1d0;})});}_0x541549=_[_0x162f('0x4a')]({},_0x541549,_0x7e2095['options']);return db[_0x162f('0x43')]['findAll'](_0x541549);}})[_0x162f('0x17')](function(_0x586317){if(_0x586317){return db['User'][_0x162f('0x4c')]({'where':{'id':_[_0x162f('0x20')](_0x586317,_0x162f('0x4d')),'role':_0x162f('0x4e')},'attributes':['id',_0x162f('0x1d'),_0x162f('0x4f'),_0x162f('0x50'),_0x162f('0x51')]});}})[_0x162f('0x17')](function(_0x104060){if(_0x104060){return{'count':_0x104060['count'],'rows':_['map'](_0x104060[_0x162f('0x28')],function(_0x24770f){return{'membername':_0x24770f[_0x162f('0x1d')],'UserId':_0x24770f['id'],'queue_name':_0x371653[_0x162f('0x1d')],'ChatQueueId':_0x371653['id'],'interface':util['format'](_0x162f('0x52'),_0x162f('0x53'),_0x24770f['name']),'penalty':0x0,'paused':_0x24770f[_0x162f('0x4f')],'createdAt':_0x24770f[_0x162f('0x51')],'updatedAt':_0x24770f[_0x162f('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x162f('0x17')](respondWithFilteredResult(_0x34dba8,_0x541549))[_0x162f('0x29')](handleError(_0x34dba8,null));};exports[_0x162f('0x54')]=function(_0x1379e6,_0x3ac990){var _0x27b226={};var _0x56869e={};var _0x2dbc2d;var _0x1016e6;return db[_0x162f('0x21')][_0x162f('0x42')]({'where':{'id':_0x1379e6[_0x162f('0x2b')]['id']}})[_0x162f('0x17')](handleEntityNotFound(_0x3ac990,null))['then'](function(_0x21802e){if(_0x21802e){_0x2dbc2d=_0x21802e;_0x56869e[_0x162f('0x2f')]=_['keys'](db[_0x162f('0x55')]['rawAttributes']);_0x56869e[_0x162f('0x2d')]=_[_0x162f('0x2c')](_0x1379e6[_0x162f('0x2d')]);_0x56869e[_0x162f('0x2e')]=_[_0x162f('0x31')](_0x56869e[_0x162f('0x2f')],_0x56869e[_0x162f('0x2d')]);_0x27b226['attributes']=_[_0x162f('0x31')](_0x56869e[_0x162f('0x2f')],qs[_0x162f('0x32')](_0x1379e6[_0x162f('0x2d')][_0x162f('0x32')]));_0x27b226[_0x162f('0x30')]=_0x27b226[_0x162f('0x30')]['length']?_0x27b226[_0x162f('0x30')]:_0x56869e[_0x162f('0x2f')];_0x27b226[_0x162f('0x46')]=qs[_0x162f('0x47')](_0x1379e6[_0x162f('0x2d')]['sort']);_0x27b226['where']=qs['filters'](_[_0x162f('0x48')](_0x1379e6[_0x162f('0x2d')],_0x56869e['filters']));if(_0x1379e6[_0x162f('0x2d')][_0x162f('0x4b')]){_0x27b226[_0x162f('0x26')]=_['merge'](_0x27b226[_0x162f('0x26')],{'$or':_['map'](_0x27b226['attributes'],function(_0x4b1d63){var _0x1aaf4f={};_0x1aaf4f[_0x4b1d63]={'$like':'%'+_0x1379e6[_0x162f('0x2d')][_0x162f('0x4b')]+'%'};return _0x1aaf4f;})});}_0x27b226=_[_0x162f('0x4a')]({},_0x27b226,_0x1379e6['options']);return _0x2dbc2d[_0x162f('0x54')](_0x27b226);}})[_0x162f('0x17')](function(_0x4b29b7){if(_0x4b29b7){_0x1016e6=_0x4b29b7['length'];if(!_0x1379e6['query'][_0x162f('0x44')](_0x162f('0x45'))){_0x27b226['limit']=qs[_0x162f('0xf')](_0x1379e6[_0x162f('0x2d')][_0x162f('0xf')]);_0x27b226[_0x162f('0xe')]=qs[_0x162f('0xe')](_0x1379e6[_0x162f('0x2d')][_0x162f('0xe')]);}return _0x2dbc2d['getTeams'](_0x27b226);}})['then'](function(_0x4564e7){if(_0x4564e7){return _0x4564e7?{'count':_0x1016e6,'rows':_0x4564e7}:null;}})[_0x162f('0x17')](respondWithResult(_0x3ac990,null))[_0x162f('0x29')](handleError(_0x3ac990,null));};exports['addTeams']=function(_0x57509d,_0x5371a2){var _0x13d978=_0x57509d[_0x162f('0x40')][_0x162f('0x56')];return db[_0x162f('0x55')]['findAll']({'where':{'id':_0x13d978},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x162f('0x57'),_0x162f('0x58'),_0x162f('0x59')],'raw':!![]}]})[_0x162f('0x17')](function(_0x49df70){if(_0x49df70){var _0x13d707=_[_0x162f('0x5a')](_0x49df70,function(_0x555245){var _0x239833=_0x555245[_0x162f('0x18')]({'plain':!![]});return _0x239833[_0x162f('0x5b')];});return db[_0x162f('0x21')]['find']({'where':{'id':_0x57509d['params']['id']}})[_0x162f('0x17')](function(_0x186ce3){return db[_0x162f('0x5c')][_0x162f('0x5d')](function(_0x1d07e0){return _0x186ce3['addTeams'](_0x13d978,{'transaction':_0x1d07e0})[_0x162f('0x17')](function(){return BPromise[_0x162f('0x5e')](_0x13d707,function(_0x56b925){return db[_0x162f('0x43')]['findOrCreate']({'where':{'UserId':_0x56b925['id'],'ChatQueueId':_0x57509d['params']['id']},'transaction':_0x1d07e0});});})['then'](function(){_0x13d707[_0x162f('0x5f')](function(_0x3a28ce){socket['emit'](_0x162f('0x60'),{'UserId':_0x3a28ce['id'],'ChatQueueId':_0x186ce3['id']});});});});});}})[_0x162f('0x17')](respondWithStatusCode(_0x5371a2,null))[_0x162f('0x29')](handleError(_0x5371a2,null));};exports[_0x162f('0x61')]=function(_0x1035fd,_0x2a2679){return db[_0x162f('0x55')][_0x162f('0x27')]({'where':{'id':_0x1035fd['query'][_0x162f('0x56')]},'attributes':['id'],'include':[{'model':db[_0x162f('0x62')],'as':_0x162f('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x162f('0x17')](handleEntityNotFound(_0x2a2679,null))['then'](function(_0x488b40){var _0x5a6d31=_['map'](_0x488b40,'id');var _0x8190fb=[];var _0xaf787=[];var _0x326749=squel[_0x162f('0x63')]();_0x326749[_0x162f('0x64')]('tq.TeamId')[_0x162f('0x65')](_0x162f('0x66'),'tq')[_0x162f('0x67')]('user_has_teams','ut',_0x162f('0x68'))[_0x162f('0x26')](_0x162f('0x69'),_0x1035fd[_0x162f('0x2b')]['id']);for(var _0x54337a=0x0;_0x54337a<_0x488b40['length'];_0x54337a+=0x1){let _0x3f103f=_0x488b40[_0x54337a];for(var _0x46b41d=0x0;_0x46b41d<_0x3f103f['Agents'][_0x162f('0x33')];_0x46b41d+=0x1){let _0x2e58f6=_0x3f103f[_0x162f('0x5b')][_0x46b41d];var _0x12f786=_0x326749[_0x162f('0x6a')]();_0x12f786[_0x162f('0x26')]('ut.UserId\x20=\x20?',_0x2e58f6['id']);_0xaf787[_0x162f('0x6b')](db[_0x162f('0x5c')][_0x162f('0x2d')](_0x12f786[_0x162f('0x6c')](),{'type':db[_0x162f('0x5c')][_0x162f('0x6d')]['SELECT']})[_0x162f('0x17')](function(_0x14fd7f){if(_0x14fd7f['length']===0x1){return _0x2e58f6['id'];}else{var _0x582f1a=_['every'](_[_0x162f('0x20')](_0x14fd7f,_0x162f('0x6e')),function(_0x3ad33a){return _[_0x162f('0x6f')](_0x5a6d31,_0x3ad33a);});if(_0x582f1a){return _0x2e58f6['id'];}}}));}}return BPromise[_0x162f('0x70')](_0xaf787)[_0x162f('0x17')](function(_0x59aa68){_0x8190fb=_(_0x8190fb)[_0x162f('0x71')](_0x59aa68)[_0x162f('0x72')]()['value']();return db[_0x162f('0x21')][_0x162f('0x37')]({'where':{'id':_0x1035fd['params']['id']}})[_0x162f('0x17')](function(_0x3bb446){return db[_0x162f('0x5c')][_0x162f('0x5d')](function(_0x43ddbf){return _0x3bb446[_0x162f('0x61')](_0x1035fd['query'][_0x162f('0x56')],{'transaction':_0x43ddbf})[_0x162f('0x17')](function(){if(!_[_0x162f('0x73')](_0x8190fb)){return _0x3bb446[_0x162f('0x74')](_0x8190fb,{'transaction':_0x43ddbf});}})['then'](function(){_0x8190fb['forEach'](function(_0x545963){socket[_0x162f('0x75')](_0x162f('0x76'),{'UserId':_0x545963,'ChatQueueId':_0x3bb446['id']});});});});});});})['then'](respondWithStatusCode(_0x2a2679,null))[_0x162f('0x29')](handleError(_0x2a2679,null));};exports[_0x162f('0x77')]=function(_0x5eeabc,_0x5958a8){return db['ChatQueue'][_0x162f('0x37')]({'where':{'id':_0x5eeabc[_0x162f('0x2b')]['id']}})[_0x162f('0x17')](handleEntityNotFound(_0x5958a8,null))[_0x162f('0x17')](function(_0x47300d){if(_0x47300d){return _0x47300d[_0x162f('0x77')](_0x5eeabc[_0x162f('0x40')][_0x162f('0x56')],_[_0x162f('0x78')](_0x5eeabc[_0x162f('0x40')],[_0x162f('0x56'),'id'])||{})['spread'](function(_0x42d506){for(var _0x23838c=0x0;_0x23838c<_0x5eeabc[_0x162f('0x40')][_0x162f('0x56')][_0x162f('0x33')];_0x23838c+=0x1){socket[_0x162f('0x75')](_0x162f('0x60'),{'UserId':Number(_0x5eeabc['body']['ids'][_0x23838c]),'ChatQueueId':Number(_0x5eeabc[_0x162f('0x2b')]['id'])});}return _0x42d506;});}})[_0x162f('0x17')](respondWithResult(_0x5958a8,null))[_0x162f('0x29')](handleError(_0x5958a8,null));};exports[_0x162f('0x74')]=function(_0x4686f9,_0x33aa0f){return db['ChatQueue']['find']({'where':{'id':_0x4686f9[_0x162f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x33aa0f,null))[_0x162f('0x17')](function(_0x4cd65d){if(_0x4cd65d){return _0x4cd65d[_0x162f('0x74')](_0x4686f9[_0x162f('0x2d')][_0x162f('0x56')])['then'](function(){if(_['isArray'](_0x4686f9[_0x162f('0x2d')][_0x162f('0x56')])){for(var _0x127cb3=0x0;_0x127cb3<_0x4686f9[_0x162f('0x2d')]['ids'][_0x162f('0x33')];_0x127cb3+=0x1){socket[_0x162f('0x75')](_0x162f('0x76'),{'UserId':Number(_0x4686f9['query']['ids'][_0x127cb3]),'ChatQueueId':Number(_0x4686f9['params']['id'])});}}else{socket[_0x162f('0x75')]('userChatQueue:remove',{'UserId':Number(_0x4686f9['query'][_0x162f('0x56')]),'ChatQueueId':Number(_0x4686f9[_0x162f('0x2b')]['id'])});}});}})[_0x162f('0x17')](respondWithStatusCode(_0x33aa0f,null))[_0x162f('0x29')](handleError(_0x33aa0f,null));};exports['getAgents']=function(_0x5aab82,_0x194628){var _0x1d3280={};var _0x2235ce={};var _0x2c80f4;var _0x4dd765;return db[_0x162f('0x21')]['findOne']({'where':{'id':_0x5aab82[_0x162f('0x2b')]['id']}})[_0x162f('0x17')](handleEntityNotFound(_0x194628,null))[_0x162f('0x17')](function(_0x12572c){if(_0x12572c){_0x2c80f4=_0x12572c;_0x2235ce[_0x162f('0x2f')]=_[_0x162f('0x2c')](db[_0x162f('0x62')][_0x162f('0x22')]);_0x2235ce[_0x162f('0x2d')]=_[_0x162f('0x2c')](_0x5aab82[_0x162f('0x2d')]);_0x2235ce[_0x162f('0x2e')]=_[_0x162f('0x31')](_0x2235ce['model'],_0x2235ce[_0x162f('0x2d')]);_0x1d3280[_0x162f('0x30')]=_[_0x162f('0x31')](_0x2235ce[_0x162f('0x2f')],qs['fields'](_0x5aab82['query'][_0x162f('0x32')]));_0x1d3280[_0x162f('0x30')]=_0x1d3280[_0x162f('0x30')]['length']?_0x1d3280['attributes']:_0x2235ce[_0x162f('0x2f')];_0x1d3280[_0x162f('0x46')]=qs['sort'](_0x5aab82[_0x162f('0x2d')][_0x162f('0x47')]);_0x1d3280[_0x162f('0x26')]=qs['filters'](_[_0x162f('0x48')](_0x5aab82['query'],_0x2235ce[_0x162f('0x2e')]));if(_0x5aab82[_0x162f('0x2d')][_0x162f('0x4b')]){_0x1d3280['where']=_[_0x162f('0x4a')](_0x1d3280[_0x162f('0x26')],{'$or':_['map'](_0x1d3280['attributes'],function(_0xb1dc13){var _0x1648f0={};_0x1648f0[_0xb1dc13]={'$like':'%'+_0x5aab82['query'][_0x162f('0x4b')]+'%'};return _0x1648f0;})});}_0x1d3280=_[_0x162f('0x4a')]({},_0x1d3280,_0x5aab82[_0x162f('0x36')]);return _0x2c80f4[_0x162f('0x79')](_0x1d3280);}})['then'](function(_0x324d14){if(_0x324d14){_0x4dd765=_0x324d14[_0x162f('0x33')];if(!_0x5aab82[_0x162f('0x2d')][_0x162f('0x44')](_0x162f('0x45'))){_0x1d3280['limit']=qs[_0x162f('0xf')](_0x5aab82[_0x162f('0x2d')][_0x162f('0xf')]);_0x1d3280[_0x162f('0xe')]=qs[_0x162f('0xe')](_0x5aab82[_0x162f('0x2d')][_0x162f('0xe')]);}return _0x2c80f4['getAgents'](_0x1d3280);}})[_0x162f('0x17')](function(_0x51e140){if(_0x51e140){return _0x51e140?{'count':_0x4dd765,'rows':_0x51e140}:null;}})[_0x162f('0x17')](respondWithResult(_0x194628,null))[_0x162f('0x29')](handleError(_0x194628,null));}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e70063b..56e74a2 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 _0xe970=['hasOwnProperty','hook','exports','../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x187266,_0x3f99df){var _0x1a83bc=function(_0x189626){while(--_0x189626){_0x187266['push'](_0x187266['shift']());}};_0x1a83bc(++_0x3f99df);}(_0xe970,0xc9));var _0x0e97=function(_0x5de5a6,_0x3769c5){_0x5de5a6=_0x5de5a6-0x0;var _0x15ba1e=_0xe970[_0x5de5a6];return _0x15ba1e;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0e97('0x0'))['db'][_0x0e97('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0e97('0x2')](0x0);var events={'afterCreate':_0x0e97('0x3'),'afterUpdate':'update','afterDestroy':_0x0e97('0x4')};function emitEvent(_0x145845){return function(_0x5eb2a2,_0x30a381,_0x573c97){ChatQueueEvents[_0x0e97('0x5')](_0x145845+':'+_0x5eb2a2['id'],_0x5eb2a2);ChatQueueEvents[_0x0e97('0x5')](_0x145845,_0x5eb2a2);_0x573c97(null);};}for(var e in events){if(events[_0x0e97('0x6')](e)){var event=events[e];ChatQueue[_0x0e97('0x7')](e,emitEvent(event));}}module[_0x0e97('0x8')]=ChatQueueEvents; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index ddc4d3e..3430c22 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 _0x6e84=['./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','api','moment','request-promise','rimraf'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x6e84,0x108));var _0x46e8=function(_0x220612,_0x1772c0){_0x220612=_0x220612-0x0;var _0x318113=_0x6e84[_0x220612];return _0x318113;};'use strict';var _=require(_0x46e8('0x0'));var util=require(_0x46e8('0x1'));var logger=require('../../config/logger')(_0x46e8('0x2'));var moment=require(_0x46e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x46e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x46e8('0x5'));var config=require('../../config/environment');var attributes=require(_0x46e8('0x6'));module['exports']=function(_0x511bfd,_0x7892af){return _0x511bfd[_0x46e8('0x7')](_0x46e8('0x8'),attributes,{'tableName':_0x46e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 60062fe..aeec004 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 _0x7292=['localhost','socket.io-emitter','./chatQueue.socket','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','stringify','model','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2cce73,_0x32395d){var _0x2912d7=function(_0x299bf1){while(--_0x299bf1){_0x2cce73['push'](_0x2cce73['shift']());}};_0x2912d7(++_0x32395d);}(_0x7292,0x6d));var _0x2729=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7292[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var moment=require(_0x2729('0x2'));var BPromise=require(_0x2729('0x3'));var rs=require(_0x2729('0x4'));var fs=require('fs');var Redis=require(_0x2729('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2729('0x6'));var logger=require(_0x2729('0x7'))(_0x2729('0x8'));var config=require(_0x2729('0x9'));var jayson=require(_0x2729('0xa'));var client=jayson['client'][_0x2729('0xb')]({'port':0x232a});config[_0x2729('0xc')]=_[_0x2729('0xd')](config[_0x2729('0xc')],{'host':_0x2729('0xe'),'port':0x18eb});var socket=require(_0x2729('0xf'))(new Redis(config['redis']));require(_0x2729('0x10'))['register'](socket);function respondWithRpcPromise(_0x22d1c5,_0x595e43,_0x4e46a1){return new BPromise(function(_0x26d5cf,_0x4374cd){return client[_0x2729('0x11')](_0x22d1c5,_0x4e46a1)[_0x2729('0x12')](function(_0x2c3fa3){logger[_0x2729('0x13')]('ChatQueue,\x20%s,\x20%s',_0x595e43,'request\x20sent');logger[_0x2729('0x14')](_0x2729('0x15'),_0x595e43,_0x2729('0x16'),JSON['stringify'](_0x2c3fa3));if(_0x2c3fa3['error']){if(_0x2c3fa3[_0x2729('0x17')][_0x2729('0x18')]===0x1f4){logger[_0x2729('0x17')]('ChatQueue,\x20%s,\x20%s',_0x595e43,_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);return _0x4374cd(_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);}logger[_0x2729('0x17')]('ChatQueue,\x20%s,\x20%s',_0x595e43,_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);return _0x26d5cf(_0x2c3fa3[_0x2729('0x17')][_0x2729('0x19')]);}else{logger[_0x2729('0x13')](_0x2729('0x1a'),_0x595e43,_0x2729('0x16'));_0x26d5cf(_0x2c3fa3[_0x2729('0x1b')][_0x2729('0x19')]);}})[_0x2729('0x1c')](function(_0x2fc850){logger[_0x2729('0x17')](_0x2729('0x1a'),_0x595e43,_0x2fc850);_0x4374cd(_0x2fc850);});});}exports[_0x2729('0x1d')]=function(_0x17db0a){var _0x24eea1=this;return new Promise(function(_0x372eeb,_0x1f7769){return db[_0x2729('0x1e')][_0x2729('0x1f')]({'raw':_0x17db0a[_0x2729('0x20')]?_0x17db0a[_0x2729('0x20')][_0x2729('0x21')]===undefined?!![]:![]:!![],'where':_0x17db0a['options']?_0x17db0a['options'][_0x2729('0x22')]||null:null,'attributes':_0x17db0a[_0x2729('0x20')]?_0x17db0a[_0x2729('0x20')][_0x2729('0x23')]||null:null,'limit':_0x17db0a['options']?_0x17db0a[_0x2729('0x20')]['limit']||null:null,'include':_0x17db0a[_0x2729('0x20')]?_0x17db0a[_0x2729('0x20')][_0x2729('0x24')]?_['map'](_0x17db0a[_0x2729('0x20')]['include'],function(_0x3eb79f){return{'model':db[_0x3eb79f['model']],'as':_0x3eb79f['as'],'attributes':_0x3eb79f[_0x2729('0x23')],'include':_0x3eb79f[_0x2729('0x24')]?_['map'](_0x3eb79f[_0x2729('0x24')],function(_0x109c97){return{'model':db[_0x109c97['model']],'as':_0x109c97['as'],'attributes':_0x109c97[_0x2729('0x23')],'include':_0x109c97[_0x2729('0x24')]?_[_0x2729('0x25')](_0x109c97[_0x2729('0x24')],function(_0x395ffa){return{'model':db[_0x395ffa['model']],'as':_0x395ffa['as'],'attributes':_0x395ffa[_0x2729('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2729('0x12')](function(_0x3bc5ae){logger[_0x2729('0x13')](_0x2729('0x1d'),_0x17db0a);logger[_0x2729('0x14')](_0x2729('0x1d'),_0x17db0a,JSON[_0x2729('0x26')](_0x3bc5ae));_0x372eeb(_0x3bc5ae);})[_0x2729('0x1c')](function(_0x38cbab){logger['error']('GetChatQueue',_0x38cbab[_0x2729('0x19')],_0x17db0a);_0x1f7769(_0x24eea1[_0x2729('0x17')](0x1f4,_0x38cbab[_0x2729('0x19')]));});});};exports['ShowChatQueue']=function(_0x56e58a){var _0x49abc6=this;return new Promise(function(_0x446bfe,_0x457212){return db[_0x2729('0x1e')]['find']({'raw':_0x56e58a[_0x2729('0x20')]?_0x56e58a[_0x2729('0x20')][_0x2729('0x21')]===undefined?!![]:![]:!![],'where':_0x56e58a[_0x2729('0x20')]?_0x56e58a[_0x2729('0x20')]['where']||null:null,'attributes':_0x56e58a[_0x2729('0x20')]?_0x56e58a['options'][_0x2729('0x23')]||null:null,'include':_0x56e58a[_0x2729('0x20')]?_0x56e58a['options']['include']?_[_0x2729('0x25')](_0x56e58a['options']['include'],function(_0x4e18c3){return{'model':db[_0x4e18c3[_0x2729('0x27')]],'as':_0x4e18c3['as'],'attributes':_0x4e18c3[_0x2729('0x23')],'include':_0x4e18c3[_0x2729('0x24')]?_[_0x2729('0x25')](_0x4e18c3[_0x2729('0x24')],function(_0xe62402){return{'model':db[_0xe62402[_0x2729('0x27')]],'as':_0xe62402['as'],'attributes':_0xe62402[_0x2729('0x23')],'include':_0xe62402['include']?_['map'](_0xe62402[_0x2729('0x24')],function(_0x33241c){return{'model':db[_0x33241c['model']],'as':_0x33241c['as'],'attributes':_0x33241c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2729('0x12')](function(_0x1675d5){logger[_0x2729('0x13')](_0x2729('0x28'),_0x56e58a);logger[_0x2729('0x14')](_0x2729('0x28'),_0x56e58a,JSON[_0x2729('0x26')](_0x1675d5));_0x446bfe(_0x1675d5);})['catch'](function(_0x2b1227){logger[_0x2729('0x17')](_0x2729('0x28'),_0x2b1227['message'],_0x56e58a);_0x457212(_0x49abc6['error'](0x1f4,_0x2b1227['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index cc31bee..5ea0b32 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 _0x9b67=['register','length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x4dadf6,_0x42a1d1){var _0x5ee5c7=function(_0x1d4e43){while(--_0x1d4e43){_0x4dadf6['push'](_0x4dadf6['shift']());}};_0x5ee5c7(++_0x42a1d1);}(_0x9b67,0xf6));var _0x79b6=function(_0x3a3958,_0x66eb1){_0x3a3958=_0x3a3958-0x0;var _0x56471f=_0x9b67[_0x3a3958];return _0x56471f;};'use strict';var ChatQueueEvents=require(_0x79b6('0x0'));var events=[_0x79b6('0x1'),_0x79b6('0x2'),_0x79b6('0x3')];function createListener(_0x29728d,_0x5523a1){return function(_0x3ba25a){_0x5523a1[_0x79b6('0x4')](_0x29728d,_0x3ba25a);};}function removeListener(_0x5297d0,_0x4e8794){return function(){ChatQueueEvents[_0x79b6('0x5')](_0x5297d0,_0x4e8794);};}exports[_0x79b6('0x6')]=function(_0x258103){for(var _0xec367e=0x0,_0xfa6a05=events[_0x79b6('0x7')];_0xec367e<_0xfa6a05;_0xec367e++){var _0x34adbe=events[_0xec367e];var _0x58ae2d=createListener(_0x79b6('0x8')+_0x34adbe,_0x258103);ChatQueueEvents['on'](_0x34adbe,_0x58ae2d);}}; \ No newline at end of file +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 diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index eedf0e0..9f4e633 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d61b2,_0x2997d0){var _0x21a1d3=function(_0x490b12){while(--_0x490b12){_0x5d61b2['push'](_0x5d61b2['shift']());}};_0x21a1d3(++_0x2997d0);}(_0x008c,0x188));var _0xc008=function(_0x5365ad,_0x41ec9b){_0x5365ad=_0x5365ad-0x0;var _0x365519=_0x008c[_0x5365ad];return _0x365519;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 83952fb..2852d37 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 _0x7f2f=['sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f2f,0x11c));var _0xf7f2=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x7f2f[_0x272638];return _0x19d027;};'use strict';var moment=require('moment');var Sequelize=require(_0xf7f2('0x0'));module[_0xf7f2('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf7f2('0x2')]},'joinAt':{'type':Sequelize[_0xf7f2('0x3')]},'leaveAt':{'type':Sequelize[_0xf7f2('0x3')]},'acceptAt':{'type':Sequelize[_0xf7f2('0x3')]},'exitAt':{'type':Sequelize[_0xf7f2('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c507167..92efa48 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 _0x9bd9=['ChatQueueReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','name','index'];(function(_0x2e4fd9,_0x1f048a){var _0x3a9524=function(_0x3c34ee){while(--_0x3c34ee){_0x2e4fd9['push'](_0x2e4fd9['shift']());}};_0x3a9524(++_0x1f048a);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x9bd9[_0x262323];return _0xa963c3;};'use strict';var emlformat=require(_0x99bd('0x0'));var rimraf=require(_0x99bd('0x1'));var zipdir=require(_0x99bd('0x2'));var jsonpatch=require(_0x99bd('0x3'));var rp=require(_0x99bd('0x4'));var moment=require(_0x99bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x99bd('0x6'));var util=require('util');var path=require(_0x99bd('0x7'));var sox=require(_0x99bd('0x8'));var csv=require('to-csv');var ejs=require(_0x99bd('0x9'));var fs=require('fs');var fs_extra=require(_0x99bd('0xa'));var _=require(_0x99bd('0xb'));var squel=require(_0x99bd('0xc'));var crypto=require(_0x99bd('0xd'));var jsforce=require(_0x99bd('0xe'));var deskjs=require(_0x99bd('0xf'));var toCsv=require(_0x99bd('0x10'));var querystring=require(_0x99bd('0x11'));var Papa=require(_0x99bd('0x12'));var Redis=require(_0x99bd('0x13'));var authService=require(_0x99bd('0x14'));var qs=require(_0x99bd('0x15'));var as=require(_0x99bd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bd('0x17'))('api');var utils=require(_0x99bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x99bd('0x19'));var db=require(_0x99bd('0x1a'))['db'];function respondWithStatusCode(_0x4a8bd9,_0x22237c){_0x22237c=_0x22237c||0xcc;return function(_0x500cd2){if(_0x500cd2){return _0x4a8bd9[_0x99bd('0x1b')](_0x22237c);}return _0x4a8bd9['status'](_0x22237c)[_0x99bd('0x1c')]();};}function respondWithResult(_0x401299,_0x141159){_0x141159=_0x141159||0xc8;return function(_0x4a9770){if(_0x4a9770){return _0x401299[_0x99bd('0x1d')](_0x141159)[_0x99bd('0x1e')](_0x4a9770);}};}function respondWithFilteredResult(_0x2d918a,_0x42b619){return function(_0x65a2e5){if(_0x65a2e5){var _0x491d9=typeof _0x42b619[_0x99bd('0x1f')]===_0x99bd('0x20')&&typeof _0x42b619[_0x99bd('0x21')]==='undefined';var _0x378079=_0x65a2e5[_0x99bd('0x22')];var _0x2fe078=_0x491d9?0x0:_0x42b619['offset'];var _0x4b98fc=_0x491d9?_0x65a2e5[_0x99bd('0x22')]:_0x42b619[_0x99bd('0x1f')]+_0x42b619[_0x99bd('0x21')];var _0xfa6227;if(_0x4b98fc>=_0x378079){_0x4b98fc=_0x378079;_0xfa6227=0xc8;}else{_0xfa6227=0xce;}_0x2d918a[_0x99bd('0x1d')](_0xfa6227);return _0x2d918a['set'](_0x99bd('0x23'),_0x2fe078+'-'+_0x4b98fc+'/'+_0x378079)['json'](_0x65a2e5);}return null;};}function patchUpdates(_0x10f2fb){return function(_0x3085df){try{jsonpatch[_0x99bd('0x24')](_0x3085df,_0x10f2fb,!![]);}catch(_0x1d937b){return BPromise[_0x99bd('0x25')](_0x1d937b);}return _0x3085df['save']();};}function saveUpdates(_0x27c551,_0x229322){return function(_0x3e339c){if(_0x3e339c){return _0x3e339c['update'](_0x27c551)[_0x99bd('0x26')](function(_0x5e6081){return _0x5e6081;});}return null;};}function removeEntity(_0x4d3ebb,_0x1c5b82){return function(_0xfdc455){if(_0xfdc455){return _0xfdc455['destroy']()[_0x99bd('0x26')](function(){_0x4d3ebb[_0x99bd('0x1d')](0xcc)[_0x99bd('0x1c')]();});}};}function handleEntityNotFound(_0x3f7bf4,_0x51ff34){return function(_0x12daac){if(!_0x12daac){_0x3f7bf4['sendStatus'](0x194);}return _0x12daac;};}function handleError(_0x550b7f,_0x10d5cd){_0x10d5cd=_0x10d5cd||0x1f4;return function(_0x5ebeeb){logger[_0x99bd('0x27')](_0x5ebeeb['stack']);if(_0x5ebeeb[_0x99bd('0x28')]){delete _0x5ebeeb[_0x99bd('0x28')];}_0x550b7f['status'](_0x10d5cd)['send'](_0x5ebeeb);};}exports[_0x99bd('0x29')]=function(_0x1af1e6,_0x1eabb9){var _0x5903aa={},_0x957d48={},_0x1d0642={'count':0x0,'rows':[]};var _0x2250d8=_['map'](db[_0x99bd('0x2a')][_0x99bd('0x2b')],function(_0x4c5493){return{'name':_0x4c5493[_0x99bd('0x2c')],'type':_0x4c5493[_0x99bd('0x2d')][_0x99bd('0x2e')]};});_0x957d48[_0x99bd('0x2f')]=_['map'](_0x2250d8,_0x99bd('0x28'));_0x957d48[_0x99bd('0x30')]=_['keys'](_0x1af1e6[_0x99bd('0x30')]);_0x957d48['filters']=_['intersection'](_0x957d48['model'],_0x957d48[_0x99bd('0x30')]);_0x5903aa[_0x99bd('0x31')]=_[_0x99bd('0x32')](_0x957d48[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x33')]));_0x5903aa[_0x99bd('0x31')]=_0x5903aa[_0x99bd('0x31')][_0x99bd('0x34')]?_0x5903aa['attributes']:_0x957d48[_0x99bd('0x2f')];if(!_0x1af1e6['query'][_0x99bd('0x35')]('nolimit')){_0x5903aa['limit']=qs['limit'](_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x21')]);_0x5903aa[_0x99bd('0x1f')]=qs[_0x99bd('0x1f')](_0x1af1e6['query'][_0x99bd('0x1f')]);}_0x5903aa[_0x99bd('0x36')]=qs[_0x99bd('0x37')](_0x1af1e6[_0x99bd('0x30')]['sort']);_0x5903aa[_0x99bd('0x38')]=qs[_0x99bd('0x39')](_[_0x99bd('0x3a')](_0x1af1e6[_0x99bd('0x30')],_0x957d48['filters']),_0x2250d8);if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]){_0x5903aa[_0x99bd('0x38')]=_[_0x99bd('0x3c')](_0x5903aa['where'],{'$or':_[_0x99bd('0x3d')](_0x2250d8,function(_0x3d2b0f){if(_0x3d2b0f[_0x99bd('0x2d')]!==_0x99bd('0x3e')){var _0x7e29ec={};_0x7e29ec[_0x3d2b0f[_0x99bd('0x28')]]={'$like':'%'+_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x3b')]+'%'};return _0x7e29ec;}})});}_0x5903aa=_[_0x99bd('0x3c')]({},_0x5903aa,_0x1af1e6[_0x99bd('0x3f')]);var _0x2fcf71={'where':_0x5903aa[_0x99bd('0x38')]};return db[_0x99bd('0x2a')]['count'](_0x2fcf71)[_0x99bd('0x26')](function(_0x1ecdd6){_0x1d0642[_0x99bd('0x22')]=_0x1ecdd6;if(_0x1af1e6[_0x99bd('0x30')][_0x99bd('0x40')]){_0x5903aa[_0x99bd('0x41')]=[{'all':!![]}];}return db[_0x99bd('0x2a')][_0x99bd('0x42')](_0x5903aa);})[_0x99bd('0x26')](function(_0x7e84b1){_0x1d0642[_0x99bd('0x43')]=_0x7e84b1;return _0x1d0642;})[_0x99bd('0x26')](respondWithFilteredResult(_0x1eabb9,_0x5903aa))[_0x99bd('0x44')](handleError(_0x1eabb9,null));};exports[_0x99bd('0x45')]=function(_0xb0ffe5,_0x2d91be){var _0x369fb5={'raw':!![],'where':{'id':_0xb0ffe5[_0x99bd('0x46')]['id']}},_0x5a4a96={};_0x5a4a96[_0x99bd('0x2f')]=_[_0x99bd('0x47')](db[_0x99bd('0x2a')][_0x99bd('0x2b')]);_0x5a4a96[_0x99bd('0x30')]=_[_0x99bd('0x47')](_0xb0ffe5[_0x99bd('0x30')]);_0x5a4a96['filters']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],_0x5a4a96[_0x99bd('0x30')]);_0x369fb5['attributes']=_[_0x99bd('0x32')](_0x5a4a96[_0x99bd('0x2f')],qs[_0x99bd('0x33')](_0xb0ffe5['query'][_0x99bd('0x33')]));_0x369fb5['attributes']=_0x369fb5['attributes']['length']?_0x369fb5[_0x99bd('0x31')]:_0x5a4a96[_0x99bd('0x2f')];if(_0xb0ffe5[_0x99bd('0x30')]['includeAll']){_0x369fb5[_0x99bd('0x41')]=[{'all':!![]}];}_0x369fb5=_[_0x99bd('0x3c')]({},_0x369fb5,_0xb0ffe5[_0x99bd('0x3f')]);return db['ChatQueueReport'][_0x99bd('0x48')](_0x369fb5)[_0x99bd('0x26')](handleEntityNotFound(_0x2d91be,null))['then'](respondWithResult(_0x2d91be,null))['catch'](handleError(_0x2d91be,null));};exports[_0x99bd('0x49')]=function(_0x1d7ec0,_0x3487c6){return db['ChatQueueReport']['create'](_0x1d7ec0[_0x99bd('0x4a')],{})[_0x99bd('0x26')](respondWithResult(_0x3487c6,0xc9))[_0x99bd('0x44')](handleError(_0x3487c6,null));};exports['update']=function(_0x3fa8e1,_0x4e71b3){if(_0x3fa8e1[_0x99bd('0x4a')]['id']){delete _0x3fa8e1[_0x99bd('0x4a')]['id'];}return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x3fa8e1[_0x99bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e71b3,null))[_0x99bd('0x26')](saveUpdates(_0x3fa8e1['body'],null))[_0x99bd('0x26')](respondWithResult(_0x4e71b3,null))[_0x99bd('0x44')](handleError(_0x4e71b3,null));};exports[_0x99bd('0x4b')]=function(_0x1912ac,_0x2100c7){return db[_0x99bd('0x2a')][_0x99bd('0x48')]({'where':{'id':_0x1912ac['params']['id']}})['then'](handleEntityNotFound(_0x2100c7,null))[_0x99bd('0x26')](removeEntity(_0x2100c7,null))[_0x99bd('0x44')](handleError(_0x2100c7,null));};exports[_0x99bd('0x4c')]=function(_0x2f0fb7,_0x25c67d){return db[_0x99bd('0x2a')][_0x99bd('0x4c')]()['then'](respondWithResult(_0x25c67d,null))['catch'](handleError(_0x25c67d,null));}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ea13bff..fede79d 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fbc9886..b6bf352 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 _0x95a1=['raw','CreateChatQueueReport','debug','UpdateChatQueueReport','update','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueueReport','create','body'];(function(_0x46ff07,_0x5150f2){var _0x59c8e7=function(_0x3ffe15){while(--_0x3ffe15){_0x46ff07['push'](_0x46ff07['shift']());}};_0x59c8e7(++_0x5150f2);}(_0x95a1,0x129));var _0x195a=function(_0xeecbed,_0x5af859){_0xeecbed=_0xeecbed-0x0;var _0x3636e8=_0x95a1[_0xeecbed];return _0x3636e8;};'use strict';var _=require(_0x195a('0x0'));var util=require(_0x195a('0x1'));var moment=require(_0x195a('0x2'));var BPromise=require(_0x195a('0x3'));var rs=require(_0x195a('0x4'));var fs=require('fs');var Redis=require(_0x195a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x195a('0x6'));var logger=require(_0x195a('0x7'))(_0x195a('0x8'));var config=require(_0x195a('0x9'));var jayson=require(_0x195a('0xa'));var client=jayson[_0x195a('0xb')][_0x195a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf26789,_0xc95dc8,_0x4bfe30){return new BPromise(function(_0x4bc3b7,_0x29a69a){return client['request'](_0xf26789,_0x4bfe30)[_0x195a('0xd')](function(_0x4cfb59){logger[_0x195a('0xe')](_0x195a('0xf'),_0xc95dc8,'request\x20sent');logger['debug'](_0x195a('0x10'),_0xc95dc8,_0x195a('0x11'),JSON[_0x195a('0x12')](_0x4cfb59));if(_0x4cfb59[_0x195a('0x13')]){if(_0x4cfb59[_0x195a('0x13')][_0x195a('0x14')]===0x1f4){logger[_0x195a('0x13')](_0x195a('0xf'),_0xc95dc8,_0x4cfb59[_0x195a('0x13')][_0x195a('0x15')]);return _0x29a69a(_0x4cfb59[_0x195a('0x13')][_0x195a('0x15')]);}logger[_0x195a('0x13')](_0x195a('0xf'),_0xc95dc8,_0x4cfb59['error']['message']);return _0x4bc3b7(_0x4cfb59[_0x195a('0x13')]['message']);}else{logger['info'](_0x195a('0xf'),_0xc95dc8,_0x195a('0x11'));_0x4bc3b7(_0x4cfb59[_0x195a('0x16')]['message']);}})[_0x195a('0x17')](function(_0x2c62a1){logger[_0x195a('0x13')](_0x195a('0xf'),_0xc95dc8,_0x2c62a1);_0x29a69a(_0x2c62a1);});});}exports['CreateChatQueueReport']=function(_0xf6a432){var _0x8a6743=this;return new Promise(function(_0x22761a,_0x11cb36){return db[_0x195a('0x18')][_0x195a('0x19')](_0xf6a432[_0x195a('0x1a')],{'raw':_0xf6a432['options']?_0xf6a432['options'][_0x195a('0x1b')]===undefined?!![]:![]:!![]})[_0x195a('0xd')](function(_0x2c8207){logger[_0x195a('0xe')](_0x195a('0x1c'),_0xf6a432);logger[_0x195a('0x1d')]('CreateChatQueueReport',_0xf6a432,JSON[_0x195a('0x12')](_0x2c8207));_0x22761a(_0x2c8207);})['catch'](function(_0xef6d6){logger['error'](_0x195a('0x1c'),_0xef6d6[_0x195a('0x15')],_0xf6a432);_0x11cb36(_0x8a6743['error'](0x1f4,_0xef6d6[_0x195a('0x15')]));});});};exports[_0x195a('0x1e')]=function(_0x5b5c53){var _0x3226f7=this;return new Promise(function(_0x5387bb,_0x133054){return db[_0x195a('0x18')][_0x195a('0x1f')](_0x5b5c53[_0x195a('0x1a')],{'raw':_0x5b5c53[_0x195a('0x20')]?_0x5b5c53[_0x195a('0x20')][_0x195a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b5c53[_0x195a('0x20')]?_0x5b5c53[_0x195a('0x20')][_0x195a('0x21')]||null:null,'attributes':_0x5b5c53['options']?_0x5b5c53[_0x195a('0x20')][_0x195a('0x22')]||null:null,'limit':_0x5b5c53[_0x195a('0x20')]?_0x5b5c53[_0x195a('0x20')][_0x195a('0x23')]||null:null})[_0x195a('0xd')](function(_0x11861b){logger[_0x195a('0xe')]('UpdateChatQueueReport',_0x5b5c53);logger['debug'](_0x195a('0x1e'),_0x5b5c53,JSON['stringify'](_0x11861b));_0x5387bb(_0x11861b);})[_0x195a('0x17')](function(_0x47f710){logger[_0x195a('0x13')](_0x195a('0x1e'),_0x47f710['message'],_0x5b5c53);_0x133054(_0x3226f7[_0x195a('0x13')](0x1f4,_0x47f710['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ad77702..a6711f0 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 _0x2ba5=['/:id','show','post','put','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x55dbac,_0x1269dd){var _0x309409=function(_0x3faeba){while(--_0x3faeba){_0x55dbac['push'](_0x55dbac['shift']());}};_0x309409(++_0x1269dd);}(_0x2ba5,0x17c));var _0x52ba=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x2ba5[_0x15cdcb];return _0x37b069;};'use strict';var multer=require(_0x52ba('0x0'));var util=require('util');var path=require(_0x52ba('0x1'));var timeout=require(_0x52ba('0x2'));var express=require(_0x52ba('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x52ba('0x4'));var interaction=require(_0x52ba('0x5'));var config=require('../../config/environment');var controller=require(_0x52ba('0x6'));router[_0x52ba('0x7')]('/',auth[_0x52ba('0x8')](),controller['index']);router['get'](_0x52ba('0x9'),auth[_0x52ba('0x8')](),controller[_0x52ba('0xa')]);router[_0x52ba('0x7')](_0x52ba('0xb'),auth[_0x52ba('0x8')](),controller[_0x52ba('0xc')]);router[_0x52ba('0xd')]('/',auth[_0x52ba('0x8')](),controller['create']);router[_0x52ba('0xe')](_0x52ba('0xb'),auth['isAuthenticated'](),controller[_0x52ba('0xf')]);router[_0x52ba('0x10')](_0x52ba('0xb'),auth[_0x52ba('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index dc0a309..86ad55e 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x457769,_0x39ef3c){var _0x1b3f9a=function(_0x198d1f){while(--_0x198d1f){_0x457769['push'](_0x457769['shift']());}};_0x1b3f9a(++_0x39ef3c);}(_0xe706,0xa3));var _0x6e70=function(_0x2e7025,_0x187270){_0x2e7025=_0x2e7025-0x0;var _0x5373ed=_0xe706[_0x2e7025];return _0x5373ed;};'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 _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 diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 93c940b..fca61f3 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 _0xee5c=['destroy','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','intersection','includeAll','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then'];(function(_0x491b78,_0x6227b8){var _0x271bc4=function(_0xf6be78){while(--_0xf6be78){_0x491b78['push'](_0x491b78['shift']());}};_0x271bc4(++_0x6227b8);}(_0xee5c,0x151));var _0xcee5=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xee5c[_0x2bcb75];return _0x175345;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcee5('0x0'));var zipdir=require(_0xcee5('0x1'));var jsonpatch=require(_0xcee5('0x2'));var rp=require(_0xcee5('0x3'));var moment=require(_0xcee5('0x4'));var BPromise=require(_0xcee5('0x5'));var Mustache=require('mustache');var util=require(_0xcee5('0x6'));var path=require(_0xcee5('0x7'));var sox=require(_0xcee5('0x8'));var csv=require(_0xcee5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcee5('0xa'));var _=require(_0xcee5('0xb'));var squel=require(_0xcee5('0xc'));var crypto=require(_0xcee5('0xd'));var jsforce=require(_0xcee5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcee5('0x9'));var querystring=require(_0xcee5('0xf'));var Papa=require(_0xcee5('0x10'));var Redis=require(_0xcee5('0x11'));var authService=require(_0xcee5('0x12'));var qs=require(_0xcee5('0x13'));var as=require(_0xcee5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcee5('0x15'))(_0xcee5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcee5('0x17'));var db=require(_0xcee5('0x18'))['db'];function respondWithStatusCode(_0x25b3d2,_0x2f4cfa){_0x2f4cfa=_0x2f4cfa||0xcc;return function(_0xeea98f){if(_0xeea98f){return _0x25b3d2[_0xcee5('0x19')](_0x2f4cfa);}return _0x25b3d2[_0xcee5('0x1a')](_0x2f4cfa)[_0xcee5('0x1b')]();};}function respondWithResult(_0x1b26b7,_0x5bfaa2){_0x5bfaa2=_0x5bfaa2||0xc8;return function(_0x34bf04){if(_0x34bf04){return _0x1b26b7[_0xcee5('0x1a')](_0x5bfaa2)[_0xcee5('0x1c')](_0x34bf04);}};}function respondWithFilteredResult(_0x5097e8,_0xf58305){return function(_0x226b42){if(_0x226b42){var _0x586723=typeof _0xf58305[_0xcee5('0x1d')]==='undefined'&&typeof _0xf58305[_0xcee5('0x1e')]===_0xcee5('0x1f');var _0x2acbcf=_0x226b42[_0xcee5('0x20')];var _0x3f3d55=_0x586723?0x0:_0xf58305[_0xcee5('0x1d')];var _0x4468f2=_0x586723?_0x226b42[_0xcee5('0x20')]:_0xf58305[_0xcee5('0x1d')]+_0xf58305[_0xcee5('0x1e')];var _0x57f779;if(_0x4468f2>=_0x2acbcf){_0x4468f2=_0x2acbcf;_0x57f779=0xc8;}else{_0x57f779=0xce;}_0x5097e8[_0xcee5('0x1a')](_0x57f779);return _0x5097e8[_0xcee5('0x21')](_0xcee5('0x22'),_0x3f3d55+'-'+_0x4468f2+'/'+_0x2acbcf)[_0xcee5('0x1c')](_0x226b42);}return null;};}function patchUpdates(_0xcf8ccb){return function(_0x4c1fb2){try{jsonpatch['apply'](_0x4c1fb2,_0xcf8ccb,!![]);}catch(_0x244b23){return BPromise['reject'](_0x244b23);}return _0x4c1fb2[_0xcee5('0x23')]();};}function saveUpdates(_0x36bd49,_0x3f6863){return function(_0x1695d4){if(_0x1695d4){return _0x1695d4[_0xcee5('0x24')](_0x36bd49)[_0xcee5('0x25')](function(_0xd1035e){return _0xd1035e;});}return null;};}function removeEntity(_0x16b289,_0x284f17){return function(_0x5005ee){if(_0x5005ee){return _0x5005ee[_0xcee5('0x26')]()[_0xcee5('0x25')](function(){_0x16b289[_0xcee5('0x1a')](0xcc)[_0xcee5('0x1b')]();});}};}function handleEntityNotFound(_0x174d0e,_0x3c97de){return function(_0x3839ce){if(!_0x3839ce){_0x174d0e[_0xcee5('0x19')](0x194);}return _0x3839ce;};}function handleError(_0x14df4f,_0x35b00f){_0x35b00f=_0x35b00f||0x1f4;return function(_0x240758){logger[_0xcee5('0x27')](_0x240758[_0xcee5('0x28')]);if(_0x240758[_0xcee5('0x29')]){delete _0x240758[_0xcee5('0x29')];}_0x14df4f['status'](_0x35b00f)[_0xcee5('0x2a')](_0x240758);};}exports['index']=function(_0x4d0929,_0x4e4ad0){var _0x5e5148={},_0x57f5e5={},_0x1f65b3={'count':0x0,'rows':[]};var _0x43ec7f=_[_0xcee5('0x2b')](db[_0xcee5('0x2c')][_0xcee5('0x2d')],function(_0x5dab24){return{'name':_0x5dab24[_0xcee5('0x2e')],'type':_0x5dab24[_0xcee5('0x2f')]['key']};});_0x57f5e5['model']=_[_0xcee5('0x2b')](_0x43ec7f,'name');_0x57f5e5[_0xcee5('0x30')]=_[_0xcee5('0x31')](_0x4d0929[_0xcee5('0x30')]);_0x57f5e5[_0xcee5('0x32')]=_['intersection'](_0x57f5e5[_0xcee5('0x33')],_0x57f5e5[_0xcee5('0x30')]);_0x5e5148[_0xcee5('0x34')]=_['intersection'](_0x57f5e5['model'],qs['fields'](_0x4d0929[_0xcee5('0x30')][_0xcee5('0x35')]));_0x5e5148[_0xcee5('0x34')]=_0x5e5148[_0xcee5('0x34')]['length']?_0x5e5148[_0xcee5('0x34')]:_0x57f5e5[_0xcee5('0x33')];if(!_0x4d0929['query'][_0xcee5('0x36')](_0xcee5('0x37'))){_0x5e5148[_0xcee5('0x1e')]=qs[_0xcee5('0x1e')](_0x4d0929['query'][_0xcee5('0x1e')]);_0x5e5148[_0xcee5('0x1d')]=qs[_0xcee5('0x1d')](_0x4d0929[_0xcee5('0x30')]['offset']);}_0x5e5148[_0xcee5('0x38')]=qs['sort'](_0x4d0929[_0xcee5('0x30')][_0xcee5('0x39')]);_0x5e5148[_0xcee5('0x3a')]=qs['filters'](_['pick'](_0x4d0929[_0xcee5('0x30')],_0x57f5e5[_0xcee5('0x32')]),_0x43ec7f);if(_0x4d0929[_0xcee5('0x30')]['filter']){_0x5e5148['where']=_[_0xcee5('0x3b')](_0x5e5148[_0xcee5('0x3a')],{'$or':_[_0xcee5('0x2b')](_0x43ec7f,function(_0x4f12c8){if(_0x4f12c8[_0xcee5('0x2f')]!==_0xcee5('0x3c')){var _0x2aa1cf={};_0x2aa1cf[_0x4f12c8[_0xcee5('0x29')]]={'$like':'%'+_0x4d0929[_0xcee5('0x30')][_0xcee5('0x3d')]+'%'};return _0x2aa1cf;}})});}_0x5e5148=_[_0xcee5('0x3b')]({},_0x5e5148,_0x4d0929[_0xcee5('0x3e')]);var _0x1be9a4={'where':_0x5e5148[_0xcee5('0x3a')]};return db[_0xcee5('0x2c')]['count'](_0x1be9a4)['then'](function(_0x20c07f){_0x1f65b3['count']=_0x20c07f;if(_0x4d0929['query']['includeAll']){_0x5e5148['include']=[{'all':!![]}];}return db[_0xcee5('0x2c')][_0xcee5('0x3f')](_0x5e5148);})[_0xcee5('0x25')](function(_0x427bc9){_0x1f65b3[_0xcee5('0x40')]=_0x427bc9;return _0x1f65b3;})['then'](respondWithFilteredResult(_0x4e4ad0,_0x5e5148))[_0xcee5('0x41')](handleError(_0x4e4ad0,null));};exports[_0xcee5('0x42')]=function(_0x19f0f2,_0x323d53){var _0x538cd7={'raw':!![],'where':{'id':_0x19f0f2[_0xcee5('0x43')]['id']}},_0x458eca={};_0x458eca[_0xcee5('0x33')]=_['keys'](db[_0xcee5('0x2c')]['rawAttributes']);_0x458eca[_0xcee5('0x30')]=_[_0xcee5('0x31')](_0x19f0f2[_0xcee5('0x30')]);_0x458eca[_0xcee5('0x32')]=_['intersection'](_0x458eca[_0xcee5('0x33')],_0x458eca[_0xcee5('0x30')]);_0x538cd7[_0xcee5('0x34')]=_[_0xcee5('0x44')](_0x458eca[_0xcee5('0x33')],qs[_0xcee5('0x35')](_0x19f0f2[_0xcee5('0x30')][_0xcee5('0x35')]));_0x538cd7[_0xcee5('0x34')]=_0x538cd7[_0xcee5('0x34')]['length']?_0x538cd7[_0xcee5('0x34')]:_0x458eca[_0xcee5('0x33')];if(_0x19f0f2['query'][_0xcee5('0x45')]){_0x538cd7[_0xcee5('0x46')]=[{'all':!![]}];}_0x538cd7=_[_0xcee5('0x3b')]({},_0x538cd7,_0x19f0f2[_0xcee5('0x3e')]);return db['ChatTransferReport']['find'](_0x538cd7)['then'](handleEntityNotFound(_0x323d53,null))[_0xcee5('0x25')](respondWithResult(_0x323d53,null))[_0xcee5('0x41')](handleError(_0x323d53,null));};exports[_0xcee5('0x47')]=function(_0xbe1b40,_0x182d28){return db[_0xcee5('0x2c')]['create'](_0xbe1b40[_0xcee5('0x48')],{})['then'](respondWithResult(_0x182d28,0xc9))['catch'](handleError(_0x182d28,null));};exports[_0xcee5('0x24')]=function(_0x383ee0,_0x32a618){if(_0x383ee0[_0xcee5('0x48')]['id']){delete _0x383ee0[_0xcee5('0x48')]['id'];}return db[_0xcee5('0x2c')]['find']({'where':{'id':_0x383ee0[_0xcee5('0x43')]['id']}})['then'](handleEntityNotFound(_0x32a618,null))['then'](saveUpdates(_0x383ee0[_0xcee5('0x48')],null))[_0xcee5('0x25')](respondWithResult(_0x32a618,null))[_0xcee5('0x41')](handleError(_0x32a618,null));};exports[_0xcee5('0x26')]=function(_0x4c19b6,_0x4211ce){return db[_0xcee5('0x2c')][_0xcee5('0x49')]({'where':{'id':_0x4c19b6[_0xcee5('0x43')]['id']}})[_0xcee5('0x25')](handleEntityNotFound(_0x4211ce,null))[_0xcee5('0x25')](removeEntity(_0x4211ce,null))[_0xcee5('0x41')](handleError(_0x4211ce,null));};exports[_0xcee5('0x4a')]=function(_0xe6bb39,_0x371f8d){return db[_0xcee5('0x2c')]['describe']()[_0xcee5('0x25')](respondWithResult(_0x371f8d,null))[_0xcee5('0x41')](handleError(_0x371f8d,null));}; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0a39280..b5ce5a0 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 _0x357e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x44d45a,_0x150d47){var _0x2e6c05=function(_0x4d22bd){while(--_0x4d22bd){_0x44d45a['push'](_0x44d45a['shift']());}};_0x2e6c05(++_0x150d47);}(_0x357e,0xc0));var _0xe357=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x357e[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xe357('0x0'));var util=require(_0xe357('0x1'));var logger=require(_0xe357('0x2'))(_0xe357('0x3'));var moment=require(_0xe357('0x4'));var BPromise=require(_0xe357('0x5'));var rp=require(_0xe357('0x6'));var fs=require('fs');var path=require(_0xe357('0x7'));var rimraf=require(_0xe357('0x8'));var config=require(_0xe357('0x9'));var attributes=require('./chatTransferReport.attributes');module[_0xe357('0xa')]=function(_0x25224,_0x43ad29){return _0x25224[_0xe357('0xb')]('ChatTransferReport',attributes,{'tableName':_0xe357('0xc'),'paranoid':![],'indexes':[{'name':_0xe357('0xd'),'fields':[_0xe357('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5584c79..5a43064 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 _0x9181=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x442f1a,_0x6ba7b1){var _0x187022=function(_0x48869b){while(--_0x48869b){_0x442f1a['push'](_0x442f1a['shift']());}};_0x187022(++_0x6ba7b1);}(_0x9181,0xc8));var _0x1918=function(_0x5a738e,_0x4d5c43){_0x5a738e=_0x5a738e-0x0;var _0x11bd18=_0x9181[_0x5a738e];return _0x11bd18;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var moment=require(_0x1918('0x2'));var BPromise=require(_0x1918('0x3'));var rs=require(_0x1918('0x4'));var fs=require('fs');var Redis=require(_0x1918('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1918('0x6'));var logger=require(_0x1918('0x7'))('rpc');var config=require(_0x1918('0x8'));var jayson=require(_0x1918('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56ef1e,_0x4a14f8,_0x173ce5){return new BPromise(function(_0x119fea,_0x2b3a0c){return client[_0x1918('0xa')](_0x56ef1e,_0x173ce5)[_0x1918('0xb')](function(_0x5050bc){logger[_0x1918('0xc')](_0x1918('0xd'),_0x4a14f8,_0x1918('0xe'));logger[_0x1918('0xf')](_0x1918('0x10'),_0x4a14f8,'request\x20sent',JSON[_0x1918('0x11')](_0x5050bc));if(_0x5050bc[_0x1918('0x12')]){if(_0x5050bc['error'][_0x1918('0x13')]===0x1f4){logger[_0x1918('0x12')](_0x1918('0xd'),_0x4a14f8,_0x5050bc[_0x1918('0x12')][_0x1918('0x14')]);return _0x2b3a0c(_0x5050bc[_0x1918('0x12')][_0x1918('0x14')]);}logger[_0x1918('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x4a14f8,_0x5050bc['error'][_0x1918('0x14')]);return _0x119fea(_0x5050bc['error'][_0x1918('0x14')]);}else{logger['info'](_0x1918('0xd'),_0x4a14f8,_0x1918('0xe'));_0x119fea(_0x5050bc['result']['message']);}})['catch'](function(_0x52585e){logger[_0x1918('0x12')](_0x1918('0xd'),_0x4a14f8,_0x52585e);_0x2b3a0c(_0x52585e);});});} \ No newline at end of file +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 diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7334e71..268d86e 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 _0x5084=['show','post','create','put','/:id','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x59a943,_0x11f767){var _0x691e42=function(_0x1f4ad9){while(--_0x1f4ad9){_0x59a943['push'](_0x59a943['shift']());}};_0x691e42(++_0x11f767);}(_0x5084,0x127));var _0x4508=function(_0x7c6b34,_0x133412){_0x7c6b34=_0x7c6b34-0x0;var _0xd529e7=_0x5084[_0x7c6b34];return _0xd529e7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4508('0x0'));var timeout=require(_0x4508('0x1'));var express=require(_0x4508('0x2'));var router=express[_0x4508('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4508('0x4'));var interaction=require(_0x4508('0x5'));var config=require(_0x4508('0x6'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x4508('0x7')](),controller[_0x4508('0x8')]);router[_0x4508('0x9')](_0x4508('0xa'),auth[_0x4508('0x7')](),controller['describe']);router[_0x4508('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4508('0xb')]);router[_0x4508('0xc')]('/',auth[_0x4508('0x7')](),controller[_0x4508('0xd')]);router[_0x4508('0xe')](_0x4508('0xf'),auth[_0x4508('0x7')](),controller[_0x4508('0x10')]);router['delete'](_0x4508('0xf'),auth[_0x4508('0x7')](),controller['destroy']);module[_0x4508('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 2e45eb0..e589b76 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 _0x3df2=['generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','sequelize','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','onlineForm','parse','getDataValue','Comments','Leave\x20your\x20comments','offlineForm','setDataValue'];(function(_0x5e57d4,_0x43f851){var _0x5a8e10=function(_0x2336b9){while(--_0x2336b9){_0x5e57d4['push'](_0x5e57d4['shift']());}};_0x5a8e10(++_0x43f851);}(_0x3df2,0x9d));var _0x23df=function(_0x4083f3,_0x3ca403){_0x4083f3=_0x4083f3-0x0;var _0x55acd4=_0x3df2[_0x4083f3];return _0x55acd4;};'use strict';var Sequelize=require(_0x23df('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x23df('0x1')]},'mapKey':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x2')},'mapKeyOffline':{'type':Sequelize[_0x23df('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x23df('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x23df('0x3')},'customerAlias':{'type':Sequelize[_0x23df('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'defaultValue':_0x23df('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'defaultValue':_0x23df('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'defaultValue':_0x23df('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x23df('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x23df('0x1')]},'animation':{'type':Sequelize[_0x23df('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x23df('0x8')](_0x23df('0x9'),'squared'),'defaultValue':_0x23df('0x9')},'header_online':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0xa')},'start_chat_button':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0xb')},'offline_chat_button':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0xc')},'header_offline':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0xd')},'download_transcript':{'type':Sequelize[_0x23df('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x23df('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x23df('0xf')]},'closingQuestion':{'type':Sequelize[_0x23df('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x23df('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x23df('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x23df('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x23df('0x13')},'closingMessageButton':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0xc')},'skipMessageButton':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x15')},'ratingType':{'type':Sequelize[_0x23df('0x8')](_0x23df('0x16'),_0x23df('0x17')),'defaultValue':_0x23df('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x23df('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x23df('0x18')]({'items':[{'type':_0x23df('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x23df('0x1a'),'required':!![]},'props':{'title':_0x23df('0x1b'),'helpText':''}},{'type':_0x23df('0x19'),'props':{'title':_0x23df('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x23df('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x23df('0x1c'))?JSON[_0x23df('0x1d')](this[_0x23df('0x1e')]('onlineForm')):{};},'set':function(_0x4ca14a){return this['setDataValue'](_0x23df('0x1c'),JSON['stringify'](_0x4ca14a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x23df('0x18')]({'items':[{'type':'input','props':{'title':_0x23df('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x23df('0x2'),'type':_0x23df('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':_0x23df('0x1f')},'props':{'title':_0x23df('0x1f'),'helpText':_0x23df('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x23df('0x21'))?JSON['parse'](this[_0x23df('0x1e')]('offlineForm')):{};},'set':function(_0x28b04b){return this[_0x23df('0x22')](_0x23df('0x21'),JSON[_0x23df('0x18')](_0x28b04b));}},'token':{'type':Sequelize[_0x23df('0x1')],'defaultValue':function(){return rs[_0x23df('0x23')]();}},'autoclose':{'type':Sequelize[_0x23df('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x23df('0x1')]},'forwardOffline':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x23df('0x1')]},'waitingTitle':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x24')},'waitingMessage':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x23df('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x23df('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x23df('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x23df('0x1')]},'notificationTemplate':{'type':Sequelize[_0x23df('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[_0x23df('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x23df('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x23df('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x29')},'messagesAlignment':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x2a')},'defaultTitle':{'type':Sequelize[_0x23df('0x1')]},'customerAvatar':{'type':Sequelize[_0x23df('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'defaultValue':_0x23df('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x23df('0x1')],'defaultValue':_0x23df('0x2c')},'systemAvatar':{'type':Sequelize[_0x23df('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x23df('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![],'comment':_0x23df('0x2e'),'set':function(_0x3beab0){if(!_0x3beab0)this[_0x23df('0x22')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x3beab0);}},'vidaooEscalation':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x23df('0x1')]},'vidaooTopic':{'type':Sequelize[_0x23df('0x1')],'allowNull':![],'defaultValue':_0x23df('0x2f')},'vidaooNote':{'type':Sequelize[_0x23df('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x23df('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x23df('0xf')]}}; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b041d21..0c3ad19 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 _0x8582=['messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','Start','startRouting','EventManager','offline','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','addInteraction','omit','Contact','Owner','internal','Tag','Tags','color','tag','virtual','custom','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','address','origin','3.5.0','remote','x-real-ip','connection','remoteAddress','referer','replace','verticalAlignment','textColor','backgroundColor','hideWhenOffline','addApplications','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','APIOutOfIntervalError','../../errors/api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','map','Interval','Intervals','all','some','user-agent-parser','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','%s\x20%s','version','unknown','device','model','vendor','type','fieldName','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','ChatWebsite','includeAll','rows','params','mandatoryDispositionPause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','ChatWebsiteId','Disposition','findOne','include','findAll','removeDispositions','CannedAnswer','rawAttributes','removeAnswers','ids','addLogo','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','file','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey','includes','List','Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','asc','from','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact'];(function(_0x762d25,_0x2a0f34){var _0x15d568=function(_0x2ad0f9){while(--_0x2ad0f9){_0x762d25['push'](_0x762d25['shift']());}};_0x15d568(++_0x2a0f34);}(_0x8582,0x70));var _0x2858=function(_0x5a3534,_0x3034ae){_0x5a3534=_0x5a3534-0x0;var _0x7aaa66=_0x8582[_0x5a3534];return _0x7aaa66;};'use strict';var Mustache=require(_0x2858('0x0'));var util=require(_0x2858('0x1'));var path=require(_0x2858('0x2'));var ejs=require(_0x2858('0x3'));var fs=require('fs');var fs_extra=require(_0x2858('0x4'));var _=require(_0x2858('0x5'));var querystring=require(_0x2858('0x6'));var htmlToText=require('html-to-text');var Redis=require(_0x2858('0x7'));var jayson=require(_0x2858('0x8'));var url=require(_0x2858('0x9'));var qs=require(_0x2858('0xa'));var logger=require(_0x2858('0xb'))('api');var config=require('../../config/environment');var APIOutOfIntervalError=require('../../errors/api')[_0x2858('0xc')];var APINotFoundError=require(_0x2858('0xd'))['APINotFoundError'];var APIHandleError=require(_0x2858('0xd'))['handleError'];var db=require(_0x2858('0xe'))['db'];config[_0x2858('0xf')]=_[_0x2858('0x10')](config[_0x2858('0xf')],{'host':_0x2858('0x11'),'port':0x18eb});var socket=require(_0x2858('0x12'))(new Redis(config[_0x2858('0xf')]));require(_0x2858('0x13'))[_0x2858('0x14')](socket);var client=jayson[_0x2858('0x15')][_0x2858('0x16')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0x2858('0x15')][_0x2858('0x16')]({'port':0x232b});var client9001=jayson[_0x2858('0x15')][_0x2858('0x16')]({'port':0x2329});function respondWithRpcPromise(_0xc0889e,_0x3faffe,_0xcd58d0,_0x3acdbc){return new Promise(function(_0x254420,_0x1a8ab8){var _0xb475ad=_0x3acdbc||client;return _0xb475ad['request'](_0xc0889e,_0xcd58d0)[_0x2858('0x17')](function(_0x407acd){logger[_0x2858('0x18')](_0x2858('0x19'),_0x3faffe,'request\x20sent');logger['debug'](_0x2858('0x1a'),_0x3faffe,'request\x20sent',JSON[_0x2858('0x1b')](_0x407acd));if(_0x407acd[_0x2858('0x1c')]){if(_0x407acd[_0x2858('0x1c')][_0x2858('0x1d')]===0x1f4){logger['error'](_0x2858('0x19'),_0x3faffe,_0x407acd['error'][_0x2858('0x1e')]);return _0x1a8ab8(_0x407acd[_0x2858('0x1c')]['message']);}logger[_0x2858('0x1c')](_0x2858('0x19'),_0x3faffe,_0x407acd[_0x2858('0x1c')]['message']);return _0x254420(_0x407acd['error'][_0x2858('0x1e')]);}else{logger[_0x2858('0x18')](_0x2858('0x19'),_0x3faffe,'request\x20sent');_0x254420(_0x407acd[_0x2858('0x1f')]['message']);}})[_0x2858('0x20')](function(_0x4aadf2){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3faffe,_0x4aadf2);_0x1a8ab8(_0x4aadf2);});});}function respondWithStatusCode(_0x9b3463,_0x44d371){_0x44d371=_0x44d371||0xcc;return function(_0x4eb333){if(_0x4eb333){return _0x9b3463[_0x2858('0x21')](_0x44d371);}return _0x9b3463[_0x2858('0x22')](_0x44d371)[_0x2858('0x23')]();};}function respondWithResult(_0x55dc0e,_0x2b25fb){_0x2b25fb=_0x2b25fb||0xc8;return function(_0x455050){if(_0x455050){return _0x55dc0e[_0x2858('0x22')](_0x2b25fb)[_0x2858('0x24')](_0x455050);}};}function respondWithFilteredResult(_0x5d5f50,_0x5a5cc6){return function(_0x46c358){if(_0x46c358){var _0x4672e3=typeof _0x5a5cc6[_0x2858('0x25')]===_0x2858('0x26')&&typeof _0x5a5cc6[_0x2858('0x27')]===_0x2858('0x26');var _0x506d32=_0x46c358[_0x2858('0x28')];var _0x4cb1db=_0x4672e3?0x0:_0x5a5cc6[_0x2858('0x25')];var _0x149983=_0x4672e3?_0x46c358[_0x2858('0x28')]:_0x5a5cc6[_0x2858('0x25')]+_0x5a5cc6[_0x2858('0x27')];var _0x2beb9e;if(_0x149983>=_0x506d32){_0x149983=_0x506d32;_0x2beb9e=0xc8;}else{_0x2beb9e=0xce;}_0x5d5f50[_0x2858('0x22')](_0x2beb9e);return _0x5d5f50[_0x2858('0x29')](_0x2858('0x2a'),_0x4cb1db+'-'+_0x149983+'/'+_0x506d32)[_0x2858('0x24')](_0x46c358);}return null;};}function saveUpdates(_0x5fb4f6){return function(_0x1b9818){if(_0x1b9818){return _0x1b9818[_0x2858('0x2b')](_0x5fb4f6)[_0x2858('0x17')](function(_0x1cb4ab){return _0x1cb4ab;});}return null;};}function removeEntity(_0x50a484){return function(_0x1f0639){if(_0x1f0639){return _0x1f0639[_0x2858('0x2c')]()['then'](function(){var _0x48860c=_0x1f0639[_0x2858('0x2d')]({'plain':!![]});var _0x1aa7ce=_0x2858('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x1aa7ce,'resourceId':_0x48860c['id']}})[_0x2858('0x17')](function(){return _0x1f0639;});})[_0x2858('0x17')](function(){_0x50a484['status'](0xcc)[_0x2858('0x23')]();});}};}function handleEntityNotFound(_0x1ce6ff){return function(_0x5c3f48){if(!_0x5c3f48){_0x1ce6ff[_0x2858('0x21')](0x194);}return _0x5c3f48;};}function handleError(_0x4ceeb7,_0x3eaf03){_0x3eaf03=_0x3eaf03||0x1f4;return function(_0x5dff78){logger[_0x2858('0x1c')](_0x5dff78[_0x2858('0x2f')]);if(_0x5dff78[_0x2858('0x30')]){delete _0x5dff78[_0x2858('0x30')];}_0x4ceeb7[_0x2858('0x22')](_0x3eaf03)[_0x2858('0x31')](_0x5dff78);};}function iftimePromise(_0x3e63ff,_0x49f18b){return respondWithRpcPromise('Command',_0x2858('0x32'),{'command':_0x49f18b[_0x2858('0x33')]?util[_0x2858('0x34')](_0x2858('0x35'),_0x3e63ff[_0x2858('0x36')],_0x49f18b[_0x2858('0x33')]):util[_0x2858('0x34')](_0x2858('0x37'),_0x3e63ff[_0x2858('0x36')])},client9002)[_0x2858('0x17')](function(_0x5d12a9){var _0x173365=_0x5d12a9&&_0x5d12a9[_0x2858('0x38')](_0x2858('0x39'))>=0x0?!![]:![];logger['info'](_0x2858('0x3a'),_0x49f18b['id'],_0x3e63ff['id'],_0x3e63ff[_0x2858('0x36')],_0x173365?_0x2858('0x3b'):_0x2858('0x3c'),_0x49f18b['timezone']?_0x49f18b[_0x2858('0x33')]:'No\x20timezone');return _0x173365;})[_0x2858('0x20')](function(_0x1f2f86){logger[_0x2858('0x1c')](_0x2858('0x3a'),_0x49f18b['id'],_0x3e63ff['id'],_0x3e63ff['interval'],util[_0x2858('0x3d')](_0x1f2f86,{'showHidden':![],'depth':null}),_0x49f18b[_0x2858('0x33')]?_0x49f18b['timezone']:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0x4b92c0){var _0x1e91c0=_[_0x2858('0x3e')](_0x4b92c0[_0x2858('0x3f')][_0x2858('0x40')],function(_0x1f40f6){var _0x120e36=_0x1f40f6[_0x2858('0x2d')]({'plain':!![]});return iftimePromise(_0x120e36,_0x4b92c0);});return Promise[_0x2858('0x41')](_0x1e91c0)['then'](function(_0x2b769c){return _[_0x2858('0x42')](_0x2b769c);});}function createInteractionObject(_0x364083,_0xcbe878,_0x5cb9ae,_0x3bba7d){var _0x39d7ea=require(_0x2858('0x43'));var _0x14b67f=new _0x39d7ea();var _0x90dd3b=_0x14b67f['setUA'](_0x5cb9ae['user-agent'])['getResult']();var _0x1ca860=_0xcbe878[_0x2858('0x44')];if(_0x5cb9ae[_0x2858('0x45')]){_0x1ca860=_0x5cb9ae[_0x2858('0x45')];}else if(_0x5cb9ae[_0x2858('0x46')]){_0x1ca860=_[_0x2858('0x47')](_0x5cb9ae[_0x2858('0x46')][_0x2858('0x48')](','));}return{'ContactId':_0x3bba7d['id'],'ChatWebsiteId':_0x364083,'from':(_0x3bba7d[_0x2858('0x49')]||'')+'\x20'+(_0x3bba7d[_0x2858('0x4a')]||''),'customerIp':_0x1ca860,'customerPort':_0x5cb9ae[_0x2858('0x4b')]?_0x5cb9ae[_0x2858('0x4b')]:null,'referer':_0xcbe878['referer'],'browserName':_0x90dd3b[_0x2858('0x4c')]['name']&&_0x90dd3b[_0x2858('0x4c')]['version']?util[_0x2858('0x34')](_0x2858('0x4d'),_0x90dd3b[_0x2858('0x4c')][_0x2858('0x30')],_0x90dd3b[_0x2858('0x4c')][_0x2858('0x4e')]):_0x2858('0x4f'),'browserVersion':_0x90dd3b[_0x2858('0x4c')][_0x2858('0x4e')]||_0x2858('0x4f'),'osName':util['format'](_0x2858('0x4d'),_0x90dd3b['os'][_0x2858('0x30')],_0x90dd3b['os']['version']),'osVersion':_0x90dd3b['os'][_0x2858('0x4e')],'deviceModel':_0x90dd3b[_0x2858('0x50')][_0x2858('0x51')]&&_0x90dd3b[_0x2858('0x50')]['vendor']?util[_0x2858('0x34')]('%s\x20%s\x20%s',_0x90dd3b[_0x2858('0x50')][_0x2858('0x51')],_0x90dd3b[_0x2858('0x50')][_0x2858('0x52')],_0x90dd3b['device'][_0x2858('0x53')]):null,'deviceVendor':_0x90dd3b[_0x2858('0x50')][_0x2858('0x52')],'deviceType':_0x90dd3b[_0x2858('0x50')]['type'],'formData':JSON[_0x2858('0x1b')](_0xcbe878)};}exports['index']=function(_0x472446,_0x473d0d){var _0x367367={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3f8b35={},_0x239d62={'count':0x0,'rows':[]};var _0x3d9025=_['map'](db['ChatWebsite']['rawAttributes'],function(_0x123210){return{'name':_0x123210[_0x2858('0x54')],'type':_0x123210[_0x2858('0x53')]['key']};});_0x3f8b35['model']=_['map'](_0x3d9025,_0x2858('0x30'));_0x3f8b35[_0x2858('0x55')]=_[_0x2858('0x56')](_0x472446[_0x2858('0x55')]);_0x3f8b35[_0x2858('0x57')]=_[_0x2858('0x58')](_0x3f8b35[_0x2858('0x51')],_0x3f8b35[_0x2858('0x55')]);_0x367367[_0x2858('0x59')]=_[_0x2858('0x58')](_0x3f8b35[_0x2858('0x51')],qs[_0x2858('0x5a')](_0x472446['query'][_0x2858('0x5a')]));_0x367367[_0x2858('0x59')]=_0x367367[_0x2858('0x59')][_0x2858('0x5b')]?_0x367367[_0x2858('0x59')]:_0x3f8b35[_0x2858('0x51')];if(!_0x472446[_0x2858('0x55')][_0x2858('0x5c')](_0x2858('0x5d'))){_0x367367[_0x2858('0x27')]=qs[_0x2858('0x27')](_0x472446['query'][_0x2858('0x27')]);_0x367367[_0x2858('0x25')]=qs[_0x2858('0x25')](_0x472446[_0x2858('0x55')][_0x2858('0x25')]);}_0x367367[_0x2858('0x5e')]=qs['sort'](_0x472446[_0x2858('0x55')][_0x2858('0x5f')]);_0x367367['where']=qs[_0x2858('0x57')](_[_0x2858('0x60')](_0x472446[_0x2858('0x55')],_0x3f8b35[_0x2858('0x57')]),_0x3d9025);if(_0x472446['query'][_0x2858('0x61')]){_0x367367[_0x2858('0x62')]=_[_0x2858('0x63')](_0x367367[_0x2858('0x62')],{'$or':_[_0x2858('0x3e')](_0x3d9025,function(_0x2a324b){if(_0x2a324b[_0x2858('0x53')]!=='VIRTUAL'){var _0x2f5a9b={};_0x2f5a9b[_0x2a324b[_0x2858('0x30')]]={'$like':'%'+_0x472446['query'][_0x2858('0x61')]+'%'};return _0x2f5a9b;}})});}_0x367367=_[_0x2858('0x63')]({},_0x367367,_0x472446['options']);var _0x1eb2bc={'where':_0x367367[_0x2858('0x62')]};return db[_0x2858('0x64')]['count'](_0x1eb2bc)[_0x2858('0x17')](function(_0x2f20fc){_0x239d62[_0x2858('0x28')]=_0x2f20fc;if(_0x472446[_0x2858('0x55')][_0x2858('0x65')]){_0x367367['include']=[{'all':!![]}];}return db[_0x2858('0x64')]['findAll'](_0x367367);})['then'](function(_0x5d8c8d){_0x239d62[_0x2858('0x66')]=_0x5d8c8d;return _0x239d62;})[_0x2858('0x17')](respondWithFilteredResult(_0x473d0d,_0x367367))['catch'](handleError(_0x473d0d,null));};exports['show']=function(_0x4f761a,_0x5f0429){var _0x5dc878={'raw':![],'where':{'id':_0x4f761a[_0x2858('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0x2858('0x68')}]},_0x220212={};_0x220212[_0x2858('0x51')]=_[_0x2858('0x56')](db['ChatWebsite']['rawAttributes']);_0x220212[_0x2858('0x55')]=_[_0x2858('0x56')](_0x4f761a[_0x2858('0x55')]);_0x220212[_0x2858('0x57')]=_[_0x2858('0x58')](_0x220212['model'],_0x220212[_0x2858('0x55')]);_0x5dc878[_0x2858('0x59')]=_[_0x2858('0x58')](_0x220212['model'],qs[_0x2858('0x5a')](_0x4f761a[_0x2858('0x55')]['fields']));_0x5dc878[_0x2858('0x59')]=_0x5dc878['attributes'][_0x2858('0x5b')]?_0x5dc878['attributes']:_0x220212[_0x2858('0x51')];if(_0x4f761a[_0x2858('0x55')][_0x2858('0x65')]){_0x5dc878['include']=[{'all':!![]}];}_0x5dc878=_[_0x2858('0x63')]({},_0x5dc878,_0x4f761a[_0x2858('0x69')]);return db[_0x2858('0x64')][_0x2858('0x6a')](_0x5dc878)[_0x2858('0x17')](handleEntityNotFound(_0x5f0429,null))[_0x2858('0x17')](respondWithResult(_0x5f0429,null))[_0x2858('0x20')](handleError(_0x5f0429,null));};exports[_0x2858('0x6b')]=function(_0x1d5fda,_0x32bdce){return db['ChatWebsite'][_0x2858('0x6b')](_0x1d5fda[_0x2858('0x6c')],{})[_0x2858('0x17')](function(_0x149762){var _0x3064a3=_0x1d5fda[_0x2858('0x6d')]['get']({'plain':!![]});if(!_0x3064a3)throw new Error(_0x2858('0x6e'));if(_0x3064a3['role']===_0x2858('0x6d')){var _0x4124ab=_0x149762['get']({'plain':!![]});var _0x3cb026=_0x2858('0x2e');return db[_0x2858('0x6f')][_0x2858('0x6a')]({'where':{'name':_0x3cb026,'userProfileId':_0x3064a3[_0x2858('0x70')]},'raw':!![]})[_0x2858('0x17')](function(_0x3d905d){if(_0x3d905d&&_0x3d905d[_0x2858('0x71')]===0x0){return db[_0x2858('0x72')][_0x2858('0x6b')]({'name':_0x4124ab[_0x2858('0x30')],'resourceId':_0x4124ab['id'],'type':_0x3d905d[_0x2858('0x30')],'sectionId':_0x3d905d['id']},{})[_0x2858('0x17')](function(){return _0x149762;});}else{return _0x149762;}})[_0x2858('0x20')](function(_0xf731de){logger['error'](_0x2858('0x73'),_0xf731de);throw _0xf731de;});}return _0x149762;})[_0x2858('0x17')](respondWithResult(_0x32bdce,0xc9))[_0x2858('0x20')](handleError(_0x32bdce,null));};exports[_0x2858('0x2b')]=function(_0x448bb1,_0x63a02c){if(_0x448bb1[_0x2858('0x6c')]['id']){delete _0x448bb1[_0x2858('0x6c')]['id'];}return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x448bb1[_0x2858('0x67')]['id']},'include':[{'model':db[_0x2858('0x74')],'as':_0x2858('0x68')}]})[_0x2858('0x17')](handleEntityNotFound(_0x63a02c,null))[_0x2858('0x17')](saveUpdates(_0x448bb1[_0x2858('0x6c')],null))[_0x2858('0x17')](respondWithResult(_0x63a02c,null))[_0x2858('0x20')](handleError(_0x63a02c,null));};exports[_0x2858('0x2c')]=function(_0x327a8c,_0x139945){return db['ChatWebsite'][_0x2858('0x6a')]({'where':{'id':_0x327a8c['params']['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x139945,null))[_0x2858('0x17')](removeEntity(_0x139945,null))[_0x2858('0x20')](handleError(_0x139945,null));};exports['describe']=function(_0x4634f4,_0x17e65d){return db['ChatWebsite'][_0x2858('0x75')]()[_0x2858('0x17')](respondWithResult(_0x17e65d,null))['catch'](handleError(_0x17e65d,null));};exports[_0x2858('0x76')]=function(_0x5d28a1,_0x53b744){if(_0x5d28a1['body']['id']){delete _0x5d28a1[_0x2858('0x6c')]['id'];}return db[_0x2858('0x64')]['find']({'where':{'id':_0x5d28a1[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x53b744,null))['then'](function(_0x4758b3){if(_0x4758b3){_0x5d28a1[_0x2858('0x6c')][_0x2858('0x77')]=_0x4758b3['id'];return db[_0x2858('0x78')][_0x2858('0x6b')](_0x5d28a1[_0x2858('0x6c')]);}})['then'](respondWithResult(_0x53b744,null))[_0x2858('0x20')](handleError(_0x53b744,null));};exports['getDispositions']=function(_0x159dfe,_0x587db4){var _0x39711b={'raw':![],'where':{}};var _0x334a74={};var _0x25f14b={'count':0x0,'rows':[]};return db[_0x2858('0x64')][_0x2858('0x79')]({'where':{'id':_0x159dfe['params']['id']}})['then'](handleEntityNotFound(_0x587db4,null))[_0x2858('0x17')](function(_0x1aab1f){if(_0x1aab1f){_0x334a74[_0x2858('0x51')]=_[_0x2858('0x56')](db[_0x2858('0x78')]['rawAttributes']);_0x334a74[_0x2858('0x55')]=_[_0x2858('0x56')](_0x159dfe[_0x2858('0x55')]);_0x334a74[_0x2858('0x57')]=_[_0x2858('0x58')](_0x334a74['model'],_0x334a74[_0x2858('0x55')]);_0x39711b[_0x2858('0x59')]=_[_0x2858('0x58')](_0x334a74['model'],qs[_0x2858('0x5a')](_0x159dfe[_0x2858('0x55')]['fields']));_0x39711b[_0x2858('0x59')]=_0x39711b[_0x2858('0x59')][_0x2858('0x5b')]?_0x39711b['attributes']:_0x334a74[_0x2858('0x51')];if(!_0x159dfe[_0x2858('0x55')][_0x2858('0x5c')](_0x2858('0x5d'))){_0x39711b[_0x2858('0x27')]=qs['limit'](_0x159dfe['query']['limit']);_0x39711b[_0x2858('0x25')]=qs['offset'](_0x159dfe[_0x2858('0x55')][_0x2858('0x25')]);}_0x39711b[_0x2858('0x5e')]=qs[_0x2858('0x5f')](_0x159dfe[_0x2858('0x55')][_0x2858('0x5f')]);_0x39711b[_0x2858('0x62')]=qs[_0x2858('0x57')](_[_0x2858('0x60')](_0x159dfe[_0x2858('0x55')],_0x334a74['filters']));_0x39711b['where'][_0x2858('0x77')]=_0x1aab1f['id'];if(_0x159dfe[_0x2858('0x55')][_0x2858('0x61')]){_0x39711b['where']=_[_0x2858('0x63')](_0x39711b[_0x2858('0x62')],{'$or':_[_0x2858('0x3e')](_0x39711b[_0x2858('0x59')],function(_0x18e0a1){var _0x5ca8ae={};_0x5ca8ae[_0x18e0a1]={'$like':'%'+_0x159dfe[_0x2858('0x55')][_0x2858('0x61')]+'%'};return _0x5ca8ae;})});}_0x39711b=_[_0x2858('0x63')]({},_0x39711b,_0x159dfe[_0x2858('0x69')]);return db[_0x2858('0x78')][_0x2858('0x28')]({'where':_0x39711b[_0x2858('0x62')]})[_0x2858('0x17')](function(_0x5bac13){_0x25f14b[_0x2858('0x28')]=_0x5bac13;if(_0x159dfe[_0x2858('0x55')][_0x2858('0x65')]){_0x39711b[_0x2858('0x7a')]=[{'all':!![]}];}return db['Disposition'][_0x2858('0x7b')](_0x39711b);})[_0x2858('0x17')](function(_0x11aa4e){_0x25f14b[_0x2858('0x66')]=_0x11aa4e;return _0x25f14b;});}})[_0x2858('0x17')](respondWithFilteredResult(_0x587db4,_0x39711b))[_0x2858('0x20')](handleError(_0x587db4,null));};exports['removeDispositions']=function(_0x2048e4,_0x28f553){return db[_0x2858('0x64')]['find']({'where':{'id':_0x2048e4['params']['id']}})['then'](handleEntityNotFound(_0x28f553,null))[_0x2858('0x17')](function(_0x182ff7){if(_0x182ff7){return _0x182ff7[_0x2858('0x7c')](_0x2048e4[_0x2858('0x55')]['ids']);}})[_0x2858('0x17')](respondWithStatusCode(_0x28f553,null))['catch'](handleError(_0x28f553,null));};exports['addAnswer']=function(_0x2e7351,_0x5d8c1f){if(_0x2e7351['body']['id']){delete _0x2e7351[_0x2858('0x6c')]['id'];}return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x2e7351[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x5d8c1f,null))[_0x2858('0x17')](function(_0xd3daa7){if(_0xd3daa7){_0x2e7351[_0x2858('0x6c')][_0x2858('0x77')]=_0xd3daa7['id'];return db[_0x2858('0x7d')][_0x2858('0x6b')](_0x2e7351[_0x2858('0x6c')]);}})[_0x2858('0x17')](respondWithResult(_0x5d8c1f,null))[_0x2858('0x20')](handleError(_0x5d8c1f,null));};exports['getAnswers']=function(_0x52d15a,_0x3cd0a1){var _0x30a483={'raw':![],'where':{}};var _0x551421={};var _0x165a61={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2858('0x79')]({'where':{'id':_0x52d15a[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x3cd0a1,null))[_0x2858('0x17')](function(_0x3e040c){if(_0x3e040c){_0x551421['model']=_[_0x2858('0x56')](db[_0x2858('0x7d')][_0x2858('0x7e')]);_0x551421[_0x2858('0x55')]=_[_0x2858('0x56')](_0x52d15a['query']);_0x551421['filters']=_['intersection'](_0x551421[_0x2858('0x51')],_0x551421[_0x2858('0x55')]);_0x30a483['attributes']=_[_0x2858('0x58')](_0x551421['model'],qs[_0x2858('0x5a')](_0x52d15a['query'][_0x2858('0x5a')]));_0x30a483[_0x2858('0x59')]=_0x30a483[_0x2858('0x59')][_0x2858('0x5b')]?_0x30a483[_0x2858('0x59')]:_0x551421[_0x2858('0x51')];if(!_0x52d15a['query'][_0x2858('0x5c')](_0x2858('0x5d'))){_0x30a483[_0x2858('0x27')]=qs[_0x2858('0x27')](_0x52d15a[_0x2858('0x55')]['limit']);_0x30a483['offset']=qs[_0x2858('0x25')](_0x52d15a[_0x2858('0x55')][_0x2858('0x25')]);}_0x30a483[_0x2858('0x5e')]=qs[_0x2858('0x5f')](_0x52d15a[_0x2858('0x55')][_0x2858('0x5f')]);_0x30a483[_0x2858('0x62')]=qs[_0x2858('0x57')](_['pick'](_0x52d15a[_0x2858('0x55')],_0x551421['filters']));_0x30a483[_0x2858('0x62')][_0x2858('0x77')]=_0x3e040c['id'];if(_0x52d15a[_0x2858('0x55')]['filter']){_0x30a483[_0x2858('0x62')]=_[_0x2858('0x63')](_0x30a483[_0x2858('0x62')],{'$or':_[_0x2858('0x3e')](_0x30a483[_0x2858('0x59')],function(_0x41f377){var _0x3ac60c={};_0x3ac60c[_0x41f377]={'$like':'%'+_0x52d15a['query']['filter']+'%'};return _0x3ac60c;})});}_0x30a483=_['merge']({},_0x30a483,_0x52d15a[_0x2858('0x69')]);return db[_0x2858('0x7d')][_0x2858('0x28')]({'where':_0x30a483[_0x2858('0x62')]})[_0x2858('0x17')](function(_0x4c1c46){_0x165a61[_0x2858('0x28')]=_0x4c1c46;if(_0x52d15a['query'][_0x2858('0x65')]){_0x30a483[_0x2858('0x7a')]=[{'all':!![]}];}return db[_0x2858('0x7d')][_0x2858('0x7b')](_0x30a483);})[_0x2858('0x17')](function(_0x3232cf){_0x165a61[_0x2858('0x66')]=_0x3232cf;return _0x165a61;});}})[_0x2858('0x17')](respondWithFilteredResult(_0x3cd0a1,_0x30a483))[_0x2858('0x20')](handleError(_0x3cd0a1,null));};exports[_0x2858('0x7f')]=function(_0x48ff8d,_0x13b236){return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x48ff8d['params']['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x13b236,null))['then'](function(_0x429ef2){if(_0x429ef2){return _0x429ef2[_0x2858('0x7f')](_0x48ff8d[_0x2858('0x55')][_0x2858('0x80')]);}})[_0x2858('0x17')](respondWithStatusCode(_0x13b236,null))[_0x2858('0x20')](handleError(_0x13b236,null));};exports[_0x2858('0x81')]=function(_0x944daf,_0x40fb35){_0x944daf[_0x2858('0x6c')][_0x2858('0x82')]=_0x944daf['file'][_0x2858('0x83')];return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x944daf[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x40fb35,null))[_0x2858('0x17')](saveUpdates(_0x944daf['body'],null))['then'](respondWithResult(_0x40fb35,null))[_0x2858('0x20')](handleError(_0x40fb35,null));};exports[_0x2858('0x84')]=function(_0x319edb,_0x74c208){_0x319edb['body'][_0x2858('0x85')]=_0x319edb['file'][_0x2858('0x83')];return db[_0x2858('0x64')]['find']({'where':{'id':_0x319edb[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x74c208,null))['then'](saveUpdates(_0x319edb['body'],null))['then'](respondWithResult(_0x74c208,null))['catch'](handleError(_0x74c208,null));};exports[_0x2858('0x86')]=function(_0x2c2242,_0x422bc2){_0x2c2242[_0x2858('0x6c')][_0x2858('0x87')]=_0x2c2242[_0x2858('0x88')]['filename'];return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x2c2242[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x422bc2,null))[_0x2858('0x17')](saveUpdates(_0x2c2242['body'],null))[_0x2858('0x17')](respondWithResult(_0x422bc2,null))[_0x2858('0x20')](handleError(_0x422bc2,null));};exports['addSystemAvatar']=function(_0x1a69be,_0x14beb9){_0x1a69be[_0x2858('0x6c')][_0x2858('0x89')]=_0x1a69be[_0x2858('0x88')][_0x2858('0x83')];return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x1a69be[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x14beb9,null))[_0x2858('0x17')](saveUpdates(_0x1a69be[_0x2858('0x6c')],null))[_0x2858('0x17')](respondWithResult(_0x14beb9,null))[_0x2858('0x20')](handleError(_0x14beb9,null));};exports[_0x2858('0x8a')]=function(_0x13c28f,_0x3e00aa){var _0x5eee41=path[_0x2858('0x8b')](config['root'],_0x2858('0x8c'));var _0x271c23={'where':{'id':_0x13c28f[_0x2858('0x67')]['id']},'attributes':['id',_0x2858('0x82')],'raw':!![]};var _0x2391f7=![];return require(_0x2858('0x8d'))['getLicense']()[_0x2858('0x17')](function(_0x3496f9){if(_0x3496f9){_0x2391f7=_0x3496f9['custom'];}})['then'](function(){return db[_0x2858('0x64')][_0x2858('0x6a')](_0x271c23);})[_0x2858('0x17')](handleEntityNotFound(_0x3e00aa,null))[_0x2858('0x17')](function(_0x1baa58){if(_0x1baa58){if(!_[_0x2858('0x8e')](_0x1baa58[_0x2858('0x82')])){if(fs[_0x2858('0x8f')](path[_0x2858('0x8b')](config[_0x2858('0x90')],'server/files/images/logos/',_0x1baa58[_0x2858('0x82')]))&&_0x2391f7){_0x5eee41=path['join'](config[_0x2858('0x90')],_0x2858('0x91'),_0x1baa58['sitepic']);}}return _0x3e00aa[_0x2858('0x92')](_0x5eee41);}})[_0x2858('0x20')](handleError(_0x3e00aa,null));};exports[_0x2858('0x93')]=function(_0x5c497f,_0x35a586){var _0x7334ce=path['join'](config[_0x2858('0x90')],'server/files/images/avatars/default_avatar.png');var _0x2bd3ef={'where':{'id':_0x5c497f[_0x2858('0x67')]['id']},'attributes':['id',_0x2858('0x85')],'raw':!![]};return db[_0x2858('0x64')]['find'](_0x2bd3ef)[_0x2858('0x17')](handleEntityNotFound(_0x35a586,null))[_0x2858('0x17')](function(_0x2345eb){if(_0x2345eb){if(!_[_0x2858('0x8e')](_0x2345eb[_0x2858('0x85')])){if(fs[_0x2858('0x8f')](path[_0x2858('0x8b')](config['root'],_0x2858('0x94'),_0x2345eb[_0x2858('0x85')]))){_0x7334ce=path['join'](config['root'],_0x2858('0x94'),_0x2345eb[_0x2858('0x85')]);}}return _0x35a586[_0x2858('0x92')](_0x7334ce);}})[_0x2858('0x20')](handleError(_0x35a586,null));};exports[_0x2858('0x95')]=function(_0x4a8a3f,_0x206aa9){var _0x1c5ac6=path[_0x2858('0x8b')](config[_0x2858('0x90')],_0x2858('0x96'));var _0x506d1c={'where':{'id':_0x4a8a3f['params']['id']},'attributes':['id',_0x2858('0x87'),'showCustomerAvatar'],'raw':!![]};return db[_0x2858('0x64')][_0x2858('0x6a')](_0x506d1c)[_0x2858('0x17')](handleEntityNotFound(_0x206aa9,null))['then'](function(_0x474d1e){if(_0x474d1e){if(!_['isNil'](_0x474d1e['customerAvatar'])){if(fs[_0x2858('0x8f')](path['join'](config[_0x2858('0x90')],_0x2858('0x94'),_0x474d1e[_0x2858('0x87')]))&&_0x474d1e['showCustomerAvatar']){_0x1c5ac6=path[_0x2858('0x8b')](config[_0x2858('0x90')],_0x2858('0x94'),_0x474d1e[_0x2858('0x87')]);}}return _0x206aa9[_0x2858('0x92')](_0x1c5ac6);}})[_0x2858('0x20')](handleError(_0x206aa9,null));};exports[_0x2858('0x97')]=function(_0x15bb1c,_0x186f61){var _0x3f1863=path[_0x2858('0x8b')](config['root'],_0x2858('0x98'));var _0x14aa15={'where':{'id':_0x15bb1c[_0x2858('0x67')]['id']},'attributes':['id',_0x2858('0x89')],'raw':!![]};return db[_0x2858('0x64')][_0x2858('0x6a')](_0x14aa15)['then'](handleEntityNotFound(_0x186f61,null))['then'](function(_0x57985a){if(_0x57985a){if(!_['isNil'](_0x57985a[_0x2858('0x89')])){if(fs[_0x2858('0x8f')](path[_0x2858('0x8b')](config[_0x2858('0x90')],_0x2858('0x94'),_0x57985a[_0x2858('0x89')]))){_0x3f1863=path[_0x2858('0x8b')](config[_0x2858('0x90')],_0x2858('0x94'),_0x57985a[_0x2858('0x89')]);}}return _0x186f61[_0x2858('0x92')](_0x3f1863);}})[_0x2858('0x20')](handleError(_0x186f61,null));};exports[_0x2858('0x99')]=function(_0x399e25,_0x3317fa){var _0x21f4b8={'body':_0x399e25[_0x2858('0x6c')],'channel':_0x2858('0x9a')};var _0x416ed5=[];var _0x2273db=[];var _0x4960e6={};var _0x56edc7=![];return db[_0x2858('0x9b')][_0x2858('0x75')]()[_0x2858('0x17')](function(_0x36edea){if(!_0x36edea){throw new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))](_0x2858('0x9e'));}_0x416ed5=_[_0x2858('0x9f')](_[_0x2858('0x56')](_0x36edea),[_0x2858('0xa0'),_0x2858('0xa1')]);_0x2273db=_['difference'](_[_0x2858('0x56')](_0x36edea),['createdAt','updatedAt',_0x2858('0xa2'),_0x2858('0xa3')]);if(_0x399e25[_0x2858('0x6c')]['id']){delete _0x399e25[_0x2858('0x6c')]['id'];}if(_[_0x2858('0x8e')](_0x399e25[_0x2858('0x6c')]['from'])){throw new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))](_0x2858('0xa4'));}if(_[_0x2858('0x8e')](_0x399e25[_0x2858('0x6c')][_0x2858('0x6c')])||_0x399e25[_0x2858('0x6c')][_0x2858('0x6c')]===''){throw new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x399e25[_0x2858('0x6c')][_0x2858('0xa5')])){throw new db[(_0x2858('0x9c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2273db);}if(!_[_0x2858('0xa6')](_0x2273db,_0x399e25['body'][_0x2858('0xa5')])){throw new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2273db);}_0x4960e6[_0x399e25['body']['mapKey']]=_0x399e25[_0x2858('0x6c')]['from'];})[_0x2858('0x17')](function(){return db['ChatWebsite'][_0x2858('0x6a')]({'where':{'id':_0x399e25['params']['id']},'include':[{'model':db['CmList'],'as':_0x2858('0xa7'),'include':[{'model':db[_0x2858('0x9b')],'as':_0x2858('0xa8'),'where':_0x4960e6,'limit':0x1,'order':[[_0x2858('0xa1'),_0x2858('0xa9')]]}]},{'model':db[_0x2858('0xaa')],'as':_0x2858('0xab')},{'model':db[_0x2858('0x3f')],'as':_0x2858('0x3f'),'include':[{'model':db[_0x2858('0x3f')],'as':_0x2858('0x40'),'attributes':['id','interval'],'raw':!![]}]}]});})['then'](function(_0x750feb){if(!_0x750feb)throw new APINotFoundError(util[_0x2858('0x34')](_0x2858('0xac'),_0x399e25['params']['id']));if(!_0x750feb['Interval']||!_0x750feb[_0x2858('0x3f')]['Intervals'])return[_0x750feb,!![]];return[_0x750feb,checkWebsiteIntervals(_0x750feb)];})[_0x2858('0xad')](function(_0x578a5f,_0x58ca17){if(!_0x58ca17)throw new APIOutOfIntervalError();if(!_0x578a5f['List'])return;_0x21f4b8[_0x2858('0xae')]=_0x578a5f;_0x21f4b8[_0x2858('0xaf')]=_0x578a5f[_0x2858('0xa7')];_0x21f4b8[_0x2858('0xb0')]=_[_0x2858('0xb1')](_0x578a5f[_0x2858('0xab')],['priority'],[_0x2858('0xb2')]);if(_0x21f4b8['account'][_0x2858('0xab')]){delete _0x21f4b8[_0x2858('0xae')][_0x2858('0xab')];}if(_0x21f4b8[_0x2858('0xae')][_0x2858('0xa7')]&&_0x21f4b8[_0x2858('0xae')][_0x2858('0xa7')][_0x2858('0xa8')][_0x2858('0x5b')]){return _0x21f4b8[_0x2858('0xae')][_0x2858('0xa7')][_0x2858('0xa8')][0x0];}var _0x224978=_['defaults'](_0x399e25[_0x2858('0x6c')],{'firstName':_0x399e25[_0x2858('0x6c')][_0x2858('0xb3')],'ListId':_0x578a5f['ListId']});_0x224978[_0x399e25[_0x2858('0x6c')][_0x2858('0xa5')]]=_0x399e25[_0x2858('0x6c')][_0x2858('0xb3')];return db[_0x2858('0x9b')]['create'](_0x224978,{'fields':_0x416ed5,'raw':!![]});})[_0x2858('0x17')](function(_0x58715b){_0x21f4b8['contact']=_0x58715b;var _0x3df2dd=createInteractionObject(_0x399e25['params']['id'],_0x399e25[_0x2858('0x6c')],_0x399e25[_0x2858('0xb4')],_0x58715b);var _0x2f172f={'ChatWebsiteId':_0x399e25[_0x2858('0x67')]['id'],'closed':![]};if(_0x399e25[_0x2858('0x6c')][_0x2858('0xb5')]){_0x2f172f[_0x2858('0xb5')]=_0x399e25[_0x2858('0x6c')][_0x2858('0xb5')];return db[_0x2858('0xb6')][_0x2858('0x6a')]({'where':_0x2f172f})[_0x2858('0x17')](function(_0x2f2b12){if(_0x2f2b12){_0x56edc7=!![];return _0x2f2b12;}_0x3df2dd[_0x2858('0xb5')]=_0x399e25[_0x2858('0x6c')]['threadId'];_0x3df2dd[_0x2858('0xb7')]=_0x399e25[_0x2858('0x6c')][_0x2858('0xb7')];return db[_0x2858('0xb6')][_0x2858('0x6b')](_0x3df2dd);});}_0x2f172f[_0x2858('0xb8')]=_0x58715b['id'];if(_0x399e25[_0x2858('0x6c')][_0x2858('0xb9')]&&_0x399e25[_0x2858('0x6c')]['interaction']['id']){_0x2f172f['id']=_0x399e25[_0x2858('0x6c')][_0x2858('0xb9')]['id'];return db[_0x2858('0xb6')]['find']({'where':_0x2f172f})[_0x2858('0x17')](function(_0x4766d3){if(_0x4766d3){_0x56edc7=!![];return _0x4766d3;}return db['ChatInteraction'][_0x2858('0x6b')](_0x3df2dd);});}return db[_0x2858('0xb6')][_0x2858('0x6b')](_0x3df2dd);})[_0x2858('0x17')](function(_0x174b43){if(!_0x56edc7)return _0x174b43;var _0x4973d7={'from':(_0x21f4b8['contact'][_0x2858('0x49')]||'')+'\x20'+(_0x21f4b8[_0x2858('0xba')][_0x2858('0x4a')]||'')};if(_0x399e25[_0x2858('0x6c')][_0x2858('0xb5')]&&_0x399e25[_0x2858('0x6c')][_0x2858('0xbb')]&&_0x399e25[_0x2858('0x6c')][_0x2858('0xb5')]!=_0x399e25['body'][_0x2858('0xbb')]){_0x4973d7['threadId']=_0x399e25['body']['messageId'];}return _0x174b43[_0x2858('0x2b')](_0x4973d7);})['then'](function(_0x5551f7){_0x21f4b8[_0x2858('0xb9')]=_0x5551f7[_0x2858('0x2d')]({'plain':!![]});_0x21f4b8[_0x2858('0xb9')]['created']=!_0x56edc7;if(_0x21f4b8[_0x2858('0xb9')][_0x2858('0xbc')]){if(_0x21f4b8[_0x2858('0xae')][_0x2858('0xbd')]){_0x21f4b8['applications'][_0x2858('0xbe')]({'id':0x0,'priority':_0x21f4b8[_0x2858('0xb0')]['length']+0x1,'app':'close','appdata':_0x2858('0xbf'),'interval':_0x2858('0xc0')});}}return db[_0x2858('0xc1')][_0x2858('0x6b')]({'body':_0x399e25[_0x2858('0x6c')]['body'],'ChatWebsiteId':_0x399e25[_0x2858('0x67')]['id'],'ChatInteractionId':_0x5551f7['id'],'direction':'in','ContactId':_0x21f4b8[_0x2858('0xba')]['id'],'AttachmentId':_0x399e25['body'][_0x2858('0xc2')]});})[_0x2858('0x17')](function(_0x2d7fe2){_0x21f4b8[_0x2858('0x1e')]=_0x2d7fe2;if(!_0x21f4b8[_0x2858('0xb9')]['UserId']){return;}return db[_0x2858('0xc3')][_0x2858('0x6a')]({'attributes':['id','name'],'where':{'id':_0x21f4b8[_0x2858('0xb9')]['UserId']}});})['then'](function(_0x56b11f){if(_0x56b11f){_0x21f4b8[_0x2858('0xb0')][_0x2858('0xc4')]({'id':0x0,'priority':0x0,'app':_0x2858('0xc5'),'appdata':_0x56b11f[_0x2858('0x30')]+','+(_0x21f4b8[_0x2858('0xae')][_0x2858('0xc6')]||0xa),'interval':_0x2858('0xc0')});_0x21f4b8[_0x2858('0xc7')]=!![];}if(!_0x21f4b8['interaction']['queueId']){return;}return db[_0x2858('0xc8')][_0x2858('0x6a')]({'attributes':['id',_0x2858('0x30')],'where':{'id':_0x21f4b8[_0x2858('0xb9')][_0x2858('0xc9')]}});})['then'](function(_0x509a95){if(_0x509a95){_0x21f4b8[_0x2858('0xb0')][_0x2858('0xc4')]({'id':0x0,'priority':0x1,'app':_0x2858('0xca'),'appdata':_0x509a95['name']+','+(_0x21f4b8[_0x2858('0xae')]['waitForTheAssignedQueue']||0x12c),'interval':_0x2858('0xc0')});}return respondWithRpcPromise(_0x2858('0xcb'),_0x2858('0xcc'),_0x21f4b8);})['then'](function(_0x11a814){respondWithRpcPromise(_0x2858('0xcd'),'EventManager',{'event':_0x2858('0x99'),'message':_0x11a814},client9002);return _0x11a814;})[_0x2858('0x17')](respondWithResult(_0x3317fa,null))[_0x2858('0x20')](APIHandleError(_0x3317fa));};exports[_0x2858('0xce')]=function(_0xc8dda8,_0x1aeb75){var _0x2628c4,_0x435220,_0x5419b5;var _0x58d600=[];var _0x12148a={};var _0x298fd0=_0xc8dda8[_0x2858('0xcf')]||[];var _0x428a2d=[];var _0x4d0bab;return db[_0x2858('0x9b')][_0x2858('0x75')]()[_0x2858('0x17')](function(_0x42b5a5){if(!_0x42b5a5){throw new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))]('no\x20available\x20attributes');}_0x58d600=_[_0x2858('0x9f')](_[_0x2858('0x56')](_0x42b5a5),['createdAt','updatedAt',_0x2858('0xa2'),_0x2858('0xa3')]);if(_0xc8dda8[_0x2858('0x6c')]['id']){delete _0xc8dda8[_0x2858('0x6c')]['id'];}if(_[_0x2858('0x8e')](_0xc8dda8['body'][_0x2858('0xb3')])){throw _0x1aeb75[_0x2858('0x22')](0x1f4)[_0x2858('0x31')](new db['Sequelize'][(_0x2858('0x9d'))](_0x2858('0xa4')));}if(_[_0x2858('0x8e')](_0xc8dda8[_0x2858('0x6c')][_0x2858('0x6c')])||_0xc8dda8[_0x2858('0x6c')][_0x2858('0x6c')]===''){throw _0x1aeb75[_0x2858('0x22')](0x1f4)['send'](new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))](_0x2858('0xd0')));}if(_[_0x2858('0x8e')](_0xc8dda8[_0x2858('0x6c')][_0x2858('0xd1')])){throw _0x1aeb75[_0x2858('0x22')](0x1f4)[_0x2858('0x31')](new db[(_0x2858('0x9c'))][(_0x2858('0x9d'))](_0x2858('0xd2')+_0x58d600));}if(!_[_0x2858('0xa6')](_0x58d600,_0xc8dda8[_0x2858('0x6c')]['mapKeyOffline'])){throw _0x1aeb75[_0x2858('0x22')](0x1f4)[_0x2858('0x31')](new db['Sequelize'][(_0x2858('0x9d'))](_0x2858('0xd3')+_0x58d600));}_0x12148a[_0xc8dda8[_0x2858('0x6c')][_0x2858('0xd1')]]=_0xc8dda8[_0x2858('0x6c')][_0x2858('0xb3')];})[_0x2858('0x17')](function(){return db['ChatWebsite']['find']({'where':{'id':_0xc8dda8[_0x2858('0x67')]['id']},'include':[{'model':db[_0x2858('0xd4')],'as':_0x2858('0xa7')},{'model':db[_0x2858('0xd5')],'as':_0x2858('0xd5')}]});})['then'](handleEntityNotFound(_0x1aeb75,null))[_0x2858('0x17')](function(_0x34a531){if(_0x34a531&&_0x34a531[_0x2858('0xa7')]){_0x435220=_0x34a531;var _0x2f4990=_['defaults'](_0xc8dda8[_0x2858('0x6c')],{'firstName':_0xc8dda8['body'][_0x2858('0xb3')],'phone':_0xc8dda8[_0x2858('0x6c')][_0x2858('0xb3')],'ListId':_0x34a531['ListId']});_0x2f4990[_0xc8dda8['body']['mapKeyOffline']]=_0xc8dda8[_0x2858('0x6c')]['from'];return db[_0x2858('0x9b')]['findOrCreate']({'where':_0x12148a,'defaults':_0x2f4990});}})[_0x2858('0xad')](function(_0x303ad0){if(_0x303ad0){_0x5419b5=_0x303ad0;var _0x381b18=fs[_0x2858('0xd6')](path[_0x2858('0x8b')](config[_0x2858('0x90')],_0x2858('0xd7')),_0x2858('0xd8'));var _0x2eca59=ejs[_0x2858('0xd9')](_0x381b18,{'body':_[_0x2858('0xda')](_0xc8dda8[_0x2858('0x6c')][_0x2858('0x6c')]),'bodyTitle':_0x435220[_0x2858('0xdb')]});return db['ChatOfflineMessage'][_0x2858('0x6b')]({'body':_0x2eca59,'plainBody':htmlToText[_0x2858('0xdc')](_0x2eca59),'ContactId':_0x303ad0['id'],'ChatWebsiteId':_0x435220['id']});}})[_0x2858('0x17')](function(_0x3db70e){_0x4d0bab=_0x3db70e;if(_0x298fd0[_0x2858('0x5b')]){var _0x5b7a24=_0x298fd0['map'](function(_0x547cb8){return{'name':_0x547cb8[_0x2858('0xdd')],'basename':_0x547cb8[_0x2858('0x83')],'type':_0x547cb8[_0x2858('0xde')],'ChatOfflineMessageId':_0x3db70e['id']};});_0x428a2d=_0x5b7a24[_0x2858('0x3e')](_0x5ceaeb=>{var _0x5dbfdd={'filename':_0x5ceaeb[_0x2858('0x30')],'path':path[_0x2858('0x8b')](config['root'],_0x2858('0xdf'),_0x2858('0xcf'),_0x2858('0xe0'),_0x2858('0xe1'),_0x5ceaeb[_0x2858('0xe2')])};return _0x5dbfdd;});if(!_0x435220[_0x2858('0xe3')]){return db[_0x2858('0xe4')][_0x2858('0xe5')](function(_0x2e4547){return db['Attachment'][_0x2858('0xe6')](_0x5b7a24,{'transaction':_0x2e4547});});}}})[_0x2858('0x17')](function(){if(_0x4d0bab){_0x2628c4=_0x4d0bab;return db['MailAccount'][_0x2858('0x79')]({'where':{'service':!![]},'include':[{'model':db[_0x2858('0xe7')],'as':_0x2858('0xe8'),'raw':!![],'include':[{'model':db[_0x2858('0xe9')],'as':_0x2858('0xe9'),'raw':!![]}]}]});}})[_0x2858('0x17')](function(_0x1f0f4b){if(_0x1f0f4b&&_0x1f0f4b[_0x2858('0xe8')]&&_0x435220[_0x2858('0xea')]&&_0x435220[_0x2858('0xeb')]){var _0x5cd8c9=_0x1f0f4b[_0x2858('0xec')]();return respondWithRpcPromise('SendMail',_0x2858('0xed'),{'account':_0x5cd8c9,'message':{'from':util[_0x2858('0x34')](_0x2858('0xee'),_0x1f0f4b[_0x2858('0x30')],_0x1f0f4b[_0x2858('0xef')]||_0x1f0f4b[_0x2858('0xe8')][_0x2858('0x6d')]),'to':_0x435220[_0x2858('0xeb')],'subject':_0x435220[_0x2858('0xf0')],'html':_0x2628c4[_0x2858('0x6c')],'attachments':_0x428a2d}},client9003)[_0x2858('0x17')](function(){return _0x2628c4;})[_0x2858('0x20')](function(_0x485c8f){logger[_0x2858('0x1c')](_0x485c8f);});}})[_0x2858('0x17')](function(){if(_0x435220&&_0x435220[_0x2858('0xe3')]&&_0x435220[_0x2858('0xf1')]){var _0x367e15=[];if(_0x298fd0['length']){_0x367e15=_0x298fd0[_0x2858('0x3e')](function(_0x51238d){return{'name':_0x51238d[_0x2858('0xdd')],'basename':_0x51238d[_0x2858('0x83')],'type':_0x51238d[_0x2858('0xde')],'ChatOfflineMessageId':_0x4d0bab['id']};});}var _0xd85154;if(!_['isNil'](_0x435220['subjectOffline'])){var _0x41b89a=_[_0x2858('0x3e')](_0xc8dda8[_0x2858('0x6c')],function(_0x2245c0){return _0x2245c0;});var _0x115ada=_[_0x2858('0xf2')](_0x41b89a)[0x0];var _0x3aaf17=_[_0x2858('0xf3')](_0x115ada,function(_0x549407){return _0x549407;});_0xd85154=_0x3aaf17[0x1][_0x435220['subjectOffline']];}var _0x16c9d0={'from':_0x5419b5['email'],'firstName':_0x5419b5[_0x2858('0x49')],'lastName':_0x5419b5[_0x2858('0x4a')],'mapKey':_0x2858('0xef'),'message':{'from':_0x5419b5[_0x2858('0xef')],'to':_0x435220[_0x2858('0xd5')][_0x2858('0xef')],'cc':'','subject':_[_0x2858('0x8e')](_0xd85154)?_0x435220['offlineMessageSubject']:_0xd85154,'messageId':'','sentAt':new Date(),'attach':_0x367e15[_0x2858('0x5b')],'attachments':_0x367e15,'originChannel':_0x2858('0xf4'),'ChatWebsiteId':_0x435220['id'],'ChatOfflineMessageId':_0x2628c4['id'],'originTo':_0x435220[_0x2858('0xd5')][_0x2858('0xef')]},'body':_0x2628c4['body']};var _0xde1a51={'account':{'id':_0x435220['MailAccountId']},'body':_0x16c9d0,'log':_0x2858('0xf5')};return respondWithRpcPromise(_0x2858('0xf5'),_0x2858('0xf6'),_0xde1a51,client9001)[_0x2858('0x17')](function(){return _0x2628c4;})['catch'](function(_0x197379){logger['error'](_0x197379);});}return;})['then'](function(){if(_0x2628c4){return _0x2628c4;}})[_0x2858('0x17')](respondWithResult(_0x1aeb75,null))['catch'](function(){for(var _0x23669f of _0x298fd0){var _0x537575=path[_0x2858('0x8b')](config[_0x2858('0x90')],_0x2858('0xdf'),_0x2858('0xcf'),_0x2858('0xe0'),_0x2858('0xe1'),_0x23669f['filename']);fs_extra['remove'](_0x537575)[_0x2858('0x20')](function(_0xca7904){logger[_0x2858('0x1c')]('Could\x20not\x20remove\x20attachment\x20file',_0x537575,_0xca7904);});}});};exports['addInteraction']=function(_0x4ec774,_0x1919bc){return db[_0x2858('0xb6')][_0x2858('0x6a')]({'where':{'id':_0x4ec774[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x1919bc,null))[_0x2858('0x17')](function(_0x45d560){if(_0x45d560){return _0x45d560[_0x2858('0xf7')](_0x4ec774['body'][_0x2858('0x80')],_[_0x2858('0xf8')](_0x4ec774['body'],[_0x2858('0x80'),'id'])||{});}})['then'](respondWithResult(_0x1919bc,null))['catch'](handleError(_0x1919bc,null));};exports['getInteractions']=function(_0x4ee787,_0xd59265){var _0x4d455e={'raw':![],'where':{}};var _0x1f7ed3={};var _0x19ab13={'count':0x0,'rows':[]};return db[_0x2858('0x64')][_0x2858('0x79')]({'where':{'id':_0x4ee787[_0x2858('0x67')]['id']}})['then'](handleEntityNotFound(_0xd59265,null))[_0x2858('0x17')](function(_0x5a6bae){if(_0x5a6bae){_0x1f7ed3[_0x2858('0x51')]=_[_0x2858('0x56')](db[_0x2858('0xb6')][_0x2858('0x7e')]);_0x1f7ed3[_0x2858('0x55')]=_[_0x2858('0x56')](_0x4ee787[_0x2858('0x55')]);_0x1f7ed3[_0x2858('0x57')]=_[_0x2858('0x58')](_0x1f7ed3[_0x2858('0x51')],_0x1f7ed3[_0x2858('0x55')]);_0x4d455e['attributes']=_['intersection'](_0x1f7ed3[_0x2858('0x51')],qs[_0x2858('0x5a')](_0x4ee787['query'][_0x2858('0x5a')]));_0x4d455e[_0x2858('0x59')]=_0x4d455e['attributes']['length']?_0x4d455e[_0x2858('0x59')]:_0x1f7ed3[_0x2858('0x51')];if(!_0x4ee787[_0x2858('0x55')][_0x2858('0x5c')]('nolimit')){_0x4d455e[_0x2858('0x27')]=qs['limit'](_0x4ee787[_0x2858('0x55')][_0x2858('0x27')]);_0x4d455e[_0x2858('0x25')]=qs[_0x2858('0x25')](_0x4ee787[_0x2858('0x55')][_0x2858('0x25')]);}_0x4d455e['order']=qs[_0x2858('0x5f')](_0x4ee787[_0x2858('0x55')][_0x2858('0x5f')]);_0x4d455e[_0x2858('0x62')]=qs[_0x2858('0x57')](_[_0x2858('0x60')](_0x4ee787['query'],_0x1f7ed3[_0x2858('0x57')]));_0x4d455e[_0x2858('0x62')][_0x2858('0x77')]=_0x5a6bae['id'];if(_0x4ee787[_0x2858('0x55')][_0x2858('0x61')]){_0x4d455e[_0x2858('0x62')]=_[_0x2858('0x63')](_0x4d455e[_0x2858('0x62')],{'$or':_['map'](_0x4d455e['attributes'],function(_0x27f639){var _0x1d737e={};_0x1d737e[_0x27f639]={'$like':'%'+_0x4ee787[_0x2858('0x55')]['filter']+'%'};return _0x1d737e;})});}_0x4d455e=_[_0x2858('0x63')]({},_0x4d455e,_0x4ee787[_0x2858('0x69')]);return db[_0x2858('0xb6')]['count']({'where':_0x4d455e[_0x2858('0x62')]})[_0x2858('0x17')](function(_0x22938b){_0x19ab13['count']=_0x22938b;if(_0x4ee787[_0x2858('0x55')][_0x2858('0x65')]){_0x4d455e[_0x2858('0x7a')]=[{'model':db['CmContact'],'as':_0x2858('0xf9'),'required':![]},{'model':db[_0x2858('0xc3')],'as':_0x2858('0xfa'),'attributes':[_0x2858('0x30'),'fullname',_0x2858('0xfb')],'required':![]},{'model':db[_0x2858('0xfc')],'as':_0x2858('0xfd'),'attributes':['id',_0x2858('0x30'),_0x2858('0xfe')],'where':_0x4ee787[_0x2858('0x55')][_0x2858('0xff')]?{'id':_0x4ee787[_0x2858('0x55')][_0x2858('0xff')]}:undefined,'required':_0x4ee787[_0x2858('0x55')][_0x2858('0xff')]?!![]:![]}];}return db[_0x2858('0xb6')][_0x2858('0x7b')](_0x4d455e);})[_0x2858('0x17')](function(_0x5787c3){_0x19ab13[_0x2858('0x66')]=_0x5787c3;return _0x19ab13;});}})['then'](respondWithFilteredResult(_0xd59265,_0x4d455e))[_0x2858('0x20')](handleError(_0xd59265,null));};exports[_0x2858('0x32')]=function(_0x863ef7,_0x209034){var _0x42c556=0x0;var _0x213bf6=0x0;var _0x2cf2d1=![];var _0x25dbfa;var _0x937c9f;return db['ChatWebsite'][_0x2858('0x6a')]({'where':{'id':_0x863ef7[_0x2858('0x67')]['id']},'include':[{'model':db[_0x2858('0x3f')],'as':'Interval','include':[{'model':db['Interval'],'as':_0x2858('0x40'),'attributes':['id',_0x2858('0x36')]}]}]})[_0x2858('0x17')](handleEntityNotFound(_0x209034,null))[_0x2858('0x17')](function(_0x3f90f5){if(_0x3f90f5){_0x25dbfa=_0x3f90f5;return _0x3f90f5['getProactiveActions']({'raw':!![]});}})[_0x2858('0x17')](function(_0x1aac91){if(_0x25dbfa){if(_0x1aac91){_0x937c9f=_0x1aac91;}}return require(_0x2858('0x8d'))['getLicense']();})[_0x2858('0x17')](function(_0x9e02cb){if(_0x9e02cb){_0x213bf6=_0x9e02cb[_0x2858('0x100')];_0x2cf2d1=_0x9e02cb[_0x2858('0x101')];}})['then'](function(){return db['ChatInteraction'][_0x2858('0x28')]({'where':{'closed':![]}});})['then'](function(_0x3f2b2d){_0x42c556=_0x3f2b2d;if(_0x213bf6&&_0x3f2b2d>_0x213bf6){return db['License'][_0x2858('0x79')]({'where':{'id':0x1}})[_0x2858('0x17')](function(_0x3104cd){if(_0x3104cd){_0x3104cd[_0x2858('0x102')](_0x2858('0x103'));}});}})['then'](function(){if(!_0x25dbfa[_0x2858('0x3f')]||!_0x25dbfa['Interval'][_0x2858('0x40')])return!![];return checkWebsiteIntervals(_0x25dbfa);})[_0x2858('0x17')](function(_0x218300){var _0x572dd3=fs['readFileSync'](path[_0x2858('0x8b')](config['root'],_0x2858('0x104')),_0x2858('0xd8'));var _0xbf78de=new url['URL'](_0x25dbfa[_0x2858('0x105')])[_0x2858('0x106')];var _0x4142c4=_0x2858('0x107');var _0x52f80a=![];var _0x407fb9={'chatVersion':_0x4142c4,'chatWebsiteAddressOrigin':_0xbf78de,'remote':_0x25dbfa[_0x2858('0x108')],'query':querystring[_0x2858('0x1b')](_[_0x2858('0x63')](_0x25dbfa[_0x2858('0x2d')]({'plain':!![]}),{'customerIp':_0x863ef7[_0x2858('0xb4')][_0x2858('0x46')]||_0x863ef7[_0x2858('0xb4')][_0x2858('0x109')]||_0x863ef7[_0x2858('0x10a')][_0x2858('0x10b')]||_0x863ef7['ip'],'referer':_0x863ef7['headers'][_0x2858('0x10c')],'openedInteractions':_0x42c556,'maxInteractions':_0x213bf6,'virtual':_0x2cf2d1[_0x2858('0x100')],'online':_0x218300,'custom':_0x2cf2d1}))[_0x2858('0x10d')](/'/g,'\x5c\x27')};_0x209034['send'](ejs[_0x2858('0xd9')](Mustache['render'](_0x572dd3,_0x407fb9),{'proactiveActions':_0x937c9f,'alignment':_0x25dbfa['alignment'],'verticalAlignment':_0x25dbfa[_0x2858('0x10e')],'div_color':_0x25dbfa[_0x2858('0xfe')],'labelText':_0x25dbfa['labelText'],'text_color':_0x25dbfa[_0x2858('0x10f')],'text_button_color':_0x25dbfa['textButtonColor'],'button_color':_0x25dbfa['color_button'],'background_color':_0x25dbfa[_0x2858('0x110')],'hideWhenOffline':_0x25dbfa[_0x2858('0x111')],'intervalId':_0x25dbfa['IntervalId'],'isDevelopment':_0x52f80a,'chatVersion':_0x4142c4}));})[_0x2858('0x20')](handleError(_0x209034,null));};exports[_0x2858('0x112')]=function(_0x3f24ae,_0x32fa1e){var _0x3623d7=_0x3f24ae[_0x2858('0x67')]['id'];var _0x542a15=_0x3f24ae[_0x2858('0x6c')];var _0x14832c=0xc8;var _0x4605fb=null;return db[_0x2858('0xe4')][_0x2858('0xe5')]({'isolationLevel':db[_0x2858('0xe4')]['Transaction'][_0x2858('0x113')]['READ_COMMITTED']},function(_0x479da4){return db[_0x2858('0x64')][_0x2858('0x79')]({'where':{'id':_0x3623d7},'transaction':_0x479da4})[_0x2858('0x17')](function(_0x30c14c){if(_0x30c14c){return db[_0x2858('0xaa')][_0x2858('0x2c')]({'where':{'ChatWebsiteId':_0x3623d7},'transaction':_0x479da4})['then'](function(){var _0x303969=_[_0x2858('0x3e')](_0x542a15,function(_0x43d234){_0x43d234[_0x2858('0x77')]=_0x3623d7;return _0x43d234;});return db[_0x2858('0xaa')][_0x2858('0xe6')](_0x303969,{'transaction':_0x479da4});});}else{_0x14832c=0x194;_0x4605fb=[];}});})[_0x2858('0x17')](function(){if(_0x14832c!==0x194){return db[_0x2858('0xaa')][_0x2858('0x114')]({'where':{'ChatWebsiteId':_0x3623d7},'order':_0x2858('0x115')})[_0x2858('0x17')](function(_0x38176f){_0x4605fb=_0x38176f;});}})[_0x2858('0x20')](function(_0x1cea15){_0x14832c=0x1f4;logger[_0x2858('0x1c')](_0x1cea15[_0x2858('0x2f')]);if(_0x1cea15[_0x2858('0x30')]){delete _0x1cea15[_0x2858('0x30')];}_0x4605fb=_0x1cea15;})[_0x2858('0x116')](function(){if(_0x4605fb===null){_0x32fa1e[_0x2858('0x21')](_0x14832c);}else{if(_0x14832c===0x1f4){_0x32fa1e[_0x2858('0x22')](_0x14832c)[_0x2858('0x31')](_0x4605fb);}else{_0x32fa1e[_0x2858('0x22')](_0x14832c)[_0x2858('0x24')](_0x4605fb);}}});};exports[_0x2858('0x117')]=function(_0xd775c3,_0x3620fe){var _0x135d8d={};var _0x34e7a6={};var _0x5c946e;var _0xa069eb;return db[_0x2858('0x64')][_0x2858('0x79')]({'where':{'id':_0xd775c3[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x3620fe,null))['then'](function(_0x32208a){if(_0x32208a){_0x5c946e=_0x32208a;_0x34e7a6[_0x2858('0x51')]=_[_0x2858('0x56')](db[_0x2858('0xaa')][_0x2858('0x7e')]);_0x34e7a6[_0x2858('0x55')]=_[_0x2858('0x56')](_0xd775c3[_0x2858('0x55')]);_0x34e7a6['filters']=_[_0x2858('0x58')](_0x34e7a6['model'],_0x34e7a6[_0x2858('0x55')]);_0x135d8d[_0x2858('0x59')]=_[_0x2858('0x58')](_0x34e7a6[_0x2858('0x51')],qs[_0x2858('0x5a')](_0xd775c3[_0x2858('0x55')][_0x2858('0x5a')]));_0x135d8d[_0x2858('0x59')]=_0x135d8d[_0x2858('0x59')]['length']?_0x135d8d[_0x2858('0x59')]:_0x34e7a6['model'];_0x135d8d[_0x2858('0x5e')]=qs[_0x2858('0x5f')](_0xd775c3[_0x2858('0x55')]['sort']);_0x135d8d[_0x2858('0x62')]=qs[_0x2858('0x57')](_[_0x2858('0x60')](_0xd775c3[_0x2858('0x55')],_0x34e7a6['filters']));if(_0xd775c3[_0x2858('0x55')][_0x2858('0x61')]){_0x135d8d[_0x2858('0x62')]=_['merge'](_0x135d8d[_0x2858('0x62')],{'$or':_[_0x2858('0x3e')](_0x135d8d[_0x2858('0x59')],function(_0x1cd2a7){var _0x2d190e={};_0x2d190e[_0x1cd2a7]={'$like':'%'+_0xd775c3['query']['filter']+'%'};return _0x2d190e;})});}_0x135d8d=_[_0x2858('0x63')]({},_0x135d8d,_0xd775c3['options']);return _0x5c946e[_0x2858('0x117')](_0x135d8d);}})[_0x2858('0x17')](function(_0x419619){if(_0x419619){_0xa069eb=_0x419619[_0x2858('0x5b')];if(!_0xd775c3[_0x2858('0x55')][_0x2858('0x5c')]('nolimit')){_0x135d8d[_0x2858('0x27')]=qs[_0x2858('0x27')](_0xd775c3['query'][_0x2858('0x27')]);_0x135d8d['offset']=qs[_0x2858('0x25')](_0xd775c3['query'][_0x2858('0x25')]);}return _0x5c946e['getApplications'](_0x135d8d);}})[_0x2858('0x17')](function(_0xa67970){if(_0xa67970){return _0xa67970?{'count':_0xa069eb,'rows':_0xa67970}:null;}})[_0x2858('0x17')](respondWithResult(_0x3620fe,null))[_0x2858('0x20')](handleError(_0x3620fe,null));};exports['addProactiveActions']=function(_0x495e1d,_0x608251){return db[_0x2858('0x118')][_0x2858('0x6a')]({'where':{'id':_0x495e1d[_0x2858('0x67')]['id']}})['then'](handleEntityNotFound(_0x608251,null))[_0x2858('0x17')](function(_0x2ff181){if(_0x2ff181){return _0x2ff181[_0x2858('0x119')](_0x495e1d[_0x2858('0x6c')][_0x2858('0x80')],_[_0x2858('0xf8')](_0x495e1d[_0x2858('0x6c')],[_0x2858('0x80'),'id'])||{});}})[_0x2858('0x17')](respondWithResult(_0x608251,null))['catch'](handleError(_0x608251,null));};exports[_0x2858('0x11a')]=function(_0x355ca1,_0x1d20de){var _0x7c4643={};var _0x288af1={};var _0x242e57;var _0x5d278e;return db['ChatWebsite']['findOne']({'where':{'id':_0x355ca1[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x1d20de,null))[_0x2858('0x17')](function(_0x3defb8){if(_0x3defb8){_0x242e57=_0x3defb8;_0x288af1[_0x2858('0x51')]=_[_0x2858('0x56')](db['ChatProactiveAction'][_0x2858('0x7e')]);_0x288af1['query']=_['keys'](_0x355ca1[_0x2858('0x55')]);_0x288af1[_0x2858('0x57')]=_[_0x2858('0x58')](_0x288af1[_0x2858('0x51')],_0x288af1[_0x2858('0x55')]);_0x7c4643[_0x2858('0x59')]=_[_0x2858('0x58')](_0x288af1[_0x2858('0x51')],qs['fields'](_0x355ca1[_0x2858('0x55')][_0x2858('0x5a')]));_0x7c4643[_0x2858('0x59')]=_0x7c4643['attributes']['length']?_0x7c4643[_0x2858('0x59')]:_0x288af1[_0x2858('0x51')];_0x7c4643[_0x2858('0x5e')]=qs[_0x2858('0x5f')](_0x355ca1['query']['sort']);_0x7c4643['where']=qs[_0x2858('0x57')](_[_0x2858('0x60')](_0x355ca1[_0x2858('0x55')],_0x288af1[_0x2858('0x57')]));if(_0x355ca1[_0x2858('0x55')][_0x2858('0x61')]){_0x7c4643['where']=_[_0x2858('0x63')](_0x7c4643[_0x2858('0x62')],{'$or':_[_0x2858('0x3e')](_0x7c4643[_0x2858('0x59')],function(_0x579cf9){var _0xe38fd8={};_0xe38fd8[_0x579cf9]={'$like':'%'+_0x355ca1[_0x2858('0x55')]['filter']+'%'};return _0xe38fd8;})});}_0x7c4643=_[_0x2858('0x63')]({},_0x7c4643,_0x355ca1[_0x2858('0x69')]);return _0x242e57[_0x2858('0x11a')](_0x7c4643);}})['then'](function(_0x2e835d){if(_0x2e835d){_0x5d278e=_0x2e835d[_0x2858('0x5b')];if(!_0x355ca1[_0x2858('0x55')][_0x2858('0x5c')](_0x2858('0x5d'))){_0x7c4643[_0x2858('0x27')]=qs['limit'](_0x355ca1['query'][_0x2858('0x27')]);_0x7c4643[_0x2858('0x25')]=qs[_0x2858('0x25')](_0x355ca1[_0x2858('0x55')]['offset']);}return _0x242e57[_0x2858('0x11a')](_0x7c4643);}})['then'](function(_0x103569){if(_0x103569){return _0x103569?{'count':_0x5d278e,'rows':_0x103569}:null;}})[_0x2858('0x17')](respondWithResult(_0x1d20de,null))[_0x2858('0x20')](handleError(_0x1d20de,null));};exports[_0x2858('0x11b')]=function(_0x28cc58,_0x12fcf1){var _0x2fdc67=_0x28cc58[_0x2858('0x55')][_0x2858('0x11c')]===_0x2858('0x11d')?_0x2858('0x11e'):_0x2858('0x11f');return db[_0x2858('0x64')][_0x2858('0x6a')]({'attributes':['id',_0x2fdc67],'where':{'id':_0x28cc58[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x12fcf1,null))[_0x2858('0x17')](function(_0x1c6b1e){if(_0x1c6b1e){var _0x31edf7=_0x1c6b1e[_0x2fdc67];var _0x2a4ff8=_0x31edf7&&_0x31edf7[_0x2858('0x120')]?_0x31edf7[_0x2858('0x120')]:[];_0x12fcf1['send']({'fromKey':_[_0x2858('0x8e')](_0x31edf7[_0x2858('0x121')])?undefined:_0x31edf7['fromKey'],'count':_0x2a4ff8[_0x2858('0x5b')],'rows':_0x2a4ff8});}})[_0x2858('0x20')](handleError(_0x12fcf1,null));};exports[_0x2858('0x122')]=function(_0x3c6628,_0x5be32b){var _0x1165f0={'raw':![],'where':{}};var _0x58d49b={};var _0x191c0b={'count':0x0,'rows':[]};return db[_0x2858('0x64')][_0x2858('0x79')]({'where':{'id':_0x3c6628['params']['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x5be32b,null))[_0x2858('0x17')](function(_0x271182){if(_0x271182){_0x58d49b['model']=_[_0x2858('0x56')](db[_0x2858('0x123')][_0x2858('0x7e')]);_0x58d49b[_0x2858('0x55')]=_['keys'](_0x3c6628[_0x2858('0x55')]);_0x58d49b[_0x2858('0x57')]=_['intersection'](_0x58d49b['model'],_0x58d49b[_0x2858('0x55')]);_0x1165f0[_0x2858('0x59')]=_[_0x2858('0x58')](_0x58d49b[_0x2858('0x51')],qs[_0x2858('0x5a')](_0x3c6628[_0x2858('0x55')][_0x2858('0x5a')]));_0x1165f0[_0x2858('0x59')]=_0x1165f0[_0x2858('0x59')]['length']?_0x1165f0['attributes']:_0x58d49b[_0x2858('0x51')];if(!_0x3c6628[_0x2858('0x55')][_0x2858('0x5c')](_0x2858('0x5d'))){_0x1165f0[_0x2858('0x27')]=qs[_0x2858('0x27')](_0x3c6628[_0x2858('0x55')]['limit']);_0x1165f0['offset']=qs['offset'](_0x3c6628[_0x2858('0x55')][_0x2858('0x25')]);}_0x1165f0[_0x2858('0x5e')]=qs[_0x2858('0x5f')](_0x3c6628[_0x2858('0x55')][_0x2858('0x5f')]);_0x1165f0[_0x2858('0x62')]=qs[_0x2858('0x57')](_[_0x2858('0x60')](_0x3c6628[_0x2858('0x55')],_0x58d49b[_0x2858('0x57')]));_0x1165f0[_0x2858('0x62')]['ChatWebsiteId']=_0x271182['id'];if(_0x3c6628[_0x2858('0x55')]['filter']){_0x1165f0[_0x2858('0x62')]=_[_0x2858('0x63')](_0x1165f0[_0x2858('0x62')],{'$or':_['map'](_0x1165f0[_0x2858('0x59')],function(_0x4ba6b4){var _0x3812da={};_0x3812da[_0x4ba6b4]={'$like':'%'+_0x3c6628[_0x2858('0x55')]['filter']+'%'};return _0x3812da;})});}_0x1165f0=_[_0x2858('0x63')]({},_0x1165f0,_0x3c6628[_0x2858('0x69')]);return db['ChatOfflineMessage'][_0x2858('0x28')]({'where':_0x1165f0[_0x2858('0x62')]})[_0x2858('0x17')](function(_0x344850){_0x191c0b[_0x2858('0x28')]=_0x344850;if(_0x3c6628[_0x2858('0x55')]['includeAll']){_0x1165f0[_0x2858('0x7a')]=[{'all':!![]}];}else{_0x1165f0['include']=[{'model':db['CmContact'],'as':_0x2858('0xf9'),'required':![]},{'model':db[_0x2858('0x124')],'as':_0x2858('0x125'),'required':![]}];}return db[_0x2858('0x123')]['findAll'](_0x1165f0);})[_0x2858('0x17')](function(_0x1ababf){_0x191c0b[_0x2858('0x66')]=_0x1ababf;return _0x191c0b;});}})[_0x2858('0x17')](respondWithFilteredResult(_0x5be32b,_0x1165f0))[_0x2858('0x20')](handleError(_0x5be32b,null));};exports['addAgents']=function(_0x239dec,_0x4305d6){return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x239dec['params']['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x4305d6,null))['then'](function(_0x391813){if(_0x391813){return _0x391813['addAgents'](_0x239dec['body'][_0x2858('0x80')],_['omit'](_0x239dec[_0x2858('0x6c')],[_0x2858('0x80'),'id'])||{})[_0x2858('0xad')](function(_0x419001){for(var _0x57c218=0x0;_0x57c218<_0x239dec[_0x2858('0x6c')][_0x2858('0x80')][_0x2858('0x5b')];_0x57c218+=0x1){socket[_0x2858('0x126')]('userChatWebsite:save',{'UserId':Number(_0x239dec[_0x2858('0x6c')][_0x2858('0x80')][_0x57c218]),'ChatWebsiteId':Number(_0x239dec['params']['id'])});}return _0x419001;});}})['then'](respondWithResult(_0x4305d6,null))['catch'](handleError(_0x4305d6,null));};exports['removeAgents']=function(_0x173eea,_0x29ab6f){return db[_0x2858('0x64')][_0x2858('0x6a')]({'where':{'id':_0x173eea[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x29ab6f,null))['then'](function(_0x27225b){if(_0x27225b){return _0x27225b[_0x2858('0x127')](_0x173eea[_0x2858('0x55')][_0x2858('0x80')])[_0x2858('0x17')](function(){if(_[_0x2858('0x128')](_0x173eea[_0x2858('0x55')][_0x2858('0x80')])){for(var _0x50f698=0x0;_0x50f698<_0x173eea[_0x2858('0x55')]['ids'][_0x2858('0x5b')];_0x50f698+=0x1){socket[_0x2858('0x126')](_0x2858('0x129'),{'UserId':Number(_0x173eea['query'][_0x2858('0x80')][_0x50f698]),'ChatWebsiteId':Number(_0x173eea[_0x2858('0x67')]['id'])});}}else{socket['emit'](_0x2858('0x129'),{'UserId':Number(_0x173eea[_0x2858('0x55')][_0x2858('0x80')]),'ChatWebsiteId':Number(_0x173eea[_0x2858('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x29ab6f,null))['catch'](handleError(_0x29ab6f,null));};exports[_0x2858('0x12a')]=function(_0x209b58,_0x437a2b){var _0x121517={};var _0x1c97be={};var _0x348f96;var _0x2bf1f6;return db[_0x2858('0x64')]['findOne']({'where':{'id':_0x209b58[_0x2858('0x67')]['id']}})[_0x2858('0x17')](handleEntityNotFound(_0x437a2b,null))[_0x2858('0x17')](function(_0x419a9c){if(_0x419a9c){_0x348f96=_0x419a9c;_0x1c97be[_0x2858('0x51')]=_['keys'](db[_0x2858('0xc3')][_0x2858('0x7e')]);_0x1c97be['query']=_[_0x2858('0x56')](_0x209b58['query']);_0x1c97be[_0x2858('0x57')]=_[_0x2858('0x58')](_0x1c97be[_0x2858('0x51')],_0x1c97be['query']);_0x121517['attributes']=_[_0x2858('0x58')](_0x1c97be[_0x2858('0x51')],qs['fields'](_0x209b58['query'][_0x2858('0x5a')]));_0x121517[_0x2858('0x59')]=_0x121517[_0x2858('0x59')]['length']?_0x121517[_0x2858('0x59')]:_0x1c97be[_0x2858('0x51')];_0x121517[_0x2858('0x5e')]=qs[_0x2858('0x5f')](_0x209b58['query'][_0x2858('0x5f')]);_0x121517[_0x2858('0x62')]=qs['filters'](_[_0x2858('0x60')](_0x209b58['query'],_0x1c97be[_0x2858('0x57')]));if(_0x209b58[_0x2858('0x55')][_0x2858('0x61')]){_0x121517[_0x2858('0x62')]=_['merge'](_0x121517[_0x2858('0x62')],{'$or':_['map'](_0x121517[_0x2858('0x59')],function(_0x4de744){var _0xd21642={};_0xd21642[_0x4de744]={'$like':'%'+_0x209b58[_0x2858('0x55')][_0x2858('0x61')]+'%'};return _0xd21642;})});}_0x121517=_[_0x2858('0x63')]({},_0x121517,_0x209b58['options']);return _0x348f96[_0x2858('0x12a')](_0x121517);}})[_0x2858('0x17')](function(_0x3ba0a3){if(_0x3ba0a3){_0x2bf1f6=_0x3ba0a3[_0x2858('0x5b')];if(!_0x209b58[_0x2858('0x55')][_0x2858('0x5c')](_0x2858('0x5d'))){_0x121517[_0x2858('0x27')]=qs['limit'](_0x209b58[_0x2858('0x55')]['limit']);_0x121517[_0x2858('0x25')]=qs[_0x2858('0x25')](_0x209b58[_0x2858('0x55')][_0x2858('0x25')]);}return _0x348f96[_0x2858('0x12a')](_0x121517);}})['then'](function(_0x36a88c){if(_0x36a88c){return _0x36a88c?{'count':_0x2bf1f6,'rows':_0x36a88c}:null;}})['then'](respondWithResult(_0x437a2b,null))[_0x2858('0x20')](handleError(_0x437a2b,null));}; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b9b4ee1..b6836e0 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 _0x9ffd=['emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x25a74e,_0x3d0466){_0x25a74e=_0x25a74e-0x0;var _0x2b0609=_0x9ffd[_0x25a74e];return _0x2b0609;};'use strict';var EventEmitter=require(_0xd9ff('0x0'));var ChatWebsite=require(_0xd9ff('0x1'))['db'][_0xd9ff('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd9ff('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd9ff('0x4'),'afterDestroy':_0xd9ff('0x5')};function emitEvent(_0x3de85b){return function(_0x96ee9a,_0x44c750,_0x4795c3){ChatWebsiteEvents['emit'](_0x3de85b+':'+_0x96ee9a['id'],_0x96ee9a);ChatWebsiteEvents[_0xd9ff('0x6')](_0x3de85b,_0x96ee9a);_0x4795c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xd9ff('0x7')](e,emitEvent(event));}}module[_0xd9ff('0x8')]=ChatWebsiteEvents; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ba95195..c368b76 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 _0x007b=['./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1d8978,_0x230bab){var _0x299236=function(_0x502d0f){while(--_0x502d0f){_0x1d8978['push'](_0x1d8978['shift']());}};_0x299236(++_0x230bab);}(_0x007b,0x19c));var _0xb007=function(_0x2e6120,_0x379641){_0x2e6120=_0x2e6120-0x0;var _0x1d3d3e=_0x007b[_0x2e6120];return _0x1d3d3e;};'use strict';var _=require(_0xb007('0x0'));var util=require(_0xb007('0x1'));var logger=require('../../config/logger')(_0xb007('0x2'));var moment=require(_0xb007('0x3'));var BPromise=require(_0xb007('0x4'));var rp=require(_0xb007('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb007('0x6'));var config=require(_0xb007('0x7'));var attributes=require(_0xb007('0x8'));module[_0xb007('0x9')]=function(_0x4f3956,_0x1cde97){return _0x4f3956['define'](_0xb007('0xa'),attributes,{'tableName':_0xb007('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index b75bcc9..dda247e 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 _0xa3cf=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x582436,_0x1b4fc1){var _0x419457=function(_0x107de7){while(--_0x107de7){_0x582436['push'](_0x582436['shift']());}};_0x419457(++_0x1b4fc1);}(_0xa3cf,0x96));var _0xfa3c=function(_0xc81edd,_0xd58e83){_0xc81edd=_0xc81edd-0x0;var _0x15786a=_0xa3cf[_0xc81edd];return _0x15786a;};'use strict';var _=require(_0xfa3c('0x0'));var util=require(_0xfa3c('0x1'));var moment=require(_0xfa3c('0x2'));var BPromise=require(_0xfa3c('0x3'));var rs=require(_0xfa3c('0x4'));var fs=require('fs');var Redis=require(_0xfa3c('0x5'));var db=require(_0xfa3c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfa3c('0x7'));var client=jayson[_0xfa3c('0x8')]['http']({'port':0x232a});config[_0xfa3c('0x9')]=_['defaults'](config[_0xfa3c('0x9')],{'host':_0xfa3c('0xa'),'port':0x18eb});var socket=require(_0xfa3c('0xb'))(new Redis(config[_0xfa3c('0x9')]));require('./chatWebsite.socket')[_0xfa3c('0xc')](socket);function respondWithRpcPromise(_0x1caee3,_0xbd40da,_0xb3426c){return new BPromise(function(_0x324fb7,_0x5ca849){return client[_0xfa3c('0xd')](_0x1caee3,_0xb3426c)[_0xfa3c('0xe')](function(_0x23195e){logger[_0xfa3c('0xf')](_0xfa3c('0x10'),_0xbd40da,_0xfa3c('0x11'));logger['debug'](_0xfa3c('0x12'),_0xbd40da,_0xfa3c('0x11'),JSON[_0xfa3c('0x13')](_0x23195e));if(_0x23195e[_0xfa3c('0x14')]){if(_0x23195e[_0xfa3c('0x14')][_0xfa3c('0x15')]===0x1f4){logger[_0xfa3c('0x14')](_0xfa3c('0x10'),_0xbd40da,_0x23195e[_0xfa3c('0x14')]['message']);return _0x5ca849(_0x23195e[_0xfa3c('0x14')][_0xfa3c('0x16')]);}logger['error'](_0xfa3c('0x10'),_0xbd40da,_0x23195e['error'][_0xfa3c('0x16')]);return _0x324fb7(_0x23195e[_0xfa3c('0x14')][_0xfa3c('0x16')]);}else{logger[_0xfa3c('0xf')]('ChatWebsite,\x20%s,\x20%s',_0xbd40da,_0xfa3c('0x11'));_0x324fb7(_0x23195e['result'][_0xfa3c('0x16')]);}})[_0xfa3c('0x17')](function(_0x41dd9e){logger[_0xfa3c('0x14')]('ChatWebsite,\x20%s,\x20%s',_0xbd40da,_0x41dd9e);_0x5ca849(_0x41dd9e);});});} \ No newline at end of file +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 diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f749e7f..152a8a7 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 _0x563f=['register','length','chatWebsite:','remove','update','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x563f,0x17d));var _0xf563=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x563f[_0x3b380d];return _0x54502b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xf563('0x0'),_0xf563('0x1')];function createListener(_0x4d7b08,_0x57d8bb){return function(_0x482b80){_0x57d8bb[_0xf563('0x2')](_0x4d7b08,_0x482b80);};}function removeListener(_0xb0e08b,_0x5ae508){return function(){ChatWebsiteEvents[_0xf563('0x3')](_0xb0e08b,_0x5ae508);};}exports[_0xf563('0x4')]=function(_0x2b715a){for(var _0x43480b=0x0,_0x3991bc=events[_0xf563('0x5')];_0x43480b<_0x3991bc;_0x43480b++){var _0x47d43c=events[_0x43480b];var _0x70b639=createListener(_0xf563('0x6')+_0x47d43c,_0x2b715a);ChatWebsiteEvents['on'](_0x47d43c,_0x70b639);}}; \ No newline at end of file +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 diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9a5f788..06dbcec 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 _0x88a9=['getDispositions','getAnswers','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','now','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','%s-%s','originalname','/:id/avatar','addCustomerAvatar','notify','attachments','offline-chat','ensureDir','/:id/offline','any','offline','addProactiveActions','addAgents','/:id','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions'];(function(_0x5ce169,_0x8b96f){var _0xa44168=function(_0x54fbf3){while(--_0x54fbf3){_0x5ce169['push'](_0x5ce169['shift']());}};_0xa44168(++_0x8b96f);}(_0x88a9,0x17b));var _0x988a=function(_0x552d9b,_0xe0b9ee){_0x552d9b=_0x552d9b-0x0;var _0x2ee918=_0x88a9[_0x552d9b];return _0x2ee918;};'use strict';var multer=require(_0x988a('0x0'));var util=require('util');var path=require(_0x988a('0x1'));var timeout=require('connect-timeout');var express=require(_0x988a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x988a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x988a('0x4'));var controller=require('./chatWebsite.controller');router[_0x988a('0x5')]('/',auth[_0x988a('0x6')](),controller[_0x988a('0x7')]);router[_0x988a('0x5')]('/describe',auth[_0x988a('0x6')](),controller[_0x988a('0x8')]);router[_0x988a('0x5')]('/:id',auth[_0x988a('0x6')](),controller[_0x988a('0x9')]);router['get'](_0x988a('0xa'),auth[_0x988a('0x6')](),controller[_0x988a('0xb')]);router[_0x988a('0x5')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x988a('0xc')]);router[_0x988a('0x5')]('/:id/logo',controller[_0x988a('0xd')]);router[_0x988a('0x5')]('/:id/avatar',controller['getAvatar']);router[_0x988a('0x5')](_0x988a('0xe'),controller[_0x988a('0xf')]);router['get'](_0x988a('0x10'),controller['getSystemAvatar']);router[_0x988a('0x5')](_0x988a('0x11'),auth['isAuthenticated'](),controller[_0x988a('0x12')]);router['get']('/:id/snippet',controller['getSnippet']);router[_0x988a('0x5')](_0x988a('0x13'),auth[_0x988a('0x6')](),controller[_0x988a('0x14')]);router[_0x988a('0x5')](_0x988a('0x15'),auth['isAuthenticated'](),controller[_0x988a('0x16')]);router[_0x988a('0x5')](_0x988a('0x17'),controller[_0x988a('0x18')]);router[_0x988a('0x5')](_0x988a('0x19'),auth[_0x988a('0x6')](),controller[_0x988a('0x1a')]);router[_0x988a('0x5')](_0x988a('0x1b'),auth[_0x988a('0x6')](),controller[_0x988a('0x1c')]);router[_0x988a('0x1d')]('/',auth[_0x988a('0x6')](),controller[_0x988a('0x1e')]);router[_0x988a('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x988a('0x1f')]);router[_0x988a('0x1d')](_0x988a('0x20'),auth[_0x988a('0x6')](),controller[_0x988a('0x21')]);var upload=multer({'storage':multer[_0x988a('0x22')]({'destination':function(_0x2a8b34,_0x529a0a,_0x31677f){_0x31677f(null,path['join'](config[_0x988a('0x23')],_0x988a('0x24')));},'filename':function(_0x42c246,_0x3eb110,_0x50fd6b){_0x50fd6b(null,util[_0x988a('0x25')]('%s-%s',Date[_0x988a('0x26')](),_0x3eb110['originalname']));}})});router[_0x988a('0x1d')](_0x988a('0x27'),upload[_0x988a('0x28')](_0x988a('0x29')),controller[_0x988a('0x2a')]);var upload=multer({'storage':multer[_0x988a('0x22')]({'destination':function(_0xf95f08,_0x11cd63,_0x48d1ae){_0x48d1ae(null,path[_0x988a('0x2b')](config['root'],_0x988a('0x2c')));},'filename':function(_0x2902db,_0x2ee215,_0x2bb9f3){_0x2bb9f3(null,util[_0x988a('0x25')](_0x988a('0x2d'),Date[_0x988a('0x26')](),_0x2ee215[_0x988a('0x2e')]));}})});router['post'](_0x988a('0x2f'),upload[_0x988a('0x28')](_0x988a('0x29')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x21e5ae,_0x420068,_0x540f2b){_0x540f2b(null,path['join'](config['root'],_0x988a('0x2c')));},'filename':function(_0x4c57ba,_0x4c50c6,_0x4cd06a){_0x4cd06a(null,util[_0x988a('0x25')](_0x988a('0x2d'),Date[_0x988a('0x26')](),_0x4c50c6[_0x988a('0x2e')]));}})});router[_0x988a('0x1d')]('/:id/customer_avatar',upload[_0x988a('0x28')]('file'),controller[_0x988a('0x30')]);var upload=multer({'storage':multer[_0x988a('0x22')]({'destination':function(_0x29bb02,_0x5834ad,_0x1e803d){_0x1e803d(null,path[_0x988a('0x2b')](config[_0x988a('0x23')],_0x988a('0x2c')));},'filename':function(_0x4f4678,_0x56781b,_0x34f3ad){_0x34f3ad(null,util[_0x988a('0x25')]('%s-%s',Date[_0x988a('0x26')](),_0x56781b['originalname']));}})});router[_0x988a('0x1d')](_0x988a('0x10'),upload[_0x988a('0x28')](_0x988a('0x29')),controller['addSystemAvatar']);router['post']('/:id/notify',controller[_0x988a('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x988a('0x22')]({'destination':function(_0x240b76,_0x3d5528,_0x30664e){const _0x4fdaf9=path[_0x988a('0x2b')](config[_0x988a('0x23')],'server/files',_0x988a('0x32'),_0x988a('0x33'));fs_extra[_0x988a('0x34')](_0x4fdaf9,function(){_0x30664e(null,_0x4fdaf9);});},'filename':function(_0x18b2e6,_0x5d0f4e,_0x42863b){const _0x198f38=_0x5d0f4e[_0x988a('0x2e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x278031=path['extname'](_0x198f38);const _0x3debb6=Date[_0x988a('0x26')]()+'-'+_0x198f38['replace'](_0x278031,'')+_0x278031;_0x42863b(null,_0x3debb6);}})});router[_0x988a('0x1d')](_0x988a('0x35'),offlineUploadMulter[_0x988a('0x36')](),controller[_0x988a('0x37')]);router[_0x988a('0x1d')](_0x988a('0x11'),auth[_0x988a('0x6')](),controller['addInteraction']);router[_0x988a('0x1d')](_0x988a('0x13'),auth[_0x988a('0x6')](),controller['addApplications']);router[_0x988a('0x1d')](_0x988a('0x15'),auth[_0x988a('0x6')](),controller[_0x988a('0x38')]);router['post'](_0x988a('0x1b'),auth['isAuthenticated'](),controller[_0x988a('0x39')]);router['put'](_0x988a('0x3a'),auth['isAuthenticated'](),controller[_0x988a('0x3b')]);router['delete'](_0x988a('0x3a'),auth[_0x988a('0x6')](),controller[_0x988a('0x3c')]);router[_0x988a('0x3d')](_0x988a('0xa'),auth[_0x988a('0x6')](),controller[_0x988a('0x3e')]);router[_0x988a('0x3d')](_0x988a('0x20'),auth[_0x988a('0x6')](),controller['removeAnswers']);router['delete'](_0x988a('0x1b'),auth['isAuthenticated'](),controller[_0x988a('0x3f')]);module[_0x988a('0x40')]=router; \ No newline at end of file +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 diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 8fd9618..df53b6f 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 _0xc7d9=['get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','Router','env','production','app'];(function(_0x27fcd1,_0x4256fa){var _0x505780=function(_0xb40bb){while(--_0xb40bb){_0x27fcd1['push'](_0x27fcd1['shift']());}};_0x505780(++_0x4256fa);}(_0xc7d9,0x130));var _0x9c7d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc7d9[_0x2dafbe];return _0x58a45a;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x9c7d('0x0')]();var isProduction=config[_0x9c7d('0x1')]===_0x9c7d('0x2')||![];function clientSideLogs(_0x43eb3e,_0x58fcf2,_0x474751){var _0x20a303=_0x43eb3e[_0x9c7d('0x3')][_0x9c7d('0x4')](_0x9c7d('0x5'));if(!_0x20a303){throw new Error(_0x9c7d('0x6'));}return beaverLogger[_0x9c7d('0x7')]({'uri':_0x9c7d('0x8'),'logger':_0x20a303,'enableCors':!isProduction})(_0x43eb3e,_0x58fcf2,_0x474751);}router[_0x9c7d('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x9c7d('0xa')]=router; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 0ccf80c..c6b4e06 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 _0xf010=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x28015a,_0x37d2d7){var _0x43bbd5=function(_0x146b86){while(--_0x146b86){_0x28015a['push'](_0x28015a['shift']());}};_0x43bbd5(++_0x37d2d7);}(_0xf010,0xf1));var _0x0f01=function(_0x1b60bb,_0x4a9a10){_0x1b60bb=_0x1b60bb-0x0;var _0x909651=_0xf010[_0x1b60bb];return _0x909651;};'use strict';var Sequelize=require(_0x0f01('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f01('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0f01('0x2')](_0x0f01('0x3'),_0x0f01('0x4'),_0x0f01('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0f01('0x2')](_0x0f01('0x6'),_0x0f01('0x7'))},'data1':{'type':Sequelize[_0x0f01('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x0f01('0x8')},'data3':{'type':Sequelize[_0x0f01('0x1')],'comment':_0x0f01('0x9')},'data4':{'type':Sequelize[_0x0f01('0x1')],'comment':_0x0f01('0xa')},'data5':{'type':Sequelize[_0x0f01('0xb')],'comment':_0x0f01('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0x0f01('0xd')},'data7':{'type':Sequelize['TEXT'],'comment':_0x0f01('0xe')}}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c821871..2a2dea7 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 _0x0948=['defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0948,0xaf));var _0x8094=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x0948[_0x2f48cd];return _0x193ae2;};'use strict';var _=require(_0x8094('0x0'));var Redis=require(_0x8094('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x8094('0x2'));var config=require(_0x8094('0x3'));var logger=require(_0x8094('0x4'))(_0x8094('0x5'));var db=require(_0x8094('0x6'))['db'];var oauth=require(_0x8094('0x7'));config[_0x8094('0x8')]=_[_0x8094('0x9')](config[_0x8094('0x8')],{'host':_0x8094('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8094('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x34b501,_0x4801f2){_0x4801f2=_0x4801f2||0xcc;return function(_0xad73da){if(_0xad73da){return _0x34b501[_0x8094('0xb')](_0x4801f2);}return _0x34b501[_0x8094('0xc')](_0x4801f2)[_0x8094('0xd')]();};}function respondWithResult(_0x11bb49,_0x259d7c){_0x259d7c=_0x259d7c||0xc8;return function(_0x2fc2b9){if(_0x2fc2b9){return _0x11bb49[_0x8094('0xc')](_0x259d7c)[_0x8094('0xe')](_0x2fc2b9);}};}function respondWithFilteredResult(_0x2c5de7,_0x266f49){return function(_0x4bc737){if(_0x4bc737){var _0x1b589a=typeof _0x266f49[_0x8094('0xf')]===_0x8094('0x10')&&typeof _0x266f49[_0x8094('0x11')]===_0x8094('0x10');var _0x833408=_0x4bc737[_0x8094('0x12')];var _0x4d3839=_0x1b589a?0x0:_0x266f49['offset'];var _0x12cda9=_0x1b589a?_0x4bc737[_0x8094('0x12')]:_0x266f49[_0x8094('0xf')]+_0x266f49[_0x8094('0x11')];var _0x1b4a7f;if(_0x12cda9>=_0x833408){_0x12cda9=_0x833408;_0x1b4a7f=0xc8;}else{_0x1b4a7f=0xce;}_0x2c5de7[_0x8094('0xc')](_0x1b4a7f);return _0x2c5de7[_0x8094('0x13')](_0x8094('0x14'),_0x4d3839+'-'+_0x12cda9+'/'+_0x833408)['json'](_0x4bc737);}return null;};}function saveUpdates(_0x12a378){return function(_0x75d194){if(_0x75d194){return _0x75d194[_0x8094('0x15')](_0x12a378)[_0x8094('0x16')](function(_0x195c02){return _0x195c02;});}return null;};}function removeEntity(_0x361851){return function(_0x3b8ea8){if(_0x3b8ea8){return _0x3b8ea8[_0x8094('0x17')]()[_0x8094('0x16')](function(){_0x361851[_0x8094('0xc')](0xcc)[_0x8094('0xd')]();});}};}function handleEntityNotFound(_0x3f75e0){return function(_0x8f189c){if(!_0x8f189c){_0x3f75e0[_0x8094('0xb')](0x194);}return _0x8f189c;};}function handleError(_0x57ef67,_0x2555d2){_0x2555d2=_0x2555d2||0x1f4;return function(_0x3e3b45){logger[_0x8094('0x18')](_0x3e3b45['stack']);if(_0x3e3b45[_0x8094('0x19')]){delete _0x3e3b45[_0x8094('0x19')];}_0x57ef67[_0x8094('0xc')](_0x2555d2)[_0x8094('0x1a')](_0x3e3b45);};}function maskClientSecret(_0x163b8c){return _['padEnd'](_0x163b8c['slice'](0x0,0x3),0x14,'*');}exports[_0x8094('0x1b')]=function(_0x3d2bec,_0x40bf74){var _0x1f8d7a={},_0x5a9224={},_0x496484={'count':0x0,'rows':[]};var _0x174930=_[_0x8094('0x1c')](db[_0x8094('0x1d')][_0x8094('0x1e')],function(_0x2d459e){return{'name':_0x2d459e['fieldName'],'type':_0x2d459e[_0x8094('0x1f')][_0x8094('0x20')]};});_0x5a9224[_0x8094('0x21')]=_[_0x8094('0x1c')](_0x174930,_0x8094('0x19'));_0x5a9224[_0x8094('0x22')]=_[_0x8094('0x23')](_0x3d2bec['query']);_0x5a9224[_0x8094('0x24')]=_[_0x8094('0x25')](_0x5a9224[_0x8094('0x21')],_0x5a9224[_0x8094('0x22')]);_0x1f8d7a[_0x8094('0x26')]=_[_0x8094('0x25')](_0x5a9224['model'],qs['fields'](_0x3d2bec[_0x8094('0x22')][_0x8094('0x27')]));_0x1f8d7a[_0x8094('0x26')]=_0x1f8d7a[_0x8094('0x26')][_0x8094('0x28')]?_0x1f8d7a['attributes']:_0x5a9224['model'];if(!_0x3d2bec[_0x8094('0x22')][_0x8094('0x29')]('nolimit')){_0x1f8d7a[_0x8094('0x11')]=qs[_0x8094('0x11')](_0x3d2bec[_0x8094('0x22')][_0x8094('0x11')]);_0x1f8d7a[_0x8094('0xf')]=qs[_0x8094('0xf')](_0x3d2bec[_0x8094('0x22')][_0x8094('0xf')]);}_0x1f8d7a[_0x8094('0x2a')]=qs[_0x8094('0x2b')](_0x3d2bec[_0x8094('0x22')][_0x8094('0x2b')]);_0x1f8d7a[_0x8094('0x2c')]=qs[_0x8094('0x24')](_[_0x8094('0x2d')](_0x3d2bec[_0x8094('0x22')],_0x5a9224[_0x8094('0x24')]),_0x174930);if(_0x3d2bec['query'][_0x8094('0x2e')]){_0x1f8d7a[_0x8094('0x2c')]=_[_0x8094('0x2f')](_0x1f8d7a['where'],{'$or':_[_0x8094('0x1c')](_0x174930,function(_0x25ea17){if(_0x25ea17[_0x8094('0x1f')]!=='VIRTUAL'){var _0xd11d6b={};_0xd11d6b[_0x25ea17[_0x8094('0x19')]]={'$like':'%'+_0x3d2bec['query'][_0x8094('0x2e')]+'%'};return _0xd11d6b;}})});}_0x1f8d7a=_[_0x8094('0x2f')]({},_0x1f8d7a,_0x3d2bec[_0x8094('0x30')]);var _0x1a1c94={'where':_0x1f8d7a[_0x8094('0x2c')]};return db[_0x8094('0x1d')][_0x8094('0x12')](_0x1a1c94)[_0x8094('0x16')](function(_0x578d54){_0x496484[_0x8094('0x12')]=_0x578d54;if(_0x3d2bec['query'][_0x8094('0x31')]){_0x1f8d7a[_0x8094('0x32')]=[{'all':!![]}];}return db[_0x8094('0x1d')][_0x8094('0x33')](_0x1f8d7a);})[_0x8094('0x16')](function(_0x8abf12){_0x496484[_0x8094('0x34')]=_['map'](_0x8abf12,function(_0xa75b4){if(_0xa75b4[_0x8094('0x35')]===_0x8094('0x36')){var _0x313470=encryptor[_0x8094('0x37')](_0xa75b4[_0x8094('0x38')]);_0xa75b4[_0x8094('0x38')]=maskClientSecret(_0x313470);}return _0xa75b4;});return _0x496484;})[_0x8094('0x16')](respondWithFilteredResult(_0x40bf74,_0x1f8d7a))[_0x8094('0x39')](handleError(_0x40bf74,null));};exports[_0x8094('0x3a')]=function(_0xbd04d5,_0x36de5a){var _0x123045={'raw':!![],'where':{'id':_0xbd04d5[_0x8094('0x3b')]['id']}},_0x1ca2a5={};_0x1ca2a5[_0x8094('0x21')]=_[_0x8094('0x23')](db[_0x8094('0x1d')]['rawAttributes']);_0x1ca2a5[_0x8094('0x22')]=_[_0x8094('0x23')](_0xbd04d5[_0x8094('0x22')]);_0x1ca2a5[_0x8094('0x24')]=_[_0x8094('0x25')](_0x1ca2a5[_0x8094('0x21')],_0x1ca2a5['query']);_0x123045[_0x8094('0x26')]=_[_0x8094('0x25')](_0x1ca2a5[_0x8094('0x21')],qs[_0x8094('0x27')](_0xbd04d5[_0x8094('0x22')]['fields']));_0x123045[_0x8094('0x26')]=_0x123045[_0x8094('0x26')][_0x8094('0x28')]?_0x123045[_0x8094('0x26')]:_0x1ca2a5[_0x8094('0x21')];if(_0xbd04d5[_0x8094('0x22')]['includeAll']){_0x123045[_0x8094('0x32')]=[{'all':!![]}];}_0x123045=_[_0x8094('0x2f')]({},_0x123045,_0xbd04d5[_0x8094('0x30')]);return db['CloudProvider'][_0x8094('0x3c')](_0x123045)[_0x8094('0x16')](handleEntityNotFound(_0x36de5a,null))['then'](function(_0x4b1faf){if(_0x4b1faf[_0x8094('0x35')]==='MicrosoftAzure'){var _0x5edc44=encryptor[_0x8094('0x37')](_0x4b1faf[_0x8094('0x38')]);_0x4b1faf[_0x8094('0x38')]=maskClientSecret(_0x5edc44);}return _0x4b1faf;})[_0x8094('0x16')](respondWithResult(_0x36de5a,null))[_0x8094('0x39')](handleError(_0x36de5a,null));};exports[_0x8094('0x3d')]=function(_0x4646a5,_0x55ad95){if(!_0x4646a5[_0x8094('0x3e')][_0x8094('0x19')])throw new Error(_0x8094('0x3f'));if(!_0x4646a5[_0x8094('0x3e')]['service'])throw new Error(_0x8094('0x40'));var _0x39753c=db[_0x8094('0x1d')]['rawAttributes'][_0x8094('0x35')][_0x8094('0x41')];if(!_0x39753c['includes'](_0x4646a5[_0x8094('0x3e')]['service']))throw new Error(_0x8094('0x42')+_0x39753c[_0x8094('0x43')](',\x20'));if(_0x4646a5['body'][_0x8094('0x35')]===_0x8094('0x36')&&_0x4646a5[_0x8094('0x3e')]['data3']){_0x4646a5[_0x8094('0x3e')][_0x8094('0x38')]=encryptor[_0x8094('0x44')](_0x4646a5[_0x8094('0x3e')][_0x8094('0x38')]);}return db['CloudProvider']['create'](_0x4646a5['body'],{})['then'](respondWithResult(_0x55ad95,0xc9))[_0x8094('0x39')](handleError(_0x55ad95,null));};exports['update']=function(_0x224cbd,_0x444f1d){if(_0x224cbd['body']['id']){delete _0x224cbd['body']['id'];}return db['CloudProvider'][_0x8094('0x3c')]({'where':{'id':_0x224cbd[_0x8094('0x3b')]['id']}})[_0x8094('0x16')](handleEntityNotFound(_0x444f1d,null))[_0x8094('0x16')](function(_0x15a148){if(_0x15a148['service']===_0x8094('0x36')&&_0x224cbd[_0x8094('0x3e')][_0x8094('0x38')]){_0x224cbd[_0x8094('0x3e')][_0x8094('0x38')]=encryptor[_0x8094('0x44')](_0x224cbd[_0x8094('0x3e')][_0x8094('0x38')]);}return _0x15a148;})[_0x8094('0x16')](saveUpdates(_0x224cbd[_0x8094('0x3e')],null))[_0x8094('0x16')](respondWithResult(_0x444f1d,null))[_0x8094('0x39')](handleError(_0x444f1d,null));};exports[_0x8094('0x17')]=function(_0x516a97,_0x1f095a){return db[_0x8094('0x1d')][_0x8094('0x3c')]({'where':{'id':_0x516a97[_0x8094('0x3b')]['id']}})[_0x8094('0x16')](handleEntityNotFound(_0x1f095a,null))['then'](removeEntity(_0x1f095a,null))[_0x8094('0x39')](handleError(_0x1f095a,null));};exports[_0x8094('0x45')]=function(_0x37716a,_0x13f84b){return db['CloudProvider'][_0x8094('0x46')]({'where':{'id':_0x37716a[_0x8094('0x3b')]['id']},'raw':!![]})[_0x8094('0x16')](function(_0x1de5b4){if(!_0x1de5b4)return _0x13f84b[_0x8094('0xb')](0x194);return{'url':oauth[_0x8094('0x47')](_0x1de5b4,_0x37716a[_0x8094('0x48')]['id'])};})[_0x8094('0x16')](respondWithResult(_0x13f84b,null))[_0x8094('0x39')](handleError(_0x13f84b,null));};exports['oauth2MicrosoftCallback']=function(_0x2275be,_0x2e5080){var _0x156a0b=_0x2275be['body'];var _0x41769e;var _0x1189d2;if(_0x156a0b[_0x8094('0x18')])throw _0x156a0b;redis['get'](_0x156a0b['state'])[_0x8094('0x16')](function(_0x40d2ba){if(!_0x40d2ba)throw new Error(_0x8094('0x49'));_0x41769e=JSON['parse'](_0x40d2ba);var _0x46a5a0=Buffer[_0x8094('0x4a')](_0x156a0b['state'],_0x8094('0x4b'))[_0x8094('0x4c')](_0x8094('0x4d'));_0x1189d2=JSON[_0x8094('0x4e')](_0x46a5a0);if(!oauth['isValidIdToken'](_0x156a0b['id_token'],_0x41769e[_0x8094('0x4f')]))throw new Error(_0x8094('0x50'));redis[_0x8094('0x51')](_0x156a0b[_0x8094('0x52')]);return oauth[_0x8094('0x53')](_0x156a0b[_0x8094('0x54')],_0x41769e);})[_0x8094('0x16')](function(_0xf8d6df){_0x41769e['data5']=_0xf8d6df[_0x8094('0x55')];_0x41769e[_0x8094('0x56')]=_0xf8d6df[_0x8094('0x57')];return db[_0x8094('0x1d')][_0x8094('0x15')]({'data5':_0x41769e['data5'],'data6':_0x41769e[_0x8094('0x56')]},{'where':{'id':_0x41769e['id']}});})[_0x8094('0x16')](function(){oauth[_0x8094('0x58')](_0x41769e);socket[_0x8094('0x59')](_0x8094('0x5a'),{'id':_0x1189d2['id']});return;})[_0x8094('0x16')](respondWithStatusCode(_0x2e5080,null))[_0x8094('0x39')](function(_0x3014a0){if(_0x1189d2){socket['emit']('microsoftAuthorization:error',{'id':_0x1189d2['id']});}if(!_0x41769e){logger[_0x8094('0x18')]('Invalid\x20authentication\x20state\x20parameter',_0x3014a0);return _0x2e5080[_0x8094('0xc')](0x1f4)['send'](_0x3014a0['message']);}logger[_0x8094('0x18')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x41769e['id'],JSON[_0x8094('0x5b')](_0x3014a0));});}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index eff3440..7bfdb9c 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 _0x9fd1=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cloudProvider.attributes','define','cloud_providers','lodash'];(function(_0x2dc33c,_0x2ab129){var _0x4148fb=function(_0x225aa3){while(--_0x225aa3){_0x2dc33c['push'](_0x2dc33c['shift']());}};_0x4148fb(++_0x2ab129);}(_0x9fd1,0x1d8));var _0x19fd=function(_0x38568b,_0x590027){_0x38568b=_0x38568b-0x0;var _0x3966f0=_0x9fd1[_0x38568b];return _0x3966f0;};'use strict';var _=require(_0x19fd('0x0'));var util=require(_0x19fd('0x1'));var logger=require(_0x19fd('0x2'))(_0x19fd('0x3'));var moment=require(_0x19fd('0x4'));var BPromise=require(_0x19fd('0x5'));var rp=require(_0x19fd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x19fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x19fd('0x8'));module['exports']=function(_0x56efaa,_0x304306){return _0x56efaa[_0x19fd('0x9')]('CloudProvider',attributes,{'tableName':_0x19fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 1b2a93a..a29d2aa 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 _0x266e=['hex','client_id','data1','response_type','response_mode','scope','state','nonce','prompt','value','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data4','decryptString','POST','data5','access_token','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','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','map','type','Dynamics365','push','data7','Outlook365','/.default','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','randomBytes'];(function(_0x47b1ae,_0x497434){var _0x140468=function(_0x51179b){while(--_0x51179b){_0x47b1ae['push'](_0x47b1ae['shift']());}};_0x140468(++_0x497434);}(_0x266e,0xc3));var _0xe266=function(_0x37c357,_0x239f12){_0x37c357=_0x37c357-0x0;var _0x33e961=_0x266e[_0x37c357];return _0x33e961;};'use strict';var _=require(_0xe266('0x0'));var crypto=require(_0xe266('0x1'));var jwt=require(_0xe266('0x2'));var moment=require(_0xe266('0x3'));var Redis=require(_0xe266('0x4'));var rp=require(_0xe266('0x5'));var util=require(_0xe266('0x6'));var encryptor=require(_0xe266('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var schedule=require(_0xe266('0x8'));var db=require(_0xe266('0x9'))['db'];config[_0xe266('0xa')]=_[_0xe266('0xb')](config['redis'],{'host':_0xe266('0xc'),'port':0x18eb});var redis=new Redis(config[_0xe266('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xe266('0xd'),_0xe266('0xe'),_0xe266('0xf'),_0xe266('0x10'),_0xe266('0x11'),_0xe266('0x12'),_0xe266('0x13')],'Dynamics365':[_0xe266('0xd'),_0xe266('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x595376){var _0x50de2b=_[_0xe266('0x14')](AZURE_AUTH_SCOPES[_0x595376[_0xe266('0x15')]]);if(_0x595376[_0xe266('0x15')]===_0xe266('0x16'))_0x50de2b[_0xe266('0x17')](_0x595376[_0xe266('0x18')]+'/.default');return _0x50de2b['join']('\x20');}function getAccessTokenScope(_0x165ea6){if(_0x165ea6[_0xe266('0x15')]===_0xe266('0x19'))return _0xe266('0x11');if(_0x165ea6['type']==='Dynamics365')return _0x165ea6[_0xe266('0x18')]+_0xe266('0x1a');}function generateMicrosoftAuthorizationUrl(_0xc0edcb,_0x577975){var _0xa632d3=MICROSOFT_AUTH_URL[_0xe266('0x1b')](_0xe266('0x1c'),_0xc0edcb[_0xe266('0x1d')]);var _0x484eb6=[_0xe266('0x1e'),_0xe266('0x1f')];var _0x131592=Buffer[_0xe266('0x20')](JSON['stringify']({'id':_0x577975}))[_0xe266('0x21')](_0xe266('0x22'));var _0x1a80a8=crypto[_0xe266('0x23')](0x10)['toString'](_0xe266('0x24'));var _0x234fe4=getAuthorizationScopes(_0xc0edcb);var _0x193bb7=[{'key':_0xe266('0x25'),'value':_0xc0edcb[_0xe266('0x26')]},{'key':_0xe266('0x27'),'value':encodeURIComponent(_0x484eb6['join']('\x20'))},{'key':'redirect_uri','value':_0xc0edcb['data4']},{'key':_0xe266('0x28'),'value':'form_post'},{'key':_0xe266('0x29'),'value':encodeURIComponent(_0x234fe4)},{'key':_0xe266('0x2a'),'value':_0x131592},{'key':_0xe266('0x2b'),'value':_0x1a80a8},{'key':_0xe266('0x2c'),'value':'login'}];var _0x2fd279=_0xa632d3+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xe266('0x14')](_0x193bb7,function(_0x22ba3a){return _0x22ba3a['key']+'='+_0x22ba3a[_0xe266('0x2d')];})['join']('&');_0xc0edcb['oauth2Claims']={'issuer':_0xa632d3[_0xe266('0x1b')](_0xe266('0x2e'),''),'audience':_0xc0edcb['data1'],'state':_0x131592,'nonce':_0x1a80a8};redis[_0xe266('0x2f')](_0x131592,JSON['stringify'](_0xc0edcb));return _0x2fd279;}function isValidIdToken(_0x5c6ecf,_0x1424fa){try{var _0x5baa06=jwt[_0xe266('0x30')](_0x5c6ecf,{'complete':!![]});var _0x4e5469=_0x5baa06[_0xe266('0x31')];if(_0x4e5469[_0xe266('0x32')]!==_0x1424fa[_0xe266('0x33')])return![];if(_0x4e5469[_0xe266('0x34')]!==_0x1424fa[_0xe266('0x35')])return![];if(_0x4e5469['nonce']!==_0x1424fa[_0xe266('0x2b')])return![];if(moment()[_0xe266('0x36')](moment[_0xe266('0x37')](_0x4e5469[_0xe266('0x38')])))return![];return!![];}catch(_0x259958){throw _0x259958;}}function refreshOauth2MicrosoftAccessToken(_0x1c3482){return Promise[_0xe266('0x39')]()['then'](function(){if(_0x1c3482[_0xe266('0x3a')])return _0x1c3482;return db[_0xe266('0x3b')][_0xe266('0x3c')]({'where':{'id':_0x1c3482['id']},'raw':!![]});})[_0xe266('0x3d')](function(_0x439544){var _0x33598a={'grant_type':_0xe266('0x3e'),'refresh_token':_0x439544['data6'],'scope':getAccessTokenScope(_0x439544),'redirect_uri':_0x439544[_0xe266('0x3f')],'client_id':_0x439544[_0xe266('0x26')],'client_secret':encryptor[_0xe266('0x40')](_0x439544['data3'])};var _0x494465={'method':_0xe266('0x41'),'uri':MICROSOFT_AUTH_URL[_0xe266('0x1b')]('{TENANT_ID}',_0x439544[_0xe266('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x33598a,'json':!![]};return rp(_0x494465);})['then'](function(_0x4cfae5){_0x1c3482[_0xe266('0x42')]=_0x4cfae5[_0xe266('0x43')];_0x1c3482[_0xe266('0x44')]=_0x4cfae5['refresh_token'];return db[_0xe266('0x3b')]['update']({'data5':_0x1c3482['data5'],'data6':_0x1c3482[_0xe266('0x44')]},{'where':{'id':_0x1c3482['id']}});})[_0xe266('0x3d')](function(){return _0x1c3482;})[_0xe266('0x45')](function(_0x5d4efb){logger[_0xe266('0x46')](_0xe266('0x47'),_0x1c3482['id'],_0x5d4efb);});}function getOauth2MicrosoftAccessToken(_0x3d7d06,_0xcc5b9b){var _0x7e0751={'grant_type':_0xe266('0x48'),'code':_0x3d7d06,'scope':getAccessTokenScope(_0xcc5b9b),'redirect_uri':_0xcc5b9b[_0xe266('0x3f')],'client_id':_0xcc5b9b['data1'],'client_secret':encryptor[_0xe266('0x40')](_0xcc5b9b[_0xe266('0x3a')])};var _0x1ef3d3={'method':_0xe266('0x41'),'uri':MICROSOFT_AUTH_URL['replace'](_0xe266('0x1c'),_0xcc5b9b[_0xe266('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x7e0751,'json':!![]};return rp(_0x1ef3d3);}function startRefreshInterval(_0x2d0e02){var _0x15920c=schedule[_0xe266('0x49')];if(_0x15920c[_0x2d0e02['id']])clearInterval(_0x15920c[_0x2d0e02['id']]);_0x15920c[_0x2d0e02['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x2d0e02['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xe266('0x49')]=_0x15920c;}function startAllRefreshIntervals(){return db[_0xe266('0x3b')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe266('0x3d')](function(_0x23b7b6){var _0x3a60d6=_0x23b7b6['map'](function(_0x19558a){return refreshOauth2MicrosoftAccessToken(_0x19558a)['then'](function(_0x1a53f3){startRefreshInterval(_0x1a53f3);});});return Promise[_0xe266('0x4a')](_0x3a60d6);})[_0xe266('0x45')](function(_0x25f8ee){var _0x570e0d=_0x25f8ee?util[_0xe266('0x4b')](_0x25f8ee,{'showHidden':![],'depth':null}):'';logger['error'](_0xe266('0x4c'),_0x570e0d);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +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 diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ec019fb..a7098c1 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 _0xe1e8=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x489695,_0x103672){_0x489695=_0x489695-0x0;var _0x23c2b0=_0xe1e8[_0x489695];return _0x23c2b0;};'use strict';var _=require(_0x8e1e('0x0'));var util=require('util');var moment=require(_0x8e1e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1e('0x2'));var db=require(_0x8e1e('0x3'))['db'];var utils=require(_0x8e1e('0x4'));var logger=require(_0x8e1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e1e('0x6'));var client=jayson[_0x8e1e('0x7')][_0x8e1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1861ce,_0x4eb2b7,_0x21ee75){return new BPromise(function(_0xe8a658,_0x3a1ead){return client['request'](_0x1861ce,_0x21ee75)['then'](function(_0x4007f3){logger[_0x8e1e('0x9')]('CloudProvider,\x20%s,\x20%s',_0x4eb2b7,_0x8e1e('0xa'));logger['debug'](_0x8e1e('0xb'),_0x4eb2b7,_0x8e1e('0xa'),JSON[_0x8e1e('0xc')](_0x4007f3));if(_0x4007f3[_0x8e1e('0xd')]){if(_0x4007f3[_0x8e1e('0xd')]['code']===0x1f4){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3[_0x8e1e('0xd')]['message']);return _0x3a1ead(_0x4007f3[_0x8e1e('0xd')][_0x8e1e('0xf')]);}logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3['error']['message']);return _0xe8a658(_0x4007f3['error'][_0x8e1e('0xf')]);}else{logger[_0x8e1e('0x9')](_0x8e1e('0xe'),_0x4eb2b7,_0x8e1e('0xa'));_0xe8a658(_0x4007f3[_0x8e1e('0x10')]['message']);}})['catch'](function(_0x2d2dc2){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x2d2dc2);_0x3a1ead(_0x2d2dc2);});});} \ No newline at end of file +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 diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index dc2ba30..629456e 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x2ffa35,_0xe08305){var _0x3d1bad=function(_0x5d131a){while(--_0x5d131a){_0x2ffa35['push'](_0x2ffa35['shift']());}};_0x3d1bad(++_0xe08305);}(_0xdb28,0x106));var _0x8db2=function(_0x189888,_0x1cf033){_0x189888=_0x189888-0x0;var _0x5f3da5=_0xdb28[_0x189888];return _0x5f3da5;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 3774247..611ad7d 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 _0x396d=['name','exports','STRING'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x396d,0x97));var _0xd396=function(_0x289c9a,_0x1bbaba){_0x289c9a=_0x289c9a-0x0;var _0x4b4e41=_0x396d[_0x289c9a];return _0x4b4e41;};'use strict';var Sequelize=require('sequelize');module[_0xd396('0x0')]={'name':{'type':Sequelize[_0xd396('0x1')],'unique':_0xd396('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd396('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xd396('0x1')]},'phone':{'type':Sequelize[_0xd396('0x1')]},'fax':{'type':Sequelize[_0xd396('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd396('0x1')]},'postalCode':{'type':Sequelize[_0xd396('0x1')]},'city':{'type':Sequelize[_0xd396('0x1')]},'country':{'type':Sequelize[_0xd396('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd396('0x1')]},'sStreet':{'type':Sequelize[_0xd396('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd396('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6aae1a3..4740a4d 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 _0xece0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','error','name','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x4d6f79,_0x7611b1){var _0x267d89=function(_0x18d0fc){while(--_0x18d0fc){_0x4d6f79['push'](_0x4d6f79['shift']());}};_0x267d89(++_0x7611b1);}(_0xece0,0x9b));var _0x0ece=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xece0[_0x36b400];return _0x4d47bf;};'use strict';var emlformat=require(_0x0ece('0x0'));var rimraf=require(_0x0ece('0x1'));var zipdir=require(_0x0ece('0x2'));var jsonpatch=require(_0x0ece('0x3'));var rp=require('request-promise');var moment=require(_0x0ece('0x4'));var BPromise=require(_0x0ece('0x5'));var Mustache=require(_0x0ece('0x6'));var util=require(_0x0ece('0x7'));var path=require(_0x0ece('0x8'));var sox=require(_0x0ece('0x9'));var csv=require('to-csv');var ejs=require(_0x0ece('0xa'));var fs=require('fs');var fs_extra=require(_0x0ece('0xb'));var _=require(_0x0ece('0xc'));var squel=require('squel');var crypto=require(_0x0ece('0xd'));var jsforce=require(_0x0ece('0xe'));var deskjs=require(_0x0ece('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ece('0x10'));var Papa=require(_0x0ece('0x11'));var Redis=require(_0x0ece('0x12'));var authService=require(_0x0ece('0x13'));var qs=require(_0x0ece('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ece('0x15'));var logger=require('../../config/logger')(_0x0ece('0x16'));var utils=require('../../config/utils');var config=require(_0x0ece('0x17'));var licenseUtil=require(_0x0ece('0x18'));var db=require(_0x0ece('0x19'))['db'];function respondWithStatusCode(_0x531bb1,_0x162e2f){_0x162e2f=_0x162e2f||0xcc;return function(_0x3a94b8){if(_0x3a94b8){return _0x531bb1['sendStatus'](_0x162e2f);}return _0x531bb1[_0x0ece('0x1a')](_0x162e2f)[_0x0ece('0x1b')]();};}function respondWithResult(_0x4943f6,_0x4e633b){_0x4e633b=_0x4e633b||0xc8;return function(_0x12d8f1){if(_0x12d8f1){return _0x4943f6[_0x0ece('0x1a')](_0x4e633b)['json'](_0x12d8f1);}};}function respondWithFilteredResult(_0x455ad5,_0x1c811d){return function(_0x29bd9c){if(_0x29bd9c){var _0x5ce7fa=typeof _0x1c811d[_0x0ece('0x1c')]===_0x0ece('0x1d')&&typeof _0x1c811d[_0x0ece('0x1e')]==='undefined';var _0x25d76b=_0x29bd9c[_0x0ece('0x1f')];var _0x23368c=_0x5ce7fa?0x0:_0x1c811d[_0x0ece('0x1c')];var _0x4e1017=_0x5ce7fa?_0x29bd9c[_0x0ece('0x1f')]:_0x1c811d[_0x0ece('0x1c')]+_0x1c811d[_0x0ece('0x1e')];var _0x457e26;if(_0x4e1017>=_0x25d76b){_0x4e1017=_0x25d76b;_0x457e26=0xc8;}else{_0x457e26=0xce;}_0x455ad5[_0x0ece('0x1a')](_0x457e26);return _0x455ad5[_0x0ece('0x20')](_0x0ece('0x21'),_0x23368c+'-'+_0x4e1017+'/'+_0x25d76b)[_0x0ece('0x22')](_0x29bd9c);}return null;};}function patchUpdates(_0x4b25d5){return function(_0x91cf67){try{jsonpatch[_0x0ece('0x23')](_0x91cf67,_0x4b25d5,!![]);}catch(_0x4241a7){return BPromise[_0x0ece('0x24')](_0x4241a7);}return _0x91cf67[_0x0ece('0x25')]();};}function saveUpdates(_0xac7294,_0x8e18ee){return function(_0x31b191){if(_0x31b191){return _0x31b191[_0x0ece('0x26')](_0xac7294)['then'](function(_0x498dfd){return _0x498dfd;});}return null;};}function removeEntity(_0x4e693d,_0x464147){return function(_0x22de1b){if(_0x22de1b){return _0x22de1b[_0x0ece('0x27')]()[_0x0ece('0x28')](function(){var _0x44ebc3=_0x22de1b[_0x0ece('0x29')]({'plain':!![]});var _0x15f40e='Companies';return db[_0x0ece('0x2a')][_0x0ece('0x27')]({'where':{'type':_0x15f40e,'resourceId':_0x44ebc3['id']}})[_0x0ece('0x28')](function(){return _0x22de1b;});})['then'](function(){_0x4e693d['status'](0xcc)[_0x0ece('0x1b')]();});}};}function handleEntityNotFound(_0x532877,_0x816227){return function(_0x725258){if(!_0x725258){_0x532877[_0x0ece('0x2b')](0x194);}return _0x725258;};}function handleError(_0x1a14c2,_0x204a0b){_0x204a0b=_0x204a0b||0x1f4;return function(_0x13b2ae){logger[_0x0ece('0x2c')](_0x13b2ae['stack']);if(_0x13b2ae[_0x0ece('0x2d')]){delete _0x13b2ae[_0x0ece('0x2d')];}_0x1a14c2['status'](_0x204a0b)['send'](_0x13b2ae);};}exports[_0x0ece('0x2e')]=function(_0x25bac7,_0x5af8be){var _0x4b2a62={},_0x515100={},_0x4b76e9={'count':0x0,'rows':[]};return db[_0x0ece('0x2f')][_0x0ece('0x30')]()[_0x0ece('0x28')](function(_0x39be6b){_0x515100[_0x0ece('0x31')]=_[_0x0ece('0x32')](_0x39be6b);_0x515100['query']=_['keys'](_0x25bac7[_0x0ece('0x33')]);_0x515100[_0x0ece('0x34')]=_[_0x0ece('0x35')](_0x515100['model'],_0x515100['query']);_0x4b2a62['attributes']=_[_0x0ece('0x35')](_0x515100['model'],qs[_0x0ece('0x36')](_0x25bac7[_0x0ece('0x33')]['fields']));_0x4b2a62[_0x0ece('0x37')]=_0x4b2a62[_0x0ece('0x37')][_0x0ece('0x38')]?_0x4b2a62['attributes']:_0x515100[_0x0ece('0x31')];if(!_0x25bac7[_0x0ece('0x33')][_0x0ece('0x39')]('nolimit')){_0x4b2a62[_0x0ece('0x1e')]=qs[_0x0ece('0x1e')](_0x25bac7[_0x0ece('0x33')][_0x0ece('0x1e')]);_0x4b2a62[_0x0ece('0x1c')]=qs[_0x0ece('0x1c')](_0x25bac7['query'][_0x0ece('0x1c')]);}_0x4b2a62[_0x0ece('0x3a')]=qs[_0x0ece('0x3b')](_0x25bac7[_0x0ece('0x33')][_0x0ece('0x3b')]);_0x4b2a62[_0x0ece('0x3c')]=qs[_0x0ece('0x34')](_[_0x0ece('0x3d')](_0x25bac7[_0x0ece('0x33')],_0x515100['filters']),_0x39be6b);if(_0x25bac7['query'][_0x0ece('0x3e')]){_0x4b2a62['where']=_[_0x0ece('0x3f')](_0x4b2a62[_0x0ece('0x3c')],{'$or':_[_0x0ece('0x40')](_0x4b2a62['attributes'],function(_0x3372bf){var _0x19b8fe={};_0x19b8fe[_0x3372bf]={'$like':'%'+_0x25bac7[_0x0ece('0x33')]['filter']+'%'};return _0x19b8fe;})});}_0x4b2a62=_['merge']({},_0x4b2a62,_0x25bac7[_0x0ece('0x41')]);var _0x21b14a={'where':_0x4b2a62[_0x0ece('0x3c')]};return db[_0x0ece('0x2f')]['count'](_0x21b14a)[_0x0ece('0x28')](function(_0x475014){_0x4b76e9['count']=_0x475014;if(_0x25bac7[_0x0ece('0x33')][_0x0ece('0x42')]){_0x4b2a62[_0x0ece('0x43')]=[{'all':!![]}];}return db[_0x0ece('0x2f')][_0x0ece('0x44')](_0x4b2a62);})[_0x0ece('0x28')](function(_0x51adab){_0x4b76e9['rows']=_0x51adab;return _0x4b76e9;})['then'](respondWithFilteredResult(_0x5af8be,_0x4b2a62))['catch'](handleError(_0x5af8be,null));})[_0x0ece('0x45')](handleError(_0x5af8be,null));};exports[_0x0ece('0x46')]=function(_0x3066d1,_0x422aba){var _0x15d879={'raw':![],'where':{'id':_0x3066d1[_0x0ece('0x47')]['id']}},_0x308782={};_0x308782['model']=_[_0x0ece('0x32')](db[_0x0ece('0x2f')][_0x0ece('0x48')]);_0x308782[_0x0ece('0x33')]=_[_0x0ece('0x32')](_0x3066d1['query']);_0x308782[_0x0ece('0x34')]=_[_0x0ece('0x35')](_0x308782[_0x0ece('0x31')],_0x308782[_0x0ece('0x33')]);_0x15d879[_0x0ece('0x37')]=_['intersection'](_0x308782[_0x0ece('0x31')],qs['fields'](_0x3066d1[_0x0ece('0x33')][_0x0ece('0x36')]));_0x15d879[_0x0ece('0x37')]=_0x15d879[_0x0ece('0x37')][_0x0ece('0x38')]?_0x15d879[_0x0ece('0x37')]:_0x308782['model'];if(_0x3066d1['query'][_0x0ece('0x42')]){_0x15d879['include']=[{'all':!![]}];}_0x15d879=_[_0x0ece('0x3f')]({},_0x15d879,_0x3066d1[_0x0ece('0x41')]);return db[_0x0ece('0x2f')]['find'](_0x15d879)[_0x0ece('0x28')](handleEntityNotFound(_0x422aba,null))[_0x0ece('0x28')](respondWithResult(_0x422aba,null))[_0x0ece('0x45')](handleError(_0x422aba,null));};exports['create']=function(_0x598bdd,_0x1cfcce){return db[_0x0ece('0x2f')]['create'](_0x598bdd[_0x0ece('0x49')],{})[_0x0ece('0x28')](function(_0x4c4f9c){var _0x106f1f=_0x598bdd['user']['get']({'plain':!![]});if(!_0x106f1f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106f1f[_0x0ece('0x4a')]===_0x0ece('0x4b')){var _0x9a071d=_0x4c4f9c[_0x0ece('0x29')]({'plain':!![]});var _0x5ebba2='Companies';return db[_0x0ece('0x4c')][_0x0ece('0x4d')]({'where':{'name':_0x5ebba2,'userProfileId':_0x106f1f['userProfileId']},'raw':!![]})[_0x0ece('0x28')](function(_0x438dd8){if(_0x438dd8&&_0x438dd8[_0x0ece('0x4e')]===0x0){return db[_0x0ece('0x2a')]['create']({'name':_0x9a071d[_0x0ece('0x2d')],'resourceId':_0x9a071d['id'],'type':_0x438dd8[_0x0ece('0x2d')],'sectionId':_0x438dd8['id']},{})[_0x0ece('0x28')](function(){return _0x4c4f9c;});}else{return _0x4c4f9c;}})[_0x0ece('0x45')](function(_0x535ea7){logger[_0x0ece('0x2c')](_0x0ece('0x4f'),_0x535ea7);throw _0x535ea7;});}return _0x4c4f9c;})[_0x0ece('0x28')](respondWithResult(_0x1cfcce,0xc9))[_0x0ece('0x45')](handleError(_0x1cfcce,null));};exports['update']=function(_0x21478a,_0x4b80cb){if(_0x21478a[_0x0ece('0x49')]['id']){delete _0x21478a['body']['id'];}return db[_0x0ece('0x2f')][_0x0ece('0x4d')]({'where':{'id':_0x21478a[_0x0ece('0x47')]['id']}})[_0x0ece('0x28')](handleEntityNotFound(_0x4b80cb,null))[_0x0ece('0x28')](saveUpdates(_0x21478a[_0x0ece('0x49')],null))[_0x0ece('0x28')](respondWithResult(_0x4b80cb,null))[_0x0ece('0x45')](handleError(_0x4b80cb,null));};exports[_0x0ece('0x27')]=function(_0xb4fecc,_0x27efe6){return db[_0x0ece('0x2f')][_0x0ece('0x4d')]({'where':{'id':_0xb4fecc[_0x0ece('0x47')]['id']}})['then'](handleEntityNotFound(_0x27efe6,null))[_0x0ece('0x28')](removeEntity(_0x27efe6,null))['catch'](handleError(_0x27efe6,null));};exports[_0x0ece('0x30')]=function(_0x575a9e,_0x4010a1){return db[_0x0ece('0x2f')][_0x0ece('0x30')]()[_0x0ece('0x28')](respondWithResult(_0x4010a1,null))[_0x0ece('0x45')](handleError(_0x4010a1,null));};exports[_0x0ece('0x50')]=function(_0x32736a,_0x13a4e6,_0x3a5e20){return db['CmContact'][_0x0ece('0x4d')]({'where':{'id':_0x32736a[_0x0ece('0x47')]['id']}})[_0x0ece('0x28')](handleEntityNotFound(_0x13a4e6,null))[_0x0ece('0x28')](function(_0x45a7e8){if(_0x45a7e8){return _0x45a7e8[_0x0ece('0x50')](_0x32736a[_0x0ece('0x49')][_0x0ece('0x51')],_[_0x0ece('0x52')](_0x32736a[_0x0ece('0x49')],[_0x0ece('0x51'),'id'])||{});}})[_0x0ece('0x28')](respondWithResult(_0x13a4e6,null))['catch'](handleError(_0x13a4e6,null));};exports[_0x0ece('0x53')]=function(_0x7de6ea,_0x5efc78,_0x596a8d){var _0x4c14bc={};var _0x184204={};var _0x2ad8bb;var _0x55ffca;return db['CmCompany'][_0x0ece('0x54')]({'where':{'id':_0x7de6ea['params']['id']}})[_0x0ece('0x28')](handleEntityNotFound(_0x5efc78,null))[_0x0ece('0x28')](function(_0x7c21d1){if(_0x7c21d1){_0x2ad8bb=_0x7c21d1;_0x184204['model']=_[_0x0ece('0x32')](db['CmContact']['rawAttributes']);_0x184204[_0x0ece('0x33')]=_[_0x0ece('0x32')](_0x7de6ea['query']);_0x184204[_0x0ece('0x34')]=_[_0x0ece('0x35')](_0x184204[_0x0ece('0x31')],_0x184204[_0x0ece('0x33')]);_0x4c14bc[_0x0ece('0x37')]=_[_0x0ece('0x35')](_0x184204['model'],qs['fields'](_0x7de6ea['query'][_0x0ece('0x36')]));_0x4c14bc[_0x0ece('0x37')]=_0x4c14bc[_0x0ece('0x37')][_0x0ece('0x38')]?_0x4c14bc[_0x0ece('0x37')]:_0x184204['model'];_0x4c14bc[_0x0ece('0x3a')]=qs[_0x0ece('0x3b')](_0x7de6ea[_0x0ece('0x33')]['sort']);_0x4c14bc['where']=qs[_0x0ece('0x34')](_['pick'](_0x7de6ea[_0x0ece('0x33')],_0x184204['filters']));if(_0x7de6ea[_0x0ece('0x33')]['filter']){_0x4c14bc[_0x0ece('0x3c')]=_[_0x0ece('0x3f')](_0x4c14bc[_0x0ece('0x3c')],{'$or':_[_0x0ece('0x40')](_0x4c14bc['attributes'],function(_0x677476){var _0x371d25={};_0x371d25[_0x677476]={'$like':'%'+_0x7de6ea[_0x0ece('0x33')][_0x0ece('0x3e')]+'%'};return _0x371d25;})});}_0x4c14bc=_[_0x0ece('0x3f')]({},_0x4c14bc,_0x7de6ea[_0x0ece('0x41')]);return _0x2ad8bb[_0x0ece('0x53')](_0x4c14bc);}})[_0x0ece('0x28')](function(_0x284be1){if(_0x284be1){_0x55ffca=_0x284be1[_0x0ece('0x38')];if(!_0x7de6ea[_0x0ece('0x33')]['hasOwnProperty'](_0x0ece('0x55'))){_0x4c14bc[_0x0ece('0x1e')]=qs[_0x0ece('0x1e')](_0x7de6ea[_0x0ece('0x33')]['limit']);_0x4c14bc[_0x0ece('0x1c')]=qs[_0x0ece('0x1c')](_0x7de6ea[_0x0ece('0x33')]['offset']);}return _0x2ad8bb[_0x0ece('0x53')](_0x4c14bc);}})['then'](function(_0x59d0d9){if(_0x59d0d9){return _0x59d0d9?{'count':_0x55ffca,'rows':_0x59d0d9}:null;}})[_0x0ece('0x28')](respondWithResult(_0x5efc78,null))[_0x0ece('0x45')](handleError(_0x5efc78,null));}; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 09f28e4..b8e15b2 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 _0xa112=['../../config/logger','api','moment','bluebird','path','lodash','util'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xa112,0x1cc));var _0x2a11=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xa112[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x2a11('0x0'));var util=require(_0x2a11('0x1'));var logger=require(_0x2a11('0x2'))(_0x2a11('0x3'));var moment=require(_0x2a11('0x4'));var BPromise=require(_0x2a11('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a11('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module['exports']=function(_0x5ef7a4,_0x17db6d){return _0x5ef7a4['define']('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 63ff72a..8b17fed 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 _0x78d6=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x78d6,0x141));var _0x678d=function(_0x33c9a6,_0x14f4d6){_0x33c9a6=_0x33c9a6-0x0;var _0x40862a=_0x78d6[_0x33c9a6];return _0x40862a;};'use strict';var _=require(_0x678d('0x0'));var util=require(_0x678d('0x1'));var moment=require('moment');var BPromise=require(_0x678d('0x2'));var rs=require(_0x678d('0x3'));var fs=require('fs');var Redis=require(_0x678d('0x4'));var db=require(_0x678d('0x5'))['db'];var utils=require(_0x678d('0x6'));var logger=require(_0x678d('0x7'))(_0x678d('0x8'));var config=require(_0x678d('0x9'));var jayson=require(_0x678d('0xa'));var client=jayson[_0x678d('0xb')][_0x678d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x125ce1,_0x3047cb,_0x2079b1){return new BPromise(function(_0x20a909,_0x5c1a05){return client[_0x678d('0xd')](_0x125ce1,_0x2079b1)['then'](function(_0x5c639d){logger['info'](_0x678d('0xe'),_0x3047cb,_0x678d('0xf'));logger[_0x678d('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3047cb,_0x678d('0xf'),JSON[_0x678d('0x11')](_0x5c639d));if(_0x5c639d['error']){if(_0x5c639d['error'][_0x678d('0x12')]===0x1f4){logger[_0x678d('0x13')](_0x678d('0xe'),_0x3047cb,_0x5c639d[_0x678d('0x13')][_0x678d('0x14')]);return _0x5c1a05(_0x5c639d['error'][_0x678d('0x14')]);}logger['error'](_0x678d('0xe'),_0x3047cb,_0x5c639d[_0x678d('0x13')]['message']);return _0x20a909(_0x5c639d[_0x678d('0x13')][_0x678d('0x14')]);}else{logger['info'](_0x678d('0xe'),_0x3047cb,_0x678d('0xf'));_0x20a909(_0x5c639d[_0x678d('0x15')][_0x678d('0x14')]);}})[_0x678d('0x16')](function(_0x48adcc){logger[_0x678d('0x13')](_0x678d('0xe'),_0x3047cb,_0x48adcc);_0x5c1a05(_0x48adcc);});});} \ No newline at end of file +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 diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4050063..a709280 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 _0xd0c4=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','/:id/contacts','update'];(function(_0x4aaeba,_0xbb6893){var _0x47be73=function(_0x5900e0){while(--_0x5900e0){_0x4aaeba['push'](_0x4aaeba['shift']());}};_0x47be73(++_0xbb6893);}(_0xd0c4,0x1d1));var _0x4d0c=function(_0x279fc8,_0x1ba427){_0x279fc8=_0x279fc8-0x0;var _0x4521a5=_0xd0c4[_0x279fc8];return _0x4521a5;};'use strict';var multer=require(_0x4d0c('0x0'));var util=require(_0x4d0c('0x1'));var path=require('path');var timeout=require(_0x4d0c('0x2'));var express=require(_0x4d0c('0x3'));var router=express[_0x4d0c('0x4')]();var fs_extra=require(_0x4d0c('0x5'));var auth=require(_0x4d0c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x4d0c('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d0c('0x8')]);router['get'](_0x4d0c('0x9'),auth[_0x4d0c('0xa')](),controller[_0x4d0c('0xb')]);router[_0x4d0c('0x7')](_0x4d0c('0xc'),auth['isAuthenticated'](),controller[_0x4d0c('0xd')]);router[_0x4d0c('0x7')]('/:id/contacts',auth[_0x4d0c('0xa')](),controller[_0x4d0c('0xe')]);router[_0x4d0c('0xf')]('/',auth[_0x4d0c('0xa')](),controller[_0x4d0c('0x10')]);router['post'](_0x4d0c('0x11'),auth[_0x4d0c('0xa')](),controller['addContacts']);router['put']('/:id',auth[_0x4d0c('0xa')](),controller[_0x4d0c('0x12')]);router[_0x4d0c('0x13')](_0x4d0c('0xc'),auth[_0x4d0c('0xa')](),controller[_0x4d0c('0x14')]);module[_0x4d0c('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1217b84..38f9a60 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 _0x70d9=['UNSIGNED','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x9d929a,_0x5f5c55){var _0x5d8627=function(_0x5717b1){while(--_0x5717b1){_0x9d929a['push'](_0x9d929a['shift']());}};_0x5d8627(++_0x5f5c55);}(_0x70d9,0xbb));var _0x970d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x70d9[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x970d('0x0'));var Sequelize=require(_0x970d('0x1'));module[_0x970d('0x2')]={'firstName':{'type':Sequelize[_0x970d('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x970d('0x3')]},'street':{'type':Sequelize[_0x970d('0x3')]},'postalCode':{'type':Sequelize[_0x970d('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x970d('0x3')]},'dateOfBirth':{'type':Sequelize[_0x970d('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x970d('0x3')]},'mobile':{'type':Sequelize[_0x970d('0x3')]},'fax':{'type':Sequelize[_0x970d('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x970d('0x3')]},'facebook':{'type':Sequelize[_0x970d('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x970d('0x3')]},'skype':{'type':Sequelize[_0x970d('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x970d('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x970d('0x4')](0x2)[_0x970d('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x970d('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index cbdebde..dbc8ce4 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 _0x17c7=['CmCustomField','omit','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','sequelize','text','phone','getTags','findOne','rawAttributes','filters','attributes','intersection','model','fields','sort','pick','filter','map','options','setTags','setAdditionalPhones','OrderBy','item_types','ItemTypeId','items','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','includeAll','include','getHopperHistories','CmHopperHistory','ContactId','rows','getHopperFinals','CmHopperFinal','nolimit','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','pid','upload','createReadStream','parse','meta','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','fullname','DESC','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','key','Owner','Tag','color','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','Interaction','flatten','sortBy','slice','moment','bluebird','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','localhost','socket.io-emitter','redis','./cmContact.socket','register','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','findAll','query','catch','CmContact','find','params','describe','tags','keys','length','startsWith','cf_','columnName','analytics','alias','type','values','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','OpenchannelInteraction','CmContactHasItem','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','spread','contact','all','show','Tags','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and'];(function(_0x1922d2,_0x224ada){var _0x268072=function(_0x2838f9){while(--_0x2838f9){_0x1922d2['push'](_0x1922d2['shift']());}};_0x268072(++_0x224ada);}(_0x17c7,0x198));var _0x717c=function(_0x5dc674,_0x2b8dc1){_0x5dc674=_0x5dc674-0x0;var _0x1e8469=_0x17c7[_0x5dc674];return _0x1e8469;};'use strict';var moment=require(_0x717c('0x0'));var BPromise=require(_0x717c('0x1'));var util=require('util');var path=require(_0x717c('0x2'));var fs=require('fs');var _=require(_0x717c('0x3'));var squel=require(_0x717c('0x4'));var Papa=require(_0x717c('0x5'));var Redis=require(_0x717c('0x6'));var contacts=require(_0x717c('0x7'));var qs=require(_0x717c('0x8'));var logger=require('../../config/logger')(_0x717c('0x9'));var config=require(_0x717c('0xa'));var shared=require(_0x717c('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x717c('0xc'),'port':0x18eb});var socket=require(_0x717c('0xd'))(new Redis(config[_0x717c('0xe')]));require(_0x717c('0xf'))[_0x717c('0x10')](socket);function respondWithResult(_0x471066,_0x3832c1){_0x3832c1=_0x3832c1||0xc8;return function(_0x32fab8){if(_0x32fab8){return _0x471066['status'](_0x3832c1)[_0x717c('0x11')](_0x32fab8);}};}function respondWithFilteredResult(_0x46fe78,_0x45111b){return function(_0xa621aa){if(_0xa621aa){var _0x45dd8a=typeof _0x45111b[_0x717c('0x12')]===_0x717c('0x13')&&typeof _0x45111b[_0x717c('0x14')]===_0x717c('0x13');var _0x242c8c=_0xa621aa[_0x717c('0x15')];var _0x2f3e16=_0x45dd8a?0x0:_0x45111b[_0x717c('0x12')];var _0x6fe482=_0x45dd8a?_0xa621aa[_0x717c('0x15')]:_0x45111b['offset']+_0x45111b[_0x717c('0x14')];var _0x4aef6b;if(_0x6fe482>=_0x242c8c){_0x6fe482=_0x242c8c;_0x4aef6b=0xc8;}else{_0x4aef6b=0xce;}_0x46fe78[_0x717c('0x16')](_0x4aef6b);return _0x46fe78['set'](_0x717c('0x17'),_0x2f3e16+'-'+_0x6fe482+'/'+_0x242c8c)[_0x717c('0x11')](_0xa621aa);}return null;};}function saveUpdates(_0x29eaa2){return function(_0x5d97c4){if(_0x5d97c4){return _0x5d97c4[_0x717c('0x18')](_0x29eaa2)[_0x717c('0x19')](function(_0x202bbc){return _0x202bbc;});}return null;};}function removeEntity(_0xf52118){return function(_0x5be4b5){if(_0x5be4b5){return _0x5be4b5[_0x717c('0x1a')]()[_0x717c('0x19')](function(){_0xf52118[_0x717c('0x16')](0xcc)[_0x717c('0x1b')]();});}};}function handleEntityNotFound(_0x3059b6){return function(_0x1fd5e2){if(!_0x1fd5e2){_0x3059b6[_0x717c('0x1c')](0x194);}return _0x1fd5e2;};}function handleError(_0xc43017,_0x10ecc5){_0x10ecc5=_0x10ecc5||0x1f4;return function(_0x25a9c9){logger[_0x717c('0x1d')](_0x25a9c9['stack']);if(_0x25a9c9[_0x717c('0x1e')]){delete _0x25a9c9[_0x717c('0x1e')];}_0xc43017[_0x717c('0x16')](_0x10ecc5)[_0x717c('0x1f')](_0x25a9c9);};}exports[_0x717c('0x20')]=function(_0x48297e,_0x172c41){var _0x2a4bf1={};return contacts['describe']()[_0x717c('0x19')](function(_0x3b71ce){_0x2a4bf1=qs['getOptions'](_0x3b71ce,_0x48297e);return contacts[_0x717c('0x21')](_0x48297e[_0x717c('0x22')],_0x48297e['user'],_0x2a4bf1,_0x3b71ce);})['then'](respondWithFilteredResult(_0x172c41,_0x2a4bf1))[_0x717c('0x23')](handleError(_0x172c41,null));};exports['destroy']=function(_0x3ca415,_0x13af43){return db[_0x717c('0x24')][_0x717c('0x25')]({'where':{'id':_0x3ca415[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x13af43,null))[_0x717c('0x19')](removeEntity(_0x13af43,null))[_0x717c('0x23')](handleError(_0x13af43,null));};exports[_0x717c('0x27')]=function(_0x5458f9,_0x3863db){return db[_0x717c('0x24')][_0x717c('0x27')]()[_0x717c('0x19')](function(_0x5e540e){delete _0x5e540e[_0x717c('0x28')];for(var _0x5aab1c=0x0;_0x5aab1c0x0){return new Promise(function(_0x958f28){var _0x3a389c=[];for(var _0x42ab4b=0x0;_0x42ab4b<_0x2cb2ac[_0x717c('0x2a')];_0x42ab4b++){_0x3a389c[_0x717c('0x5b')](insertAdditionalPhones(_0x2cb2ac[_0x42ab4b][_0x717c('0x5f')],_0x2cb2ac[_0x42ab4b][_0x717c('0x56')]));}Promise[_0x717c('0x60')](_0x3a389c)[_0x717c('0x19')](function(){_0x958f28(0x1);});})[_0x717c('0x19')](function(){return{'success':_0x38cd69,'failure':_0x4a70f6,'duplicates':_0x396f36};});}else{return{'success':_0x38cd69,'failure':_0x4a70f6,'duplicates':_0x396f36};}}})['then'](respondWithResult(_0x297aaa,0xc9))['catch'](handleError(_0x297aaa,null));};exports[_0x717c('0x61')]=function(_0x34d4f2,_0x4f4540){var _0x4af379;return db[_0x717c('0x24')][_0x717c('0x27')]()[_0x717c('0x19')](function(_0x28a941){return db[_0x717c('0x24')][_0x717c('0x25')]({'where':{'id':_0x34d4f2['params']['id']},'include':[{'model':db['Tag'],'as':_0x717c('0x62'),'attributes':['id',_0x717c('0x1e'),'color'],'required':_0x34d4f2[_0x717c('0x22')][_0x717c('0x63')]?!![]:![]},{'model':db[_0x717c('0x48')],'as':_0x717c('0x64'),'where':{'CmContactId':_0x34d4f2['params']['id']},'required':![],'include':[{'model':db[_0x717c('0x65')],'as':_0x717c('0x66')}]}],'order':[db['sequelize'][_0x717c('0x67')](_0x717c('0x68'))],'attributes':_['keys'](_0x28a941)});})[_0x717c('0x19')](function(_0x41e580){if(!_[_0x717c('0x52')](_0x41e580)){_0x4af379=_0x41e580[_0x717c('0x37')]({'plain':!![]});var _0x8fdb18={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x41e580&&_0x41e580['ListId']){if(_0x41e580['ListId']){_0x8fdb18[_0x717c('0x5c')][_0x717c('0x69')][_0x717c('0x5b')]({'ListId':{'$ne':_0x41e580[_0x717c('0x5d')]}});}}return db[_0x717c('0x6a')]['findAll'](_0x8fdb18);}})[_0x717c('0x19')](function(_0x17dc6e){if(!_['isNil'](_0x17dc6e)){return _[_0x717c('0x6b')](_0x4af379,_['map'](_0x17dc6e,function(_0x5be7ae){return util[_0x717c('0x6c')](_0x717c('0x6d'),_0x5be7ae['id']);}));}})[_0x717c('0x19')](handleEntityNotFound(_0x4f4540,null))['then'](respondWithResult(_0x4f4540,null))[_0x717c('0x23')](handleError(_0x4f4540,null));};exports['update']=function(_0x2786a1,_0x1f68c0){var _0x5b42e5;if(_0x2786a1[_0x717c('0x35')]['id']){delete _0x2786a1[_0x717c('0x35')]['id'];}if(!_['isNil'](_0x2786a1[_0x717c('0x35')][_0x717c('0x53')])){var _0x29b2dc=_0x2786a1[_0x717c('0x35')][_0x717c('0x53')];if(!_[_0x717c('0x52')](shared[_0x717c('0x54')][_0x29b2dc]))_0x2786a1[_0x717c('0x35')][_0x717c('0x55')]=shared[_0x717c('0x54')][_0x29b2dc][_0x717c('0x55')];}return db[_0x717c('0x24')][_0x717c('0x25')]({'where':{'id':_0x2786a1[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x1f68c0,null))[_0x717c('0x19')](saveUpdates(_0x2786a1[_0x717c('0x35')],null))['then'](function(_0x4a1484){_0x5b42e5=_0x4a1484;var _0x1e52cb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4a1484&&_0x4a1484['ListId']){if(_0x4a1484[_0x717c('0x5d')]){_0x1e52cb[_0x717c('0x5c')][_0x717c('0x69')][_0x717c('0x5b')]({'ListId':{'$ne':_0x4a1484[_0x717c('0x5d')]}});}}return db['CmCustomField'][_0x717c('0x21')](_0x1e52cb);})['then'](function(_0x255c93){if(_0x255c93){return _[_0x717c('0x6b')](_[_0x717c('0x6e')](_0x2786a1[_0x717c('0x35')],function(_0x3f0241,_0x529aa8){return _[_0x717c('0x2b')](_0x529aa8,_0x717c('0x2c'));}),_['map'](_0x255c93,function(_0x482386){return util[_0x717c('0x6c')]('cf_%d',_0x482386['id']);}));}})[_0x717c('0x19')](function(_0x4a48f7){if(_0x4a48f7&&!_[_0x717c('0x6f')](_0x4a48f7)){var _0x355ae9=squel['update']()[_0x717c('0x70')](_0x717c('0x71'))[_0x717c('0x72')](_0x4a48f7)[_0x717c('0x5c')](_0x717c('0x73'),_0x2786a1[_0x717c('0x26')]['id'])[_0x717c('0x74')]();return db[_0x717c('0x75')]['query'](_0x355ae9[_0x717c('0x76')],{'replacements':_0x355ae9[_0x717c('0x31')]});}})[_0x717c('0x19')](function(){if(_0x2786a1['body'][_0x717c('0x77')]&&_0x5b42e5){return db[_0x717c('0x3c')]['update']({'phone':_0x2786a1[_0x717c('0x35')][_0x717c('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x5b42e5['id']}});}})['then'](function(){return _0x5b42e5;})['then'](respondWithResult(_0x1f68c0,null))[_0x717c('0x23')](handleError(_0x1f68c0,null));};exports[_0x717c('0x78')]=function(_0xf0a550,_0x5c73d6){var _0x17f9be={};var _0x33b6fc={};var _0x1bbc1d;var _0x1ff54e;return db[_0x717c('0x24')][_0x717c('0x79')]({'where':{'id':_0xf0a550[_0x717c('0x26')]['id']}})['then'](handleEntityNotFound(_0x5c73d6,null))[_0x717c('0x19')](function(_0x4c855d){if(_0x4c855d){_0x1bbc1d=_0x4c855d;_0x33b6fc['model']=_[_0x717c('0x29')](db['Tag'][_0x717c('0x7a')]);_0x33b6fc[_0x717c('0x22')]=_[_0x717c('0x29')](_0xf0a550[_0x717c('0x22')]);_0x33b6fc[_0x717c('0x7b')]=_['intersection'](_0x33b6fc['model'],_0x33b6fc[_0x717c('0x22')]);_0x17f9be[_0x717c('0x7c')]=_[_0x717c('0x7d')](_0x33b6fc[_0x717c('0x7e')],qs[_0x717c('0x7f')](_0xf0a550[_0x717c('0x22')][_0x717c('0x7f')]));_0x17f9be[_0x717c('0x7c')]=_0x17f9be[_0x717c('0x7c')][_0x717c('0x2a')]?_0x17f9be[_0x717c('0x7c')]:_0x33b6fc['model'];_0x17f9be['order']=qs[_0x717c('0x80')](_0xf0a550[_0x717c('0x22')]['sort']);_0x17f9be['where']=qs['filters'](_[_0x717c('0x81')](_0xf0a550[_0x717c('0x22')],_0x33b6fc[_0x717c('0x7b')]));if(_0xf0a550[_0x717c('0x22')][_0x717c('0x82')]){_0x17f9be[_0x717c('0x5c')]=_[_0x717c('0x34')](_0x17f9be[_0x717c('0x5c')],{'$or':_[_0x717c('0x83')](_0x17f9be[_0x717c('0x7c')],function(_0x12fd70){var _0x41e29b={};_0x41e29b[_0x12fd70]={'$like':'%'+_0xf0a550[_0x717c('0x22')][_0x717c('0x82')]+'%'};return _0x41e29b;})});}_0x17f9be=_[_0x717c('0x34')]({},_0x17f9be,_0xf0a550[_0x717c('0x84')]);return _0x1bbc1d[_0x717c('0x78')](_0x17f9be);}})[_0x717c('0x19')](function(_0x59f7f1){if(_0x59f7f1){_0x1ff54e=_0x59f7f1['length'];if(!_0xf0a550['query']['hasOwnProperty']('nolimit')){_0x17f9be[_0x717c('0x14')]=qs[_0x717c('0x14')](_0xf0a550[_0x717c('0x22')]['limit']);_0x17f9be[_0x717c('0x12')]=qs[_0x717c('0x12')](_0xf0a550['query']['offset']);}return _0x1bbc1d['getTags'](_0x17f9be);}})[_0x717c('0x19')](function(_0x4ed1f0){if(_0x4ed1f0){return _0x4ed1f0?{'count':_0x1ff54e,'rows':_0x4ed1f0}:null;}})[_0x717c('0x19')](respondWithResult(_0x5c73d6,null))[_0x717c('0x23')](handleError(_0x5c73d6,null));};exports['setTags']=function(_0x16439f,_0x17e6e3){if(_0x16439f[_0x717c('0x35')]['id']){delete _0x16439f[_0x717c('0x35')]['id'];}return db[_0x717c('0x24')]['findOne']({'where':{'id':_0x16439f[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x17e6e3,null))[_0x717c('0x19')](function(_0x1e9013){if(_0x1e9013){return _0x1e9013[_0x717c('0x85')](_0x16439f[_0x717c('0x35')]['ids']||[]);}return null;})[_0x717c('0x19')](respondWithResult(_0x17e6e3,null))['catch'](handleError(_0x17e6e3,null));};exports[_0x717c('0x86')]=function(_0x16a112,_0x6fc6ee){var _0x31c802=[];_0x31c802['push'](addAdditionalPhones(_0x16a112[_0x717c('0x35')]));Promise[_0x717c('0x60')](_0x31c802)[_0x717c('0x19')](function(){_0x31c802=[];_0x31c802[_0x717c('0x5b')](deleteCmHopperPhones(_0x16a112['body']['id']));_0x31c802[_0x717c('0x5b')](addCmHopperPhones(_0x16a112['body']['id']));Promise[_0x717c('0x60')](_0x31c802)[_0x717c('0x19')](function(){return[0x1];})[_0x717c('0x19')](respondWithResult(_0x6fc6ee,null));});};function addAdditionalPhones(_0x101da5){var _0xdc9a02;return new Promise(function(_0xff6ade){return db[_0x717c('0x48')][_0x717c('0x1a')]({'where':{'CmContactId':_0x101da5['id']}})[_0x717c('0x19')](function(){db[_0x717c('0x65')]['findAll']({'raw':!![],'attributes':['id',_0x717c('0x87')]})[_0x717c('0x19')](function(_0x44ef8c){var _0x5da45e=[];for(var _0x26cadd=0x0;_0x26cadd<_0x101da5['items']['length'];_0x26cadd++){var _0x559585=_0x101da5[_0x717c('0x88')]?_[_0x717c('0x52')](_0x101da5[_0x717c('0x88')][_0x26cadd])?'':_0x101da5[_0x717c('0x88')][_0x26cadd]:_0x101da5['items'][_0x26cadd][_0x717c('0x89')]?_0x101da5[_0x717c('0x8a')][_0x26cadd]['ItemTypeId']:'';var _0x2df514=_[_0x717c('0x52')](_0x101da5[_0x717c('0x8a')][_0x26cadd][_0x717c('0x8b')])?'':_0x101da5[_0x717c('0x8a')][_0x26cadd][_0x717c('0x8b')];var _0x1e56cd=_0x559585+':'+_0x101da5['items'][_0x26cadd]['phone']+'§'+_0x2df514;if(_[_0x717c('0x52')](_0xdc9a02))_0xdc9a02=_0x1e56cd;else _0xdc9a02+=';'+_0x1e56cd;var _0x543694=null;var _0x15713c=null;if(_0x101da5[_0x717c('0x88')]){if(!_[_0x717c('0x52')](_0x101da5[_0x717c('0x88')][_0x26cadd])){_0x15713c=_[_0x717c('0x25')](_0x44ef8c,function(_0x251c67){return _0x251c67['id']===_0x101da5['item_types'][_0x26cadd];});if(!_[_0x717c('0x52')](_0x15713c)){_0x543694=_0x15713c[_0x717c('0x87')];}}}else{if(!_[_0x717c('0x52')](_0x101da5[_0x717c('0x8a')][_0x26cadd])){_0x15713c=_['find'](_0x44ef8c,function(_0x344b50){return _0x344b50['id']===_0x101da5[_0x717c('0x8a')][_0x26cadd][_0x717c('0x89')];});if(!_['isNil'](_0x15713c)){_0x543694=_0x26cadd;}}}if(_[_0x717c('0x52')](_0x543694)){_0x543694=0x64;}_0x5da45e[_0x717c('0x5b')](addAdditionalPhone(_0x101da5['id'],_0x101da5[_0x717c('0x8a')][_0x26cadd]['phone'],_0x101da5[_0x717c('0x88')]?_[_0x717c('0x52')](_0x101da5[_0x717c('0x88')][_0x26cadd])?null:_0x101da5[_0x717c('0x88')][_0x26cadd]:_0x101da5[_0x717c('0x8a')][_0x26cadd][_0x717c('0x89')]?_0x101da5[_0x717c('0x8a')][_0x26cadd][_0x717c('0x89')]:null,_0x543694,_0x2df514));}Promise['all'](_0x5da45e)[_0x717c('0x19')](function(){db['CmContact'][_0x717c('0x18')]({'AdditionalPhones':_0xdc9a02},{'where':{'id':_0x101da5['id']}})[_0x717c('0x19')](function(){_0xff6ade(0x1);});});});});});}function addAdditionalPhone(_0xa8e35b,_0x4df85f,_0x3f0870,_0x4ebacf,_0x146aba){return db[_0x717c('0x48')][_0x717c('0x25')]({'where':{'CmContactId':_0xa8e35b,'item':_0x4df85f}})[_0x717c('0x19')](function(_0x2e26b1){if(_0x2e26b1)logger[_0x717c('0x3a')](_0x717c('0x8c'),_0x2e26b1);else{db[_0x717c('0x48')][_0x717c('0x40')]({'CmContactId':_0xa8e35b,'item':_0x4df85f,'ItemTypeId':_0x3f0870,'OrderBy':_0x4ebacf,'ItemClass':_0x717c('0x8d'),'description':_0x146aba});}});}function deleteCmHopperPhones(_0x37b77d){return new Promise(function(_0xdc1b9b){return db[_0x717c('0x3c')][_0x717c('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x37b77d}})['then'](function(_0x382d2b){db[_0x717c('0x8e')][_0x717c('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x717c('0x83')](_0x382d2b,'id')}}});})[_0x717c('0x19')](function(){_0xdc1b9b(0x1);});});}function addCmHopperPhones(_0x1c0621){return new Promise(function(_0x134b77){return db[_0x717c('0x3c')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1c0621}})[_0x717c('0x19')](function(_0x22581d){var _0x278205=[];_['map'](_0x22581d,function(_0x25f14a){_0x278205['push'](createCmHopperPhone(_0x1c0621,_0x25f14a['id']));});Promise['all'](_0x278205)[_0x717c('0x19')](function(){_0x134b77(0x1);});});});}function createCmHopperPhone(_0x46fd26,_0x329926){return new Promise(function(_0x538178){db['CmContactHasItem'][_0x717c('0x21')]({'raw':!![],'attributes':[_0x717c('0x8f'),'OrderBy'],'where':{'CmContactId':_0x46fd26,'ItemClass':_0x717c('0x8d')},'include':[{'model':db[_0x717c('0x65')],'attributes':['OrderBy'],'as':_0x717c('0x66')}],'order':[_0x717c('0x87'),db[_0x717c('0x75')][_0x717c('0x67')](_0x717c('0x90'))]})[_0x717c('0x19')](function(_0x251ce2){var _0xa2d348=0x1;var _0x5a904=_[_0x717c('0x83')](_0x251ce2,function(_0x230406){_0x230406[_0x717c('0x91')]=_0x329926;_0x230406[_0x717c('0x77')]=_0x230406[_0x717c('0x8f')];_0x230406[_0x717c('0x87')]=_0xa2d348;delete _0x230406[_0x717c('0x92')];_0xa2d348=_0xa2d348+0x1;return _0x230406;});return db[_0x717c('0x8e')][_0x717c('0x57')](_0x5a904,{});})[_0x717c('0x19')](function(){_0x538178(0x1);});});}function insertAdditionalPhones(_0x44d9ea,_0x466e17){return new Promise(function(_0x53ff98){var _0x4b3d79=[];for(var _0x21b850=0x0;_0x21b850<_0x466e17[_0x717c('0x2a')];_0x21b850++){var _0x5e16f0=_0x466e17[_0x21b850];_0x4b3d79[_0x717c('0x5b')](parseContactItemType(_0x5e16f0));}Promise[_0x717c('0x60')](_0x4b3d79)[_0x717c('0x19')](function(){var _0x5997c2={'id':_0x44d9ea['id'],'items':_0x466e17};return addAdditionalPhones(_0x5997c2)[_0x717c('0x19')](function(){return addCmHopperPhones(_0x44d9ea['id']);});})[_0x717c('0x19')](function(){_0x53ff98(_0x44d9ea);});});}function parseContactItemType(_0x2ea140){return new Promise(function(_0x2bbc85){if(_0x2ea140[_0x717c('0x33')](_0x717c('0x89'))){_0x2bbc85(_0x2ea140);}else{return db['ContactItemType']['find']({'where':{'name':_0x2ea140[_0x717c('0x66')]}})[_0x717c('0x19')](function(_0x60c9e9){if(_[_0x717c('0x52')](_0x60c9e9))_0x2ea140[_0x717c('0x89')]=null;else _0x2ea140[_0x717c('0x89')]=_0x60c9e9['id'];_0x2bbc85(_0x2ea140);});}});}exports['getAdditionalPhones']=function(_0x8c7a5e,_0x42063e){return db[_0x717c('0x48')][_0x717c('0x21')]({'raw':!![],'where':{'CmContactId':_0x8c7a5e[_0x717c('0x26')]['id'],'ItemClass':_0x717c('0x8d')},'include':[{'model':db[_0x717c('0x65')],'as':_0x717c('0x66')}],'order':[[_0x717c('0x87')],[db[_0x717c('0x75')][_0x717c('0x67')]('`ItemType`.OrderBy')]]})[_0x717c('0x19')](function(_0x38e5e2){return _0x38e5e2;})[_0x717c('0x19')](respondWithResult(_0x42063e,null))['catch'](handleError(_0x42063e,null));};exports[_0x717c('0x93')]=function(_0x1a7a22,_0x2d1b45){return db[_0x717c('0x48')]['findAll']({'raw':!![],'where':{'CmContactId':_0x1a7a22[_0x717c('0x35')][_0x717c('0x94')]}})[_0x717c('0x19')](function(_0xe6df2b){var _0x3ace9a=_[_0x717c('0x83')](_0xe6df2b,function(_0x2d7099){_0x2d7099[_0x717c('0x95')]=_0x1a7a22['body'][_0x717c('0x96')];return _0x2d7099;});return db['CmContactHasItem']['bulkCreate'](_0x3ace9a,{});})['then'](function(){return addCmHopperPhones(_0x1a7a22[_0x717c('0x35')][_0x717c('0x96')]);})[_0x717c('0x19')](function(){return['ok'];})[_0x717c('0x19')](respondWithResult(_0x2d1b45,null))[_0x717c('0x23')](handleError(_0x2d1b45,null));};exports[_0x717c('0x97')]=function(_0x5024f0,_0x6b9621){var _0x40bd0b=[];_0x40bd0b[_0x717c('0x5b')](createCmHopperPhone(_0x5024f0[_0x717c('0x35')]['id'],_0x5024f0[_0x717c('0x35')][_0x717c('0x98')]));Promise['all'](_0x40bd0b)[_0x717c('0x19')](function(){return[0x1];})[_0x717c('0x19')](respondWithResult(_0x6b9621,null));};exports[_0x717c('0x99')]=function(_0x218171,_0x579d02){var _0x5c6476={'raw':![],'where':{}};var _0x4a6d72={};var _0x55a732={'count':0x0,'rows':[]};return db[_0x717c('0x24')][_0x717c('0x79')]({'where':{'id':_0x218171[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x579d02,null))[_0x717c('0x19')](function(_0x2fad24){if(_0x2fad24){_0x4a6d72['model']=_[_0x717c('0x29')](db[_0x717c('0x3c')][_0x717c('0x7a')]);_0x4a6d72[_0x717c('0x22')]=_['keys'](_0x218171[_0x717c('0x22')]);_0x4a6d72[_0x717c('0x7b')]=_['intersection'](_0x4a6d72[_0x717c('0x7e')],_0x4a6d72[_0x717c('0x22')]);_0x5c6476[_0x717c('0x7c')]=_[_0x717c('0x7d')](_0x4a6d72[_0x717c('0x7e')],qs[_0x717c('0x7f')](_0x218171[_0x717c('0x22')][_0x717c('0x7f')]));_0x5c6476[_0x717c('0x7c')]=_0x5c6476[_0x717c('0x7c')]['length']?_0x5c6476['attributes']:_0x4a6d72[_0x717c('0x7e')];if(!_0x218171[_0x717c('0x22')][_0x717c('0x33')]('nolimit')){_0x5c6476['limit']=qs['limit'](_0x218171[_0x717c('0x22')][_0x717c('0x14')]);_0x5c6476[_0x717c('0x12')]=qs['offset'](_0x218171['query'][_0x717c('0x12')]);}_0x5c6476[_0x717c('0x9a')]=qs[_0x717c('0x80')](_0x218171['query']['sort']);_0x5c6476[_0x717c('0x5c')]=qs[_0x717c('0x7b')](_['pick'](_0x218171['query'],_0x4a6d72['filters']));_0x5c6476[_0x717c('0x5c')]['ContactId']=_0x2fad24['id'];if(_0x218171[_0x717c('0x22')][_0x717c('0x82')]){_0x5c6476[_0x717c('0x5c')]=_[_0x717c('0x34')](_0x5c6476[_0x717c('0x5c')],{'$or':_['map'](_0x5c6476[_0x717c('0x7c')],function(_0x4f4920){var _0x5aaa38={};_0x5aaa38[_0x4f4920]={'$like':'%'+_0x218171[_0x717c('0x22')]['filter']+'%'};return _0x5aaa38;})});}_0x5c6476=_[_0x717c('0x34')]({},_0x5c6476,_0x218171[_0x717c('0x84')]);return db['CmHopper'][_0x717c('0x15')]({'where':_0x5c6476[_0x717c('0x5c')]})[_0x717c('0x19')](function(_0x353fae){_0x55a732[_0x717c('0x15')]=_0x353fae;if(_0x218171[_0x717c('0x22')][_0x717c('0x9b')]){_0x5c6476[_0x717c('0x9c')]=[{'all':!![]}];}return db[_0x717c('0x3c')][_0x717c('0x21')](_0x5c6476);})[_0x717c('0x19')](function(_0x3900e0){_0x55a732['rows']=_0x3900e0;return _0x55a732;});}})[_0x717c('0x19')](respondWithFilteredResult(_0x579d02,_0x5c6476))[_0x717c('0x23')](handleError(_0x579d02,null));};exports[_0x717c('0x9d')]=function(_0x408ede,_0x2afac4){var _0x16cc5b={'raw':!![],'where':{}};var _0x2113b0={};var _0x2ac2e1={'count':0x0,'rows':[]};return db[_0x717c('0x24')][_0x717c('0x79')]({'where':{'id':_0x408ede[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x2afac4,null))['then'](function(_0x33d6e1){if(_0x33d6e1){_0x2113b0['model']=_[_0x717c('0x29')](db[_0x717c('0x9e')][_0x717c('0x7a')]);_0x2113b0['query']=_[_0x717c('0x29')](_0x408ede[_0x717c('0x22')]);_0x2113b0['filters']=_['intersection'](_0x2113b0[_0x717c('0x7e')],_0x2113b0['query']);_0x16cc5b['attributes']=_[_0x717c('0x7d')](_0x2113b0[_0x717c('0x7e')],qs[_0x717c('0x7f')](_0x408ede[_0x717c('0x22')][_0x717c('0x7f')]));_0x16cc5b[_0x717c('0x7c')]=_0x16cc5b[_0x717c('0x7c')][_0x717c('0x2a')]?_0x16cc5b[_0x717c('0x7c')]:_0x2113b0[_0x717c('0x7e')];if(!_0x408ede[_0x717c('0x22')][_0x717c('0x33')]('nolimit')){_0x16cc5b[_0x717c('0x14')]=qs[_0x717c('0x14')](_0x408ede[_0x717c('0x22')][_0x717c('0x14')]);_0x16cc5b[_0x717c('0x12')]=qs['offset'](_0x408ede['query']['offset']);}_0x16cc5b[_0x717c('0x9a')]=qs[_0x717c('0x80')](_0x408ede[_0x717c('0x22')]['sort']);_0x16cc5b[_0x717c('0x5c')]=qs[_0x717c('0x7b')](_['pick'](_0x408ede[_0x717c('0x22')],_0x2113b0['filters']));_0x16cc5b['where'][_0x717c('0x9f')]=_0x33d6e1['id'];if(_0x408ede['query']['filter']){_0x16cc5b[_0x717c('0x5c')]=_[_0x717c('0x34')](_0x16cc5b['where'],{'$or':_[_0x717c('0x83')](_0x16cc5b[_0x717c('0x7c')],function(_0x1f950d){var _0x2da9f7={};_0x2da9f7[_0x1f950d]={'$like':'%'+_0x408ede[_0x717c('0x22')][_0x717c('0x82')]+'%'};return _0x2da9f7;})});}_0x16cc5b=_[_0x717c('0x34')]({},_0x16cc5b,_0x408ede[_0x717c('0x84')]);return db[_0x717c('0x9e')][_0x717c('0x15')]({'where':_0x16cc5b[_0x717c('0x5c')]})[_0x717c('0x19')](function(_0x4249f0){_0x2ac2e1[_0x717c('0x15')]=_0x4249f0;if(_0x408ede['query'][_0x717c('0x9b')]){_0x16cc5b['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x16cc5b);})['then'](function(_0x59cb31){_0x2ac2e1[_0x717c('0xa0')]=_0x59cb31;return _0x2ac2e1;});}})['then'](respondWithFilteredResult(_0x2afac4,_0x16cc5b))[_0x717c('0x23')](handleError(_0x2afac4,null));};exports[_0x717c('0xa1')]=function(_0x3c79f3,_0x455859){var _0x5ee2cd={'raw':!![],'where':{}};var _0x9f42be={};var _0x20e0e5={'count':0x0,'rows':[]};return db[_0x717c('0x24')]['findOne']({'where':{'id':_0x3c79f3[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x455859,null))['then'](function(_0x54e54a){if(_0x54e54a){_0x9f42be[_0x717c('0x7e')]=_[_0x717c('0x29')](db[_0x717c('0xa2')][_0x717c('0x7a')]);_0x9f42be[_0x717c('0x22')]=_[_0x717c('0x29')](_0x3c79f3[_0x717c('0x22')]);_0x9f42be[_0x717c('0x7b')]=_['intersection'](_0x9f42be[_0x717c('0x7e')],_0x9f42be[_0x717c('0x22')]);_0x5ee2cd[_0x717c('0x7c')]=_[_0x717c('0x7d')](_0x9f42be[_0x717c('0x7e')],qs[_0x717c('0x7f')](_0x3c79f3['query'][_0x717c('0x7f')]));_0x5ee2cd[_0x717c('0x7c')]=_0x5ee2cd[_0x717c('0x7c')][_0x717c('0x2a')]?_0x5ee2cd[_0x717c('0x7c')]:_0x9f42be['model'];if(!_0x3c79f3[_0x717c('0x22')]['hasOwnProperty']('nolimit')){_0x5ee2cd['limit']=qs[_0x717c('0x14')](_0x3c79f3['query']['limit']);_0x5ee2cd['offset']=qs[_0x717c('0x12')](_0x3c79f3[_0x717c('0x22')][_0x717c('0x12')]);}_0x5ee2cd[_0x717c('0x9a')]=qs[_0x717c('0x80')](_0x3c79f3[_0x717c('0x22')]['sort']);_0x5ee2cd['where']=qs[_0x717c('0x7b')](_[_0x717c('0x81')](_0x3c79f3[_0x717c('0x22')],_0x9f42be[_0x717c('0x7b')]));_0x5ee2cd[_0x717c('0x5c')][_0x717c('0x9f')]=_0x54e54a['id'];if(_0x3c79f3[_0x717c('0x22')][_0x717c('0x82')]){_0x5ee2cd[_0x717c('0x5c')]=_[_0x717c('0x34')](_0x5ee2cd['where'],{'$or':_[_0x717c('0x83')](_0x5ee2cd[_0x717c('0x7c')],function(_0x2960c7){var _0x1a4337={};_0x1a4337[_0x2960c7]={'$like':'%'+_0x3c79f3['query'][_0x717c('0x82')]+'%'};return _0x1a4337;})});}_0x5ee2cd=_['merge']({},_0x5ee2cd,_0x3c79f3[_0x717c('0x84')]);return db[_0x717c('0xa2')]['count']({'where':_0x5ee2cd['where']})[_0x717c('0x19')](function(_0x2d7454){_0x20e0e5[_0x717c('0x15')]=_0x2d7454;if(_0x3c79f3[_0x717c('0x22')][_0x717c('0x9b')]){_0x5ee2cd[_0x717c('0x9c')]=[{'all':!![]}];}return db[_0x717c('0xa2')][_0x717c('0x21')](_0x5ee2cd);})['then'](function(_0x1cb305){_0x20e0e5['rows']=_0x1cb305;return _0x20e0e5;});}})[_0x717c('0x19')](respondWithFilteredResult(_0x455859,_0x5ee2cd))['catch'](handleError(_0x455859,null));};exports['getJscriptySessions']=function(_0x163854,_0x597758){var _0x3b01d2={'raw':!![],'where':{}};var _0x6c1943={};var _0x43e1a9={'count':0x0,'rows':[]};return db[_0x717c('0x24')][_0x717c('0x79')]({'where':{'id':_0x163854[_0x717c('0x26')]['id']}})[_0x717c('0x19')](handleEntityNotFound(_0x597758,null))[_0x717c('0x19')](function(_0x4960cf){if(_0x4960cf){_0x6c1943['model']=_[_0x717c('0x29')](db[_0x717c('0x4e')][_0x717c('0x7a')]);_0x6c1943[_0x717c('0x22')]=_[_0x717c('0x29')](_0x163854[_0x717c('0x22')]);_0x6c1943[_0x717c('0x7b')]=_['intersection'](_0x6c1943[_0x717c('0x7e')],_0x6c1943[_0x717c('0x22')]);_0x3b01d2[_0x717c('0x7c')]=_[_0x717c('0x7d')](_0x6c1943[_0x717c('0x7e')],qs[_0x717c('0x7f')](_0x163854[_0x717c('0x22')][_0x717c('0x7f')]));_0x3b01d2[_0x717c('0x7c')]=_0x3b01d2[_0x717c('0x7c')][_0x717c('0x2a')]?_0x3b01d2[_0x717c('0x7c')]:_0x6c1943[_0x717c('0x7e')];if(!_0x163854[_0x717c('0x22')][_0x717c('0x33')](_0x717c('0xa3'))){_0x3b01d2[_0x717c('0x14')]=qs[_0x717c('0x14')](_0x163854[_0x717c('0x22')][_0x717c('0x14')]);_0x3b01d2['offset']=qs[_0x717c('0x12')](_0x163854[_0x717c('0x22')][_0x717c('0x12')]);}_0x3b01d2[_0x717c('0x9a')]=qs['sort'](_0x163854['query'][_0x717c('0x80')]);_0x3b01d2[_0x717c('0x5c')]=qs[_0x717c('0x7b')](_[_0x717c('0x81')](_0x163854[_0x717c('0x22')],_0x6c1943['filters']));_0x3b01d2[_0x717c('0x5c')][_0x717c('0x9f')]=_0x4960cf['id'];if(_0x163854[_0x717c('0x22')][_0x717c('0x82')]){_0x3b01d2['where']=_[_0x717c('0x34')](_0x3b01d2[_0x717c('0x5c')],{'$or':_[_0x717c('0x83')](_0x3b01d2[_0x717c('0x7c')],function(_0x2d0974){var _0x334a38={};_0x334a38[_0x2d0974]={'$like':'%'+_0x163854[_0x717c('0x22')]['filter']+'%'};return _0x334a38;})});}_0x3b01d2=_[_0x717c('0x34')]({},_0x3b01d2,_0x163854['options']);return db[_0x717c('0x4e')][_0x717c('0x15')]({'where':_0x3b01d2[_0x717c('0x5c')]})[_0x717c('0x19')](function(_0x5a6493){_0x43e1a9[_0x717c('0x15')]=_0x5a6493;if(_0x163854[_0x717c('0x22')][_0x717c('0x9b')]){_0x3b01d2[_0x717c('0x9c')]=[{'all':!![]}];}return db[_0x717c('0x4e')]['findAll'](_0x3b01d2);})['then'](function(_0x34842e){_0x43e1a9['rows']=_0x34842e;return _0x43e1a9;});}})[_0x717c('0x19')](respondWithFilteredResult(_0x597758,_0x3b01d2))[_0x717c('0x23')](handleError(_0x597758,null));};exports[_0x717c('0xa4')]=function(_0x216efd,_0x36dfeb){try{if(!_0x216efd['body'][_0x717c('0x5d')]){throw new Error(_0x717c('0xa5'));}if(!_0x216efd[_0x717c('0x35')]['binding_keys']){throw new Error(_0x717c('0xa6'));}if(!_0x216efd[_0x717c('0x35')][_0x717c('0xa7')]){throw new Error(_0x717c('0xa8'));}if(!_0x216efd[_0x717c('0x35')]['socket_timestamp']){throw new Error(_0x717c('0xa9'));}var _0x255176=_0x216efd[_0x717c('0x35')][_0x717c('0xaa')]['split'](',');var _0x1818df=_0x216efd[_0x717c('0x35')][_0x717c('0xa7')][_0x717c('0xab')](',');if(!_0x255176[_0x717c('0x2a')]||!_0x1818df[_0x717c('0x2a')]||_0x255176[_0x717c('0x2a')]!==_0x1818df['length']){throw new Error(_0x717c('0xac'));}_0x216efd[_0x717c('0x35')][_0x717c('0x7f')]=_['zipObject'](_0x255176,_0x1818df);if(!_0x216efd[_0x717c('0x35')][_0x717c('0x7f')][_0x717c('0x77')]){throw new Error(_0x717c('0xad'));}if(!_0x216efd[_0x717c('0x35')]['fields'][_0x717c('0xae')]){throw new Error(_0x717c('0xaf'));}var _0x97043c=path[_0x717c('0x51')](config[_0x717c('0xb0')],_0x717c('0xb1'),_0x216efd[_0x717c('0xb2')][_0x717c('0xb3')]);fs[_0x717c('0xb4')](_0x97043c,parseInt(_0x717c('0xb5'),0x8));var _0x2f72da=require(_0x717c('0xb6'))[_0x717c('0xb7')](path[_0x717c('0x51')](__dirname,_0x717c('0xb8')),[_0x97043c,_0x216efd[_0x717c('0x35')][_0x717c('0xaa')],_0x216efd['body'][_0x717c('0xa7')],_0x216efd['body'][_0x717c('0x5d')],_0x216efd[_0x717c('0x35')][_0x717c('0xb9')],_0x216efd[_0x717c('0x35')]['duplicates'],_0x216efd['body'][_0x717c('0xba')]]);return _0x36dfeb[_0x717c('0x16')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x2f72da[_0x717c('0xbb')]});}catch(_0x2f7675){return _0x36dfeb['status'](0x1f4)[_0x717c('0x1f')](_0x2f7675);}};exports[_0x717c('0xbc')]=function(_0x4b1172,_0x105fc7){var _0x30f13a=fs[_0x717c('0xbd')](_0x4b1172[_0x717c('0xb2')][_0x717c('0x2')]);Papa[_0x717c('0xbe')](_0x30f13a,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3d2367){return _0x105fc7[_0x717c('0x16')](0xc8)['json']({'file':_0x4b1172[_0x717c('0xb2')],'fields':_0x3d2367[_0x717c('0xbf')][_0x717c('0x7f')]});}});};exports['import']=function(_0xf7c061,_0x414dbe){return db[_0x717c('0xc0')][_0x717c('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x717c('0xc1')}})[_0x717c('0x19')](function(_0x56d662){var _0x4cba5c=![];if(!_0xf7c061[_0x717c('0x35')]['ListId']){throw new Error(_0x717c('0xa5'));}if(!_0xf7c061[_0x717c('0x35')][_0x717c('0xc2')][_0x717c('0x77')]){throw new Error(_0x717c('0xad'));}if(!_0xf7c061[_0x717c('0x35')]['binding'][_0x717c('0xae')]){throw new Error(_0x717c('0xaf'));}if(!_0xf7c061[_0x717c('0x35')][_0x717c('0xba')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x60f672=require('child_process')['fork'](path[_0x717c('0x51')](__dirname,_0x717c('0xc3')),[_0xf7c061['params']['id'],JSON['stringify'](_0xf7c061[_0x717c('0x35')]),JSON[_0x717c('0xc4')](_0x56d662)]);_0x60f672['on'](_0x717c('0xc5'),function(){_0x4cba5c=!![];return _0x414dbe[_0x717c('0x16')](0xc8)[_0x717c('0x11')]({'message':_0x717c('0xc6'),'pid':_0x60f672[_0x717c('0xbb')]});});_0x60f672['on']('exit',function(_0x474103){if(_0x474103&&!_0x4cba5c){return _0x414dbe['status'](0x1f4)[_0x717c('0x11')]({'message':_0x717c('0xc7'),'pid':_0x60f672['pid']});}});})[_0x717c('0x23')](handleError(_0x414dbe,null));};exports[_0x717c('0xc8')]=function(_0x52e35f,_0x2bd715){return db[_0x717c('0xc0')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x717c('0xc1')}})[_0x717c('0x19')](function(_0x5c2716){var _0x2c8b2b=![];if(!_0x52e35f['body']['ListId']){throw new Error(_0x717c('0xa5'));}if(!_0x52e35f['body'][_0x717c('0xc2')]['phone']){throw new Error(_0x717c('0xad'));}if(!_0x52e35f[_0x717c('0x35')][_0x717c('0xc2')][_0x717c('0xae')]){throw new Error(_0x717c('0xaf'));}if(!_0x52e35f[_0x717c('0x35')][_0x717c('0xba')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1a6c3d=require(_0x717c('0xb6'))[_0x717c('0xb7')](path[_0x717c('0x51')](__dirname,_0x717c('0xc9')),[_0x52e35f[_0x717c('0x26')]['id'],JSON[_0x717c('0xc4')](_0x52e35f[_0x717c('0x35')]),JSON[_0x717c('0xc4')](_0x5c2716)]);_0x1a6c3d['on'](_0x717c('0xc5'),function(){_0x2c8b2b=!![];return _0x2bd715[_0x717c('0x16')](0xc8)['json']({'message':_0x717c('0xc6'),'pid':_0x1a6c3d[_0x717c('0xbb')]});});_0x1a6c3d['on'](_0x717c('0xca'),function(_0x14650a){if(_0x14650a&&!_0x2c8b2b){return _0x2bd715[_0x717c('0x16')](0x1f4)[_0x717c('0x11')]({'message':_0x717c('0xc7'),'pid':_0x1a6c3d[_0x717c('0xbb')]});}});})['catch'](handleError(_0x2bd715,null));};exports[_0x717c('0xcb')]=function(_0x224fa0,_0x4a6b9c){var _0x190fd3=[_0x717c('0xcc'),_0x717c('0xcd'),_0x717c('0xce'),'openchannel',_0x717c('0xcf'),_0x717c('0xd0'),_0x717c('0xd1')];var _0x5dc39b={'offset':0x0,'order':qs[_0x717c('0x80')](_0x717c('0xd2'))},_0x4e59f1={'count':0x0,'rows':[]};Promise[_0x717c('0xd3')]()[_0x717c('0x19')](function(){if(_0x224fa0[_0x717c('0x22')][_0x717c('0xd4')]){if(!_[_0x717c('0xd5')](_0x190fd3,_0x224fa0[_0x717c('0x22')][_0x717c('0xd4')][_0x717c('0xd6')]())){throw new Error('Invalid\x20channel');}_0x190fd3=[_0x224fa0['query'][_0x717c('0xd4')]['toLowerCase']()];}if(_0x224fa0[_0x717c('0x22')]['range']){try{var _0x21566c=JSON[_0x717c('0xbe')](_0x224fa0[_0x717c('0x22')][_0x717c('0xd7')]);if(!moment(_0x21566c[_0x717c('0x36')])[_0x717c('0xd8')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x21566c['to'])[_0x717c('0xd8')]()){throw new Error(_0x717c('0xd9'));}}catch(_0x18da54){throw new Error(_0x717c('0xda'));}}if(!_0x224fa0[_0x717c('0x22')][_0x717c('0x33')](_0x717c('0xa3'))){_0x5dc39b[_0x717c('0x14')]=qs['limit'](_0x224fa0[_0x717c('0x22')][_0x717c('0x14')]||0xa);_0x5dc39b[_0x717c('0x12')]=qs[_0x717c('0x12')](_0x224fa0[_0x717c('0x22')][_0x717c('0x12')]);}var _0x5e4d19=_0x190fd3[_0x717c('0x83')](function(_0x4750e0){if(_0x4750e0===_0x717c('0xd1')){var _0x16e9ed={'attributes':['id',_0x717c('0xdb'),_0x717c('0x30'),_0x717c('0xdc'),_0x717c('0xdd'),_0x717c('0xde'),_0x717c('0xdf'),_0x717c('0xe0'),'duration',_0x717c('0xe1'),_0x717c('0xe2'),_0x717c('0xe3'),'userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x224fa0[_0x717c('0x26')]['id']},'include':[{'model':db[_0x717c('0xc0')],'as':_0x717c('0xc0'),'attributes':['id',_0x717c('0x1e'),_0x717c('0xe4'),_0x717c('0x2f')]}],'order':[[_0x717c('0xe2'),_0x717c('0xe5')]]};if(_0x224fa0[_0x717c('0x22')]['range']){_0x16e9ed['where']['createdAt']={'$gte':_0x21566c[_0x717c('0x36')],'$lte':_0x21566c['to']};}return db[_0x717c('0x4a')][_0x717c('0xe6')](_0x16e9ed)['then'](function(_0x1d171a){_0x4e59f1['count']+=_0x1d171a[_0x717c('0x15')];return _['map'](_0x1d171a[_0x717c('0xa0')],function(_0x1e4ab5){var _0x16b0da=_0x1e4ab5[_0x717c('0x37')]({'plain':!![]});_0x16b0da[_0x717c('0xd4')]=_0x4750e0;if(_0x16b0da['User']){_0x16b0da[_0x717c('0xc0')]={'id':_0x16b0da[_0x717c('0xc0')]['id'],'name':_0x16b0da[_0x717c('0xc0')]['name'],'fullname':_0x16b0da['User'][_0x717c('0xe4')],'alias':_0x16b0da[_0x717c('0xc0')]['alias']};}return _0x16b0da;});});}else{var _0x3dd706=_[_0x717c('0xe7')](_0x4750e0)+(_0x4750e0==='chat'?_0x717c('0xe8'):_0x717c('0xe9'));var _0x470f15={'attributes':['id',_0x717c('0xea'),_0x717c('0xeb'),_0x717c('0xe2'),_0x717c('0xe1'),_0x717c('0xec'),_0x717c('0xed'),'thirdDisposition','UserId',_0x3dd706+'Id'],'where':{'ContactId':_0x224fa0[_0x717c('0x26')]['id']},'include':[{'model':db[_0x3dd706],'as':_0x717c('0xe9'),'attributes':['id',_0x717c('0x1e'),_0x717c('0xee')]},{'model':db[_0x717c('0xc0')],'as':_0x717c('0xef'),'attributes':['id','name','fullname']},{'model':db[_0x717c('0xf0')],'as':_0x717c('0x62'),'attributes':['id',_0x717c('0x1e'),_0x717c('0xf1')],'through':{'attributes':[]}}],'order':[[_0x717c('0xe2'),_0x717c('0xe5')]]};if(_0x224fa0[_0x717c('0x22')][_0x717c('0xd7')]){_0x470f15['where'][_0x717c('0xe2')]={'$gte':_0x21566c[_0x717c('0x36')],'$lte':_0x21566c['to']};}switch(_0x4750e0){case _0x717c('0xcd'):_0x470f15['attributes']['push'](_0x717c('0xf2'),'customerIp',_0x717c('0xf3'),_0x717c('0xf4'),'osName',_0x717c('0xf5'),_0x717c('0xf6'),_0x717c('0xf7'),_0x717c('0xf8'));break;case'mail':_0x470f15[_0x717c('0x7c')][_0x717c('0x5b')](_0x717c('0xf9'),_0x717c('0xfa'));break;case _0x717c('0xfb'):_0x470f15['attributes'][_0x717c('0x5b')](_0x717c('0xfc'),'threadId');break;}return db[_['startCase'](_0x4750e0)+_0x717c('0xfd')][_0x717c('0xe6')](_0x470f15)[_0x717c('0x19')](function(_0x48c9e9){_0x4e59f1['count']+=_0x48c9e9[_0x717c('0x15')];return _[_0x717c('0x83')](_0x48c9e9[_0x717c('0xa0')],function(_0x3d7038){var _0x74feaf=_0x3d7038[_0x717c('0x37')]({'plain':!![]});_0x74feaf[_0x717c('0xd4')]=_0x4750e0;if(_0x74feaf[_0x717c('0xef')]){_0x74feaf['Owner']={'id':_0x74feaf['Owner']['id'],'name':_0x74feaf['Owner']['name'],'fullname':_0x74feaf['Owner'][_0x717c('0xe4')]};}return _0x74feaf;});});}});return Promise[_0x717c('0x60')](_0x5e4d19);})[_0x717c('0x19')](function(_0x34657a){return _(_0x34657a)[_0x717c('0xfe')]()[_0x717c('0xff')]('createdAt')['reverse']()['value']();})[_0x717c('0x19')](function(_0xfa6ec2){_0x4e59f1['rows']=_0x5dc39b[_0x717c('0x14')]?_0xfa6ec2[_0x717c('0x100')](_0x5dc39b['offset'],_0x5dc39b[_0x717c('0x12')]+_0x5dc39b[_0x717c('0x14')]):_0xfa6ec2;return _0x4e59f1;})[_0x717c('0x19')](respondWithFilteredResult(_0x4a6b9c,_0x5dc39b))[_0x717c('0x23')](handleError(_0x4a6b9c,null));}; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index fd276ad..e205964 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 _0xd3b7=['emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','save','remove'];(function(_0x56a78d,_0x2c2638){var _0x3e6499=function(_0x124e93){while(--_0x124e93){_0x56a78d['push'](_0x56a78d['shift']());}};_0x3e6499(++_0x2c2638);}(_0xd3b7,0x81));var _0x7d3b=function(_0x4e8d7c,_0x2fd0c3){_0x4e8d7c=_0x4e8d7c-0x0;var _0x129ac5=_0xd3b7[_0x4e8d7c];return _0x129ac5;};'use strict';var EventEmitter=require(_0x7d3b('0x0'));var CmContact=require(_0x7d3b('0x1'))['db'][_0x7d3b('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x7d3b('0x3')](0x0);var events={'afterCreate':_0x7d3b('0x4'),'afterUpdate':'update','afterDestroy':_0x7d3b('0x5')};function emitEvent(_0xe4de9){return function(_0x17fb54,_0x19e783,_0x2b6887){CmContactEvents['emit'](_0xe4de9+':'+_0x17fb54['id'],_0x17fb54);CmContactEvents[_0x7d3b('0x6')](_0xe4de9,_0x17fb54);_0x2b6887(null);};}for(var e in events){if(events[_0x7d3b('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x7d3b('0x8')]=CmContactEvents; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index cc4b57a..a57474c 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 _0x98f9=['outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','lastName','utf8mb4','models','get','error','cmContact','afterCreate','scheduledat','format','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'];(function(_0x4316f0,_0x583506){var _0x2fba98=function(_0x2ac61a){while(--_0x2ac61a){_0x4316f0['push'](_0x4316f0['shift']());}};_0x2fba98(++_0x583506);}(_0x98f9,0x17c));var _0x998f=function(_0x12193a,_0x34b07a){_0x12193a=_0x12193a-0x0;var _0x3d12ae=_0x98f9[_0x12193a];return _0x3d12ae;};'use strict';var _=require('lodash');var util=require(_0x998f('0x0'));var logger=require(_0x998f('0x1'))(_0x998f('0x2'));var moment=require(_0x998f('0x3'));var BPromise=require(_0x998f('0x4'));var rp=require(_0x998f('0x5'));var fs=require('fs');var path=require(_0x998f('0x6'));var rimraf=require(_0x998f('0x7'));var config=require(_0x998f('0x8'));var shared=require(_0x998f('0x9'));var attributes=require(_0x998f('0xa'));module[_0x998f('0xb')]=function(_0x48ad29,_0x4ec0a3){return _0x48ad29[_0x998f('0xc')]('CmContact',attributes,{'tableName':_0x998f('0xd'),'paranoid':!![],'indexes':[{'name':_0x998f('0xe'),'fields':['phone']},{'name':_0x998f('0xf'),'fields':[_0x998f('0x10'),_0x998f('0x11'),_0x998f('0xe'),'mobile','fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x998f('0x12'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xbacd47,_0x2d717b,_0x1543c9){var _0x2ecbe2=_0x48ad29[_0x998f('0x13')];var _0x5ecf61=_0xbacd47[_0x998f('0x14')]({'plain':!![]});function _0x5476e5(){return function(_0x28f24f){logger[_0x998f('0x15')](_0x998f('0x16'),_0x998f('0x17'),util['inspect'](_0x28f24f,{'showHidden':![],'depth':null}));};}function _0x291ee7(_0x10d96c,_0x1377eb){var _0x10e231=_0x1377eb[_0x998f('0x18')]?_0x1377eb['scheduledat']:moment()[_0x998f('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x17499e,_0x359103){if(_[_0x998f('0x1a')](_0x1377eb[_0x998f('0x1b')])){_0x17499e({'ret':_0x10e231});}else{_0x2ecbe2[_0x998f('0x1c')]['findOne']({'where':{'id':_0x10d96c['id']}})[_0x998f('0x1d')](function(_0x36af8d){if(!_['isNil'](_0x36af8d)){var _0x5312e3=_0x36af8d['dialTimezone'];if(!_[_0x998f('0x1a')](_0x5312e3)){var _0x105c90=shared[_0x998f('0x1e')];var _0x15cc27=_0x105c90[_0x5312e3];var _0x32d6b9=_0x105c90[_0x1377eb[_0x998f('0x1b')]];if(!_[_0x998f('0x1a')](_0x15cc27)&&!_[_0x998f('0x1a')](_0x32d6b9)){var _0x2cf9a2=_0x15cc27['utcOffset']-_0x32d6b9[_0x998f('0x1f')];_0x10e231=_0x1377eb[_0x998f('0x18')]?_0x1377eb[_0x998f('0x18')]:moment();var _0x47950f=moment(_0x10e231)[_0x998f('0x20')](_0x2cf9a2,'minutes');_0x17499e({'ret':_0x47950f['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x17499e({'ret':_0x10e231});}else _0x17499e({'ret':_0x10e231});}else{_0x17499e({'ret':_0x10e231});}});}});return 0xa;}var _0xfa0d8b=function(_0x543f5c){return new BPromise(function(_0xa1e239,_0x401ff5){_0x291ee7(_0x543f5c,_0x5ecf61)['then'](function(_0x46a0d3){_0x5ecf61[_0x998f('0x18')]=_0x46a0d3[_0x998f('0x21')];_0x2ecbe2[_0x998f('0x22')][_0x998f('0x23')]({'where':{'phone':_0x5ecf61[_0x998f('0xe')],'VoiceQueueId':_0x543f5c['id']}})[_0x998f('0x1d')](function(_0x3ce53f){if(!_[_0x998f('0x1a')](_0x3ce53f)){throw new Error(_0x998f('0x24')+_0x5ecf61[_0x998f('0xe')]+_0x998f('0x25')+_0x543f5c['id']);}return _0x2ecbe2[_0x998f('0x22')][_0x998f('0x26')]({'phone':_0x5ecf61['phone'],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'priority':_0x5ecf61[_0x998f('0x28')]?_0x5ecf61[_0x998f('0x28')]:0x2,'scheduledat':_0x5ecf61['scheduledat']?_0x5ecf61[_0x998f('0x18')]:moment()[_0x998f('0x19')](_0x998f('0x29')),'callback':_0x5ecf61[_0x998f('0x2a')]?!![]:![],'callbackuniqueid':_0x5ecf61[_0x998f('0x2a')]?_0x5ecf61['callbackUniqueid']:undefined,'callbackat':_0x5ecf61[_0x998f('0x2a')]?moment()[_0x998f('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x543f5c['id']});})[_0x998f('0x2b')](function(_0x2cbcae){_0x401ff5(_0x2cbcae);});});});};var _0x3b55fc=function(_0x1deeba){return new BPromise(function(_0x17ff63,_0x34ce43){_0x291ee7(_0x1deeba,_0x5ecf61)[_0x998f('0x1d')](function(_0x342bc4){_0x5ecf61[_0x998f('0x18')]=_0x342bc4[_0x998f('0x21')];_0x2ecbe2[_0x998f('0x22')]['findOne']({'where':{'phone':_0x5ecf61['phone'],'VoiceQueueId':_0x1deeba['id']}})[_0x998f('0x1d')](function(_0x1d488d){if(!_[_0x998f('0x1a')](_0x1d488d)){throw new Error(_0x998f('0x24')+_0x5ecf61[_0x998f('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1deeba['id']);}return _0x2ecbe2[_0x998f('0x2c')]['findOne']({'where':{'calleridnum':_0x5ecf61[_0x998f('0xe')],'VoiceQueueId':_0x1deeba['id']}});})[_0x998f('0x1d')](function(_0x168d34){if(!_[_0x998f('0x1a')](_0x168d34)){throw new Error(_0x998f('0x2d')+_0x5ecf61['phone']+_0x998f('0x2e')+_0x1deeba['id']);}return _0x2ecbe2[_0x998f('0x22')][_0x998f('0x26')]({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'priority':_0x5ecf61['priority']?_0x5ecf61[_0x998f('0x28')]:0x2,'scheduledat':_0x5ecf61[_0x998f('0x18')]?_0x5ecf61[_0x998f('0x18')]:moment()[_0x998f('0x19')](_0x998f('0x29')),'callback':_0x5ecf61[_0x998f('0x2a')]?!![]:![],'callbackuniqueid':_0x5ecf61['callbackUniqueid']?_0x5ecf61['callbackUniqueid']:undefined,'callbackat':_0x5ecf61[_0x998f('0x2a')]?moment()[_0x998f('0x19')](_0x998f('0x29')):undefined,'VoiceQueueId':_0x1deeba['id']});})[_0x998f('0x2b')](function(_0x5c6c5d){_0x34ce43(_0x5c6c5d);});});});};function _0x150fdb(){return function(_0x2b9b8c){logger[_0x998f('0x15')](_0x998f('0x16'),_0x998f('0x17'),util[_0x998f('0x2f')](_0x2b9b8c,{'showHidden':![],'depth':null}));};}function _0x30301b(_0x2f2400,_0x29202e){var _0x47b409=_0x29202e[_0x998f('0x18')]?_0x29202e[_0x998f('0x18')]:moment()[_0x998f('0x19')](_0x998f('0x29'));return new BPromise(function(_0x353480,_0x4feb7e){if(_[_0x998f('0x1a')](_0x29202e[_0x998f('0x1b')])){_0x353480({'ret':_0x47b409});}else{_0x2ecbe2[_0x998f('0x30')][_0x998f('0x23')]({'where':{'id':_0x2f2400['id']}})['then'](function(_0x155a86){if(!_[_0x998f('0x1a')](_0x155a86)){var _0x56dc53=_0x155a86['dialTimezone'];if(!_['isNil'](_0x56dc53)){var _0xeb7e5d=shared[_0x998f('0x1e')];var _0x25f563=_0xeb7e5d[_0x56dc53];var _0xd53106=_0xeb7e5d[_0x29202e['dialTimezone']];if(!_[_0x998f('0x1a')](_0x25f563)&&!_['isNil'](_0xd53106)){var _0x3049dc=_0x25f563[_0x998f('0x1f')]-_0xd53106[_0x998f('0x1f')];_0x47b409=_0x29202e[_0x998f('0x18')]?_0x29202e[_0x998f('0x18')]:moment();var _0x9a17a8=moment(_0x47b409)['add'](_0x3049dc,_0x998f('0x31'));_0x353480({'ret':_0x9a17a8[_0x998f('0x19')](_0x998f('0x29'))});}else _0x353480({'ret':_0x47b409});}else _0x353480({'ret':_0x47b409});}else{_0x353480({'ret':_0x47b409});}});}});return 0xa;}var _0x267b7b=function(_0x50d453){return new BPromise(function(_0x30d54e,_0x27a494){_0x30301b(_0x50d453,_0x5ecf61)[_0x998f('0x1d')](function(_0x255f1b){_0x5ecf61[_0x998f('0x18')]=_0x255f1b['ret'];_0x2ecbe2[_0x998f('0x22')][_0x998f('0x23')]({'where':{'phone':_0x5ecf61[_0x998f('0xe')],'CampaignId':_0x50d453['id']}})[_0x998f('0x1d')](function(_0x240fc4){if(!_[_0x998f('0x1a')](_0x240fc4)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5ecf61[_0x998f('0xe')]+_0x998f('0x32')+_0x50d453['id']);}return _0x2ecbe2['CmHopper']['create']({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'priority':_0x5ecf61[_0x998f('0x28')]?_0x5ecf61[_0x998f('0x28')]:0x2,'scheduledat':_0x5ecf61[_0x998f('0x18')]?_0x5ecf61['scheduledat']:moment()[_0x998f('0x19')](_0x998f('0x29')),'callback':_0x5ecf61[_0x998f('0x2a')]?!![]:![],'callbackuniqueid':_0x5ecf61[_0x998f('0x2a')]?_0x5ecf61[_0x998f('0x2a')]:undefined,'callbackat':_0x5ecf61[_0x998f('0x2a')]?moment()[_0x998f('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x50d453['id']});})[_0x998f('0x2b')](function(_0x5b7439){_0x27a494(_0x5b7439);});});});};var _0x4c3494=function(_0x227203){return new BPromise(function(_0x59bc29,_0x1bbee7){_0x30301b(_0x227203,_0x5ecf61)[_0x998f('0x1d')](function(_0x4f548f){_0x5ecf61[_0x998f('0x18')]=_0x4f548f['ret'];_0x2ecbe2[_0x998f('0x22')][_0x998f('0x23')]({'where':{'phone':_0x5ecf61[_0x998f('0xe')],'CampaignId':_0x227203['id']}})[_0x998f('0x1d')](function(_0x574705){if(!_[_0x998f('0x1a')](_0x574705)){throw new Error(_0x998f('0x24')+_0x5ecf61[_0x998f('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x227203['id']);}return _0x2ecbe2['CmHopperFinal'][_0x998f('0x23')]({'where':{'calleridnum':_0x5ecf61['phone'],'CampaignId':_0x227203['id']}});})[_0x998f('0x1d')](function(_0x415a34){if(!_[_0x998f('0x1a')](_0x415a34)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5ecf61['phone']+_0x998f('0x33')+_0x227203['id']);}return _0x2ecbe2[_0x998f('0x22')][_0x998f('0x26')]({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'priority':_0x5ecf61[_0x998f('0x28')]?_0x5ecf61[_0x998f('0x28')]:0x2,'scheduledat':_0x5ecf61[_0x998f('0x18')]?_0x5ecf61[_0x998f('0x18')]:moment()[_0x998f('0x19')](_0x998f('0x29')),'callback':_0x5ecf61[_0x998f('0x2a')]?!![]:![],'callbackuniqueid':_0x5ecf61[_0x998f('0x2a')]?_0x5ecf61['callbackUniqueid']:undefined,'callbackat':_0x5ecf61[_0x998f('0x2a')]?moment()[_0x998f('0x19')](_0x998f('0x29')):undefined,'CampaignId':_0x227203['id']});})['catch'](function(_0x33e54d){_0x1bbee7(_0x33e54d);});});});};if(_0x5ecf61[_0x998f('0x27')]){_0x2ecbe2['VoiceQueue']['findAll']({'where':{'type':_0x998f('0x34')},'attributes':['id',_0x998f('0x35'),_0x998f('0x1b')],'include':[{'model':_0x2ecbe2[_0x998f('0x36')],'as':_0x998f('0x37'),'where':{'id':_0x5ecf61['ListId']}}]})[_0x998f('0x1d')](function(_0x1c3732){if(_0x1c3732){var _0x5c3a35=[];for(var _0xd936f1=0x0,_0x240557;_0xd936f1<_0x1c3732[_0x998f('0x38')];_0xd936f1+=0x1){_0x240557=_0x1c3732[_0xd936f1][_0x998f('0x14')]({'plain':!![]});switch(_0x240557[_0x998f('0x35')]){case _0x998f('0x39'):_0x3b55fc(_0x240557)[_0x998f('0x2b')](_0x5476e5());break;case _0x998f('0x3a'):_0xfa0d8b(_0x240557)[_0x998f('0x2b')](_0x5476e5());break;default:_0x30301b(_0x240557,_0x5ecf61)[_0x998f('0x1d')](function(_0x218283){_0x5ecf61[_0x998f('0x18')]=_0x218283[_0x998f('0x21')];_0x2ecbe2[_0x998f('0x22')][_0x998f('0x26')]({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61['ListId'],'scheduledat':_0x5ecf61['scheduledat']?_0x5ecf61[_0x998f('0x18')]:moment()[_0x998f('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5ecf61[_0x998f('0x28')]?_0x5ecf61[_0x998f('0x28')]:0x2,'callback':_0x5ecf61[_0x998f('0x2a')]?!![]:![],'callbackuniqueid':_0x5ecf61['callbackUniqueid']?_0x5ecf61[_0x998f('0x2a')]:undefined,'callbackat':_0x5ecf61[_0x998f('0x2a')]?moment()[_0x998f('0x19')](_0x998f('0x29')):undefined,'VoiceQueueId':_0x240557['id']})[_0x998f('0x2b')](_0x5476e5());});}}}})[_0x998f('0x1d')](function(){return _0x2ecbe2[_0x998f('0x1c')][_0x998f('0x3b')]({'where':{'type':_0x998f('0x34')},'attributes':['id'],'include':[{'model':_0x2ecbe2[_0x998f('0x36')],'as':_0x998f('0x3c'),'where':{'id':_0x5ecf61[_0x998f('0x27')]}}]})['then'](function(_0x543961){if(_0x543961){var _0x321380=[];for(var _0x5628f9=0x0,_0x3b1d25;_0x5628f9<_0x543961[_0x998f('0x38')];_0x5628f9+=0x1){_0x3b1d25=_0x543961[_0x5628f9]['get']({'plain':!![]});_0x2ecbe2[_0x998f('0x3d')][_0x998f('0x26')]({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'VoiceQueueId':_0x3b1d25['id']})[_0x998f('0x2b')](function(_0x1ef76e){logger[_0x998f('0x15')]('cmContact,\x20%s,\x20%s','afterCreate',_0x1ef76e['message']);});}}});})['then'](function(){return _0x2ecbe2[_0x998f('0x30')][_0x998f('0x3b')]({'attributes':['id',_0x998f('0x35'),_0x998f('0x1b')],'include':[{'model':_0x2ecbe2['CmList'],'as':_0x998f('0x37'),'where':{'id':_0x5ecf61[_0x998f('0x27')]}}]})[_0x998f('0x1d')](function(_0x582337){if(_0x582337){var _0x2ef382=[];for(var _0x5df363=0x0,_0x255845;_0x5df363<_0x582337['length'];_0x5df363+=0x1){_0x255845=_0x582337[_0x5df363][_0x998f('0x14')]({'plain':!![]});switch(_0x255845[_0x998f('0x35')]){case'always':_0x4c3494(_0x255845)['catch'](_0x150fdb());break;case _0x998f('0x3a'):_0x267b7b(_0x255845)[_0x998f('0x2b')](_0x150fdb());break;default:_0x2ecbe2[_0x998f('0x22')][_0x998f('0x26')]({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'scheduledat':_0x5ecf61['scheduledat']?_0x5ecf61['scheduledat']:moment()[_0x998f('0x19')](_0x998f('0x29')),'priority':_0x5ecf61[_0x998f('0x28')]?_0x5ecf61[_0x998f('0x28')]:0x2,'callback':_0x5ecf61[_0x998f('0x2a')]?!![]:![],'callbackuniqueid':_0x5ecf61[_0x998f('0x2a')]?_0x5ecf61[_0x998f('0x2a')]:undefined,'callbackat':_0x5ecf61['callbackUniqueid']?moment()[_0x998f('0x19')](_0x998f('0x29')):undefined,'CampaignId':_0x255845['id']})[_0x998f('0x2b')](_0x150fdb());}}}});})[_0x998f('0x1d')](function(){return _0x2ecbe2[_0x998f('0x30')][_0x998f('0x3b')]({'attributes':['id'],'include':[{'model':_0x2ecbe2['CmList'],'as':_0x998f('0x3c'),'where':{'id':_0x5ecf61[_0x998f('0x27')]}}]})[_0x998f('0x1d')](function(_0x344bdd){if(_0x344bdd){var _0x2aaf6e=[];for(var _0x22ea6c=0x0,_0x4d562e;_0x22ea6c<_0x344bdd[_0x998f('0x38')];_0x22ea6c+=0x1){_0x4d562e=_0x344bdd[_0x22ea6c][_0x998f('0x14')]({'plain':!![]});_0x2ecbe2[_0x998f('0x3d')]['create']({'phone':_0x5ecf61[_0x998f('0xe')],'ContactId':_0x5ecf61['id'],'ListId':_0x5ecf61[_0x998f('0x27')],'CampaignId':_0x4d562e['id']})[_0x998f('0x2b')](function(_0x4b8d0b){logger[_0x998f('0x15')](_0x998f('0x3e'),_0x998f('0x17'),_0x4b8d0b[_0x998f('0x3f')]);});}}});})[_0x998f('0x1d')](function(){_0x1543c9();})[_0x998f('0x2b')](function(_0x1ee05a){logger[_0x998f('0x15')]('cmContact,\x20%s,\x20%s',_0x998f('0x17'),_0x1ee05a[_0x998f('0x3f')]);_0x1543c9(_0x1ee05a);});}else{_0x1543c9(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x3635d5,_0x2fc556,_0x5cb817){var _0x360a87=_0x48ad29[_0x998f('0x13')];var _0x2cd2a4=_0x3635d5[_0x998f('0x14')]({'plain':!![]});return _0x360a87[_0x998f('0x22')][_0x998f('0x3b')]({'raw':!![],'where':{'ListId':_0x2cd2a4[_0x998f('0x27')],'ContactId':_0x2cd2a4['id']}})[_0x998f('0x1d')](function(_0x2e979b){if(!_[_0x998f('0x40')](_0x2e979b)){var _0x41dc2e=[];for(var _0x2d4eb8=0x0;_0x2d4eb8<_0x2e979b['length'];_0x2d4eb8+=0x1){var _0xc09a54=_0x360a87[_0x998f('0x22')][_0x998f('0x41')]({'where':{'ListId':_0x2e979b[_0x2d4eb8]['ListId'],'ContactId':_0x2e979b[_0x2d4eb8][_0x998f('0x42')],'VoiceQueueId':_0x2e979b[_0x2d4eb8][_0x998f('0x43')],'CampaignId':_0x2e979b[_0x2d4eb8][_0x998f('0x44')]}});_0x41dc2e['push'](_0xc09a54);}return BPromise[_0x998f('0x45')](_0x41dc2e);}})['then'](function(_0x222e70){logger[_0x998f('0x46')](_0x998f('0x47'),util[_0x998f('0x2f')](_0x222e70,{'showHidden':![],'depth':null}));_0x5cb817();})['catch'](function(_0x2a4bc4){logger[_0x998f('0x15')]('[CmContact][afterDestroy][Error]',util[_0x998f('0x2f')](_0x2a4bc4,{'showHidden':![],'depth':null}));_0x5cb817(_0x2a4bc4);});}}});}; \ No newline at end of file +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 diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 8ff4176..1b7eabd 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x4ad1a5,_0x4e12d4){var _0xe5f587=function(_0x10f51b){while(--_0x10f51b){_0x4ad1a5['push'](_0x4ad1a5['shift']());}};_0xe5f587(++_0x4e12d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 fe7d1c8..9da1b5b 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 _0x6282=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0x32906f,_0x3e67d5){var _0x2ef85d=function(_0x3aa0a4){while(--_0x3aa0a4){_0x32906f['push'](_0x32906f['shift']());}};_0x2ef85d(++_0x3e67d5);}(_0x6282,0x76));var _0x2628=function(_0x25d17b,_0x377820){_0x25d17b=_0x25d17b-0x0;var _0x611c2f=_0x6282[_0x25d17b];return _0x611c2f;};'use strict';var Sequelize=require(_0x2628('0x0'));module[_0x2628('0x1')]={'CmContactId':{'type':Sequelize[_0x2628('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2628('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x2628('0x4')},'OrderBy':{'type':Sequelize[_0x2628('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +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 diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index d7f636a..5928fb6 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 _0x9cf1=['params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0x9cf1,0x196));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x19cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x19cf('0x1'));var jsonpatch=require(_0x19cf('0x2'));var rp=require(_0x19cf('0x3'));var moment=require('moment');var BPromise=require(_0x19cf('0x4'));var Mustache=require(_0x19cf('0x5'));var util=require('util');var path=require(_0x19cf('0x6'));var sox=require(_0x19cf('0x7'));var csv=require(_0x19cf('0x8'));var ejs=require(_0x19cf('0x9'));var fs=require('fs');var fs_extra=require(_0x19cf('0xa'));var _=require(_0x19cf('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x19cf('0xc'));var toCsv=require(_0x19cf('0x8'));var querystring=require(_0x19cf('0xd'));var Papa=require(_0x19cf('0xe'));var Redis=require(_0x19cf('0xf'));var authService=require(_0x19cf('0x10'));var qs=require(_0x19cf('0x11'));var as=require(_0x19cf('0x12'));var hardwareService=require(_0x19cf('0x13'));var logger=require(_0x19cf('0x14'))(_0x19cf('0x15'));var utils=require(_0x19cf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x19cf('0x17'))['db'];function respondWithStatusCode(_0x27479c,_0x582bad){_0x582bad=_0x582bad||0xcc;return function(_0x5c5940){if(_0x5c5940){return _0x27479c[_0x19cf('0x18')](_0x582bad);}return _0x27479c[_0x19cf('0x19')](_0x582bad)[_0x19cf('0x1a')]();};}function respondWithResult(_0x138e06,_0x3cb895){_0x3cb895=_0x3cb895||0xc8;return function(_0x1dcc8e){if(_0x1dcc8e){return _0x138e06[_0x19cf('0x19')](_0x3cb895)['json'](_0x1dcc8e);}};}function respondWithFilteredResult(_0x5dde67,_0x578893){return function(_0x2baed6){if(_0x2baed6){var _0x21f340=typeof _0x578893[_0x19cf('0x1b')]===_0x19cf('0x1c')&&typeof _0x578893[_0x19cf('0x1d')]===_0x19cf('0x1c');var _0x2d6b27=_0x2baed6[_0x19cf('0x1e')];var _0x192705=_0x21f340?0x0:_0x578893['offset'];var _0x245514=_0x21f340?_0x2baed6[_0x19cf('0x1e')]:_0x578893['offset']+_0x578893[_0x19cf('0x1d')];var _0x474628;if(_0x245514>=_0x2d6b27){_0x245514=_0x2d6b27;_0x474628=0xc8;}else{_0x474628=0xce;}_0x5dde67[_0x19cf('0x19')](_0x474628);return _0x5dde67['set']('Content-Range',_0x192705+'-'+_0x245514+'/'+_0x2d6b27)[_0x19cf('0x1f')](_0x2baed6);}return null;};}function patchUpdates(_0xeb7e0a){return function(_0x3395b8){try{jsonpatch[_0x19cf('0x20')](_0x3395b8,_0xeb7e0a,!![]);}catch(_0x2af1b7){return BPromise[_0x19cf('0x21')](_0x2af1b7);}return _0x3395b8['save']();};}function saveUpdates(_0x21072f,_0x1cab30){return function(_0x59a709){if(_0x59a709){return _0x59a709[_0x19cf('0x22')](_0x21072f)[_0x19cf('0x23')](function(_0x55e950){return _0x55e950;});}return null;};}function removeEntity(_0x5cbf1d,_0x1eea94){return function(_0x3c1b36){if(_0x3c1b36){return _0x3c1b36[_0x19cf('0x24')]()[_0x19cf('0x23')](function(){var _0x3990a8=_0x3c1b36[_0x19cf('0x25')]({'plain':!![]});var _0x548489=_0x19cf('0x26');return db[_0x19cf('0x27')][_0x19cf('0x24')]({'where':{'type':_0x548489,'resourceId':_0x3990a8['id']}})[_0x19cf('0x23')](function(){return _0x3c1b36;});})['then'](function(){_0x5cbf1d[_0x19cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f9b2,_0x1108d7){return function(_0x34c9b7){if(!_0x34c9b7){_0x40f9b2[_0x19cf('0x18')](0x194);}return _0x34c9b7;};}function handleError(_0xc1b31c,_0x3a8b3d){_0x3a8b3d=_0x3a8b3d||0x1f4;return function(_0x1414be){logger[_0x19cf('0x28')](_0x1414be[_0x19cf('0x29')]);if(_0x1414be[_0x19cf('0x2a')]){delete _0x1414be[_0x19cf('0x2a')];}_0xc1b31c['status'](_0x3a8b3d)[_0x19cf('0x2b')](_0x1414be);};}exports[_0x19cf('0x2c')]=function(_0x9e3a4a,_0xff077e){var _0x11ae21={},_0x5d56a3={},_0x3ae1cd={'count':0x0,'rows':[]};var _0x38303c=_[_0x19cf('0x2d')](db[_0x19cf('0x2e')][_0x19cf('0x2f')],function(_0x1cc0a8){return{'name':_0x1cc0a8[_0x19cf('0x30')],'type':_0x1cc0a8[_0x19cf('0x31')]['key']};});_0x5d56a3['model']=_[_0x19cf('0x2d')](_0x38303c,_0x19cf('0x2a'));_0x5d56a3[_0x19cf('0x32')]=_['keys'](_0x9e3a4a['query']);_0x5d56a3[_0x19cf('0x33')]=_[_0x19cf('0x34')](_0x5d56a3[_0x19cf('0x35')],_0x5d56a3[_0x19cf('0x32')]);_0x11ae21['attributes']=_[_0x19cf('0x34')](_0x5d56a3[_0x19cf('0x35')],qs[_0x19cf('0x36')](_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x36')]));_0x11ae21[_0x19cf('0x37')]=_0x11ae21['attributes'][_0x19cf('0x38')]?_0x11ae21[_0x19cf('0x37')]:_0x5d56a3[_0x19cf('0x35')];if(!_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x39')](_0x19cf('0x3a'))){_0x11ae21[_0x19cf('0x1d')]=qs[_0x19cf('0x1d')](_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x1d')]);_0x11ae21[_0x19cf('0x1b')]=qs[_0x19cf('0x1b')](_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x1b')]);}_0x11ae21['order']=qs[_0x19cf('0x3b')](_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x3b')]);_0x11ae21[_0x19cf('0x3c')]=qs[_0x19cf('0x33')](_[_0x19cf('0x3d')](_0x9e3a4a[_0x19cf('0x32')],_0x5d56a3[_0x19cf('0x33')]),_0x38303c);if(_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x3e')]){_0x11ae21[_0x19cf('0x3c')]=_[_0x19cf('0x3f')](_0x11ae21[_0x19cf('0x3c')],{'$or':_[_0x19cf('0x2d')](_0x38303c,function(_0x131888){if(_0x131888[_0x19cf('0x31')]!==_0x19cf('0x40')){var _0x375441={};_0x375441[_0x131888[_0x19cf('0x2a')]]={'$like':'%'+_0x9e3a4a[_0x19cf('0x32')][_0x19cf('0x3e')]+'%'};return _0x375441;}})});}_0x11ae21=_[_0x19cf('0x3f')]({},_0x11ae21,_0x9e3a4a[_0x19cf('0x41')]);var _0x44dd26={'where':_0x11ae21['where']};return db['CmContactHasItem']['count'](_0x44dd26)[_0x19cf('0x23')](function(_0x3966ea){_0x3ae1cd[_0x19cf('0x1e')]=_0x3966ea;if(_0x9e3a4a['query'][_0x19cf('0x42')]){_0x11ae21['include']=[{'all':!![]}];}return db[_0x19cf('0x2e')][_0x19cf('0x43')](_0x11ae21);})[_0x19cf('0x23')](function(_0x37138a){_0x3ae1cd[_0x19cf('0x44')]=_0x37138a;return _0x3ae1cd;})['then'](respondWithFilteredResult(_0xff077e,_0x11ae21))[_0x19cf('0x45')](handleError(_0xff077e,null));};exports[_0x19cf('0x46')]=function(_0x9e6f09,_0x477565){var _0x215f31={'raw':!![],'where':{'id':_0x9e6f09['params']['id']}},_0x3c0c6f={};_0x3c0c6f[_0x19cf('0x35')]=_[_0x19cf('0x47')](db['CmContactHasItem'][_0x19cf('0x2f')]);_0x3c0c6f[_0x19cf('0x32')]=_[_0x19cf('0x47')](_0x9e6f09['query']);_0x3c0c6f[_0x19cf('0x33')]=_[_0x19cf('0x34')](_0x3c0c6f[_0x19cf('0x35')],_0x3c0c6f[_0x19cf('0x32')]);_0x215f31['attributes']=_[_0x19cf('0x34')](_0x3c0c6f[_0x19cf('0x35')],qs['fields'](_0x9e6f09[_0x19cf('0x32')]['fields']));_0x215f31[_0x19cf('0x37')]=_0x215f31[_0x19cf('0x37')][_0x19cf('0x38')]?_0x215f31['attributes']:_0x3c0c6f[_0x19cf('0x35')];if(_0x9e6f09['query'][_0x19cf('0x42')]){_0x215f31['include']=[{'all':!![]}];}_0x215f31=_['merge']({},_0x215f31,_0x9e6f09['options']);return db['CmContactHasItem']['find'](_0x215f31)[_0x19cf('0x23')](handleEntityNotFound(_0x477565,null))[_0x19cf('0x23')](respondWithResult(_0x477565,null))[_0x19cf('0x45')](handleError(_0x477565,null));};exports[_0x19cf('0x48')]=function(_0x29cce7,_0x429f20){return db[_0x19cf('0x2e')][_0x19cf('0x48')](_0x29cce7[_0x19cf('0x49')],{})[_0x19cf('0x23')](function(_0x291592){var _0x481469=_0x29cce7[_0x19cf('0x4a')]['get']({'plain':!![]});if(!_0x481469)throw new Error(_0x19cf('0x4b'));if(_0x481469['role']===_0x19cf('0x4a')){var _0x5cc544=_0x291592[_0x19cf('0x25')]({'plain':!![]});var _0x37bb85=_0x19cf('0x26');return db[_0x19cf('0x4c')][_0x19cf('0x4d')]({'where':{'name':_0x37bb85,'userProfileId':_0x481469[_0x19cf('0x4e')]},'raw':!![]})['then'](function(_0xe7cfbf){if(_0xe7cfbf&&_0xe7cfbf['autoAssociation']===0x0){return db[_0x19cf('0x27')][_0x19cf('0x48')]({'name':_0x5cc544[_0x19cf('0x2a')],'resourceId':_0x5cc544['id'],'type':_0xe7cfbf['name'],'sectionId':_0xe7cfbf['id']},{})[_0x19cf('0x23')](function(){return _0x291592;});}else{return _0x291592;}})[_0x19cf('0x45')](function(_0x31414d){logger[_0x19cf('0x28')](_0x19cf('0x4f'),_0x31414d);throw _0x31414d;});}return _0x291592;})[_0x19cf('0x23')](respondWithResult(_0x429f20,0xc9))[_0x19cf('0x45')](handleError(_0x429f20,null));};exports['update']=function(_0x3134f7,_0x1925d2){if(_0x3134f7[_0x19cf('0x49')]['id']){delete _0x3134f7[_0x19cf('0x49')]['id'];}return db[_0x19cf('0x2e')][_0x19cf('0x4d')]({'where':{'id':_0x3134f7[_0x19cf('0x50')]['id']}})[_0x19cf('0x23')](handleEntityNotFound(_0x1925d2,null))[_0x19cf('0x23')](saveUpdates(_0x3134f7[_0x19cf('0x49')],null))[_0x19cf('0x23')](respondWithResult(_0x1925d2,null))[_0x19cf('0x45')](handleError(_0x1925d2,null));};exports['destroy']=function(_0x7cf1c7,_0x341f5d){return db[_0x19cf('0x2e')][_0x19cf('0x4d')]({'where':{'id':_0x7cf1c7['params']['id']}})[_0x19cf('0x23')](handleEntityNotFound(_0x341f5d,null))[_0x19cf('0x23')](removeEntity(_0x341f5d,null))[_0x19cf('0x45')](handleError(_0x341f5d,null));}; \ No newline at end of file +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 diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4ac8659..09d7834 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 _0xbd9f=['../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xbd9f,0x6d));var _0xfbd9=function(_0xfdbaf0,_0x45f455){_0xfdbaf0=_0xfdbaf0-0x0;var _0x314a46=_0xbd9f[_0xfdbaf0];return _0x314a46;};'use strict';var _=require(_0xfbd9('0x0'));var util=require('util');var logger=require(_0xfbd9('0x1'))(_0xfbd9('0x2'));var moment=require(_0xfbd9('0x3'));var BPromise=require(_0xfbd9('0x4'));var rp=require(_0xfbd9('0x5'));var fs=require('fs');var path=require(_0xfbd9('0x6'));var rimraf=require(_0xfbd9('0x7'));var config=require(_0xfbd9('0x8'));var attributes=require(_0xfbd9('0x9'));module[_0xfbd9('0xa')]=function(_0x5b7e62,_0x427eae){return _0x5b7e62[_0xfbd9('0xb')](_0xfbd9('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index cfd421c..bb12c58 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 _0x3435=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error'];(function(_0x102311,_0x47a4a1){var _0x29a818=function(_0x38bc6f){while(--_0x38bc6f){_0x102311['push'](_0x102311['shift']());}};_0x29a818(++_0x47a4a1);}(_0x3435,0x87));var _0x5343=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x3435[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var moment=require('moment');var BPromise=require(_0x5343('0x2'));var rs=require(_0x5343('0x3'));var fs=require('fs');var Redis=require(_0x5343('0x4'));var db=require(_0x5343('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5343('0x6'));var config=require(_0x5343('0x7'));var jayson=require(_0x5343('0x8'));var client=jayson[_0x5343('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e62fb,_0x40f83a,_0x1d93a6){return new BPromise(function(_0x4dd74a,_0x1d111e){return client['request'](_0x2e62fb,_0x1d93a6)[_0x5343('0xa')](function(_0x16b272){logger[_0x5343('0xb')](_0x5343('0xc'),_0x40f83a,_0x5343('0xd'));logger[_0x5343('0xe')](_0x5343('0xf'),_0x40f83a,_0x5343('0xd'),JSON['stringify'](_0x16b272));if(_0x16b272[_0x5343('0x10')]){if(_0x16b272[_0x5343('0x10')][_0x5343('0x11')]===0x1f4){logger['error'](_0x5343('0xc'),_0x40f83a,_0x16b272['error']['message']);return _0x1d111e(_0x16b272[_0x5343('0x10')]['message']);}logger[_0x5343('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x40f83a,_0x16b272['error'][_0x5343('0x12')]);return _0x4dd74a(_0x16b272['error']['message']);}else{logger[_0x5343('0xb')](_0x5343('0xc'),_0x40f83a,_0x5343('0xd'));_0x4dd74a(_0x16b272['result']['message']);}})['catch'](function(_0x4f2833){logger[_0x5343('0x10')](_0x5343('0xc'),_0x40f83a,_0x4f2833);_0x1d111e(_0x4f2833);});});} \ No newline at end of file +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 diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 87f14da..a342b71 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 _0x3ec8=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout'];(function(_0xf1b862,_0x8ba344){var _0x1c75c5=function(_0x3016c2){while(--_0x3016c2){_0xf1b862['push'](_0xf1b862['shift']());}};_0x1c75c5(++_0x8ba344);}(_0x3ec8,0x141));var _0x83ec=function(_0x35462f,_0x3b0377){_0x35462f=_0x35462f-0x0;var _0xd3950b=_0x3ec8[_0x35462f];return _0xd3950b;};'use strict';var multer=require('multer');var util=require(_0x83ec('0x0'));var path=require(_0x83ec('0x1'));var timeout=require(_0x83ec('0x2'));var express=require('express');var router=express[_0x83ec('0x3')]();var fs_extra=require(_0x83ec('0x4'));var auth=require(_0x83ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x83ec('0x6'));var controller=require('./cmContactHasItem.controller');router['get']('/',auth[_0x83ec('0x7')](),controller[_0x83ec('0x8')]);router[_0x83ec('0x9')](_0x83ec('0xa'),auth[_0x83ec('0x7')](),controller[_0x83ec('0xb')]);router[_0x83ec('0xc')]('/',auth[_0x83ec('0x7')](),controller[_0x83ec('0xd')]);router[_0x83ec('0xe')](_0x83ec('0xa'),auth[_0x83ec('0x7')](),controller[_0x83ec('0xf')]);router[_0x83ec('0x10')](_0x83ec('0xa'),auth[_0x83ec('0x7')](),controller['destroy']);module[_0x83ec('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b2c3cb3..2e5ec8f 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 _0xdad3=['alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','BOOLEAN','ENUM','sequelize','lodash','exports','getDataValue'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xdad3,0x1c7));var _0x3dad=function(_0x12960a,_0x3f250e){_0x12960a=_0x12960a-0x0;var _0xeada86=_0xdad3[_0x12960a];return _0xeada86;};'use strict';var Sequelize=require(_0x3dad('0x0'));var _=require(_0x3dad('0x1'));module[_0x3dad('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x36501e){return this[_0x3dad('0x3')](_0x3dad('0x4'));}},'alias':{'type':Sequelize[_0x3dad('0x5')],'allowNull':![],'set':function(_0x551ba3){this[_0x3dad('0x6')](_0x3dad('0x4'),_0x551ba3?_0x551ba3:this[_0x3dad('0x3')](_0x3dad('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x3dad('0x8')](_0x3dad('0x9')),'get':function(){if(this[_0x3dad('0x3')](_0x3dad('0xa'))===_0x3dad('0xb')){return JSON[_0x3dad('0xc')](this[_0x3dad('0x3')](_0x3dad('0xd')));}else{return this[_0x3dad('0x3')](_0x3dad('0xd'));}},'set':function(_0xb43242){if(Array[_0x3dad('0xe')](_0xb43242)){this[_0x3dad('0x6')](_0x3dad('0xd'),JSON['stringify'](_0xb43242));}else{this['setDataValue'](_0x3dad('0xd'),_0xb43242);}}},'required':{'type':Sequelize[_0x3dad('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3dad('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x3dad('0x10')]('voice')}}; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c28a104..083a0b5 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 _0x032e=['options','includeAll','include','findAll','rows','catch','params','find','body','create','transaction','TEXT','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','CmCustomField','fieldName','type','key','model','differenceBy','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x032e,0x6d));var _0xe032=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x032e[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe032('0x0'));var jsonpatch=require(_0xe032('0x1'));var rp=require(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var Mustache=require(_0xe032('0x5'));var util=require(_0xe032('0x6'));var path=require(_0xe032('0x7'));var sox=require('sox');var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe032('0x11'));var qs=require(_0xe032('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe032('0x13'));var logger=require(_0xe032('0x14'))('api');var utils=require(_0xe032('0x15'));var config=require(_0xe032('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4309e7,_0x28b6c9){_0x28b6c9=_0x28b6c9||0xcc;return function(_0x327cf9){if(_0x327cf9){return _0x4309e7[_0xe032('0x17')](_0x28b6c9);}return _0x4309e7[_0xe032('0x18')](_0x28b6c9)[_0xe032('0x19')]();};}function respondWithResult(_0x1b6bc1,_0x43cfb9){_0x43cfb9=_0x43cfb9||0xc8;return function(_0x35d972){if(_0x35d972){return _0x1b6bc1[_0xe032('0x18')](_0x43cfb9)['json'](_0x35d972);}};}function respondWithFilteredResult(_0x372365,_0x54c365){return function(_0x2aab41){if(_0x2aab41){var _0x3ca0dd=typeof _0x54c365[_0xe032('0x1a')]===_0xe032('0x1b')&&typeof _0x54c365['limit']===_0xe032('0x1b');var _0x5f2ea1=_0x2aab41[_0xe032('0x1c')];var _0x1c003b=_0x3ca0dd?0x0:_0x54c365[_0xe032('0x1a')];var _0x4d43eb=_0x3ca0dd?_0x2aab41[_0xe032('0x1c')]:_0x54c365[_0xe032('0x1a')]+_0x54c365[_0xe032('0x1d')];var _0x20245c;if(_0x4d43eb>=_0x5f2ea1){_0x4d43eb=_0x5f2ea1;_0x20245c=0xc8;}else{_0x20245c=0xce;}_0x372365[_0xe032('0x18')](_0x20245c);return _0x372365['set'](_0xe032('0x1e'),_0x1c003b+'-'+_0x4d43eb+'/'+_0x5f2ea1)[_0xe032('0x1f')](_0x2aab41);}return null;};}function patchUpdates(_0x5ac89b){return function(_0x42c406){try{jsonpatch[_0xe032('0x20')](_0x42c406,_0x5ac89b,!![]);}catch(_0x78f005){return BPromise[_0xe032('0x21')](_0x78f005);}return _0x42c406[_0xe032('0x22')]();};}function saveUpdates(_0x4bea27,_0x34c0d1){return function(_0xf5dac9){if(_0xf5dac9){return _0xf5dac9[_0xe032('0x23')](_0x4bea27)[_0xe032('0x24')](function(_0x4cea5a){return _0x4cea5a;});}return null;};}function removeEntity(_0x15c03a,_0x1419d9){return function(_0x1305ed){if(_0x1305ed){return _0x1305ed[_0xe032('0x25')]()[_0xe032('0x24')](function(){_0x15c03a['status'](0xcc)[_0xe032('0x19')]();});}};}function handleEntityNotFound(_0x1610ef,_0x3350fa){return function(_0x858270){if(!_0x858270){_0x1610ef[_0xe032('0x17')](0x194);}return _0x858270;};}function handleError(_0x3c4764,_0x45813c){_0x45813c=_0x45813c||0x1f4;return function(_0x1fcce7){logger['error'](_0x1fcce7[_0xe032('0x26')]);if(_0x1fcce7['name']){delete _0x1fcce7[_0xe032('0x27')];}_0x3c4764[_0xe032('0x18')](_0x45813c)[_0xe032('0x28')](_0x1fcce7);};}exports[_0xe032('0x29')]=function(_0x9504bc,_0xf61e91){var _0x399f5a={},_0x37a7b6={},_0x561396={'count':0x0,'rows':[]};var _0x23d257=_['map'](db[_0xe032('0x2a')]['rawAttributes'],function(_0x24acba){return{'name':_0x24acba[_0xe032('0x2b')],'type':_0x24acba[_0xe032('0x2c')][_0xe032('0x2d')]};});_0x37a7b6[_0xe032('0x2e')]=_[_0xe032('0x2f')](_[_0xe032('0x30')](_0x23d257,_0xe032('0x27')),[_0xe032('0x27')]);_0x37a7b6['query']=_[_0xe032('0x31')](_0x9504bc[_0xe032('0x32')]);_0x37a7b6[_0xe032('0x33')]=_[_0xe032('0x34')](_0x37a7b6[_0xe032('0x2e')],_0x37a7b6[_0xe032('0x32')]);_0x399f5a[_0xe032('0x35')]=_[_0xe032('0x34')](_0x37a7b6[_0xe032('0x2e')],qs[_0xe032('0x36')](_0x9504bc[_0xe032('0x32')][_0xe032('0x36')]));_0x399f5a[_0xe032('0x35')]=_0x399f5a[_0xe032('0x35')][_0xe032('0x37')]?_0x399f5a[_0xe032('0x35')]:_0x37a7b6['model'];if(!_0x9504bc[_0xe032('0x32')][_0xe032('0x38')](_0xe032('0x39'))){_0x399f5a[_0xe032('0x1d')]=qs[_0xe032('0x1d')](_0x9504bc[_0xe032('0x32')][_0xe032('0x1d')]);_0x399f5a[_0xe032('0x1a')]=qs[_0xe032('0x1a')](_0x9504bc[_0xe032('0x32')][_0xe032('0x1a')]);}_0x399f5a[_0xe032('0x3a')]=qs[_0xe032('0x3b')](_0x9504bc[_0xe032('0x32')][_0xe032('0x3b')]);_0x399f5a[_0xe032('0x3c')]=qs[_0xe032('0x33')](_[_0xe032('0x3d')](_0x9504bc[_0xe032('0x32')],_0x37a7b6['filters']),_0x23d257);if(_0x9504bc[_0xe032('0x32')][_0xe032('0x3e')]){_0x399f5a[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x399f5a[_0xe032('0x3c')],{'$or':_[_0xe032('0x30')](_0x23d257,function(_0xcdec57){if(_0xcdec57[_0xe032('0x2c')]!==_0xe032('0x40')){var _0x53d363={};_0x53d363[_0xcdec57['name']]={'$like':'%'+_0x9504bc[_0xe032('0x32')][_0xe032('0x3e')]+'%'};return _0x53d363;}})});}_0x399f5a=_[_0xe032('0x3f')]({},_0x399f5a,_0x9504bc[_0xe032('0x41')]);var _0x2fda0a={'where':_0x399f5a[_0xe032('0x3c')]};return db[_0xe032('0x2a')]['count'](_0x2fda0a)[_0xe032('0x24')](function(_0x4973da){_0x561396['count']=_0x4973da;if(_0x9504bc['query'][_0xe032('0x42')]){_0x399f5a[_0xe032('0x43')]=[{'all':!![]}];}return db[_0xe032('0x2a')][_0xe032('0x44')](_0x399f5a);})[_0xe032('0x24')](function(_0x430625){_0x561396[_0xe032('0x45')]=_0x430625;return _0x561396;})['then'](respondWithFilteredResult(_0xf61e91,_0x399f5a))[_0xe032('0x46')](handleError(_0xf61e91,null));};exports['show']=function(_0xd4e3a7,_0x596cc1){var _0x1eaea7={'raw':!![],'where':{'id':_0xd4e3a7[_0xe032('0x47')]['id']}},_0x277988={};_0x277988[_0xe032('0x2e')]=_[_0xe032('0x31')](db[_0xe032('0x2a')]['rawAttributes']);_0x277988[_0xe032('0x32')]=_[_0xe032('0x31')](_0xd4e3a7['query']);_0x277988['filters']=_[_0xe032('0x34')](_0x277988[_0xe032('0x2e')],_0x277988[_0xe032('0x32')]);_0x1eaea7[_0xe032('0x35')]=_[_0xe032('0x34')](_0x277988['model'],qs[_0xe032('0x36')](_0xd4e3a7[_0xe032('0x32')]['fields']));_0x1eaea7[_0xe032('0x35')]=_0x1eaea7[_0xe032('0x35')][_0xe032('0x37')]?_0x1eaea7[_0xe032('0x35')]:_0x277988[_0xe032('0x2e')];if(_0xd4e3a7[_0xe032('0x32')][_0xe032('0x42')]){_0x1eaea7['include']=[{'all':!![]}];}_0x1eaea7=_[_0xe032('0x3f')]({},_0x1eaea7,_0xd4e3a7['options']);return db[_0xe032('0x2a')][_0xe032('0x48')](_0x1eaea7)[_0xe032('0x24')](handleEntityNotFound(_0x596cc1,null))[_0xe032('0x24')](respondWithResult(_0x596cc1,null))[_0xe032('0x46')](handleError(_0x596cc1,null));};exports[_0xe032('0x23')]=function(_0x2a7a93,_0x4827b9){if(_0x2a7a93[_0xe032('0x49')]['id']){delete _0x2a7a93[_0xe032('0x49')]['id'];}return db[_0xe032('0x2a')][_0xe032('0x48')]({'where':{'id':_0x2a7a93[_0xe032('0x47')]['id']}})[_0xe032('0x24')](handleEntityNotFound(_0x4827b9,null))[_0xe032('0x24')](saveUpdates(_0x2a7a93['body'],null))[_0xe032('0x24')](respondWithResult(_0x4827b9,null))[_0xe032('0x46')](handleError(_0x4827b9,null));};exports['destroy']=function(_0x60897d,_0x31f9ca){return db['CmCustomField'][_0xe032('0x48')]({'where':{'id':_0x60897d[_0xe032('0x47')]['id']}})[_0xe032('0x24')](handleEntityNotFound(_0x31f9ca,null))[_0xe032('0x24')](removeEntity(_0x31f9ca,null))[_0xe032('0x46')](handleError(_0x31f9ca,null));};exports[_0xe032('0x4a')]=function(_0xe4f78d,_0x1f705e){var _0x4b22e4;return db['sequelize'][_0xe032('0x4b')](function(_0x504bad){return db['CmCustomField'][_0xe032('0x4a')](_0xe4f78d['body'],{'transaction':_0x504bad})[_0xe032('0x24')](function(_0x36ab98){_0x4b22e4=_0x36ab98;var _0x44f170={'type':db['Sequelize'][_0xe032('0x4c')],'transaction':_0x504bad};switch(_0xe4f78d[_0xe032('0x49')]['type']){case'text':_0x44f170[_0xe032('0x2c')]=db[_0xe032('0x4d')]['TEXT'];break;case _0xe032('0x4e'):_0x44f170[_0xe032('0x2c')]=db[_0xe032('0x4d')][_0xe032('0x4f')];break;case'switch':_0x44f170[_0xe032('0x2c')]=db[_0xe032('0x4d')][_0xe032('0x50')];_0x44f170[_0xe032('0x51')]=![];break;default:}return db['sequelize'][_0xe032('0x52')][_0xe032('0x53')](_0xe032('0x54'),util[_0xe032('0x55')](_0xe032('0x56'),_0x4b22e4['id']),_0x44f170);})[_0xe032('0x24')](function(){return _0x4b22e4;});})['then'](respondWithResult(_0x1f705e,0xc9))[_0xe032('0x46')](handleError(_0x1f705e,null));}; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index db55030..6e62885 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 _0xd5aa=['cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','rimraf','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xd5aa,0x1ed));var _0xad5a=function(_0x12197f,_0x58134e){_0x12197f=_0x12197f-0x0;var _0x1d5895=_0xd5aa[_0x12197f];return _0x1d5895;};'use strict';var _=require(_0xad5a('0x0'));var util=require(_0xad5a('0x1'));var logger=require('../../config/logger')(_0xad5a('0x2'));var moment=require(_0xad5a('0x3'));var BPromise=require(_0xad5a('0x4'));var rp=require(_0xad5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad5a('0x6'));var config=require('../../config/environment');var attributes=require(_0xad5a('0x7'));module[_0xad5a('0x8')]=function(_0x59ad36,_0x1713b8){return _0x59ad36[_0xad5a('0x9')](_0xad5a('0xa'),attributes,{'tableName':_0xad5a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 692f8b4..fd87e0d 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 _0xdca3=['request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x2137a0,_0x3fc562){var _0x17b245=function(_0x29d8eb){while(--_0x29d8eb){_0x2137a0['push'](_0x2137a0['shift']());}};_0x17b245(++_0x3fc562);}(_0xdca3,0xa2));var _0x3dca=function(_0x4dfa57,_0x5a00c6){_0x4dfa57=_0x4dfa57-0x0;var _0xd510=_0xdca3[_0x4dfa57];return _0xd510;};'use strict';var _=require(_0x3dca('0x0'));var util=require(_0x3dca('0x1'));var moment=require(_0x3dca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dca('0x3'));var db=require(_0x3dca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dca('0x5'))('rpc');var config=require(_0x3dca('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3dca('0x7')][_0x3dca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5adf33,_0x2c3b64,_0x37ccba){return new BPromise(function(_0x5ae8c2,_0x53aa05){return client[_0x3dca('0x9')](_0x5adf33,_0x37ccba)['then'](function(_0x4aa4ef){logger[_0x3dca('0xa')](_0x3dca('0xb'),_0x2c3b64,_0x3dca('0xc'));logger[_0x3dca('0xd')](_0x3dca('0xe'),_0x2c3b64,_0x3dca('0xc'),JSON['stringify'](_0x4aa4ef));if(_0x4aa4ef['error']){if(_0x4aa4ef[_0x3dca('0xf')][_0x3dca('0x10')]===0x1f4){logger['error'](_0x3dca('0xb'),_0x2c3b64,_0x4aa4ef['error'][_0x3dca('0x11')]);return _0x53aa05(_0x4aa4ef[_0x3dca('0xf')][_0x3dca('0x11')]);}logger[_0x3dca('0xf')](_0x3dca('0xb'),_0x2c3b64,_0x4aa4ef[_0x3dca('0xf')][_0x3dca('0x11')]);return _0x5ae8c2(_0x4aa4ef[_0x3dca('0xf')][_0x3dca('0x11')]);}else{logger[_0x3dca('0xa')](_0x3dca('0xb'),_0x2c3b64,_0x3dca('0xc'));_0x5ae8c2(_0x4aa4ef[_0x3dca('0x12')][_0x3dca('0x11')]);}})['catch'](function(_0x33d2c5){logger[_0x3dca('0xf')](_0x3dca('0xb'),_0x2c3b64,_0x33d2c5);_0x53aa05(_0x33d2c5);});});} \ No newline at end of file +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 diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d4e88cf..a49c5a1 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 _0x1298=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1dd037,_0x5109d8){var _0x4cbc85=function(_0xe47e9c){while(--_0xe47e9c){_0x1dd037['push'](_0x1dd037['shift']());}};_0x4cbc85(++_0x5109d8);}(_0x1298,0x19e));var _0x8129=function(_0x23cb78,_0x183a3a){_0x23cb78=_0x23cb78-0x0;var _0x5ae7d8=_0x1298[_0x23cb78];return _0x5ae7d8;};'use strict';var multer=require('multer');var util=require(_0x8129('0x0'));var path=require('path');var timeout=require(_0x8129('0x1'));var express=require(_0x8129('0x2'));var router=express[_0x8129('0x3')]();var fs_extra=require(_0x8129('0x4'));var auth=require(_0x8129('0x5'));var interaction=require(_0x8129('0x6'));var config=require(_0x8129('0x7'));var controller=require('./cmCustomField.controller');router[_0x8129('0x8')]('/',auth[_0x8129('0x9')](),controller['index']);router['get'](_0x8129('0xa'),auth[_0x8129('0x9')](),controller[_0x8129('0xb')]);router[_0x8129('0xc')]('/',auth[_0x8129('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8129('0xd')]);router[_0x8129('0xe')]('/:id',auth[_0x8129('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5c17883..c87e358 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 _0x3f4b=['INTEGER','STRING','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46342d,_0x31f835){var _0x4470a8=function(_0x466066){while(--_0x466066){_0x46342d['push'](_0x46342d['shift']());}};_0x4470a8(++_0x31f835);}(_0x3f4b,0x67));var _0xb3f4=function(_0x3d2c4a,_0x1a50e8){_0x3d2c4a=_0x3d2c4a-0x0;var _0x5a4dec=_0x3f4b[_0x3d2c4a];return _0x5a4dec;};'use strict';var moment=require(_0xb3f4('0x0'));var Sequelize=require(_0xb3f4('0x1'));module[_0xb3f4('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xb3f4('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb3f4('0x4')],'defaultValue':moment()[_0xb3f4('0x5')](_0xb3f4('0x6'))},'countbusyretry':{'type':Sequelize[_0xb3f4('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb3f4('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb3f4('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb3f4('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb3f4('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb3f4('0x4')]},'priority':{'type':Sequelize[_0xb3f4('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb3f4('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb3f4('0x9')},'ListId':{'type':Sequelize[_0xb3f4('0x7')],'unique':_0xb3f4('0x9')},'UserId':{'type':Sequelize[_0xb3f4('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xb3f4('0x7')],'unique':_0xb3f4('0x9')},'CampaignId':{'type':Sequelize[_0xb3f4('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb3f4('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb3f4('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb3f4('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb3f4('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb3f4('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb3f4('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 3693aec..a03ba8a 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 _0x0bde=['moment','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','index','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lte','$eq','$between','$notBetween','$in','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','map','value','direction','prev','isEmpty','hopperIds','ASC','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','findOne','LOCK','CmCompany','CmList','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x0bde,0x110));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xe0bd('0x0'));var _=require('lodash');var qs=require(_0xe0bd('0x1'));var logger=require(_0xe0bd('0x2'))('api');var shared=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];function respondWithResult(_0x2294a7,_0x595deb){_0x595deb=_0x595deb||0xc8;return function(_0x95dfde){if(_0x95dfde){return _0x2294a7[_0xe0bd('0x5')](_0x595deb)[_0xe0bd('0x6')](_0x95dfde);}};}function respondWithFilteredResult(_0x3a3cd2,_0x37289f){return function(_0x1c8892){if(_0x1c8892){var _0x29faee=typeof _0x37289f[_0xe0bd('0x7')]===_0xe0bd('0x8')&&typeof _0x37289f[_0xe0bd('0x9')]===_0xe0bd('0x8');var _0x3c2ee1=_0x1c8892[_0xe0bd('0xa')];var _0x589149=_0x29faee?0x0:_0x37289f[_0xe0bd('0x7')];var _0x235122=_0x29faee?_0x1c8892['count']:_0x37289f[_0xe0bd('0x7')]+_0x37289f['limit'];var _0x175f8a;if(_0x235122>=_0x3c2ee1){_0x235122=_0x3c2ee1;_0x175f8a=0xc8;}else{_0x175f8a=0xce;}_0x3a3cd2[_0xe0bd('0x5')](_0x175f8a);return _0x3a3cd2[_0xe0bd('0xb')](_0xe0bd('0xc'),_0x589149+'-'+_0x235122+'/'+_0x3c2ee1)[_0xe0bd('0x6')](_0x1c8892);}return null;};}function saveUpdates(_0x16c3a9,_0x1905b2){return function(_0x500a9e){if(_0x500a9e){return _0x500a9e[_0xe0bd('0xd')](_0x16c3a9)[_0xe0bd('0xe')](function(_0x3dfc72){return _0x3dfc72;});}return null;};}function handleEntityNotFound(_0x5c76f1,_0x479438){return function(_0x48afde){if(!_0x48afde){_0x5c76f1[_0xe0bd('0xf')](0x194);}return _0x48afde;};}function handleError(_0x234c34,_0x3f5ef7){_0x3f5ef7=_0x3f5ef7||0x1f4;return function(_0x3042e1){logger[_0xe0bd('0x10')](_0x3042e1[_0xe0bd('0x11')]);if(_0x3042e1[_0xe0bd('0x12')]){delete _0x3042e1[_0xe0bd('0x12')];}_0x234c34['status'](_0x3f5ef7)['send'](_0x3042e1);};}exports[_0xe0bd('0x13')]=function(_0xd8746d,_0x1c4533){var _0x100b8f={},_0xa6be32={},_0x2a015c={'count':0x0,'rows':[]};var _0x5b23de=_['map'](db[_0xe0bd('0x14')][_0xe0bd('0x15')],function(_0x1187cf){return{'name':_0x1187cf[_0xe0bd('0x16')],'type':_0x1187cf[_0xe0bd('0x17')][_0xe0bd('0x18')]};});_0xa6be32[_0xe0bd('0x19')]=_['map'](_0x5b23de,'name');_0xa6be32[_0xe0bd('0x1a')]=_[_0xe0bd('0x1b')](_0xd8746d[_0xe0bd('0x1a')]);_0xa6be32[_0xe0bd('0x1c')]=_[_0xe0bd('0x1d')](_0xa6be32['model'],_0xa6be32[_0xe0bd('0x1a')]);_0xa6be32['filters']=_[_0xe0bd('0x1e')](_0xa6be32[_0xe0bd('0x1c')],[_0xe0bd('0x1f'),'$or',_0xe0bd('0x20'),_0xe0bd('0x21'),'$lt',_0xe0bd('0x22'),'$ne',_0xe0bd('0x23'),'$not',_0xe0bd('0x24'),_0xe0bd('0x25'),_0xe0bd('0x26'),'$notIn',_0xe0bd('0x27'),'$notLike',_0xe0bd('0x28'),_0xe0bd('0x29'),'$like','$overlap',_0xe0bd('0x2a'),_0xe0bd('0x2b'),_0xe0bd('0x2c')]);_0x100b8f[_0xe0bd('0x2d')]=_[_0xe0bd('0x1d')](_0xa6be32[_0xe0bd('0x19')],qs[_0xe0bd('0x2e')](_0xd8746d['query'][_0xe0bd('0x2e')]));_0x100b8f[_0xe0bd('0x2d')]=_0x100b8f[_0xe0bd('0x2d')][_0xe0bd('0x2f')]?_0x100b8f[_0xe0bd('0x2d')]:_0xa6be32[_0xe0bd('0x19')];if(!_0xd8746d['query'][_0xe0bd('0x30')](_0xe0bd('0x31'))){_0x100b8f[_0xe0bd('0x9')]=qs[_0xe0bd('0x9')](_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x9')]);_0x100b8f[_0xe0bd('0x7')]=qs[_0xe0bd('0x7')](_0xd8746d['query']['offset']);}_0x100b8f[_0xe0bd('0x32')]=qs[_0xe0bd('0x33')](_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x33')]);_0x100b8f[_0xe0bd('0x34')]=qs['filters'](_['pick'](_0xd8746d['query'],_0xa6be32[_0xe0bd('0x1c')]),_0x5b23de);if(_0xd8746d[_0xe0bd('0x1a')][_0xe0bd('0x35')]){_0x100b8f[_0xe0bd('0x34')]=_[_0xe0bd('0x36')](_0x100b8f[_0xe0bd('0x34')],{'$or':_['map'](_0x5b23de,function(_0x1304d2){if(_0x1304d2[_0xe0bd('0x17')]!==_0xe0bd('0x37')){var _0x4e9272={};_0x4e9272[_0x1304d2[_0xe0bd('0x12')]]={'$like':'%'+_0xd8746d[_0xe0bd('0x1a')]['filter']+'%'};return _0x4e9272;}})});}_0x100b8f=_[_0xe0bd('0x36')]({},_0x100b8f,_0xd8746d[_0xe0bd('0x38')]);var _0x406b41={'where':_0x100b8f['where']};return db[_0xe0bd('0x14')]['count'](_0x406b41)[_0xe0bd('0xe')](function(_0x37a8b9){_0x2a015c[_0xe0bd('0xa')]=_0x37a8b9;if(_0xd8746d[_0xe0bd('0x1a')]['includeAll']){_0x100b8f[_0xe0bd('0x39')]=[{'all':!![]}];}return db[_0xe0bd('0x14')][_0xe0bd('0x3a')](_0x100b8f);})['then'](function(_0x54170b){_0x2a015c[_0xe0bd('0x3b')]=_0x54170b;return _0x2a015c;})[_0xe0bd('0xe')](respondWithFilteredResult(_0x1c4533,_0x100b8f))[_0xe0bd('0x3c')](handleError(_0x1c4533,null));};exports['show']=function(_0x5cc98d,_0x42a725){var _0x383b08={'raw':!![],'where':{'id':_0x5cc98d[_0xe0bd('0x3d')]['id']}},_0x324bb2={};_0x324bb2['model']=_[_0xe0bd('0x1b')](db[_0xe0bd('0x14')][_0xe0bd('0x15')]);_0x324bb2['query']=_['keys'](_0x5cc98d[_0xe0bd('0x1a')]);_0x324bb2[_0xe0bd('0x1c')]=_[_0xe0bd('0x1d')](_0x324bb2[_0xe0bd('0x19')],_0x324bb2['query']);_0x383b08[_0xe0bd('0x2d')]=_[_0xe0bd('0x1d')](_0x324bb2[_0xe0bd('0x19')],qs['fields'](_0x5cc98d['query'][_0xe0bd('0x2e')]));_0x383b08['attributes']=_0x383b08[_0xe0bd('0x2d')][_0xe0bd('0x2f')]?_0x383b08['attributes']:_0x324bb2[_0xe0bd('0x19')];if(_0x5cc98d[_0xe0bd('0x1a')][_0xe0bd('0x3e')]){_0x383b08['include']=[{'all':!![]}];}_0x383b08=_[_0xe0bd('0x36')]({},_0x383b08,_0x5cc98d[_0xe0bd('0x38')]);return db[_0xe0bd('0x14')][_0xe0bd('0x3f')](_0x383b08)[_0xe0bd('0xe')](handleEntityNotFound(_0x42a725,null))[_0xe0bd('0xe')](respondWithResult(_0x42a725,null))[_0xe0bd('0x3c')](handleError(_0x42a725,null));};exports[_0xe0bd('0x40')]=function(_0x5a02f9,_0x9505be){return db[_0xe0bd('0x14')][_0xe0bd('0x40')](_0x5a02f9[_0xe0bd('0x41')],{})[_0xe0bd('0xe')](respondWithResult(_0x9505be,0xc9))[_0xe0bd('0x3c')](handleError(_0x9505be,null));};exports[_0xe0bd('0xd')]=function(_0x5399b3,_0x59d38a){if(_0x5399b3[_0xe0bd('0x41')]['id']){delete _0x5399b3[_0xe0bd('0x41')]['id'];}return db[_0xe0bd('0x14')][_0xe0bd('0x3f')]({'where':{'id':_0x5399b3[_0xe0bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59d38a,null))[_0xe0bd('0xe')](saveUpdates(_0x5399b3['body'],null))['then'](respondWithResult(_0x59d38a,null))['catch'](handleError(_0x59d38a,null));};exports[_0xe0bd('0x42')]=function(_0x55dd83,_0x545cfb){return db[_0xe0bd('0x14')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](respondWithResult(_0x545cfb,null))[_0xe0bd('0x3c')](handleError(_0x545cfb,null));};exports[_0xe0bd('0x43')]=function(_0x220147,_0xe2b989){var _0x1c4464;var _0x137bed=_0x220147[_0xe0bd('0x3d')]['id'];return db['CmHopper'][_0xe0bd('0x3f')]({'where':{'id':_0x220147['params']['id']}})['then'](handleEntityNotFound(_0xe2b989,null))[_0xe0bd('0xe')](function(_0x292296){if(_0x292296){return _0x292296[_0xe0bd('0x43')]()['then'](function(_0x281a60){return _0x281a60;});}})[_0xe0bd('0xe')](function(_0x2ace8e){_0x1c4464=_0x2ace8e;if(_0x2ace8e){if(_0x2ace8e[_0xe0bd('0x44')]||_0x2ace8e[_0xe0bd('0x45')]){return db[_0x2ace8e[_0xe0bd('0x44')]?_0xe0bd('0x46'):_0xe0bd('0x47')][_0xe0bd('0x3f')]({'where':{'id':_0x2ace8e[_0xe0bd('0x44')]?_0x2ace8e[_0xe0bd('0x44')]:_0x2ace8e[_0xe0bd('0x45')]},'attributes':['id','name'],'raw':!![]});}}})[_0xe0bd('0xe')](function(_0xa761ae){var _0x530338={};if(_0xa761ae){_['merge'](_0x530338,_['omit'](_0x1c4464[_0xe0bd('0x48')],['createdAt','updatedAt','id']));_0x530338['state']=0x15;_0x530338[_0xe0bd('0x49')]=_0xe0bd('0x4a');_0x530338[_0xe0bd('0x4b')]=_0xa761ae[_0xe0bd('0x12')];_0x530338['membername']=_0x220147[_0xe0bd('0x4c')]['name'];_0x530338[_0xe0bd('0x4d')]=_0x220147[_0xe0bd('0x4c')]['id'];_0x530338[_0xe0bd('0x4a')]=!![];_0x530338[_0xe0bd('0x4e')]=moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'));_0x530338[_0xe0bd('0x51')]=_0x1c4464[_0xe0bd('0x52')];_0x530338[_0xe0bd('0x53')]=_0x1c4464[_0xe0bd('0x44')]?_0xe0bd('0x54'):_0xe0bd('0x55');return db[_0xe0bd('0x56')]['find']({'where':{'id':_0x530338[_0xe0bd('0x57')]},'attributes':['firstName',_0xe0bd('0x58')]})[_0xe0bd('0xe')](function(_0x302bae){if(!_[_0xe0bd('0x59')](_0xe2b989)&&!_[_0xe0bd('0x59')](_0x302bae[_0xe0bd('0x5a')])){_0x530338[_0xe0bd('0x5b')]=_0x302bae[_0xe0bd('0x5a')];if(!_[_0xe0bd('0x59')](_0x302bae['lastName'])){_0x530338['calleridname']+='\x20'+_0x302bae['lastName'];}}})[_0xe0bd('0x5c')](function(){return db[_0xe0bd('0x5d')][_0xe0bd('0x40')](_0x530338);});}})[_0xe0bd('0xe')](function(_0x3c12a2){return db[_0xe0bd('0x5e')][_0xe0bd('0x43')]({'where':{'CmHopperId':_0x137bed}});})[_0xe0bd('0xe')](function(){return _0xe2b989[_0xe0bd('0x5')](0xcc)['end']();})[_0xe0bd('0x3c')](handleError(_0xe2b989,null));};exports['getPreview']=function(_0x5f0226,_0x36fb12){var _0x38dfae=[];return db[_0xe0bd('0x56')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](function(_0x36f315){_0x38dfae=_[_0xe0bd('0x1b')](_0x36f315);return _0x5f0226['user'][_0xe0bd('0x5f')]({'where':{'type':_0xe0bd('0x60'),'dialActive':!![],'dialMethod':_0xe0bd('0x61')},'attributes':['id','dialOrderByScheduledAt',_0xe0bd('0x62')],'raw':!![]});})[_0xe0bd('0xe')](function(_0x593e24){if(_0x593e24&&_0x593e24[_0xe0bd('0x2f')]){return db[_0xe0bd('0x63')][_0xe0bd('0x64')](function(_0x26d6fc){var _0x5a43e0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x65')](_0x593e24,'id')},'$or':[{'UserId':null},{'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']}]};var _0x20a619={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x593e24)[_0xe0bd('0x35')]([_0xe0bd('0x62'),0x0])[_0xe0bd('0x65')]('id')[_0xe0bd('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']}]};var _0x2ddfd4={'$or':[_0x5a43e0,_0x20a619]};var _0xcd835d=[];if(_0x5f0226['body'][_0xe0bd('0x67')]&&_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x67')]===_0xe0bd('0x68')){if(!_[_0xe0bd('0x69')](_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x6a')])){_0x2ddfd4['id']={'$in':_0x5f0226['body'][_0xe0bd('0x6a')]};}_0xcd835d=[['priority',_0xe0bd('0x6b')],['scheduledAt',_0x593e24[0x0][_0xe0bd('0x6c')]===_0xe0bd('0x6b')?_0xe0bd('0x6d'):_0xe0bd('0x6b')],db[_0xe0bd('0x63')][_0xe0bd('0x6e')](_0xe0bd('0x6f')),['id',_0xe0bd('0x6d')]];}else{if(!_[_0xe0bd('0x69')](_0x5f0226[_0xe0bd('0x41')]['hopperIds'])){_0x2ddfd4['id']={'$notIn':_0x5f0226[_0xe0bd('0x41')][_0xe0bd('0x6a')]};}_0xcd835d=[[_0xe0bd('0x70'),_0xe0bd('0x6d')],[_0xe0bd('0x71'),_0x593e24[0x0][_0xe0bd('0x6c')]],db[_0xe0bd('0x63')][_0xe0bd('0x6e')](_0xe0bd('0x72')),['id',_0xe0bd('0x6b')]];}return db[_0xe0bd('0x14')]['findOne']({'attributes':['id',_0xe0bd('0x73'),_0xe0bd('0x52'),_0xe0bd('0x74')],'where':_0x2ddfd4,'order':_0xcd835d,'transaction':_0x26d6fc,'lock':_0x26d6fc['LOCK'][_0xe0bd('0x75')],'include':[{'model':db[_0xe0bd('0x56')],'as':_0xe0bd('0x76'),'attributes':_0x38dfae,'include':[{'model':db['CmCompany'],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x12')]}]},{'model':db['CmList'],'as':_0xe0bd('0x78'),'attributes':['id',_0xe0bd('0x12')]},{'model':db[_0xe0bd('0x46')],'as':_0xe0bd('0x79'),'attributes':['id','name','dialActive']}]})[_0xe0bd('0xe')](function(_0x4f2941){if(_0x4f2941){return _0x4f2941[_0xe0bd('0xd')]({'UserId':_0x5f0226[_0xe0bd('0x4c')]['id']},{'transaction':_0x26d6fc});}});});}})[_0xe0bd('0xe')](handleEntityNotFound(_0x36fb12,null))[_0xe0bd('0xe')](respondWithResult(_0x36fb12,null))[_0xe0bd('0x3c')](handleError(_0x36fb12,null));};exports[_0xe0bd('0x7a')]=function(_0xcd7424,_0x4b0bd7,_0xa3b019){var _0x1b982d=[];var _0x379195=_0xcd7424['params']['id'];var _0x5be09e=_0xcd7424['user']['id'];return db[_0xe0bd('0x56')][_0xe0bd('0x42')]()[_0xe0bd('0xe')](function(_0x12dd0c){_0x1b982d=_[_0xe0bd('0x1b')](_0x12dd0c);return db[_0xe0bd('0x63')]['transaction'](function(_0x7bd607){const _0x47a2d8={'id':_0x379195};return db['CmHopper'][_0xe0bd('0x7b')]({'attributes':['id',_0xe0bd('0x73'),_0xe0bd('0x74')],'where':_0x47a2d8,'transaction':_0x7bd607,'lock':_0x7bd607[_0xe0bd('0x7c')][_0xe0bd('0x75')],'include':[{'model':db[_0xe0bd('0x56')],'as':_0xe0bd('0x76'),'attributes':_0x1b982d,'include':[{'model':db[_0xe0bd('0x7d')],'as':_0xe0bd('0x77'),'attributes':['id',_0xe0bd('0x12')]}]},{'model':db[_0xe0bd('0x7e')],'as':'List','attributes':['id',_0xe0bd('0x12')]},{'model':db[_0xe0bd('0x46')],'as':'Queue','attributes':['id',_0xe0bd('0x12'),_0xe0bd('0x7f')]}]})['then'](function(_0x536021){if(_0x536021){return _0x536021[_0xe0bd('0xd')]({'UserId':_0x5be09e},{'transaction':_0x7bd607});}});});})[_0xe0bd('0xe')](handleEntityNotFound(_0x4b0bd7,null))[_0xe0bd('0xe')](respondWithResult(_0x4b0bd7,null))['catch'](handleError(_0x4b0bd7,null));};exports['getOpenContacts']=function(_0x4e2b01,_0x4b8928){return _0x4e2b01[_0xe0bd('0x4c')]['getVoiceQueues']({'where':{'type':_0xe0bd('0x60'),'dialActive':!![],'dialMethod':_0xe0bd('0x61')},'attributes':['id'],'raw':!![]})['then'](function(_0x3a8d82){if(_0x3a8d82&&_0x3a8d82[_0xe0bd('0x2f')]){return db[_0xe0bd('0x14')][_0xe0bd('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe0bd('0x4f')](_0xe0bd('0x50'))},'VoiceQueueId':{'$in':_[_0xe0bd('0x65')](_0x3a8d82,'id')},'$or':[{'UserId':null},{'UserId':_0x4e2b01[_0xe0bd('0x4c')]['id']}]}});}return 0x0;})[_0xe0bd('0xe')](function(_0xa1342d){if(!_['isNil'](_0xa1342d)&&_[_0xe0bd('0x80')](_0xa1342d)){return _0x4b8928[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'contacts':_0xa1342d});}else{logger['error'](_0xe0bd('0x81'),_0xe0bd('0x82'),0x194,_0xe0bd('0x83'));_0x4b8928['sendStatus'](0x194);}})[_0xe0bd('0x3c')](handleError(_0x4b8928,null));};exports[_0xe0bd('0x84')]=function(_0x4d611a,_0x458846){var _0xe90d7e=shared[_0xe0bd('0x85')];var _0xbec78a=[];_[_0xe0bd('0x65')](_0xe90d7e,function(_0x9ce5a8){_0xbec78a['push']({'id':_0x9ce5a8[_0xe0bd('0x12')],'name':_0x9ce5a8[_0xe0bd('0x12')],'utcOffset':_0x9ce5a8[_0xe0bd('0x86')]});});return _0x458846[_0xe0bd('0x5')](0xc8)[_0xe0bd('0x6')]({'tz':_0xbec78a});};exports[_0xe0bd('0x87')]=function(_0x51b263,_0x4394c7){var _0x59e087=shared[_0xe0bd('0x85')];var _0x43fea2={};if(!_['isNil'](_0x59e087[_0x51b263[_0xe0bd('0x41')]['id']]))_0x43fea2=_0x59e087[_0x51b263[_0xe0bd('0x41')]['id']];return _0x4394c7[_0xe0bd('0x5')](0xc8)['json'](_0x43fea2);}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a05fb19..a82d7ef 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 _0x5d17=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x3242c7,_0x26c519){var _0x15d289=function(_0x12438f){while(--_0x12438f){_0x3242c7['push'](_0x3242c7['shift']());}};_0x15d289(++_0x26c519);}(_0x5d17,0x114));var _0x75d1=function(_0x2badac,_0x4b93fa){_0x2badac=_0x2badac-0x0;var _0x28276c=_0x5d17[_0x2badac];return _0x28276c;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]},{'name':_0x75d1('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x75d1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ce37e8a..85c3423 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 _0x505d=['dataValues','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','dialTimezone','DESC','getContactByPhone','transaction','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','info','debug','stringify','catch','error','message','find','ShowCmHopper','CreateCmHopper','create','body','update','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','UserId','push','includes','all','length'];(function(_0x4c7b44,_0x2b9a5b){var _0x4ebaee=function(_0x2d9ce8){while(--_0x2d9ce8){_0x4c7b44['push'](_0x4c7b44['shift']());}};_0x4ebaee(++_0x2b9a5b);}(_0x505d,0xb9));var _0xd505=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x505d[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0xd505('0x0'));var util=require(_0xd505('0x1'));var moment=require('moment');var BPromise=require(_0xd505('0x2'));var db=require(_0xd505('0x3'))['db'];var logger=require(_0xd505('0x4'))(_0xd505('0x5'));exports[_0xd505('0x6')]=function(_0x20880b){var _0x299d3e=this;return new Promise(function(_0x2ce572,_0x3f94e9){return db[_0xd505('0x7')][_0xd505('0x8')]({'raw':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x20880b[_0xd505('0x9')]?_0x20880b['options'][_0xd505('0xb')]||null:null,'attributes':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':_0x20880b['options']?_0x20880b[_0xd505('0x9')][_0xd505('0xd')]||null:null,'include':_0x20880b[_0xd505('0x9')]?_0x20880b[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0x20880b['options'][_0xd505('0xf')],function(_0x1c6751){return{'model':db[_0x1c6751[_0xd505('0x10')]],'as':_0x1c6751['as'],'attributes':_0x1c6751['attributes'],'include':_0x1c6751[_0xd505('0xf')]?_['map'](_0x1c6751[_0xd505('0xf')],function(_0x1dd011){return{'model':db[_0x1dd011[_0xd505('0x10')]],'as':_0x1dd011['as'],'attributes':_0x1dd011[_0xd505('0xc')],'include':_0x1dd011['include']?_[_0xd505('0xe')](_0x1dd011['include'],function(_0x32c6f7){return{'model':db[_0x32c6f7[_0xd505('0x10')]],'as':_0x32c6f7['as'],'attributes':_0x32c6f7[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x5d3aa2){logger[_0xd505('0x12')](_0xd505('0x6'),_0x20880b);logger[_0xd505('0x13')]('GetCmHopper',_0x20880b,JSON[_0xd505('0x14')](_0x5d3aa2));_0x2ce572(_0x5d3aa2);})[_0xd505('0x15')](function(_0x1b558a){logger[_0xd505('0x16')](_0xd505('0x6'),_0x1b558a['message'],_0x20880b);_0x3f94e9(_0x299d3e[_0xd505('0x16')](0x1f4,_0x1b558a[_0xd505('0x17')]));});});};exports['ShowCmHopper']=function(_0x31b03f){var _0x3f6da0=this;return new Promise(function(_0x5285ac,_0x214c44){return db[_0xd505('0x7')][_0xd505('0x18')]({'raw':_0x31b03f[_0xd505('0x9')]?_0x31b03f['options'][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x31b03f[_0xd505('0x9')]?_0x31b03f[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':_0x31b03f['options']?_0x31b03f[_0xd505('0x9')][_0xd505('0xc')]||null:null,'include':_0x31b03f[_0xd505('0x9')]?_0x31b03f[_0xd505('0x9')][_0xd505('0xf')]?_['map'](_0x31b03f['options'][_0xd505('0xf')],function(_0x485166){return{'model':db[_0x485166[_0xd505('0x10')]],'as':_0x485166['as'],'attributes':_0x485166[_0xd505('0xc')],'include':_0x485166[_0xd505('0xf')]?_[_0xd505('0xe')](_0x485166[_0xd505('0xf')],function(_0x983885){return{'model':db[_0x983885['model']],'as':_0x983885['as'],'attributes':_0x983885[_0xd505('0xc')],'include':_0x983885[_0xd505('0xf')]?_[_0xd505('0xe')](_0x983885[_0xd505('0xf')],function(_0x57038a){return{'model':db[_0x57038a['model']],'as':_0x57038a['as'],'attributes':_0x57038a[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x55ad93){logger['info'](_0xd505('0x19'),_0x31b03f);logger[_0xd505('0x13')](_0xd505('0x19'),_0x31b03f,JSON['stringify'](_0x55ad93));_0x5285ac(_0x55ad93);})[_0xd505('0x15')](function(_0x2809d7){logger['error']('ShowCmHopper',_0x2809d7[_0xd505('0x17')],_0x31b03f);_0x214c44(_0x3f6da0[_0xd505('0x16')](0x1f4,_0x2809d7[_0xd505('0x17')]));});});};exports[_0xd505('0x1a')]=function(_0x487625){var _0x49a677=this;return new Promise(function(_0x5ec4a1,_0x1682ec){return db[_0xd505('0x7')][_0xd505('0x1b')](_0x487625[_0xd505('0x1c')],{'raw':_0x487625[_0xd505('0x9')]?_0x487625[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![]})[_0xd505('0x11')](function(_0x1a93c7){logger['info']('CreateCmHopper',_0x487625);logger[_0xd505('0x13')](_0xd505('0x1a'),_0x487625,JSON['stringify'](_0x1a93c7));_0x5ec4a1(_0x1a93c7);})[_0xd505('0x15')](function(_0x5e341a){logger[_0xd505('0x16')]('CreateCmHopper',_0x5e341a[_0xd505('0x17')],_0x487625);_0x1682ec(_0x49a677[_0xd505('0x16')](0x1f4,_0x5e341a['message']));});});};exports['UpdateCmHopper']=function(_0x223246){var _0x21d4c9=this;return new Promise(function(_0xb0127e,_0x3cc8db){return db[_0xd505('0x7')][_0xd505('0x1d')](_0x223246[_0xd505('0x1c')],{'raw':_0x223246['options']?_0x223246[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x223246[_0xd505('0x9')]?_0x223246[_0xd505('0x9')]['where']||null:null,'attributes':_0x223246['options']?_0x223246[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':_0x223246[_0xd505('0x9')]?_0x223246[_0xd505('0x9')][_0xd505('0xd')]||null:null})[_0xd505('0x11')](function(_0x2c509d){logger[_0xd505('0x12')](_0xd505('0x1e'),_0x223246);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd505('0x14')](_0x223246['options'][_0xd505('0xb')]),_0x223246[_0xd505('0x1c')][_0xd505('0x1f')]);logger['debug']('UpdateCmHopper',_0x223246,JSON[_0xd505('0x14')](_0x2c509d));_0xb0127e(_0x2c509d);})[_0xd505('0x15')](function(_0x389b39){logger[_0xd505('0x16')](_0xd505('0x1e'),_0x389b39[_0xd505('0x17')],_0x223246);_0x3cc8db(_0x21d4c9[_0xd505('0x16')](0x1f4,_0x389b39['message']));});});};exports[_0xd505('0x20')]=function(_0x4a2b84){var _0x2f2206=this;return new Promise(function(_0x5ebe3b,_0x205444){return db[_0xd505('0x7')][_0xd505('0x21')]({'where':_0x4a2b84[_0xd505('0x9')]?_0x4a2b84[_0xd505('0x9')][_0xd505('0xb')]||null:null})['then'](function(_0x354cba){logger[_0xd505('0x12')](_0xd505('0x20'),_0x4a2b84);logger[_0xd505('0x13')](_0xd505('0x20'),_0x4a2b84,JSON[_0xd505('0x14')](_0x354cba));_0x5ebe3b(_0x354cba);})[_0xd505('0x15')](function(_0x59936d){logger[_0xd505('0x16')](_0xd505('0x20'),_0x59936d[_0xd505('0x17')],_0x4a2b84);_0x205444(_0x2f2206['error'](0x1f4,_0x59936d[_0xd505('0x17')]));});});};exports[_0xd505('0x22')]=function(_0x531359){var _0x6ee653=this;return new Promise(function(_0x28cfec,_0x5ebd36){return db['CmContact'][_0xd505('0x23')]()[_0xd505('0x11')](function(_0x4710e6){return db[_0xd505('0x24')]['transaction'](function(_0x281e2e){return db[_0xd505('0x7')]['findAll']({'where':_0x531359['options']?_0x531359['options'][_0xd505('0xb')]||null:null,'attributes':_0x531359[_0xd505('0x9')]?_0x531359[_0xd505('0x9')]['attributes']||null:null,'limit':_0x531359[_0xd505('0x9')]?_0x531359[_0xd505('0x9')][_0xd505('0xd')]||null:null,'order':_0x531359['options']?_0x531359['options'][_0xd505('0x25')]||null:null,'transaction':_0x281e2e,'lock':_0x281e2e[_0xd505('0x26')][_0xd505('0x27')],'include':[{'model':db[_0xd505('0x28')],'as':_0xd505('0x29'),'attributes':_[_0xd505('0x2a')](_0x4710e6)},{'model':db[_0xd505('0x2b')],'as':_0xd505('0x2c'),'attributes':['id',_0xd505('0x2d'),_0xd505('0x2e')]}]})[_0xd505('0x11')](function(_0x34a3c6){var _0x31b885=[];var _0x4540e2=[];for(var _0x3f110a=0x0;_0x3f110a<_0x34a3c6['length'];_0x3f110a+=0x1){var _0x3281df=_0x34a3c6[_0x3f110a][_0xd505('0x2f')];if(_0x3281df===null){_0x31b885[_0xd505('0x30')](_0x34a3c6[_0x3f110a][_0xd505('0x1d')](_0x531359[_0xd505('0x1c')],{'transaction':_0x281e2e}));}else if(!_0x4540e2[_0xd505('0x31')](_0x3281df)){_0x4540e2['push'](_0x3281df);_0x31b885['push'](_0x34a3c6[_0x3f110a][_0xd505('0x1d')](_0x531359[_0xd505('0x1c')],{'transaction':_0x281e2e}));}}return BPromise[_0xd505('0x32')](_0x31b885);});})[_0xd505('0x11')](function(_0x227212){logger[_0xd505('0x12')]('GetContactDialer',_0x531359);if(_0x227212[_0xd505('0x33')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x227212[0x0][_0xd505('0x34')]['id'],_0x227212[0x0][_0xd505('0x34')]['ContactId'],_0x227212[0x0][_0xd505('0x34')][_0xd505('0x1f')]);}logger[_0xd505('0x13')](_0xd505('0x22'),_0x531359,JSON[_0xd505('0x14')](_0x227212));_0x28cfec(_0x227212);})[_0xd505('0x15')](function(_0x1ebcf4){logger[_0xd505('0x16')](_0xd505('0x22'),_0x1ebcf4['message'],_0x531359);_0x5ebd36(_0x6ee653[_0xd505('0x16')](0x1f4,_0x1ebcf4[_0xd505('0x17')]));});});});};exports[_0xd505('0x35')]=function(_0x1cf21c){var _0x3b0cd7=this;return new Promise(function(_0x27a668,_0x29e381){return db['sequelize']['transaction'](function(_0x5874a3){return db[_0xd505('0x36')][_0xd505('0x1b')](_0x1cf21c[_0xd505('0x1c')],{'raw':_0x1cf21c[_0xd505('0x9')]?_0x1cf21c['options'][_0xd505('0xa')]===undefined?!![]:![]:!![],'transaction':_0x5874a3})[_0xd505('0x11')](function(){logger[_0xd505('0x12')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x1cf21c[_0xd505('0x9')]['where']),_0x1cf21c[_0xd505('0x9')]['where']['active']);return db[_0xd505('0x7')][_0xd505('0x21')]({'where':_0x1cf21c[_0xd505('0x9')]?_0x1cf21c['options'][_0xd505('0xb')]||null:null,'transaction':_0x5874a3});});})[_0xd505('0x11')](function(_0x1819fe){logger[_0xd505('0x12')](_0xd505('0x35'),_0x1cf21c);logger['debug']('MoveContactManagedDialer',_0x1cf21c,JSON[_0xd505('0x14')](_0x1819fe));_0x27a668(_0x1819fe);})[_0xd505('0x15')](function(_0x95fbc1){logger[_0xd505('0x16')](_0xd505('0x35'),_0x95fbc1['message'],_0x1cf21c);_0x29e381(_0x3b0cd7[_0xd505('0x16')](0x1f4,_0x95fbc1['message']));});});};exports[_0xd505('0x37')]=function(_0x406c1c){var _0x354771=this;return new Promise(function(_0x2e02c0,_0x2275a3){return db[_0xd505('0x7')][_0xd505('0x8')]({'raw':_0x406c1c[_0xd505('0x9')]?_0x406c1c[_0xd505('0x9')][_0xd505('0xa')]===undefined?!![]:![]:!![],'where':_0x406c1c['options']?_0x406c1c[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':[[db[_0xd505('0x24')]['fn'](_0xd505('0x38'),db[_0xd505('0x24')]['fn']('IF',db[_0xd505('0x24')][_0xd505('0x39')](_0xd505('0x3a')+util[_0xd505('0x3b')](_0xd505('0x3c'),moment()[_0xd505('0x3b')](_0xd505('0x3d')))+_0xd505('0x3e')))),_0xd505('0x3f')]]})[_0xd505('0x11')](function(_0x16efc8){logger['info'](_0xd505('0x37'),_0x406c1c);logger[_0xd505('0x13')](_0xd505('0x37'),_0x406c1c,JSON[_0xd505('0x14')](_0x16efc8));_0x2e02c0(_0x16efc8);})[_0xd505('0x15')](function(_0x190175){logger['error'](_0xd505('0x37'),_0x190175[_0xd505('0x17')],_0x406c1c);_0x2275a3(_0x354771[_0xd505('0x16')](0x1f4,_0x190175['message']));});});};exports['GetContactRecallMe']=function(_0xe1a363){var _0x5eacf9=this;return new Promise(function(_0x510a4a,_0x99cef3){return db[_0xd505('0x28')][_0xd505('0x23')]()[_0xd505('0x11')](function(){return db[_0xd505('0x24')]['transaction'](function(_0x598bfc){return db[_0xd505('0x7')]['findAll']({'where':_0xe1a363['options']?_0xe1a363['options']['where']||null:null,'attributes':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')][_0xd505('0xc')]||null:null,'limit':0x1,'order':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')][_0xd505('0x25')]||null:null,'group':db[_0xd505('0x7')][_0xd505('0x2f')],'transaction':_0x598bfc,'lock':_0x598bfc[_0xd505('0x26')][_0xd505('0x27')],'include':_0xe1a363[_0xd505('0x9')]?_0xe1a363[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0xe1a363[_0xd505('0x9')][_0xd505('0xf')],function(_0x1477f5){return{'model':db[_0x1477f5[_0xd505('0x10')]],'as':_0x1477f5['as'],'attributes':_0x1477f5[_0xd505('0xc')],'include':_0x1477f5[_0xd505('0xf')]?_[_0xd505('0xe')](_0x1477f5[_0xd505('0xf')],function(_0x346bce){return{'model':db[_0x346bce[_0xd505('0x10')]],'as':_0x346bce['as'],'attributes':_0x346bce['attributes'],'include':_0x346bce[_0xd505('0xf')]?_[_0xd505('0xe')](_0x346bce['include'],function(_0x342311){return{'model':db[_0x342311['model']],'as':_0x342311['as'],'attributes':_0x342311['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e63e){var _0x545e06=[];for(var _0x9b90e3=0x0;_0x9b90e3<_0x35e63e[_0xd505('0x33')];_0x9b90e3+=0x1){_0x545e06['push'](_0x35e63e[_0x9b90e3]['update'](_0xe1a363['body'],{'transaction':_0x598bfc}));}return BPromise[_0xd505('0x32')](_0x545e06);});})[_0xd505('0x11')](function(_0x1e4a1d){logger['info']('GetContactRecallMe',_0xe1a363);logger[_0xd505('0x13')]('GetContactRecallMe',_0xe1a363,JSON[_0xd505('0x14')](_0x1e4a1d));_0x510a4a(_0x1e4a1d);})['catch'](function(_0x31d1c2){logger[_0xd505('0x16')](_0xd505('0x40'),_0x31d1c2[_0xd505('0x17')],_0xe1a363);_0x99cef3(_0x5eacf9[_0xd505('0x16')](0x1f4,_0x31d1c2[_0xd505('0x17')]));});});});};exports[_0xd505('0x41')]=function(_0x5129c1){var _0x345e41=this;return new Promise(function(_0x3142ff,_0x495ca1){db['CmContact']['describe']()[_0xd505('0x11')](function(_0x30475b){return db[_0xd505('0x7')]['findAll']({'raw':_0x5129c1['options']?_0x5129c1[_0xd505('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x5129c1[_0xd505('0x9')]?_0x5129c1[_0xd505('0x9')][_0xd505('0xb')]||null:null,'attributes':_0x5129c1['options']?_0x5129c1['options']['attributes']||null:null,'limit':_0x5129c1[_0xd505('0x9')]?_0x5129c1[_0xd505('0x9')][_0xd505('0xd')]||null:null,'include':_0x5129c1['options']?_0x5129c1[_0xd505('0x9')]['include']?_[_0xd505('0xe')](_0x5129c1['options']['include'],function(_0x580b31){return{'model':db[_0x580b31['model']],'as':_0x580b31['as'],'attributes':_0x580b31['as']===_0xd505('0x29')?_[_0xd505('0x2a')](_0x30475b):_0x580b31[_0xd505('0xc')],'include':_0x580b31[_0xd505('0xf')]?_['map'](_0x580b31[_0xd505('0xf')],function(_0x4c4f4c){return{'model':db[_0x4c4f4c[_0xd505('0x10')]],'as':_0x4c4f4c['as'],'attributes':_0x4c4f4c[_0xd505('0xc')],'include':_0x4c4f4c['include']?_[_0xd505('0xe')](_0x4c4f4c[_0xd505('0xf')],function(_0x2e8641){return{'model':db[_0x2e8641[_0xd505('0x10')]],'as':_0x2e8641['as'],'attributes':_0x2e8641[_0xd505('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x11')](function(_0x2d6997){logger[_0xd505('0x12')](_0xd505('0x6'),_0x5129c1);logger[_0xd505('0x13')](_0xd505('0x6'),_0x5129c1,JSON[_0xd505('0x14')](_0x2d6997));_0x3142ff(_0x2d6997);})[_0xd505('0x15')](function(_0x494092){logger[_0xd505('0x16')]('GetCmHopper',_0x494092['message'],_0x5129c1);_0x495ca1(_0x345e41[_0xd505('0x16')](0x1f4,_0x494092[_0xd505('0x17')]));});});});};exports[_0xd505('0x42')]=function(_0x57610d){var _0x54e260=this;return new Promise(function(_0x4e7100,_0x419d72){return db[_0xd505('0x28')]['findOne']({'raw':!![],'where':{'phone':_0x57610d[_0xd505('0x9')][_0xd505('0xb')]['phone']},'attributes':['id',_0xd505('0x43')],'order':[['id',_0xd505('0x44')]]})[_0xd505('0x11')](function(_0x1e4d4a){logger[_0xd505('0x12')](_0xd505('0x45'),_0x57610d);logger[_0xd505('0x13')]('getContactByPhone',_0x57610d,JSON[_0xd505('0x14')](_0x1e4d4a));_0x4e7100(_0x1e4d4a);})['catch'](function(_0x4fc79f){logger['error'](_0xd505('0x45'),_0x4fc79f[_0xd505('0x17')],_0x57610d);_0x419d72(_0x54e260[_0xd505('0x16')](0x1f4,_0x4fc79f[_0xd505('0x17')]));});});};exports['ResetActiveCalls']=function(_0x34fac9){var _0x5c9175=this;return new Promise(function(_0x38ddc8,_0x20dabf){return db[_0xd505('0x24')][_0xd505('0x46')](function(_0x32ccf3){var _0x848404=_0x34fac9[_0xd505('0x9')]&&_0x34fac9['options'][_0xd505('0xb')]?_0x34fac9[_0xd505('0x9')]['where']:{};return db['CmHopper'][_0xd505('0x1d')](_0x34fac9[_0xd505('0x1c')],{'where':_0x848404,'transaction':_0x32ccf3})['then'](function(_0x5f157a){logger['info'](_0xd505('0x47'),_0x34fac9);logger['debug'](_0xd505('0x47'),_0x34fac9,JSON[_0xd505('0x14')](_0x5f157a));_0x38ddc8(_0x5f157a);})[_0xd505('0x15')](function(_0x360bda){logger[_0xd505('0x16')]('ResetActiveCalls',_0x360bda['message'],_0x34fac9);_0x20dabf(_0x5c9175[_0xd505('0x16')](0x1f4,_0x360bda['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x22c0f4){var _0x29f040=this;var _0x389084=_0x22c0f4[_0xd505('0x1c')][_0xd505('0xb')]['voiceQueueIds'];var _0x3469b1=_0x22c0f4['body'][_0xd505('0xb')][_0xd505('0x48')];var _0x2cd4d7=_0x22c0f4[_0xd505('0x1c')][_0xd505('0xb')][_0xd505('0x49')];return new Promise(function(_0x5b37b4,_0x38410d){return db[_0xd505('0x7')][_0xd505('0x8')]({'where':{'voiceQueueId':{'$in':_0x389084},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd505('0x24')][_0xd505('0x39')](_0xd505('0x4a')+_0x3469b1+_0xd505('0x4b')),'$gt':db['sequelize'][_0xd505('0x39')](_0xd505('0x4c'))}},'UserId':{'$in':_0x2cd4d7}},'include':[{'model':db[_0xd505('0x28')],'as':_0xd505('0x29')},{'model':db[_0xd505('0x2b')],'as':_0xd505('0x2c'),'attributes':['id','name',_0xd505('0x2e')]},{'model':db[_0xd505('0x4d')],'as':'List'}]})[_0xd505('0x11')](function(_0x3697cd){if(_0x3697cd[_0xd505('0x33')]>0x0){return db[_0xd505('0x24')][_0xd505('0x46')](function(_0x2566e4){return db['CmHopper'][_0xd505('0x1d')]({'recallmeNotifiedDate':db[_0xd505('0x24')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0xd505('0xe')](_0x3697cd,'id')}},'transaction':_0x2566e4})[_0xd505('0x11')](function(){_0x5b37b4(_0x3697cd);})[_0xd505('0x15')](function(_0x22cc7e){logger[_0xd505('0x16')](_0xd505('0x4e'),_0x22cc7e['message'],_0x22c0f4);_0x38410d(_0x29f040[_0xd505('0x16')](0x1f4,_0x22cc7e[_0xd505('0x17')]));});})[_0xd505('0x15')](function(_0x3eb873){logger[_0xd505('0x16')](_0xd505('0x4e'),_0x3eb873['message'],_0x22c0f4);_0x38410d(_0x29f040[_0xd505('0x16')](0x1f4,_0x3eb873[_0xd505('0x17')]));});}else{_0x5b37b4(_0x3697cd);}});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f1a8e1a..5689a18 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 _0xcec0=['post','getPreview','/timezone','getTimezone','put','update','delete','exports','express','Router','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall'];(function(_0x4cf29e,_0x287400){var _0xe8bea0=function(_0x3dd6){while(--_0x3dd6){_0x4cf29e['push'](_0x4cf29e['shift']());}};_0xe8bea0(++_0x287400);}(_0xcec0,0x8c));var _0x0cec=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xcec0[_0x4243a3];return _0x1b2a33;};'use strict';var express=require(_0x0cec('0x0'));var router=express[_0x0cec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x0cec('0x2'));router[_0x0cec('0x3')]('/',auth[_0x0cec('0x4')](),controller['index']);router[_0x0cec('0x3')](_0x0cec('0x5'),auth['isAuthenticated'](),controller[_0x0cec('0x6')]);router[_0x0cec('0x3')](_0x0cec('0x7'),auth[_0x0cec('0x4')](),controller[_0x0cec('0x8')]);router[_0x0cec('0x3')](_0x0cec('0x9'),auth[_0x0cec('0x4')](),controller[_0x0cec('0xa')]);router['get'](_0x0cec('0xb'),auth['isAuthenticated'](),controller[_0x0cec('0xc')]);router['get'](_0x0cec('0xd'),auth[_0x0cec('0x4')](),controller['getPreviewRecall']);router[_0x0cec('0xe')]('/',auth[_0x0cec('0x4')](),controller['create']);router[_0x0cec('0xe')]('/preview',auth[_0x0cec('0x4')](),controller[_0x0cec('0xf')]);router[_0x0cec('0xe')](_0x0cec('0x10'),auth[_0x0cec('0x4')](),controller[_0x0cec('0x11')]);router[_0x0cec('0x12')](_0x0cec('0xb'),auth[_0x0cec('0x4')](),controller[_0x0cec('0x13')]);router[_0x0cec('0x14')](_0x0cec('0xb'),auth[_0x0cec('0x4')](),controller['destroy']);module[_0x0cec('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 086c305..bdf52ac 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 _0x9098=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','STRING','DATE'];(function(_0x25991b,_0x3bbb86){var _0x50177e=function(_0x240b47){while(--_0x240b47){_0x25991b['push'](_0x25991b['shift']());}};_0x50177e(++_0x3bbb86);}(_0x9098,0x18a));var _0x8909=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9098[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x8909('0x0'));var Sequelize=require(_0x8909('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x8909('0x2')]},'phone':{'type':Sequelize[_0x8909('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8909('0x4')],'defaultValue':moment()[_0x8909('0x5')](_0x8909('0x6'))},'countbusyretry':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8909('0x2')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index f89f865..fb715fe 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 _0x1d5c=['CmHopperAdditionalPhones','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0x1d5c,0x11d));var _0xc1d5=function(_0x4628c6,_0x212c5e){_0x4628c6=_0x4628c6-0x0;var _0x181ddc=_0x1d5c[_0x4628c6];return _0x181ddc;};'use strict';var emlformat=require(_0xc1d5('0x0'));var rimraf=require(_0xc1d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1d5('0x2'));var rp=require(_0xc1d5('0x3'));var moment=require(_0xc1d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1d5('0x5'));var util=require('util');var path=require(_0xc1d5('0x6'));var sox=require(_0xc1d5('0x7'));var csv=require(_0xc1d5('0x8'));var ejs=require(_0xc1d5('0x9'));var fs=require('fs');var fs_extra=require(_0xc1d5('0xa'));var _=require(_0xc1d5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc1d5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1d5('0xd'));var Redis=require(_0xc1d5('0xe'));var authService=require(_0xc1d5('0xf'));var qs=require(_0xc1d5('0x10'));var as=require(_0xc1d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1d5('0x12'))(_0xc1d5('0x13'));var utils=require(_0xc1d5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc1d5('0x15'));var db=require(_0xc1d5('0x16'))['db'];function respondWithStatusCode(_0x32f3f8,_0xcf8f7f){_0xcf8f7f=_0xcf8f7f||0xcc;return function(_0x3df1f3){if(_0x3df1f3){return _0x32f3f8[_0xc1d5('0x17')](_0xcf8f7f);}return _0x32f3f8[_0xc1d5('0x18')](_0xcf8f7f)[_0xc1d5('0x19')]();};}function respondWithResult(_0x784210,_0x4cda49){_0x4cda49=_0x4cda49||0xc8;return function(_0x29001b){if(_0x29001b){return _0x784210[_0xc1d5('0x18')](_0x4cda49)['json'](_0x29001b);}};}function respondWithFilteredResult(_0x10681c,_0x58bb44){return function(_0x1e9583){if(_0x1e9583){var _0x18d364=typeof _0x58bb44[_0xc1d5('0x1a')]==='undefined'&&typeof _0x58bb44[_0xc1d5('0x1b')]===_0xc1d5('0x1c');var _0x3a5026=_0x1e9583[_0xc1d5('0x1d')];var _0x5cc6c1=_0x18d364?0x0:_0x58bb44[_0xc1d5('0x1a')];var _0x9bdc9a=_0x18d364?_0x1e9583[_0xc1d5('0x1d')]:_0x58bb44[_0xc1d5('0x1a')]+_0x58bb44[_0xc1d5('0x1b')];var _0x34ea50;if(_0x9bdc9a>=_0x3a5026){_0x9bdc9a=_0x3a5026;_0x34ea50=0xc8;}else{_0x34ea50=0xce;}_0x10681c['status'](_0x34ea50);return _0x10681c[_0xc1d5('0x1e')](_0xc1d5('0x1f'),_0x5cc6c1+'-'+_0x9bdc9a+'/'+_0x3a5026)['json'](_0x1e9583);}return null;};}function patchUpdates(_0x37ce7d){return function(_0x56a632){try{jsonpatch[_0xc1d5('0x20')](_0x56a632,_0x37ce7d,!![]);}catch(_0x2d0e6b){return BPromise[_0xc1d5('0x21')](_0x2d0e6b);}return _0x56a632[_0xc1d5('0x22')]();};}function saveUpdates(_0x1c5fee,_0x1fbc68){return function(_0x54671b){if(_0x54671b){return _0x54671b[_0xc1d5('0x23')](_0x1c5fee)[_0xc1d5('0x24')](function(_0x2377d3){return _0x2377d3;});}return null;};}function removeEntity(_0x92091f,_0x1af393){return function(_0x314d8c){if(_0x314d8c){return _0x314d8c[_0xc1d5('0x25')]()['then'](function(){var _0x3b3024=_0x314d8c[_0xc1d5('0x26')]({'plain':!![]});var _0x41d9b1=_0xc1d5('0x27');return db['UserProfileResource'][_0xc1d5('0x25')]({'where':{'type':_0x41d9b1,'resourceId':_0x3b3024['id']}})['then'](function(){return _0x314d8c;});})[_0xc1d5('0x24')](function(){_0x92091f['status'](0xcc)[_0xc1d5('0x19')]();});}};}function handleEntityNotFound(_0x2e4153,_0x45e3cf){return function(_0x244ddb){if(!_0x244ddb){_0x2e4153[_0xc1d5('0x17')](0x194);}return _0x244ddb;};}function handleError(_0x24f5df,_0x357e30){_0x357e30=_0x357e30||0x1f4;return function(_0x6f1113){logger['error'](_0x6f1113['stack']);if(_0x6f1113[_0xc1d5('0x28')]){delete _0x6f1113['name'];}_0x24f5df[_0xc1d5('0x18')](_0x357e30)[_0xc1d5('0x29')](_0x6f1113);};}exports[_0xc1d5('0x2a')]=function(_0x92ffb6,_0x4d96a6){var _0x3674d5={},_0x5a216c={},_0xbf5937={'count':0x0,'rows':[]};var _0x398e95=_[_0xc1d5('0x2b')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x59075f){return{'name':_0x59075f[_0xc1d5('0x2c')],'type':_0x59075f['type']['key']};});_0x5a216c[_0xc1d5('0x2d')]=_[_0xc1d5('0x2b')](_0x398e95,_0xc1d5('0x28'));_0x5a216c[_0xc1d5('0x2e')]=_[_0xc1d5('0x2f')](_0x92ffb6[_0xc1d5('0x2e')]);_0x5a216c[_0xc1d5('0x30')]=_[_0xc1d5('0x31')](_0x5a216c['model'],_0x5a216c[_0xc1d5('0x2e')]);_0x3674d5[_0xc1d5('0x32')]=_['intersection'](_0x5a216c[_0xc1d5('0x2d')],qs[_0xc1d5('0x33')](_0x92ffb6[_0xc1d5('0x2e')][_0xc1d5('0x33')]));_0x3674d5[_0xc1d5('0x32')]=_0x3674d5[_0xc1d5('0x32')]['length']?_0x3674d5[_0xc1d5('0x32')]:_0x5a216c[_0xc1d5('0x2d')];if(!_0x92ffb6[_0xc1d5('0x2e')][_0xc1d5('0x34')](_0xc1d5('0x35'))){_0x3674d5[_0xc1d5('0x1b')]=qs[_0xc1d5('0x1b')](_0x92ffb6[_0xc1d5('0x2e')]['limit']);_0x3674d5[_0xc1d5('0x1a')]=qs[_0xc1d5('0x1a')](_0x92ffb6[_0xc1d5('0x2e')][_0xc1d5('0x1a')]);}_0x3674d5[_0xc1d5('0x36')]=qs[_0xc1d5('0x37')](_0x92ffb6[_0xc1d5('0x2e')][_0xc1d5('0x37')]);_0x3674d5['where']=qs['filters'](_[_0xc1d5('0x38')](_0x92ffb6[_0xc1d5('0x2e')],_0x5a216c[_0xc1d5('0x30')]),_0x398e95);if(_0x92ffb6[_0xc1d5('0x2e')][_0xc1d5('0x39')]){_0x3674d5[_0xc1d5('0x3a')]=_['merge'](_0x3674d5[_0xc1d5('0x3a')],{'$or':_[_0xc1d5('0x2b')](_0x398e95,function(_0xd7e640){if(_0xd7e640[_0xc1d5('0x3b')]!==_0xc1d5('0x3c')){var _0x4ac76f={};_0x4ac76f[_0xd7e640[_0xc1d5('0x28')]]={'$like':'%'+_0x92ffb6['query'][_0xc1d5('0x39')]+'%'};return _0x4ac76f;}})});}_0x3674d5=_[_0xc1d5('0x3d')]({},_0x3674d5,_0x92ffb6[_0xc1d5('0x3e')]);var _0x162d71={'where':_0x3674d5[_0xc1d5('0x3a')]};return db[_0xc1d5('0x3f')][_0xc1d5('0x1d')](_0x162d71)[_0xc1d5('0x24')](function(_0x19fed8){_0xbf5937[_0xc1d5('0x1d')]=_0x19fed8;if(_0x92ffb6[_0xc1d5('0x2e')][_0xc1d5('0x40')]){_0x3674d5[_0xc1d5('0x41')]=[{'all':!![]}];}return db[_0xc1d5('0x3f')][_0xc1d5('0x42')](_0x3674d5);})[_0xc1d5('0x24')](function(_0x10dac2){_0xbf5937[_0xc1d5('0x43')]=_0x10dac2;return _0xbf5937;})[_0xc1d5('0x24')](respondWithFilteredResult(_0x4d96a6,_0x3674d5))[_0xc1d5('0x44')](handleError(_0x4d96a6,null));};exports[_0xc1d5('0x45')]=function(_0x649630,_0x48da83){var _0x2055cf={'raw':!![],'where':{'id':_0x649630[_0xc1d5('0x46')]['id']}},_0x578935={};_0x578935[_0xc1d5('0x2d')]=_[_0xc1d5('0x2f')](db[_0xc1d5('0x3f')]['rawAttributes']);_0x578935['query']=_[_0xc1d5('0x2f')](_0x649630[_0xc1d5('0x2e')]);_0x578935[_0xc1d5('0x30')]=_['intersection'](_0x578935[_0xc1d5('0x2d')],_0x578935['query']);_0x2055cf[_0xc1d5('0x32')]=_['intersection'](_0x578935[_0xc1d5('0x2d')],qs[_0xc1d5('0x33')](_0x649630[_0xc1d5('0x2e')][_0xc1d5('0x33')]));_0x2055cf[_0xc1d5('0x32')]=_0x2055cf['attributes'][_0xc1d5('0x47')]?_0x2055cf[_0xc1d5('0x32')]:_0x578935[_0xc1d5('0x2d')];if(_0x649630[_0xc1d5('0x2e')][_0xc1d5('0x40')]){_0x2055cf['include']=[{'all':!![]}];}_0x2055cf=_[_0xc1d5('0x3d')]({},_0x2055cf,_0x649630[_0xc1d5('0x3e')]);return db['CmHopperAdditionalPhone'][_0xc1d5('0x48')](_0x2055cf)['then'](handleEntityNotFound(_0x48da83,null))[_0xc1d5('0x24')](respondWithResult(_0x48da83,null))[_0xc1d5('0x44')](handleError(_0x48da83,null));};exports[_0xc1d5('0x49')]=function(_0x4653f9,_0x44ff9b){return db[_0xc1d5('0x3f')][_0xc1d5('0x49')](_0x4653f9[_0xc1d5('0x4a')],{})[_0xc1d5('0x24')](function(_0x44100e){var _0x1bd369=_0x4653f9[_0xc1d5('0x4b')][_0xc1d5('0x26')]({'plain':!![]});if(!_0x1bd369)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd369[_0xc1d5('0x4c')]==='user'){var _0x2cbfc2=_0x44100e[_0xc1d5('0x26')]({'plain':!![]});var _0x34587e=_0xc1d5('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x34587e,'userProfileId':_0x1bd369[_0xc1d5('0x4d')]},'raw':!![]})['then'](function(_0x5f320a){if(_0x5f320a&&_0x5f320a[_0xc1d5('0x4e')]===0x0){return db['UserProfileResource'][_0xc1d5('0x49')]({'name':_0x2cbfc2['name'],'resourceId':_0x2cbfc2['id'],'type':_0x5f320a[_0xc1d5('0x28')],'sectionId':_0x5f320a['id']},{})[_0xc1d5('0x24')](function(){return _0x44100e;});}else{return _0x44100e;}})['catch'](function(_0x278252){logger[_0xc1d5('0x4f')](_0xc1d5('0x50'),_0x278252);throw _0x278252;});}return _0x44100e;})[_0xc1d5('0x24')](respondWithResult(_0x44ff9b,0xc9))['catch'](handleError(_0x44ff9b,null));};exports[_0xc1d5('0x23')]=function(_0x153bb3,_0x1bcc1f){if(_0x153bb3[_0xc1d5('0x4a')]['id']){delete _0x153bb3[_0xc1d5('0x4a')]['id'];}return db[_0xc1d5('0x3f')]['find']({'where':{'id':_0x153bb3[_0xc1d5('0x46')]['id']}})[_0xc1d5('0x24')](handleEntityNotFound(_0x1bcc1f,null))['then'](saveUpdates(_0x153bb3[_0xc1d5('0x4a')],null))['then'](respondWithResult(_0x1bcc1f,null))[_0xc1d5('0x44')](handleError(_0x1bcc1f,null));};exports[_0xc1d5('0x25')]=function(_0x50c6c0,_0x58205f){return db[_0xc1d5('0x3f')]['find']({'where':{'id':_0x50c6c0[_0xc1d5('0x46')]['id']}})[_0xc1d5('0x24')](handleEntityNotFound(_0x58205f,null))[_0xc1d5('0x24')](removeEntity(_0x58205f,null))[_0xc1d5('0x44')](handleError(_0x58205f,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 49956b7..347b66a 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 _0x17f5=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x172fda,_0x3272dd){var _0x1a11b2=function(_0x1c1911){while(--_0x1c1911){_0x172fda['push'](_0x172fda['shift']());}};_0x1a11b2(++_0x3272dd);}(_0x17f5,0xa1));var _0x517f=function(_0x5f527e,_0x5c89ff){_0x5f527e=_0x5f527e-0x0;var _0x336dba=_0x17f5[_0x5f527e];return _0x336dba;};'use strict';var _=require(_0x517f('0x0'));var util=require(_0x517f('0x1'));var logger=require(_0x517f('0x2'))('api');var moment=require(_0x517f('0x3'));var BPromise=require('bluebird');var rp=require(_0x517f('0x4'));var fs=require('fs');var path=require(_0x517f('0x5'));var rimraf=require(_0x517f('0x6'));var config=require(_0x517f('0x7'));var attributes=require(_0x517f('0x8'));module[_0x517f('0x9')]=function(_0xdbe27e,_0xbc4fb9){return _0xdbe27e[_0x517f('0xa')](_0x517f('0xb'),attributes,{'tableName':_0x517f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 50d7c02..ad7480d 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 _0x03a9=['error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','CmHopperAdditionalPhone','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3bb63a,_0x15af8f){var _0x3b822a=function(_0x5e31cb){while(--_0x5e31cb){_0x3bb63a['push'](_0x3bb63a['shift']());}};_0x3b822a(++_0x15af8f);}(_0x03a9,0x10d));var _0x903a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x03a9[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x903a('0x0'));var util=require(_0x903a('0x1'));var moment=require('moment');var BPromise=require(_0x903a('0x2'));var rs=require(_0x903a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x903a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x903a('0x5'))('rpc');var config=require(_0x903a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x903a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40fbe8,_0x1aebea,_0x4c5dd0){return new BPromise(function(_0x3b2995,_0x71fd20){return client[_0x903a('0x8')](_0x40fbe8,_0x4c5dd0)[_0x903a('0x9')](function(_0x19ba5b){logger[_0x903a('0xa')](_0x903a('0xb'),_0x1aebea,'request\x20sent');logger[_0x903a('0xc')](_0x903a('0xd'),_0x1aebea,_0x903a('0xe'),JSON[_0x903a('0xf')](_0x19ba5b));if(_0x19ba5b['error']){if(_0x19ba5b[_0x903a('0x10')][_0x903a('0x11')]===0x1f4){logger['error'](_0x903a('0xb'),_0x1aebea,_0x19ba5b[_0x903a('0x10')]['message']);return _0x71fd20(_0x19ba5b['error'][_0x903a('0x12')]);}logger[_0x903a('0x10')](_0x903a('0xb'),_0x1aebea,_0x19ba5b[_0x903a('0x10')][_0x903a('0x12')]);return _0x3b2995(_0x19ba5b[_0x903a('0x10')]['message']);}else{logger[_0x903a('0xa')](_0x903a('0xb'),_0x1aebea,_0x903a('0xe'));_0x3b2995(_0x19ba5b[_0x903a('0x13')][_0x903a('0x12')]);}})[_0x903a('0x14')](function(_0x5837ee){logger[_0x903a('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1aebea,_0x5837ee);_0x71fd20(_0x5837ee);});});}exports[_0x903a('0x15')]=function(_0x3b01ec){var _0x2ee782=this;return new Promise(function(_0xa35be9,_0x3ccaf4){return db[_0x903a('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x3b01ec[_0x903a('0x17')][_0x903a('0x18')],'ListId':_0x3b01ec['body'][_0x903a('0x19')],'VoiceQueueId':_0x3b01ec[_0x903a('0x17')][_0x903a('0x1a')]===undefined?null:_0x3b01ec[_0x903a('0x17')][_0x903a('0x1a')],'CampaignId':_0x3b01ec[_0x903a('0x17')][_0x903a('0x1b')]===undefined?null:_0x3b01ec[_0x903a('0x17')]['CampaignId']}})[_0x903a('0x9')](function(_0x4c2f70){if(_0x4c2f70!=null){return db['CmHopperAdditionalPhone'][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4c2f70['id'],'OrderBy':{'$gt':_0x4c2f70[_0x903a('0x1d')]}},'order':[[_0x903a('0x1d'),_0x903a('0x1e')]]})[_0x903a('0x9')](function(_0x10189b){var _0x3bc754=0x0;if(_0x10189b){if(_0x10189b[_0x903a('0x1f')]+_0x10189b[_0x903a('0x20')]+_0x10189b[_0x903a('0x21')]+_0x10189b[_0x903a('0x22')]+_0x10189b[_0x903a('0x23')]+_0x10189b[_0x903a('0x24')]+_0x10189b[_0x903a('0x25')]+_0x10189b[_0x903a('0x26')]<_0x3b01ec[_0x903a('0x27')]['dialGlobalMaxRetry'])_0x3bc754=0x1;_0xa35be9({'additional':_0x3bc754});}else{return db[_0x903a('0x28')][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x4c2f70['id']},'order':[[_0x903a('0x1d'),_0x903a('0x1e')]]})[_0x903a('0x9')](function(_0x32dee7){var _0x252967=0x0;if(_0x32dee7){if(_0x32dee7['countbusyretry']+_0x32dee7[_0x903a('0x20')]+_0x32dee7[_0x903a('0x21')]+_0x32dee7['countnosuchnumberretry']+_0x32dee7[_0x903a('0x23')]+_0x32dee7[_0x903a('0x24')]+_0x32dee7[_0x903a('0x25')]+_0x32dee7[_0x903a('0x26')]<_0x3b01ec[_0x903a('0x27')][_0x903a('0x29')])_0x252967=0x1;_0xa35be9({'additional':_0x252967});}else{_0xa35be9({'additional':0x0});}})[_0x903a('0x14')](function(_0xd16193){logger[_0x903a('0x10')](_0x903a('0x15'),_0xd16193[_0x903a('0x12')]);_0x3ccaf4(_0x2ee782[_0x903a('0x10')](0x1f4,_0xd16193['message']));});}})[_0x903a('0x14')](function(_0x151bc8){logger[_0x903a('0x10')](_0x903a('0x15'),_0x151bc8[_0x903a('0x12')]);_0x3ccaf4(_0x2ee782[_0x903a('0x10')](0x1f4,_0x151bc8['message']));});}else _0xa35be9({'additional':0x0});});});};exports[_0x903a('0x2a')]=function(_0x35499a){var _0x1abf74=this;return new Promise(function(_0x15450c,_0x518052){return db[_0x903a('0x16')][_0x903a('0x1c')]({'raw':!![],'where':{'ContactId':_0x35499a[_0x903a('0x17')][_0x903a('0x18')],'ListId':_0x35499a['body'][_0x903a('0x19')],'VoiceQueueId':_0x35499a[_0x903a('0x17')][_0x903a('0x1a')]===undefined?null:_0x35499a['body'][_0x903a('0x1a')],'CampaignId':_0x35499a[_0x903a('0x17')]['CampaignId']===undefined?null:_0x35499a[_0x903a('0x17')][_0x903a('0x1b')]}})[_0x903a('0x9')](function(_0x5cc939){if(_0x5cc939!=null){return db['CmHopperAdditionalPhone'][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x5cc939['id'],'OrderBy':{'$gte':_0x5cc939[_0x903a('0x1d')]}},'order':[[_0x903a('0x1d'),'ASC']]})[_0x903a('0x9')](function(_0x454421){if(_0x454421)return activateAdditionalPhone(_0x5cc939,_0x35499a[_0x903a('0x17')],_0x454421,_0x35499a[_0x903a('0x2b')],_0x35499a[_0x903a('0x2c')])['then'](function(_0x5ddc95){_0x15450c(_0x5ddc95);});else{return db[_0x903a('0x28')][_0x903a('0x1c')]({'raw':!![],'where':{'CmHopperId':_0x5cc939['id']},'order':[[_0x903a('0x1d'),_0x903a('0x1e')]]})[_0x903a('0x9')](function(_0x53a785){if(_0x53a785)return activateAdditionalPhone(_0x5cc939,_0x35499a[_0x903a('0x17')],_0x53a785,_0x35499a[_0x903a('0x2b')],_0x35499a[_0x903a('0x2c')])[_0x903a('0x9')](function(_0x4655ad){_0x15450c(_0x4655ad);});else{_0x15450c({'id':_0x5cc939['id'],'phone':''});}})[_0x903a('0x14')](function(_0x125e54){logger[_0x903a('0x10')]('VerifyAdditionalPhones',_0x125e54['message']);_0x518052(_0x1abf74[_0x903a('0x10')](0x1f4,_0x125e54[_0x903a('0x12')]));});}})['catch'](function(_0x51dd02){logger[_0x903a('0x10')](_0x903a('0x15'),_0x51dd02[_0x903a('0x12')]);_0x518052(_0x1abf74[_0x903a('0x10')](0x1f4,_0x51dd02[_0x903a('0x12')]));});}else _0x15450c(0x1);});});};function activateAdditionalPhone(_0xd3207f,_0xbd7bbc,_0x293850,_0x25e697,_0x4aaaec){return new Promise(function(_0x3119fc,_0x214e11){var _0xaeffa9;if(_['isNil'](_0x293850[_0x903a('0x2d')])){_0x293850[_0x903a('0x2d')]=moment();}if(moment()>moment(_0x293850[_0x903a('0x2d')])){_0xaeffa9=moment()[_0x903a('0x2e')](_0x4aaaec||0x3,'minutes');}else{if(_0x293850[_0x903a('0x1d')]==0x0){_0xaeffa9=moment(_0x293850[_0x903a('0x2d')]);}else{_0xaeffa9=moment()[_0x903a('0x2e')](_0x4aaaec||0x3,_0x903a('0x2f'));}}if(_[_0x903a('0x30')](_0xaeffa9)){_0xaeffa9=moment()['add'](_0x4aaaec||0x3,_0x903a('0x2f'));}var _0x1ca3d5={'phone':_0xd3207f[_0x903a('0x31')],'active':0x0,'OrderBy':_[_0x903a('0x30')](_0xd3207f[_0x903a('0x1d')])?0x0:_0xd3207f[_0x903a('0x1d')],'scheduledat':moment()[_0x903a('0x2e')](_0x25e697||0x1,'minutes'),'countbusyretry':_0xbd7bbc[_0x903a('0x1f')],'countcongestionretry':_0xbd7bbc['countcongestionretry'],'countnoanswerretry':_0xbd7bbc[_0x903a('0x21')],'countnosuchnumberretry':_0xbd7bbc['countnosuchnumberretry'],'countdropretry':_0xbd7bbc[_0x903a('0x23')],'countabandonedretry':_0xbd7bbc['countabandonedretry'],'countmachineretry':_0xbd7bbc[_0x903a('0x25')],'countagentrejectretry':_0xbd7bbc[_0x903a('0x26')],'createdAt':_0xbd7bbc[_0x903a('0x32')],'updatedAt':_0xbd7bbc[_0x903a('0x33')]};var _0x54a34e={'CmHopperId':_0xd3207f['id'],'phone':_0x293850[_0x903a('0x31')],'active':0x0,'OrderBy':_[_0x903a('0x30')](_0x293850[_0x903a('0x1d')])?0x0:_0x293850[_0x903a('0x1d')],'scheduledat':_0xaeffa9,'countbusyretry':_0x293850['countbusyretry'],'countcongestionretry':_0x293850[_0x903a('0x20')],'countnoanswerretry':_0x293850[_0x903a('0x21')],'countnosuchnumberretry':_0x293850[_0x903a('0x22')],'countdropretry':_0x293850[_0x903a('0x23')],'countabandonedretry':_0x293850['countabandonedretry'],'countmachineretry':_0x293850[_0x903a('0x25')],'countagentrejectretry':_0x293850['countagentrejectretry'],'createdAt':_0x293850[_0x903a('0x32')],'updatedAt':_0x293850[_0x903a('0x33')]};return db[_0x903a('0x34')][_0x903a('0x35')](function(_0x3d8be6){return db[_0x903a('0x28')]['update'](_0x1ca3d5,{'where':{'id':_0x293850['id']}},{'transaction':_0x3d8be6})[_0x903a('0x9')](function(){return db['CmHopper'][_0x903a('0x36')](_0x54a34e,{'where':{'id':_0xd3207f['id']}},{'transaction':_0x3d8be6});});})[_0x903a('0x9')](function(_0x59bdd6){_0x3119fc({'id':_0xd3207f['id'],'phone':_0x293850[_0x903a('0x31')]});})['catch'](function(_0x4235af){logger[_0x903a('0x10')](_0x903a('0x37'),_0x4235af[_0x903a('0x12')]);_0x214e11({'error':_0x4235af['message']});});});}exports['IncrementPreviewCounters']=function(_0x2e5314){var _0x7fa776=this;return new Promise(function(_0x2d8790,_0x4000df){return db[_0x903a('0x16')]['update'](_0x2e5314[_0x903a('0x17')]['field'],{'where':{'id':_0x2e5314[_0x903a('0x17')]['id']}})[_0x903a('0x9')](function(_0x40b51e){_0x2d8790(_0x40b51e);})['catch'](function(_0x1c7a36){logger[_0x903a('0x10')](_0x903a('0x38'),_0x1c7a36[_0x903a('0x12')]);_0x4000df(_0x7fa776['error'](0x1f4,_0x1c7a36['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6058144..dfb5255 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 _0x88be=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','create','update'];(function(_0x3a4fc5,_0xb5d020){var _0xd0ff8b=function(_0x5a9fd1){while(--_0x5a9fd1){_0x3a4fc5['push'](_0x3a4fc5['shift']());}};_0xd0ff8b(++_0xb5d020);}(_0x88be,0xcb));var _0xe88b=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x88be[_0x3e112d];return _0x531c31;};'use strict';var multer=require('multer');var util=require(_0xe88b('0x0'));var path=require(_0xe88b('0x1'));var timeout=require(_0xe88b('0x2'));var express=require(_0xe88b('0x3'));var router=express[_0xe88b('0x4')]();var fs_extra=require(_0xe88b('0x5'));var auth=require(_0xe88b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe88b('0x7'));var controller=require(_0xe88b('0x8'));router['get']('/',auth[_0xe88b('0x9')](),controller[_0xe88b('0xa')]);router[_0xe88b('0xb')](_0xe88b('0xc'),auth[_0xe88b('0x9')](),controller[_0xe88b('0xd')]);router[_0xe88b('0xe')]('/',auth['isAuthenticated'](),controller[_0xe88b('0xf')]);router['put'](_0xe88b('0xc'),auth[_0xe88b('0x9')](),controller[_0xe88b('0x10')]);router[_0xe88b('0x11')]('/:id',auth[_0xe88b('0x9')](),controller[_0xe88b('0x12')]);module[_0xe88b('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 10566c6..abfa11d 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 _0xb777=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x3e917d,_0x3d93df){var _0x3a5e21=function(_0x1ba681){while(--_0x1ba681){_0x3e917d['push'](_0x3e917d['shift']());}};_0x3a5e21(++_0x3d93df);}(_0xb777,0x107));var _0x7b77=function(_0x21b762,_0xc8ef11){_0x21b762=_0x21b762-0x0;var _0x2ea6d4=_0xb777[_0x21b762];return _0x2ea6d4;};'use strict';var moment=require('moment');var Sequelize=require(_0x7b77('0x0'));module[_0x7b77('0x1')]={'phone':{'type':Sequelize[_0x7b77('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7b77('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x7b77('0x3')],'unique':_0x7b77('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7b77('0x3')],'unique':_0x7b77('0x4')}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0fd0dbc..2059e9c 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 _0xa8a0=['include','findAll','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa8a0,0x9e));var _0x0a8a=function(_0x42c347,_0x22ea23){_0x42c347=_0x42c347-0x0;var _0x27db51=_0xa8a0[_0x42c347];return _0x27db51;};'use strict';var emlformat=require(_0x0a8a('0x0'));var rimraf=require(_0x0a8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a8a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a8a('0x3'));var Mustache=require('mustache');var util=require(_0x0a8a('0x4'));var path=require(_0x0a8a('0x5'));var sox=require(_0x0a8a('0x6'));var csv=require(_0x0a8a('0x7'));var ejs=require(_0x0a8a('0x8'));var fs=require('fs');var fs_extra=require(_0x0a8a('0x9'));var _=require(_0x0a8a('0xa'));var squel=require(_0x0a8a('0xb'));var crypto=require(_0x0a8a('0xc'));var jsforce=require(_0x0a8a('0xd'));var deskjs=require(_0x0a8a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0a8a('0xf'));var Papa=require(_0x0a8a('0x10'));var Redis=require(_0x0a8a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0a8a('0x12'));var hardwareService=require(_0x0a8a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0a8a('0x14'));var config=require(_0x0a8a('0x15'));var licenseUtil=require(_0x0a8a('0x16'));var db=require(_0x0a8a('0x17'))['db'];function respondWithStatusCode(_0x4a102f,_0x176a88){_0x176a88=_0x176a88||0xcc;return function(_0x3aea17){if(_0x3aea17){return _0x4a102f[_0x0a8a('0x18')](_0x176a88);}return _0x4a102f[_0x0a8a('0x19')](_0x176a88)[_0x0a8a('0x1a')]();};}function respondWithResult(_0x2102a4,_0x373fba){_0x373fba=_0x373fba||0xc8;return function(_0x41626e){if(_0x41626e){return _0x2102a4[_0x0a8a('0x19')](_0x373fba)[_0x0a8a('0x1b')](_0x41626e);}};}function respondWithFilteredResult(_0x3a204e,_0x970dd9){return function(_0x2b43cd){if(_0x2b43cd){var _0x4e5f49=typeof _0x970dd9[_0x0a8a('0x1c')]===_0x0a8a('0x1d')&&typeof _0x970dd9[_0x0a8a('0x1e')]==='undefined';var _0xbc0707=_0x2b43cd[_0x0a8a('0x1f')];var _0x299c31=_0x4e5f49?0x0:_0x970dd9[_0x0a8a('0x1c')];var _0x4906c5=_0x4e5f49?_0x2b43cd[_0x0a8a('0x1f')]:_0x970dd9[_0x0a8a('0x1c')]+_0x970dd9[_0x0a8a('0x1e')];var _0x3600e8;if(_0x4906c5>=_0xbc0707){_0x4906c5=_0xbc0707;_0x3600e8=0xc8;}else{_0x3600e8=0xce;}_0x3a204e[_0x0a8a('0x19')](_0x3600e8);return _0x3a204e[_0x0a8a('0x20')](_0x0a8a('0x21'),_0x299c31+'-'+_0x4906c5+'/'+_0xbc0707)[_0x0a8a('0x1b')](_0x2b43cd);}return null;};}function patchUpdates(_0x516c02){return function(_0x52119a){try{jsonpatch[_0x0a8a('0x22')](_0x52119a,_0x516c02,!![]);}catch(_0x337229){return BPromise['reject'](_0x337229);}return _0x52119a[_0x0a8a('0x23')]();};}function saveUpdates(_0x50cb8e,_0x4b6cdb){return function(_0x389b4b){if(_0x389b4b){return _0x389b4b['update'](_0x50cb8e)[_0x0a8a('0x24')](function(_0xf0e7ed){return _0xf0e7ed;});}return null;};}function removeEntity(_0x3fb9e3,_0x573b8d){return function(_0x4b9980){if(_0x4b9980){return _0x4b9980[_0x0a8a('0x25')]()['then'](function(){_0x3fb9e3[_0x0a8a('0x19')](0xcc)[_0x0a8a('0x1a')]();});}};}function handleEntityNotFound(_0x3a4173,_0xbb2b0a){return function(_0x3bd16d){if(!_0x3bd16d){_0x3a4173[_0x0a8a('0x18')](0x194);}return _0x3bd16d;};}function handleError(_0x2b037d,_0x2fa90c){_0x2fa90c=_0x2fa90c||0x1f4;return function(_0x2ccea4){logger['error'](_0x2ccea4[_0x0a8a('0x26')]);if(_0x2ccea4[_0x0a8a('0x27')]){delete _0x2ccea4['name'];}_0x2b037d['status'](_0x2fa90c)[_0x0a8a('0x28')](_0x2ccea4);};}exports[_0x0a8a('0x29')]=function(_0x1a70d5,_0xb08928){var _0x595f56={},_0x11a1ca={},_0xcee84={'count':0x0,'rows':[]};var _0x12d44e=_[_0x0a8a('0x2a')](db[_0x0a8a('0x2b')]['rawAttributes'],function(_0x440fa9){return{'name':_0x440fa9[_0x0a8a('0x2c')],'type':_0x440fa9[_0x0a8a('0x2d')][_0x0a8a('0x2e')]};});_0x11a1ca[_0x0a8a('0x2f')]=_['map'](_0x12d44e,_0x0a8a('0x27'));_0x11a1ca[_0x0a8a('0x30')]=_[_0x0a8a('0x31')](_0x1a70d5['query']);_0x11a1ca[_0x0a8a('0x32')]=_[_0x0a8a('0x33')](_0x11a1ca[_0x0a8a('0x2f')],_0x11a1ca[_0x0a8a('0x30')]);_0x595f56[_0x0a8a('0x34')]=_['intersection'](_0x11a1ca['model'],qs[_0x0a8a('0x35')](_0x1a70d5[_0x0a8a('0x30')][_0x0a8a('0x35')]));_0x595f56[_0x0a8a('0x34')]=_0x595f56['attributes'][_0x0a8a('0x36')]?_0x595f56[_0x0a8a('0x34')]:_0x11a1ca[_0x0a8a('0x2f')];if(!_0x1a70d5['query'][_0x0a8a('0x37')]('nolimit')){_0x595f56[_0x0a8a('0x1e')]=qs[_0x0a8a('0x1e')](_0x1a70d5[_0x0a8a('0x30')][_0x0a8a('0x1e')]);_0x595f56[_0x0a8a('0x1c')]=qs[_0x0a8a('0x1c')](_0x1a70d5[_0x0a8a('0x30')][_0x0a8a('0x1c')]);}_0x595f56['order']=qs[_0x0a8a('0x38')](_0x1a70d5['query'][_0x0a8a('0x38')]);_0x595f56['where']=qs[_0x0a8a('0x32')](_[_0x0a8a('0x39')](_0x1a70d5[_0x0a8a('0x30')],_0x11a1ca[_0x0a8a('0x32')]),_0x12d44e);if(_0x1a70d5['query'][_0x0a8a('0x3a')]){_0x595f56[_0x0a8a('0x3b')]=_[_0x0a8a('0x3c')](_0x595f56[_0x0a8a('0x3b')],{'$or':_[_0x0a8a('0x2a')](_0x12d44e,function(_0x52d230){if(_0x52d230['type']!==_0x0a8a('0x3d')){var _0x3486ea={};_0x3486ea[_0x52d230['name']]={'$like':'%'+_0x1a70d5[_0x0a8a('0x30')][_0x0a8a('0x3a')]+'%'};return _0x3486ea;}})});}_0x595f56=_[_0x0a8a('0x3c')]({},_0x595f56,_0x1a70d5[_0x0a8a('0x3e')]);var _0x3a3fc1={'where':_0x595f56[_0x0a8a('0x3b')]};return db['CmHopperBlack'][_0x0a8a('0x1f')](_0x3a3fc1)[_0x0a8a('0x24')](function(_0x49452f){_0xcee84[_0x0a8a('0x1f')]=_0x49452f;if(_0x1a70d5[_0x0a8a('0x30')][_0x0a8a('0x3f')]){_0x595f56[_0x0a8a('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a8a('0x41')](_0x595f56);})[_0x0a8a('0x24')](function(_0x1a0488){_0xcee84[_0x0a8a('0x42')]=_0x1a0488;return _0xcee84;})[_0x0a8a('0x24')](respondWithFilteredResult(_0xb08928,_0x595f56))[_0x0a8a('0x43')](handleError(_0xb08928,null));};exports[_0x0a8a('0x44')]=function(_0x547fa4,_0x14e7b2){var _0x3ac719={'raw':!![],'where':{'id':_0x547fa4[_0x0a8a('0x45')]['id']}},_0x15da94={};_0x15da94[_0x0a8a('0x2f')]=_['keys'](db[_0x0a8a('0x2b')]['rawAttributes']);_0x15da94[_0x0a8a('0x30')]=_[_0x0a8a('0x31')](_0x547fa4[_0x0a8a('0x30')]);_0x15da94['filters']=_['intersection'](_0x15da94[_0x0a8a('0x2f')],_0x15da94[_0x0a8a('0x30')]);_0x3ac719[_0x0a8a('0x34')]=_[_0x0a8a('0x33')](_0x15da94['model'],qs[_0x0a8a('0x35')](_0x547fa4[_0x0a8a('0x30')][_0x0a8a('0x35')]));_0x3ac719['attributes']=_0x3ac719[_0x0a8a('0x34')][_0x0a8a('0x36')]?_0x3ac719[_0x0a8a('0x34')]:_0x15da94[_0x0a8a('0x2f')];if(_0x547fa4[_0x0a8a('0x30')]['includeAll']){_0x3ac719['include']=[{'all':!![]}];}_0x3ac719=_[_0x0a8a('0x3c')]({},_0x3ac719,_0x547fa4[_0x0a8a('0x3e')]);return db[_0x0a8a('0x2b')][_0x0a8a('0x46')](_0x3ac719)[_0x0a8a('0x24')](handleEntityNotFound(_0x14e7b2,null))['then'](respondWithResult(_0x14e7b2,null))[_0x0a8a('0x43')](handleError(_0x14e7b2,null));};exports[_0x0a8a('0x47')]=function(_0x214e96,_0x470818){if(_0x214e96['body']['id']){delete _0x214e96[_0x0a8a('0x48')]['id'];}return db[_0x0a8a('0x2b')]['find']({'where':{'id':_0x214e96[_0x0a8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x470818,null))['then'](saveUpdates(_0x214e96[_0x0a8a('0x48')],null))[_0x0a8a('0x24')](respondWithResult(_0x470818,null))['catch'](handleError(_0x470818,null));};exports[_0x0a8a('0x25')]=function(_0x3bd125,_0x3f07e3){return db['CmHopperBlack'][_0x0a8a('0x46')]({'where':{'id':_0x3bd125[_0x0a8a('0x45')]['id']}})[_0x0a8a('0x24')](handleEntityNotFound(_0x3f07e3,null))[_0x0a8a('0x24')](removeEntity(_0x3f07e3,null))[_0x0a8a('0x43')](handleError(_0x3f07e3,null));};exports[_0x0a8a('0x49')]=function(_0x43f57d,_0x5d3503){return db[_0x0a8a('0x2b')][_0x0a8a('0x49')]()['then'](respondWithResult(_0x5d3503,null))[_0x0a8a('0x43')](handleError(_0x5d3503,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 046d2c7..cce12d6 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 _0x1386=['exports','define','cm_hopper_black','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x14db66,_0x2afdcd){var _0x186e1a=function(_0x15a2a9){while(--_0x15a2a9){_0x14db66['push'](_0x14db66['shift']());}};_0x186e1a(++_0x2afdcd);}(_0x1386,0x16e));var _0x6138=function(_0x371ad4,_0x4e23f0){_0x371ad4=_0x371ad4-0x0;var _0x796c0b=_0x1386[_0x371ad4];return _0x796c0b;};'use strict';var _=require(_0x6138('0x0'));var util=require(_0x6138('0x1'));var logger=require(_0x6138('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6138('0x3'));var rp=require(_0x6138('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6138('0x5'));var config=require(_0x6138('0x6'));var attributes=require(_0x6138('0x7'));module[_0x6138('0x8')]=function(_0x537a01,_0xbca25f){return _0x537a01[_0x6138('0x9')]('CmHopperBlack',attributes,{'tableName':_0x6138('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index adf1523..4403252 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 _0x195e=['destroy','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','options','raw','where','include','map','model','attributes','UpdateCmHopperBlack','update','limit','then','DestroyCmHopperBlack','CmHopperBlack'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x195e,0x95));var _0xe195=function(_0x19545a,_0x91aad0){_0x19545a=_0x19545a-0x0;var _0x1ffea6=_0x195e[_0x19545a];return _0x1ffea6;};'use strict';var _=require('lodash');var util=require(_0xe195('0x0'));var moment=require('moment');var BPromise=require(_0xe195('0x1'));var rs=require(_0xe195('0x2'));var fs=require('fs');var Redis=require(_0xe195('0x3'));var db=require(_0xe195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe195('0x5'))(_0xe195('0x6'));var config=require('../../config/environment');var jayson=require(_0xe195('0x7'));var client=jayson[_0xe195('0x8')][_0xe195('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaed986,_0x1b4122,_0x65a2a1){return new BPromise(function(_0x37e70f,_0x2a2c13){return client[_0xe195('0xa')](_0xaed986,_0x65a2a1)['then'](function(_0x7fa06){logger[_0xe195('0xb')](_0xe195('0xc'),_0x1b4122,_0xe195('0xd'));logger[_0xe195('0xe')](_0xe195('0xf'),_0x1b4122,_0xe195('0xd'),JSON[_0xe195('0x10')](_0x7fa06));if(_0x7fa06['error']){if(_0x7fa06[_0xe195('0x11')][_0xe195('0x12')]===0x1f4){logger[_0xe195('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x1b4122,_0x7fa06[_0xe195('0x11')][_0xe195('0x13')]);return _0x2a2c13(_0x7fa06[_0xe195('0x11')][_0xe195('0x13')]);}logger[_0xe195('0x11')](_0xe195('0xc'),_0x1b4122,_0x7fa06[_0xe195('0x11')][_0xe195('0x13')]);return _0x37e70f(_0x7fa06[_0xe195('0x11')][_0xe195('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1b4122,'request\x20sent');_0x37e70f(_0x7fa06[_0xe195('0x14')][_0xe195('0x13')]);}})[_0xe195('0x15')](function(_0x1f8fa0){logger[_0xe195('0x11')](_0xe195('0xc'),_0x1b4122,_0x1f8fa0);_0x2a2c13(_0x1f8fa0);});});}exports[_0xe195('0x16')]=function(_0x5717c2){var _0x38638a=this;return new Promise(function(_0x31e98f,_0x3270dd){return db['CmHopperBlack']['findAll']({'raw':_0x5717c2[_0xe195('0x17')]?_0x5717c2['options'][_0xe195('0x18')]===undefined?!![]:![]:!![],'where':_0x5717c2[_0xe195('0x17')]?_0x5717c2[_0xe195('0x17')][_0xe195('0x19')]||null:null,'attributes':_0x5717c2[_0xe195('0x17')]?_0x5717c2['options']['attributes']||null:null,'limit':_0x5717c2[_0xe195('0x17')]?_0x5717c2['options']['limit']||null:null,'include':_0x5717c2[_0xe195('0x17')]?_0x5717c2[_0xe195('0x17')][_0xe195('0x1a')]?_[_0xe195('0x1b')](_0x5717c2[_0xe195('0x17')][_0xe195('0x1a')],function(_0x13a113){return{'model':db[_0x13a113[_0xe195('0x1c')]],'as':_0x13a113['as'],'attributes':_0x13a113[_0xe195('0x1d')],'include':_0x13a113[_0xe195('0x1a')]?_[_0xe195('0x1b')](_0x13a113[_0xe195('0x1a')],function(_0x4f7bbf){return{'model':db[_0x4f7bbf[_0xe195('0x1c')]],'as':_0x4f7bbf['as'],'attributes':_0x4f7bbf[_0xe195('0x1d')],'include':_0x4f7bbf['include']?_['map'](_0x4f7bbf['include'],function(_0x369d88){return{'model':db[_0x369d88['model']],'as':_0x369d88['as'],'attributes':_0x369d88[_0xe195('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x292aae){logger[_0xe195('0xb')](_0xe195('0x16'),_0x5717c2);logger['debug'](_0xe195('0x16'),_0x5717c2,JSON[_0xe195('0x10')](_0x292aae));_0x31e98f(_0x292aae);})[_0xe195('0x15')](function(_0x46aeb4){logger[_0xe195('0x11')](_0xe195('0x16'),_0x46aeb4['message'],_0x5717c2);_0x3270dd(_0x38638a[_0xe195('0x11')](0x1f4,_0x46aeb4[_0xe195('0x13')]));});});};exports[_0xe195('0x1e')]=function(_0x335a18){var _0x22b060=this;return new Promise(function(_0x24a53b,_0x31b20a){return db['CmHopperBlack'][_0xe195('0x1f')](_0x335a18['body'],{'raw':_0x335a18['options']?_0x335a18[_0xe195('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x335a18['options']?_0x335a18['options'][_0xe195('0x19')]||null:null,'attributes':_0x335a18[_0xe195('0x17')]?_0x335a18[_0xe195('0x17')][_0xe195('0x1d')]||null:null,'limit':_0x335a18[_0xe195('0x17')]?_0x335a18[_0xe195('0x17')][_0xe195('0x20')]||null:null})[_0xe195('0x21')](function(_0x2a9cf5){logger[_0xe195('0xb')](_0xe195('0x1e'),_0x335a18);logger['debug']('UpdateCmHopperBlack',_0x335a18,JSON[_0xe195('0x10')](_0x2a9cf5));_0x24a53b(_0x2a9cf5);})[_0xe195('0x15')](function(_0x99eb64){logger[_0xe195('0x11')](_0xe195('0x1e'),_0x99eb64[_0xe195('0x13')],_0x335a18);_0x31b20a(_0x22b060[_0xe195('0x11')](0x1f4,_0x99eb64[_0xe195('0x13')]));});});};exports[_0xe195('0x22')]=function(_0x5bb2fb){var _0x1933a5=this;return new Promise(function(_0x2cde73,_0x2c1f3d){return db[_0xe195('0x23')][_0xe195('0x24')]({'where':_0x5bb2fb[_0xe195('0x17')]?_0x5bb2fb[_0xe195('0x17')][_0xe195('0x19')]||null:null})[_0xe195('0x21')](function(_0x58eec3){logger['info']('DestroyCmHopperBlack',_0x5bb2fb);logger[_0xe195('0xe')](_0xe195('0x22'),_0x5bb2fb,JSON[_0xe195('0x10')](_0x58eec3));_0x2cde73(_0x58eec3);})[_0xe195('0x15')](function(_0x5b712f){logger[_0xe195('0x11')](_0xe195('0x22'),_0x5b712f[_0xe195('0x13')],_0x5bb2fb);_0x2c1f3d(_0x1933a5[_0xe195('0x11')](0x1f4,_0x5b712f['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 47e3ca5..71e7fd6 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 _0xbd51=['/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','put'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x678f61,_0x2fee69){_0x678f61=_0x678f61-0x0;var _0x1880a6=_0xbd51[_0x678f61];return _0x1880a6;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('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(_0x1bd5('0x5'));router[_0x1bd5('0x6')]('/',auth[_0x1bd5('0x7')](),controller['index']);router[_0x1bd5('0x6')](_0x1bd5('0x8'),auth[_0x1bd5('0x7')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0x6')]('/:id',auth[_0x1bd5('0x7')](),controller['show']);router[_0x1bd5('0xa')](_0x1bd5('0xb'),auth[_0x1bd5('0x7')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0xb'),auth['isAuthenticated'](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index ed5848a..8055b1a 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 _0x57f6=['sequelize','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','BOOLEAN'];(function(_0x5c188c,_0x512c6d){var _0x189d62=function(_0x37680f){while(--_0x37680f){_0x5c188c['push'](_0x5c188c['shift']());}};_0x189d62(++_0x512c6d);}(_0x57f6,0x170));var _0x657f=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0x57f6[_0x1bb812];return _0x372adb;};'use strict';var Sequelize=require(_0x657f('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x657f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x657f('0x2')]},'scheduledat':{'type':Sequelize[_0x657f('0x3')]},'countbusyretry':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x657f('0x2')]},'originatecalleridname':{'type':Sequelize[_0x657f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x657f('0x3')]},'responsetime':{'type':Sequelize[_0x657f('0x3')]},'answertime':{'type':Sequelize[_0x657f('0x3')]},'droptime':{'type':Sequelize[_0x657f('0x3')]},'endtime':{'type':Sequelize[_0x657f('0x3')]},'ringtime':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x657f('0x2')]},'campaigntype':{'type':Sequelize[_0x657f('0x2')]},'membername':{'type':Sequelize[_0x657f('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x657f('0x2')]},'secondDisposition':{'type':Sequelize[_0x657f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x657f('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x516ce9){var _0x4c9d16=this[_0x657f('0x4')](_0x657f('0x5'));if(_0x4c9d16&&_0x516ce9){this[_0x657f('0x6')]('followuptime',moment(_0x516ce9)['diff'](moment(_0x4c9d16),'seconds'));}}},'amd':{'type':Sequelize[_0x657f('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0x657f('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x657f('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x657f('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x657f('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x657f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x657f('0x3')]},'recallme':{'type':Sequelize[_0x657f('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x657f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index a08db22..8c75014 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 _0x4975=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','CmHopperFinal','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','noAnswerContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','ANY_VALUE(calleridnum)','phone','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','select'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x4975,0x86));var _0x5497=function(_0x30136d,_0x2a940a){_0x30136d=_0x30136d-0x0;var _0x5654c5=_0x4975[_0x30136d];return _0x5654c5;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':!![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['CmHopperFinal'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['describe']()[_0x5497('0x24')](respondWithResult(_0x466287,null))[_0x5497('0x40')](handleError(_0x466287,null));};exports[_0x5497('0x23')]=function(_0x52a189,_0x3e4da2){if(_0x52a189['body'][_0x5497('0x46')]){delete _0x52a189[_0x5497('0x47')][_0x5497('0x46')];}return db['CmHopperFinal'][_0x5497('0x44')]({'where':{'uniqueid':_0x52a189[_0x5497('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e4da2,null))[_0x5497('0x24')](saveUpdates(_0x52a189['body'],null))[_0x5497('0x24')](respondWithResult(_0x3e4da2,null))['catch'](handleError(_0x3e4da2,null));};exports[_0x5497('0x48')]=function(_0x400860,_0x26fd9f,_0xf07541){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x400860[_0x5497('0x42')]['id']},'attributes':[[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db['sequelize']['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize'][_0x5497('0x4d')]('`state`\x20=\x208,\x201,\x20null'))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x50')))),_0x5497('0x51')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x52')))),_0x5497('0x53')],[db['sequelize']['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5497('0x56')))),_0x5497('0x57')]]})[_0x5497('0x24')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x24')](respondWithResult(_0x26fd9f,null))[_0x5497('0x40')](handleError(_0x26fd9f,null));};exports[_0x5497('0x58')]=function(_0x573f93,_0x18b30c,_0x3b0350){return db[_0x5497('0x3b')][_0x5497('0x3f')]({'raw':![],'where':{'CampaignId':_0x573f93['params']['id']},'attributes':[[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x4a')))),_0x5497('0x4b')],[db[_0x5497('0x49')]['fn']('COUNT',db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5497('0x4e')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x59')))),_0x5497('0x5a')],[db['sequelize']['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')]['literal'](_0x5497('0x5b')))),_0x5497('0x4f')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5497('0x51')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5497('0x53')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db['sequelize']['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x54')))),_0x5497('0x55')],[db[_0x5497('0x49')]['fn'](_0x5497('0x4c'),db[_0x5497('0x49')]['fn']('IF',db[_0x5497('0x49')][_0x5497('0x4d')](_0x5497('0x56')))),_0x5497('0x57')]]})['then'](handleEntityNotFound(_0x18b30c,null))[_0x5497('0x24')](respondWithResult(_0x18b30c,null))[_0x5497('0x40')](handleError(_0x18b30c,null));};exports[_0x5497('0x5c')]=function(_0x4ef195,_0x5794ff,_0x589008){return db[_0x5497('0x5d')][_0x5497('0x44')]({'where':{'id':_0x4ef195['params']['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x5794ff,null))[_0x5497('0x24')](function(_0x21c715){var _0x286af8;if(_0x21c715){_0x286af8=squel['insert']()[_0x5497('0x5e')](_0x5497('0x5f'))[_0x5497('0x60')](['phone',_0x5497('0x61'),_0x5497('0x62'),'ListId',_0x5497('0x63'),_0x5497('0x64'),_0x5497('0x65')],squel['select']()['field'](_0x5497('0x66'),_0x5497('0x67'))[_0x5497('0x68')](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x6d'),_0x5497('0x63'))[_0x5497('0x68')]('NOW()',_0x5497('0x64'))[_0x5497('0x68')]('NOW()',_0x5497('0x65'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4ef195[_0x5497('0x47')][_0x5497('0x73')]['toString']())[_0x5497('0x37')](_0x5497('0x74'))[_0x5497('0x37')](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x67'))['from'](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195[_0x5497('0x42')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5497('0x76'))[_0x5497('0x6e')](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x70'),_0x4ef195['params']['id']['toString']())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x286af8);}return[];})[_0x5497('0x24')](respondWithResult(_0x5794ff,null))[_0x5497('0x40')](handleError(_0x5794ff,null));};exports[_0x5497('0x79')]=function(_0x4c41c4,_0x1515f1,_0x4118ec){return db[_0x5497('0x7a')][_0x5497('0x44')]({'where':{'id':_0x4c41c4[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x1515f1,null))['then'](function(_0x1ef7fc){var _0x5903b7;if(_0x1ef7fc){_0x5903b7=squel[_0x5497('0x7b')]()[_0x5497('0x5e')](_0x5497('0x5f'))['fromQuery'](['phone',_0x5497('0x61'),_0x5497('0x62'),_0x5497('0x6c'),_0x5497('0x7c'),_0x5497('0x64'),_0x5497('0x65')],squel[_0x5497('0x7d')]()[_0x5497('0x68')]('ANY_VALUE(calleridnum)','phone')['field'](_0x5497('0x69'),_0x5497('0x61'))[_0x5497('0x68')](_0x5497('0x6a'),'ContactId')['field'](_0x5497('0x6b'),_0x5497('0x6c'))['field'](_0x5497('0x7e'),_0x5497('0x7c'))[_0x5497('0x68')](_0x5497('0x69'),'createdAt')['field']('NOW()','updatedAt')['from'](_0x5497('0x6f'))['where'](_0x5497('0x7f'),_0x4c41c4['params']['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x72'),_0x4c41c4[_0x5497('0x47')][_0x5497('0x73')][_0x5497('0x71')]())['where'](_0x5497('0x74'))['where'](_0x5497('0x75'),squel[_0x5497('0x7d')]()[_0x5497('0x68')](_0x5497('0x67'))[_0x5497('0x6e')](_0x5497('0x5f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]()))['where'](_0x5497('0x75'),squel['select']()[_0x5497('0x68')](_0x5497('0x76'))['from'](_0x5497('0x6f'))[_0x5497('0x37')](_0x5497('0x7f'),_0x4c41c4[_0x5497('0x42')]['id'][_0x5497('0x71')]())[_0x5497('0x37')](_0x5497('0x77')))[_0x5497('0x78')](_0x5497('0x62')))[_0x5497('0x71')]();return db[_0x5497('0x49')][_0x5497('0x2c')](_0x5903b7);}return[];})[_0x5497('0x24')](respondWithResult(_0x1515f1,null))[_0x5497('0x40')](handleError(_0x1515f1,null));};exports['checkContactHopper']=function(_0x37c17e,_0x163b5b,_0x3a31be){return db[_0x5497('0x80')][_0x5497('0x81')]({'where':{'VoiceQueueId':_0x37c17e['body'][_0x5497('0x63')],'CampaignId':_0x37c17e[_0x5497('0x47')]['CampaignId'],'ContactId':_0x37c17e['body'][_0x5497('0x62')]}})[_0x5497('0x24')](handleEntityNotFound(_0x163b5b,null))[_0x5497('0x24')](function(_0x14f693){if(_0x14f693){return _0x14f693;}return null;})[_0x5497('0x24')](respondWithResult(_0x163b5b,null))['catch'](handleError(_0x163b5b,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e76e7c2..09f347d 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 _0xdf00=['CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0x18ac70,_0x59c0ac){var _0x112f2c=function(_0x10d464){while(--_0x10d464){_0x18ac70['push'](_0x18ac70['shift']());}};_0x112f2c(++_0x59c0ac);}(_0xdf00,0x1a7));var _0x0df0=function(_0x10750c,_0x52d001){_0x10750c=_0x10750c-0x0;var _0x28fce2=_0xdf00[_0x10750c];return _0x28fce2;};'use strict';var _=require(_0x0df0('0x0'));var util=require(_0x0df0('0x1'));var logger=require(_0x0df0('0x2'))('api');var moment=require(_0x0df0('0x3'));var BPromise=require(_0x0df0('0x4'));var rp=require(_0x0df0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0df0('0x6'));var config=require(_0x0df0('0x7'));var attributes=require(_0x0df0('0x8'));module[_0x0df0('0x9')]=function(_0x39d896,_0x27e7ac){return _0x39d896[_0x0df0('0xa')](_0x0df0('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x0df0('0xc')]},{'name':_0x0df0('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index df4c2cc..22f5130 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x5db71b,_0x35c0d1){var _0x142c5c=function(_0x1eea68){while(--_0x1eea68){_0x5db71b['push'](_0x5db71b['shift']());}};_0x142c5c(++_0x35c0d1);}(_0xb10b,0x12a));var _0xbb10=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xb10b[_0x163691];return _0x543ae5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index a4c32b3..cef8450 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 _0x347d=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path'];(function(_0x4e250d,_0x3646fa){var _0x2b819e=function(_0x39a967){while(--_0x39a967){_0x4e250d['push'](_0x4e250d['shift']());}};_0x2b819e(++_0x3646fa);}(_0x347d,0x177));var _0xd347=function(_0x13ed92,_0x4f0392){_0x13ed92=_0x13ed92-0x0;var _0x5ee49b=_0x347d[_0x13ed92];return _0x5ee49b;};'use strict';var multer=require(_0xd347('0x0'));var util=require(_0xd347('0x1'));var path=require(_0xd347('0x2'));var timeout=require(_0xd347('0x3'));var express=require(_0xd347('0x4'));var router=express[_0xd347('0x5')]();var fs_extra=require(_0xd347('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd347('0x7'));var config=require('../../config/environment');var controller=require(_0xd347('0x8'));router[_0xd347('0x9')]('/',auth[_0xd347('0xa')](),controller[_0xd347('0xb')]);router[_0xd347('0x9')](_0xd347('0xc'),auth['isAuthenticated'](),controller[_0xd347('0xd')]);router[_0xd347('0x9')](_0xd347('0xe'),auth['isAuthenticated'](),controller[_0xd347('0xf')]);router[_0xd347('0x9')](_0xd347('0x10'),auth['isAuthenticated'](),controller[_0xd347('0x11')]);router[_0xd347('0x9')](_0xd347('0x12'),auth[_0xd347('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xd347('0x13'),auth[_0xd347('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd347('0x14')](_0xd347('0x15'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xd347('0x14')](_0xd347('0x16'),auth[_0xd347('0xa')](),controller[_0xd347('0x17')]);router[_0xd347('0x18')](_0xd347('0xe'),auth[_0xd347('0xa')](),controller[_0xd347('0x19')]);module[_0xd347('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index db7d37f..823a954 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 _0x2bae=['INTEGER','DATE','STRING','BOOLEAN','sequelize','exports'];(function(_0x12d981,_0x3b1621){var _0x4e0caf=function(_0x59d613){while(--_0x59d613){_0x12d981['push'](_0x12d981['shift']());}};_0x4e0caf(++_0x3b1621);}(_0x2bae,0xe2));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe2ba('0x0'));module[_0xe2ba('0x1')]={'state':{'type':Sequelize[_0xe2ba('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe2ba('0x3')]},'countbusyretry':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe2ba('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe2ba('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe2ba('0x4')]},'calleridname':{'type':Sequelize[_0xe2ba('0x4')]},'starttime':{'type':Sequelize[_0xe2ba('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe2ba('0x3')]},'droptime':{'type':Sequelize[_0xe2ba('0x3')]},'endtime':{'type':Sequelize[_0xe2ba('0x3')]},'ringtime':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe2ba('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe2ba('0x4')]},'reason':{'type':Sequelize[_0xe2ba('0x4')]},'amd':{'type':Sequelize[_0xe2ba('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe2ba('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe2ba('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe2ba('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe2ba('0x3')]},'recallme':{'type':Sequelize[_0xe2ba('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xe2ba('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe2ba('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1db4b44..a9e5e95 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 _0xdbc0=['json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','CmHopperHistory','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','keys','rawAttributes','include','find','catch','create','body','describe','uniqueid','eml-format','bluebird','mustache','path','sox','ejs','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xdbc0,0x140));var _0x0dbc=function(_0x1fe5fc,_0x539b2e){_0x1fe5fc=_0x1fe5fc-0x0;var _0xfcf0f8=_0xdbc0[_0x1fe5fc];return _0xfcf0f8;};'use strict';var emlformat=require(_0x0dbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0dbc('0x1'));var Mustache=require(_0x0dbc('0x2'));var util=require('util');var path=require(_0x0dbc('0x3'));var sox=require(_0x0dbc('0x4'));var csv=require('to-csv');var ejs=require(_0x0dbc('0x5'));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('desk.js');var toCsv=require(_0x0dbc('0x6'));var querystring=require(_0x0dbc('0x7'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0dbc('0x8'));var qs=require(_0x0dbc('0x9'));var as=require(_0x0dbc('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0dbc('0xb'))(_0x0dbc('0xc'));var utils=require(_0x0dbc('0xd'));var config=require(_0x0dbc('0xe'));var licenseUtil=require(_0x0dbc('0xf'));var db=require(_0x0dbc('0x10'))['db'];function respondWithStatusCode(_0x548d50,_0x23fe8d){_0x23fe8d=_0x23fe8d||0xcc;return function(_0xcecabd){if(_0xcecabd){return _0x548d50[_0x0dbc('0x11')](_0x23fe8d);}return _0x548d50[_0x0dbc('0x12')](_0x23fe8d)[_0x0dbc('0x13')]();};}function respondWithResult(_0x87e9c3,_0x288f2c){_0x288f2c=_0x288f2c||0xc8;return function(_0x206660){if(_0x206660){return _0x87e9c3[_0x0dbc('0x12')](_0x288f2c)[_0x0dbc('0x14')](_0x206660);}};}function respondWithFilteredResult(_0x334211,_0x312a4c){return function(_0x41cfe0){if(_0x41cfe0){var _0x3c2121=typeof _0x312a4c[_0x0dbc('0x15')]===_0x0dbc('0x16')&&typeof _0x312a4c[_0x0dbc('0x17')]===_0x0dbc('0x16');var _0x563dd4=_0x41cfe0[_0x0dbc('0x18')];var _0x5ec88c=_0x3c2121?0x0:_0x312a4c[_0x0dbc('0x15')];var _0x13bae9=_0x3c2121?_0x41cfe0[_0x0dbc('0x18')]:_0x312a4c[_0x0dbc('0x15')]+_0x312a4c['limit'];var _0x2ffc57;if(_0x13bae9>=_0x563dd4){_0x13bae9=_0x563dd4;_0x2ffc57=0xc8;}else{_0x2ffc57=0xce;}_0x334211[_0x0dbc('0x12')](_0x2ffc57);return _0x334211['set']('Content-Range',_0x5ec88c+'-'+_0x13bae9+'/'+_0x563dd4)['json'](_0x41cfe0);}return null;};}function patchUpdates(_0x168e35){return function(_0x3f1292){try{jsonpatch[_0x0dbc('0x19')](_0x3f1292,_0x168e35,!![]);}catch(_0x4e9cf5){return BPromise['reject'](_0x4e9cf5);}return _0x3f1292[_0x0dbc('0x1a')]();};}function saveUpdates(_0x30d345,_0x58e947){return function(_0x110e24){if(_0x110e24){return _0x110e24[_0x0dbc('0x1b')](_0x30d345)[_0x0dbc('0x1c')](function(_0x34ffcb){return _0x34ffcb;});}return null;};}function removeEntity(_0x3b42cf,_0xcada39){return function(_0x45901e){if(_0x45901e){return _0x45901e[_0x0dbc('0x1d')]()[_0x0dbc('0x1c')](function(){_0x3b42cf['status'](0xcc)[_0x0dbc('0x13')]();});}};}function handleEntityNotFound(_0x458d61,_0x277ff3){return function(_0x2ea6bd){if(!_0x2ea6bd){_0x458d61['sendStatus'](0x194);}return _0x2ea6bd;};}function handleError(_0x5da06c,_0xd779b3){_0xd779b3=_0xd779b3||0x1f4;return function(_0x34e67f){logger[_0x0dbc('0x1e')](_0x34e67f[_0x0dbc('0x1f')]);if(_0x34e67f[_0x0dbc('0x20')]){delete _0x34e67f[_0x0dbc('0x20')];}_0x5da06c[_0x0dbc('0x12')](_0xd779b3)[_0x0dbc('0x21')](_0x34e67f);};}exports['index']=function(_0x1ebcbc,_0x37639b){var _0x2b412f={},_0x71b06b={},_0x3c34c3={'count':0x0,'rows':[]};var _0x2f2ab8=_['map'](db[_0x0dbc('0x22')]['rawAttributes'],function(_0xedba3a){return{'name':_0xedba3a[_0x0dbc('0x23')],'type':_0xedba3a[_0x0dbc('0x24')][_0x0dbc('0x25')]};});_0x71b06b[_0x0dbc('0x26')]=_[_0x0dbc('0x27')](_0x2f2ab8,'name');_0x71b06b[_0x0dbc('0x28')]=_['keys'](_0x1ebcbc[_0x0dbc('0x28')]);_0x71b06b[_0x0dbc('0x29')]=_[_0x0dbc('0x2a')](_0x71b06b[_0x0dbc('0x26')],_0x71b06b[_0x0dbc('0x28')]);_0x2b412f[_0x0dbc('0x2b')]=_[_0x0dbc('0x2a')](_0x71b06b[_0x0dbc('0x26')],qs[_0x0dbc('0x2c')](_0x1ebcbc['query'][_0x0dbc('0x2c')]));_0x2b412f[_0x0dbc('0x2b')]=_0x2b412f['attributes'][_0x0dbc('0x2d')]?_0x2b412f[_0x0dbc('0x2b')]:_0x71b06b['model'];if(!_0x1ebcbc[_0x0dbc('0x28')][_0x0dbc('0x2e')](_0x0dbc('0x2f'))){_0x2b412f[_0x0dbc('0x17')]=qs[_0x0dbc('0x17')](_0x1ebcbc[_0x0dbc('0x28')]['limit']);_0x2b412f[_0x0dbc('0x15')]=qs[_0x0dbc('0x15')](_0x1ebcbc[_0x0dbc('0x28')]['offset']);}_0x2b412f[_0x0dbc('0x30')]=qs['sort'](_0x1ebcbc[_0x0dbc('0x28')]['sort']);_0x2b412f['where']=qs[_0x0dbc('0x29')](_[_0x0dbc('0x31')](_0x1ebcbc[_0x0dbc('0x28')],_0x71b06b[_0x0dbc('0x29')]),_0x2f2ab8);if(_0x1ebcbc[_0x0dbc('0x28')][_0x0dbc('0x32')]){_0x2b412f['where']=_['merge'](_0x2b412f[_0x0dbc('0x33')],{'$or':_[_0x0dbc('0x27')](_0x2f2ab8,function(_0x2e20a2){if(_0x2e20a2[_0x0dbc('0x24')]!==_0x0dbc('0x34')){var _0x2f51ed={};_0x2f51ed[_0x2e20a2[_0x0dbc('0x20')]]={'$like':'%'+_0x1ebcbc[_0x0dbc('0x28')][_0x0dbc('0x32')]+'%'};return _0x2f51ed;}})});}_0x2b412f=_[_0x0dbc('0x35')]({},_0x2b412f,_0x1ebcbc[_0x0dbc('0x36')]);var _0x914ebc={'where':_0x2b412f['where']};return db['CmHopperHistory'][_0x0dbc('0x18')](_0x914ebc)['then'](function(_0x3af1f4){_0x3c34c3[_0x0dbc('0x18')]=_0x3af1f4;if(_0x1ebcbc[_0x0dbc('0x28')][_0x0dbc('0x37')]){_0x2b412f['include']=[{'all':!![]}];}return db[_0x0dbc('0x22')]['findAll'](_0x2b412f);})[_0x0dbc('0x1c')](function(_0x55c200){_0x3c34c3[_0x0dbc('0x38')]=_0x55c200;return _0x3c34c3;})[_0x0dbc('0x1c')](respondWithFilteredResult(_0x37639b,_0x2b412f))['catch'](handleError(_0x37639b,null));};exports[_0x0dbc('0x39')]=function(_0x138b2f,_0x35e28b){var _0x80ff39={'raw':!![],'where':{'id':_0x138b2f[_0x0dbc('0x3a')]['id']}},_0x568626={};_0x568626[_0x0dbc('0x26')]=_[_0x0dbc('0x3b')](db['CmHopperHistory'][_0x0dbc('0x3c')]);_0x568626[_0x0dbc('0x28')]=_[_0x0dbc('0x3b')](_0x138b2f[_0x0dbc('0x28')]);_0x568626[_0x0dbc('0x29')]=_[_0x0dbc('0x2a')](_0x568626[_0x0dbc('0x26')],_0x568626[_0x0dbc('0x28')]);_0x80ff39[_0x0dbc('0x2b')]=_[_0x0dbc('0x2a')](_0x568626[_0x0dbc('0x26')],qs[_0x0dbc('0x2c')](_0x138b2f[_0x0dbc('0x28')][_0x0dbc('0x2c')]));_0x80ff39[_0x0dbc('0x2b')]=_0x80ff39[_0x0dbc('0x2b')][_0x0dbc('0x2d')]?_0x80ff39[_0x0dbc('0x2b')]:_0x568626[_0x0dbc('0x26')];if(_0x138b2f[_0x0dbc('0x28')]['includeAll']){_0x80ff39[_0x0dbc('0x3d')]=[{'all':!![]}];}_0x80ff39=_[_0x0dbc('0x35')]({},_0x80ff39,_0x138b2f['options']);return db['CmHopperHistory'][_0x0dbc('0x3e')](_0x80ff39)[_0x0dbc('0x1c')](handleEntityNotFound(_0x35e28b,null))[_0x0dbc('0x1c')](respondWithResult(_0x35e28b,null))[_0x0dbc('0x3f')](handleError(_0x35e28b,null));};exports[_0x0dbc('0x40')]=function(_0x456996,_0x8fb463){return db['CmHopperHistory']['create'](_0x456996[_0x0dbc('0x41')],{})[_0x0dbc('0x1c')](respondWithResult(_0x8fb463,0xc9))['catch'](handleError(_0x8fb463,null));};exports[_0x0dbc('0x42')]=function(_0x1bcd95,_0x1757e5){return db[_0x0dbc('0x22')][_0x0dbc('0x42')]()[_0x0dbc('0x1c')](respondWithResult(_0x1757e5,null))[_0x0dbc('0x3f')](handleError(_0x1757e5,null));};exports[_0x0dbc('0x1b')]=function(_0x4a8106,_0x1666b6){if(_0x4a8106[_0x0dbc('0x41')][_0x0dbc('0x43')]){delete _0x4a8106[_0x0dbc('0x41')]['uniqueid'];}return db['CmHopperHistory'][_0x0dbc('0x3e')]({'where':{'uniqueid':_0x4a8106[_0x0dbc('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1666b6,null))[_0x0dbc('0x1c')](saveUpdates(_0x4a8106['body'],null))[_0x0dbc('0x1c')](respondWithResult(_0x1666b6,null))[_0x0dbc('0x3f')](handleError(_0x1666b6,null));}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b45f9ad..e9fade0 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 _0x186d=['CmHopperHistory','endtime','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','define'];(function(_0x382e58,_0x3060d9){var _0x34ef18=function(_0x176a0e){while(--_0x176a0e){_0x382e58['push'](_0x382e58['shift']());}};_0x34ef18(++_0x3060d9);}(_0x186d,0x1ca));var _0xd186=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x186d[_0x4d79bc];return _0x4b4760;};'use strict';var _=require('lodash');var util=require(_0xd186('0x0'));var logger=require(_0xd186('0x1'))(_0xd186('0x2'));var moment=require(_0xd186('0x3'));var BPromise=require(_0xd186('0x4'));var rp=require(_0xd186('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd186('0x6'));var config=require(_0xd186('0x7'));var attributes=require(_0xd186('0x8'));module['exports']=function(_0x5312dd,_0x410c23){return _0x5312dd[_0xd186('0x9')](_0xd186('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xd186('0xb'),'fields':[_0xd186('0xb')]},{'name':_0xd186('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d819360..47976f8 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 _0x257e=['`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','request\x20sent','result','CmHopperHistory','body','options','CreateCmHopperHistory','AvgHandleTime','findAll','raw','where','sequelize','col','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay'];(function(_0x42ec8f,_0x43ac68){var _0x3475e5=function(_0x3e43fa){while(--_0x3e43fa){_0x42ec8f['push'](_0x42ec8f['shift']());}};_0x3475e5(++_0x43ac68);}(_0x257e,0x1dc));var _0xe257=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x257e[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0xe257('0x0'));var moment=require(_0xe257('0x1'));var BPromise=require('bluebird');var rs=require(_0xe257('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe257('0x3'))['db'];var utils=require(_0xe257('0x4'));var logger=require(_0xe257('0x5'))(_0xe257('0x6'));var config=require('../../config/environment');var jayson=require(_0xe257('0x7'));var client=jayson[_0xe257('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278e88,_0x3313e5,_0x28b35c){return new BPromise(function(_0x558a9e,_0x1e839a){return client[_0xe257('0x9')](_0x278e88,_0x28b35c)[_0xe257('0xa')](function(_0x3fe0e1){logger[_0xe257('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x3313e5,'request\x20sent');logger[_0xe257('0xc')](_0xe257('0xd'),_0x3313e5,'request\x20sent',JSON[_0xe257('0xe')](_0x3fe0e1));if(_0x3fe0e1[_0xe257('0xf')]){if(_0x3fe0e1['error'][_0xe257('0x10')]===0x1f4){logger[_0xe257('0xf')](_0xe257('0x11'),_0x3313e5,_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);return _0x1e839a(_0x3fe0e1['error'][_0xe257('0x12')]);}logger[_0xe257('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x3313e5,_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);return _0x558a9e(_0x3fe0e1[_0xe257('0xf')][_0xe257('0x12')]);}else{logger[_0xe257('0xb')](_0xe257('0x11'),_0x3313e5,_0xe257('0x13'));_0x558a9e(_0x3fe0e1[_0xe257('0x14')][_0xe257('0x12')]);}})['catch'](function(_0x9df9de){logger['error'](_0xe257('0x11'),_0x3313e5,_0x9df9de);_0x1e839a(_0x9df9de);});});}exports['CreateCmHopperHistory']=function(_0x481419){var _0x3189b3=this;return new Promise(function(_0x56f1dc,_0x49e150){return db[_0xe257('0x15')]['create'](_0x481419[_0xe257('0x16')],{'raw':_0x481419[_0xe257('0x17')]?_0x481419['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x34033d){logger['info']('CreateCmHopperHistory',_0x481419);logger['debug']('CreateCmHopperHistory',_0x481419,JSON[_0xe257('0xe')](_0x34033d));_0x56f1dc(_0x34033d);})['catch'](function(_0x2a2816){logger[_0xe257('0xf')](_0xe257('0x18'),_0x2a2816[_0xe257('0x12')],_0x481419);_0x49e150(_0x3189b3['error'](0x1f4,_0x2a2816['message']));});});};exports[_0xe257('0x19')]=function(_0x11b467){var _0x59e7fa=this;return new Promise(function(_0x52c528,_0x17be93){return db[_0xe257('0x15')][_0xe257('0x1a')]({'raw':_0x11b467[_0xe257('0x17')]?_0x11b467['options'][_0xe257('0x1b')]===undefined?!![]:![]:!![],'where':_0x11b467[_0xe257('0x17')]?_0x11b467[_0xe257('0x17')][_0xe257('0x1c')]||null:null,'attributes':[[db[_0xe257('0x1d')]['fn']('COUNT',db[_0xe257('0x1d')][_0xe257('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xe257('0x1d')]['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db['sequelize'][_0xe257('0x20')](_0xe257('0x21')))),_0xe257('0x22')],[db['sequelize']['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xe257('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xe257('0x1d')]['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')]['literal'](_0xe257('0x24')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xe257('0x1d')]['fn'](_0xe257('0x25'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xe257('0x25'),db[_0xe257('0x1d')]['fn']('IF',db['sequelize'][_0xe257('0x20')](_0xe257('0x26')))),_0xe257('0x27')]]})[_0xe257('0xa')](function(_0x32d444){logger[_0xe257('0xb')](_0xe257('0x19'),_0x11b467);logger[_0xe257('0xc')](_0xe257('0x19'),_0x11b467,JSON[_0xe257('0xe')](_0x32d444));_0x52c528(_0x32d444);})[_0xe257('0x28')](function(_0x12a9a4){logger[_0xe257('0xf')]('AvgHandleTime',_0x12a9a4['message'],_0x11b467);_0x17be93(_0x59e7fa[_0xe257('0xf')](0x1f4,_0x12a9a4[_0xe257('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x496a5b){var _0x2722af=this;return new Promise(function(_0x182e1f,_0x10ee80){return db[_0xe257('0x15')][_0xe257('0x1a')]({'raw':_0x496a5b[_0xe257('0x17')]?_0x496a5b[_0xe257('0x17')][_0xe257('0x1b')]===undefined?!![]:![]:!![],'where':_0x496a5b[_0xe257('0x17')]?_0x496a5b[_0xe257('0x17')][_0xe257('0x1c')]||null:null,'attributes':[['campaign',_0xe257('0x29')],[db[_0xe257('0x1d')]['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')]['literal'](_0xe257('0x2a')))),_0xe257('0x2b')],[db[_0xe257('0x1d')]['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x2c')))),_0xe257('0x2d')],[db[_0xe257('0x1d')]['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x21')))),'outboundAnswerCallsDay'],[db[_0xe257('0x1d')]['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x2e')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xe257('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xe257('0x1d')]['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db['sequelize'][_0xe257('0x20')](_0xe257('0x30')))),_0xe257('0x31')],[db[_0xe257('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x32')))),_0xe257('0x33')],[db['sequelize']['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')]['literal'](_0xe257('0x34')))),_0xe257('0x35')],[db['sequelize']['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x36')))),_0xe257('0x37')],[db[_0xe257('0x1d')]['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x38')))),'outboundRejectCallsDay'],[db[_0xe257('0x1d')]['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')][_0xe257('0x20')](_0xe257('0x39')))),_0xe257('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xe257('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xe257('0x3b')))),'outboundRejectCallsDay'],[db[_0xe257('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xe257('0x3c')]],'group':[_0xe257('0x3d')]})[_0xe257('0xa')](function(_0x115293){logger[_0xe257('0xb')](_0xe257('0x3e'),_0x496a5b);logger[_0xe257('0xc')](_0xe257('0x3e'),_0x496a5b,JSON['stringify'](_0x115293));_0x182e1f(_0x115293);})[_0xe257('0x28')](function(_0x53a8a0){logger[_0xe257('0xf')]('GetVoiceQueueHopperHistory',_0x53a8a0['message'],_0x496a5b);_0x10ee80(_0x2722af[_0xe257('0xf')](0x1f4,_0x53a8a0[_0xe257('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x553a6c){var _0x175682=this;return new Promise(function(_0x8db909,_0x51292f){return db[_0xe257('0x15')][_0xe257('0x1a')]({'raw':_0x553a6c[_0xe257('0x17')]?_0x553a6c['options'][_0xe257('0x1b')]===undefined?!![]:![]:!![],'where':_0x553a6c[_0xe257('0x17')]?_0x553a6c['options'][_0xe257('0x1c')]||null:null,'attributes':[[_0xe257('0x3d'),_0xe257('0x29')],[db['sequelize']['fn'](_0xe257('0x1f'),db['sequelize'][_0xe257('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0xe257('0x1d')]['fn'](_0xe257('0x1f'),db[_0xe257('0x1d')]['fn']('IF',db[_0xe257('0x1d')]['literal'](_0xe257('0x21')))),_0xe257('0x3f')]],'group':['campaign']})[_0xe257('0xa')](function(_0x43d090){logger['info']('GetCampaignHopperHistory',_0x553a6c);logger[_0xe257('0xc')](_0xe257('0x40'),_0x553a6c,JSON[_0xe257('0xe')](_0x43d090));_0x8db909(_0x43d090);})[_0xe257('0x28')](function(_0x176517){logger['error'](_0xe257('0x40'),_0x176517[_0xe257('0x12')],_0x553a6c);_0x51292f(_0x175682[_0xe257('0xf')](0x1f4,_0x176517[_0xe257('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e0c9462..5332599 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 _0xfc30=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x19d501,_0x364820){var _0x293e33=function(_0x2b4985){while(--_0x2b4985){_0x19d501['push'](_0x19d501['shift']());}};_0x293e33(++_0x364820);}(_0xfc30,0x182));var _0x0fc3=function(_0x575ca3,_0x1b9f90){_0x575ca3=_0x575ca3-0x0;var _0x390135=_0xfc30[_0x575ca3];return _0x390135;};'use strict';var multer=require(_0x0fc3('0x0'));var util=require(_0x0fc3('0x1'));var path=require(_0x0fc3('0x2'));var timeout=require(_0x0fc3('0x3'));var express=require(_0x0fc3('0x4'));var router=express[_0x0fc3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0fc3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0fc3('0x7'));var controller=require(_0x0fc3('0x8'));router[_0x0fc3('0x9')]('/',auth[_0x0fc3('0xa')](),controller[_0x0fc3('0xb')]);router[_0x0fc3('0x9')]('/describe',auth[_0x0fc3('0xa')](),controller[_0x0fc3('0xc')]);router[_0x0fc3('0x9')](_0x0fc3('0xd'),auth[_0x0fc3('0xa')](),controller[_0x0fc3('0xe')]);router[_0x0fc3('0xf')]('/',auth[_0x0fc3('0xa')](),controller[_0x0fc3('0x10')]);router[_0x0fc3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0fc3('0x12')]);module[_0x0fc3('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b44d2cd..8c1467f 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 _0x165d=['STRING','name','sequelize','exports'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x165d,0x14a));var _0xd165=function(_0x19e3c2,_0x24e2cc){_0x19e3c2=_0x19e3c2-0x0;var _0x23abb3=_0x165d[_0x19e3c2];return _0x23abb3;};'use strict';var Sequelize=require(_0xd165('0x0'));module[_0xd165('0x1')]={'name':{'type':Sequelize[_0xd165('0x2')],'unique':_0xd165('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd165('0x2')]},'dialPrefix':{'type':Sequelize[_0xd165('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a748b37..b6db556 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 _0xa6b3=['alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','field','description','description_additionalPhone_','toString','each','/tmp/list_%d_%s.csv','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmList','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','find','userProfileId','autoAssociation','describe','ListId','Disposition','getDispositions','findOne','rawAttributes','ids','addContacts','CmContact','isArray','tags','join','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy'];(function(_0x2c9d5a,_0x31c795){var _0x4b2669=function(_0x3ce120){while(--_0x3ce120){_0x2c9d5a['push'](_0x2c9d5a['shift']());}};_0x4b2669(++_0x31c795);}(_0xa6b3,0x169));var _0x3a6b=function(_0x4a1db1,_0x153f61){_0x4a1db1=_0x4a1db1-0x0;var _0xb55307=_0xa6b3[_0x4a1db1];return _0xb55307;};'use strict';var emlformat=require(_0x3a6b('0x0'));var rimraf=require(_0x3a6b('0x1'));var zipdir=require(_0x3a6b('0x2'));var jsonpatch=require(_0x3a6b('0x3'));var rp=require(_0x3a6b('0x4'));var moment=require(_0x3a6b('0x5'));var BPromise=require(_0x3a6b('0x6'));var Mustache=require(_0x3a6b('0x7'));var util=require(_0x3a6b('0x8'));var path=require(_0x3a6b('0x9'));var sox=require(_0x3a6b('0xa'));var csv=require(_0x3a6b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a6b('0xc'));var _=require(_0x3a6b('0xd'));var squel=require(_0x3a6b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3a6b('0xf'));var toCsv=require(_0x3a6b('0xb'));var querystring=require(_0x3a6b('0x10'));var Papa=require(_0x3a6b('0x11'));var Redis=require('ioredis');var authService=require(_0x3a6b('0x12'));var qs=require(_0x3a6b('0x13'));var as=require(_0x3a6b('0x14'));var hardwareService=require(_0x3a6b('0x15'));var logger=require(_0x3a6b('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3a6b('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x3a6b('0x18')]=_[_0x3a6b('0x19')](config['redis'],{'host':_0x3a6b('0x1a'),'port':0x18eb});var socket=require(_0x3a6b('0x1b'))(new Redis(config['redis']));require(_0x3a6b('0x1c'))[_0x3a6b('0x1d')](socket);function respondWithStatusCode(_0xfaf2f6,_0x28fa79){_0x28fa79=_0x28fa79||0xcc;return function(_0x49bd8e){if(_0x49bd8e){return _0xfaf2f6[_0x3a6b('0x1e')](_0x28fa79);}return _0xfaf2f6[_0x3a6b('0x1f')](_0x28fa79)[_0x3a6b('0x20')]();};}function respondWithResult(_0xe702ce,_0x10caac){_0x10caac=_0x10caac||0xc8;return function(_0x3c2ffc){if(_0x3c2ffc){return _0xe702ce[_0x3a6b('0x1f')](_0x10caac)[_0x3a6b('0x21')](_0x3c2ffc);}};}function respondWithFilteredResult(_0x1db0f6,_0x1861b5){return function(_0x3d9fd7){if(_0x3d9fd7){var _0x4cf8c5=typeof _0x1861b5[_0x3a6b('0x22')]===_0x3a6b('0x23')&&typeof _0x1861b5[_0x3a6b('0x24')]===_0x3a6b('0x23');var _0x213821=_0x3d9fd7[_0x3a6b('0x25')];var _0x53ec4a=_0x4cf8c5?0x0:_0x1861b5[_0x3a6b('0x22')];var _0x339b48=_0x4cf8c5?_0x3d9fd7[_0x3a6b('0x25')]:_0x1861b5['offset']+_0x1861b5[_0x3a6b('0x24')];var _0xccd2ec;if(_0x339b48>=_0x213821){_0x339b48=_0x213821;_0xccd2ec=0xc8;}else{_0xccd2ec=0xce;}_0x1db0f6[_0x3a6b('0x1f')](_0xccd2ec);return _0x1db0f6[_0x3a6b('0x26')](_0x3a6b('0x27'),_0x53ec4a+'-'+_0x339b48+'/'+_0x213821)[_0x3a6b('0x21')](_0x3d9fd7);}return null;};}function patchUpdates(_0x300846){return function(_0x20e58d){try{jsonpatch[_0x3a6b('0x28')](_0x20e58d,_0x300846,!![]);}catch(_0x3ac0a6){return BPromise[_0x3a6b('0x29')](_0x3ac0a6);}return _0x20e58d['save']();};}function saveUpdates(_0x7a7036,_0x4ade58){return function(_0x1188e5){if(_0x1188e5){return _0x1188e5['update'](_0x7a7036)[_0x3a6b('0x2a')](function(_0x7a56d2){return _0x7a56d2;});}return null;};}function removeEntity(_0x104f86,_0x4e9f99){return function(_0x35b3ae){if(_0x35b3ae){return _0x35b3ae['destroy']()['then'](function(){var _0x4fe7fb=_0x35b3ae[_0x3a6b('0x2b')]({'plain':!![]});var _0x2d547e='Lists';return db[_0x3a6b('0x2c')][_0x3a6b('0x2d')]({'where':{'type':_0x2d547e,'resourceId':_0x4fe7fb['id']}})['then'](function(){return _0x35b3ae;});})[_0x3a6b('0x2a')](function(){_0x104f86[_0x3a6b('0x1f')](0xcc)[_0x3a6b('0x20')]();});}};}function handleEntityNotFound(_0x24ef79,_0x52c060){return function(_0x2e3a2f){if(!_0x2e3a2f){_0x24ef79[_0x3a6b('0x1e')](0x194);}return _0x2e3a2f;};}function handleError(_0x5c7ae7,_0x44f2fe){_0x44f2fe=_0x44f2fe||0x1f4;return function(_0x884f0b){logger[_0x3a6b('0x2e')](_0x884f0b[_0x3a6b('0x2f')]);if(_0x884f0b['name']){delete _0x884f0b[_0x3a6b('0x30')];}_0x5c7ae7['status'](_0x44f2fe)['send'](_0x884f0b);};}exports[_0x3a6b('0x31')]=function(_0x1b7e9f,_0x2674f8){var _0x14bed0={},_0x32b39a={},_0x137b52={'count':0x0,'rows':[]};var _0x34f748=_[_0x3a6b('0x32')](db['CmList']['rawAttributes'],function(_0x1b7c21){return{'name':_0x1b7c21[_0x3a6b('0x33')],'type':_0x1b7c21[_0x3a6b('0x34')][_0x3a6b('0x35')]};});_0x32b39a[_0x3a6b('0x36')]=_[_0x3a6b('0x32')](_0x34f748,_0x3a6b('0x30'));_0x32b39a[_0x3a6b('0x37')]=_[_0x3a6b('0x38')](_0x1b7e9f[_0x3a6b('0x37')]);_0x32b39a[_0x3a6b('0x39')]=_[_0x3a6b('0x3a')](_0x32b39a[_0x3a6b('0x36')],_0x32b39a[_0x3a6b('0x37')]);_0x14bed0['attributes']=_[_0x3a6b('0x3a')](_0x32b39a['model'],qs['fields'](_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x3b')]));_0x14bed0[_0x3a6b('0x3c')]=_0x14bed0['attributes'][_0x3a6b('0x3d')]?_0x14bed0['attributes']:_0x32b39a['model'];if(!_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x3e')](_0x3a6b('0x3f'))){_0x14bed0[_0x3a6b('0x24')]=qs['limit'](_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x24')]);_0x14bed0[_0x3a6b('0x22')]=qs[_0x3a6b('0x22')](_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x22')]);}_0x14bed0[_0x3a6b('0x40')]=qs[_0x3a6b('0x41')](_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x41')]);_0x14bed0['where']=qs[_0x3a6b('0x39')](_[_0x3a6b('0x42')](_0x1b7e9f[_0x3a6b('0x37')],_0x32b39a[_0x3a6b('0x39')]),_0x34f748);if(_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x43')]){_0x14bed0[_0x3a6b('0x44')]=_[_0x3a6b('0x45')](_0x14bed0[_0x3a6b('0x44')],{'$or':_[_0x3a6b('0x32')](_0x34f748,function(_0x65dc5f){if(_0x65dc5f[_0x3a6b('0x34')]!==_0x3a6b('0x46')){var _0x2b0a25={};_0x2b0a25[_0x65dc5f[_0x3a6b('0x30')]]={'$like':'%'+_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x43')]+'%'};return _0x2b0a25;}})});}_0x14bed0=_[_0x3a6b('0x45')]({},_0x14bed0,_0x1b7e9f['options']);var _0x491eb0={'where':_0x14bed0[_0x3a6b('0x44')]};return db[_0x3a6b('0x47')][_0x3a6b('0x25')](_0x491eb0)[_0x3a6b('0x2a')](function(_0x22f007){_0x137b52['count']=_0x22f007;if(_0x1b7e9f[_0x3a6b('0x37')][_0x3a6b('0x48')]){_0x14bed0[_0x3a6b('0x49')]=[{'all':!![]}];}return db[_0x3a6b('0x47')][_0x3a6b('0x4a')](_0x14bed0);})[_0x3a6b('0x2a')](function(_0x441efa){_0x137b52[_0x3a6b('0x4b')]=_0x441efa;return _0x137b52;})['then'](respondWithFilteredResult(_0x2674f8,_0x14bed0))[_0x3a6b('0x4c')](handleError(_0x2674f8,null));};exports[_0x3a6b('0x4d')]=function(_0x1a1129,_0x39cdb1){var _0x14f480={'raw':![],'where':{'id':_0x1a1129[_0x3a6b('0x4e')]['id']}},_0x5a3d25={};_0x5a3d25['model']=_[_0x3a6b('0x38')](db['CmList']['rawAttributes']);_0x5a3d25['query']=_[_0x3a6b('0x38')](_0x1a1129['query']);_0x5a3d25[_0x3a6b('0x39')]=_['intersection'](_0x5a3d25['model'],_0x5a3d25[_0x3a6b('0x37')]);_0x14f480['attributes']=_['intersection'](_0x5a3d25[_0x3a6b('0x36')],qs['fields'](_0x1a1129['query'][_0x3a6b('0x3b')]));_0x14f480[_0x3a6b('0x3c')]=_0x14f480[_0x3a6b('0x3c')][_0x3a6b('0x3d')]?_0x14f480[_0x3a6b('0x3c')]:_0x5a3d25[_0x3a6b('0x36')];if(_0x1a1129[_0x3a6b('0x37')]['includeAll']){_0x14f480[_0x3a6b('0x49')]=[{'all':!![]}];}_0x14f480=_['merge']({},_0x14f480,_0x1a1129[_0x3a6b('0x4f')]);return db[_0x3a6b('0x47')]['find'](_0x14f480)[_0x3a6b('0x2a')](handleEntityNotFound(_0x39cdb1,null))['then'](respondWithResult(_0x39cdb1,null))[_0x3a6b('0x4c')](handleError(_0x39cdb1,null));};exports[_0x3a6b('0x50')]=function(_0x18fbdb,_0x5b4d15){return db['CmList']['create'](_0x18fbdb[_0x3a6b('0x51')],{})[_0x3a6b('0x2a')](function(_0x49b857){var _0x205f88=_0x18fbdb[_0x3a6b('0x52')][_0x3a6b('0x2b')]({'plain':!![]});if(!_0x205f88)throw new Error(_0x3a6b('0x53'));if(_0x205f88[_0x3a6b('0x54')]===_0x3a6b('0x52')){var _0x1e44c5=_0x49b857[_0x3a6b('0x2b')]({'plain':!![]});var _0x51e22b=_0x3a6b('0x55');return db[_0x3a6b('0x56')][_0x3a6b('0x57')]({'where':{'name':_0x51e22b,'userProfileId':_0x205f88[_0x3a6b('0x58')]},'raw':!![]})['then'](function(_0x20f3c1){if(_0x20f3c1&&_0x20f3c1[_0x3a6b('0x59')]===0x0){return db['UserProfileResource'][_0x3a6b('0x50')]({'name':_0x1e44c5[_0x3a6b('0x30')],'resourceId':_0x1e44c5['id'],'type':_0x20f3c1[_0x3a6b('0x30')],'sectionId':_0x20f3c1['id']},{})[_0x3a6b('0x2a')](function(){return _0x49b857;});}else{return _0x49b857;}})[_0x3a6b('0x4c')](function(_0x559fc9){logger[_0x3a6b('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x559fc9);throw _0x559fc9;});}return _0x49b857;})[_0x3a6b('0x2a')](respondWithResult(_0x5b4d15,0xc9))[_0x3a6b('0x4c')](handleError(_0x5b4d15,null));};exports['update']=function(_0x46944b,_0x487fe9){if(_0x46944b[_0x3a6b('0x51')]['id']){delete _0x46944b[_0x3a6b('0x51')]['id'];}return db['CmList'][_0x3a6b('0x57')]({'where':{'id':_0x46944b[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x487fe9,null))['then'](saveUpdates(_0x46944b['body'],null))[_0x3a6b('0x2a')](respondWithResult(_0x487fe9,null))[_0x3a6b('0x4c')](handleError(_0x487fe9,null));};exports[_0x3a6b('0x2d')]=function(_0x5891c4,_0x48289c){return db[_0x3a6b('0x47')][_0x3a6b('0x57')]({'where':{'id':_0x5891c4[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x48289c,null))[_0x3a6b('0x2a')](removeEntity(_0x48289c,null))[_0x3a6b('0x4c')](handleError(_0x48289c,null));};exports[_0x3a6b('0x5a')]=function(_0x4ef028,_0x45d34b){return db[_0x3a6b('0x47')][_0x3a6b('0x5a')]()[_0x3a6b('0x2a')](respondWithResult(_0x45d34b,null))['catch'](handleError(_0x45d34b,null));};exports['addDisposition']=function(_0x2f8b48,_0x514e22,_0x5e8330){if(_0x2f8b48[_0x3a6b('0x51')]['id']){delete _0x2f8b48['body']['id'];}return db['CmList']['find']({'where':{'id':_0x2f8b48[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x514e22,null))['then'](function(_0x572181){if(_0x572181){_0x2f8b48['body'][_0x3a6b('0x5b')]=_0x572181['id'];return db[_0x3a6b('0x5c')][_0x3a6b('0x50')](_0x2f8b48[_0x3a6b('0x51')]);}})[_0x3a6b('0x2a')](respondWithResult(_0x514e22,null))[_0x3a6b('0x4c')](handleError(_0x514e22,null));};exports[_0x3a6b('0x5d')]=function(_0x33d965,_0x16674e,_0x12ba87){var _0x512a95={'raw':![],'where':{}};var _0x1bf1c8={};var _0x3bc105={'count':0x0,'rows':[]};return db['CmList'][_0x3a6b('0x5e')]({'where':{'id':_0x33d965[_0x3a6b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16674e,null))['then'](function(_0x4eab15){if(_0x4eab15){_0x1bf1c8[_0x3a6b('0x36')]=_[_0x3a6b('0x38')](db[_0x3a6b('0x5c')][_0x3a6b('0x5f')]);_0x1bf1c8[_0x3a6b('0x37')]=_[_0x3a6b('0x38')](_0x33d965[_0x3a6b('0x37')]);_0x1bf1c8[_0x3a6b('0x39')]=_[_0x3a6b('0x3a')](_0x1bf1c8[_0x3a6b('0x36')],_0x1bf1c8[_0x3a6b('0x37')]);_0x512a95[_0x3a6b('0x3c')]=_[_0x3a6b('0x3a')](_0x1bf1c8[_0x3a6b('0x36')],qs[_0x3a6b('0x3b')](_0x33d965[_0x3a6b('0x37')][_0x3a6b('0x3b')]));_0x512a95['attributes']=_0x512a95[_0x3a6b('0x3c')][_0x3a6b('0x3d')]?_0x512a95[_0x3a6b('0x3c')]:_0x1bf1c8[_0x3a6b('0x36')];if(!_0x33d965[_0x3a6b('0x37')][_0x3a6b('0x3e')]('nolimit')){_0x512a95[_0x3a6b('0x24')]=qs['limit'](_0x33d965[_0x3a6b('0x37')][_0x3a6b('0x24')]);_0x512a95['offset']=qs[_0x3a6b('0x22')](_0x33d965[_0x3a6b('0x37')]['offset']);}_0x512a95['order']=qs[_0x3a6b('0x41')](_0x33d965['query']['sort']);_0x512a95[_0x3a6b('0x44')]=qs[_0x3a6b('0x39')](_[_0x3a6b('0x42')](_0x33d965[_0x3a6b('0x37')],_0x1bf1c8[_0x3a6b('0x39')]));_0x512a95[_0x3a6b('0x44')][_0x3a6b('0x5b')]=_0x4eab15['id'];if(_0x33d965['query'][_0x3a6b('0x43')]){_0x512a95[_0x3a6b('0x44')]=_['merge'](_0x512a95['where'],{'$or':_['map'](_0x512a95[_0x3a6b('0x3c')],function(_0x1ace3f){var _0x9cea7f={};_0x9cea7f[_0x1ace3f]={'$like':'%'+_0x33d965[_0x3a6b('0x37')][_0x3a6b('0x43')]+'%'};return _0x9cea7f;})});}_0x512a95=_[_0x3a6b('0x45')]({},_0x512a95,_0x33d965[_0x3a6b('0x4f')]);return db['Disposition'][_0x3a6b('0x25')]({'where':_0x512a95[_0x3a6b('0x44')]})[_0x3a6b('0x2a')](function(_0x5ea1df){_0x3bc105[_0x3a6b('0x25')]=_0x5ea1df;if(_0x33d965[_0x3a6b('0x37')][_0x3a6b('0x48')]){_0x512a95[_0x3a6b('0x49')]=[{'all':!![]}];}return db[_0x3a6b('0x5c')][_0x3a6b('0x4a')](_0x512a95);})[_0x3a6b('0x2a')](function(_0x4c9f24){_0x3bc105[_0x3a6b('0x4b')]=_0x4c9f24;return _0x3bc105;});}})['then'](respondWithFilteredResult(_0x16674e,_0x512a95))[_0x3a6b('0x4c')](handleError(_0x16674e,null));};exports['removeDispositions']=function(_0x33c7f,_0xb4b28f,_0x42fa62){return db[_0x3a6b('0x47')][_0x3a6b('0x57')]({'where':{'id':_0x33c7f['params']['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0xb4b28f,null))[_0x3a6b('0x2a')](function(_0x44ae74){if(_0x44ae74){return _0x44ae74['removeDispositions'](_0x33c7f[_0x3a6b('0x37')][_0x3a6b('0x60')]);}})[_0x3a6b('0x2a')](respondWithStatusCode(_0xb4b28f,null))[_0x3a6b('0x4c')](handleError(_0xb4b28f,null));};exports[_0x3a6b('0x61')]=function(_0x4f9227,_0x5200ad,_0x5f0208){return db[_0x3a6b('0x47')]['find']({'where':{'id':_0x4f9227[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x5200ad,null))[_0x3a6b('0x2a')](function(_0x2b0add){if(_0x2b0add){var _0x22729f=[];var _0x4587e4={'success':[],'errors':[]};return db[_0x3a6b('0x62')][_0x3a6b('0x5a')]()[_0x3a6b('0x2a')](function(_0x52b5d6){if(_0x4f9227[_0x3a6b('0x51')]['tags']&&_[_0x3a6b('0x63')](_0x4f9227[_0x3a6b('0x51')][_0x3a6b('0x64')])){if(_0x4f9227['body'][_0x3a6b('0x64')]['length']){_0x4f9227[_0x3a6b('0x51')]['tags']=_0x4f9227[_0x3a6b('0x51')][_0x3a6b('0x64')][_0x3a6b('0x65')](';')+';';}else{_0x4f9227[_0x3a6b('0x51')][_0x3a6b('0x64')]=null;}}else{_0x4f9227[_0x3a6b('0x51')][_0x3a6b('0x64')]=null;}if(_0x4f9227[_0x3a6b('0x51')]&&_[_0x3a6b('0x63')](_0x4f9227['body'])){for(var _0x2b9dc5=0x0;_0x2b9dc5<_0x4f9227['body']['length'];_0x2b9dc5+=0x1){_0x4f9227[_0x3a6b('0x51')][_0x2b9dc5][_0x3a6b('0x5b')]=_0x4f9227[_0x3a6b('0x4e')]['id'];_0x22729f[_0x3a6b('0x66')](_0x4f9227[_0x3a6b('0x51')][_0x2b9dc5]);}return BPromise['each'](_0x22729f,function(_0x180e5c){return db[_0x3a6b('0x62')][_0x3a6b('0x50')](_[_0x3a6b('0x67')](_0x180e5c,[_0x3a6b('0x60'),'id'])||{},{'fields':_['keys'](_0x52b5d6),'raw':!![]})[_0x3a6b('0x2a')](function(_0x13a503){_0x4587e4[_0x3a6b('0x68')][_0x3a6b('0x66')](_0x13a503[_0x3a6b('0x69')]);})[_0x3a6b('0x4c')](function(_0x48f86f){_0x4587e4[_0x3a6b('0x6a')][_0x3a6b('0x66')]({'data':_0x180e5c,'error':_0x48f86f[_0x3a6b('0x6b')]});});})['then'](function(_0x5e76b0){return _0x4587e4;})[_0x3a6b('0x4c')](function(_0x358a31){return _0x358a31;});}else{_0x5200ad[_0x3a6b('0x1f')](0x190)[_0x3a6b('0x21')]({'message':_0x3a6b('0x6c')});}});}})[_0x3a6b('0x2a')](respondWithResult(_0x5200ad,null))['catch'](handleError(_0x5200ad,null));};exports[_0x3a6b('0x6d')]=function(_0x55810f,_0x189aa5,_0xeb7697){var _0x95f393;return db[_0x3a6b('0x47')][_0x3a6b('0x57')]({'where':{'id':_0x55810f[_0x3a6b('0x4e')]['id']},'include':[{'model':db[_0x3a6b('0x6e')],'as':_0x3a6b('0x6f')}]})['then'](handleEntityNotFound(_0x189aa5,null))['then'](function(_0x85a615){if(_0x85a615){_0x95f393=_0x85a615;return db['CmContact'][_0x3a6b('0x5f')];}})['then'](function(_0x59422d){if(_0x59422d){var _0x21204e={};var _0x276af2={};_0x276af2[_0x3a6b('0x36')]=_[_0x3a6b('0x70')](_['keys'](_0x59422d),_[_0x3a6b('0x32')](_0x95f393[_0x3a6b('0x6f')],function(_0xdc1e0){return util[_0x3a6b('0x71')](_0x3a6b('0x72'),_0xdc1e0['id']);}));_0x276af2[_0x3a6b('0x37')]=_[_0x3a6b('0x38')](_0x55810f[_0x3a6b('0x37')]);_0x276af2[_0x3a6b('0x39')]=_[_0x3a6b('0x3a')](_0x276af2[_0x3a6b('0x36')],_0x276af2['query']);_0x21204e[_0x3a6b('0x3c')]=_[_0x3a6b('0x3a')](_0x276af2[_0x3a6b('0x36')],qs[_0x3a6b('0x3b')](_0x55810f['query']['fields']));_0x21204e['attributes']=_0x21204e[_0x3a6b('0x3c')][_0x3a6b('0x3d')]?_0x21204e[_0x3a6b('0x3c')]:_0x276af2[_0x3a6b('0x36')];if(!_0x55810f[_0x3a6b('0x37')][_0x3a6b('0x3e')](_0x3a6b('0x3f'))){_0x21204e['limit']=qs['limit'](_0x55810f[_0x3a6b('0x37')][_0x3a6b('0x24')]);_0x21204e[_0x3a6b('0x22')]=qs[_0x3a6b('0x22')](_0x55810f['query'][_0x3a6b('0x22')]);}_0x21204e[_0x3a6b('0x40')]=qs['sort'](_0x55810f['query']['sort']);_0x21204e[_0x3a6b('0x44')]=qs[_0x3a6b('0x39')](_['pick'](_0x55810f[_0x3a6b('0x37')],_0x276af2['filters']));_0x21204e[_0x3a6b('0x73')]=!![];if(_0x55810f[_0x3a6b('0x37')]['filter']){_0x21204e[_0x3a6b('0x44')]=_[_0x3a6b('0x45')](_0x21204e[_0x3a6b('0x44')],{'$or':_[_0x3a6b('0x32')](_0x21204e[_0x3a6b('0x3c')],function(_0x129615){var _0x5cbbd7={};_0x5cbbd7[_0x129615]={'$like':'%'+_0x55810f[_0x3a6b('0x37')]['filter']+'%'};return _0x5cbbd7;})});}_0x21204e=_[_0x3a6b('0x45')]({},_0x21204e,_0x55810f[_0x3a6b('0x4f')]);return _0x95f393[_0x3a6b('0x6d')](_0x21204e);}})[_0x3a6b('0x2a')](respondWithResult(_0x189aa5,null))['catch'](handleError(_0x189aa5,null));};exports[_0x3a6b('0x74')]=function(_0x1147e0,_0x28898a,_0x39f468){var _0x1a6d08;var _0x22e176;var _0x14391a;var _0x1dd300=_0x1147e0[_0x3a6b('0x4e')]['id'];csv_results=[];return db[_0x3a6b('0x75')][_0x3a6b('0x4a')]({'attributes':['id','name'],'raw':!![],'order':[_0x3a6b('0x76')]})['then'](function(_0x506585){_0x1a6d08=_0x506585;var _0x1c2f04=_[_0x3a6b('0x38')](db[_0x3a6b('0x62')][_0x3a6b('0x5f')]);return db[_0x3a6b('0x6e')][_0x3a6b('0x4a')]({'raw':!![],'attributes':['id',_0x3a6b('0x77')]})[_0x3a6b('0x2a')](function(_0x21214e){_0x22e176=_0x21214e;var _0x1e2409=squel[_0x3a6b('0x78')]()['fields'](_0x1c2f04)[_0x3a6b('0x79')](_0x3a6b('0x7a'),'c')[_0x3a6b('0x44')](_0x3a6b('0x7b'),_0x1dd300)[_0x3a6b('0x44')](_0x3a6b('0x7c'))[_0x3a6b('0x7d')]();for(var _0x46c970=0x0;_0x46c970<_0x22e176[_0x3a6b('0x3d')];_0x46c970++){_0x1e2409['field'](_0x3a6b('0x7e')+_0x22e176[_0x46c970]['id'],'customField_'+_0x22e176[_0x46c970][_0x3a6b('0x77')]);}for(var _0x46c970=0x0;_0x46c970<_0x1a6d08['length'];_0x46c970++){_0x1e2409['field'](squel['select']()['field'](_0x3a6b('0x7f'))[_0x3a6b('0x79')](_0x3a6b('0x80'))[_0x3a6b('0x44')](_0x3a6b('0x81'),_0x1a6d08[_0x46c970]['id'])[_0x3a6b('0x44')](_0x3a6b('0x82')),'additionalPhone_'+_0x1a6d08[_0x46c970][_0x3a6b('0x30')]);_0x1e2409['field'](squel[_0x3a6b('0x78')]()[_0x3a6b('0x83')](_0x3a6b('0x84'))[_0x3a6b('0x79')](_0x3a6b('0x80'))[_0x3a6b('0x44')](_0x3a6b('0x81'),_0x1a6d08[_0x46c970]['id'])['where']('CmContactId\x20=\x20c.id'),_0x3a6b('0x85')+_0x1a6d08[_0x46c970][_0x3a6b('0x30')]);}var _0x3705ab=[];_0x3705ab[_0x3a6b('0x66')](_0x1e2409[_0x3a6b('0x86')]());BPromise[_0x3a6b('0x87')](_0x3705ab,handleQuery)[_0x3a6b('0x2a')](function(_0x16c35c){handleQuery(_0x1e2409[_0x3a6b('0x86')]());var _0x39461d=csv_results[0x0];if(!_['isEmpty'](_0x39461d)){var _0x5c9f2e=toCsv(_0x39461d);var _0x2472ad=Date['now']();fs['writeFileSync'](util[_0x3a6b('0x71')](_0x3a6b('0x88'),_0x1dd300,_0x2472ad),_0x5c9f2e);_0x28898a['setHeader']('Content-disposition',_0x3a6b('0x89')+util[_0x3a6b('0x71')]('list_%d_%s.csv',_0x1dd300,_0x2472ad));_0x28898a['setHeader'](_0x3a6b('0x8a'),_0x3a6b('0x8b'));return _0x28898a['download'](util[_0x3a6b('0x71')]('/tmp/list_%d_%s.csv',_0x1dd300,_0x2472ad));}else{return _0x28898a[_0x3a6b('0x1e')](0xcc);}});});});};exports[_0x3a6b('0x8c')]=function(_0x4cd25a,_0x1538e4,_0x408f56){var _0x42858c;delete _0x4cd25a[_0x3a6b('0x51')]['id'];return db[_0x3a6b('0x47')][_0x3a6b('0x5e')]({'where':{'id':_0x4cd25a[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x1538e4,null))[_0x3a6b('0x2a')](function(_0x122f4a){if(_0x122f4a){return db[_0x3a6b('0x8d')][_0x3a6b('0x8e')](function(_0x5f466b){return db['CmCustomField'][_0x3a6b('0x50')](_0x4cd25a['body'],{'transaction':_0x5f466b})[_0x3a6b('0x2a')](function(_0x55dae0){_0x42858c=_0x55dae0;return _0x122f4a['addCustomFields'](_0x55dae0,{'transaction':_0x5f466b});})[_0x3a6b('0x2a')](function(){var _0x3b7c11={'type':db[_0x3a6b('0x8f')]['TEXT'],'transaction':_0x5f466b};switch(_0x4cd25a[_0x3a6b('0x51')]['type']){case'text':_0x3b7c11[_0x3a6b('0x34')]=db[_0x3a6b('0x8f')][_0x3a6b('0x90')];break;case _0x3a6b('0x91'):_0x3b7c11['type']=db[_0x3a6b('0x8f')][_0x3a6b('0x92')];break;case _0x3a6b('0x93'):_0x3b7c11[_0x3a6b('0x34')]=db[_0x3a6b('0x8f')]['BOOLEAN'];_0x3b7c11[_0x3a6b('0x94')]=![];break;default:}return db['sequelize'][_0x3a6b('0x95')][_0x3a6b('0x96')](_0x3a6b('0x7a'),util['format'](_0x3a6b('0x97'),_0x42858c['id']),_0x3b7c11);})['then'](function(){return _0x42858c;});});}})[_0x3a6b('0x2a')](respondWithResult(_0x1538e4,null))[_0x3a6b('0x4c')](handleError(_0x1538e4,null));};exports['getCustomFields']=function(_0x3227e1,_0xc7db09,_0x3e611f){var _0x9b498a={};var _0x49aac0={};var _0x42b424;var _0x348f27;return db[_0x3a6b('0x47')]['findOne']({'where':{'id':_0x3227e1[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0xc7db09,null))[_0x3a6b('0x2a')](function(_0x4528e7){if(_0x4528e7){_0x42b424=_0x4528e7;_0x49aac0[_0x3a6b('0x36')]=_[_0x3a6b('0x38')](db['CmCustomField']['rawAttributes']);_0x49aac0[_0x3a6b('0x37')]=_[_0x3a6b('0x38')](_0x3227e1[_0x3a6b('0x37')]);_0x49aac0[_0x3a6b('0x39')]=_[_0x3a6b('0x3a')](_0x49aac0[_0x3a6b('0x36')],_0x49aac0[_0x3a6b('0x37')]);_0x9b498a[_0x3a6b('0x3c')]=_[_0x3a6b('0x3a')](_0x49aac0[_0x3a6b('0x36')],qs[_0x3a6b('0x3b')](_0x3227e1['query'][_0x3a6b('0x3b')]));_0x9b498a[_0x3a6b('0x3c')]=_0x9b498a['attributes']['length']?_0x9b498a[_0x3a6b('0x3c')]:_0x49aac0[_0x3a6b('0x36')];_0x9b498a[_0x3a6b('0x40')]=qs['sort'](_0x3227e1[_0x3a6b('0x37')][_0x3a6b('0x41')]);_0x9b498a[_0x3a6b('0x44')]=qs[_0x3a6b('0x39')](_[_0x3a6b('0x42')](_0x3227e1['query'],_0x49aac0[_0x3a6b('0x39')]));_0x9b498a[_0x3a6b('0x44')]=_[_0x3a6b('0x45')](_0x9b498a['where'],{'$or':[{'ListId':_0x4528e7['id']},{'ListId':null}]});if(_0x3227e1[_0x3a6b('0x37')][_0x3a6b('0x43')]){_0x9b498a[_0x3a6b('0x44')]=_[_0x3a6b('0x45')](_0x9b498a['where'],{'$or':_['map'](_0x9b498a['attributes'],function(_0x425673){var _0x4029db={};_0x4029db[_0x425673]={'$like':'%'+_0x3227e1[_0x3a6b('0x37')][_0x3a6b('0x43')]+'%'};return _0x4029db;})});}_0x9b498a=_['merge']({},_0x9b498a,_0x3227e1[_0x3a6b('0x4f')]);return db['CmCustomField'][_0x3a6b('0x98')](_0x9b498a);}})[_0x3a6b('0x2a')](respondWithResult(_0xc7db09,null))['catch'](handleError(_0xc7db09,null));};exports['getGlobalCustomFields']=function(_0xbd1331,_0x5f1e84){return db[_0x3a6b('0x6e')][_0x3a6b('0x98')]({'where':{'ListId':null}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x5f1e84,null))[_0x3a6b('0x2a')](function(_0x5cdc01){return _0x5cdc01;})[_0x3a6b('0x2a')](respondWithResult(_0x5f1e84,null))[_0x3a6b('0x4c')](handleError(_0x5f1e84,null));};exports['addAgents']=function(_0x25a439,_0x55636d,_0x46ffec){return db[_0x3a6b('0x47')][_0x3a6b('0x57')]({'where':{'id':_0x25a439[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x55636d,null))['then'](function(_0x5e4717){if(_0x5e4717){return _0x5e4717['addAgents'](_0x25a439[_0x3a6b('0x51')][_0x3a6b('0x60')],_[_0x3a6b('0x67')](_0x25a439['body'],[_0x3a6b('0x60'),'id'])||{})[_0x3a6b('0x99')](function(_0x14ee5d){for(var _0x353338=0x0;_0x353338<_0x25a439[_0x3a6b('0x51')][_0x3a6b('0x60')]['length'];_0x353338+=0x1){socket[_0x3a6b('0x9a')](_0x3a6b('0x9b'),{'UserId':Number(_0x25a439['body'][_0x3a6b('0x60')][_0x353338]),'CmListId':Number(_0x25a439[_0x3a6b('0x4e')]['id'])});}return _0x14ee5d;});}})[_0x3a6b('0x2a')](respondWithResult(_0x55636d,null))[_0x3a6b('0x4c')](handleError(_0x55636d,null));};exports[_0x3a6b('0x9c')]=function(_0x39ff6b,_0x44aab8,_0x429f79){return db[_0x3a6b('0x47')][_0x3a6b('0x57')]({'where':{'id':_0x39ff6b[_0x3a6b('0x4e')]['id']}})[_0x3a6b('0x2a')](handleEntityNotFound(_0x44aab8,null))[_0x3a6b('0x2a')](function(_0x4d8bf3){if(_0x4d8bf3){return _0x4d8bf3[_0x3a6b('0x9c')](_0x39ff6b[_0x3a6b('0x37')]['ids'])[_0x3a6b('0x2a')](function(){if(_[_0x3a6b('0x63')](_0x39ff6b['query']['ids'])){for(var _0x47d023=0x0;_0x47d023<_0x39ff6b['query'][_0x3a6b('0x60')]['length'];_0x47d023+=0x1){socket[_0x3a6b('0x9a')](_0x3a6b('0x9d'),{'UserId':Number(_0x39ff6b[_0x3a6b('0x37')][_0x3a6b('0x60')][_0x47d023]),'CmListId':Number(_0x39ff6b[_0x3a6b('0x4e')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x39ff6b[_0x3a6b('0x37')][_0x3a6b('0x60')]),'CmListId':Number(_0x39ff6b['params']['id'])});}});}})[_0x3a6b('0x2a')](respondWithStatusCode(_0x44aab8,null))['catch'](handleError(_0x44aab8,null));};exports[_0x3a6b('0x9e')]=function(_0x25bb94,_0x5d04cb,_0x1c0b55){var _0x1e22eb={};var _0x3dd3a2={};var _0x2598e2;var _0x59d6ae;return db['CmList'][_0x3a6b('0x5e')]({'where':{'id':_0x25bb94['params']['id']}})['then'](handleEntityNotFound(_0x5d04cb,null))[_0x3a6b('0x2a')](function(_0x2114fa){if(_0x2114fa){_0x2598e2=_0x2114fa;_0x3dd3a2[_0x3a6b('0x36')]=_[_0x3a6b('0x38')](db['User']['rawAttributes']);_0x3dd3a2[_0x3a6b('0x37')]=_[_0x3a6b('0x38')](_0x25bb94['query']);_0x3dd3a2[_0x3a6b('0x39')]=_['intersection'](_0x3dd3a2[_0x3a6b('0x36')],_0x3dd3a2[_0x3a6b('0x37')]);_0x1e22eb[_0x3a6b('0x3c')]=_[_0x3a6b('0x3a')](_0x3dd3a2[_0x3a6b('0x36')],qs['fields'](_0x25bb94['query']['fields']));_0x1e22eb[_0x3a6b('0x3c')]=_0x1e22eb[_0x3a6b('0x3c')][_0x3a6b('0x3d')]?_0x1e22eb['attributes']:_0x3dd3a2[_0x3a6b('0x36')];_0x1e22eb[_0x3a6b('0x40')]=qs[_0x3a6b('0x41')](_0x25bb94[_0x3a6b('0x37')]['sort']);_0x1e22eb[_0x3a6b('0x44')]=qs[_0x3a6b('0x39')](_[_0x3a6b('0x42')](_0x25bb94[_0x3a6b('0x37')],_0x3dd3a2['filters']));if(_0x25bb94[_0x3a6b('0x37')][_0x3a6b('0x43')]){_0x1e22eb[_0x3a6b('0x44')]=_[_0x3a6b('0x45')](_0x1e22eb['where'],{'$or':_[_0x3a6b('0x32')](_0x1e22eb['attributes'],function(_0x24beeb){var _0x4893ea={};_0x4893ea[_0x24beeb]={'$like':'%'+_0x25bb94[_0x3a6b('0x37')]['filter']+'%'};return _0x4893ea;})});}_0x1e22eb=_[_0x3a6b('0x45')]({},_0x1e22eb,_0x25bb94[_0x3a6b('0x4f')]);return _0x2598e2[_0x3a6b('0x9e')](_0x1e22eb);}})[_0x3a6b('0x2a')](function(_0x2e2622){if(_0x2e2622){_0x59d6ae=_0x2e2622[_0x3a6b('0x3d')];if(!_0x25bb94['query'][_0x3a6b('0x3e')]('nolimit')){_0x1e22eb[_0x3a6b('0x24')]=qs[_0x3a6b('0x24')](_0x25bb94[_0x3a6b('0x37')]['limit']);_0x1e22eb[_0x3a6b('0x22')]=qs[_0x3a6b('0x22')](_0x25bb94[_0x3a6b('0x37')][_0x3a6b('0x22')]);}return _0x2598e2[_0x3a6b('0x9e')](_0x1e22eb);}})[_0x3a6b('0x2a')](function(_0x1e9751){if(_0x1e9751){return _0x1e9751?{'count':_0x59d6ae,'rows':_0x1e9751}:null;}})[_0x3a6b('0x2a')](respondWithResult(_0x5d04cb,null))[_0x3a6b('0x4c')](handleError(_0x5d04cb,null));};function handleQuery(_0x125ef4){logger[_0x3a6b('0x9f')](_0x125ef4);return db[_0x3a6b('0x8d')][_0x3a6b('0x37')](_0x125ef4)['spread'](function(_0x48c583){csv_results['push'](_0x48c583);})[_0x3a6b('0x4c')](function(_0x26137a){logger['error'](_0x26137a[_0x3a6b('0x6b')]);});} \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 816d3ad..ae5a9d8 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x56e64f,_0x4b7c63){var _0x88e7d0=function(_0x4c58bc){while(--_0x4c58bc){_0x56e64f['push'](_0x56e64f['shift']());}};_0x88e7d0(++_0x4b7c63);}(_0x814b,0x1a2));var _0xb814=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x814b[_0x5d6e30];return _0x3d3f3b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 27c9416..3c06418 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 _0x4ea3=['CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','./cmList.attributes','exports','define'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x4ea3,0x70));var _0x34ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4ea3[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index c54fd2b..d442db5 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 _0x7c49=['./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x7c49,0xed));var _0x97c4=function(_0x4e8da0,_0x22b3f3){_0x4e8da0=_0x4e8da0-0x0;var _0x3cdea4=_0x7c49[_0x4e8da0];return _0x3cdea4;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var moment=require(_0x97c4('0x2'));var BPromise=require(_0x97c4('0x3'));var rs=require(_0x97c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97c4('0x5'))['db'];var utils=require(_0x97c4('0x6'));var logger=require('../../config/logger')(_0x97c4('0x7'));var config=require(_0x97c4('0x8'));var jayson=require(_0x97c4('0x9'));var client=jayson[_0x97c4('0xa')]['http']({'port':0x232a});config[_0x97c4('0xb')]=_[_0x97c4('0xc')](config[_0x97c4('0xb')],{'host':_0x97c4('0xd'),'port':0x18eb});var socket=require(_0x97c4('0xe'))(new Redis(config['redis']));require(_0x97c4('0xf'))[_0x97c4('0x10')](socket);function respondWithRpcPromise(_0x2aa5f7,_0x40ccdc,_0xbd1eb6){return new BPromise(function(_0x42a3e3,_0x2509a9){return client[_0x97c4('0x11')](_0x2aa5f7,_0xbd1eb6)['then'](function(_0x54442b){logger[_0x97c4('0x12')]('CmList,\x20%s,\x20%s',_0x40ccdc,_0x97c4('0x13'));logger[_0x97c4('0x14')](_0x97c4('0x15'),_0x40ccdc,_0x97c4('0x13'),JSON[_0x97c4('0x16')](_0x54442b));if(_0x54442b[_0x97c4('0x17')]){if(_0x54442b[_0x97c4('0x17')][_0x97c4('0x18')]===0x1f4){logger[_0x97c4('0x17')](_0x97c4('0x19'),_0x40ccdc,_0x54442b[_0x97c4('0x17')][_0x97c4('0x1a')]);return _0x2509a9(_0x54442b[_0x97c4('0x17')][_0x97c4('0x1a')]);}logger[_0x97c4('0x17')]('CmList,\x20%s,\x20%s',_0x40ccdc,_0x54442b[_0x97c4('0x17')][_0x97c4('0x1a')]);return _0x42a3e3(_0x54442b[_0x97c4('0x17')][_0x97c4('0x1a')]);}else{logger[_0x97c4('0x12')](_0x97c4('0x19'),_0x40ccdc,_0x97c4('0x13'));_0x42a3e3(_0x54442b['result'][_0x97c4('0x1a')]);}})[_0x97c4('0x1b')](function(_0xf65705){logger[_0x97c4('0x17')](_0x97c4('0x19'),_0x40ccdc,_0xf65705);_0x2509a9(_0xf65705);});});} \ No newline at end of file +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 diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6e2aaac..31f0af3 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 _0xea41=['register','./cmList.events','save','remove','update','emit','removeListener'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0xea41,0x13c));var _0x1ea4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xea41[_0x3bf83f];return _0x22c4a9;};'use strict';var CmListEvents=require(_0x1ea4('0x0'));var events=[_0x1ea4('0x1'),_0x1ea4('0x2'),_0x1ea4('0x3')];function createListener(_0x289f16,_0xde0d63){return function(_0x41d7b2){_0xde0d63[_0x1ea4('0x4')](_0x289f16,_0x41d7b2);};}function removeListener(_0xb10a53,_0x111146){return function(){CmListEvents[_0x1ea4('0x5')](_0xb10a53,_0x111146);};}exports[_0x1ea4('0x6')]=function(_0x19ce5f){for(var _0xa1aee8=0x0,_0x5b1814=events['length'];_0xa1aee8<_0x5b1814;_0xa1aee8++){var _0x3b75d2=events[_0xa1aee8];var _0x19173b=createListener('cmList:'+_0x3b75d2,_0x19ce5f);CmListEvents['on'](_0x3b75d2,_0x19173b);}}; \ No newline at end of file +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 diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ce02d2f..e1f7528 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 _0xd116=['show','/:id/dispositions','getContacts','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','update','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','/:id'];(function(_0x4c932b,_0x3411a3){var _0x3f73c3=function(_0x59b485){while(--_0x59b485){_0x4c932b['push'](_0x4c932b['shift']());}};_0x3f73c3(++_0x3411a3);}(_0xd116,0x6a));var _0x6d11=function(_0x2ce52e,_0x184a4f){_0x2ce52e=_0x2ce52e-0x0;var _0x415607=_0xd116[_0x2ce52e];return _0x415607;};'use strict';var multer=require(_0x6d11('0x0'));var util=require(_0x6d11('0x1'));var path=require(_0x6d11('0x2'));var timeout=require(_0x6d11('0x3'));var express=require(_0x6d11('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d11('0x5'));var config=require('../../config/environment');var controller=require(_0x6d11('0x6'));router[_0x6d11('0x7')]('/',auth[_0x6d11('0x8')](),controller[_0x6d11('0x9')]);router[_0x6d11('0x7')](_0x6d11('0xa'),auth[_0x6d11('0x8')](),controller[_0x6d11('0xb')]);router['get'](_0x6d11('0xc'),auth[_0x6d11('0x8')](),controller['getGlobalCustomFields']);router[_0x6d11('0x7')](_0x6d11('0xd'),auth['isAuthenticated'](),controller[_0x6d11('0xe')]);router['get'](_0x6d11('0xf'),auth[_0x6d11('0x8')](),controller['getDispositions']);router['get']('/:id/contacts',auth[_0x6d11('0x8')](),controller[_0x6d11('0x10')]);router[_0x6d11('0x7')]('/:id/contacts/csv',auth[_0x6d11('0x8')](),controller[_0x6d11('0x11')]);router[_0x6d11('0x7')](_0x6d11('0x12'),auth[_0x6d11('0x8')](),controller['getCustomFields']);router['get'](_0x6d11('0x13'),auth[_0x6d11('0x8')](),controller[_0x6d11('0x14')]);router[_0x6d11('0x15')]('/',auth[_0x6d11('0x8')](),controller[_0x6d11('0x16')]);router[_0x6d11('0x15')](_0x6d11('0xf'),auth['isAuthenticated'](),controller[_0x6d11('0x17')]);router[_0x6d11('0x15')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x6d11('0x18')]);router[_0x6d11('0x15')](_0x6d11('0x12'),auth['isAuthenticated'](),controller[_0x6d11('0x19')]);router[_0x6d11('0x15')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x6d11('0xd'),auth[_0x6d11('0x8')](),controller[_0x6d11('0x1a')]);router[_0x6d11('0x1b')](_0x6d11('0xd'),auth[_0x6d11('0x8')](),controller['destroy']);router['delete'](_0x6d11('0xf'),auth['isAuthenticated'](),controller[_0x6d11('0x1c')]);router[_0x6d11('0x1b')](_0x6d11('0x13'),auth[_0x6d11('0x8')](),controller[_0x6d11('0x1d')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 074e817..786cb0f 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 _0x2c1c=['sequelize','VIRTUAL','field','STRING'];(function(_0x1b1948,_0x49f451){var _0x3cbd38=function(_0x2ca4f2){while(--_0x2ca4f2){_0x1b1948['push'](_0x1b1948['shift']());}};_0x3cbd38(++_0x49f451);}(_0x2c1c,0xc8));var _0xc2c1=function(_0x7d261d,_0x4e1d2f){_0x7d261d=_0x7d261d-0x0;var _0x1a992a=_0x2c1c[_0x7d261d];return _0x1a992a;};'use strict';var Sequelize=require(_0xc2c1('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2c1('0x1')],'get':function(_0x332f65){return this['getDataValue'](_0xc2c1('0x2'));}},'field':{'type':Sequelize[_0xc2c1('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xc2c1('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0edcfc1..e3b130b 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(_0x26e1d4,_0x7e2a6f){var _0xeffe9c=function(_0x1612f2){while(--_0x1612f2){_0x26e1d4['push'](_0x26e1d4['shift']());}};_0xeffe9c(++_0x7e2a6f);}(_0x7a54,0x106));var _0x47a5=function(_0x41f7f3,_0x3d1ebb){_0x41f7f3=_0x41f7f3-0x0;var _0x4de719=_0x7a54[_0x41f7f3];return _0x4de719;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2822daf..cb39f98 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 _0xb12d=['Condition','tools_conditions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb12d,0x84));var _0xdb12=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xb12d[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var logger=require('../../config/logger')(_0xdb12('0x2'));var moment=require(_0xdb12('0x3'));var BPromise=require(_0xdb12('0x4'));var rp=require(_0xdb12('0x5'));var fs=require('fs');var path=require(_0xdb12('0x6'));var rimraf=require(_0xdb12('0x7'));var config=require(_0xdb12('0x8'));var attributes=require(_0xdb12('0x9'));module['exports']=function(_0x1e64de,_0x539e59){return _0x1e64de[_0xdb12('0xa')](_0xdb12('0xb'),attributes,{'tableName':_0xdb12('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index f5ff783..6c32ef0 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 _0xa1b0=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa1b0,0x7e));var _0x0a1b=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xa1b0[_0x4c0622];return _0x1799d8;};'use strict';var _=require(_0x0a1b('0x0'));var util=require(_0x0a1b('0x1'));var moment=require(_0x0a1b('0x2'));var BPromise=require(_0x0a1b('0x3'));var rs=require(_0x0a1b('0x4'));var fs=require('fs');var Redis=require(_0x0a1b('0x5'));var db=require(_0x0a1b('0x6'))['db'];var utils=require(_0x0a1b('0x7'));var logger=require('../../config/logger')(_0x0a1b('0x8'));var config=require('../../config/environment');var jayson=require(_0x0a1b('0x9'));var client=jayson[_0x0a1b('0xa')][_0x0a1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1be903,_0x2f3cbb,_0x1cfc5e){return new BPromise(function(_0x38aaec,_0x73117){return client[_0x0a1b('0xc')](_0x1be903,_0x1cfc5e)['then'](function(_0x5205f2){logger['info']('Condition,\x20%s,\x20%s',_0x2f3cbb,_0x0a1b('0xd'));logger['debug'](_0x0a1b('0xe'),_0x2f3cbb,_0x0a1b('0xd'),JSON[_0x0a1b('0xf')](_0x5205f2));if(_0x5205f2[_0x0a1b('0x10')]){if(_0x5205f2[_0x0a1b('0x10')][_0x0a1b('0x11')]===0x1f4){logger[_0x0a1b('0x10')](_0x0a1b('0x12'),_0x2f3cbb,_0x5205f2['error'][_0x0a1b('0x13')]);return _0x73117(_0x5205f2[_0x0a1b('0x10')][_0x0a1b('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x2f3cbb,_0x5205f2[_0x0a1b('0x10')]['message']);return _0x38aaec(_0x5205f2[_0x0a1b('0x10')]['message']);}else{logger[_0x0a1b('0x14')](_0x0a1b('0x12'),_0x2f3cbb,_0x0a1b('0xd'));_0x38aaec(_0x5205f2[_0x0a1b('0x15')][_0x0a1b('0x13')]);}})['catch'](function(_0x205cad){logger[_0x0a1b('0x10')](_0x0a1b('0x12'),_0x2f3cbb,_0x205cad);_0x73117(_0x205cad);});});} \ No newline at end of file +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 diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 49cd05a..e4ea53b 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 _0x75d4=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete'];(function(_0x4421bc,_0x3de4c1){var _0x4df57b=function(_0xca5f19){while(--_0xca5f19){_0x4421bc['push'](_0x4421bc['shift']());}};_0x4df57b(++_0x3de4c1);}(_0x75d4,0x112));var _0x475d=function(_0x42a6d9,_0x3e629e){_0x42a6d9=_0x42a6d9-0x0;var _0x2a20bf=_0x75d4[_0x42a6d9];return _0x2a20bf;};'use strict';var multer=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var path=require('path');var timeout=require(_0x475d('0x2'));var express=require(_0x475d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x475d('0x4'));var interaction=require(_0x475d('0x5'));var config=require('../../config/environment');var controller=require(_0x475d('0x6'));router[_0x475d('0x7')](_0x475d('0x8'),auth[_0x475d('0x9')](),controller[_0x475d('0xa')]);router[_0x475d('0xb')](_0x475d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x475d('0xc')]=router; \ No newline at end of file +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 diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index fafe279..e8bf259 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 _0xecf3=['STRING','name','INTEGER'];(function(_0x28e4ea,_0x4856fd){var _0x545c63=function(_0x1a6471){while(--_0x1a6471){_0x28e4ea['push'](_0x28e4ea['shift']());}};_0x545c63(++_0x4856fd);}(_0xecf3,0x66));var _0x3ecf=function(_0x1a8672,_0x4ead1a){_0x1a8672=_0x1a8672-0x0;var _0xc58aa=_0xecf3[_0x1a8672];return _0xc58aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3ecf('0x0')],'allowNull':![],'unique':_0x3ecf('0x1')},'OrderBy':{'type':Sequelize[_0x3ecf('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +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 diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 8bfd877..d69fd04 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 _0x6d11=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x6d11,0xbf));var _0x16d1=function(_0x37860d,_0x39139b){_0x37860d=_0x37860d-0x0;var _0x3a6fe9=_0x6d11[_0x37860d];return _0x3a6fe9;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){var _0x21e122=_0x215c23[_0x16d1('0x24')]({'plain':!![]});var _0x335c24=_0x16d1('0x25');return db[_0x16d1('0x26')][_0x16d1('0x23')]({'where':{'type':_0x335c24,'resourceId':_0x21e122['id']}})[_0x16d1('0x22')](function(){return _0x215c23;});})[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ae4e,_0x440a47){return function(_0x4257f1){if(!_0x4257f1){_0x25ae4e['sendStatus'](0x194);}return _0x4257f1;};}function handleError(_0x28837c,_0x1deb1e){_0x1deb1e=_0x1deb1e||0x1f4;return function(_0x364bf7){logger[_0x16d1('0x27')](_0x364bf7[_0x16d1('0x28')]);if(_0x364bf7[_0x16d1('0x29')]){delete _0x364bf7[_0x16d1('0x29')];}_0x28837c['status'](_0x1deb1e)[_0x16d1('0x2a')](_0x364bf7);};}exports[_0x16d1('0x2b')]=function(_0x31c4e9,_0x30cd8f){var _0x55c021={},_0x4b27f6={},_0x2f16ee={'count':0x0,'rows':[]};var _0x4ab3d4=_[_0x16d1('0x2c')](db[_0x16d1('0x2d')][_0x16d1('0x2e')],function(_0x2b4dbd){return{'name':_0x2b4dbd[_0x16d1('0x2f')],'type':_0x2b4dbd[_0x16d1('0x30')][_0x16d1('0x31')]};});_0x4b27f6[_0x16d1('0x32')]=_[_0x16d1('0x2c')](_0x4ab3d4,_0x16d1('0x29'));_0x4b27f6[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x31c4e9['query']);_0x4b27f6[_0x16d1('0x35')]=_['intersection'](_0x4b27f6[_0x16d1('0x32')],_0x4b27f6[_0x16d1('0x33')]);_0x55c021[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x4b27f6[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x31c4e9['query']['fields']));_0x55c021['attributes']=_0x55c021[_0x16d1('0x36')][_0x16d1('0x39')]?_0x55c021[_0x16d1('0x36')]:_0x4b27f6[_0x16d1('0x32')];if(!_0x31c4e9['query'][_0x16d1('0x3a')](_0x16d1('0x3b'))){_0x55c021['limit']=qs['limit'](_0x31c4e9['query'][_0x16d1('0x1f')]);_0x55c021[_0x16d1('0x1d')]=qs[_0x16d1('0x1d')](_0x31c4e9['query'][_0x16d1('0x1d')]);}_0x55c021[_0x16d1('0x3c')]=qs[_0x16d1('0x3d')](_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3d')]);_0x55c021[_0x16d1('0x3e')]=qs[_0x16d1('0x35')](_['pick'](_0x31c4e9['query'],_0x4b27f6['filters']),_0x4ab3d4);if(_0x31c4e9[_0x16d1('0x33')][_0x16d1('0x3f')]){_0x55c021[_0x16d1('0x3e')]=_[_0x16d1('0x40')](_0x55c021[_0x16d1('0x3e')],{'$or':_[_0x16d1('0x2c')](_0x4ab3d4,function(_0x364c39){if(_0x364c39[_0x16d1('0x30')]!=='VIRTUAL'){var _0x180f55={};_0x180f55[_0x364c39['name']]={'$like':'%'+_0x31c4e9['query'][_0x16d1('0x3f')]+'%'};return _0x180f55;}})});}_0x55c021=_[_0x16d1('0x40')]({},_0x55c021,_0x31c4e9[_0x16d1('0x41')]);var _0x3a0343={'where':_0x55c021[_0x16d1('0x3e')]};return db[_0x16d1('0x2d')]['count'](_0x3a0343)[_0x16d1('0x22')](function(_0x525212){_0x2f16ee['count']=_0x525212;if(_0x31c4e9['query']['includeAll']){_0x55c021[_0x16d1('0x42')]=[{'all':!![]}];}return db[_0x16d1('0x2d')][_0x16d1('0x43')](_0x55c021);})[_0x16d1('0x22')](function(_0x53de06){_0x2f16ee[_0x16d1('0x44')]=_0x53de06;return _0x2f16ee;})['then'](respondWithFilteredResult(_0x30cd8f,_0x55c021))[_0x16d1('0x45')](handleError(_0x30cd8f,null));};exports[_0x16d1('0x46')]=function(_0x19ac7c,_0x2e4971){var _0x1a109d={'raw':!![],'where':{'id':_0x19ac7c[_0x16d1('0x47')]['id']}},_0x116f51={};_0x116f51[_0x16d1('0x32')]=_[_0x16d1('0x34')](db[_0x16d1('0x2d')][_0x16d1('0x2e')]);_0x116f51[_0x16d1('0x33')]=_[_0x16d1('0x34')](_0x19ac7c[_0x16d1('0x33')]);_0x116f51[_0x16d1('0x35')]=_['intersection'](_0x116f51['model'],_0x116f51[_0x16d1('0x33')]);_0x1a109d[_0x16d1('0x36')]=_[_0x16d1('0x37')](_0x116f51[_0x16d1('0x32')],qs[_0x16d1('0x38')](_0x19ac7c[_0x16d1('0x33')]['fields']));_0x1a109d[_0x16d1('0x36')]=_0x1a109d[_0x16d1('0x36')][_0x16d1('0x39')]?_0x1a109d['attributes']:_0x116f51['model'];if(_0x19ac7c[_0x16d1('0x33')][_0x16d1('0x48')]){_0x1a109d['include']=[{'all':!![]}];}_0x1a109d=_[_0x16d1('0x40')]({},_0x1a109d,_0x19ac7c['options']);return db[_0x16d1('0x2d')][_0x16d1('0x49')](_0x1a109d)[_0x16d1('0x22')](handleEntityNotFound(_0x2e4971,null))[_0x16d1('0x22')](respondWithResult(_0x2e4971,null))['catch'](handleError(_0x2e4971,null));};exports['create']=function(_0x1d92cd,_0x8bb0c1){return db['ContactItemType'][_0x16d1('0x4a')](_0x1d92cd[_0x16d1('0x4b')],{})[_0x16d1('0x22')](function(_0x117da5){var _0x3b77db=_0x1d92cd['user'][_0x16d1('0x24')]({'plain':!![]});if(!_0x3b77db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b77db[_0x16d1('0x4c')]===_0x16d1('0x4d')){var _0x5d384c=_0x117da5[_0x16d1('0x24')]({'plain':!![]});var _0xd3a7f8=_0x16d1('0x25');return db[_0x16d1('0x4e')]['find']({'where':{'name':_0xd3a7f8,'userProfileId':_0x3b77db['userProfileId']},'raw':!![]})['then'](function(_0x34e266){if(_0x34e266&&_0x34e266[_0x16d1('0x4f')]===0x0){return db[_0x16d1('0x26')][_0x16d1('0x4a')]({'name':_0x5d384c['name'],'resourceId':_0x5d384c['id'],'type':_0x34e266[_0x16d1('0x29')],'sectionId':_0x34e266['id']},{})[_0x16d1('0x22')](function(){return _0x117da5;});}else{return _0x117da5;}})['catch'](function(_0x1e1bbc){logger[_0x16d1('0x27')](_0x16d1('0x50'),_0x1e1bbc);throw _0x1e1bbc;});}return _0x117da5;})[_0x16d1('0x22')](respondWithResult(_0x8bb0c1,0xc9))['catch'](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x51')]=function(_0x2b0aa7,_0xb9fb43){if(_0x2b0aa7['body']['id']){delete _0x2b0aa7['body']['id'];}return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x2b0aa7['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0xb9fb43,null))[_0x16d1('0x22')](saveUpdates(_0x2b0aa7[_0x16d1('0x4b')],null))['then'](respondWithResult(_0xb9fb43,null))[_0x16d1('0x45')](handleError(_0xb9fb43,null));};exports[_0x16d1('0x23')]=function(_0x11209f,_0x4b3079){return db[_0x16d1('0x2d')][_0x16d1('0x49')]({'where':{'id':_0x11209f['params']['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x4b3079,null))[_0x16d1('0x22')](db['CmContactHasItem'][_0x16d1('0x51')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x11209f[_0x16d1('0x47')]['id']}}))[_0x16d1('0x22')](removeEntity(_0x4b3079,null))[_0x16d1('0x45')](handleError(_0x4b3079,null));}; \ No newline at end of file +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 diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4824b8e..56bf82c 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 _0xf1b0=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types','lodash'];(function(_0x143f75,_0x290630){var _0x56c94f=function(_0x20050e){while(--_0x20050e){_0x143f75['push'](_0x143f75['shift']());}};_0x56c94f(++_0x290630);}(_0xf1b0,0x14f));var _0x0f1b=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0xf1b0[_0x5d88c0];return _0x1b40f0;};'use strict';var _=require(_0x0f1b('0x0'));var util=require(_0x0f1b('0x1'));var logger=require(_0x0f1b('0x2'))(_0x0f1b('0x3'));var moment=require(_0x0f1b('0x4'));var BPromise=require('bluebird');var rp=require(_0x0f1b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f1b('0x6'));var config=require(_0x0f1b('0x7'));var attributes=require(_0x0f1b('0x8'));module[_0x0f1b('0x9')]=function(_0x34bc04,_0x20f330){return _0x34bc04[_0x0f1b('0xa')]('ContactItemType',attributes,{'tableName':_0x0f1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 1f3372a..1b4a816 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 _0xd96d=['error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd96d,0x180));var _0xdd96=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xd96d[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require('lodash');var util=require(_0xdd96('0x0'));var moment=require('moment');var BPromise=require(_0xdd96('0x1'));var rs=require(_0xdd96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd96('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd96('0x4'))(_0xdd96('0x5'));var config=require(_0xdd96('0x6'));var jayson=require(_0xdd96('0x7'));var client=jayson['client'][_0xdd96('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27bb5a,_0x5c3e58,_0x231d17){return new BPromise(function(_0x422751,_0x5004e8){return client[_0xdd96('0x9')](_0x27bb5a,_0x231d17)['then'](function(_0x208508){logger[_0xdd96('0xa')](_0xdd96('0xb'),_0x5c3e58,_0xdd96('0xc'));logger[_0xdd96('0xd')](_0xdd96('0xe'),_0x5c3e58,_0xdd96('0xc'),JSON['stringify'](_0x208508));if(_0x208508[_0xdd96('0xf')]){if(_0x208508[_0xdd96('0xf')]['code']===0x1f4){logger[_0xdd96('0xf')](_0xdd96('0xb'),_0x5c3e58,_0x208508[_0xdd96('0xf')][_0xdd96('0x10')]);return _0x5004e8(_0x208508['error'][_0xdd96('0x10')]);}logger[_0xdd96('0xf')](_0xdd96('0xb'),_0x5c3e58,_0x208508[_0xdd96('0xf')]['message']);return _0x422751(_0x208508['error']['message']);}else{logger[_0xdd96('0xa')](_0xdd96('0xb'),_0x5c3e58,_0xdd96('0xc'));_0x422751(_0x208508[_0xdd96('0x11')][_0xdd96('0x10')]);}})[_0xdd96('0x12')](function(_0x381abd){logger[_0xdd96('0xf')](_0xdd96('0xb'),_0x5c3e58,_0x381abd);_0x5004e8(_0x381abd);});});} \ No newline at end of file +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 diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 94d8df5..8aad635 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 _0xdd58=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc25f0d,_0x1c8adf){var _0x4d3c7e=function(_0x1cd20a){while(--_0x1cd20a){_0xc25f0d['push'](_0xc25f0d['shift']());}};_0x4d3c7e(++_0x1c8adf);}(_0xdd58,0x109));var _0x8dd5=function(_0x53dcac,_0x351c81){_0x53dcac=_0x53dcac-0x0;var _0x372c8e=_0xdd58[_0x53dcac];return _0x372c8e;};'use strict';var multer=require(_0x8dd5('0x0'));var util=require(_0x8dd5('0x1'));var path=require(_0x8dd5('0x2'));var timeout=require(_0x8dd5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8dd5('0x4'));var auth=require(_0x8dd5('0x5'));var interaction=require(_0x8dd5('0x6'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x8dd5('0x7')]('/',auth[_0x8dd5('0x8')](),controller[_0x8dd5('0x9')]);router[_0x8dd5('0x7')](_0x8dd5('0xa'),auth[_0x8dd5('0x8')](),controller[_0x8dd5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8dd5('0xc')]);router[_0x8dd5('0xd')](_0x8dd5('0xa'),auth[_0x8dd5('0x8')](),controller[_0x8dd5('0xe')]);router[_0x8dd5('0xf')](_0x8dd5('0xa'),auth['isAuthenticated'](),controller[_0x8dd5('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index d74272c..64bb35d 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 _0xd8b0=['exports','sequelize'];(function(_0x173aee,_0x7a5b2b){var _0x493d5e=function(_0x575e07){while(--_0x575e07){_0x173aee['push'](_0x173aee['shift']());}};_0x493d5e(++_0x7a5b2b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 +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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 7aa58fa..b2ce599 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 _0x8ee8=['sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','UserProfileResource','then','stack','name','status','send','map','Dashboard','fieldName','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','CustomDashboards','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','intersection','omit','createdAt','updatedAt','autoAssociation','update','destroy','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrOpenchannelAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems','findOne','DashboardItem','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x5bd997,_0x47ebb2){var _0xc32f74=function(_0x2fa676){while(--_0x2fa676){_0x5bd997['push'](_0x5bd997['shift']());}};_0xc32f74(++_0x47ebb2);}(_0x8ee8,0x7d));var _0x88ee=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x8ee8[_0x25a136];return _0x5b7159;};'use strict';var emlformat=require(_0x88ee('0x0'));var rimraf=require(_0x88ee('0x1'));var zipdir=require(_0x88ee('0x2'));var jsonpatch=require(_0x88ee('0x3'));var rp=require(_0x88ee('0x4'));var moment=require(_0x88ee('0x5'));var BPromise=require(_0x88ee('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x88ee('0x7'));var sox=require(_0x88ee('0x8'));var csv=require(_0x88ee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88ee('0xa'));var _=require('lodash');var squel=require(_0x88ee('0xb'));var crypto=require(_0x88ee('0xc'));var jsforce=require(_0x88ee('0xd'));var deskjs=require(_0x88ee('0xe'));var toCsv=require('to-csv');var querystring=require(_0x88ee('0xf'));var Papa=require(_0x88ee('0x10'));var Redis=require(_0x88ee('0x11'));var authService=require(_0x88ee('0x12'));var qs=require(_0x88ee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x88ee('0x14'))(_0x88ee('0x15'));var utils=require('../../config/utils');var config=require(_0x88ee('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x88ee('0x17'))['db'];config[_0x88ee('0x18')]=_[_0x88ee('0x19')](config[_0x88ee('0x18')],{'host':_0x88ee('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ee('0x18')]));require(_0x88ee('0x1b'))[_0x88ee('0x1c')](socket);function respondWithStatusCode(_0x1b2b57,_0x5b320c){_0x5b320c=_0x5b320c||0xcc;return function(_0x2f5ee6){if(_0x2f5ee6){return _0x1b2b57[_0x88ee('0x1d')](_0x5b320c);}return _0x1b2b57['status'](_0x5b320c)[_0x88ee('0x1e')]();};}function respondWithResult(_0x54a258,_0x212bbc){_0x212bbc=_0x212bbc||0xc8;return function(_0x178a47){if(_0x178a47){return _0x54a258['status'](_0x212bbc)[_0x88ee('0x1f')](_0x178a47);}};}function respondWithFilteredResult(_0x3a04bd,_0x474e34){return function(_0x4c0249){if(_0x4c0249){var _0x5a8004=typeof _0x474e34[_0x88ee('0x20')]===_0x88ee('0x21')&&typeof _0x474e34['limit']===_0x88ee('0x21');var _0x4f3bd3=_0x4c0249[_0x88ee('0x22')];var _0x17eaf7=_0x5a8004?0x0:_0x474e34['offset'];var _0x19e070=_0x5a8004?_0x4c0249[_0x88ee('0x22')]:_0x474e34['offset']+_0x474e34[_0x88ee('0x23')];var _0xde7960;if(_0x19e070>=_0x4f3bd3){_0x19e070=_0x4f3bd3;_0xde7960=0xc8;}else{_0xde7960=0xce;}_0x3a04bd['status'](_0xde7960);return _0x3a04bd[_0x88ee('0x24')](_0x88ee('0x25'),_0x17eaf7+'-'+_0x19e070+'/'+_0x4f3bd3)[_0x88ee('0x1f')](_0x4c0249);}return null;};}function patchUpdates(_0x296608){return function(_0x3a6834){try{jsonpatch[_0x88ee('0x26')](_0x3a6834,_0x296608,!![]);}catch(_0x3d641a){return BPromise[_0x88ee('0x27')](_0x3d641a);}return _0x3a6834[_0x88ee('0x28')]();};}function saveUpdates(_0x34dfce,_0x49a2eb){return function(_0x6f9d38){if(_0x6f9d38){return _0x6f9d38['update'](_0x34dfce)['then'](function(_0x539d9c){return _0x539d9c;});}return null;};}function removeEntity(_0x5d1276,_0x3cda0d){return function(_0x577103){if(_0x577103){return _0x577103['destroy']()['then'](function(){var _0x30f2b1=_0x577103['get']({'plain':!![]});var _0x523ae0='CustomDashboards';return db[_0x88ee('0x29')]['destroy']({'where':{'type':_0x523ae0,'resourceId':_0x30f2b1['id']}})[_0x88ee('0x2a')](function(){return _0x577103;});})[_0x88ee('0x2a')](function(){_0x5d1276['status'](0xcc)[_0x88ee('0x1e')]();});}};}function handleEntityNotFound(_0x5cb1b5,_0x4f61ce){return function(_0x1e9db7){if(!_0x1e9db7){_0x5cb1b5[_0x88ee('0x1d')](0x194);}return _0x1e9db7;};}function handleError(_0x3db0ff,_0x401cfb){_0x401cfb=_0x401cfb||0x1f4;return function(_0x49823e){logger['error'](_0x49823e[_0x88ee('0x2b')]);if(_0x49823e[_0x88ee('0x2c')]){delete _0x49823e[_0x88ee('0x2c')];}_0x3db0ff[_0x88ee('0x2d')](_0x401cfb)[_0x88ee('0x2e')](_0x49823e);};}exports['index']=function(_0x480740,_0x4396ca){var _0xb4642b={},_0x488a9c={},_0x33e36f={'count':0x0,'rows':[]};var _0x3860e6=_[_0x88ee('0x2f')](db[_0x88ee('0x30')]['rawAttributes'],function(_0x1beab3){return{'name':_0x1beab3[_0x88ee('0x31')],'type':_0x1beab3[_0x88ee('0x32')][_0x88ee('0x33')]};});_0x488a9c['model']=_[_0x88ee('0x2f')](_0x3860e6,_0x88ee('0x2c'));_0x488a9c[_0x88ee('0x34')]=_['keys'](_0x480740['query']);_0x488a9c[_0x88ee('0x35')]=_['intersection'](_0x488a9c[_0x88ee('0x36')],_0x488a9c[_0x88ee('0x34')]);_0xb4642b[_0x88ee('0x37')]=_['intersection'](_0x488a9c[_0x88ee('0x36')],qs[_0x88ee('0x38')](_0x480740[_0x88ee('0x34')][_0x88ee('0x38')]));_0xb4642b[_0x88ee('0x37')]=_0xb4642b[_0x88ee('0x37')][_0x88ee('0x39')]?_0xb4642b[_0x88ee('0x37')]:_0x488a9c[_0x88ee('0x36')];if(!_0x480740[_0x88ee('0x34')][_0x88ee('0x3a')]('nolimit')){_0xb4642b[_0x88ee('0x23')]=qs[_0x88ee('0x23')](_0x480740[_0x88ee('0x34')][_0x88ee('0x23')]);_0xb4642b[_0x88ee('0x20')]=qs[_0x88ee('0x20')](_0x480740[_0x88ee('0x34')]['offset']);}_0xb4642b[_0x88ee('0x3b')]=qs[_0x88ee('0x3c')](_0x480740[_0x88ee('0x34')][_0x88ee('0x3c')]);_0xb4642b[_0x88ee('0x3d')]=qs[_0x88ee('0x35')](_[_0x88ee('0x3e')](_0x480740[_0x88ee('0x34')],_0x488a9c[_0x88ee('0x35')]),_0x3860e6);if(_0x480740[_0x88ee('0x34')][_0x88ee('0x3f')]){_0xb4642b[_0x88ee('0x3d')]=_['merge'](_0xb4642b[_0x88ee('0x3d')],{'$or':_[_0x88ee('0x2f')](_0x3860e6,function(_0x26996d){if(_0x26996d[_0x88ee('0x32')]!==_0x88ee('0x40')){var _0x257e7e={};_0x257e7e[_0x26996d[_0x88ee('0x2c')]]={'$like':'%'+_0x480740[_0x88ee('0x34')][_0x88ee('0x3f')]+'%'};return _0x257e7e;}})});}_0xb4642b=_[_0x88ee('0x41')]({},_0xb4642b,_0x480740[_0x88ee('0x42')]);var _0x2292aa={'where':_0xb4642b[_0x88ee('0x3d')]};return db[_0x88ee('0x30')][_0x88ee('0x22')](_0x2292aa)[_0x88ee('0x2a')](function(_0x1684b2){_0x33e36f['count']=_0x1684b2;if(_0x480740['query'][_0x88ee('0x43')]){_0xb4642b['include']=[{'all':!![]}];}return db[_0x88ee('0x30')]['findAll'](_0xb4642b);})['then'](function(_0x1b9afa){_0x33e36f[_0x88ee('0x44')]=_0x1b9afa;return _0x33e36f;})[_0x88ee('0x2a')](respondWithFilteredResult(_0x4396ca,_0xb4642b))[_0x88ee('0x45')](handleError(_0x4396ca,null));};exports['show']=function(_0x586e8b,_0x796581){var _0x94fa19={'raw':![],'where':{'id':_0x586e8b[_0x88ee('0x46')]['id']}},_0x59cd2c={};_0x59cd2c[_0x88ee('0x36')]=_[_0x88ee('0x47')](db[_0x88ee('0x30')][_0x88ee('0x48')]);_0x59cd2c[_0x88ee('0x34')]=_[_0x88ee('0x47')](_0x586e8b['query']);_0x59cd2c['filters']=_['intersection'](_0x59cd2c['model'],_0x59cd2c[_0x88ee('0x34')]);_0x94fa19[_0x88ee('0x37')]=_['intersection'](_0x59cd2c[_0x88ee('0x36')],qs[_0x88ee('0x38')](_0x586e8b[_0x88ee('0x34')][_0x88ee('0x38')]));_0x94fa19[_0x88ee('0x37')]=_0x94fa19[_0x88ee('0x37')][_0x88ee('0x39')]?_0x94fa19[_0x88ee('0x37')]:_0x59cd2c[_0x88ee('0x36')];if(_0x586e8b['query'][_0x88ee('0x43')]){_0x94fa19[_0x88ee('0x49')]=[{'all':!![]}];}_0x94fa19=_[_0x88ee('0x41')]({},_0x94fa19,_0x586e8b[_0x88ee('0x42')]);return db[_0x88ee('0x30')][_0x88ee('0x4a')](_0x94fa19)[_0x88ee('0x2a')](handleEntityNotFound(_0x796581,null))[_0x88ee('0x2a')](respondWithResult(_0x796581,null))[_0x88ee('0x45')](handleError(_0x796581,null));};exports['create']=function(_0x645b45,_0x2c6871){return db[_0x88ee('0x30')][_0x88ee('0x4b')](_0x645b45[_0x88ee('0x4c')],{})[_0x88ee('0x2a')](function(_0x45d84c){var _0x3c4139=_0x645b45[_0x88ee('0x4d')]['get']({'plain':!![]});if(!_0x3c4139)throw new Error(_0x88ee('0x4e'));if(_0x3c4139[_0x88ee('0x4f')]===_0x88ee('0x4d')){var _0x801814=_0x45d84c[_0x88ee('0x50')]({'plain':!![]});var _0x2cb6dc=_0x88ee('0x51');return db[_0x88ee('0x52')]['find']({'where':{'name':_0x2cb6dc,'userProfileId':_0x3c4139[_0x88ee('0x53')]},'raw':!![]})[_0x88ee('0x2a')](function(_0x28b86d){if(_0x28b86d&&_0x28b86d['autoAssociation']===0x0){return db[_0x88ee('0x29')]['create']({'name':_0x801814['name'],'resourceId':_0x801814['id'],'type':_0x28b86d[_0x88ee('0x2c')],'sectionId':_0x28b86d['id']},{})[_0x88ee('0x2a')](function(){return _0x45d84c;});}else{return _0x45d84c;}})['catch'](function(_0x145339){logger[_0x88ee('0x54')](_0x88ee('0x55'),_0x145339);throw _0x145339;});}return _0x45d84c;})[_0x88ee('0x2a')](respondWithResult(_0x2c6871,0xc9))['catch'](handleError(_0x2c6871,null));};exports[_0x88ee('0x56')]=function(_0x2e8bfb,_0x385061){var _0x406cc3={'where':{'id':_0x2e8bfb[_0x88ee('0x46')]['id']}},_0x157231={};_0x157231[_0x88ee('0x36')]=_[_0x88ee('0x47')](db[_0x88ee('0x30')]['rawAttributes']);_0x406cc3['attributes']=_[_0x88ee('0x57')](_0x157231[_0x88ee('0x36')],qs[_0x88ee('0x38')](_0x2e8bfb[_0x88ee('0x34')][_0x88ee('0x38')]));_0x406cc3[_0x88ee('0x37')]=_0x406cc3[_0x88ee('0x37')][_0x88ee('0x39')]?_0x406cc3['attributes']:_0x157231['model'];if(_0x2e8bfb['query']['includeAll']){_0x406cc3[_0x88ee('0x49')]=[{'all':!![]}];}_0x406cc3=_[_0x88ee('0x41')]({},_0x406cc3,_0x2e8bfb[_0x88ee('0x42')]);return db[_0x88ee('0x30')][_0x88ee('0x4a')](_0x406cc3)[_0x88ee('0x2a')](handleEntityNotFound(_0x385061,null))[_0x88ee('0x2a')](function(_0x1d6f77){if(_0x1d6f77){var _0x19c939=_0x1d6f77['get']({'plain':!![]});_0x19c939=qs[_0x88ee('0x58')](_0x19c939,['id',_0x88ee('0x59'),_0x88ee('0x5a')]);_0x2e8bfb[_0x88ee('0x4c')]=_[_0x88ee('0x58')](_0x2e8bfb[_0x88ee('0x4c')],['id',_0x88ee('0x59'),_0x88ee('0x5a')]);return db[_0x88ee('0x30')][_0x88ee('0x4b')](_[_0x88ee('0x41')](_0x19c939,_0x2e8bfb[_0x88ee('0x4c')]),{'include':_0x2e8bfb[_0x88ee('0x34')][_0x88ee('0x43')]?[{'all':!![]}]:undefined})[_0x88ee('0x2a')](function(_0x23bf59){var _0x2ec658=_0x2e8bfb[_0x88ee('0x4d')]['get']({'plain':!![]});if(!_0x2ec658)throw new Error(_0x88ee('0x4e'));if(_0x2ec658[_0x88ee('0x4f')]===_0x88ee('0x4d')){var _0xa26b95=_0x23bf59[_0x88ee('0x50')]({'plain':!![]});var _0x4f28b0='CustomDashboards';return db['UserProfileSection'][_0x88ee('0x4a')]({'where':{'name':_0x4f28b0,'userProfileId':_0x2ec658[_0x88ee('0x53')]},'raw':!![]})[_0x88ee('0x2a')](function(_0x160cff){if(_0x160cff&&_0x160cff[_0x88ee('0x5b')]===0x0){return db[_0x88ee('0x29')][_0x88ee('0x4b')]({'name':_0xa26b95['name'],'resourceId':_0xa26b95['id'],'type':_0x160cff[_0x88ee('0x2c')],'sectionId':_0x160cff['id']},{})['then'](function(){return _0x23bf59;});}else{return _0x23bf59;}})[_0x88ee('0x45')](function(_0x149060){logger['error'](_0x88ee('0x55'),_0x149060);throw _0x149060;});}return _0x23bf59;});}})['then'](respondWithResult(_0x385061,0xc9))[_0x88ee('0x45')](handleError(_0x385061,null));};exports[_0x88ee('0x5c')]=function(_0x328590,_0x45614f){if(_0x328590[_0x88ee('0x4c')]['id']){delete _0x328590[_0x88ee('0x4c')]['id'];}return db[_0x88ee('0x30')][_0x88ee('0x4a')]({'where':{'id':_0x328590[_0x88ee('0x46')]['id']}})[_0x88ee('0x2a')](handleEntityNotFound(_0x45614f,null))[_0x88ee('0x2a')](saveUpdates(_0x328590[_0x88ee('0x4c')],null))[_0x88ee('0x2a')](respondWithResult(_0x45614f,null))[_0x88ee('0x45')](handleError(_0x45614f,null));};exports[_0x88ee('0x5d')]=function(_0x2e4222,_0x106e42){return db[_0x88ee('0x30')][_0x88ee('0x4a')]({'where':{'id':_0x2e4222[_0x88ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x106e42,null))[_0x88ee('0x2a')](removeEntity(_0x106e42,null))['catch'](handleError(_0x106e42,null));};function widgetAttributes(_0x23eba3){try{switch(_0x23eba3[_0x88ee('0x32')]){case _0x88ee('0x5e'):return[{'name':_0x88ee('0x5f'),'value':_0x23eba3[_0x88ee('0x5f')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3['attrs'][0x0]?_0x23eba3[_0x88ee('0x60')][0x0][_0x88ee('0x61')]:undefined)||_0x88ee('0x62')}];case _0x88ee('0x63'):return[{'name':_0x88ee('0x64'),'value':_0x23eba3['attrPath']||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3['attrs'][0x0]?_0x23eba3['attrs'][0x0][_0x88ee('0x61')]:undefined)||''}];case _0x88ee('0x65'):return[{'name':_0x88ee('0x66'),'value':_0x23eba3[_0x88ee('0x66')]||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x0]?_0x23eba3[_0x88ee('0x60')][0x0][_0x88ee('0x61')]:undefined)||_0x88ee('0x67')},{'name':_0x88ee('0x68'),'value':_0x23eba3[_0x88ee('0x68')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3['attrs'][0x1]?_0x23eba3[_0x88ee('0x60')][0x1][_0x88ee('0x61')]:undefined)||_0x88ee('0x69')},{'name':_0x88ee('0x6a'),'value':_0x23eba3[_0x88ee('0x6a')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x2]?_0x23eba3['attrs'][0x2][_0x88ee('0x61')]:undefined)||0xc}];case _0x88ee('0x6b'):return[{'name':'attrMetric','value':_0x23eba3[_0x88ee('0x6c')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x0]?_0x23eba3['attrs'][0x0]['value']:undefined)||_0x88ee('0x6d')},{'name':_0x88ee('0x6e'),'value':_0x23eba3[_0x88ee('0x6e')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x1]?_0x23eba3['attrs'][0x1][_0x88ee('0x61')]:undefined)||[]},{'name':_0x88ee('0x6a'),'value':_0x23eba3[_0x88ee('0x6a')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3['attrs'][0x2]?_0x23eba3[_0x88ee('0x60')][0x2][_0x88ee('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0x23eba3[_0x88ee('0x6f')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x3]?_0x23eba3[_0x88ee('0x60')][0x3][_0x88ee('0x61')]:undefined)||_0x88ee('0x70')},{'name':_0x88ee('0x71'),'value':_0x23eba3[_0x88ee('0x71')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x4]?_0x23eba3[_0x88ee('0x60')][0x4][_0x88ee('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x23eba3[_0x88ee('0x72')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3['attrs'][0x5]?_0x23eba3[_0x88ee('0x60')][0x5][_0x88ee('0x61')]:undefined)||''},{'name':_0x88ee('0x73'),'value':_0x23eba3[_0x88ee('0x73')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x6]?_0x23eba3['attrs'][0x6][_0x88ee('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x23eba3['attrOpenchannelAccounts']||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x7]?_0x23eba3['attrs'][0x7]['value']:undefined)||''},{'name':_0x88ee('0x74'),'value':_0x23eba3['attrWhatsappAccounts']||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x8]?_0x23eba3['attrs'][0x8][_0x88ee('0x61')]:undefined)||''},{'name':_0x88ee('0x75'),'value':_0x23eba3['attrChatWebsites']||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x9]?_0x23eba3['attrs'][0x9][_0x88ee('0x61')]:undefined)||''}];case'multibar-chart':case _0x88ee('0x76'):return[{'name':_0x88ee('0x77'),'value':_0x23eba3['attrSerie1']||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x0]?_0x23eba3[_0x88ee('0x60')][0x0][_0x88ee('0x61')]:undefined)||_0x88ee('0x6d')},{'name':'attrSerie2','value':_0x23eba3[_0x88ee('0x78')]||(_0x23eba3['attrs']&&_0x23eba3['attrs'][0x1]?_0x23eba3['attrs'][0x1][_0x88ee('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x23eba3['attrSerie3']||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x2]?_0x23eba3[_0x88ee('0x60')][0x2][_0x88ee('0x61')]:undefined)||null},{'name':_0x88ee('0x6e'),'value':_0x23eba3[_0x88ee('0x6e')]||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x3]?_0x23eba3['attrs'][0x3]['value']:undefined)||[]},{'name':_0x88ee('0x6f'),'value':_0x23eba3['attrChannel']||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x4]?_0x23eba3['attrs'][0x4][_0x88ee('0x61')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x23eba3[_0x88ee('0x71')]||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x5]?_0x23eba3[_0x88ee('0x60')][0x5][_0x88ee('0x61')]:undefined)||''},{'name':_0x88ee('0x72'),'value':_0x23eba3[_0x88ee('0x72')]||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x6]?_0x23eba3['attrs'][0x6][_0x88ee('0x61')]:undefined)||''},{'name':_0x88ee('0x73'),'value':_0x23eba3[_0x88ee('0x73')]||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x7]?_0x23eba3[_0x88ee('0x60')][0x7]['value']:undefined)||''},{'name':_0x88ee('0x79'),'value':_0x23eba3[_0x88ee('0x79')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x8]?_0x23eba3[_0x88ee('0x60')][0x8]['value']:undefined)||''},{'name':_0x88ee('0x74'),'value':_0x23eba3[_0x88ee('0x74')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x9]?_0x23eba3[_0x88ee('0x60')][0x9][_0x88ee('0x61')]:undefined)||''},{'name':_0x88ee('0x75'),'value':_0x23eba3[_0x88ee('0x75')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0xa]?_0x23eba3[_0x88ee('0x60')][0xa][_0x88ee('0x61')]:undefined)||''}];case _0x88ee('0x7a'):return[{'name':_0x88ee('0x7b'),'type':_0x23eba3[_0x88ee('0x7c')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x0]?_0x23eba3[_0x88ee('0x60')][0x0][_0x88ee('0x32')]:undefined)||null,'value':_0x23eba3['attrReport']||(_0x23eba3['attrs']&&_0x23eba3[_0x88ee('0x60')][0x0]?_0x23eba3[_0x88ee('0x60')][0x0]['value']:undefined)||null},{'name':_0x88ee('0x7d'),'value':_0x23eba3[_0x88ee('0x7d')]||(_0x23eba3[_0x88ee('0x60')]&&_0x23eba3[_0x88ee('0x60')][0x1]?_0x23eba3[_0x88ee('0x60')][0x1][_0x88ee('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x2f6d21){logger['error'](_0x88ee('0x7e'),JSON[_0x88ee('0x7f')](_0x2f6d21));return[];}}exports[_0x88ee('0x80')]=function(_0xef805c,_0x1c479a,_0x5aa9e7){if(_0xef805c[_0x88ee('0x4c')]['id']){delete _0xef805c['body']['id'];}return db[_0x88ee('0x30')][_0x88ee('0x4a')]({'where':{'id':_0xef805c['params']['id']}})['then'](handleEntityNotFound(_0x1c479a,null))['then'](function(_0x48cd24){if(_0x48cd24){_0xef805c[_0x88ee('0x4c')]['DashboardId']=_0x48cd24['id'];_0xef805c[_0x88ee('0x4c')][_0x88ee('0x60')]=widgetAttributes(_0xef805c[_0x88ee('0x4c')]);return db['DashboardItem'][_0x88ee('0x4b')](_0xef805c[_0x88ee('0x4c')]);}})[_0x88ee('0x2a')](respondWithResult(_0x1c479a,null))[_0x88ee('0x45')](handleError(_0x1c479a,null));};exports[_0x88ee('0x81')]=function(_0x21acec,_0x4821fb,_0x1afd32){var _0x518197={};var _0x247834={};var _0x52506e;var _0x797c7e;return db[_0x88ee('0x30')][_0x88ee('0x82')]({'where':{'id':_0x21acec[_0x88ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x4821fb,null))['then'](function(_0x3bdd88){if(_0x3bdd88){_0x52506e=_0x3bdd88;_0x247834[_0x88ee('0x36')]=_[_0x88ee('0x47')](db[_0x88ee('0x83')][_0x88ee('0x48')]);_0x247834[_0x88ee('0x34')]=_['keys'](_0x21acec['query']);_0x247834[_0x88ee('0x35')]=_['intersection'](_0x247834[_0x88ee('0x36')],_0x247834['query']);_0x518197[_0x88ee('0x37')]=_[_0x88ee('0x57')](_0x247834['model'],qs[_0x88ee('0x38')](_0x21acec[_0x88ee('0x34')]['fields']));_0x518197[_0x88ee('0x37')]=_0x518197[_0x88ee('0x37')][_0x88ee('0x39')]?_0x518197['attributes']:_0x247834[_0x88ee('0x36')];_0x518197['order']=qs[_0x88ee('0x3c')](_0x21acec[_0x88ee('0x34')][_0x88ee('0x3c')]);_0x518197['where']=qs[_0x88ee('0x35')](_[_0x88ee('0x3e')](_0x21acec[_0x88ee('0x34')],_0x247834[_0x88ee('0x35')]));if(_0x21acec[_0x88ee('0x34')][_0x88ee('0x3f')]){_0x518197['where']=_['merge'](_0x518197[_0x88ee('0x3d')],{'$or':_[_0x88ee('0x2f')](_0x518197[_0x88ee('0x37')],function(_0xf79831){var _0x5639ff={};_0x5639ff[_0xf79831]={'$like':'%'+_0x21acec[_0x88ee('0x34')][_0x88ee('0x3f')]+'%'};return _0x5639ff;})});}_0x518197=_[_0x88ee('0x41')]({},_0x518197,_0x21acec[_0x88ee('0x42')]);return _0x52506e[_0x88ee('0x81')](_0x518197);}})[_0x88ee('0x2a')](function(_0x2176fc){if(_0x2176fc){_0x797c7e=_0x2176fc[_0x88ee('0x39')];if(!_0x21acec['query'][_0x88ee('0x3a')](_0x88ee('0x84'))){_0x518197['limit']=qs[_0x88ee('0x23')](_0x21acec[_0x88ee('0x34')][_0x88ee('0x23')]);_0x518197[_0x88ee('0x20')]=qs['offset'](_0x21acec[_0x88ee('0x34')]['offset']);}return _0x52506e[_0x88ee('0x81')](_0x518197);}})[_0x88ee('0x2a')](function(_0x1af534){if(_0x1af534){return _0x1af534?{'count':_0x797c7e,'rows':_0x1af534}:null;}})['then'](respondWithResult(_0x4821fb,null))[_0x88ee('0x45')](handleError(_0x4821fb,null));}; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d9221f8..26b4df8 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 _0x46db=['hook','exports','events','../../mysqldb','Dashboard','update','remove','hasOwnProperty'];(function(_0x2267ba,_0x4d7917){var _0xf1f28c=function(_0x464b7f){while(--_0x464b7f){_0x2267ba['push'](_0x2267ba['shift']());}};_0xf1f28c(++_0x4d7917);}(_0x46db,0x1da));var _0xb46d=function(_0x5ba564,_0x57501f){_0x5ba564=_0x5ba564-0x0;var _0x7eeb97=_0x46db[_0x5ba564];return _0x7eeb97;};'use strict';var EventEmitter=require(_0xb46d('0x0'));var Dashboard=require(_0xb46d('0x1'))['db'][_0xb46d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb46d('0x3'),'afterDestroy':_0xb46d('0x4')};function emitEvent(_0xcf17aa){return function(_0x30ea7f,_0x1ed1d3,_0x367342){DashboardEvents['emit'](_0xcf17aa+':'+_0x30ea7f['id'],_0x30ea7f);DashboardEvents['emit'](_0xcf17aa,_0x30ea7f);_0x367342(null);};}for(var e in events){if(events[_0xb46d('0x5')](e)){var event=events[e];Dashboard[_0xb46d('0x6')](e,emitEvent(event));}}module[_0xb46d('0x7')]=DashboardEvents; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2109571..d1b8fd5 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 _0x6f02=['Dashboard','dashboards','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x6f02,0xf0));var _0x26f0=function(_0x180dc4,_0x235cea){_0x180dc4=_0x180dc4-0x0;var _0x3f8eaf=_0x6f02[_0x180dc4];return _0x3f8eaf;};'use strict';var _=require(_0x26f0('0x0'));var util=require(_0x26f0('0x1'));var logger=require('../../config/logger')(_0x26f0('0x2'));var moment=require(_0x26f0('0x3'));var BPromise=require(_0x26f0('0x4'));var rp=require(_0x26f0('0x5'));var fs=require('fs');var path=require(_0x26f0('0x6'));var rimraf=require(_0x26f0('0x7'));var config=require(_0x26f0('0x8'));var attributes=require(_0x26f0('0x9'));module[_0x26f0('0xa')]=function(_0x572ebf,_0x50566f){return _0x572ebf[_0x26f0('0xb')](_0x26f0('0xc'),attributes,{'tableName':_0x26f0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7d47501..a628d30 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 _0x8b8e=['bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','redis','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0x56ed61,_0x5c5c53){var _0x4f1e4a=function(_0x24d743){while(--_0x24d743){_0x56ed61['push'](_0x56ed61['shift']());}};_0x4f1e4a(++_0x5c5c53);}(_0x8b8e,0xbe));var _0xe8b8=function(_0x280e4c,_0x592974){_0x280e4c=_0x280e4c-0x0;var _0x38e36d=_0x8b8e[_0x280e4c];return _0x38e36d;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var moment=require(_0xe8b8('0x1'));var BPromise=require(_0xe8b8('0x2'));var rs=require(_0xe8b8('0x3'));var fs=require('fs');var Redis=require(_0xe8b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe8b8('0x5'));var config=require(_0xe8b8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe8b8('0x7')][_0xe8b8('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe8b8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b8('0xa'))(new Redis(config[_0xe8b8('0x9')]));require(_0xe8b8('0xb'))[_0xe8b8('0xc')](socket);function respondWithRpcPromise(_0x39c91d,_0x13077a,_0x4413f2){return new BPromise(function(_0x3f9b05,_0x3e2fca){return client[_0xe8b8('0xd')](_0x39c91d,_0x4413f2)[_0xe8b8('0xe')](function(_0x1cad60){logger[_0xe8b8('0xf')](_0xe8b8('0x10'),_0x13077a,_0xe8b8('0x11'));logger[_0xe8b8('0x12')](_0xe8b8('0x13'),_0x13077a,_0xe8b8('0x11'),JSON[_0xe8b8('0x14')](_0x1cad60));if(_0x1cad60[_0xe8b8('0x15')]){if(_0x1cad60[_0xe8b8('0x15')]['code']===0x1f4){logger[_0xe8b8('0x15')](_0xe8b8('0x10'),_0x13077a,_0x1cad60['error'][_0xe8b8('0x16')]);return _0x3e2fca(_0x1cad60[_0xe8b8('0x15')]['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x13077a,_0x1cad60['error'][_0xe8b8('0x16')]);return _0x3f9b05(_0x1cad60[_0xe8b8('0x15')]['message']);}else{logger['info'](_0xe8b8('0x10'),_0x13077a,_0xe8b8('0x11'));_0x3f9b05(_0x1cad60[_0xe8b8('0x17')][_0xe8b8('0x16')]);}})['catch'](function(_0xd34416){logger[_0xe8b8('0x15')]('Dashboard,\x20%s,\x20%s',_0x13077a,_0xd34416);_0x3e2fca(_0xd34416);});});} \ No newline at end of file +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 diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 7da3c9e..b2dea42 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 _0xcf8e=['emit','register','dashboard:','./dashboard.events','save','remove','update'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0xcf8e,0x1d8));var _0xecf8=function(_0xf2a05c,_0x249a1e){_0xf2a05c=_0xf2a05c-0x0;var _0x222b3e=_0xcf8e[_0xf2a05c];return _0x222b3e;};'use strict';var DashboardEvents=require(_0xecf8('0x0'));var events=[_0xecf8('0x1'),_0xecf8('0x2'),_0xecf8('0x3')];function createListener(_0x4beb95,_0x45f4e8){return function(_0x60088e){_0x45f4e8[_0xecf8('0x4')](_0x4beb95,_0x60088e);};}function removeListener(_0x5bcc33,_0x664351){return function(){DashboardEvents['removeListener'](_0x5bcc33,_0x664351);};}exports[_0xecf8('0x5')]=function(_0x8cdfe6){for(var _0x39123d=0x0,_0xb59f69=events['length'];_0x39123d<_0xb59f69;_0x39123d++){var _0x39ae50=events[_0x39123d];var _0x5851c4=createListener(_0xecf8('0x6')+_0x39ae50,_0x8cdfe6);DashboardEvents['on'](_0x39ae50,_0x5851c4);}}; \ No newline at end of file +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 diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3637bf0..c116d8f 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 _0x2879=['post','create','/:id/clone','addItem','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','show','get','getItems'];(function(_0x159309,_0x3ab419){var _0x1f126c=function(_0x59f7ba){while(--_0x59f7ba){_0x159309['push'](_0x159309['shift']());}};_0x1f126c(++_0x3ab419);}(_0x2879,0x107));var _0x9287=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2879[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9287('0x0'));var util=require(_0x9287('0x1'));var path=require('path');var timeout=require(_0x9287('0x2'));var express=require('express');var router=express[_0x9287('0x3')]();var fs_extra=require(_0x9287('0x4'));var auth=require(_0x9287('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9287('0x6'));var controller=require(_0x9287('0x7'));router['get']('/',auth[_0x9287('0x8')](),controller[_0x9287('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9287('0xa')]);router[_0x9287('0xb')]('/:id/items',auth[_0x9287('0x8')](),controller[_0x9287('0xc')]);router[_0x9287('0xd')]('/',auth[_0x9287('0x8')](),controller[_0x9287('0xe')]);router['post'](_0x9287('0xf'),auth[_0x9287('0x8')](),controller['clone']);router[_0x9287('0xd')]('/:id/items',auth[_0x9287('0x8')](),controller[_0x9287('0x10')]);router[_0x9287('0x11')](_0x9287('0x12'),auth['isAuthenticated'](),controller[_0x9287('0x13')]);router[_0x9287('0x14')](_0x9287('0x12'),auth[_0x9287('0x8')](),controller[_0x9287('0x15')]);module[_0x9287('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ddb7471..f857064 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 _0x2ef3=['parse','attrs','stringify','setDataValue','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','long'];(function(_0x4f8f3c,_0x5d0a5e){var _0x34f2bd=function(_0xd4e616){while(--_0xd4e616){_0x4f8f3c['push'](_0x4f8f3c['shift']());}};_0x34f2bd(++_0x5d0a5e);}(_0x2ef3,0xba));var _0x32ef=function(_0x97a9e8,_0x5555a1){_0x97a9e8=_0x97a9e8-0x0;var _0xa1a09f=_0x2ef3[_0x97a9e8];return _0xa1a09f;};'use strict';var Sequelize=require(_0x32ef('0x0'));var squel=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));module[_0x32ef('0x3')]={'title':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x32ef('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x32ef('0x5')),'get':function(){try{return JSON[_0x32ef('0x6')](this['getDataValue'](_0x32ef('0x7')));}catch(_0x37dd1d){return[];}},'set':function(_0x4c8104){try{this['setDataValue'](_0x32ef('0x7'),JSON[_0x32ef('0x8')](_0x4c8104));}catch(_0x367c39){this[_0x32ef('0x9')](_0x32ef('0x7'),JSON[_0x32ef('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x32ef('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x32ef('0xa')]},'col':{'type':Sequelize[_0x32ef('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x32ef('0x4')],'allowNull':![],'defaultValue':_0x32ef('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x32ef('0x4')]},'titleFontSize':{'type':Sequelize[_0x32ef('0xa')],'defaultValue':0xc}}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b4a9a42..c49c0f2 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 _0xaaee=['web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','destroy','error','stack','name','send','show','model','DashboardItem','query','keys','filters','intersection','fields','attributes','includeAll','include','merge','then','find','params','catch','type','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x1604ab,_0x4867e7){var _0x78c92b=function(_0x3f8b57){while(--_0x3f8b57){_0x1604ab['push'](_0x1604ab['shift']());}};_0x78c92b(++_0x4867e7);}(_0xaaee,0x132));var _0xeaae=function(_0xa9c1b8,_0x28bd08){_0xa9c1b8=_0xa9c1b8-0x0;var _0x3554f2=_0xaaee[_0xa9c1b8];return _0x3554f2;};'use strict';var emlformat=require(_0xeaae('0x0'));var rimraf=require(_0xeaae('0x1'));var zipdir=require(_0xeaae('0x2'));var jsonpatch=require(_0xeaae('0x3'));var rp=require(_0xeaae('0x4'));var moment=require('moment');var BPromise=require(_0xeaae('0x5'));var Mustache=require(_0xeaae('0x6'));var util=require(_0xeaae('0x7'));var path=require(_0xeaae('0x8'));var sox=require(_0xeaae('0x9'));var csv=require(_0xeaae('0xa'));var ejs=require(_0xeaae('0xb'));var fs=require('fs');var fs_extra=require(_0xeaae('0xc'));var _=require(_0xeaae('0xd'));var squel=require(_0xeaae('0xe'));var crypto=require(_0xeaae('0xf'));var jsforce=require(_0xeaae('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xeaae('0xa'));var querystring=require(_0xeaae('0x11'));var Papa=require('papaparse');var Redis=require(_0xeaae('0x12'));var authService=require(_0xeaae('0x13'));var qs=require(_0xeaae('0x14'));var as=require(_0xeaae('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeaae('0x16'));var utils=require(_0xeaae('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xeaae('0x18'));var db=require(_0xeaae('0x19'))['db'];config[_0xeaae('0x1a')]=_[_0xeaae('0x1b')](config['redis'],{'host':_0xeaae('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeaae('0x1a')]));require(_0xeaae('0x1d'))[_0xeaae('0x1e')](socket);function respondWithStatusCode(_0x35a31d,_0x261116){_0x261116=_0x261116||0xcc;return function(_0x29b982){if(_0x29b982){return _0x35a31d[_0xeaae('0x1f')](_0x261116);}return _0x35a31d[_0xeaae('0x20')](_0x261116)[_0xeaae('0x21')]();};}function respondWithResult(_0x39bada,_0x1277cf){_0x1277cf=_0x1277cf||0xc8;return function(_0x29d624){if(_0x29d624){return _0x39bada[_0xeaae('0x20')](_0x1277cf)['json'](_0x29d624);}};}function respondWithFilteredResult(_0x32ec1e,_0x5b3235){return function(_0x3ace1f){if(_0x3ace1f){var _0x10b6bf=typeof _0x5b3235[_0xeaae('0x22')]===_0xeaae('0x23')&&typeof _0x5b3235[_0xeaae('0x24')]===_0xeaae('0x23');var _0xeb2ecf=_0x3ace1f['count'];var _0x39ca53=_0x10b6bf?0x0:_0x5b3235[_0xeaae('0x22')];var _0x344171=_0x10b6bf?_0x3ace1f[_0xeaae('0x25')]:_0x5b3235[_0xeaae('0x22')]+_0x5b3235[_0xeaae('0x24')];var _0x57f8f9;if(_0x344171>=_0xeb2ecf){_0x344171=_0xeb2ecf;_0x57f8f9=0xc8;}else{_0x57f8f9=0xce;}_0x32ec1e[_0xeaae('0x20')](_0x57f8f9);return _0x32ec1e[_0xeaae('0x26')]('Content-Range',_0x39ca53+'-'+_0x344171+'/'+_0xeb2ecf)[_0xeaae('0x27')](_0x3ace1f);}return null;};}function patchUpdates(_0x5b69c1){return function(_0x3a14e6){try{jsonpatch[_0xeaae('0x28')](_0x3a14e6,_0x5b69c1,!![]);}catch(_0x2b7b6f){return BPromise[_0xeaae('0x29')](_0x2b7b6f);}return _0x3a14e6['save']();};}function saveUpdates(_0x445b35,_0x1e429d){return function(_0x324a1e){if(_0x324a1e){return _0x324a1e['update'](_0x445b35)['then'](function(_0x4129ed){return _0x4129ed;});}return null;};}function removeEntity(_0x305c15,_0x2d0ff4){return function(_0x1b37fe){if(_0x1b37fe){return _0x1b37fe[_0xeaae('0x2a')]()['then'](function(){_0x305c15[_0xeaae('0x20')](0xcc)[_0xeaae('0x21')]();});}};}function handleEntityNotFound(_0x54997c,_0x3433c4){return function(_0x3bd47a){if(!_0x3bd47a){_0x54997c[_0xeaae('0x1f')](0x194);}return _0x3bd47a;};}function handleError(_0x38729a,_0x4f4285){_0x4f4285=_0x4f4285||0x1f4;return function(_0x3ec714){logger[_0xeaae('0x2b')](_0x3ec714[_0xeaae('0x2c')]);if(_0x3ec714['name']){delete _0x3ec714[_0xeaae('0x2d')];}_0x38729a[_0xeaae('0x20')](_0x4f4285)[_0xeaae('0x2e')](_0x3ec714);};}exports[_0xeaae('0x2f')]=function(_0x1f09f4,_0x47f796){var _0x1a9967={'raw':![],'where':{'id':_0x1f09f4['params']['id']}},_0x3b73fa={};_0x3b73fa[_0xeaae('0x30')]=_['keys'](db[_0xeaae('0x31')]['rawAttributes']);_0x3b73fa[_0xeaae('0x32')]=_[_0xeaae('0x33')](_0x1f09f4['query']);_0x3b73fa[_0xeaae('0x34')]=_[_0xeaae('0x35')](_0x3b73fa[_0xeaae('0x30')],_0x3b73fa[_0xeaae('0x32')]);_0x1a9967['attributes']=_[_0xeaae('0x35')](_0x3b73fa[_0xeaae('0x30')],qs['fields'](_0x1f09f4['query'][_0xeaae('0x36')]));_0x1a9967[_0xeaae('0x37')]=_0x1a9967[_0xeaae('0x37')]['length']?_0x1a9967[_0xeaae('0x37')]:_0x3b73fa[_0xeaae('0x30')];if(_0x1f09f4[_0xeaae('0x32')][_0xeaae('0x38')]){_0x1a9967[_0xeaae('0x39')]=[{'all':!![]}];}_0x1a9967=_[_0xeaae('0x3a')]({},_0x1a9967,_0x1f09f4['options']);return db[_0xeaae('0x31')]['find'](_0x1a9967)[_0xeaae('0x3b')](handleEntityNotFound(_0x47f796,null))[_0xeaae('0x3b')](respondWithResult(_0x47f796,null))['catch'](handleError(_0x47f796,null));};exports[_0xeaae('0x2a')]=function(_0x15a7de,_0x1aa432){return db['DashboardItem'][_0xeaae('0x3c')]({'where':{'id':_0x15a7de[_0xeaae('0x3d')]['id']}})[_0xeaae('0x3b')](handleEntityNotFound(_0x1aa432,null))[_0xeaae('0x3b')](removeEntity(_0x1aa432,null))[_0xeaae('0x3e')](handleError(_0x1aa432,null));};function widgetAttributes(_0x38d86c){try{switch(_0x38d86c[_0xeaae('0x3f')]){case'iframe':return[{'name':_0xeaae('0x40'),'value':_0x38d86c[_0xeaae('0x40')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c[_0xeaae('0x41')][0x0][_0xeaae('0x42')]:undefined)||'https://'}];case'custom':return[{'name':_0xeaae('0x43'),'value':_0x38d86c[_0xeaae('0x43')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c[_0xeaae('0x41')][0x0][_0xeaae('0x42')]:undefined)||''}];case _0xeaae('0x44'):return[{'name':_0xeaae('0x45'),'value':_0x38d86c[_0xeaae('0x45')]||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c['attrs'][0x0][_0xeaae('0x42')]:undefined)||_0xeaae('0x46')},{'name':'attrTimezone','value':_0x38d86c['attrTimezone']||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x1]?_0x38d86c['attrs'][0x1]['value']:undefined)||_0xeaae('0x47')},{'name':_0xeaae('0x48'),'value':_0x38d86c[_0xeaae('0x48')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x2]?_0x38d86c[_0xeaae('0x41')][0x2]['value']:undefined)||0xc}];case _0xeaae('0x49'):return[{'name':'attrMetric','value':_0x38d86c[_0xeaae('0x4a')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c[_0xeaae('0x41')][0x0]['value']:undefined)||_0xeaae('0x4b')},{'name':_0xeaae('0x4c'),'value':_0x38d86c['attrVoiceQueues']||(_0x38d86c['attrs']&&_0x38d86c['attrs'][0x1]?_0x38d86c['attrs'][0x1]['value']:undefined)||[]},{'name':_0xeaae('0x48'),'value':_0x38d86c[_0xeaae('0x48')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c['attrs'][0x2]?_0x38d86c['attrs'][0x2][_0xeaae('0x42')]:undefined)||0x14},{'name':_0xeaae('0x4d'),'value':_0x38d86c[_0xeaae('0x4d')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x3]?_0x38d86c[_0xeaae('0x41')][0x3][_0xeaae('0x42')]:undefined)||_0xeaae('0x4e')},{'name':_0xeaae('0x4f'),'value':_0x38d86c[_0xeaae('0x4f')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x4]?_0x38d86c['attrs'][0x4][_0xeaae('0x42')]:undefined)||''},{'name':_0xeaae('0x50'),'value':_0x38d86c[_0xeaae('0x50')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x5]?_0x38d86c['attrs'][0x5][_0xeaae('0x42')]:undefined)||''},{'name':_0xeaae('0x51'),'value':_0x38d86c[_0xeaae('0x51')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x6]?_0x38d86c[_0xeaae('0x41')][0x6][_0xeaae('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x38d86c[_0xeaae('0x52')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c['attrs'][0x7]?_0x38d86c['attrs'][0x7][_0xeaae('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d86c[_0xeaae('0x53')]||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x8]?_0x38d86c[_0xeaae('0x41')][0x8][_0xeaae('0x42')]:undefined)||''},{'name':_0xeaae('0x54'),'value':_0x38d86c[_0xeaae('0x54')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x9]?_0x38d86c[_0xeaae('0x41')][0x9][_0xeaae('0x42')]:undefined)||''}];case _0xeaae('0x55'):case _0xeaae('0x56'):return[{'name':_0xeaae('0x57'),'value':_0x38d86c[_0xeaae('0x57')]||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c[_0xeaae('0x41')][0x0][_0xeaae('0x42')]:undefined)||_0xeaae('0x4b')},{'name':_0xeaae('0x58'),'value':_0x38d86c[_0xeaae('0x58')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x1]?_0x38d86c['attrs'][0x1]['value']:undefined)||null},{'name':_0xeaae('0x59'),'value':_0x38d86c[_0xeaae('0x59')]||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x2]?_0x38d86c[_0xeaae('0x41')][0x2]['value']:undefined)||null},{'name':_0xeaae('0x4c'),'value':_0x38d86c[_0xeaae('0x4c')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x3]?_0x38d86c[_0xeaae('0x41')][0x3][_0xeaae('0x42')]:undefined)||[]},{'name':'attrChannel','value':_0x38d86c[_0xeaae('0x4d')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x4]?_0x38d86c[_0xeaae('0x41')][0x4][_0xeaae('0x42')]:undefined)||_0xeaae('0x4e')},{'name':_0xeaae('0x4f'),'value':_0x38d86c['attrEmailAccounts']||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x5]?_0x38d86c[_0xeaae('0x41')][0x5][_0xeaae('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38d86c['attrFaxAccounts']||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x6]?_0x38d86c[_0xeaae('0x41')][0x6][_0xeaae('0x42')]:undefined)||''},{'name':_0xeaae('0x51'),'value':_0x38d86c[_0xeaae('0x51')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x7]?_0x38d86c[_0xeaae('0x41')][0x7][_0xeaae('0x42')]:undefined)||''},{'name':_0xeaae('0x52'),'value':_0x38d86c[_0xeaae('0x52')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x8]?_0x38d86c[_0xeaae('0x41')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d86c[_0xeaae('0x53')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x9]?_0x38d86c[_0xeaae('0x41')][0x9][_0xeaae('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x38d86c[_0xeaae('0x54')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0xa]?_0x38d86c[_0xeaae('0x41')][0xa][_0xeaae('0x42')]:undefined)||''}];case _0xeaae('0x5a'):return[{'name':_0xeaae('0x5b'),'type':_0x38d86c[_0xeaae('0x5c')]||(_0x38d86c['attrs']&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c[_0xeaae('0x41')][0x0][_0xeaae('0x3f')]:undefined)||null,'value':_0x38d86c[_0xeaae('0x5b')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x0]?_0x38d86c[_0xeaae('0x41')][0x0][_0xeaae('0x42')]:undefined)||null},{'name':_0xeaae('0x5d'),'value':_0x38d86c[_0xeaae('0x5d')]||(_0x38d86c[_0xeaae('0x41')]&&_0x38d86c[_0xeaae('0x41')][0x1]?_0x38d86c[_0xeaae('0x41')][0x1][_0xeaae('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x5ac176){logger[_0xeaae('0x2b')](_0xeaae('0x5e'),JSON[_0xeaae('0x5f')](_0x5ac176));return[];}}exports[_0xeaae('0x60')]=function(_0x163d1b,_0x36eb59){if(_0x163d1b[_0xeaae('0x61')]){_0x163d1b[_0xeaae('0x61')][_0xeaae('0x41')]=widgetAttributes(_0x163d1b[_0xeaae('0x61')]);}return db[_0xeaae('0x31')][_0xeaae('0x60')](_0x163d1b[_0xeaae('0x61')],{})['then'](respondWithResult(_0x36eb59,0xc9))[_0xeaae('0x3e')](handleError(_0x36eb59,null));};exports[_0xeaae('0x62')]=function(_0x2899a9,_0x333728){if(_0x2899a9[_0xeaae('0x61')]['id']){delete _0x2899a9[_0xeaae('0x61')]['id'];}_0x2899a9['body'][_0xeaae('0x41')]=widgetAttributes(_0x2899a9[_0xeaae('0x61')]);return db[_0xeaae('0x31')][_0xeaae('0x3c')]({'where':{'id':_0x2899a9[_0xeaae('0x3d')]['id']}})['then'](handleEntityNotFound(_0x333728,null))[_0xeaae('0x3b')](saveUpdates(_0x2899a9[_0xeaae('0x61')],null))[_0xeaae('0x3b')](respondWithResult(_0x333728,null))[_0xeaae('0x3e')](handleError(_0x333728,null));}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 59453cb..80e2b4a 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 _0x78e7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x78e7,0xb1));var _0x778e=function(_0x52a1ca,_0x1eaa00){_0x52a1ca=_0x52a1ca-0x0;var _0x5b0966=_0x78e7[_0x52a1ca];return _0x5b0966;};'use strict';var EventEmitter=require(_0x778e('0x0'));var DashboardItem=require(_0x778e('0x1'))['db'][_0x778e('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x778e('0x3')](0x0);var events={'afterCreate':_0x778e('0x4'),'afterUpdate':_0x778e('0x5'),'afterDestroy':_0x778e('0x6')};function emitEvent(_0x16c06e){return function(_0x21986f,_0x26bfa1,_0x4ff453){DashboardItemEvents[_0x778e('0x7')](_0x16c06e+':'+_0x21986f['id'],_0x21986f);DashboardItemEvents[_0x778e('0x7')](_0x16c06e,_0x21986f);_0x4ff453(null);};}for(var e in events){if(events[_0x778e('0x8')](e)){var event=events[e];DashboardItem[_0x778e('0x9')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 9640cc4..6c30bfb 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 _0x1c08=['dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x5a617b,_0x3edb2c){var _0x295469=function(_0x3981a7){while(--_0x3981a7){_0x5a617b['push'](_0x5a617b['shift']());}};_0x295469(++_0x3edb2c);}(_0x1c08,0x17b));var _0x81c0=function(_0x18eeaa,_0x4380b6){_0x18eeaa=_0x18eeaa-0x0;var _0x23d240=_0x1c08[_0x18eeaa];return _0x23d240;};'use strict';var _=require(_0x81c0('0x0'));var util=require(_0x81c0('0x1'));var logger=require(_0x81c0('0x2'))(_0x81c0('0x3'));var moment=require('moment');var BPromise=require(_0x81c0('0x4'));var rp=require(_0x81c0('0x5'));var fs=require('fs');var path=require(_0x81c0('0x6'));var rimraf=require(_0x81c0('0x7'));var config=require(_0x81c0('0x8'));var attributes=require(_0x81c0('0x9'));module[_0x81c0('0xa')]=function(_0x472cde,_0x47c1b9){return _0x472cde[_0x81c0('0xb')](_0x81c0('0xc'),attributes,{'tableName':_0x81c0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0119a8c..003e930 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 _0x6896=['./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x7e460,_0x3cfade){var _0x290ef4=function(_0x428043){while(--_0x428043){_0x7e460['push'](_0x7e460['shift']());}};_0x290ef4(++_0x3cfade);}(_0x6896,0x7a));var _0x6689=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6896[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x6689('0x0'));var moment=require('moment');var BPromise=require(_0x6689('0x1'));var rs=require(_0x6689('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6689('0x3'))['db'];var utils=require(_0x6689('0x4'));var logger=require(_0x6689('0x5'))(_0x6689('0x6'));var config=require('../../config/environment');var jayson=require(_0x6689('0x7'));var client=jayson[_0x6689('0x8')]['http']({'port':0x232a});config[_0x6689('0x9')]=_['defaults'](config[_0x6689('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6689('0x9')]));require(_0x6689('0xa'))['register'](socket);function respondWithRpcPromise(_0x1ba399,_0x1e7472,_0x44159a){return new BPromise(function(_0x204334,_0x58f19c){return client['request'](_0x1ba399,_0x44159a)[_0x6689('0xb')](function(_0x10857){logger[_0x6689('0xc')](_0x6689('0xd'),_0x1e7472,_0x6689('0xe'));logger[_0x6689('0xf')](_0x6689('0x10'),_0x1e7472,'request\x20sent',JSON[_0x6689('0x11')](_0x10857));if(_0x10857[_0x6689('0x12')]){if(_0x10857[_0x6689('0x12')][_0x6689('0x13')]===0x1f4){logger['error'](_0x6689('0xd'),_0x1e7472,_0x10857[_0x6689('0x12')][_0x6689('0x14')]);return _0x58f19c(_0x10857[_0x6689('0x12')][_0x6689('0x14')]);}logger['error'](_0x6689('0xd'),_0x1e7472,_0x10857['error']['message']);return _0x204334(_0x10857[_0x6689('0x12')][_0x6689('0x14')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x1e7472,'request\x20sent');_0x204334(_0x10857['result'][_0x6689('0x14')]);}})[_0x6689('0x15')](function(_0x3fc784){logger[_0x6689('0x12')](_0x6689('0xd'),_0x1e7472,_0x3fc784);_0x58f19c(_0x3fc784);});});} \ No newline at end of file +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 diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 7ae14af..bdaa29d 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 _0x68a5=['register','length','dashboardItem:','./dashboardItem.events','remove','update','emit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x68a5,0x1a0));var _0x568a=function(_0x4a9f88,_0x433825){_0x4a9f88=_0x4a9f88-0x0;var _0x2856a8=_0x68a5[_0x4a9f88];return _0x2856a8;};'use strict';var DashboardItemEvents=require(_0x568a('0x0'));var events=['save',_0x568a('0x1'),_0x568a('0x2')];function createListener(_0x1b575d,_0x5486cf){return function(_0x2d0d28){_0x5486cf[_0x568a('0x3')](_0x1b575d,_0x2d0d28);};}function removeListener(_0x1f9703,_0x704572){return function(){DashboardItemEvents['removeListener'](_0x1f9703,_0x704572);};}exports[_0x568a('0x4')]=function(_0x167d06){for(var _0x8833a2=0x0,_0xc05e9d=events[_0x568a('0x5')];_0x8833a2<_0xc05e9d;_0x8833a2++){var _0x48732a=events[_0x8833a2];var _0x1ba5bc=createListener(_0x568a('0x6')+_0x48732a,_0x167d06);DashboardItemEvents['on'](_0x48732a,_0x1ba5bc);}}; \ No newline at end of file +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 diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b14322c..2e2bbcc 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 _0x4985=['isAuthenticated','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','show','post'];(function(_0x1d165f,_0x178107){var _0x4110ad=function(_0x5366c9){while(--_0x5366c9){_0x1d165f['push'](_0x1d165f['shift']());}};_0x4110ad(++_0x178107);}(_0x4985,0x1a4));var _0x5498=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x4985[_0x186376];return _0x2dbdd9;};'use strict';var multer=require(_0x5498('0x0'));var util=require('util');var path=require(_0x5498('0x1'));var timeout=require(_0x5498('0x2'));var express=require(_0x5498('0x3'));var router=express[_0x5498('0x4')]();var fs_extra=require(_0x5498('0x5'));var auth=require(_0x5498('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5498('0x7'));var controller=require(_0x5498('0x8'));router['get'](_0x5498('0x9'),auth['isAuthenticated'](),controller[_0x5498('0xa')]);router[_0x5498('0xb')]('/',auth[_0x5498('0xc')](),controller['create']);router[_0x5498('0xd')]('/:id',auth[_0x5498('0xc')](),controller['update']);router['delete'](_0x5498('0x9'),auth[_0x5498('0xc')](),controller[_0x5498('0xe')]);module[_0x5498('0xf')]=router; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 36708de..ba3da75 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 _0x66c1=['third','STRING','second'];(function(_0x9dcb24,_0x3d6f50){var _0x44f4f1=function(_0x5216d7){while(--_0x5216d7){_0x9dcb24['push'](_0x9dcb24['shift']());}};_0x44f4f1(++_0x3d6f50);}(_0x66c1,0xd0));var _0x166c=function(_0x9b9713,_0x14152a){_0x9b9713=_0x9b9713-0x0;var _0x208406=_0x66c1[_0x9b9713];return _0x208406;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x166c('0x0')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x166c('0x1'),_0x166c('0x2')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x166c('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 5dc8faa..28c7cb5 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 _0x0023=['options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','error','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','map','Disposition','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x0023,0x10a));var _0x3002=function(_0x5a62e8,_0xcb65a9){_0x5a62e8=_0x5a62e8-0x0;var _0x46571c=_0x0023[_0x5a62e8];return _0x46571c;};'use strict';var emlformat=require(_0x3002('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3002('0x1'));var jsonpatch=require(_0x3002('0x2'));var rp=require(_0x3002('0x3'));var moment=require(_0x3002('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3002('0x5'));var util=require(_0x3002('0x6'));var path=require('path');var sox=require(_0x3002('0x7'));var csv=require('to-csv');var ejs=require(_0x3002('0x8'));var fs=require('fs');var fs_extra=require(_0x3002('0x9'));var _=require(_0x3002('0xa'));var squel=require(_0x3002('0xb'));var crypto=require(_0x3002('0xc'));var jsforce=require(_0x3002('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3002('0xe'));var querystring=require('querystring');var Papa=require(_0x3002('0xf'));var Redis=require(_0x3002('0x10'));var authService=require(_0x3002('0x11'));var qs=require(_0x3002('0x12'));var as=require(_0x3002('0x13'));var hardwareService=require(_0x3002('0x14'));var logger=require('../../config/logger')(_0x3002('0x15'));var utils=require(_0x3002('0x16'));var config=require(_0x3002('0x17'));var licenseUtil=require(_0x3002('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36834e,_0x723bc3){_0x723bc3=_0x723bc3||0xcc;return function(_0x10c7c2){if(_0x10c7c2){return _0x36834e[_0x3002('0x19')](_0x723bc3);}return _0x36834e[_0x3002('0x1a')](_0x723bc3)[_0x3002('0x1b')]();};}function respondWithResult(_0x2148b6,_0x318cfd){_0x318cfd=_0x318cfd||0xc8;return function(_0x2ec1f0){if(_0x2ec1f0){return _0x2148b6[_0x3002('0x1a')](_0x318cfd)[_0x3002('0x1c')](_0x2ec1f0);}};}function respondWithFilteredResult(_0x7a9a2c,_0x5391c8){return function(_0x1bc179){if(_0x1bc179){var _0x54c8fd=typeof _0x5391c8[_0x3002('0x1d')]==='undefined'&&typeof _0x5391c8['limit']===_0x3002('0x1e');var _0x5d12e7=_0x1bc179[_0x3002('0x1f')];var _0x4a75aa=_0x54c8fd?0x0:_0x5391c8['offset'];var _0x42367a=_0x54c8fd?_0x1bc179[_0x3002('0x1f')]:_0x5391c8[_0x3002('0x1d')]+_0x5391c8[_0x3002('0x20')];var _0x3894a2;if(_0x42367a>=_0x5d12e7){_0x42367a=_0x5d12e7;_0x3894a2=0xc8;}else{_0x3894a2=0xce;}_0x7a9a2c[_0x3002('0x1a')](_0x3894a2);return _0x7a9a2c['set'](_0x3002('0x21'),_0x4a75aa+'-'+_0x42367a+'/'+_0x5d12e7)['json'](_0x1bc179);}return null;};}function patchUpdates(_0x1a1105){return function(_0x335e9b){try{jsonpatch[_0x3002('0x22')](_0x335e9b,_0x1a1105,!![]);}catch(_0x5621d0){return BPromise[_0x3002('0x23')](_0x5621d0);}return _0x335e9b[_0x3002('0x24')]();};}function saveUpdates(_0x67c16,_0x4c144e){return function(_0x159a0e){if(_0x159a0e){return _0x159a0e[_0x3002('0x25')](_0x67c16)[_0x3002('0x26')](function(_0xe953f9){return _0xe953f9;});}return null;};}function removeEntity(_0x4d0ad6,_0xfaf37a){return function(_0x266af8){if(_0x266af8){return _0x266af8[_0x3002('0x27')]()[_0x3002('0x26')](function(){var _0x14cdb4=_0x266af8[_0x3002('0x28')]({'plain':!![]});var _0x338d0e=_0x3002('0x29');return db[_0x3002('0x2a')]['destroy']({'where':{'type':_0x338d0e,'resourceId':_0x14cdb4['id']}})[_0x3002('0x26')](function(){return _0x266af8;});})[_0x3002('0x26')](function(){_0x4d0ad6[_0x3002('0x1a')](0xcc)[_0x3002('0x1b')]();});}};}function handleEntityNotFound(_0x50675f,_0x11be1c){return function(_0x3f5298){if(!_0x3f5298){_0x50675f[_0x3002('0x19')](0x194);}return _0x3f5298;};}function handleError(_0x2bfd82,_0x2db746){_0x2db746=_0x2db746||0x1f4;return function(_0x2963ef){logger['error'](_0x2963ef[_0x3002('0x2b')]);if(_0x2963ef[_0x3002('0x2c')]){delete _0x2963ef[_0x3002('0x2c')];}_0x2bfd82[_0x3002('0x1a')](_0x2db746)[_0x3002('0x2d')](_0x2963ef);};}exports['index']=function(_0x15b687,_0x583ded){var _0x5a18b0={},_0x18c50e={},_0x122899={'count':0x0,'rows':[]};var _0x3c275b=_[_0x3002('0x2e')](db[_0x3002('0x2f')][_0x3002('0x30')],function(_0x100182){return{'name':_0x100182['fieldName'],'type':_0x100182[_0x3002('0x31')][_0x3002('0x32')]};});_0x18c50e['model']=_[_0x3002('0x2e')](_0x3c275b,'name');_0x18c50e[_0x3002('0x33')]=_[_0x3002('0x34')](_0x15b687[_0x3002('0x33')]);_0x18c50e[_0x3002('0x35')]=_['intersection'](_0x18c50e[_0x3002('0x36')],_0x18c50e[_0x3002('0x33')]);_0x5a18b0[_0x3002('0x37')]=_[_0x3002('0x38')](_0x18c50e[_0x3002('0x36')],qs['fields'](_0x15b687[_0x3002('0x33')][_0x3002('0x39')]));_0x5a18b0[_0x3002('0x37')]=_0x5a18b0[_0x3002('0x37')]['length']?_0x5a18b0[_0x3002('0x37')]:_0x18c50e['model'];if(!_0x15b687[_0x3002('0x33')][_0x3002('0x3a')](_0x3002('0x3b'))){_0x5a18b0['limit']=qs['limit'](_0x15b687[_0x3002('0x33')][_0x3002('0x20')]);_0x5a18b0[_0x3002('0x1d')]=qs[_0x3002('0x1d')](_0x15b687[_0x3002('0x33')][_0x3002('0x1d')]);}_0x5a18b0['order']=qs[_0x3002('0x3c')](_0x15b687['query'][_0x3002('0x3c')]);_0x5a18b0[_0x3002('0x3d')]=qs[_0x3002('0x35')](_[_0x3002('0x3e')](_0x15b687[_0x3002('0x33')],_0x18c50e[_0x3002('0x35')]),_0x3c275b);if(_0x15b687[_0x3002('0x33')][_0x3002('0x3f')]){_0x5a18b0[_0x3002('0x3d')]=_[_0x3002('0x40')](_0x5a18b0['where'],{'$or':_[_0x3002('0x2e')](_0x3c275b,function(_0x170301){if(_0x170301['type']!==_0x3002('0x41')){var _0x361172={};_0x361172[_0x170301[_0x3002('0x2c')]]={'$like':'%'+_0x15b687['query'][_0x3002('0x3f')]+'%'};return _0x361172;}})});}_0x5a18b0=_[_0x3002('0x40')]({},_0x5a18b0,_0x15b687[_0x3002('0x42')]);var _0x196939={'where':_0x5a18b0['where']};return db[_0x3002('0x2f')][_0x3002('0x1f')](_0x196939)[_0x3002('0x26')](function(_0x11594d){_0x122899[_0x3002('0x1f')]=_0x11594d;if(_0x15b687[_0x3002('0x33')][_0x3002('0x43')]){_0x5a18b0[_0x3002('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x3002('0x45')](_0x5a18b0);})[_0x3002('0x26')](function(_0x271d6d){_0x122899[_0x3002('0x46')]=_0x271d6d;return _0x122899;})[_0x3002('0x26')](respondWithFilteredResult(_0x583ded,_0x5a18b0))[_0x3002('0x47')](handleError(_0x583ded,null));};exports[_0x3002('0x48')]=function(_0x2bd4d3,_0x14c3c4){var _0x3bc9e7={'raw':!![],'where':{'id':_0x2bd4d3[_0x3002('0x49')]['id']}},_0x15f0cd={};_0x15f0cd[_0x3002('0x36')]=_[_0x3002('0x34')](db[_0x3002('0x2f')][_0x3002('0x30')]);_0x15f0cd[_0x3002('0x33')]=_[_0x3002('0x34')](_0x2bd4d3[_0x3002('0x33')]);_0x15f0cd[_0x3002('0x35')]=_[_0x3002('0x38')](_0x15f0cd[_0x3002('0x36')],_0x15f0cd['query']);_0x3bc9e7[_0x3002('0x37')]=_[_0x3002('0x38')](_0x15f0cd[_0x3002('0x36')],qs[_0x3002('0x39')](_0x2bd4d3[_0x3002('0x33')]['fields']));_0x3bc9e7[_0x3002('0x37')]=_0x3bc9e7['attributes'][_0x3002('0x4a')]?_0x3bc9e7['attributes']:_0x15f0cd['model'];if(_0x2bd4d3['query'][_0x3002('0x43')]){_0x3bc9e7['include']=[{'all':!![]}];}_0x3bc9e7=_[_0x3002('0x40')]({},_0x3bc9e7,_0x2bd4d3[_0x3002('0x42')]);return db[_0x3002('0x2f')]['find'](_0x3bc9e7)['then'](handleEntityNotFound(_0x14c3c4,null))[_0x3002('0x26')](respondWithResult(_0x14c3c4,null))[_0x3002('0x47')](handleError(_0x14c3c4,null));};exports[_0x3002('0x4b')]=function(_0x370cda,_0x37af8b){return db[_0x3002('0x2f')][_0x3002('0x4b')](_0x370cda[_0x3002('0x4c')],{})[_0x3002('0x26')](function(_0x4e6cb4){var _0x5cde3e=_0x370cda[_0x3002('0x4d')][_0x3002('0x28')]({'plain':!![]});if(!_0x5cde3e)throw new Error(_0x3002('0x4e'));if(_0x5cde3e[_0x3002('0x4f')]===_0x3002('0x4d')){var _0x5ae248=_0x4e6cb4[_0x3002('0x28')]({'plain':!![]});var _0x4a1f2c=_0x3002('0x29');return db['UserProfileSection'][_0x3002('0x50')]({'where':{'name':_0x4a1f2c,'userProfileId':_0x5cde3e[_0x3002('0x51')]},'raw':!![]})['then'](function(_0x465c1a){if(_0x465c1a&&_0x465c1a['autoAssociation']===0x0){return db['UserProfileResource'][_0x3002('0x4b')]({'name':_0x5ae248[_0x3002('0x2c')],'resourceId':_0x5ae248['id'],'type':_0x465c1a[_0x3002('0x2c')],'sectionId':_0x465c1a['id']},{})['then'](function(){return _0x4e6cb4;});}else{return _0x4e6cb4;}})[_0x3002('0x47')](function(_0x164e38){logger[_0x3002('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x164e38);throw _0x164e38;});}return _0x4e6cb4;})['then'](respondWithResult(_0x37af8b,0xc9))['catch'](handleError(_0x37af8b,null));};exports['update']=function(_0x7c729,_0x337209){if(_0x7c729[_0x3002('0x4c')]['id']){delete _0x7c729[_0x3002('0x4c')]['id'];}return db[_0x3002('0x2f')][_0x3002('0x50')]({'where':{'id':_0x7c729['params']['id']}})[_0x3002('0x26')](handleEntityNotFound(_0x337209,null))['then'](saveUpdates(_0x7c729[_0x3002('0x4c')],null))[_0x3002('0x26')](respondWithResult(_0x337209,null))[_0x3002('0x47')](handleError(_0x337209,null));};exports['destroy']=function(_0x349c38,_0x41238c){return db[_0x3002('0x2f')][_0x3002('0x50')]({'where':{'id':_0x349c38['params']['id']}})[_0x3002('0x26')](handleEntityNotFound(_0x41238c,null))[_0x3002('0x26')](removeEntity(_0x41238c,null))['catch'](handleError(_0x41238c,null));}; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a09c123..a596fe0 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 _0x0035=['bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','moment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0035,0x1d8));var _0x5003=function(_0x20713e,_0x44f710){_0x20713e=_0x20713e-0x0;var _0x7d998b=_0x0035[_0x20713e];return _0x7d998b;};'use strict';var _=require('lodash');var util=require(_0x5003('0x0'));var logger=require(_0x5003('0x1'))('api');var moment=require(_0x5003('0x2'));var BPromise=require(_0x5003('0x3'));var rp=require(_0x5003('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5003('0x5'));var config=require(_0x5003('0x6'));var attributes=require(_0x5003('0x7'));module[_0x5003('0x8')]=function(_0x32a402,_0x30d4e5){return _0x32a402[_0x5003('0x9')](_0x5003('0xa'),attributes,{'tableName':_0x5003('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5003('0xc'),'fields':[_0x5003('0xd'),_0x5003('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x5003('0xd'),_0x5003('0xf')]},{'unique':!![],'name':_0x5003('0x10'),'fields':[_0x5003('0xd'),_0x5003('0x11')]},{'unique':!![],'name':_0x5003('0x12'),'fields':[_0x5003('0xd'),_0x5003('0x13')]},{'unique':!![],'name':_0x5003('0x14'),'fields':['name',_0x5003('0x15')]},{'unique':!![],'name':_0x5003('0x16'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x5003('0x17'),'fields':[_0x5003('0xd'),_0x5003('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 071f3ba..bf0c64f 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(_0xdbaeb5,_0x5cd9e5){var _0xad871b=function(_0x5caff6){while(--_0x5caff6){_0xdbaeb5['push'](_0xdbaeb5['shift']());}};_0xad871b(++_0x5cd9e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_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 diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index dfd72e1..6a3e826 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 _0xbd2a=['express','Router','../../components/auth/service','../../config/environment','get','/:id','show','post','create','put','update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout'];(function(_0x386190,_0x41428d){var _0x50d46e=function(_0x29303d){while(--_0x29303d){_0x386190['push'](_0x386190['shift']());}};_0x50d46e(++_0x41428d);}(_0xbd2a,0x1ac));var _0xabd2=function(_0x55eb4e,_0x3e78d3){_0x55eb4e=_0x55eb4e-0x0;var _0x250ff7=_0xbd2a[_0x55eb4e];return _0x250ff7;};'use strict';var multer=require(_0xabd2('0x0'));var util=require(_0xabd2('0x1'));var path=require(_0xabd2('0x2'));var timeout=require(_0xabd2('0x3'));var express=require(_0xabd2('0x4'));var router=express[_0xabd2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xabd2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabd2('0x7'));var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xabd2('0x8')](_0xabd2('0x9'),auth['isAuthenticated'](),controller[_0xabd2('0xa')]);router[_0xabd2('0xb')]('/',auth['isAuthenticated'](),controller[_0xabd2('0xc')]);router[_0xabd2('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xabd2('0xe')]);router[_0xabd2('0xf')]('/:id',auth[_0xabd2('0x10')](),controller[_0xabd2('0x11')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f312b91..615c1d9 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 _0x326f=['4800','INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x38a7bd,_0x274871){_0x38a7bd=_0x38a7bd-0x0;var _0x2b691c=_0x326f[_0x38a7bd];return _0x2b691c;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf326('0x1')]},'ecm':{'type':Sequelize[_0xf326('0x2')](_0xf326('0x3'),'no'),'defaultValue':_0xf326('0x3')},'headerinfo':{'type':Sequelize[_0xf326('0x1')],'defaultValue':_0xf326('0x4')},'localstationid':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x5')},'minrate':{'type':Sequelize[_0xf326('0x2')](_0xf326('0x6'),'4800',_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM']('2400',_0xf326('0xb'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf326('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xf326('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf326('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xf326('0xd'),_0xf326('0xe'),'DADHI',_0xf326('0xf')),'defaultValue':_0xf326('0xd')},'key':{'type':Sequelize[_0xf326('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf326('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf326('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf326('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf326('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf326('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf326('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf326('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf326('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf326('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xf326('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3ad7da){if(!_0x3ad7da)this[_0xf326('0x13')](_0xf326('0x14'),null);this[_0xf326('0x13')](_0xf326('0x15'),_0x3ad7da);}}}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 591d941..0a6a050 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 _0x1dc3=['include','findAll','rows','show','params','Pause','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','describe','addDisposition','Disposition','getDispositions','findOne','order','sort','FaxAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','options','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','sendStatus','json','getApplications','context','from-voip-provider','exten','localstationid','system','description','appdata','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','FaxAccounts','stack','name','send','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','where','filter','FaxAccount','includeAll'];(function(_0x410b8d,_0x3627cd){var _0x5101b1=function(_0x24a0d0){while(--_0x24a0d0){_0x410b8d['push'](_0x410b8d['shift']());}};_0x5101b1(++_0x3627cd);}(_0x1dc3,0x73));var _0x31dc=function(_0xf63033,_0x164b22){_0xf63033=_0xf63033-0x0;var _0x18dca0=_0x1dc3[_0xf63033];return _0x18dca0;};'use strict';var emlformat=require(_0x31dc('0x0'));var rimraf=require(_0x31dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x31dc('0x2'));var moment=require(_0x31dc('0x3'));var BPromise=require(_0x31dc('0x4'));var Mustache=require(_0x31dc('0x5'));var util=require(_0x31dc('0x6'));var path=require(_0x31dc('0x7'));var sox=require(_0x31dc('0x8'));var csv=require('to-csv');var ejs=require(_0x31dc('0x9'));var fs=require('fs');var fs_extra=require(_0x31dc('0xa'));var _=require(_0x31dc('0xb'));var squel=require(_0x31dc('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x31dc('0xd'));var toCsv=require(_0x31dc('0xe'));var querystring=require(_0x31dc('0xf'));var Papa=require(_0x31dc('0x10'));var Redis=require(_0x31dc('0x11'));var authService=require(_0x31dc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x31dc('0x13'));var hardwareService=require(_0x31dc('0x14'));var logger=require(_0x31dc('0x15'))(_0x31dc('0x16'));var utils=require(_0x31dc('0x17'));var config=require(_0x31dc('0x18'));var licenseUtil=require(_0x31dc('0x19'));var db=require(_0x31dc('0x1a'))['db'];config[_0x31dc('0x1b')]=_[_0x31dc('0x1c')](config[_0x31dc('0x1b')],{'host':_0x31dc('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x31dc('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x31dc('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x31dc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x506b59,_0x46001a,_0x45178b,_0x2df3fa){return new BPromise(function(_0x2c465f,_0x3dfbb8){var _0x56afed=_0x2df3fa||client;return _0x56afed[_0x31dc('0x20')](_0x506b59,_0x45178b)[_0x31dc('0x21')](function(_0x4e7599){logger[_0x31dc('0x22')](_0x31dc('0x23'),_0x46001a,_0x31dc('0x24'));logger['debug'](_0x31dc('0x25'),_0x46001a,'request\x20sent',JSON[_0x31dc('0x26')](_0x4e7599));if(_0x4e7599[_0x31dc('0x27')]){if(_0x4e7599[_0x31dc('0x27')][_0x31dc('0x28')]===0x1f4){logger[_0x31dc('0x27')]('FaxAccount,\x20%s,\x20%s',_0x46001a,_0x4e7599['error'][_0x31dc('0x29')]);return _0x3dfbb8(_0x4e7599[_0x31dc('0x27')][_0x31dc('0x29')]);}logger[_0x31dc('0x27')](_0x31dc('0x23'),_0x46001a,_0x4e7599[_0x31dc('0x27')][_0x31dc('0x29')]);return _0x2c465f(_0x4e7599[_0x31dc('0x27')][_0x31dc('0x29')]);}else{logger[_0x31dc('0x22')](_0x31dc('0x23'),_0x46001a,_0x31dc('0x24'));_0x2c465f(_0x4e7599['result'][_0x31dc('0x29')]);}})[_0x31dc('0x2a')](function(_0x29949e){logger[_0x31dc('0x27')](_0x31dc('0x23'),_0x46001a,_0x29949e);_0x3dfbb8(_0x29949e);});});}function respondWithStatusCode(_0x544a52,_0x4cfd98){_0x4cfd98=_0x4cfd98||0xcc;return function(_0x458c03){if(_0x458c03){return _0x544a52['sendStatus'](_0x4cfd98);}return _0x544a52[_0x31dc('0x2b')](_0x4cfd98)[_0x31dc('0x2c')]();};}function respondWithResult(_0x42859f,_0xaccfeb){_0xaccfeb=_0xaccfeb||0xc8;return function(_0x14b311){if(_0x14b311){return _0x42859f[_0x31dc('0x2b')](_0xaccfeb)['json'](_0x14b311);}};}function respondWithFilteredResult(_0x2f95ca,_0xabff51){return function(_0x3daa13){if(_0x3daa13){var _0x39922b=typeof _0xabff51[_0x31dc('0x2d')]===_0x31dc('0x2e')&&typeof _0xabff51[_0x31dc('0x2f')]==='undefined';var _0x2a91bb=_0x3daa13[_0x31dc('0x30')];var _0x6e4d46=_0x39922b?0x0:_0xabff51['offset'];var _0xe9724d=_0x39922b?_0x3daa13[_0x31dc('0x30')]:_0xabff51[_0x31dc('0x2d')]+_0xabff51[_0x31dc('0x2f')];var _0x38e16f;if(_0xe9724d>=_0x2a91bb){_0xe9724d=_0x2a91bb;_0x38e16f=0xc8;}else{_0x38e16f=0xce;}_0x2f95ca[_0x31dc('0x2b')](_0x38e16f);return _0x2f95ca['set'](_0x31dc('0x31'),_0x6e4d46+'-'+_0xe9724d+'/'+_0x2a91bb)['json'](_0x3daa13);}return null;};}function patchUpdates(_0x41d81e){return function(_0x534331){try{jsonpatch[_0x31dc('0x32')](_0x534331,_0x41d81e,!![]);}catch(_0x21839b){return BPromise[_0x31dc('0x33')](_0x21839b);}return _0x534331['save']();};}function saveUpdates(_0x1a1f20,_0x437a86){return function(_0x1ac49c){if(_0x1ac49c){return _0x1ac49c[_0x31dc('0x34')](_0x1a1f20)[_0x31dc('0x21')](function(_0x400aff){return _0x400aff;});}return null;};}function removeEntity(_0x20ed98,_0x464497){return function(_0x4ecf20){if(_0x4ecf20){return _0x4ecf20[_0x31dc('0x35')]()[_0x31dc('0x21')](function(){var _0x8ba7c2=_0x4ecf20[_0x31dc('0x36')]({'plain':!![]});var _0x46a4a8=_0x31dc('0x37');return db['UserProfileResource'][_0x31dc('0x35')]({'where':{'type':_0x46a4a8,'resourceId':_0x8ba7c2['id']}})[_0x31dc('0x21')](function(){return _0x4ecf20;});})['then'](function(){_0x20ed98[_0x31dc('0x2b')](0xcc)[_0x31dc('0x2c')]();});}};}function handleEntityNotFound(_0x3b5f31,_0x55c479){return function(_0x354a2f){if(!_0x354a2f){_0x3b5f31['sendStatus'](0x194);}return _0x354a2f;};}function handleError(_0x3013a8,_0x51ba24){_0x51ba24=_0x51ba24||0x1f4;return function(_0x48259b){logger['error'](_0x48259b[_0x31dc('0x38')]);if(_0x48259b[_0x31dc('0x39')]){delete _0x48259b[_0x31dc('0x39')];}_0x3013a8[_0x31dc('0x2b')](_0x51ba24)[_0x31dc('0x3a')](_0x48259b);};}exports['index']=function(_0x13d278,_0x255de3){var _0x5c3a95={'include':[{'model':db['Pause'],'as':_0x31dc('0x3b')}]},_0x590a16={},_0x211714={'count':0x0,'rows':[]};var _0x1db7d4=_['map'](db['FaxAccount'][_0x31dc('0x3c')],function(_0xbb41b4){return{'name':_0xbb41b4[_0x31dc('0x3d')],'type':_0xbb41b4[_0x31dc('0x3e')]['key']};});_0x590a16[_0x31dc('0x3f')]=_[_0x31dc('0x40')](_0x1db7d4,_0x31dc('0x39'));_0x590a16[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0x13d278[_0x31dc('0x41')]);_0x590a16[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x590a16[_0x31dc('0x3f')],_0x590a16[_0x31dc('0x41')]);_0x5c3a95[_0x31dc('0x45')]=_[_0x31dc('0x44')](_0x590a16[_0x31dc('0x3f')],qs[_0x31dc('0x46')](_0x13d278[_0x31dc('0x41')][_0x31dc('0x46')]));_0x5c3a95['attributes']=_0x5c3a95[_0x31dc('0x45')][_0x31dc('0x47')]?_0x5c3a95[_0x31dc('0x45')]:_0x590a16[_0x31dc('0x3f')];if(!_0x13d278['query'][_0x31dc('0x48')](_0x31dc('0x49'))){_0x5c3a95['limit']=qs[_0x31dc('0x2f')](_0x13d278[_0x31dc('0x41')][_0x31dc('0x2f')]);_0x5c3a95['offset']=qs[_0x31dc('0x2d')](_0x13d278[_0x31dc('0x41')][_0x31dc('0x2d')]);}_0x5c3a95['order']=qs['sort'](_0x13d278[_0x31dc('0x41')]['sort']);_0x5c3a95['where']=qs['filters'](_[_0x31dc('0x4a')](_0x13d278[_0x31dc('0x41')],_0x590a16[_0x31dc('0x43')]),_0x1db7d4);if(_0x13d278[_0x31dc('0x41')]['filter']){_0x5c3a95['where']=_['merge'](_0x5c3a95[_0x31dc('0x4b')],{'$or':_[_0x31dc('0x40')](_0x1db7d4,function(_0x54b066){if(_0x54b066['type']!=='VIRTUAL'){var _0x1ad00f={};_0x1ad00f[_0x54b066[_0x31dc('0x39')]]={'$like':'%'+_0x13d278[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x1ad00f;}})});}_0x5c3a95=_['merge']({},_0x5c3a95,_0x13d278['options']);var _0xaf852f={'where':_0x5c3a95[_0x31dc('0x4b')]};return db[_0x31dc('0x4d')][_0x31dc('0x30')](_0xaf852f)[_0x31dc('0x21')](function(_0x206cc5){_0x211714[_0x31dc('0x30')]=_0x206cc5;if(_0x13d278[_0x31dc('0x41')][_0x31dc('0x4e')]){_0x5c3a95[_0x31dc('0x4f')]=[{'all':!![]}];}return db[_0x31dc('0x4d')][_0x31dc('0x50')](_0x5c3a95);})[_0x31dc('0x21')](function(_0x256835){_0x211714[_0x31dc('0x51')]=_0x256835;return _0x211714;})[_0x31dc('0x21')](respondWithFilteredResult(_0x255de3,_0x5c3a95))[_0x31dc('0x2a')](handleError(_0x255de3,null));};exports[_0x31dc('0x52')]=function(_0x266262,_0x236d12){var _0x547558={'raw':![],'where':{'id':_0x266262[_0x31dc('0x53')]['id']},'include':[{'model':db[_0x31dc('0x54')],'as':_0x31dc('0x3b')}]},_0x3322e0={};_0x3322e0[_0x31dc('0x3f')]=_[_0x31dc('0x42')](db[_0x31dc('0x4d')][_0x31dc('0x3c')]);_0x3322e0[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0x266262[_0x31dc('0x41')]);_0x3322e0[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x3322e0[_0x31dc('0x3f')],_0x3322e0[_0x31dc('0x41')]);_0x547558[_0x31dc('0x45')]=_[_0x31dc('0x44')](_0x3322e0[_0x31dc('0x3f')],qs['fields'](_0x266262[_0x31dc('0x41')][_0x31dc('0x46')]));_0x547558[_0x31dc('0x45')]=_0x547558[_0x31dc('0x45')][_0x31dc('0x47')]?_0x547558['attributes']:_0x3322e0[_0x31dc('0x3f')];if(_0x266262['query'][_0x31dc('0x4e')]){_0x547558[_0x31dc('0x4f')]=[{'all':!![]}];}_0x547558=_[_0x31dc('0x55')]({},_0x547558,_0x266262['options']);return db[_0x31dc('0x4d')][_0x31dc('0x56')](_0x547558)['then'](handleEntityNotFound(_0x236d12,null))[_0x31dc('0x21')](respondWithResult(_0x236d12,null))[_0x31dc('0x2a')](handleError(_0x236d12,null));};exports[_0x31dc('0x57')]=function(_0x8fc486,_0x57fb4d){return db[_0x31dc('0x4d')][_0x31dc('0x57')](_0x8fc486[_0x31dc('0x58')],{})[_0x31dc('0x21')](function(_0x227a42){var _0x208d34=_0x8fc486['user'][_0x31dc('0x36')]({'plain':!![]});if(!_0x208d34)throw new Error(_0x31dc('0x59'));if(_0x208d34['role']===_0x31dc('0x5a')){var _0x4e4c25=_0x227a42[_0x31dc('0x36')]({'plain':!![]});var _0xca7e4=_0x31dc('0x37');return db[_0x31dc('0x5b')][_0x31dc('0x56')]({'where':{'name':_0xca7e4,'userProfileId':_0x208d34[_0x31dc('0x5c')]},'raw':!![]})[_0x31dc('0x21')](function(_0x437314){if(_0x437314&&_0x437314['autoAssociation']===0x0){return db[_0x31dc('0x5d')][_0x31dc('0x57')]({'name':_0x4e4c25[_0x31dc('0x39')],'resourceId':_0x4e4c25['id'],'type':_0x437314[_0x31dc('0x39')],'sectionId':_0x437314['id']},{})['then'](function(){return _0x227a42;});}else{return _0x227a42;}})[_0x31dc('0x2a')](function(_0x369a84){logger[_0x31dc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x369a84);throw _0x369a84;});}return _0x227a42;})[_0x31dc('0x21')](respondWithResult(_0x57fb4d,0xc9))[_0x31dc('0x2a')](handleError(_0x57fb4d,null));};exports['update']=function(_0x396e44,_0x22147f){if(_0x396e44[_0x31dc('0x58')]['id']){delete _0x396e44[_0x31dc('0x58')]['id'];}return db[_0x31dc('0x4d')][_0x31dc('0x56')]({'where':{'id':_0x396e44['params']['id']},'include':[{'model':db[_0x31dc('0x54')],'as':_0x31dc('0x3b')}]})[_0x31dc('0x21')](handleEntityNotFound(_0x22147f,null))[_0x31dc('0x21')](saveUpdates(_0x396e44['body'],null))[_0x31dc('0x21')](respondWithResult(_0x22147f,null))[_0x31dc('0x2a')](handleError(_0x22147f,null));};exports['destroy']=function(_0xcb3151,_0x279ed9){return db[_0x31dc('0x4d')]['find']({'where':{'id':_0xcb3151[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x279ed9,null))[_0x31dc('0x21')](removeEntity(_0x279ed9,null))[_0x31dc('0x2a')](handleError(_0x279ed9,null));};exports[_0x31dc('0x5e')]=function(_0x215cc3,_0x406e75){return db[_0x31dc('0x4d')][_0x31dc('0x5e')]()[_0x31dc('0x21')](respondWithResult(_0x406e75,null))['catch'](handleError(_0x406e75,null));};exports[_0x31dc('0x5f')]=function(_0x339382,_0x58ffe4,_0x2f9010){if(_0x339382['body']['id']){delete _0x339382[_0x31dc('0x58')]['id'];}return db[_0x31dc('0x4d')]['find']({'where':{'id':_0x339382[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x58ffe4,null))[_0x31dc('0x21')](function(_0xb30670){if(_0xb30670){_0x339382[_0x31dc('0x58')]['FaxAccountId']=_0xb30670['id'];return db[_0x31dc('0x60')][_0x31dc('0x57')](_0x339382[_0x31dc('0x58')]);}})[_0x31dc('0x21')](respondWithResult(_0x58ffe4,null))[_0x31dc('0x2a')](handleError(_0x58ffe4,null));};exports[_0x31dc('0x61')]=function(_0x42a9c8,_0x27f878,_0xb81c8e){var _0x93934e={'raw':![],'where':{}};var _0x31bb37={};var _0x42f0b2={'count':0x0,'rows':[]};return db[_0x31dc('0x4d')][_0x31dc('0x62')]({'where':{'id':_0x42a9c8[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x27f878,null))[_0x31dc('0x21')](function(_0x138f28){if(_0x138f28){_0x31bb37[_0x31dc('0x3f')]=_['keys'](db[_0x31dc('0x60')]['rawAttributes']);_0x31bb37[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0x42a9c8[_0x31dc('0x41')]);_0x31bb37[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x31bb37[_0x31dc('0x3f')],_0x31bb37['query']);_0x93934e['attributes']=_[_0x31dc('0x44')](_0x31bb37[_0x31dc('0x3f')],qs[_0x31dc('0x46')](_0x42a9c8[_0x31dc('0x41')]['fields']));_0x93934e[_0x31dc('0x45')]=_0x93934e['attributes']['length']?_0x93934e[_0x31dc('0x45')]:_0x31bb37[_0x31dc('0x3f')];if(!_0x42a9c8[_0x31dc('0x41')][_0x31dc('0x48')](_0x31dc('0x49'))){_0x93934e['limit']=qs[_0x31dc('0x2f')](_0x42a9c8[_0x31dc('0x41')][_0x31dc('0x2f')]);_0x93934e[_0x31dc('0x2d')]=qs['offset'](_0x42a9c8[_0x31dc('0x41')][_0x31dc('0x2d')]);}_0x93934e[_0x31dc('0x63')]=qs[_0x31dc('0x64')](_0x42a9c8[_0x31dc('0x41')]['sort']);_0x93934e[_0x31dc('0x4b')]=qs[_0x31dc('0x43')](_[_0x31dc('0x4a')](_0x42a9c8[_0x31dc('0x41')],_0x31bb37[_0x31dc('0x43')]));_0x93934e[_0x31dc('0x4b')][_0x31dc('0x65')]=_0x138f28['id'];if(_0x42a9c8[_0x31dc('0x41')][_0x31dc('0x4c')]){_0x93934e['where']=_['merge'](_0x93934e['where'],{'$or':_['map'](_0x93934e[_0x31dc('0x45')],function(_0x41da51){var _0x1d8ff6={};_0x1d8ff6[_0x41da51]={'$like':'%'+_0x42a9c8[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x1d8ff6;})});}_0x93934e=_[_0x31dc('0x55')]({},_0x93934e,_0x42a9c8['options']);return db[_0x31dc('0x60')][_0x31dc('0x30')]({'where':_0x93934e['where']})[_0x31dc('0x21')](function(_0x5780e7){_0x42f0b2[_0x31dc('0x30')]=_0x5780e7;if(_0x42a9c8[_0x31dc('0x41')]['includeAll']){_0x93934e['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x93934e);})[_0x31dc('0x21')](function(_0x3236d2){_0x42f0b2[_0x31dc('0x51')]=_0x3236d2;return _0x42f0b2;});}})[_0x31dc('0x21')](respondWithFilteredResult(_0x27f878,_0x93934e))['catch'](handleError(_0x27f878,null));};exports['removeDispositions']=function(_0x2e4fff,_0x4fbb54,_0x46a667){return db[_0x31dc('0x4d')][_0x31dc('0x56')]({'where':{'id':_0x2e4fff[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x4fbb54,null))[_0x31dc('0x21')](function(_0x516349){if(_0x516349){return _0x516349[_0x31dc('0x66')](_0x2e4fff['query'][_0x31dc('0x67')]);}})[_0x31dc('0x21')](respondWithStatusCode(_0x4fbb54,null))[_0x31dc('0x2a')](handleError(_0x4fbb54,null));};exports[_0x31dc('0x68')]=function(_0x1323d1,_0x442622,_0x1d98e9){if(_0x1323d1[_0x31dc('0x58')]['id']){delete _0x1323d1[_0x31dc('0x58')]['id'];}return db['FaxAccount'][_0x31dc('0x56')]({'where':{'id':_0x1323d1['params']['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x442622,null))[_0x31dc('0x21')](function(_0x428ae8){if(_0x428ae8){_0x1323d1[_0x31dc('0x58')][_0x31dc('0x65')]=_0x428ae8['id'];return db['CannedAnswer'][_0x31dc('0x57')](_0x1323d1['body']);}})['then'](respondWithResult(_0x442622,null))[_0x31dc('0x2a')](handleError(_0x442622,null));};exports[_0x31dc('0x69')]=function(_0x212cdd,_0x4b285,_0x2bf96f){var _0x5b7bb5={'raw':![],'where':{}};var _0x404240={};var _0x5d0524={'count':0x0,'rows':[]};return db[_0x31dc('0x4d')][_0x31dc('0x62')]({'where':{'id':_0x212cdd[_0x31dc('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b285,null))[_0x31dc('0x21')](function(_0x4d4d43){if(_0x4d4d43){_0x404240['model']=_['keys'](db[_0x31dc('0x6a')][_0x31dc('0x3c')]);_0x404240[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0x212cdd[_0x31dc('0x41')]);_0x404240[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x404240['model'],_0x404240['query']);_0x5b7bb5[_0x31dc('0x45')]=_[_0x31dc('0x44')](_0x404240[_0x31dc('0x3f')],qs[_0x31dc('0x46')](_0x212cdd[_0x31dc('0x41')][_0x31dc('0x46')]));_0x5b7bb5[_0x31dc('0x45')]=_0x5b7bb5[_0x31dc('0x45')][_0x31dc('0x47')]?_0x5b7bb5[_0x31dc('0x45')]:_0x404240[_0x31dc('0x3f')];if(!_0x212cdd[_0x31dc('0x41')][_0x31dc('0x48')]('nolimit')){_0x5b7bb5['limit']=qs['limit'](_0x212cdd[_0x31dc('0x41')][_0x31dc('0x2f')]);_0x5b7bb5[_0x31dc('0x2d')]=qs[_0x31dc('0x2d')](_0x212cdd[_0x31dc('0x41')][_0x31dc('0x2d')]);}_0x5b7bb5[_0x31dc('0x63')]=qs['sort'](_0x212cdd['query'][_0x31dc('0x64')]);_0x5b7bb5[_0x31dc('0x4b')]=qs[_0x31dc('0x43')](_[_0x31dc('0x4a')](_0x212cdd[_0x31dc('0x41')],_0x404240[_0x31dc('0x43')]));_0x5b7bb5[_0x31dc('0x4b')][_0x31dc('0x65')]=_0x4d4d43['id'];if(_0x212cdd['query'][_0x31dc('0x4c')]){_0x5b7bb5[_0x31dc('0x4b')]=_[_0x31dc('0x55')](_0x5b7bb5[_0x31dc('0x4b')],{'$or':_['map'](_0x5b7bb5[_0x31dc('0x45')],function(_0x236fb9){var _0x4629c9={};_0x4629c9[_0x236fb9]={'$like':'%'+_0x212cdd[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x4629c9;})});}_0x5b7bb5=_[_0x31dc('0x55')]({},_0x5b7bb5,_0x212cdd[_0x31dc('0x6b')]);return db[_0x31dc('0x6a')][_0x31dc('0x30')]({'where':_0x5b7bb5['where']})[_0x31dc('0x21')](function(_0x7bf450){_0x5d0524['count']=_0x7bf450;if(_0x212cdd[_0x31dc('0x41')]['includeAll']){_0x5b7bb5['include']=[{'all':!![]}];}return db[_0x31dc('0x6a')][_0x31dc('0x50')](_0x5b7bb5);})[_0x31dc('0x21')](function(_0x133a4d){_0x5d0524[_0x31dc('0x51')]=_0x133a4d;return _0x5d0524;});}})['then'](respondWithFilteredResult(_0x4b285,_0x5b7bb5))[_0x31dc('0x2a')](handleError(_0x4b285,null));};exports[_0x31dc('0x6c')]=function(_0x478eba,_0x1cdf0b,_0x2edd97){return db['FaxAccount']['find']({'where':{'id':_0x478eba[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x1cdf0b,null))[_0x31dc('0x21')](function(_0x4dc4d7){if(_0x4dc4d7){return _0x4dc4d7[_0x31dc('0x6c')](_0x478eba[_0x31dc('0x41')][_0x31dc('0x67')]);}})[_0x31dc('0x21')](respondWithStatusCode(_0x1cdf0b,null))['catch'](handleError(_0x1cdf0b,null));};exports[_0x31dc('0x6d')]=function(_0x57093f,_0x1b278b,_0x9dd21){return db[_0x31dc('0x6e')][_0x31dc('0x56')]({'where':{'id':_0x57093f[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x1b278b,null))[_0x31dc('0x21')](function(_0x4b04d3){if(_0x4b04d3){return _0x4b04d3[_0x31dc('0x6d')](_0x57093f[_0x31dc('0x58')][_0x31dc('0x67')],_[_0x31dc('0x6f')](_0x57093f[_0x31dc('0x58')],['ids','id'])||{});}})[_0x31dc('0x21')](respondWithResult(_0x1b278b,null))['catch'](handleError(_0x1b278b,null));};exports[_0x31dc('0x70')]=function(_0xfc3806,_0x1156af,_0xc06e86){var _0x3656b0={'raw':![],'where':{}};var _0x43a98f={};var _0xf9aafe={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xfc3806[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x1156af,null))[_0x31dc('0x21')](function(_0x2aaf48){if(_0x2aaf48){_0x43a98f[_0x31dc('0x3f')]=_[_0x31dc('0x42')](db[_0x31dc('0x6e')][_0x31dc('0x3c')]);_0x43a98f[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0xfc3806[_0x31dc('0x41')]);_0x43a98f[_0x31dc('0x43')]=_['intersection'](_0x43a98f['model'],_0x43a98f[_0x31dc('0x41')]);_0x3656b0[_0x31dc('0x45')]=_[_0x31dc('0x44')](_0x43a98f[_0x31dc('0x3f')],qs[_0x31dc('0x46')](_0xfc3806[_0x31dc('0x41')][_0x31dc('0x46')]));_0x3656b0[_0x31dc('0x45')]=_0x3656b0[_0x31dc('0x45')]['length']?_0x3656b0[_0x31dc('0x45')]:_0x43a98f[_0x31dc('0x3f')];if(!_0xfc3806[_0x31dc('0x41')][_0x31dc('0x48')]('nolimit')){_0x3656b0[_0x31dc('0x2f')]=qs[_0x31dc('0x2f')](_0xfc3806[_0x31dc('0x41')]['limit']);_0x3656b0['offset']=qs[_0x31dc('0x2d')](_0xfc3806[_0x31dc('0x41')][_0x31dc('0x2d')]);}_0x3656b0[_0x31dc('0x63')]=qs[_0x31dc('0x64')](_0xfc3806[_0x31dc('0x41')]['sort']);_0x3656b0[_0x31dc('0x4b')]=qs[_0x31dc('0x43')](_[_0x31dc('0x4a')](_0xfc3806[_0x31dc('0x41')],_0x43a98f[_0x31dc('0x43')]));_0x3656b0[_0x31dc('0x4b')][_0x31dc('0x65')]=_0x2aaf48['id'];if(_0xfc3806['query'][_0x31dc('0x4c')]){_0x3656b0['where']=_['merge'](_0x3656b0['where'],{'$or':_[_0x31dc('0x40')](_0x3656b0[_0x31dc('0x45')],function(_0x1eadd7){var _0x2cba3e={};_0x2cba3e[_0x1eadd7]={'$like':'%'+_0xfc3806[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x2cba3e;})});}_0x3656b0=_['merge']({},_0x3656b0,_0xfc3806['options']);return db[_0x31dc('0x6e')][_0x31dc('0x30')]({'where':_0x3656b0['where']})[_0x31dc('0x21')](function(_0x454666){_0xf9aafe['count']=_0x454666;if(_0xfc3806[_0x31dc('0x41')][_0x31dc('0x4e')]){_0x3656b0[_0x31dc('0x4f')]=[{'model':db[_0x31dc('0x71')],'as':_0x31dc('0x72'),'required':![]},{'model':db[_0x31dc('0x73')],'as':_0x31dc('0x74'),'attributes':['name',_0x31dc('0x75'),'internal'],'required':![]},{'model':db[_0x31dc('0x76')],'as':_0x31dc('0x77'),'attributes':['id',_0x31dc('0x39'),_0x31dc('0x78')],'where':_0xfc3806[_0x31dc('0x41')][_0x31dc('0x79')]?{'id':_0xfc3806[_0x31dc('0x41')][_0x31dc('0x79')]}:undefined,'required':_0xfc3806[_0x31dc('0x41')]['tag']?!![]:![]}];}return db[_0x31dc('0x6e')][_0x31dc('0x50')](_0x3656b0);})[_0x31dc('0x21')](function(_0x2e1220){_0xf9aafe[_0x31dc('0x51')]=_0x2e1220;return _0xf9aafe;});}})['then'](respondWithFilteredResult(_0x1156af,_0x3656b0))[_0x31dc('0x2a')](handleError(_0x1156af,null));};exports[_0x31dc('0x7a')]=function(_0x452a0b,_0x5aede7){var _0x5a5d45=_0x452a0b[_0x31dc('0x53')]['id'];var _0x554cd2=_0x452a0b[_0x31dc('0x58')];var _0xac063a=0xc8;var _0x565ac4=null;return db[_0x31dc('0x7b')][_0x31dc('0x7c')]({'isolationLevel':db[_0x31dc('0x7b')]['Transaction'][_0x31dc('0x7d')][_0x31dc('0x7e')]},function(_0x30ea0c){return db['FaxAccount']['findOne']({'where':{'id':_0x5a5d45},'transaction':_0x30ea0c})['then'](function(_0x44d48a){if(_0x44d48a){return db[_0x31dc('0x7f')][_0x31dc('0x35')]({'where':{'FaxAccountId':_0x5a5d45},'transaction':_0x30ea0c})['then'](function(){var _0x4d1063=_[_0x31dc('0x40')](_0x554cd2,function(_0xec5448){_0xec5448[_0x31dc('0x65')]=_0x5a5d45;return _0xec5448;});return db[_0x31dc('0x7f')][_0x31dc('0x80')](_0x4d1063,{'transaction':_0x30ea0c});});}else{_0xac063a=0x194;_0x565ac4=[];}});})[_0x31dc('0x21')](function(){if(_0xac063a!==0x194){return db['FaxApplication'][_0x31dc('0x81')]({'where':{'FaxAccountId':_0x5a5d45},'order':_0x31dc('0x82')})['then'](function(_0x5f3ed5){_0x565ac4=_0x5f3ed5;});}})['catch'](function(_0x50b3f1){_0xac063a=0x1f4;logger[_0x31dc('0x27')](_0x50b3f1['stack']);if(_0x50b3f1[_0x31dc('0x39')]){delete _0x50b3f1[_0x31dc('0x39')];}_0x565ac4=_0x50b3f1;})[_0x31dc('0x83')](function(){if(_0x565ac4===null){_0x5aede7[_0x31dc('0x84')](_0xac063a);}else{if(_0xac063a===0x1f4){_0x5aede7[_0x31dc('0x2b')](_0xac063a)['send'](_0x565ac4);}else{_0x5aede7['status'](_0xac063a)[_0x31dc('0x85')](_0x565ac4);}}});};exports['getApplications']=function(_0x28f8be,_0x5c7cc6,_0x38971c){var _0x1f2c15={};var _0x494849={};var _0xe5c5f2;var _0x42b4e8;return db[_0x31dc('0x4d')][_0x31dc('0x62')]({'where':{'id':_0x28f8be[_0x31dc('0x53')]['id']}})['then'](handleEntityNotFound(_0x5c7cc6,null))[_0x31dc('0x21')](function(_0x26bedc){if(_0x26bedc){_0xe5c5f2=_0x26bedc;_0x494849[_0x31dc('0x3f')]=_['keys'](db[_0x31dc('0x7f')][_0x31dc('0x3c')]);_0x494849[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0x28f8be[_0x31dc('0x41')]);_0x494849[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x494849[_0x31dc('0x3f')],_0x494849['query']);_0x1f2c15[_0x31dc('0x45')]=_[_0x31dc('0x44')](_0x494849[_0x31dc('0x3f')],qs[_0x31dc('0x46')](_0x28f8be[_0x31dc('0x41')][_0x31dc('0x46')]));_0x1f2c15['attributes']=_0x1f2c15['attributes'][_0x31dc('0x47')]?_0x1f2c15[_0x31dc('0x45')]:_0x494849['model'];_0x1f2c15[_0x31dc('0x63')]=qs[_0x31dc('0x64')](_0x28f8be[_0x31dc('0x41')]['sort']);_0x1f2c15[_0x31dc('0x4b')]=qs[_0x31dc('0x43')](_['pick'](_0x28f8be['query'],_0x494849[_0x31dc('0x43')]));if(_0x28f8be[_0x31dc('0x41')][_0x31dc('0x4c')]){_0x1f2c15[_0x31dc('0x4b')]=_[_0x31dc('0x55')](_0x1f2c15[_0x31dc('0x4b')],{'$or':_['map'](_0x1f2c15[_0x31dc('0x45')],function(_0x5a218c){var _0x4700d0={};_0x4700d0[_0x5a218c]={'$like':'%'+_0x28f8be[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x4700d0;})});}_0x1f2c15=_['merge']({},_0x1f2c15,_0x28f8be[_0x31dc('0x6b')]);return _0xe5c5f2[_0x31dc('0x86')](_0x1f2c15);}})[_0x31dc('0x21')](function(_0x45b43f){if(_0x45b43f){_0x42b4e8=_0x45b43f[_0x31dc('0x47')];if(!_0x28f8be[_0x31dc('0x41')][_0x31dc('0x48')]('nolimit')){_0x1f2c15[_0x31dc('0x2f')]=qs[_0x31dc('0x2f')](_0x28f8be['query'][_0x31dc('0x2f')]);_0x1f2c15[_0x31dc('0x2d')]=qs[_0x31dc('0x2d')](_0x28f8be[_0x31dc('0x41')][_0x31dc('0x2d')]);}return _0xe5c5f2[_0x31dc('0x86')](_0x1f2c15);}})[_0x31dc('0x21')](function(_0x2855a5){if(_0x2855a5){return _0x2855a5?{'count':_0x42b4e8,'rows':_0x2855a5}:null;}})[_0x31dc('0x21')](respondWithResult(_0x5c7cc6,null))[_0x31dc('0x2a')](handleError(_0x5c7cc6,null));};function Extension(_0x12164e,_0x4a0d03,_0x12b6db,_0x24d917){this[_0x31dc('0x87')]=_0x31dc('0x88');this[_0x31dc('0x89')]=_0x12164e[_0x31dc('0x8a')];this['app']=_0x24d917;this[_0x31dc('0x3e')]=_0x31dc('0x8b');this[_0x31dc('0x8c')]='Fax\x20Extension';this[_0x31dc('0x65')]=_0x12164e['id'];this[_0x31dc('0x82')]=_0x4a0d03;this[_0x31dc('0x8d')]=_0x12b6db;}function createExtensionsReciveFax(_0x5d52e4){var _0x20d8ff=0x1;var _0x38e47c=[];_0x38e47c[_0x31dc('0x8e')](new Extension(_0x5d52e4,_0x20d8ff,'',_0x31dc('0x8f')));_0x20d8ff+=0x1;_0x38e47c[_0x31dc('0x8e')](new Extension(_0x5d52e4,_0x20d8ff,_0x31dc('0x90'),'Set'));_0x20d8ff+=0x1;for(var _0x5657fe in _0x5d52e4){if(_0x5d52e4[_0x31dc('0x48')](_0x5657fe)&&(_0x5657fe===_0x31dc('0x91')||_0x5657fe===_0x31dc('0x8a')||_0x5657fe===_0x31dc('0x92')||_0x5657fe===_0x31dc('0x93')||_0x5657fe===_0x31dc('0x94')||_0x5657fe==='maxrate'||_0x5657fe===_0x31dc('0x95')||_0x5657fe==='modem'||_0x5657fe==='t38timeout')){_0x38e47c[_0x31dc('0x8e')](new Extension(_0x5d52e4,_0x20d8ff,'FAXOPT('+_0x5657fe+')='+_0x5d52e4[_0x5657fe],_0x31dc('0x96')));_0x20d8ff+=0x1;}}_0x38e47c[_0x31dc('0x8e')](new Extension(_0x5d52e4,_0x20d8ff,'6',_0x31dc('0x97')));_0x20d8ff+=0x1;_0x38e47c['push'](new Extension(_0x5d52e4,_0x20d8ff,_0x31dc('0x98'),'ReceiveFax'));_0x20d8ff=0x0;return _0x38e47c;}exports['addAccountApplications']=function(_0x3c8e5e,_0x5880cb,_0x445d3f){var _0x4b9bd5;return db['sequelize']['transaction'](function(_0x4aa691){return db['FaxAccount'][_0x31dc('0x57')](_0x3c8e5e[_0x31dc('0x58')],{'transaction':_0x4aa691})[_0x31dc('0x21')](function(_0x22267b){_0x4b9bd5=_0x22267b[_0x31dc('0x36')]({'plain':!![]});return db[_0x31dc('0x99')][_0x31dc('0x80')](createExtensionsReciveFax(_0x4b9bd5),{'transaction':_0x4aa691});});})[_0x31dc('0x21')](function(){return _0x4b9bd5;})['then'](respondWithResult(_0x5880cb,null))['catch'](handleError(_0x5880cb,null));};exports[_0x31dc('0x9a')]=function(_0x95f1b6,_0xfdd7af,_0x4d4b52){var _0x2961a4;return db[_0x31dc('0x7b')]['transaction'](function(_0x3924ab){return db[_0x31dc('0x4d')][_0x31dc('0x34')](_0x95f1b6[_0x31dc('0x58')],{'where':{'id':_0x95f1b6[_0x31dc('0x58')]['id']},'transaction':_0x3924ab})[_0x31dc('0x21')](function(_0x5ca138){return db[_0x31dc('0x99')]['destroy']({'where':{'FaxAccountId':_0x95f1b6[_0x31dc('0x58')]['id']},'transaction':_0x3924ab})['then'](function(_0x25c23b){return db[_0x31dc('0x99')][_0x31dc('0x80')](createExtensionsReciveFax(_['omit'](_0x95f1b6[_0x31dc('0x58')],[_0x31dc('0x9b'),'key','createdAt',_0x31dc('0x9c'),'TrunkId',_0x31dc('0x9d')])),{'transaction':_0x3924ab});});});})[_0x31dc('0x21')](function(){return db[_0x31dc('0x4d')][_0x31dc('0x9e')](_0x95f1b6[_0x31dc('0x58')]['id']);})[_0x31dc('0x21')](respondWithResult(_0xfdd7af,null))['catch'](handleError(_0xfdd7af,null));};exports[_0x31dc('0x9f')]=function(_0x217efe,_0x5ad75d,_0x108ac1){var _0x1a8fc3={'raw':!![],'where':{}};var _0x59acec={};var _0xe6024a={'count':0x0,'rows':[]};return db[_0x31dc('0x4d')][_0x31dc('0x62')]({'where':{'id':_0x217efe[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x5ad75d,null))['then'](function(_0x9308eb){if(_0x9308eb){_0x59acec[_0x31dc('0x3f')]=_['keys'](db['FaxMessage'][_0x31dc('0x3c')]);_0x59acec[_0x31dc('0x41')]=_[_0x31dc('0x42')](_0x217efe[_0x31dc('0x41')]);_0x59acec[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x59acec[_0x31dc('0x3f')],_0x59acec['query']);_0x1a8fc3['attributes']=_[_0x31dc('0x44')](_0x59acec[_0x31dc('0x3f')],qs['fields'](_0x217efe['query'][_0x31dc('0x46')]));_0x1a8fc3[_0x31dc('0x45')]=_0x1a8fc3['attributes'][_0x31dc('0x47')]?_0x1a8fc3[_0x31dc('0x45')]:_0x59acec[_0x31dc('0x3f')];if(!_0x217efe[_0x31dc('0x41')]['hasOwnProperty']('nolimit')){_0x1a8fc3['limit']=qs[_0x31dc('0x2f')](_0x217efe[_0x31dc('0x41')][_0x31dc('0x2f')]);_0x1a8fc3[_0x31dc('0x2d')]=qs['offset'](_0x217efe[_0x31dc('0x41')][_0x31dc('0x2d')]);}_0x1a8fc3['order']=qs[_0x31dc('0x64')](_0x217efe[_0x31dc('0x41')][_0x31dc('0x64')]);_0x1a8fc3[_0x31dc('0x4b')]=qs[_0x31dc('0x43')](_[_0x31dc('0x4a')](_0x217efe[_0x31dc('0x41')],_0x59acec[_0x31dc('0x43')]));_0x1a8fc3['where'][_0x31dc('0x65')]=_0x9308eb['id'];if(_0x217efe['query'][_0x31dc('0x4c')]){_0x1a8fc3[_0x31dc('0x4b')]=_['merge'](_0x1a8fc3[_0x31dc('0x4b')],{'$or':_['map'](_0x1a8fc3['attributes'],function(_0x797af6){var _0x51780f={};_0x51780f[_0x797af6]={'$like':'%'+_0x217efe[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x51780f;})});}if(_0x217efe['query'][_0x31dc('0xa0')]){var _0x370e9f=_0x217efe[_0x31dc('0x41')][_0x31dc('0xa0')][_0x31dc('0xa1')](',');var _0xb0ee46={};_0xb0ee46[_0x370e9f[0x0]]={'$gte':moment(_0x370e9f[0x1])[_0x31dc('0xa2')](_0x31dc('0xa3'))};_0x1a8fc3[_0x31dc('0x4b')]=_[_0x31dc('0x55')](_0x1a8fc3[_0x31dc('0x4b')],_0xb0ee46);}_0x1a8fc3=_[_0x31dc('0x55')]({},_0x1a8fc3,_0x217efe[_0x31dc('0x6b')]);return db[_0x31dc('0xa4')][_0x31dc('0x30')]({'where':_0x1a8fc3[_0x31dc('0x4b')]})[_0x31dc('0x21')](function(_0x37b805){_0xe6024a[_0x31dc('0x30')]=_0x37b805;if(_0x217efe['query'][_0x31dc('0x4e')]){_0x1a8fc3[_0x31dc('0x4f')]=[{'all':!![]}];}return db[_0x31dc('0xa4')][_0x31dc('0x50')](_0x1a8fc3);})[_0x31dc('0x21')](function(_0x1757d9){_0xe6024a[_0x31dc('0x51')]=_0x1757d9;return _0xe6024a;});}})[_0x31dc('0x21')](respondWithFilteredResult(_0x5ad75d,_0x1a8fc3))[_0x31dc('0x2a')](handleError(_0x5ad75d,null));};exports[_0x31dc('0x3a')]=function(_0x1742ea,_0x162fcf,_0x31147e){var _0x5d13c2,_0x4c1b17={},_0x5a5435;if(_0x1742ea[_0x31dc('0x58')]['to']){_0x5a5435=_0x1742ea[_0x31dc('0x58')]['to'][0x0];}return db['FaxAccount'][_0x31dc('0x56')]({'where':{'id':_0x1742ea[_0x31dc('0x53')]['id']},'include':[{'model':db[_0x31dc('0xa5')],'as':_0x31dc('0xa6'),'include':[{'model':db[_0x31dc('0x71')],'as':_0x31dc('0xa7'),'where':{'fax':_0x5a5435},'limit':0x1,'order':[[_0x31dc('0x9c'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x162fcf,null))['then'](function(_0x362705){_0x5d13c2=_0x362705;if(_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')]&&_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][_0x31dc('0x47')]){for(var _0x364b3d=0x0;_0x364b3d<_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][_0x31dc('0x47')];_0x364b3d+=0x1){_0x1742ea['body']['attachments'][_0x364b3d]={'filename':_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][_0x364b3d][_0x31dc('0x39')],'id':_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][_0x364b3d]['id'],'path':path[_0x31dc('0xa9')](config[_0x31dc('0xaa')],_0x31dc('0xab'),_0x1742ea[_0x31dc('0x58')]['attachments'][_0x364b3d][_0x31dc('0xac')])};}}return respondWithRpcPromise(_0x31dc('0xad'),_0x31dc('0xad'),{'FaxAccountId':_['isNil'](_0x1742ea[_0x31dc('0x53')]['id'])?undefined:_0x1742ea[_0x31dc('0x53')]['id'],'path':_[_0x31dc('0xae')](_0x1742ea[_0x31dc('0x58')]['attachments'][0x0][_0x31dc('0x7')])?undefined:_0x1742ea[_0x31dc('0x58')]['attachments'][0x0][_0x31dc('0x7')],'fax':_['isNil'](_0x1742ea['body']['to'][0x0])?undefined:_0x1742ea['body']['to'][0x0]},client9002);})[_0x31dc('0x21')](function(){if(_0x5d13c2){if(_[_0x31dc('0xae')](_0x1742ea[_0x31dc('0x58')][_0x31dc('0xaf')])){_0x1742ea[_0x31dc('0x58')][_0x31dc('0xaf')]=util[_0x31dc('0xa2')](_0x31dc('0xb0'),_0x5d13c2[_0x31dc('0x39')],_0x5d13c2['fax']);}if(_0x5d13c2[_0x31dc('0xa6')]){if(_0x5d13c2['List']['Contacts'][_0x31dc('0x47')]){return _0x5d13c2[_0x31dc('0xa6')][_0x31dc('0xa7')][0x0];}else{return db['CmContact'][_0x31dc('0x57')](_[_0x31dc('0x1c')](_0x1742ea[_0x31dc('0x58')],{'firstName':_0x1742ea[_0x31dc('0x58')]['to'][0x0],'phone':_0x1742ea[_0x31dc('0x58')]['to'][0x0],'fax':_0x1742ea[_0x31dc('0x58')]['to'][0x0],'ListId':_0x5d13c2['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x31dc('0xb1'));}})[_0x31dc('0x21')](function(_0x15a91f){if(_0x15a91f){return db[_0x31dc('0x6e')]['find']({'where':{'ContactId':_0x15a91f['id'],'closed':![],'FaxAccountId':_0x5d13c2['id']}})[_0x31dc('0x21')](function(_0x48f4ae){if(_0x48f4ae){return[_0x48f4ae,![]];}return db[_0x31dc('0x6e')][_0x31dc('0x57')]({'UserId':_0x1742ea['user']['id'],'ContactId':_0x15a91f['id'],'FaxAccountId':_0x5d13c2['id'],'fax':_0x1742ea[_0x31dc('0x58')]['to'][0x0],'firstMsgDirection':_0x31dc('0xb2'),'Messages':[_['merge'](_0x1742ea[_0x31dc('0x58')],{'read':![],'body':_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][0x0][_0x31dc('0xb3')],'FaxAccountId':_0x5d13c2['id'],'UserId':_0x1742ea[_0x31dc('0x5a')]['id'],'ContactId':_0x15a91f['id'],'AttachmentId':_0x1742ea['body'][_0x31dc('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x31dc('0xa4')],'as':_0x31dc('0xb4')}]})[_0x31dc('0x21')](function(_0x5961f2){return[_0x5961f2,!![]];});});}else{throw new Error(_0x31dc('0xb5'));}})['spread'](function(_0x576820,_0x45af58){if(_0x45af58){return _0x576820;}return db[_0x31dc('0xa4')][_0x31dc('0x57')]({'direction':_0x31dc('0xb2'),'read':![],'body':_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][0x0]['filename'],'FaxAccountId':_0x5d13c2['id'],'FaxInteractionId':_0x576820['id'],'UserId':_0x1742ea[_0x31dc('0x5a')]['id'],'ContactId':_0x576820[_0x31dc('0xb6')],'AttachmentId':_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][0x0]['id']})[_0x31dc('0x21')](function(_0x215210){_0x576820[_0x31dc('0xb7')][_0x31dc('0xb4')]=[];_0x576820[_0x31dc('0xb7')][_0x31dc('0xb4')][_0x31dc('0x8e')](_0x215210['dataValues']);return _0x576820;});})['then'](function(_0x182ee0){respondWithRpcPromise(_0x31dc('0xb8'),'SendFax',{'FaxAccountId':_['isNil'](_0x1742ea['params']['id'])?undefined:_0x1742ea[_0x31dc('0x53')]['id'],'path':_[_0x31dc('0xae')](_0x1742ea[_0x31dc('0x58')]['attachments'][0x0][_0x31dc('0x7')])?undefined:_0x1742ea[_0x31dc('0x58')][_0x31dc('0xa8')][0x0][_0x31dc('0x7')],'fax':_['isNil'](_0x1742ea['body']['to'][0x0])?undefined:_0x1742ea[_0x31dc('0x58')]['to'][0x0],'AttachmentId':_0x1742ea['body'][_0x31dc('0xa8')][0x0]['id']},client9002)[_0x31dc('0x21')](function(_0x87dcb6){logger['info'](_0x31dc('0xb9'),_0x87dcb6);})[_0x31dc('0x2a')](function(_0x453998){logger[_0x31dc('0x22')](_0x31dc('0xb9'),_0x453998);});return _0x182ee0;})['then'](respondWithResult(_0x162fcf,null))[_0x31dc('0x2a')](handleError(_0x162fcf,null));};exports['addAgents']=function(_0x3ba831,_0xd92187,_0x13e49c){return db[_0x31dc('0x4d')][_0x31dc('0x56')]({'where':{'id':_0x3ba831['params']['id']}})['then'](handleEntityNotFound(_0xd92187,null))['then'](function(_0x230663){if(_0x230663){return _0x230663[_0x31dc('0xba')](_0x3ba831[_0x31dc('0x58')][_0x31dc('0x67')],_['omit'](_0x3ba831[_0x31dc('0x58')],[_0x31dc('0x67'),'id'])||{})[_0x31dc('0xbb')](function(_0x3c6872){for(var _0x90300a=0x0;_0x90300a<_0x3ba831[_0x31dc('0x58')]['ids']['length'];_0x90300a+=0x1){socket[_0x31dc('0xbc')](_0x31dc('0xbd'),{'UserId':Number(_0x3ba831[_0x31dc('0x58')]['ids'][_0x90300a]),'FaxAccountId':Number(_0x3ba831[_0x31dc('0x53')]['id'])});}return _0x3c6872;});}})[_0x31dc('0x21')](respondWithResult(_0xd92187,null))[_0x31dc('0x2a')](handleError(_0xd92187,null));};exports[_0x31dc('0xbe')]=function(_0xa51bcc,_0x7298ce,_0x156c3c){return db[_0x31dc('0x4d')][_0x31dc('0x56')]({'where':{'id':_0xa51bcc[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x7298ce,null))[_0x31dc('0x21')](function(_0x21cf01){if(_0x21cf01){return _0x21cf01[_0x31dc('0xbe')](_0xa51bcc[_0x31dc('0x41')]['ids'])['then'](function(){if(_[_0x31dc('0xbf')](_0xa51bcc[_0x31dc('0x41')][_0x31dc('0x67')])){for(var _0x36bc4f=0x0;_0x36bc4f<_0xa51bcc['query']['ids'][_0x31dc('0x47')];_0x36bc4f+=0x1){socket['emit'](_0x31dc('0xc0'),{'UserId':Number(_0xa51bcc[_0x31dc('0x41')][_0x31dc('0x67')][_0x36bc4f]),'FaxAccountId':Number(_0xa51bcc['params']['id'])});}}else{socket[_0x31dc('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0xa51bcc[_0x31dc('0x41')][_0x31dc('0x67')]),'FaxAccountId':Number(_0xa51bcc[_0x31dc('0x53')]['id'])});}});}})[_0x31dc('0x21')](respondWithStatusCode(_0x7298ce,null))[_0x31dc('0x2a')](handleError(_0x7298ce,null));};exports['getAgents']=function(_0x258e54,_0x525541,_0x2d4805){var _0x4b7635={};var _0x15655f={};var _0x155377;var _0x24830b;return db[_0x31dc('0x4d')]['findOne']({'where':{'id':_0x258e54[_0x31dc('0x53')]['id']}})[_0x31dc('0x21')](handleEntityNotFound(_0x525541,null))[_0x31dc('0x21')](function(_0x552bf9){if(_0x552bf9){_0x155377=_0x552bf9;_0x15655f['model']=_[_0x31dc('0x42')](db[_0x31dc('0x73')][_0x31dc('0x3c')]);_0x15655f[_0x31dc('0x41')]=_['keys'](_0x258e54[_0x31dc('0x41')]);_0x15655f[_0x31dc('0x43')]=_[_0x31dc('0x44')](_0x15655f['model'],_0x15655f[_0x31dc('0x41')]);_0x4b7635[_0x31dc('0x45')]=_[_0x31dc('0x44')](_0x15655f[_0x31dc('0x3f')],qs[_0x31dc('0x46')](_0x258e54[_0x31dc('0x41')][_0x31dc('0x46')]));_0x4b7635[_0x31dc('0x45')]=_0x4b7635['attributes'][_0x31dc('0x47')]?_0x4b7635[_0x31dc('0x45')]:_0x15655f[_0x31dc('0x3f')];_0x4b7635[_0x31dc('0x63')]=qs[_0x31dc('0x64')](_0x258e54[_0x31dc('0x41')][_0x31dc('0x64')]);_0x4b7635[_0x31dc('0x4b')]=qs[_0x31dc('0x43')](_[_0x31dc('0x4a')](_0x258e54[_0x31dc('0x41')],_0x15655f[_0x31dc('0x43')]));if(_0x258e54[_0x31dc('0x41')][_0x31dc('0x4c')]){_0x4b7635[_0x31dc('0x4b')]=_[_0x31dc('0x55')](_0x4b7635[_0x31dc('0x4b')],{'$or':_[_0x31dc('0x40')](_0x4b7635[_0x31dc('0x45')],function(_0xc15a81){var _0x1278fe={};_0x1278fe[_0xc15a81]={'$like':'%'+_0x258e54[_0x31dc('0x41')][_0x31dc('0x4c')]+'%'};return _0x1278fe;})});}_0x4b7635=_[_0x31dc('0x55')]({},_0x4b7635,_0x258e54[_0x31dc('0x6b')]);return _0x155377[_0x31dc('0xc1')](_0x4b7635);}})['then'](function(_0x2c3d82){if(_0x2c3d82){_0x24830b=_0x2c3d82[_0x31dc('0x47')];if(!_0x258e54[_0x31dc('0x41')][_0x31dc('0x48')]('nolimit')){_0x4b7635[_0x31dc('0x2f')]=qs[_0x31dc('0x2f')](_0x258e54['query'][_0x31dc('0x2f')]);_0x4b7635[_0x31dc('0x2d')]=qs['offset'](_0x258e54[_0x31dc('0x41')][_0x31dc('0x2d')]);}return _0x155377[_0x31dc('0xc1')](_0x4b7635);}})[_0x31dc('0x21')](function(_0x19c3af){if(_0x19c3af){return _0x19c3af?{'count':_0x24830b,'rows':_0x19c3af}:null;}})[_0x31dc('0x21')](respondWithResult(_0x525541,null))[_0x31dc('0x2a')](handleError(_0x525541,null));}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4b03bb1..9d33b87 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 _0xe4f1=['FaxAccount','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0xe4f1,0x1a6));var _0x1e4f=function(_0x3b8b19,_0x4fc627){_0x3b8b19=_0x3b8b19-0x0;var _0x4523da=_0xe4f1[_0x3b8b19];return _0x4523da;};'use strict';var EventEmitter=require(_0x1e4f('0x0'));var FaxAccount=require(_0x1e4f('0x1'))['db'][_0x1e4f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e4f('0x3'),'afterUpdate':'update','afterDestroy':_0x1e4f('0x4')};function emitEvent(_0x53a999){return function(_0x2316e2,_0x425300,_0x53ada2){FaxAccountEvents[_0x1e4f('0x5')](_0x53a999+':'+_0x2316e2['id'],_0x2316e2);FaxAccountEvents[_0x1e4f('0x5')](_0x53a999,_0x2316e2);_0x53ada2(null);};}for(var e in events){if(events[_0x1e4f('0x6')](e)){var event=events[e];FaxAccount[_0x1e4f('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 22a313f..93e69c2 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 _0x26cd=['request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','api','moment'];(function(_0x48e66c,_0x1c7ddc){var _0x22b130=function(_0x292260){while(--_0x292260){_0x48e66c['push'](_0x48e66c['shift']());}};_0x22b130(++_0x1c7ddc);}(_0x26cd,0xd8));var _0xd26c=function(_0x390c74,_0xf6c338){_0x390c74=_0x390c74-0x0;var _0xa103f8=_0x26cd[_0x390c74];return _0xa103f8;};'use strict';var _=require(_0xd26c('0x0'));var util=require(_0xd26c('0x1'));var logger=require('../../config/logger')(_0xd26c('0x2'));var moment=require(_0xd26c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd26c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd26c('0x5'));var config=require(_0xd26c('0x6'));var attributes=require(_0xd26c('0x7'));module['exports']=function(_0x210408,_0x22ef0e){return _0x210408[_0xd26c('0x8')](_0xd26c('0x9'),attributes,{'tableName':_0xd26c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 709839c..f0d4084 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 _0xffc9=['FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxAccount','options','raw','where','attributes','limit','include','map','model','then','GetFaxAccount','NotifyFaxAccount','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','Applications','get','list','applications','priority','asc','length','CmContact','create','FaxInteraction','spread','autoclose','push','close','*,*,*,*','created','AttachmentId','interaction','UserId','User','unshift','name','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','redis','defaults','localhost','socket.io-emitter','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc9ee84,_0x234a09){var _0x5cc626=function(_0x853077){while(--_0x853077){_0xc9ee84['push'](_0xc9ee84['shift']());}};_0x5cc626(++_0x234a09);}(_0xffc9,0xf8));var _0x9ffc=function(_0x3840b6,_0x2ea852){_0x3840b6=_0x3840b6-0x0;var _0xfdca1e=_0xffc9[_0x3840b6];return _0xfdca1e;};'use strict';var _=require(_0x9ffc('0x0'));var util=require(_0x9ffc('0x1'));var moment=require(_0x9ffc('0x2'));var BPromise=require(_0x9ffc('0x3'));var rs=require(_0x9ffc('0x4'));var fs=require('fs');var Redis=require(_0x9ffc('0x5'));var db=require(_0x9ffc('0x6'))['db'];var utils=require(_0x9ffc('0x7'));var logger=require('../../config/logger')(_0x9ffc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ffc('0x9')]['http']({'port':0x232c});config[_0x9ffc('0xa')]=_[_0x9ffc('0xb')](config[_0x9ffc('0xa')],{'host':_0x9ffc('0xc'),'port':0x18eb});var socket=require(_0x9ffc('0xd'))(new Redis(config[_0x9ffc('0xa')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4f17d3,_0x385eca,_0x764851){return new BPromise(function(_0x539143,_0xff4a76){return client[_0x9ffc('0xe')](_0x4f17d3,_0x764851)['then'](function(_0x4efbc9){logger[_0x9ffc('0xf')](_0x9ffc('0x10'),_0x385eca,_0x9ffc('0x11'));logger[_0x9ffc('0x12')](_0x9ffc('0x13'),_0x385eca,_0x9ffc('0x11'),JSON[_0x9ffc('0x14')](_0x4efbc9));if(_0x4efbc9[_0x9ffc('0x15')]){if(_0x4efbc9['error'][_0x9ffc('0x16')]===0x1f4){logger[_0x9ffc('0x15')](_0x9ffc('0x10'),_0x385eca,_0x4efbc9['error'][_0x9ffc('0x17')]);return _0xff4a76(_0x4efbc9['error']['message']);}logger[_0x9ffc('0x15')]('FaxAccount,\x20%s,\x20%s',_0x385eca,_0x4efbc9['error'][_0x9ffc('0x17')]);return _0x539143(_0x4efbc9['error'][_0x9ffc('0x17')]);}else{logger[_0x9ffc('0xf')]('FaxAccount,\x20%s,\x20%s',_0x385eca,_0x9ffc('0x11'));_0x539143(_0x4efbc9['result']['message']);}})[_0x9ffc('0x18')](function(_0x3c5f5c){logger['error']('FaxAccount,\x20%s,\x20%s',_0x385eca,_0x3c5f5c);_0xff4a76(_0x3c5f5c);});});}exports['GetFaxAccount']=function(_0x201bb2){var _0x40b810=this;return new Promise(function(_0x5e4887,_0x33fe1c){return db[_0x9ffc('0x19')]['findAll']({'raw':_0x201bb2[_0x9ffc('0x1a')]?_0x201bb2[_0x9ffc('0x1a')][_0x9ffc('0x1b')]===undefined?!![]:![]:!![],'where':_0x201bb2[_0x9ffc('0x1a')]?_0x201bb2[_0x9ffc('0x1a')][_0x9ffc('0x1c')]||null:null,'attributes':_0x201bb2[_0x9ffc('0x1a')]?_0x201bb2[_0x9ffc('0x1a')][_0x9ffc('0x1d')]||null:null,'limit':_0x201bb2[_0x9ffc('0x1a')]?_0x201bb2[_0x9ffc('0x1a')][_0x9ffc('0x1e')]||null:null,'include':_0x201bb2[_0x9ffc('0x1a')]?_0x201bb2['options'][_0x9ffc('0x1f')]?_[_0x9ffc('0x20')](_0x201bb2['options'][_0x9ffc('0x1f')],function(_0x26ce5a){return{'model':db[_0x26ce5a[_0x9ffc('0x21')]],'as':_0x26ce5a['as'],'attributes':_0x26ce5a['attributes'],'include':_0x26ce5a[_0x9ffc('0x1f')]?_[_0x9ffc('0x20')](_0x26ce5a[_0x9ffc('0x1f')],function(_0x262370){return{'model':db[_0x262370['model']],'as':_0x262370['as'],'attributes':_0x262370['attributes'],'include':_0x262370[_0x9ffc('0x1f')]?_[_0x9ffc('0x20')](_0x262370['include'],function(_0x2eab9e){return{'model':db[_0x2eab9e[_0x9ffc('0x21')]],'as':_0x2eab9e['as'],'attributes':_0x2eab9e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ffc('0x22')](function(_0x5bf064){logger[_0x9ffc('0xf')](_0x9ffc('0x23'),_0x201bb2);logger[_0x9ffc('0x12')]('GetFaxAccount',_0x201bb2,JSON['stringify'](_0x5bf064));_0x5e4887(_0x5bf064);})['catch'](function(_0x3e9823){logger[_0x9ffc('0x15')](_0x9ffc('0x23'),_0x3e9823[_0x9ffc('0x17')],_0x201bb2);_0x33fe1c(_0x40b810[_0x9ffc('0x15')](0x1f4,_0x3e9823['message']));});});};exports[_0x9ffc('0x24')]=function(_0xe6bf78,_0x5448ab,_0x22b500){var _0x406ff1=this;return new Promise(function(_0x24357d,_0x5bae93){var _0x570fc4={'body':_0xe6bf78['body'],'channel':_0x9ffc('0x25')};var _0x1c054d=[];var _0x27cb40=[];var _0x27b0a6={};return db['CmContact'][_0x9ffc('0x26')]()[_0x9ffc('0x22')](function(_0x4a7463){if(!_0x4a7463){throw new db[(_0x9ffc('0x27'))]['ValidationError'](_0x9ffc('0x28'));}_0x1c054d=_[_0x9ffc('0x29')](_[_0x9ffc('0x2a')](_0x4a7463),[_0x9ffc('0x2b'),_0x9ffc('0x2c')]);_0x27cb40=_[_0x9ffc('0x29')](_[_0x9ffc('0x2a')](_0x4a7463),[_0x9ffc('0x2b'),_0x9ffc('0x2c'),_0x9ffc('0x2d'),_0x9ffc('0x2e')]);if(_0xe6bf78[_0x9ffc('0x2f')]['id']){delete _0xe6bf78['body']['id'];}if(_[_0x9ffc('0x30')](_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x31')])){throw new db['Sequelize'][(_0x9ffc('0x32'))](_0x9ffc('0x33'));}if(_[_0x9ffc('0x30')](_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x2f')])||_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x2f')]===''){throw new db[(_0x9ffc('0x27'))][(_0x9ffc('0x32'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9ffc('0x30')](_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x34')])){throw new db[(_0x9ffc('0x27'))][(_0x9ffc('0x32'))](_0x9ffc('0x35')+_0x27cb40);}if(!_[_0x9ffc('0x36')](_0x27cb40,_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x34')])){throw new db['Sequelize'][(_0x9ffc('0x32'))](_0x9ffc('0x37')+_0x27cb40);}_0x27b0a6[_0xe6bf78['body'][_0x9ffc('0x34')]]=_0xe6bf78['body'][_0x9ffc('0x31')];})[_0x9ffc('0x22')](function(){return db['FaxAccount'][_0x9ffc('0x38')]({'where':{'id':_0xe6bf78[_0x9ffc('0x39')]['id']},'include':[{'model':db[_0x9ffc('0x3a')],'as':_0x9ffc('0x3b'),'include':[{'model':db['CmContact'],'as':_0x9ffc('0x3c'),'where':_0x27b0a6,'limit':0x1,'order':[[_0x9ffc('0x2c'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x9ffc('0x3d')}]});})[_0x9ffc('0x22')](function(_0x1efdd7){if(_0x1efdd7&&_0x1efdd7['List']){var _0x58f7d5=_0x1efdd7[_0x9ffc('0x3e')]({'plain':!![]});_0x570fc4[_0x9ffc('0x39')]=_0x58f7d5;_0x570fc4['applications']=_0x58f7d5[_0x9ffc('0x3d')];_0x570fc4[_0x9ffc('0x3f')]=_0x58f7d5['List'];_0x570fc4[_0x9ffc('0x40')]=_['orderBy'](_0x570fc4[_0x9ffc('0x40')],[_0x9ffc('0x41')],[_0x9ffc('0x42')]);if(_0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x3d')]){delete _0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x3d')];}if(_0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x3b')]&&_0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x3b')][_0x9ffc('0x3c')][_0x9ffc('0x43')]){return _0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x3b')][_0x9ffc('0x3c')][0x0];}var _0x2c36ec=_[_0x9ffc('0xb')](_0xe6bf78['body'],{'firstName':_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x31')],'ListId':_0x58f7d5[_0x9ffc('0x2e')]});_0x2c36ec[_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x34')]]=_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x31')];return db[_0x9ffc('0x44')][_0x9ffc('0x45')](_0x2c36ec,{'fields':_0x1c054d,'raw':!![]});}})['then'](function(_0x41c701){_0x570fc4['contact']=_0x41c701;if(_0x41c701){var _0x243c7f={'ContactId':_0x41c701['id'],'FaxAccountId':_0xe6bf78[_0x9ffc('0x39')]['id'],'fax':_0x41c701['fax']};return db[_0x9ffc('0x46')][_0x9ffc('0x38')]({'where':{'ContactId':_0x41c701['id'],'closed':![],'FaxAccountId':_0xe6bf78[_0x9ffc('0x39')]['id']}})[_0x9ffc('0x22')](function(_0xaef6a1){if(_0xaef6a1){return[_0xaef6a1,![]];}return db[_0x9ffc('0x46')]['create'](_0x243c7f)['then'](function(_0x4832a2){return[_0x4832a2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9ffc('0x47')](function(_0x42a63e,_0x659a4f){var _0x6d61cc=_0x42a63e[_0x9ffc('0x3e')]({'plain':!![]});if(_0x659a4f){if(_0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x48')]){_0x570fc4[_0x9ffc('0x40')][_0x9ffc('0x49')]({'id':0x0,'priority':_0x570fc4[_0x9ffc('0x40')]['length']+0x1,'app':_0x9ffc('0x4a'),'appdata':'unmanaged','interval':_0x9ffc('0x4b')});}_0x6d61cc[_0x9ffc('0x4c')]=!![];}else{_0x6d61cc[_0x9ffc('0x4c')]=![];}_0x570fc4['interaction']=_0x6d61cc;return db['FaxMessage'][_0x9ffc('0x45')]({'body':_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x2f')],'FaxAccountId':_0xe6bf78[_0x9ffc('0x39')]['id'],'FaxInteractionId':_0x42a63e['id'],'direction':'in','ContactId':_0x42a63e['ContactId'],'AttachmentId':_0xe6bf78[_0x9ffc('0x2f')][_0x9ffc('0x4d')]});})[_0x9ffc('0x22')](function(_0x13d4bb){_0x570fc4[_0x9ffc('0x17')]=_0x13d4bb;if(!_0x570fc4[_0x9ffc('0x4e')][_0x9ffc('0x4f')])return;return db[_0x9ffc('0x50')][_0x9ffc('0x38')]({'attributes':['id','name'],'where':{'id':_0x570fc4[_0x9ffc('0x4e')][_0x9ffc('0x4f')]}});})['then'](function(_0x2cafd2){if(_0x2cafd2){_0x570fc4[_0x9ffc('0x40')][_0x9ffc('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2cafd2[_0x9ffc('0x52')]+','+(_0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x53')]||0xa),'interval':_0x9ffc('0x4b')});}if(!_0x570fc4[_0x9ffc('0x4e')][_0x9ffc('0x54')])return;return db[_0x9ffc('0x55')][_0x9ffc('0x38')]({'attributes':['id',_0x9ffc('0x52')],'where':{'id':_0x570fc4[_0x9ffc('0x4e')][_0x9ffc('0x54')]}});})[_0x9ffc('0x22')](function(_0x323cdb){if(_0x323cdb){_0x570fc4[_0x9ffc('0x40')][_0x9ffc('0x51')]({'id':0x0,'priority':0x1,'app':_0x9ffc('0x56'),'appdata':_0x323cdb[_0x9ffc('0x52')]+','+(_0x570fc4[_0x9ffc('0x39')][_0x9ffc('0x57')]||0x12c),'interval':_0x9ffc('0x4b')});}return respondWithRpcPromise(_0x9ffc('0x58'),'startRouting',_0x570fc4);})['then'](function(_0xcd1102){_0x24357d(_0xcd1102);})[_0x9ffc('0x18')](function(_0x52d063){_0x5bae93(_0x406ff1[_0x9ffc('0x15')](0x1f4,_0x52d063['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0f8a44d..cf338f3 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 _0xf6fd=['length','faxAccount:','./faxAccount.events','remove','update','emit','removeListener','register'];(function(_0x309f6c,_0x358c94){var _0x348f29=function(_0x15fd3d){while(--_0x15fd3d){_0x309f6c['push'](_0x309f6c['shift']());}};_0x348f29(++_0x358c94);}(_0xf6fd,0x6a));var _0xdf6f=function(_0x211644,_0xa5bac5){_0x211644=_0x211644-0x0;var _0x1aad3d=_0xf6fd[_0x211644];return _0x1aad3d;};'use strict';var FaxAccountEvents=require(_0xdf6f('0x0'));var events=['save',_0xdf6f('0x1'),_0xdf6f('0x2')];function createListener(_0x53777a,_0x3f0047){return function(_0x14366b){_0x3f0047[_0xdf6f('0x3')](_0x53777a,_0x14366b);};}function removeListener(_0x4551ff,_0x1835d8){return function(){FaxAccountEvents[_0xdf6f('0x4')](_0x4551ff,_0x1835d8);};}exports[_0xdf6f('0x5')]=function(_0x251443){for(var _0xead930=0x0,_0x248181=events[_0xdf6f('0x6')];_0xead930<_0x248181;_0xead930++){var _0x2e7259=events[_0xead930];var _0x32eb70=createListener(_0xdf6f('0x7')+_0x2e7259,_0x251443);FaxAccountEvents['on'](_0x2e7259,_0x32eb70);}}; \ No newline at end of file +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 diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index f36d193..5fe2eec 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 _0xf38f=['removeAnswers','removeAgents','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','index','isAuthenticated','describe','get','/:id','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','addDisposition','addAnswer','addApplications','addAccountApplications','updateAccountApplications','send','addAgents','put','update','destroy','delete','removeDispositions'];(function(_0x275da3,_0x3e590f){var _0x28340f=function(_0x17f410){while(--_0x17f410){_0x275da3['push'](_0x275da3['shift']());}};_0x28340f(++_0x3e590f);}(_0xf38f,0xb6));var _0xff38=function(_0xa970d1,_0x8e9f98){_0xa970d1=_0xa970d1-0x0;var _0x4c5a31=_0xf38f[_0xa970d1];return _0x4c5a31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xff38('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff38('0x1')]();var fs_extra=require(_0xff38('0x2'));var auth=require(_0xff38('0x3'));var interaction=require(_0xff38('0x4'));var config=require(_0xff38('0x5'));var controller=require(_0xff38('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xff38('0x7')]);router['get']('/describe',auth[_0xff38('0x8')](),controller[_0xff38('0x9')]);router[_0xff38('0xa')](_0xff38('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xff38('0xa')](_0xff38('0xc'),auth[_0xff38('0x8')](),controller['getDispositions']);router[_0xff38('0xa')](_0xff38('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xff38('0xa')](_0xff38('0xe'),auth[_0xff38('0x8')](),controller[_0xff38('0xf')]);router['get'](_0xff38('0x10'),auth[_0xff38('0x8')](),controller[_0xff38('0x11')]);router[_0xff38('0xa')](_0xff38('0x12'),auth['isAuthenticated'](),controller[_0xff38('0x13')]);router[_0xff38('0xa')](_0xff38('0x14'),auth[_0xff38('0x8')](),controller['getAgents']);router[_0xff38('0x15')]('/',auth[_0xff38('0x8')](),controller['create']);router['post'](_0xff38('0xc'),auth['isAuthenticated'](),controller[_0xff38('0x16')]);router[_0xff38('0x15')](_0xff38('0xd'),auth['isAuthenticated'](),controller[_0xff38('0x17')]);router[_0xff38('0x15')](_0xff38('0xe'),auth[_0xff38('0x8')](),controller['addInteraction']);router[_0xff38('0x15')](_0xff38('0x10'),auth[_0xff38('0x8')](),controller[_0xff38('0x18')]);router[_0xff38('0x15')]('/addaccountapplications',auth[_0xff38('0x8')](),controller[_0xff38('0x19')]);router[_0xff38('0x15')]('/updateaccountapplications',auth[_0xff38('0x8')](),controller[_0xff38('0x1a')]);router[_0xff38('0x15')]('/:id/send',auth[_0xff38('0x8')](),controller[_0xff38('0x1b')]);router[_0xff38('0x15')](_0xff38('0x14'),auth[_0xff38('0x8')](),controller[_0xff38('0x1c')]);router[_0xff38('0x1d')](_0xff38('0xb'),auth['isAuthenticated'](),controller[_0xff38('0x1e')]);router['delete'](_0xff38('0xb'),auth[_0xff38('0x8')](),controller[_0xff38('0x1f')]);router[_0xff38('0x20')]('/:id/dispositions',auth[_0xff38('0x8')](),controller[_0xff38('0x21')]);router[_0xff38('0x20')](_0xff38('0xd'),auth[_0xff38('0x8')](),controller[_0xff38('0x22')]);router['delete'](_0xff38('0x14'),auth[_0xff38('0x8')](),controller[_0xff38('0x23')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 6e2f621..cc08ff0 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 _0xd94e=['*,*,*,*','sequelize','exports','TEXT','STRING'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xd94e,0x6a));var _0xed94=function(_0x438988,_0x2a86cf){_0x438988=_0x438988-0x0;var _0x1ce59f=_0xd94e[_0x438988];return _0x1ce59f;};'use strict';var Sequelize=require(_0xed94('0x0'));module[_0xed94('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xed94('0x2')]()},'description':{'type':Sequelize[_0xed94('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xed94('0x4')}}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1bd73c3..837357e 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 _0x33ee=['rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','then','includeAll','include','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','reject','save','end','stack','name','send','index','FaxApplication'];(function(_0x117194,_0x3d55c1){var _0x4c9bc0=function(_0x423987){while(--_0x423987){_0x117194['push'](_0x117194['shift']());}};_0x4c9bc0(++_0x3d55c1);}(_0x33ee,0x1d5));var _0xe33e=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x33ee[_0x261522];return _0x98a25a;};'use strict';var emlformat=require(_0xe33e('0x0'));var rimraf=require(_0xe33e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe33e('0x2'));var rp=require(_0xe33e('0x3'));var moment=require(_0xe33e('0x4'));var BPromise=require(_0xe33e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe33e('0x6'));var sox=require('sox');var csv=require(_0xe33e('0x7'));var ejs=require(_0xe33e('0x8'));var fs=require('fs');var fs_extra=require(_0xe33e('0x9'));var _=require(_0xe33e('0xa'));var squel=require(_0xe33e('0xb'));var crypto=require(_0xe33e('0xc'));var jsforce=require(_0xe33e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe33e('0x7'));var querystring=require(_0xe33e('0xe'));var Papa=require('papaparse');var Redis=require(_0xe33e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe33e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe33e('0x11'));var utils=require(_0xe33e('0x12'));var config=require(_0xe33e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1891d0,_0x5037b0){_0x5037b0=_0x5037b0||0xcc;return function(_0x1e8180){if(_0x1e8180){return _0x1891d0[_0xe33e('0x14')](_0x5037b0);}return _0x1891d0[_0xe33e('0x15')](_0x5037b0)['end']();};}function respondWithResult(_0x42135e,_0x196f1f){_0x196f1f=_0x196f1f||0xc8;return function(_0x286844){if(_0x286844){return _0x42135e['status'](_0x196f1f)[_0xe33e('0x16')](_0x286844);}};}function respondWithFilteredResult(_0x517f65,_0x5c7f7f){return function(_0x346fca){if(_0x346fca){var _0x39ceba=typeof _0x5c7f7f[_0xe33e('0x17')]===_0xe33e('0x18')&&typeof _0x5c7f7f[_0xe33e('0x19')]==='undefined';var _0x6e3259=_0x346fca[_0xe33e('0x1a')];var _0x3d185c=_0x39ceba?0x0:_0x5c7f7f['offset'];var _0x2a1d99=_0x39ceba?_0x346fca[_0xe33e('0x1a')]:_0x5c7f7f[_0xe33e('0x17')]+_0x5c7f7f[_0xe33e('0x19')];var _0x505fe3;if(_0x2a1d99>=_0x6e3259){_0x2a1d99=_0x6e3259;_0x505fe3=0xc8;}else{_0x505fe3=0xce;}_0x517f65['status'](_0x505fe3);return _0x517f65['set']('Content-Range',_0x3d185c+'-'+_0x2a1d99+'/'+_0x6e3259)[_0xe33e('0x16')](_0x346fca);}return null;};}function patchUpdates(_0x26c203){return function(_0xc0ba4e){try{jsonpatch['apply'](_0xc0ba4e,_0x26c203,!![]);}catch(_0x408e02){return BPromise[_0xe33e('0x1b')](_0x408e02);}return _0xc0ba4e[_0xe33e('0x1c')]();};}function saveUpdates(_0x22c983,_0x234bf9){return function(_0x36160d){if(_0x36160d){return _0x36160d['update'](_0x22c983)['then'](function(_0x11c8b0){return _0x11c8b0;});}return null;};}function removeEntity(_0x3c1ca3,_0x3399fe){return function(_0x2a9630){if(_0x2a9630){return _0x2a9630['destroy']()['then'](function(){_0x3c1ca3[_0xe33e('0x15')](0xcc)[_0xe33e('0x1d')]();});}};}function handleEntityNotFound(_0x38403f,_0x50c736){return function(_0x1b79e0){if(!_0x1b79e0){_0x38403f[_0xe33e('0x14')](0x194);}return _0x1b79e0;};}function handleError(_0x5bda40,_0x3b7753){_0x3b7753=_0x3b7753||0x1f4;return function(_0xc79ea9){logger['error'](_0xc79ea9[_0xe33e('0x1e')]);if(_0xc79ea9[_0xe33e('0x1f')]){delete _0xc79ea9[_0xe33e('0x1f')];}_0x5bda40[_0xe33e('0x15')](_0x3b7753)[_0xe33e('0x20')](_0xc79ea9);};}exports[_0xe33e('0x21')]=function(_0x425f4a,_0x47c3a5){var _0x603156={},_0x1d4b19={},_0x1c069e={'count':0x0,'rows':[]};var _0x446afb=_['map'](db[_0xe33e('0x22')][_0xe33e('0x23')],function(_0x514d5a){return{'name':_0x514d5a['fieldName'],'type':_0x514d5a[_0xe33e('0x24')][_0xe33e('0x25')]};});_0x1d4b19[_0xe33e('0x26')]=_[_0xe33e('0x27')](_0x446afb,_0xe33e('0x1f'));_0x1d4b19['query']=_[_0xe33e('0x28')](_0x425f4a['query']);_0x1d4b19['filters']=_[_0xe33e('0x29')](_0x1d4b19['model'],_0x1d4b19[_0xe33e('0x2a')]);_0x603156[_0xe33e('0x2b')]=_[_0xe33e('0x29')](_0x1d4b19[_0xe33e('0x26')],qs[_0xe33e('0x2c')](_0x425f4a[_0xe33e('0x2a')][_0xe33e('0x2c')]));_0x603156[_0xe33e('0x2b')]=_0x603156[_0xe33e('0x2b')][_0xe33e('0x2d')]?_0x603156[_0xe33e('0x2b')]:_0x1d4b19[_0xe33e('0x26')];if(!_0x425f4a[_0xe33e('0x2a')][_0xe33e('0x2e')]('nolimit')){_0x603156[_0xe33e('0x19')]=qs[_0xe33e('0x19')](_0x425f4a[_0xe33e('0x2a')]['limit']);_0x603156['offset']=qs[_0xe33e('0x17')](_0x425f4a[_0xe33e('0x2a')][_0xe33e('0x17')]);}_0x603156['order']=qs['sort'](_0x425f4a[_0xe33e('0x2a')][_0xe33e('0x2f')]);_0x603156[_0xe33e('0x30')]=qs[_0xe33e('0x31')](_[_0xe33e('0x32')](_0x425f4a[_0xe33e('0x2a')],_0x1d4b19[_0xe33e('0x31')]),_0x446afb);if(_0x425f4a['query']['filter']){_0x603156[_0xe33e('0x30')]=_[_0xe33e('0x33')](_0x603156[_0xe33e('0x30')],{'$or':_[_0xe33e('0x27')](_0x446afb,function(_0x2a2050){if(_0x2a2050['type']!=='VIRTUAL'){var _0x4c95ac={};_0x4c95ac[_0x2a2050['name']]={'$like':'%'+_0x425f4a[_0xe33e('0x2a')][_0xe33e('0x34')]+'%'};return _0x4c95ac;}})});}_0x603156=_['merge']({},_0x603156,_0x425f4a[_0xe33e('0x35')]);var _0x5b3253={'where':_0x603156['where']};return db['FaxApplication'][_0xe33e('0x1a')](_0x5b3253)[_0xe33e('0x36')](function(_0x3c88ce){_0x1c069e[_0xe33e('0x1a')]=_0x3c88ce;if(_0x425f4a[_0xe33e('0x2a')][_0xe33e('0x37')]){_0x603156[_0xe33e('0x38')]=[{'all':!![]}];}return db[_0xe33e('0x22')]['findAll'](_0x603156);})['then'](function(_0x120f8d){_0x1c069e['rows']=_0x120f8d;return _0x1c069e;})['then'](respondWithFilteredResult(_0x47c3a5,_0x603156))[_0xe33e('0x39')](handleError(_0x47c3a5,null));};exports[_0xe33e('0x3a')]=function(_0x5b0d6b,_0x581930){var _0x53558d={'raw':!![],'where':{'id':_0x5b0d6b['params']['id']}},_0x43bee0={};_0x43bee0[_0xe33e('0x26')]=_[_0xe33e('0x28')](db[_0xe33e('0x22')][_0xe33e('0x23')]);_0x43bee0['query']=_['keys'](_0x5b0d6b[_0xe33e('0x2a')]);_0x43bee0[_0xe33e('0x31')]=_['intersection'](_0x43bee0[_0xe33e('0x26')],_0x43bee0['query']);_0x53558d[_0xe33e('0x2b')]=_[_0xe33e('0x29')](_0x43bee0[_0xe33e('0x26')],qs[_0xe33e('0x2c')](_0x5b0d6b[_0xe33e('0x2a')]['fields']));_0x53558d[_0xe33e('0x2b')]=_0x53558d[_0xe33e('0x2b')][_0xe33e('0x2d')]?_0x53558d[_0xe33e('0x2b')]:_0x43bee0[_0xe33e('0x26')];if(_0x5b0d6b[_0xe33e('0x2a')][_0xe33e('0x37')]){_0x53558d[_0xe33e('0x38')]=[{'all':!![]}];}_0x53558d=_[_0xe33e('0x33')]({},_0x53558d,_0x5b0d6b['options']);return db['FaxApplication'][_0xe33e('0x3b')](_0x53558d)[_0xe33e('0x36')](handleEntityNotFound(_0x581930,null))[_0xe33e('0x36')](respondWithResult(_0x581930,null))[_0xe33e('0x39')](handleError(_0x581930,null));};exports[_0xe33e('0x3c')]=function(_0x24fb07,_0x1d2929){return db[_0xe33e('0x22')][_0xe33e('0x3c')](_0x24fb07[_0xe33e('0x3d')],{})[_0xe33e('0x36')](respondWithResult(_0x1d2929,0xc9))['catch'](handleError(_0x1d2929,null));};exports['update']=function(_0xf93a26,_0x360283){if(_0xf93a26[_0xe33e('0x3d')]['id']){delete _0xf93a26[_0xe33e('0x3d')]['id'];}return db[_0xe33e('0x22')][_0xe33e('0x3b')]({'where':{'id':_0xf93a26[_0xe33e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x360283,null))[_0xe33e('0x36')](saveUpdates(_0xf93a26[_0xe33e('0x3d')],null))['then'](respondWithResult(_0x360283,null))[_0xe33e('0x39')](handleError(_0x360283,null));};exports['destroy']=function(_0xe45aaa,_0x3d52b2){return db['FaxApplication'][_0xe33e('0x3b')]({'where':{'id':_0xe45aaa[_0xe33e('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3d52b2,null))[_0xe33e('0x36')](removeEntity(_0x3d52b2,null))['catch'](handleError(_0x3d52b2,null));}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 946a237..b41fd4f 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 _0x6f28=['define','FaxApplication','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x6f28,0x12c));var _0x86f2=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0x6f28[_0x6287b6];return _0x5d6be4;};'use strict';var _=require('lodash');var util=require(_0x86f2('0x0'));var logger=require('../../config/logger')(_0x86f2('0x1'));var moment=require(_0x86f2('0x2'));var BPromise=require(_0x86f2('0x3'));var rp=require(_0x86f2('0x4'));var fs=require('fs');var path=require(_0x86f2('0x5'));var rimraf=require(_0x86f2('0x6'));var config=require('../../config/environment');var attributes=require(_0x86f2('0x7'));module['exports']=function(_0x5b2a93,_0x224ed0){return _0x5b2a93[_0x86f2('0x8')](_0x86f2('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86f2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 20546b9..60db1da 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 _0xd25e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit'];(function(_0x3958e8,_0x42fa99){var _0xb6338f=function(_0x325eec){while(--_0x325eec){_0x3958e8['push'](_0x3958e8['shift']());}};_0xb6338f(++_0x42fa99);}(_0xd25e,0x1d1));var _0xed25=function(_0x1dc1bc,_0x490dbd){_0x1dc1bc=_0x1dc1bc-0x0;var _0x597fb0=_0xd25e[_0x1dc1bc];return _0x597fb0;};'use strict';var _=require(_0xed25('0x0'));var util=require(_0xed25('0x1'));var moment=require(_0xed25('0x2'));var BPromise=require('bluebird');var rs=require(_0xed25('0x3'));var fs=require('fs');var Redis=require(_0xed25('0x4'));var db=require(_0xed25('0x5'))['db'];var utils=require(_0xed25('0x6'));var logger=require('../../config/logger')(_0xed25('0x7'));var config=require(_0xed25('0x8'));var jayson=require(_0xed25('0x9'));var client=jayson[_0xed25('0xa')][_0xed25('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d1b5d,_0x417e68,_0x2523a5){return new BPromise(function(_0x3c9013,_0x5b31ff){return client[_0xed25('0xc')](_0x1d1b5d,_0x2523a5)['then'](function(_0x4f822a){logger[_0xed25('0xd')](_0xed25('0xe'),_0x417e68,_0xed25('0xf'));logger[_0xed25('0x10')](_0xed25('0x11'),_0x417e68,'request\x20sent',JSON[_0xed25('0x12')](_0x4f822a));if(_0x4f822a[_0xed25('0x13')]){if(_0x4f822a[_0xed25('0x13')]['code']===0x1f4){logger['error'](_0xed25('0xe'),_0x417e68,_0x4f822a[_0xed25('0x13')][_0xed25('0x14')]);return _0x5b31ff(_0x4f822a['error']['message']);}logger[_0xed25('0x13')](_0xed25('0xe'),_0x417e68,_0x4f822a['error'][_0xed25('0x14')]);return _0x3c9013(_0x4f822a[_0xed25('0x13')]['message']);}else{logger[_0xed25('0xd')]('FaxApplication,\x20%s,\x20%s',_0x417e68,_0xed25('0xf'));_0x3c9013(_0x4f822a['result'][_0xed25('0x14')]);}})[_0xed25('0x15')](function(_0x4313ac){logger[_0xed25('0x13')](_0xed25('0xe'),_0x417e68,_0x4313ac);_0x5b31ff(_0x4313ac);});});}exports[_0xed25('0x16')]=function(_0x6f14df){var _0x59b59e=this;return new Promise(function(_0x524506,_0x1cf00b){return db[_0xed25('0x17')][_0xed25('0x18')](_0x6f14df[_0xed25('0x19')],{'raw':_0x6f14df[_0xed25('0x1a')]?_0x6f14df['options'][_0xed25('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f14df[_0xed25('0x1a')]?_0x6f14df[_0xed25('0x1a')][_0xed25('0x1c')]||null:null,'attributes':_0x6f14df[_0xed25('0x1a')]?_0x6f14df[_0xed25('0x1a')][_0xed25('0x1d')]||null:null,'limit':_0x6f14df[_0xed25('0x1a')]?_0x6f14df[_0xed25('0x1a')][_0xed25('0x1e')]||null:null})['then'](function(_0x259c2d){logger[_0xed25('0xd')](_0xed25('0x16'),_0x6f14df);logger[_0xed25('0x10')](_0xed25('0x16'),_0x6f14df,JSON['stringify'](_0x259c2d));_0x524506(_0x259c2d);})['catch'](function(_0x3f14d8){logger['error'](_0xed25('0x16'),_0x3f14d8['message'],_0x6f14df);_0x1cf00b(_0x59b59e['error'](0x1f4,_0x3f14d8[_0xed25('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 43a3cf8..d367259 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x955f,0x1eb));var _0xf955=function(_0x6d59f9,_0x1193b7){_0x6d59f9=_0x6d59f9-0x0;var _0x1f599a=_0x955f[_0x6d59f9];return _0x1f599a;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1f5cdd1..922ea5e 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 _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7b84,0x17c));var _0x47b8=function(_0x134a26,_0x12a787){_0x134a26=_0x134a26-0x0;var _0x233a50=_0x7b84[_0x134a26];return _0x233a50;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 689798a..33574f6 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 _0x58b5=['query','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','nolimit','limit','order','sort','where','pick','FaxInteractionId','filter','$gte','split','rows','addTags','spread','color','emit','removeTags','download','unix','toString','join','root','files','server','attachments','format','transcript-%d-%s.zip','push','Messages','createdAt','get','mkdirSync','Attachment','basename','existsSync','createReadStream','pipe','resolve','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','user','catch','show','params','keys','filters','intersection','model'];(function(_0x289b2b,_0x5e088e){var _0x5824a0=function(_0x55dda1){while(--_0x55dda1){_0x289b2b['push'](_0x289b2b['shift']());}};_0x5824a0(++_0x5e088e);}(_0x58b5,0x9f));var _0x558b=function(_0x798f9b,_0x48646d){_0x798f9b=_0x798f9b-0x0;var _0x1bcf59=_0x58b5[_0x798f9b];return _0x1bcf59;};'use strict';var rimraf=require(_0x558b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x558b('0x1'));var BPromise=require(_0x558b('0x2'));var util=require(_0x558b('0x3'));var path=require(_0x558b('0x4'));var fs=require('fs');var _=require(_0x558b('0x5'));var Redis=require(_0x558b('0x6'));var interaction=require(_0x558b('0x7'));var qs=require(_0x558b('0x8'));var logger=require(_0x558b('0x9'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x558b('0xa')]=_[_0x558b('0xb')](config[_0x558b('0xa')],{'host':_0x558b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x558b('0xa')]));require(_0x558b('0xd'))[_0x558b('0xe')](socket);function respondWithStatusCode(_0x416d0a,_0x370b54){_0x370b54=_0x370b54||0xcc;return function(_0x42e31b){if(_0x42e31b){return _0x416d0a[_0x558b('0xf')](_0x370b54);}return _0x416d0a[_0x558b('0x10')](_0x370b54)[_0x558b('0x11')]();};}function respondWithResult(_0x220fdc,_0x7484de){_0x7484de=_0x7484de||0xc8;return function(_0x486343){if(_0x486343){return _0x220fdc['status'](_0x7484de)['json'](_0x486343);}};}function respondWithFilteredResult(_0x204169,_0x4cf87e){return function(_0x2f3ecd){if(_0x2f3ecd){var _0x4ebc4d=typeof _0x4cf87e[_0x558b('0x12')]===_0x558b('0x13')&&typeof _0x4cf87e['limit']===_0x558b('0x13');var _0x590fbd=_0x2f3ecd['count'];var _0x2f8a7c=_0x4ebc4d?0x0:_0x4cf87e['offset'];var _0xaf1943=_0x4ebc4d?_0x2f3ecd[_0x558b('0x14')]:_0x4cf87e[_0x558b('0x12')]+_0x4cf87e['limit'];var _0x4d54d2;if(_0xaf1943>=_0x590fbd){_0xaf1943=_0x590fbd;_0x4d54d2=0xc8;}else{_0x4d54d2=0xce;}_0x204169['status'](_0x4d54d2);return _0x204169[_0x558b('0x15')](_0x558b('0x16'),_0x2f8a7c+'-'+_0xaf1943+'/'+_0x590fbd)['json'](_0x2f3ecd);}return null;};}function saveUpdates(_0x42e545){return function(_0x3ba234){if(_0x3ba234){return _0x3ba234[_0x558b('0x17')](_0x42e545)[_0x558b('0x18')](function(_0x2751c2){return _0x2751c2;});}return null;};}function removeEntity(_0x2473a9){return function(_0x2478b6){if(_0x2478b6){return _0x2478b6[_0x558b('0x19')]()['then'](function(){_0x2473a9[_0x558b('0x10')](0xcc)[_0x558b('0x11')]();});}};}function handleEntityNotFound(_0x984a07){return function(_0x4fafc7){if(!_0x4fafc7){_0x984a07[_0x558b('0xf')](0x194);}return _0x4fafc7;};}function handleError(_0x299326,_0x339e52){_0x339e52=_0x339e52||0x1f4;return function(_0x3a3349){logger[_0x558b('0x1a')](_0x3a3349[_0x558b('0x1b')]);if(_0x3a3349['name']){delete _0x3a3349[_0x558b('0x1c')];}_0x299326[_0x558b('0x10')](_0x339e52)['send'](_0x3a3349);};}exports['index']=function(_0x8e4d72,_0x28e0bb){var _0x4b61c3={};var _0x20afcd=_[_0x558b('0x1d')](db[_0x558b('0x1e')][_0x558b('0x1f')],function(_0x238951){return{'name':_0x238951['fieldName'],'type':_0x238951[_0x558b('0x20')][_0x558b('0x21')]};});_0x4b61c3=qs[_0x558b('0x22')](_0x20afcd,_0x8e4d72);return interaction[_0x558b('0x23')](_0x558b('0x24'),_0x8e4d72['query'],_0x8e4d72[_0x558b('0x25')],_0x4b61c3,_0x20afcd)[_0x558b('0x18')](respondWithFilteredResult(_0x28e0bb,_0x4b61c3))[_0x558b('0x26')](handleError(_0x28e0bb,null));};exports[_0x558b('0x27')]=function(_0x2a387c,_0x50feff){var _0x2e526b={'raw':![],'where':{'id':_0x2a387c[_0x558b('0x28')]['id']}},_0x4d43aa={};_0x4d43aa['model']=_[_0x558b('0x29')](db[_0x558b('0x1e')][_0x558b('0x1f')]);_0x4d43aa['query']=_['keys'](_0x2a387c['query']);_0x4d43aa[_0x558b('0x2a')]=_[_0x558b('0x2b')](_0x4d43aa[_0x558b('0x2c')],_0x4d43aa[_0x558b('0x2d')]);_0x2e526b[_0x558b('0x2e')]=_[_0x558b('0x2b')](_0x4d43aa[_0x558b('0x2c')],qs['fields'](_0x2a387c['query'][_0x558b('0x2f')]));_0x2e526b[_0x558b('0x2e')]=_0x2e526b[_0x558b('0x2e')][_0x558b('0x30')]?_0x2e526b[_0x558b('0x2e')]:_0x4d43aa['model'];if(_0x2a387c[_0x558b('0x2d')][_0x558b('0x31')]){_0x2e526b[_0x558b('0x32')]=[{'all':!![]}];}_0x2e526b=_[_0x558b('0x33')]({},_0x2e526b,_0x2a387c[_0x558b('0x34')]);return db[_0x558b('0x1e')][_0x558b('0x35')](_0x2e526b)['then'](handleEntityNotFound(_0x50feff,null))[_0x558b('0x18')](respondWithResult(_0x50feff,null))[_0x558b('0x26')](handleError(_0x50feff,null));};exports[_0x558b('0x36')]=function(_0x1b98b8,_0x43cdd2){return db[_0x558b('0x1e')][_0x558b('0x36')](_0x1b98b8[_0x558b('0x37')],{})[_0x558b('0x18')](respondWithResult(_0x43cdd2,0xc9))['catch'](handleError(_0x43cdd2,null));};exports[_0x558b('0x17')]=function(_0x20e1a2,_0x4c7609){if(_0x20e1a2[_0x558b('0x37')]['id']){delete _0x20e1a2[_0x558b('0x37')]['id'];}return db[_0x558b('0x1e')][_0x558b('0x35')]({'where':{'id':_0x20e1a2['params']['id']}})[_0x558b('0x18')](handleEntityNotFound(_0x4c7609,null))[_0x558b('0x18')](saveUpdates(_0x20e1a2['body'],null))[_0x558b('0x18')](respondWithResult(_0x4c7609,null))[_0x558b('0x26')](handleError(_0x4c7609,null));};exports[_0x558b('0x19')]=function(_0x549491,_0x18202b){return db['FaxInteraction'][_0x558b('0x35')]({'where':{'id':_0x549491[_0x558b('0x28')]['id']}})[_0x558b('0x18')](handleEntityNotFound(_0x18202b,null))['then'](removeEntity(_0x18202b,null))[_0x558b('0x26')](handleError(_0x18202b,null));};exports[_0x558b('0x38')]=function(_0x46438a,_0x933d53){return db[_0x558b('0x1e')][_0x558b('0x38')]()[_0x558b('0x18')](respondWithResult(_0x933d53,null))[_0x558b('0x26')](handleError(_0x933d53,null));};exports[_0x558b('0x39')]=function(_0x572fe1,_0x9c48f8){return db[_0x558b('0x3a')][_0x558b('0x35')]({'where':{'id':_0x572fe1[_0x558b('0x28')]['id']}})['then'](handleEntityNotFound(_0x9c48f8,null))['then'](function(_0x22ad32){if(_0x22ad32){return _0x22ad32[_0x558b('0x39')](_0x572fe1[_0x558b('0x37')][_0x558b('0x3b')],_[_0x558b('0x3c')](_0x572fe1[_0x558b('0x37')],[_0x558b('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x9c48f8,null))[_0x558b('0x26')](handleError(_0x9c48f8,null));};exports['getMessages']=function(_0x3ef234,_0x181b90){var _0x625749={'raw':![],'where':{}};var _0x257418={};var _0x59f4a4={'count':0x0,'rows':[]};return db[_0x558b('0x1e')][_0x558b('0x3d')]({'where':{'id':_0x3ef234['params']['id']}})[_0x558b('0x18')](handleEntityNotFound(_0x181b90,null))[_0x558b('0x18')](function(_0x469541){if(_0x469541){_0x257418['model']=_['keys'](db[_0x558b('0x3a')]['rawAttributes']);_0x257418[_0x558b('0x2d')]=_[_0x558b('0x29')](_0x3ef234['query']);_0x257418['filters']=_[_0x558b('0x2b')](_0x257418[_0x558b('0x2c')],_0x257418[_0x558b('0x2d')]);_0x625749[_0x558b('0x2e')]=_[_0x558b('0x2b')](_0x257418[_0x558b('0x2c')],qs['fields'](_0x3ef234[_0x558b('0x2d')]['fields']));_0x625749[_0x558b('0x2e')]=_0x625749[_0x558b('0x2e')][_0x558b('0x30')]?_0x625749['attributes']:_0x257418[_0x558b('0x2c')];if(!_0x3ef234[_0x558b('0x2d')][_0x558b('0x3e')](_0x558b('0x3f'))){_0x625749['limit']=qs[_0x558b('0x40')](_0x3ef234[_0x558b('0x2d')][_0x558b('0x40')]);_0x625749[_0x558b('0x12')]=qs[_0x558b('0x12')](_0x3ef234[_0x558b('0x2d')]['offset']);}_0x625749[_0x558b('0x41')]=qs[_0x558b('0x42')](_0x3ef234[_0x558b('0x2d')][_0x558b('0x42')]);_0x625749[_0x558b('0x43')]=qs[_0x558b('0x2a')](_[_0x558b('0x44')](_0x3ef234[_0x558b('0x2d')],_0x257418[_0x558b('0x2a')]));_0x625749[_0x558b('0x43')][_0x558b('0x45')]=_0x469541['id'];if(_0x3ef234[_0x558b('0x2d')][_0x558b('0x46')]){_0x625749[_0x558b('0x43')]=_[_0x558b('0x33')](_0x625749[_0x558b('0x43')],{'$or':_['map'](_0x625749[_0x558b('0x2e')],function(_0x2ea7f8){var _0x4c5ee5={};_0x4c5ee5[_0x2ea7f8]={'$like':'%'+_0x3ef234[_0x558b('0x2d')][_0x558b('0x46')]+'%'};return _0x4c5ee5;})});}if(_0x3ef234[_0x558b('0x2d')][_0x558b('0x47')]){var _0x1c87a4=_0x3ef234[_0x558b('0x2d')][_0x558b('0x47')][_0x558b('0x48')](',');var _0x53c099={};_0x53c099[_0x1c87a4[0x0]]={'$gte':moment(_0x1c87a4[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x625749['where']=_[_0x558b('0x33')](_0x625749[_0x558b('0x43')],_0x53c099);}_0x625749=_['merge']({},_0x625749,_0x3ef234['options']);return db[_0x558b('0x3a')][_0x558b('0x14')]({'where':_0x625749[_0x558b('0x43')]})[_0x558b('0x18')](function(_0x1f510b){_0x59f4a4[_0x558b('0x14')]=_0x1f510b;if(_0x3ef234['query'][_0x558b('0x31')]){_0x625749['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x625749);})['then'](function(_0x555f79){_0x59f4a4[_0x558b('0x49')]=_0x555f79;return _0x59f4a4;});}})[_0x558b('0x18')](respondWithFilteredResult(_0x181b90,_0x625749))[_0x558b('0x26')](handleError(_0x181b90,null));};exports[_0x558b('0x4a')]=function(_0x1d242d,_0x54c36c){return db['FaxInteraction'][_0x558b('0x35')]({'where':{'id':_0x1d242d['params']['id']}})['then'](handleEntityNotFound(_0x54c36c,null))[_0x558b('0x18')](function(_0x45d376){if(_0x45d376){return _0x45d376['setTags'](_0x1d242d[_0x558b('0x37')]['ids'],_[_0x558b('0x3c')](_0x1d242d[_0x558b('0x37')],['ids','id'])||{})[_0x558b('0x4b')](function(){return db['Tag'][_0x558b('0x23')]({'attributes':['id',_0x558b('0x1c'),_0x558b('0x4c')],'where':{'id':_0x1d242d['body'][_0x558b('0x3b')]}});})[_0x558b('0x18')](function(_0x1f645b){socket[_0x558b('0x4d')]('faxInteractionTags:save',{'id':Number(_0x1d242d['params']['id']),'tags':_0x1f645b||[]});return{'id':Number(_0x1d242d[_0x558b('0x28')]['id']),'tags':_0x1f645b||[]};});}})[_0x558b('0x18')](respondWithResult(_0x54c36c,null))[_0x558b('0x26')](handleError(_0x54c36c,null));};exports[_0x558b('0x4e')]=function(_0x3daccc,_0x63ab91){return db[_0x558b('0x1e')][_0x558b('0x35')]({'where':{'id':_0x3daccc[_0x558b('0x28')]['id']}})[_0x558b('0x18')](handleEntityNotFound(_0x63ab91,null))['then'](function(_0xf6c547){if(_0xf6c547){return _0xf6c547[_0x558b('0x4e')](_0x3daccc['query'][_0x558b('0x3b')]);}})[_0x558b('0x18')](respondWithStatusCode(_0x63ab91,null))[_0x558b('0x26')](handleError(_0x63ab91,null));};exports[_0x558b('0x4f')]=function(_0x554bc5,_0x454d61){var _0x1d1228=moment()[_0x558b('0x50')]()[_0x558b('0x51')]();var _0xd6b87a=path[_0x558b('0x52')](config[_0x558b('0x53')],'server',_0x558b('0x54'),'tmp');var _0x4ed3c4=path[_0x558b('0x52')](config[_0x558b('0x53')],_0x558b('0x55'),_0x558b('0x54'),_0x558b('0x56'));var _0x3edaef=path[_0x558b('0x52')](_0xd6b87a,_0x1d1228);var _0x14e7d8=util[_0x558b('0x57')](_0x558b('0x58'),_0x554bc5[_0x558b('0x28')]['id'],_0x1d1228);var _0x1af322=path[_0x558b('0x52')](_0xd6b87a,_0x14e7d8);var _0x45ccf6=[];_0x45ccf6[_0x558b('0x59')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x35af9f=[{'model':db[_0x558b('0x3a')],'as':_0x558b('0x5a'),'attributes':['id','body',_0x558b('0x5b')],'include':_0x45ccf6}];return db[_0x558b('0x1e')][_0x558b('0x35')]({'where':{'id':_0x554bc5[_0x558b('0x28')]['id']},'include':_0x35af9f})[_0x558b('0x18')](handleEntityNotFound(_0x454d61,null))['then'](function(_0x17b749){if(_0x17b749&&_0x17b749[_0x558b('0x5a')]){var _0x147cc7=_0x17b749[_0x558b('0x5c')]({'plain':!![]});fs[_0x558b('0x5d')](_0x3edaef);for(var _0x11f368=0x0;_0x11f368<_0x147cc7[_0x558b('0x5a')]['length'];_0x11f368++){var _0x155b39=_0x147cc7[_0x558b('0x5a')][_0x11f368][_0x558b('0x5e')];if(_0x155b39){var _0x190c41=path['join'](_0x4ed3c4,_0x155b39[_0x558b('0x5f')]);if(fs[_0x558b('0x60')](_0x190c41)){fs[_0x558b('0x61')](_0x190c41)[_0x558b('0x62')](fs['createWriteStream'](path['join'](_0x3edaef,_0x155b39['basename'])));}}}return BPromise[_0x558b('0x63')]()['then'](function(){return new BPromise(function(_0x47e02c,_0x17e0e4){zipdir(_0x3edaef,{'saveTo':_0x1af322},function(_0x4cade9,_0x370a3e){if(_0x4cade9)return _0x17e0e4(_0x4cade9);return _0x47e02c(_0x370a3e);});})[_0x558b('0x18')](function(){return new BPromise(function(_0x2b80b0,_0x1d01a4){rimraf(_0x3edaef,function(_0x4bde5f){if(_0x4bde5f)_0x1d01a4(_0x4bde5f);return _0x2b80b0();});});})['then'](function(){return _0x454d61[_0x558b('0x4f')](_0x1af322,_0x14e7d8,function(_0x7d3516){if(_0x7d3516){console['log'](_0x558b('0x64'),_0x7d3516);}else{fs[_0x558b('0x65')](_0x1af322);}});});});}else{return _0x454d61['sendStatus'](0xc8);}})[_0x558b('0x26')](handleError(_0x454d61,null));}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 146741f..e49adc0 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 _0xd750=['getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove'];(function(_0xd0ee2c,_0xdd29ba){var _0x508e58=function(_0x1a3a3e){while(--_0x1a3a3e){_0xd0ee2c['push'](_0xd0ee2c['shift']());}};_0x508e58(++_0xdd29ba);}(_0xd750,0x173));var _0x0d75=function(_0x1b58b8,_0x3e1c2a){_0x1b58b8=_0x1b58b8-0x0;var _0x479502=_0xd750[_0x1b58b8];return _0x479502;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x0d75('0x0'))['db'][_0x0d75('0x1')];var FaxMessage=require(_0x0d75('0x0'))['db'][_0x0d75('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0d75('0x3')](0x0);var events={'afterCreate':_0x0d75('0x4'),'afterUpdate':_0x0d75('0x5'),'afterDestroy':_0x0d75('0x6')};function emitEvent(_0x11567e){return function(_0x1db984,_0x242a7d,_0x52a5ba){_0x1db984[_0x0d75('0x7')]({'attributes':['id'],'raw':!![]})[_0x0d75('0x8')](function(_0x28516f){_0x1db984[_0x0d75('0x9')](_0x0d75('0xa'),_0x28516f[_0x0d75('0xb')](function(_0xd83db6){return{'id':_0xd83db6['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1db984['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0d75('0x8')](function(_0x16fe83){_0x1db984[_0x0d75('0x9')]('unreadMessages',_0x16fe83[_0x0d75('0xc')]);FaxInteractionEvents[_0x0d75('0xd')](_0x11567e+':'+_0x1db984['id'],_0x1db984);FaxInteractionEvents['emit'](_0x11567e,_0x1db984);_0x52a5ba(null);})[_0x0d75('0xe')](_0x52a5ba(null));};}for(var e in events){if(events[_0x0d75('0xf')](e)){var event=events[e];FaxInteraction[_0x0d75('0x10')](e,emitEvent(event));}}module[_0x0d75('0x11')]=FaxInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 83539e0..c9cb4ab 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 _0xdf93=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3d0aae,_0x23ed20){var _0x2cf906=function(_0xdcaca1){while(--_0xdcaca1){_0x3d0aae['push'](_0x3d0aae['shift']());}};_0x2cf906(++_0x23ed20);}(_0xdf93,0x13b));var _0x3df9=function(_0x457b2f,_0x3d6c6d){_0x457b2f=_0x457b2f-0x0;var _0x133808=_0xdf93[_0x457b2f];return _0x133808;};'use strict';var _=require(_0x3df9('0x0'));var util=require(_0x3df9('0x1'));var logger=require(_0x3df9('0x2'))('api');var moment=require(_0x3df9('0x3'));var BPromise=require(_0x3df9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3df9('0x5'));var rimraf=require(_0x3df9('0x6'));var config=require(_0x3df9('0x7'));var attributes=require(_0x3df9('0x8'));module[_0x3df9('0x9')]=function(_0x286688,_0x58632e){return _0x286688[_0x3df9('0xa')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x71809c,_0x2dc660,_0x3698cb){if(_0x71809c['changed'](_0x3df9('0xb'))){_0x71809c[_0x3df9('0xc')]=moment()[_0x3df9('0xd')](_0x3df9('0xe'));}_0x3698cb(null,_0x71809c);}}});}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 2783b69..613fa24 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 _0xb2d9=['FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','info','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then'];(function(_0x5465bf,_0x55ff18){var _0x4fb1cc=function(_0x42d404){while(--_0x42d404){_0x5465bf['push'](_0x5465bf['shift']());}};_0x4fb1cc(++_0x55ff18);}(_0xb2d9,0x105));var _0x9b2d=function(_0x28ae06,_0x45e0c1){_0x28ae06=_0x28ae06-0x0;var _0x524495=_0xb2d9[_0x28ae06];return _0x524495;};'use strict';var _=require('lodash');var util=require(_0x9b2d('0x0'));var moment=require(_0x9b2d('0x1'));var BPromise=require(_0x9b2d('0x2'));var rs=require(_0x9b2d('0x3'));var fs=require('fs');var Redis=require(_0x9b2d('0x4'));var db=require(_0x9b2d('0x5'))['db'];var utils=require(_0x9b2d('0x6'));var logger=require(_0x9b2d('0x7'))(_0x9b2d('0x8'));var config=require(_0x9b2d('0x9'));var jayson=require(_0x9b2d('0xa'));var client=jayson[_0x9b2d('0xb')][_0x9b2d('0xc')]({'port':0x232a});config[_0x9b2d('0xd')]=_[_0x9b2d('0xe')](config[_0x9b2d('0xd')],{'host':_0x9b2d('0xf'),'port':0x18eb});var socket=require(_0x9b2d('0x10'))(new Redis(config[_0x9b2d('0xd')]));require(_0x9b2d('0x11'))[_0x9b2d('0x12')](socket);function respondWithRpcPromise(_0x17715b,_0x4a8cd4,_0x2e7a2a){return new BPromise(function(_0x47824f,_0x4e86ac){return client[_0x9b2d('0x13')](_0x17715b,_0x2e7a2a)[_0x9b2d('0x14')](function(_0xf245b4){logger['info'](_0x9b2d('0x15'),_0x4a8cd4,_0x9b2d('0x16'));logger[_0x9b2d('0x17')](_0x9b2d('0x18'),_0x4a8cd4,_0x9b2d('0x16'),JSON[_0x9b2d('0x19')](_0xf245b4));if(_0xf245b4[_0x9b2d('0x1a')]){if(_0xf245b4[_0x9b2d('0x1a')][_0x9b2d('0x1b')]===0x1f4){logger[_0x9b2d('0x1a')](_0x9b2d('0x15'),_0x4a8cd4,_0xf245b4['error']['message']);return _0x4e86ac(_0xf245b4[_0x9b2d('0x1a')][_0x9b2d('0x1c')]);}logger[_0x9b2d('0x1a')](_0x9b2d('0x15'),_0x4a8cd4,_0xf245b4[_0x9b2d('0x1a')]['message']);return _0x47824f(_0xf245b4[_0x9b2d('0x1a')][_0x9b2d('0x1c')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4a8cd4,'request\x20sent');_0x47824f(_0xf245b4[_0x9b2d('0x1d')][_0x9b2d('0x1c')]);}})[_0x9b2d('0x1e')](function(_0x5c206e){logger['error'](_0x9b2d('0x15'),_0x4a8cd4,_0x5c206e);_0x4e86ac(_0x5c206e);});});}exports[_0x9b2d('0x1f')]=function(_0x41541c){var _0x512da7=this;return new Promise(function(_0x3e2e3a,_0x576e52){return db[_0x9b2d('0x20')][_0x9b2d('0x21')](_0x41541c['body'],{'raw':_0x41541c[_0x9b2d('0x22')]?_0x41541c[_0x9b2d('0x22')][_0x9b2d('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41541c[_0x9b2d('0x22')]?_0x41541c[_0x9b2d('0x22')][_0x9b2d('0x24')]||null:null,'attributes':_0x41541c[_0x9b2d('0x22')]?_0x41541c['options'][_0x9b2d('0x25')]||null:null,'limit':_0x41541c[_0x9b2d('0x22')]?_0x41541c['options']['limit']||null:null})[_0x9b2d('0x14')](function(_0x16c461){logger[_0x9b2d('0x26')]('UpdateFaxInteraction',_0x41541c);logger[_0x9b2d('0x17')](_0x9b2d('0x1f'),_0x41541c,JSON[_0x9b2d('0x19')](_0x16c461));_0x3e2e3a(_0x16c461);})[_0x9b2d('0x1e')](function(_0xc0ad3b){logger[_0x9b2d('0x1a')](_0x9b2d('0x1f'),_0xc0ad3b[_0x9b2d('0x1c')],_0x41541c);_0x576e52(_0x512da7[_0x9b2d('0x1a')](0x1f4,_0xc0ad3b[_0x9b2d('0x1c')]));});});};exports[_0x9b2d('0x27')]=function(_0x4276d8){return new Promise(function(_0x1d710b,_0x38d52c){return db[_0x9b2d('0x20')][_0x9b2d('0x28')]({'where':_0x4276d8['options']?_0x4276d8[_0x9b2d('0x22')]['where']||null:null})[_0x9b2d('0x14')](function(_0x235c09){if(_0x235c09){return _0x235c09[_0x9b2d('0x29')](_0x4276d8[_0x9b2d('0x2a')][_0x9b2d('0x2b')],_[_0x9b2d('0x2c')](_0x4276d8[_0x9b2d('0x2a')],[_0x9b2d('0x2b'),'id'])||{});}})[_0x9b2d('0x2d')](function(_0x5376a6){logger[_0x9b2d('0x26')](_0x9b2d('0x2e'),_0x4276d8);logger[_0x9b2d('0x17')](_0x9b2d('0x2e'),_0x4276d8,JSON[_0x9b2d('0x19')](_0x5376a6));_0x1d710b(_0x5376a6);})[_0x9b2d('0x1e')](function(_0x419dd8){logger[_0x9b2d('0x1a')]('AddTags',_0x419dd8[_0x9b2d('0x1c')],_0x4276d8);_0x38d52c(_this[_0x9b2d('0x1a')](0x1f4,_0x419dd8[_0x9b2d('0x1c')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 80f6bd4..cee06f7 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 _0x9ab9=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x3235b3,_0x585376){var _0x4f2c73=function(_0x2f50bc){while(--_0x2f50bc){_0x3235b3['push'](_0x3235b3['shift']());}};_0x4f2c73(++_0x585376);}(_0x9ab9,0x87));var _0x99ab=function(_0x123edb,_0x4c3fb2){_0x123edb=_0x123edb-0x0;var _0x44f83e=_0x9ab9[_0x123edb];return _0x44f83e;};'use strict';var FaxInteractionEvents=require(_0x99ab('0x0'));var events=[_0x99ab('0x1'),_0x99ab('0x2'),_0x99ab('0x3')];function createListener(_0x5e7498,_0x49ed0f){return function(_0x296ac9){_0x49ed0f[_0x99ab('0x4')](_0x5e7498,_0x296ac9);};}function removeListener(_0x530576,_0x22cc53){return function(){FaxInteractionEvents[_0x99ab('0x5')](_0x530576,_0x22cc53);};}exports[_0x99ab('0x6')]=function(_0x13b5a3){for(var _0x4c8d32=0x0,_0x53f971=events[_0x99ab('0x7')];_0x4c8d32<_0x53f971;_0x4c8d32++){var _0xd8fda8=events[_0x4c8d32];var _0x240755=createListener(_0x99ab('0x8')+_0xd8fda8,_0x13b5a3);FaxInteractionEvents['on'](_0xd8fda8,_0x240755);}}; \ No newline at end of file +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 diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ccc1ca6..8f4606e 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 _0xe37a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','create','post','addMessage','fax','faxinteraction:addtags','addTags','put','update','delete','tracked','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x471ed9,_0x576066){var _0x398eb8=function(_0x34e948){while(--_0x34e948){_0x471ed9['push'](_0x471ed9['shift']());}};_0x398eb8(++_0x576066);}(_0xe37a,0x1bd));var _0xae37=function(_0x2c84a8,_0x49eccb){_0x2c84a8=_0x2c84a8-0x0;var _0xbce604=_0xe37a[_0x2c84a8];return _0xbce604;};'use strict';var multer=require(_0xae37('0x0'));var util=require(_0xae37('0x1'));var path=require(_0xae37('0x2'));var timeout=require(_0xae37('0x3'));var express=require(_0xae37('0x4'));var router=express[_0xae37('0x5')]();var fs_extra=require(_0xae37('0x6'));var auth=require(_0xae37('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae37('0x8'));var controller=require(_0xae37('0x9'));router[_0xae37('0xa')]('/',auth[_0xae37('0xb')](),controller[_0xae37('0xc')]);router[_0xae37('0xa')](_0xae37('0xd'),auth[_0xae37('0xb')](),controller['describe']);router[_0xae37('0xa')](_0xae37('0xe'),auth['isAuthenticated'](),controller[_0xae37('0xf')]);router['get'](_0xae37('0x10'),auth[_0xae37('0xb')](),controller[_0xae37('0x11')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xae37('0x12')]);router[_0xae37('0x13')](_0xae37('0x10'),auth['isAuthenticated'](),controller[_0xae37('0x14')]);router[_0xae37('0x13')]('/:id/tags',auth[_0xae37('0xb')](),interaction['tracked'](_0xae37('0x15'),_0xae37('0x16')),controller[_0xae37('0x17')]);router[_0xae37('0x18')](_0xae37('0xe'),auth[_0xae37('0xb')](),interaction['tracked'](_0xae37('0x15'),'faxinteraction:update'),controller[_0xae37('0x19')]);router[_0xae37('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xae37('0x1b')](_0xae37('0x15'),_0xae37('0x1c')),controller[_0xae37('0x1d')]);router[_0xae37('0x1a')]('/:id/tags',auth[_0xae37('0xb')](),controller[_0xae37('0x1e')]);module[_0xae37('0x1f')]=router; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 9a1beee..af74137 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 _0xe630=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0xe630,0x149));var _0x0e63=function(_0x26b00e,_0x245a09){_0x26b00e=_0x26b00e-0x0;var _0x3764c3=_0xe630[_0x26b00e];return _0x3764c3;};'use strict';var Sequelize=require(_0x0e63('0x0'));module[_0x0e63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0e63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0e63('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e63('0x4')]('in','out'),'defaultValue':_0x0e63('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0e63('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0e63('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 464b6a5..afef0d6 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 _0xe0ce=['root','server','files','attachments','Attachment','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','apply','update','destroy','stack','name','send','index','map','FaxMessage','type','key','model','query','filters','attributes','intersection','length','nolimit','order','sort','merge','where','VIRTUAL','options','count','includeAll','show','params','keys','rawAttributes','fields','include','body','find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','email','internal','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join'];(function(_0x4c0405,_0x1d263c){var _0x125158=function(_0x5d8b54){while(--_0x5d8b54){_0x4c0405['push'](_0x4c0405['shift']());}};_0x125158(++_0x1d263c);}(_0xe0ce,0x1b0));var _0xee0c=function(_0x4c29f9,_0x5bddd4){_0x4c29f9=_0x4c29f9-0x0;var _0x4e17b8=_0xe0ce[_0x4c29f9];return _0x4e17b8;};'use strict';var emlformat=require(_0xee0c('0x0'));var rimraf=require(_0xee0c('0x1'));var zipdir=require(_0xee0c('0x2'));var jsonpatch=require(_0xee0c('0x3'));var rp=require(_0xee0c('0x4'));var moment=require(_0xee0c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee0c('0x6'));var path=require(_0xee0c('0x7'));var sox=require(_0xee0c('0x8'));var csv=require(_0xee0c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee0c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee0c('0xb'));var Papa=require('papaparse');var Redis=require(_0xee0c('0xc'));var authService=require(_0xee0c('0xd'));var qs=require(_0xee0c('0xe'));var as=require(_0xee0c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee0c('0x10'))(_0xee0c('0x11'));var utils=require(_0xee0c('0x12'));var config=require(_0xee0c('0x13'));var licenseUtil=require(_0xee0c('0x14'));var db=require(_0xee0c('0x15'))['db'];config[_0xee0c('0x16')]=_[_0xee0c('0x17')](config['redis'],{'host':_0xee0c('0x18'),'port':0x18eb});var socket=require(_0xee0c('0x19'))(new Redis(config[_0xee0c('0x16')]));require(_0xee0c('0x1a'))[_0xee0c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xee0c('0x1c')][_0xee0c('0x1d')]({'port':0x232c});var client9002=jayson[_0xee0c('0x1c')][_0xee0c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x33b2c8,_0x276e8,_0x4e69c8,_0x4f64db){return new BPromise(function(_0x14fe2b,_0x24c854){var _0x142a87=_0x4f64db||client;return _0x142a87[_0xee0c('0x1e')](_0x33b2c8,_0x4e69c8)[_0xee0c('0x1f')](function(_0x44dda1){logger[_0xee0c('0x20')](_0xee0c('0x21'),_0x276e8,_0xee0c('0x22'));logger[_0xee0c('0x23')](_0xee0c('0x24'),_0x276e8,_0xee0c('0x22'),JSON['stringify'](_0x44dda1));if(_0x44dda1['error']){if(_0x44dda1[_0xee0c('0x25')][_0xee0c('0x26')]===0x1f4){logger[_0xee0c('0x25')](_0xee0c('0x21'),_0x276e8,_0x44dda1[_0xee0c('0x25')][_0xee0c('0x27')]);return _0x24c854(_0x44dda1[_0xee0c('0x25')][_0xee0c('0x27')]);}logger[_0xee0c('0x25')](_0xee0c('0x21'),_0x276e8,_0x44dda1[_0xee0c('0x25')][_0xee0c('0x27')]);return _0x14fe2b(_0x44dda1[_0xee0c('0x25')][_0xee0c('0x27')]);}else{logger[_0xee0c('0x20')](_0xee0c('0x21'),_0x276e8,'request\x20sent');_0x14fe2b(_0x44dda1['result'][_0xee0c('0x27')]);}})[_0xee0c('0x28')](function(_0x383441){logger[_0xee0c('0x25')]('FaxMessage,\x20%s,\x20%s',_0x276e8,_0x383441);_0x24c854(_0x383441);});});}function respondWithStatusCode(_0x35d609,_0x59d7eb){_0x59d7eb=_0x59d7eb||0xcc;return function(_0x53022c){if(_0x53022c){return _0x35d609[_0xee0c('0x29')](_0x59d7eb);}return _0x35d609[_0xee0c('0x2a')](_0x59d7eb)[_0xee0c('0x2b')]();};}function respondWithResult(_0x2b9d8b,_0x5edcfa){_0x5edcfa=_0x5edcfa||0xc8;return function(_0x253bba){if(_0x253bba){return _0x2b9d8b[_0xee0c('0x2a')](_0x5edcfa)[_0xee0c('0x2c')](_0x253bba);}};}function respondWithFilteredResult(_0x203823,_0xafc131){return function(_0x22203e){if(_0x22203e){var _0x370f35=typeof _0xafc131[_0xee0c('0x2d')]===_0xee0c('0x2e')&&typeof _0xafc131[_0xee0c('0x2f')]===_0xee0c('0x2e');var _0x2991f7=_0x22203e['count'];var _0x3d6777=_0x370f35?0x0:_0xafc131[_0xee0c('0x2d')];var _0x50dcd0=_0x370f35?_0x22203e['count']:_0xafc131[_0xee0c('0x2d')]+_0xafc131['limit'];var _0x1e194e;if(_0x50dcd0>=_0x2991f7){_0x50dcd0=_0x2991f7;_0x1e194e=0xc8;}else{_0x1e194e=0xce;}_0x203823[_0xee0c('0x2a')](_0x1e194e);return _0x203823[_0xee0c('0x30')]('Content-Range',_0x3d6777+'-'+_0x50dcd0+'/'+_0x2991f7)[_0xee0c('0x2c')](_0x22203e);}return null;};}function patchUpdates(_0x3b832c){return function(_0x2668f2){try{jsonpatch[_0xee0c('0x31')](_0x2668f2,_0x3b832c,!![]);}catch(_0x55e4c4){return BPromise['reject'](_0x55e4c4);}return _0x2668f2['save']();};}function saveUpdates(_0x5daf24,_0x5a819d){return function(_0x36b25e){if(_0x36b25e){return _0x36b25e[_0xee0c('0x32')](_0x5daf24)[_0xee0c('0x1f')](function(_0xcec143){return _0xcec143;});}return null;};}function removeEntity(_0x202d4f,_0x5c720f){return function(_0x1da123){if(_0x1da123){return _0x1da123[_0xee0c('0x33')]()[_0xee0c('0x1f')](function(){_0x202d4f['status'](0xcc)[_0xee0c('0x2b')]();});}};}function handleEntityNotFound(_0x267fef,_0x4bda77){return function(_0x4c024a){if(!_0x4c024a){_0x267fef[_0xee0c('0x29')](0x194);}return _0x4c024a;};}function handleError(_0x5412af,_0x5e5f1c){_0x5e5f1c=_0x5e5f1c||0x1f4;return function(_0x532884){logger[_0xee0c('0x25')](_0x532884[_0xee0c('0x34')]);if(_0x532884[_0xee0c('0x35')]){delete _0x532884[_0xee0c('0x35')];}_0x5412af[_0xee0c('0x2a')](_0x5e5f1c)[_0xee0c('0x36')](_0x532884);};}exports[_0xee0c('0x37')]=function(_0x5bd2d3,_0x1ea889){var _0x545398={},_0x6e3431={},_0x4b7e94={'count':0x0,'rows':[]};var _0x3ceb01=_[_0xee0c('0x38')](db[_0xee0c('0x39')]['rawAttributes'],function(_0x1d46dc){return{'name':_0x1d46dc['fieldName'],'type':_0x1d46dc[_0xee0c('0x3a')][_0xee0c('0x3b')]};});_0x6e3431[_0xee0c('0x3c')]=_[_0xee0c('0x38')](_0x3ceb01,'name');_0x6e3431[_0xee0c('0x3d')]=_['keys'](_0x5bd2d3[_0xee0c('0x3d')]);_0x6e3431[_0xee0c('0x3e')]=_['intersection'](_0x6e3431['model'],_0x6e3431['query']);_0x545398[_0xee0c('0x3f')]=_[_0xee0c('0x40')](_0x6e3431['model'],qs['fields'](_0x5bd2d3['query']['fields']));_0x545398[_0xee0c('0x3f')]=_0x545398[_0xee0c('0x3f')][_0xee0c('0x41')]?_0x545398[_0xee0c('0x3f')]:_0x6e3431[_0xee0c('0x3c')];if(!_0x5bd2d3['query']['hasOwnProperty'](_0xee0c('0x42'))){_0x545398[_0xee0c('0x2f')]=qs[_0xee0c('0x2f')](_0x5bd2d3[_0xee0c('0x3d')][_0xee0c('0x2f')]);_0x545398[_0xee0c('0x2d')]=qs[_0xee0c('0x2d')](_0x5bd2d3['query'][_0xee0c('0x2d')]);}_0x545398[_0xee0c('0x43')]=qs[_0xee0c('0x44')](_0x5bd2d3[_0xee0c('0x3d')]['sort']);_0x545398['where']=qs[_0xee0c('0x3e')](_['pick'](_0x5bd2d3[_0xee0c('0x3d')],_0x6e3431[_0xee0c('0x3e')]),_0x3ceb01);if(_0x5bd2d3[_0xee0c('0x3d')]['filter']){_0x545398['where']=_[_0xee0c('0x45')](_0x545398[_0xee0c('0x46')],{'$or':_[_0xee0c('0x38')](_0x3ceb01,function(_0x5cb5d1){if(_0x5cb5d1[_0xee0c('0x3a')]!==_0xee0c('0x47')){var _0x14ab43={};_0x14ab43[_0x5cb5d1[_0xee0c('0x35')]]={'$like':'%'+_0x5bd2d3[_0xee0c('0x3d')]['filter']+'%'};return _0x14ab43;}})});}_0x545398=_['merge']({},_0x545398,_0x5bd2d3[_0xee0c('0x48')]);var _0x1f7013={'where':_0x545398['where']};return db['FaxMessage'][_0xee0c('0x49')](_0x1f7013)[_0xee0c('0x1f')](function(_0x4fcee4){_0x4b7e94['count']=_0x4fcee4;if(_0x5bd2d3[_0xee0c('0x3d')][_0xee0c('0x4a')]){_0x545398['include']=[{'all':!![]}];}return db[_0xee0c('0x39')]['findAll'](_0x545398);})[_0xee0c('0x1f')](function(_0x3bb9f6){_0x4b7e94['rows']=_0x3bb9f6;return _0x4b7e94;})[_0xee0c('0x1f')](respondWithFilteredResult(_0x1ea889,_0x545398))['catch'](handleError(_0x1ea889,null));};exports[_0xee0c('0x4b')]=function(_0x120bdf,_0x4201d7){var _0x171575={'raw':!![],'where':{'id':_0x120bdf[_0xee0c('0x4c')]['id']}},_0x5d52e3={};_0x5d52e3[_0xee0c('0x3c')]=_[_0xee0c('0x4d')](db['FaxMessage'][_0xee0c('0x4e')]);_0x5d52e3[_0xee0c('0x3d')]=_['keys'](_0x120bdf[_0xee0c('0x3d')]);_0x5d52e3[_0xee0c('0x3e')]=_[_0xee0c('0x40')](_0x5d52e3[_0xee0c('0x3c')],_0x5d52e3[_0xee0c('0x3d')]);_0x171575[_0xee0c('0x3f')]=_[_0xee0c('0x40')](_0x5d52e3[_0xee0c('0x3c')],qs[_0xee0c('0x4f')](_0x120bdf[_0xee0c('0x3d')][_0xee0c('0x4f')]));_0x171575[_0xee0c('0x3f')]=_0x171575['attributes'][_0xee0c('0x41')]?_0x171575[_0xee0c('0x3f')]:_0x5d52e3[_0xee0c('0x3c')];if(_0x120bdf[_0xee0c('0x3d')]['includeAll']){_0x171575[_0xee0c('0x50')]=[{'all':!![]}];}_0x171575=_[_0xee0c('0x45')]({},_0x171575,_0x120bdf[_0xee0c('0x48')]);return db['FaxMessage']['find'](_0x171575)[_0xee0c('0x1f')](handleEntityNotFound(_0x4201d7,null))['then'](respondWithResult(_0x4201d7,null))[_0xee0c('0x28')](handleError(_0x4201d7,null));};exports[_0xee0c('0x32')]=function(_0x2567de,_0x59f737){if(_0x2567de[_0xee0c('0x51')]['id']){delete _0x2567de['body']['id'];}return db['FaxMessage']['find']({'where':{'id':_0x2567de[_0xee0c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x59f737,null))[_0xee0c('0x1f')](saveUpdates(_0x2567de[_0xee0c('0x51')],null))[_0xee0c('0x1f')](respondWithResult(_0x59f737,null))[_0xee0c('0x28')](handleError(_0x59f737,null));};exports[_0xee0c('0x33')]=function(_0x29c717,_0xbdf74e){return db[_0xee0c('0x39')][_0xee0c('0x52')]({'where':{'id':_0x29c717[_0xee0c('0x4c')]['id']}})[_0xee0c('0x1f')](handleEntityNotFound(_0xbdf74e,null))[_0xee0c('0x1f')](removeEntity(_0xbdf74e,null))[_0xee0c('0x28')](handleError(_0xbdf74e,null));};exports[_0xee0c('0x53')]=function(_0x384fd8,_0x3daf04){return db[_0xee0c('0x39')]['describe']()[_0xee0c('0x1f')](respondWithResult(_0x3daf04,null))[_0xee0c('0x28')](handleError(_0x3daf04,null));};var interaction_log=require(_0xee0c('0x10'))(_0xee0c('0x54'));exports[_0xee0c('0x55')]=function(_0x190a7e,_0x5abbf0,_0x32218f){var _0x380f66={'agent':{},'channel':_0xee0c('0x56')};if(_0x190a7e[_0xee0c('0x51')]['id']){delete _0x190a7e[_0xee0c('0x51')]['id'];}_0x190a7e[_0xee0c('0x51')][_0xee0c('0x57')]=!![];_0x190a7e['body'][_0xee0c('0x58')]=moment()[_0xee0c('0x59')](_0xee0c('0x5a'));_0x190a7e['body']['UserId']=_0x190a7e[_0xee0c('0x51')][_0xee0c('0x5b')]||_0x190a7e['user']['id'];_0x380f66[_0xee0c('0x5c')]['id']=_0x190a7e[_0xee0c('0x51')][_0xee0c('0x5b')];return db['FaxMessage'][_0xee0c('0x52')]({'where':{'id':_0x190a7e[_0xee0c('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5abbf0,null))['then'](saveUpdates(_0x190a7e[_0xee0c('0x51')],null))[_0xee0c('0x1f')](function(_0x3916a1){if(_0x3916a1){_0x380f66[_0xee0c('0x27')]=_0x3916a1[_0xee0c('0x5d')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3916a1[_0xee0c('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5abbf0,null))[_0xee0c('0x1f')](function(_0x2bcb60){if(_0x2bcb60){return _0x2bcb60[_0xee0c('0x32')]({'UserId':_0x190a7e[_0xee0c('0x51')][_0xee0c('0x5b')],'read1stAt':_[_0xee0c('0x5f')](_0x2bcb60[_0xee0c('0x60')])?moment()[_0xee0c('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xee0c('0x1f')](function(_0x4d6575){if(_0x4d6575){_0x380f66[_0xee0c('0x61')]=_0x4d6575['get']({'plain':!![]});interaction_log[_0xee0c('0x20')](_0xee0c('0x62'),_0x190a7e[_0xee0c('0x63')]['id'],_0x190a7e[_0xee0c('0x63')]['name'],_0x190a7e[_0xee0c('0x63')][_0xee0c('0x64')],_0x380f66[_0xee0c('0x61')]['id'],_0x190a7e['body']?JSON[_0xee0c('0x65')](_0x190a7e[_0xee0c('0x51')]):'null');return respondWithRpcPromise(_0xee0c('0x66'),'acceptMessage',_0x380f66);}return null;})[_0xee0c('0x1f')](function(_0x24b002){var _0xad582f=_0xee0c('0x67')+_0x24b002['message'][_0xee0c('0x68')];return db[_0xee0c('0x69')][_0xee0c('0x3d')](_0xad582f,{'type':db['Sequelize'][_0xee0c('0x6a')][_0xee0c('0x6b')],'raw':!![]})['then'](function(_0x11e843){return _0x11e843;});})[_0xee0c('0x1f')](function(_0xec3127){if(_0xec3127){_0x380f66[_0xee0c('0x27')][_0xee0c('0x6c')]=_0xec3127[0x0];if(!_0x190a7e[_0xee0c('0x51')][_0xee0c('0x5b')])return;return db[_0xee0c('0x6d')][_0xee0c('0x52')]({'where':{'id':_0x190a7e[_0xee0c('0x51')]['UserId'],'role':_0xee0c('0x5c')},'attributes':['id',_0xee0c('0x35'),_0xee0c('0x6e'),'email','internal'],'raw':!![]});}return null;})[_0xee0c('0x1f')](function(_0xb53094){if(!_0xb53094)return null;_0x380f66[_0xee0c('0x27')]['agent']=_0xb53094;return _0x380f66;})[_0xee0c('0x1f')](function(_0x1d051e){if(_0x1d051e){if(_0x190a7e['body'][_0xee0c('0x6f')]){_0x380f66[_0xee0c('0x27')][_0xee0c('0x70')]=util[_0xee0c('0x59')](_0xee0c('0x71'),_0x190a7e['user'][_0xee0c('0x35')]);_0x380f66['message']['channel']=_0x380f66[_0xee0c('0x72')];_0x380f66[_0xee0c('0x27')][_0xee0c('0x73')]=_0x380f66[_0xee0c('0x72')];_0x380f66[_0xee0c('0x27')][_0xee0c('0x74')]='accept';return respondWithRpcPromise('EventManager',_0xee0c('0x75'),{'event':'acceptmessage','message':_0x380f66[_0xee0c('0x27')]},client9002)[_0xee0c('0x1f')](function(){return _0x380f66;});}return _0x380f66;}return null;})[_0xee0c('0x1f')](respondWithResult(_0x5abbf0,null))[_0xee0c('0x28')](handleError(_0x5abbf0,null));};var interaction_log=require(_0xee0c('0x10'))(_0xee0c('0x54'));exports[_0xee0c('0x76')]=function(_0x42e3bf,_0x52e6d4,_0x6f54a2){var _0x80bf2e={'agent':{},'channel':_0xee0c('0x56')};if(_0x42e3bf['body']['id']){delete _0x42e3bf[_0xee0c('0x51')]['id'];}_0x42e3bf[_0xee0c('0x51')][_0xee0c('0x5b')]=_0x42e3bf[_0xee0c('0x51')][_0xee0c('0x5b')]||_0x42e3bf[_0xee0c('0x63')]['id'];_0x80bf2e[_0xee0c('0x5c')]['id']=_0x42e3bf[_0xee0c('0x51')][_0xee0c('0x5b')];return db['FaxMessage'][_0xee0c('0x52')]({'where':{'id':_0x42e3bf[_0xee0c('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52e6d4,null))[_0xee0c('0x1f')](function(_0x47c41e){if(_0x47c41e){_0x80bf2e[_0xee0c('0x27')]=_0x47c41e[_0xee0c('0x5d')]({'plain':!![]});return db[_0xee0c('0x77')]['find']({'where':{'id':_0x47c41e[_0xee0c('0x5e')]}});}return null;})[_0xee0c('0x1f')](handleEntityNotFound(_0x52e6d4,null))['then'](function(_0x5ed8bc){if(_0x5ed8bc){_0x80bf2e[_0xee0c('0x61')]=_0x5ed8bc['get']({'plain':!![]});interaction_log[_0xee0c('0x20')](_0xee0c('0x78'),_0x42e3bf[_0xee0c('0x63')]['id'],_0x42e3bf['user']['name'],_0x42e3bf[_0xee0c('0x63')][_0xee0c('0x64')],_0x80bf2e['interaction']['id'],_0x42e3bf[_0xee0c('0x51')]?JSON[_0xee0c('0x65')](_0x42e3bf[_0xee0c('0x51')]):_0xee0c('0x79'));return respondWithRpcPromise(_0xee0c('0x7a'),_0xee0c('0x7b'),_0x80bf2e);}return null;})[_0xee0c('0x1f')](function(_0x10c86d){var _0x38c131='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10c86d[_0xee0c('0x27')][_0xee0c('0x68')];return db[_0xee0c('0x69')]['query'](_0x38c131,{'type':db[_0xee0c('0x7c')]['QueryTypes'][_0xee0c('0x6b')],'raw':!![]})['then'](function(_0x2a07a3){return _0x2a07a3;});})[_0xee0c('0x1f')](function(_0x56b71e){if(_0x56b71e){_0x80bf2e[_0xee0c('0x27')][_0xee0c('0x6c')]=_0x56b71e[0x0];if(!_0x42e3bf[_0xee0c('0x51')]['UserId'])return;return db[_0xee0c('0x6d')][_0xee0c('0x52')]({'where':{'id':_0x42e3bf['body']['UserId'],'role':_0xee0c('0x5c')},'attributes':['id',_0xee0c('0x35'),_0xee0c('0x6e'),_0xee0c('0x7d'),_0xee0c('0x7e')],'raw':!![]});}return null;})[_0xee0c('0x1f')](function(_0x5c8b36){if(!_0x5c8b36)return null;_0x80bf2e[_0xee0c('0x27')][_0xee0c('0x5c')]=_0x5c8b36;return _0x80bf2e;})[_0xee0c('0x1f')](function(_0x1e3bd0){if(_0x1e3bd0){_0x1e3bd0[_0xee0c('0x27')]['interface']=util[_0xee0c('0x59')](_0xee0c('0x71'),_0x42e3bf['user'][_0xee0c('0x35')]);_0x1e3bd0['message'][_0xee0c('0x72')]=_0x80bf2e[_0xee0c('0x72')];_0x1e3bd0[_0xee0c('0x27')][_0xee0c('0x73')]=_0x80bf2e['channel'];_0x1e3bd0[_0xee0c('0x27')][_0xee0c('0x74')]='reject';respondWithRpcPromise('EventManager',_0xee0c('0x75'),{'event':'rejectmessage','message':_0x1e3bd0['message']},client9002);return _0x80bf2e;}return null;})[_0xee0c('0x1f')](respondWithResult(_0x52e6d4,null))['catch'](handleError(_0x52e6d4,null));};exports[_0xee0c('0x7f')]=function(_0x117cfb,_0x31d9b5){var _0x5da032;return db[_0xee0c('0x39')]['create'](_0x117cfb[_0xee0c('0x51')],{})[_0xee0c('0x1f')](function(_0x3f0fd8){_0x5da032=_0x3f0fd8;return db[_0xee0c('0x80')]['findOne']({'where':{'id':_0x5da032['ContactId']}});})['then'](function(_0x18a3ab){if(_['isNil'](_0x18a3ab)){return;}else{_0x5da032['fax']=_0x18a3ab[_0xee0c('0x56')];return db['Attachment'][_0xee0c('0x81')]({'where':{'id':_0x5da032[_0xee0c('0x82')]}});}})['then'](function(_0x3cf6e0){return respondWithRpcPromise(_0xee0c('0x83'),_0xee0c('0x83'),{'FaxAccountId':_[_0xee0c('0x5f')](_0x117cfb['body'])?undefined:_0x117cfb[_0xee0c('0x51')][_0xee0c('0x84')],'path':_['isNil'](_0x3cf6e0)?undefined:util[_0xee0c('0x59')](_0xee0c('0x85'),_0x3cf6e0['basename']),'fax':_[_0xee0c('0x5f')](_0x5da032[_0xee0c('0x56')])?undefined:_0x5da032[_0xee0c('0x56')],'AttachmentId':_0x5da032[_0xee0c('0x82')]},client9002);})[_0xee0c('0x1f')](respondWithResult(_0x31d9b5,0xc9))[_0xee0c('0x28')](handleError(_0x31d9b5,null));};exports[_0xee0c('0x86')]=function(_0x254e27,_0x5b0c36){var _0x253ba4=path[_0xee0c('0x87')](config[_0xee0c('0x88')],_0xee0c('0x89'),_0xee0c('0x8a'),_0xee0c('0x8b'));return db['FaxMessage'][_0xee0c('0x52')]({'where':{'id':_0x254e27[_0xee0c('0x4c')]['id']},'include':[{'model':db['Attachment'],'as':_0xee0c('0x8c')}]})[_0xee0c('0x1f')](handleEntityNotFound(_0x5b0c36,null))[_0xee0c('0x1f')](function(_0x32eccb){if(_0x32eccb){return _0x5b0c36['download'](path['join'](_0x253ba4,_0x32eccb[_0xee0c('0x8c')][_0xee0c('0x8d')]));}})[_0xee0c('0x28')](handleError(_0x5b0c36,null));}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3fba9b9..9990cb8 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 _0xaafc=['setMaxListeners','save','remove','emit','hook','exports','../../mysqldb','FaxMessage'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xaafc,0x176));var _0xcaaf=function(_0x53c853,_0xf9a2fc){_0x53c853=_0x53c853-0x0;var _0x513916=_0xaafc[_0x53c853];return _0x513916;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xcaaf('0x0'))['db'][_0xcaaf('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xcaaf('0x2')](0x0);var events={'afterCreate':_0xcaaf('0x3'),'afterUpdate':'update','afterDestroy':_0xcaaf('0x4')};function emitEvent(_0x28b0c5){return function(_0x4e9be3,_0x4a3b11,_0x38f094){FaxMessageEvents['emit'](_0x28b0c5+':'+_0x4e9be3['id'],_0x4e9be3);FaxMessageEvents[_0xcaaf('0x5')](_0x28b0c5,_0x4e9be3);_0x38f094(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xcaaf('0x6')](e,emitEvent(event));}}module[_0xcaaf('0x7')]=FaxMessageEvents; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ba7d784..9d7c0d7 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 _0x310c=['path','rimraf','define','FaxMessage','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x310c,0x138));var _0xc310=function(_0x46f9de,_0x5e6fec){_0x46f9de=_0x46f9de-0x0;var _0xea9e78=_0x310c[_0x46f9de];return _0xea9e78;};'use strict';var _=require(_0xc310('0x0'));var util=require(_0xc310('0x1'));var logger=require(_0xc310('0x2'))(_0xc310('0x3'));var moment=require(_0xc310('0x4'));var BPromise=require(_0xc310('0x5'));var rp=require(_0xc310('0x6'));var fs=require('fs');var path=require(_0xc310('0x7'));var rimraf=require(_0xc310('0x8'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x3e320a,_0x3ae9a0){return _0x3e320a[_0xc310('0x9')](_0xc310('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc310('0xb'),'fields':[_0xc310('0xc')],'type':_0xc310('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43e447,_0x2e4110,_0xe24928){var _0x3f60c3=_0x3e320a['models'];var _0x231832=_0x43e447[_0xc310('0xe')]({'plain':!![]});if(_0x231832['direction'][_0xc310('0xf')]()==='in'||_0x231832[_0xc310('0x10')][_0xc310('0xf')]()==='out'&&!_0x231832[_0xc310('0x11')]&&!_[_0xc310('0x12')](_0x231832[_0xc310('0x13')])){_0x3f60c3[_0xc310('0x14')][_0xc310('0x15')]({'where':{'id':_0x231832[_0xc310('0x16')]}})[_0xc310('0x17')](function(_0x18c09e){if(_0x18c09e){_0x18c09e[_0xc310('0x18')]({'lastMsgAt':_0x231832[_0xc310('0x19')],'lastMsgDirection':_0x231832[_0xc310('0x10')][_0xc310('0xf')]()});}})[_0xc310('0x1a')](function(_0x2159be){console[_0xc310('0x1b')](_0x2159be);});}_0xe24928();}},'charset':'utf8mb4','collate':_0xc310('0x1c')});}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a62ae13..2017f1f 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 _0xd2ea=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','FaxMessage','create','body','options','raw','CreateFaxMessage','stringify','catch','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c47e9,_0x231099){var _0x181f3e=function(_0x11d909){while(--_0x11d909){_0x2c47e9['push'](_0x2c47e9['shift']());}};_0x181f3e(++_0x231099);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1ce269,_0x20ec6e){_0x1ce269=_0x1ce269-0x0;var _0x3c66e0=_0xd2ea[_0x1ce269];return _0x3c66e0;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});config[_0xad2e('0xc')]=_[_0xad2e('0xd')](config[_0xad2e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0xe'))(new Redis(config[_0xad2e('0xc')]));require('./faxMessage.socket')[_0xad2e('0xf')](socket);function respondWithRpcPromise(_0x51f575,_0x430443,_0x415a41){return new BPromise(function(_0x9879f2,_0x24c5da){return client['request'](_0x51f575,_0x415a41)[_0xad2e('0x10')](function(_0x5707a5){logger[_0xad2e('0x11')](_0xad2e('0x12'),_0x430443,_0xad2e('0x13'));logger[_0xad2e('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x430443,_0xad2e('0x13'),JSON['stringify'](_0x5707a5));if(_0x5707a5[_0xad2e('0x15')]){if(_0x5707a5['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x430443,_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);return _0x24c5da(_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);}logger[_0xad2e('0x15')](_0xad2e('0x12'),_0x430443,_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);return _0x9879f2(_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);}else{logger[_0xad2e('0x11')](_0xad2e('0x12'),_0x430443,_0xad2e('0x13'));_0x9879f2(_0x5707a5[_0xad2e('0x17')][_0xad2e('0x16')]);}})['catch'](function(_0x245617){logger[_0xad2e('0x15')]('FaxMessage,\x20%s,\x20%s',_0x430443,_0x245617);_0x24c5da(_0x245617);});});}exports['CreateFaxMessage']=function(_0x48d8b5){var _0x4a4b2d=this;return new Promise(function(_0x18c38d,_0x293adc){return db[_0xad2e('0x18')][_0xad2e('0x19')](_0x48d8b5[_0xad2e('0x1a')],{'raw':_0x48d8b5[_0xad2e('0x1b')]?_0x48d8b5[_0xad2e('0x1b')][_0xad2e('0x1c')]===undefined?!![]:![]:!![]})[_0xad2e('0x10')](function(_0x154d54){logger[_0xad2e('0x11')](_0xad2e('0x1d'),_0x48d8b5);logger[_0xad2e('0x14')](_0xad2e('0x1d'),_0x48d8b5,JSON[_0xad2e('0x1e')](_0x154d54));_0x18c38d(_0x154d54);})[_0xad2e('0x1f')](function(_0x59630b){logger[_0xad2e('0x15')](_0xad2e('0x1d'),_0x59630b[_0xad2e('0x16')],_0x48d8b5);_0x293adc(_0x4a4b2d[_0xad2e('0x15')](0x1f4,_0x59630b[_0xad2e('0x16')]));});});};exports[_0xad2e('0x20')]=function(_0x1161d5){var _0x175055=this;return new Promise(function(_0xfd90a4,_0x50d446){return db[_0xad2e('0x18')]['update'](_0x1161d5[_0xad2e('0x1a')],{'raw':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x21')]||null:null,'attributes':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x22')]||null:null,'limit':_0x1161d5['options']?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x23')]||null:null})[_0xad2e('0x10')](function(_0x4379f4){logger[_0xad2e('0x11')](_0xad2e('0x20'),_0x1161d5);logger[_0xad2e('0x14')](_0xad2e('0x20'),_0x1161d5,JSON[_0xad2e('0x1e')](_0x4379f4));_0xfd90a4(_0x4379f4);})[_0xad2e('0x1f')](function(_0xcc4c66){logger['error'](_0xad2e('0x20'),_0xcc4c66['message'],_0x1161d5);_0x50d446(_0x175055[_0xad2e('0x15')](0x1f4,_0xcc4c66[_0xad2e('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3fb42d3..da3eb33 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 _0x45da=['remove','update','length','./faxMessage.events'];(function(_0x4631eb,_0x55649e){var _0x562eca=function(_0x25a436){while(--_0x25a436){_0x4631eb['push'](_0x4631eb['shift']());}};_0x562eca(++_0x55649e);}(_0x45da,0x157));var _0xa45d=function(_0x59990a,_0x3939d0){_0x59990a=_0x59990a-0x0;var _0x37d7ac=_0x45da[_0x59990a];return _0x37d7ac;};'use strict';var FaxMessageEvents=require(_0xa45d('0x0'));var events=['save',_0xa45d('0x1'),_0xa45d('0x2')];function createListener(_0x45d36d,_0x53b56c){return function(_0x118bb6){_0x53b56c['emit'](_0x45d36d,_0x118bb6);};}function removeListener(_0x41bdeb,_0x10f7f7){return function(){FaxMessageEvents['removeListener'](_0x41bdeb,_0x10f7f7);};}exports['register']=function(_0x53fca3){for(var _0x479eb1=0x0,_0x480458=events[_0xa45d('0x3')];_0x479eb1<_0x480458;_0x479eb1++){var _0x18cd40=events[_0x479eb1];var _0xc8f29b=createListener('faxMessage:'+_0x18cd40,_0x53fca3);FaxMessageEvents['on'](_0x18cd40,_0xc8f29b);}}; \ No newline at end of file +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 diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 746de0f..e4b6db0 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 _0xfe57=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','show','download','faxmessage:create','create','put','/:id','update','/:id/reject','reject','destroy','exports','multer','util','express'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xfe57,0x195));var _0x7fe5=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xfe57[_0x548200];return _0x1a6d74;};'use strict';var multer=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fe5('0x2'));var router=express[_0x7fe5('0x3')]();var fs_extra=require(_0x7fe5('0x4'));var auth=require(_0x7fe5('0x5'));var interaction=require(_0x7fe5('0x6'));var config=require(_0x7fe5('0x7'));var controller=require(_0x7fe5('0x8'));router[_0x7fe5('0x9')]('/',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xb')]);router[_0x7fe5('0x9')](_0x7fe5('0xc'),auth[_0x7fe5('0xa')](),controller['describe']);router[_0x7fe5('0x9')]('/:id',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xd')]);router['get']('/:id/download',auth[_0x7fe5('0xa')](),controller[_0x7fe5('0xe')]);router['post']('/',auth[_0x7fe5('0xa')](),interaction['tracked']('fax',_0x7fe5('0xf')),controller[_0x7fe5('0x10')]);router[_0x7fe5('0x11')](_0x7fe5('0x12'),auth['isAuthenticated'](),controller[_0x7fe5('0x13')]);router[_0x7fe5('0x11')]('/:id/accept',auth[_0x7fe5('0xa')](),controller['accept']);router[_0x7fe5('0x11')](_0x7fe5('0x14'),auth['isAuthenticated'](),controller[_0x7fe5('0x15')]);router['delete'](_0x7fe5('0x12'),auth[_0x7fe5('0xa')](),controller[_0x7fe5('0x16')]);module[_0x7fe5('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3346acb..0cf7d9a 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 _0x9e7b=['STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0xe7071,_0x3ef03f){var _0x4f6ecb=function(_0x20dc1c){while(--_0x20dc1c){_0xe7071['push'](_0xe7071['shift']());}};_0x4f6ecb(++_0x3ef03f);}(_0x9e7b,0xed));var _0xb9e7=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9e7b[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0xb9e7('0x0'));module[_0xb9e7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb9e7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb9e7('0x3')]},'timeout':{'type':Sequelize[_0xb9e7('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb9e7('0x5'),_0xb9e7('0x6'),_0xb9e7('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb9e7('0x4')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 043265e..13f9794 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 _0xf61e=['all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','stack','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','filters','intersection','model','attributes','fields','length','includeAll','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','findOne','keys','UserFaxQueue','order','sort','filter','options','User','findAndCountAll','UserId','agent','faxPause','rows','format','%s/%s','SIP','createdAt','Team','pick','getTeams','hasOwnProperty','nolimit','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId'];(function(_0x5c4443,_0x44bbf8){var _0x3e9531=function(_0x9af25f){while(--_0x9af25f){_0x5c4443['push'](_0x5c4443['shift']());}};_0x3e9531(++_0x44bbf8);}(_0xf61e,0x191));var _0xef61=function(_0x35d59a,_0x5daaeb){_0x35d59a=_0x35d59a-0x0;var _0x5dbd31=_0xf61e[_0x35d59a];return _0x5dbd31;};'use strict';var BPromise=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var _=require(_0xef61('0x2'));var squel=require(_0xef61('0x3'));var Redis=require(_0xef61('0x4'));var qs=require(_0xef61('0x5'));var logger=require(_0xef61('0x6'))(_0xef61('0x7'));var config=require(_0xef61('0x8'));var db=require(_0xef61('0x9'))['db'];config[_0xef61('0xa')]=_[_0xef61('0xb')](config['redis'],{'host':_0xef61('0xc'),'port':0x18eb});var socket=require(_0xef61('0xd'))(new Redis(config['redis']));require(_0xef61('0xe'))[_0xef61('0xf')](socket);function respondWithStatusCode(_0x106e7f,_0x4dba00){_0x4dba00=_0x4dba00||0xcc;return function(_0x47d0a7){if(_0x47d0a7){return _0x106e7f[_0xef61('0x10')](_0x4dba00);}return _0x106e7f[_0xef61('0x11')](_0x4dba00)[_0xef61('0x12')]();};}function respondWithResult(_0x11181b,_0x2af74c){_0x2af74c=_0x2af74c||0xc8;return function(_0xdcd707){if(_0xdcd707){return _0x11181b[_0xef61('0x11')](_0x2af74c)[_0xef61('0x13')](_0xdcd707);}};}function respondWithFilteredResult(_0x237f43,_0x66e7b2){return function(_0x28d4f7){if(_0x28d4f7){var _0x2f203c=typeof _0x66e7b2[_0xef61('0x14')]===_0xef61('0x15')&&typeof _0x66e7b2['limit']===_0xef61('0x15');var _0x58d9a0=_0x28d4f7[_0xef61('0x16')];var _0x1db2a9=_0x2f203c?0x0:_0x66e7b2[_0xef61('0x14')];var _0x76ef9b=_0x2f203c?_0x28d4f7['count']:_0x66e7b2[_0xef61('0x14')]+_0x66e7b2[_0xef61('0x17')];var _0x1224c2;if(_0x76ef9b>=_0x58d9a0){_0x76ef9b=_0x58d9a0;_0x1224c2=0xc8;}else{_0x1224c2=0xce;}_0x237f43[_0xef61('0x11')](_0x1224c2);return _0x237f43['set'](_0xef61('0x18'),_0x1db2a9+'-'+_0x76ef9b+'/'+_0x58d9a0)[_0xef61('0x13')](_0x28d4f7);}return null;};}function saveUpdates(_0x4f7a62){return function(_0x8b2810){if(_0x8b2810){return _0x8b2810[_0xef61('0x19')](_0x4f7a62)[_0xef61('0x1a')](function(_0x22dc1b){return _0x22dc1b;});}return null;};}function removeEntity(_0xfc36d6){return function(_0x28315a){if(_0x28315a){return _0x28315a[_0xef61('0x1b')]()['then'](function(){var _0x39443d=_0x28315a[_0xef61('0x1c')]({'plain':!![]});var _0x4a3af6=_0xef61('0x1d');return db[_0xef61('0x1e')][_0xef61('0x1b')]({'where':{'type':_0x4a3af6,'resourceId':_0x39443d['id']}})[_0xef61('0x1a')](function(){return _0x28315a;});})[_0xef61('0x1a')](function(){_0xfc36d6[_0xef61('0x11')](0xcc)[_0xef61('0x12')]();});}};}function handleEntityNotFound(_0x51f9ca){return function(_0x536e9e){if(!_0x536e9e){_0x51f9ca[_0xef61('0x10')](0x194);}return _0x536e9e;};}function handleError(_0x58bd7d,_0x389d6d){_0x389d6d=_0x389d6d||0x1f4;return function(_0x5ae7a2){logger['error'](_0x5ae7a2[_0xef61('0x1f')]);if(_0x5ae7a2['name']){delete _0x5ae7a2['name'];}_0x58bd7d[_0xef61('0x11')](_0x389d6d)[_0xef61('0x20')](_0x5ae7a2);};}exports[_0xef61('0x21')]=function(_0x111bac,_0x5e56da){var _0x16b144={};var _0x4e738f={'count':0x0,'rows':[]};var _0x2a6832=_[_0xef61('0x22')](db[_0xef61('0x23')][_0xef61('0x24')],function(_0x2155f1){return{'name':_0x2155f1[_0xef61('0x25')],'type':_0x2155f1[_0xef61('0x26')][_0xef61('0x27')]};});_0x16b144=qs[_0xef61('0x28')](_0x2a6832,_0x111bac);var _0x1ee27b={'where':_0x16b144[_0xef61('0x29')]};return db[_0xef61('0x23')][_0xef61('0x16')](_0x1ee27b)[_0xef61('0x1a')](function(_0x1f3572){_0x4e738f[_0xef61('0x16')]=_0x1f3572;_0x16b144[_0xef61('0x2a')]=qs[_0xef61('0x2a')](_0x111bac[_0xef61('0x2b')]);return db[_0xef61('0x23')][_0xef61('0x2c')](_0x16b144);})[_0xef61('0x1a')](function(_0x4f35ad){_0x4e738f['rows']=_0x4f35ad;return _0x4e738f;})[_0xef61('0x1a')](respondWithFilteredResult(_0x5e56da,_0x16b144))[_0xef61('0x2d')](handleError(_0x5e56da,null));};exports[_0xef61('0x2e')]=function(_0x554ef4,_0x2bd5b3){var _0x21d6f0={'raw':!![],'where':{'id':_0x554ef4[_0xef61('0x2f')]['id']}},_0x4eceec={};_0x4eceec['model']=_['keys'](db[_0xef61('0x23')]['rawAttributes']);_0x4eceec[_0xef61('0x2b')]=_['keys'](_0x554ef4[_0xef61('0x2b')]);_0x4eceec[_0xef61('0x30')]=_[_0xef61('0x31')](_0x4eceec[_0xef61('0x32')],_0x4eceec[_0xef61('0x2b')]);_0x21d6f0[_0xef61('0x33')]=_[_0xef61('0x31')](_0x4eceec[_0xef61('0x32')],qs[_0xef61('0x34')](_0x554ef4[_0xef61('0x2b')]['fields']));_0x21d6f0[_0xef61('0x33')]=_0x21d6f0[_0xef61('0x33')][_0xef61('0x35')]?_0x21d6f0[_0xef61('0x33')]:_0x4eceec[_0xef61('0x32')];if(_0x554ef4['query'][_0xef61('0x36')]){_0x21d6f0[_0xef61('0x2a')]=[{'all':!![]}];}_0x21d6f0=_[_0xef61('0x37')]({},_0x21d6f0,_0x554ef4['options']);return db['FaxQueue']['find'](_0x21d6f0)[_0xef61('0x1a')](handleEntityNotFound(_0x2bd5b3,null))['then'](respondWithResult(_0x2bd5b3,null))['catch'](handleError(_0x2bd5b3,null));};exports['create']=function(_0x3ee764,_0x294063){return db[_0xef61('0x23')]['create'](_0x3ee764['body'],{})['then'](function(_0x23a59b){var _0x32ad44=_0x3ee764['user'][_0xef61('0x1c')]({'plain':!![]});if(!_0x32ad44)throw new Error(_0xef61('0x38'));if(_0x32ad44[_0xef61('0x39')]===_0xef61('0x3a')){var _0x49e7c4=_0x23a59b[_0xef61('0x1c')]({'plain':!![]});var _0x184063=_0xef61('0x1d');return db[_0xef61('0x3b')]['find']({'where':{'name':_0x184063,'userProfileId':_0x32ad44['userProfileId']},'raw':!![]})[_0xef61('0x1a')](function(_0x462972){if(_0x462972&&_0x462972[_0xef61('0x3c')]===0x0){return db['UserProfileResource'][_0xef61('0x3d')]({'name':_0x49e7c4[_0xef61('0x3e')],'resourceId':_0x49e7c4['id'],'type':_0x462972[_0xef61('0x3e')],'sectionId':_0x462972['id']},{})[_0xef61('0x1a')](function(){return _0x23a59b;});}else{return _0x23a59b;}})['catch'](function(_0x545597){logger['error'](_0xef61('0x3f'),_0x545597);throw _0x545597;});}return _0x23a59b;})[_0xef61('0x1a')](respondWithResult(_0x294063,0xc9))[_0xef61('0x2d')](handleError(_0x294063,null));};exports[_0xef61('0x19')]=function(_0x3f81a1,_0x272143){if(_0x3f81a1[_0xef61('0x40')]['id']){delete _0x3f81a1['body']['id'];}return db[_0xef61('0x23')][_0xef61('0x41')]({'where':{'id':_0x3f81a1[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0x272143,null))['then'](saveUpdates(_0x3f81a1[_0xef61('0x40')],null))[_0xef61('0x1a')](respondWithResult(_0x272143,null))[_0xef61('0x2d')](handleError(_0x272143,null));};exports[_0xef61('0x1b')]=function(_0xa0e92b,_0x7837ba){return db['FaxQueue'][_0xef61('0x41')]({'where':{'id':_0xa0e92b[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0x7837ba,null))['then'](removeEntity(_0x7837ba,null))[_0xef61('0x2d')](handleError(_0x7837ba,null));};exports[_0xef61('0x42')]=function(_0x14862d,_0x408e7c){return db[_0xef61('0x23')][_0xef61('0x42')]()['then'](respondWithResult(_0x408e7c,null))[_0xef61('0x2d')](handleError(_0x408e7c,null));};exports[_0xef61('0x43')]=function(_0x5c6ab1,_0xdb0ee8){var _0x37da22={'raw':!![],'where':{}},_0x183ddd={},_0x3dbd56;return db['FaxQueue'][_0xef61('0x44')]({'where':{'id':_0x5c6ab1[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0xdb0ee8,null))['then'](function(_0x3ed63f){if(_0x3ed63f){_0x3dbd56=_0x3ed63f[_0xef61('0x1c')]({'plain':!![]});_0x183ddd['model']=_[_0xef61('0x45')](db[_0xef61('0x46')][_0xef61('0x24')]);_0x183ddd[_0xef61('0x2b')]=_[_0xef61('0x45')](_0x5c6ab1[_0xef61('0x2b')]);_0x183ddd[_0xef61('0x30')]=_['intersection'](_0x183ddd[_0xef61('0x32')],_0x183ddd['query']);_0x37da22[_0xef61('0x33')]=_[_0xef61('0x31')](_0x183ddd[_0xef61('0x32')],qs[_0xef61('0x34')](_0x5c6ab1[_0xef61('0x2b')][_0xef61('0x34')]));_0x37da22[_0xef61('0x33')]=_0x37da22[_0xef61('0x33')][_0xef61('0x35')]?_0x37da22['attributes']:_0x183ddd[_0xef61('0x32')];if(!_0x5c6ab1[_0xef61('0x2b')]['hasOwnProperty']('nolimit')){_0x37da22[_0xef61('0x17')]=qs[_0xef61('0x17')](_0x5c6ab1['query'][_0xef61('0x17')]);_0x37da22['offset']=qs[_0xef61('0x14')](_0x5c6ab1[_0xef61('0x2b')][_0xef61('0x14')]);}_0x37da22[_0xef61('0x47')]=qs[_0xef61('0x48')](_0x5c6ab1[_0xef61('0x2b')]['sort']);_0x37da22[_0xef61('0x29')]=qs[_0xef61('0x30')](_['pick'](_0x5c6ab1[_0xef61('0x2b')],_0x183ddd[_0xef61('0x30')]));_0x37da22['where']['FaxQueueId']=_0x3ed63f['id'];if(_0x5c6ab1[_0xef61('0x2b')]['filter']){_0x37da22['where']=_['merge'](_0x37da22[_0xef61('0x29')],{'$or':_[_0xef61('0x22')](_0x37da22['attributes'],function(_0xe37eda){var _0x1928a5={};_0x1928a5[_0xe37eda]={'$like':'%'+_0x5c6ab1[_0xef61('0x2b')][_0xef61('0x49')]+'%'};return _0x1928a5;})});}_0x37da22=_[_0xef61('0x37')]({},_0x37da22,_0x5c6ab1[_0xef61('0x4a')]);return db[_0xef61('0x46')][_0xef61('0x2c')](_0x37da22);}})['then'](function(_0x53062c){if(_0x53062c){return db[_0xef61('0x4b')][_0xef61('0x4c')]({'where':{'id':_[_0xef61('0x22')](_0x53062c,_0xef61('0x4d')),'role':_0xef61('0x4e')},'attributes':['id','name',_0xef61('0x4f'),'updatedAt','createdAt']});}})[_0xef61('0x1a')](function(_0x310206){if(_0x310206){return{'count':_0x310206[_0xef61('0x16')],'rows':_['map'](_0x310206[_0xef61('0x50')],function(_0x1a8f8f){return{'membername':_0x1a8f8f[_0xef61('0x3e')],'UserId':_0x1a8f8f['id'],'queue_name':_0x3dbd56[_0xef61('0x3e')],'FaxQueueId':_0x3dbd56['id'],'interface':util[_0xef61('0x51')](_0xef61('0x52'),_0xef61('0x53'),_0x1a8f8f[_0xef61('0x3e')]),'penalty':0x0,'paused':_0x1a8f8f[_0xef61('0x4f')],'createdAt':_0x1a8f8f[_0xef61('0x54')],'updatedAt':_0x1a8f8f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xef61('0x1a')](respondWithFilteredResult(_0xdb0ee8,_0x37da22))['catch'](handleError(_0xdb0ee8,null));};exports['getTeams']=function(_0x4386a7,_0x458e00){var _0x394ff2={};var _0x294dee={};var _0xc987bc;var _0x2a65a0;return db['FaxQueue']['findOne']({'where':{'id':_0x4386a7[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0x458e00,null))[_0xef61('0x1a')](function(_0x219714){if(_0x219714){_0xc987bc=_0x219714;_0x294dee[_0xef61('0x32')]=_[_0xef61('0x45')](db[_0xef61('0x55')][_0xef61('0x24')]);_0x294dee[_0xef61('0x2b')]=_[_0xef61('0x45')](_0x4386a7[_0xef61('0x2b')]);_0x294dee['filters']=_[_0xef61('0x31')](_0x294dee[_0xef61('0x32')],_0x294dee['query']);_0x394ff2[_0xef61('0x33')]=_[_0xef61('0x31')](_0x294dee[_0xef61('0x32')],qs[_0xef61('0x34')](_0x4386a7[_0xef61('0x2b')][_0xef61('0x34')]));_0x394ff2[_0xef61('0x33')]=_0x394ff2[_0xef61('0x33')]['length']?_0x394ff2[_0xef61('0x33')]:_0x294dee['model'];_0x394ff2['order']=qs['sort'](_0x4386a7[_0xef61('0x2b')][_0xef61('0x48')]);_0x394ff2[_0xef61('0x29')]=qs['filters'](_[_0xef61('0x56')](_0x4386a7[_0xef61('0x2b')],_0x294dee[_0xef61('0x30')]));if(_0x4386a7[_0xef61('0x2b')][_0xef61('0x49')]){_0x394ff2[_0xef61('0x29')]=_[_0xef61('0x37')](_0x394ff2[_0xef61('0x29')],{'$or':_[_0xef61('0x22')](_0x394ff2[_0xef61('0x33')],function(_0x128a95){var _0x476c51={};_0x476c51[_0x128a95]={'$like':'%'+_0x4386a7[_0xef61('0x2b')][_0xef61('0x49')]+'%'};return _0x476c51;})});}_0x394ff2=_[_0xef61('0x37')]({},_0x394ff2,_0x4386a7[_0xef61('0x4a')]);return _0xc987bc[_0xef61('0x57')](_0x394ff2);}})[_0xef61('0x1a')](function(_0x529a78){if(_0x529a78){_0x2a65a0=_0x529a78[_0xef61('0x35')];if(!_0x4386a7[_0xef61('0x2b')][_0xef61('0x58')](_0xef61('0x59'))){_0x394ff2[_0xef61('0x17')]=qs[_0xef61('0x17')](_0x4386a7['query'][_0xef61('0x17')]);_0x394ff2[_0xef61('0x14')]=qs['offset'](_0x4386a7[_0xef61('0x2b')]['offset']);}return _0xc987bc[_0xef61('0x57')](_0x394ff2);}})[_0xef61('0x1a')](function(_0x5c4000){if(_0x5c4000){return _0x5c4000?{'count':_0x2a65a0,'rows':_0x5c4000}:null;}})[_0xef61('0x1a')](respondWithResult(_0x458e00,null))['catch'](handleError(_0x458e00,null));};exports[_0xef61('0x5a')]=function(_0x3f9882,_0x4c880e){var _0x59065a=_0x3f9882[_0xef61('0x40')][_0xef61('0x5b')];return db[_0xef61('0x55')][_0xef61('0x2c')]({'where':{'id':_0x59065a},'attributes':['id'],'include':[{'model':db[_0xef61('0x4b')],'as':'Agents','attributes':['id',_0xef61('0x3e'),_0xef61('0x5c'),_0xef61('0x5d'),_0xef61('0x5e')],'raw':!![]}]})[_0xef61('0x1a')](function(_0x1aa9c3){if(_0x1aa9c3){var _0x5e94f1=_[_0xef61('0x5f')](_0x1aa9c3,function(_0x5c6004){var _0x18ed35=_0x5c6004[_0xef61('0x1c')]({'plain':!![]});return _0x18ed35[_0xef61('0x60')];});return db[_0xef61('0x23')][_0xef61('0x41')]({'where':{'id':_0x3f9882[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](function(_0x273d5c){return db[_0xef61('0x61')][_0xef61('0x62')](function(_0x383409){return _0x273d5c[_0xef61('0x5a')](_0x59065a,{'transaction':_0x383409})[_0xef61('0x1a')](function(){return BPromise['each'](_0x5e94f1,function(_0x3f4ff8){return db[_0xef61('0x46')][_0xef61('0x63')]({'where':{'UserId':_0x3f4ff8['id'],'FaxQueueId':_0x3f9882[_0xef61('0x2f')]['id']},'transaction':_0x383409});});})['then'](function(){_0x5e94f1[_0xef61('0x64')](function(_0x57ba16){socket['emit'](_0xef61('0x65'),{'UserId':_0x57ba16['id'],'FaxQueueId':_0x273d5c['id']});});});});});}})['then'](respondWithStatusCode(_0x4c880e,null))[_0xef61('0x2d')](handleError(_0x4c880e,null));};exports['removeTeams']=function(_0x5a9478,_0xab59f1){return db[_0xef61('0x55')]['findAll']({'where':{'id':_0x5a9478[_0xef61('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xef61('0x4b')],'as':_0xef61('0x60'),'attributes':['id'],'raw':!![]}]})[_0xef61('0x1a')](handleEntityNotFound(_0xab59f1,null))[_0xef61('0x1a')](function(_0x531587){var _0x1488c0=_['map'](_0x531587,'id');var _0x2e91b2=[];var _0x2ddf83=[];var _0x1929aa=squel[_0xef61('0x66')]();_0x1929aa[_0xef61('0x67')](_0xef61('0x68'))[_0xef61('0x69')](_0xef61('0x6a'),'tq')[_0xef61('0x6b')]('user_has_teams','ut',_0xef61('0x6c'))['where'](_0xef61('0x6d'),_0x5a9478[_0xef61('0x2f')]['id']);for(var _0x5db4a0=0x0;_0x5db4a0<_0x531587[_0xef61('0x35')];_0x5db4a0+=0x1){let _0x5b86e4=_0x531587[_0x5db4a0];for(var _0x52f7c5=0x0;_0x52f7c5<_0x5b86e4[_0xef61('0x60')][_0xef61('0x35')];_0x52f7c5+=0x1){let _0x4cdabf=_0x5b86e4[_0xef61('0x60')][_0x52f7c5];var _0x34e4cb=_0x1929aa['clone']();_0x34e4cb[_0xef61('0x29')](_0xef61('0x6e'),_0x4cdabf['id']);_0x2ddf83['push'](db[_0xef61('0x61')]['query'](_0x34e4cb[_0xef61('0x6f')](),{'type':db[_0xef61('0x61')][_0xef61('0x70')][_0xef61('0x71')]})['then'](function(_0x36318a){if(_0x36318a[_0xef61('0x35')]===0x1){return _0x4cdabf['id'];}else{var _0x113bf2=_['every'](_[_0xef61('0x22')](_0x36318a,_0xef61('0x72')),function(_0x5a4338){return _['includes'](_0x1488c0,_0x5a4338);});if(_0x113bf2){return _0x4cdabf['id'];}}}));}}return BPromise[_0xef61('0x73')](_0x2ddf83)[_0xef61('0x1a')](function(_0x30887a){_0x2e91b2=_(_0x2e91b2)[_0xef61('0x74')](_0x30887a)[_0xef61('0x75')]()[_0xef61('0x76')]();return db[_0xef61('0x23')][_0xef61('0x41')]({'where':{'id':_0x5a9478[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](function(_0x17f16a){return db[_0xef61('0x61')][_0xef61('0x62')](function(_0x2ef818){return _0x17f16a[_0xef61('0x77')](_0x5a9478[_0xef61('0x2b')]['ids'],{'transaction':_0x2ef818})[_0xef61('0x1a')](function(){if(!_[_0xef61('0x78')](_0x2e91b2)){return _0x17f16a[_0xef61('0x79')](_0x2e91b2,{'transaction':_0x2ef818});}})[_0xef61('0x1a')](function(){_0x2e91b2[_0xef61('0x64')](function(_0x2a13b0){socket[_0xef61('0x7a')](_0xef61('0x7b'),{'UserId':_0x2a13b0,'FaxQueueId':_0x17f16a['id']});});});});});});})[_0xef61('0x1a')](respondWithStatusCode(_0xab59f1,null))[_0xef61('0x2d')](handleError(_0xab59f1,null));};exports[_0xef61('0x7c')]=function(_0x2ebe38,_0x4e8a39){return db[_0xef61('0x23')][_0xef61('0x41')]({'where':{'id':_0x2ebe38['params']['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0x4e8a39,null))[_0xef61('0x1a')](function(_0x4629bf){if(_0x4629bf){return _0x4629bf[_0xef61('0x7c')](_0x2ebe38[_0xef61('0x40')]['ids'],_[_0xef61('0x7d')](_0x2ebe38['body'],[_0xef61('0x5b'),'id'])||{})[_0xef61('0x7e')](function(_0x297a8a){for(var _0x19b1a0=0x0;_0x19b1a0<_0x2ebe38[_0xef61('0x40')][_0xef61('0x5b')][_0xef61('0x35')];_0x19b1a0+=0x1){socket[_0xef61('0x7a')]('userFaxQueue:save',{'UserId':Number(_0x2ebe38[_0xef61('0x40')][_0xef61('0x5b')][_0x19b1a0]),'FaxQueueId':Number(_0x2ebe38[_0xef61('0x2f')]['id'])});}return _0x297a8a;});}})[_0xef61('0x1a')](respondWithResult(_0x4e8a39,null))[_0xef61('0x2d')](handleError(_0x4e8a39,null));};exports[_0xef61('0x79')]=function(_0x411b1b,_0x2c8155){return db[_0xef61('0x23')]['find']({'where':{'id':_0x411b1b[_0xef61('0x2f')]['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0x2c8155,null))[_0xef61('0x1a')](function(_0x317c4a){if(_0x317c4a){return _0x317c4a['removeAgents'](_0x411b1b['query'][_0xef61('0x5b')])[_0xef61('0x1a')](function(){if(_[_0xef61('0x7f')](_0x411b1b[_0xef61('0x2b')][_0xef61('0x5b')])){for(var _0x4680a6=0x0;_0x4680a6<_0x411b1b[_0xef61('0x2b')]['ids'][_0xef61('0x35')];_0x4680a6+=0x1){socket[_0xef61('0x7a')](_0xef61('0x7b'),{'UserId':Number(_0x411b1b[_0xef61('0x2b')][_0xef61('0x5b')][_0x4680a6]),'FaxQueueId':Number(_0x411b1b['params']['id'])});}}else{socket[_0xef61('0x7a')]('userFaxQueue:remove',{'UserId':Number(_0x411b1b[_0xef61('0x2b')][_0xef61('0x5b')]),'FaxQueueId':Number(_0x411b1b[_0xef61('0x2f')]['id'])});}});}})[_0xef61('0x1a')](respondWithStatusCode(_0x2c8155,null))[_0xef61('0x2d')](handleError(_0x2c8155,null));};exports[_0xef61('0x80')]=function(_0x4fb8be,_0x2387b1){var _0x10e5f0={};var _0xc67b1b={};var _0x3f8c6d;var _0x3b4645;return db[_0xef61('0x23')][_0xef61('0x44')]({'where':{'id':_0x4fb8be['params']['id']}})[_0xef61('0x1a')](handleEntityNotFound(_0x2387b1,null))[_0xef61('0x1a')](function(_0x86913){if(_0x86913){_0x3f8c6d=_0x86913;_0xc67b1b['model']=_['keys'](db[_0xef61('0x4b')][_0xef61('0x24')]);_0xc67b1b['query']=_[_0xef61('0x45')](_0x4fb8be[_0xef61('0x2b')]);_0xc67b1b[_0xef61('0x30')]=_[_0xef61('0x31')](_0xc67b1b[_0xef61('0x32')],_0xc67b1b[_0xef61('0x2b')]);_0x10e5f0[_0xef61('0x33')]=_[_0xef61('0x31')](_0xc67b1b['model'],qs[_0xef61('0x34')](_0x4fb8be[_0xef61('0x2b')][_0xef61('0x34')]));_0x10e5f0[_0xef61('0x33')]=_0x10e5f0[_0xef61('0x33')]['length']?_0x10e5f0[_0xef61('0x33')]:_0xc67b1b['model'];_0x10e5f0[_0xef61('0x47')]=qs[_0xef61('0x48')](_0x4fb8be[_0xef61('0x2b')]['sort']);_0x10e5f0['where']=qs[_0xef61('0x30')](_[_0xef61('0x56')](_0x4fb8be['query'],_0xc67b1b['filters']));if(_0x4fb8be[_0xef61('0x2b')][_0xef61('0x49')]){_0x10e5f0[_0xef61('0x29')]=_[_0xef61('0x37')](_0x10e5f0[_0xef61('0x29')],{'$or':_[_0xef61('0x22')](_0x10e5f0[_0xef61('0x33')],function(_0x35c0bd){var _0x102fe5={};_0x102fe5[_0x35c0bd]={'$like':'%'+_0x4fb8be[_0xef61('0x2b')][_0xef61('0x49')]+'%'};return _0x102fe5;})});}_0x10e5f0=_['merge']({},_0x10e5f0,_0x4fb8be[_0xef61('0x4a')]);return _0x3f8c6d[_0xef61('0x80')](_0x10e5f0);}})['then'](function(_0x477368){if(_0x477368){_0x3b4645=_0x477368[_0xef61('0x35')];if(!_0x4fb8be[_0xef61('0x2b')][_0xef61('0x58')](_0xef61('0x59'))){_0x10e5f0[_0xef61('0x17')]=qs['limit'](_0x4fb8be[_0xef61('0x2b')][_0xef61('0x17')]);_0x10e5f0[_0xef61('0x14')]=qs[_0xef61('0x14')](_0x4fb8be[_0xef61('0x2b')][_0xef61('0x14')]);}return _0x3f8c6d['getAgents'](_0x10e5f0);}})['then'](function(_0x2df73f){if(_0x2df73f){return _0x2df73f?{'count':_0x3b4645,'rows':_0x2df73f}:null;}})[_0xef61('0x1a')](respondWithResult(_0x2387b1,null))[_0xef61('0x2d')](handleError(_0x2387b1,null));}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9a61c01..afcc3b3 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 _0x1bcf=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1bcf,0x1f4));var _0xf1bc=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x1bcf[_0x358806];return _0x19fdcb;};'use strict';var EventEmitter=require(_0xf1bc('0x0'));var FaxQueue=require(_0xf1bc('0x1'))['db'][_0xf1bc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf1bc('0x3')](0x0);var events={'afterCreate':_0xf1bc('0x4'),'afterUpdate':_0xf1bc('0x5'),'afterDestroy':_0xf1bc('0x6')};function emitEvent(_0x476479){return function(_0xc215df,_0x1ff3cd,_0x15ef32){FaxQueueEvents[_0xf1bc('0x7')](_0x476479+':'+_0xc215df['id'],_0xc215df);FaxQueueEvents['emit'](_0x476479,_0xc215df);_0x15ef32(null);};}for(var e in events){if(events[_0xf1bc('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xf1bc('0x9')]=FaxQueueEvents; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3b1d219..5a96346 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 _0x96e5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','fax_queues','lodash','api'];(function(_0x42572b,_0x259433){var _0x4d50b3=function(_0x17a250){while(--_0x17a250){_0x42572b['push'](_0x42572b['shift']());}};_0x4d50b3(++_0x259433);}(_0x96e5,0x8d));var _0x596e=function(_0xb5bc50,_0x470bfd){_0xb5bc50=_0xb5bc50-0x0;var _0x5e8aa5=_0x96e5[_0xb5bc50];return _0x5e8aa5;};'use strict';var _=require(_0x596e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x596e('0x1'));var moment=require(_0x596e('0x2'));var BPromise=require(_0x596e('0x3'));var rp=require(_0x596e('0x4'));var fs=require('fs');var path=require(_0x596e('0x5'));var rimraf=require(_0x596e('0x6'));var config=require(_0x596e('0x7'));var attributes=require('./faxQueue.attributes');module[_0x596e('0x8')]=function(_0x2874bf,_0x487790){return _0x2874bf[_0x596e('0x9')]('FaxQueue',attributes,{'tableName':_0x596e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index b083d84..97689be 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 _0x146a=['request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetFaxQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','find','where','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x146a,0x1c2));var _0xa146=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x146a[_0x4d3a2b];return _0xdd32c8;};'use strict';var _=require(_0xa146('0x0'));var util=require('util');var moment=require(_0xa146('0x1'));var BPromise=require(_0xa146('0x2'));var rs=require(_0xa146('0x3'));var fs=require('fs');var Redis=require(_0xa146('0x4'));var db=require(_0xa146('0x5'))['db'];var utils=require(_0xa146('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa146('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa146('0x8')][_0xa146('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa146('0xa')],{'host':_0xa146('0xb'),'port':0x18eb});var socket=require(_0xa146('0xc'))(new Redis(config[_0xa146('0xa')]));require('./faxQueue.socket')[_0xa146('0xd')](socket);function respondWithRpcPromise(_0xb12eda,_0x2619e4,_0x4168fd){return new BPromise(function(_0x3ec814,_0x175cfb){return client[_0xa146('0xe')](_0xb12eda,_0x4168fd)[_0xa146('0xf')](function(_0x176d54){logger[_0xa146('0x10')](_0xa146('0x11'),_0x2619e4,_0xa146('0x12'));logger['debug'](_0xa146('0x13'),_0x2619e4,_0xa146('0x12'),JSON['stringify'](_0x176d54));if(_0x176d54['error']){if(_0x176d54['error']['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x2619e4,_0x176d54[_0xa146('0x14')]['message']);return _0x175cfb(_0x176d54[_0xa146('0x14')][_0xa146('0x15')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x2619e4,_0x176d54[_0xa146('0x14')][_0xa146('0x15')]);return _0x3ec814(_0x176d54[_0xa146('0x14')][_0xa146('0x15')]);}else{logger[_0xa146('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2619e4,_0xa146('0x12'));_0x3ec814(_0x176d54['result'][_0xa146('0x15')]);}})[_0xa146('0x16')](function(_0x21c890){logger[_0xa146('0x14')](_0xa146('0x11'),_0x2619e4,_0x21c890);_0x175cfb(_0x21c890);});});}exports[_0xa146('0x17')]=function(_0x9a59e7){var _0x152121=this;return new Promise(function(_0x1f3ea0,_0x34d486){return db['FaxQueue'][_0xa146('0x18')]({'raw':_0x9a59e7[_0xa146('0x19')]?_0x9a59e7[_0xa146('0x19')][_0xa146('0x1a')]===undefined?!![]:![]:!![],'where':_0x9a59e7['options']?_0x9a59e7[_0xa146('0x19')]['where']||null:null,'attributes':_0x9a59e7[_0xa146('0x19')]?_0x9a59e7[_0xa146('0x19')][_0xa146('0x1b')]||null:null,'limit':_0x9a59e7[_0xa146('0x19')]?_0x9a59e7[_0xa146('0x19')][_0xa146('0x1c')]||null:null,'include':_0x9a59e7[_0xa146('0x19')]?_0x9a59e7[_0xa146('0x19')][_0xa146('0x1d')]?_[_0xa146('0x1e')](_0x9a59e7[_0xa146('0x19')][_0xa146('0x1d')],function(_0x412d78){return{'model':db[_0x412d78[_0xa146('0x1f')]],'as':_0x412d78['as'],'attributes':_0x412d78[_0xa146('0x1b')],'include':_0x412d78['include']?_[_0xa146('0x1e')](_0x412d78['include'],function(_0xbf0e6a){return{'model':db[_0xbf0e6a[_0xa146('0x1f')]],'as':_0xbf0e6a['as'],'attributes':_0xbf0e6a[_0xa146('0x1b')],'include':_0xbf0e6a[_0xa146('0x1d')]?_[_0xa146('0x1e')](_0xbf0e6a['include'],function(_0x3b0c61){return{'model':db[_0x3b0c61['model']],'as':_0x3b0c61['as'],'attributes':_0x3b0c61[_0xa146('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa146('0xf')](function(_0x4cd7a1){logger[_0xa146('0x10')]('GetFaxQueue',_0x9a59e7);logger['debug']('GetFaxQueue',_0x9a59e7,JSON[_0xa146('0x20')](_0x4cd7a1));_0x1f3ea0(_0x4cd7a1);})[_0xa146('0x16')](function(_0x13666b){logger[_0xa146('0x14')](_0xa146('0x17'),_0x13666b[_0xa146('0x15')],_0x9a59e7);_0x34d486(_0x152121[_0xa146('0x14')](0x1f4,_0x13666b[_0xa146('0x15')]));});});};exports['ShowFaxQueue']=function(_0x448116){var _0x46ebd8=this;return new Promise(function(_0x47cfb4,_0x1e4ec7){return db['FaxQueue'][_0xa146('0x21')]({'raw':_0x448116['options']?_0x448116[_0xa146('0x19')][_0xa146('0x1a')]===undefined?!![]:![]:!![],'where':_0x448116[_0xa146('0x19')]?_0x448116[_0xa146('0x19')][_0xa146('0x22')]||null:null,'attributes':_0x448116[_0xa146('0x19')]?_0x448116[_0xa146('0x19')][_0xa146('0x1b')]||null:null,'include':_0x448116[_0xa146('0x19')]?_0x448116[_0xa146('0x19')][_0xa146('0x1d')]?_[_0xa146('0x1e')](_0x448116['options'][_0xa146('0x1d')],function(_0x9d0b3d){return{'model':db[_0x9d0b3d[_0xa146('0x1f')]],'as':_0x9d0b3d['as'],'attributes':_0x9d0b3d[_0xa146('0x1b')],'include':_0x9d0b3d['include']?_[_0xa146('0x1e')](_0x9d0b3d[_0xa146('0x1d')],function(_0x3489d5){return{'model':db[_0x3489d5[_0xa146('0x1f')]],'as':_0x3489d5['as'],'attributes':_0x3489d5['attributes'],'include':_0x3489d5[_0xa146('0x1d')]?_[_0xa146('0x1e')](_0x3489d5[_0xa146('0x1d')],function(_0x46c971){return{'model':db[_0x46c971[_0xa146('0x1f')]],'as':_0x46c971['as'],'attributes':_0x46c971[_0xa146('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa146('0xf')](function(_0x27d33a){logger[_0xa146('0x10')](_0xa146('0x23'),_0x448116);logger['debug'](_0xa146('0x23'),_0x448116,JSON['stringify'](_0x27d33a));_0x47cfb4(_0x27d33a);})[_0xa146('0x16')](function(_0x4cbe96){logger[_0xa146('0x14')](_0xa146('0x23'),_0x4cbe96[_0xa146('0x15')],_0x448116);_0x1e4ec7(_0x46ebd8[_0xa146('0x14')](0x1f4,_0x4cbe96[_0xa146('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d9e1ca2..7149910 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 _0x9b2e=['emit','removeListener','register','length','faxQueue:','save','update'];(function(_0x30f932,_0x3c5459){var _0x8131d7=function(_0x51555b){while(--_0x51555b){_0x30f932['push'](_0x30f932['shift']());}};_0x8131d7(++_0x3c5459);}(_0x9b2e,0x7c));var _0xe9b2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9b2e[_0x397e5f];return _0x5302b8;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xe9b2('0x0'),'remove',_0xe9b2('0x1')];function createListener(_0x3df078,_0x2e3d62){return function(_0x26a228){_0x2e3d62[_0xe9b2('0x2')](_0x3df078,_0x26a228);};}function removeListener(_0x5f12e5,_0x4e9ea1){return function(){FaxQueueEvents[_0xe9b2('0x3')](_0x5f12e5,_0x4e9ea1);};}exports[_0xe9b2('0x4')]=function(_0x4b642c){for(var _0x28c996=0x0,_0x3fbae5=events[_0xe9b2('0x5')];_0x28c996<_0x3fbae5;_0x28c996++){var _0x531192=events[_0x28c996];var _0x4dfe35=createListener(_0xe9b2('0x6')+_0x531192,_0x4b642c);FaxQueueEvents['on'](_0x531192,_0x4dfe35);}}; \ No newline at end of file +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 diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7692381..465f06e 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 _0xc0d7=['get','index','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x1955b9,_0x181a33){_0x1955b9=_0x1955b9-0x0;var _0x2d85f4=_0xc0d7[_0x1955b9];return _0x2d85f4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7c0d('0x0'));var express=require(_0x7c0d('0x1'));var router=express[_0x7c0d('0x2')]();var fs_extra=require(_0x7c0d('0x3'));var auth=require(_0x7c0d('0x4'));var interaction=require(_0x7c0d('0x5'));var config=require(_0x7c0d('0x6'));var controller=require(_0x7c0d('0x7'));router[_0x7c0d('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c0d('0x9')]);router[_0x7c0d('0x8')](_0x7c0d('0xa'),auth[_0x7c0d('0xb')](),controller['describe']);router[_0x7c0d('0x8')](_0x7c0d('0xc'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0xd')]);router['get'](_0x7c0d('0xe'),auth[_0x7c0d('0xb')](),controller['getMembers']);router['get'](_0x7c0d('0xf'),auth[_0x7c0d('0xb')](),controller['getTeams']);router[_0x7c0d('0x8')](_0x7c0d('0x10'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x11')]);router[_0x7c0d('0x12')]('/',auth[_0x7c0d('0xb')](),controller['create']);router[_0x7c0d('0x12')](_0x7c0d('0xf'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x13')]);router[_0x7c0d('0x12')](_0x7c0d('0x10'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x14')]);router['put'](_0x7c0d('0xc'),auth['isAuthenticated'](),controller[_0x7c0d('0x15')]);router['delete'](_0x7c0d('0xc'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x16')]);router[_0x7c0d('0x17')](_0x7c0d('0xf'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x18')]);router[_0x7c0d('0x17')](_0x7c0d('0x10'),auth[_0x7c0d('0xb')](),controller[_0x7c0d('0x19')]);module[_0x7c0d('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1db783c..8c6702c 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 _0xc147=['moment','sequelize','exports','STRING','DATE'];(function(_0x69247c,_0x3916b0){var _0xd96265=function(_0x566ccc){while(--_0x566ccc){_0x69247c['push'](_0x69247c['shift']());}};_0xd96265(++_0x3916b0);}(_0xc147,0xd7));var _0x7c14=function(_0x193685,_0x2802b5){_0x193685=_0x193685-0x0;var _0x159aaa=_0xc147[_0x193685];return _0x159aaa;};'use strict';var moment=require(_0x7c14('0x0'));var Sequelize=require(_0x7c14('0x1'));module[_0x7c14('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7c14('0x3')]},'joinAt':{'type':Sequelize[_0x7c14('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7c14('0x4')]},'reason':{'type':Sequelize[_0x7c14('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f26d7dd..8098e13 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 _0xa854=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','FaxQueueReport','findAll','rows','catch','show','includeAll','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model'];(function(_0x2a726b,_0x402d7c){var _0x37cee8=function(_0x8b7d71){while(--_0x8b7d71){_0x2a726b['push'](_0x2a726b['shift']());}};_0x37cee8(++_0x402d7c);}(_0xa854,0x103));var _0x4a85=function(_0x956c06,_0x2f47ed){_0x956c06=_0x956c06-0x0;var _0x41f276=_0xa854[_0x956c06];return _0x41f276;};'use strict';var emlformat=require(_0x4a85('0x0'));var rimraf=require(_0x4a85('0x1'));var zipdir=require(_0x4a85('0x2'));var jsonpatch=require(_0x4a85('0x3'));var rp=require(_0x4a85('0x4'));var moment=require('moment');var BPromise=require(_0x4a85('0x5'));var Mustache=require('mustache');var util=require(_0x4a85('0x6'));var path=require('path');var sox=require(_0x4a85('0x7'));var csv=require(_0x4a85('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a85('0x9'));var _=require(_0x4a85('0xa'));var squel=require('squel');var crypto=require(_0x4a85('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4a85('0xc'));var toCsv=require(_0x4a85('0x8'));var querystring=require(_0x4a85('0xd'));var Papa=require(_0x4a85('0xe'));var Redis=require(_0x4a85('0xf'));var authService=require(_0x4a85('0x10'));var qs=require(_0x4a85('0x11'));var as=require(_0x4a85('0x12'));var hardwareService=require(_0x4a85('0x13'));var logger=require('../../config/logger')(_0x4a85('0x14'));var utils=require(_0x4a85('0x15'));var config=require(_0x4a85('0x16'));var licenseUtil=require(_0x4a85('0x17'));var db=require(_0x4a85('0x18'))['db'];function respondWithStatusCode(_0x95669b,_0x108b0d){_0x108b0d=_0x108b0d||0xcc;return function(_0x42088d){if(_0x42088d){return _0x95669b[_0x4a85('0x19')](_0x108b0d);}return _0x95669b['status'](_0x108b0d)[_0x4a85('0x1a')]();};}function respondWithResult(_0x2a2802,_0x454596){_0x454596=_0x454596||0xc8;return function(_0x153d39){if(_0x153d39){return _0x2a2802[_0x4a85('0x1b')](_0x454596)[_0x4a85('0x1c')](_0x153d39);}};}function respondWithFilteredResult(_0x34743a,_0x256a3c){return function(_0x1922cb){if(_0x1922cb){var _0x397f4a=typeof _0x256a3c[_0x4a85('0x1d')]==='undefined'&&typeof _0x256a3c[_0x4a85('0x1e')]===_0x4a85('0x1f');var _0x5c9b9f=_0x1922cb[_0x4a85('0x20')];var _0x159ed0=_0x397f4a?0x0:_0x256a3c[_0x4a85('0x1d')];var _0x50e210=_0x397f4a?_0x1922cb[_0x4a85('0x20')]:_0x256a3c[_0x4a85('0x1d')]+_0x256a3c[_0x4a85('0x1e')];var _0x496b8a;if(_0x50e210>=_0x5c9b9f){_0x50e210=_0x5c9b9f;_0x496b8a=0xc8;}else{_0x496b8a=0xce;}_0x34743a['status'](_0x496b8a);return _0x34743a[_0x4a85('0x21')](_0x4a85('0x22'),_0x159ed0+'-'+_0x50e210+'/'+_0x5c9b9f)[_0x4a85('0x1c')](_0x1922cb);}return null;};}function patchUpdates(_0x2ace62){return function(_0x121379){try{jsonpatch[_0x4a85('0x23')](_0x121379,_0x2ace62,!![]);}catch(_0x382af0){return BPromise[_0x4a85('0x24')](_0x382af0);}return _0x121379['save']();};}function saveUpdates(_0x4f93ba,_0x5cf506){return function(_0x4219a7){if(_0x4219a7){return _0x4219a7[_0x4a85('0x25')](_0x4f93ba)[_0x4a85('0x26')](function(_0x408581){return _0x408581;});}return null;};}function removeEntity(_0x4d3774,_0x154bea){return function(_0x27f9c1){if(_0x27f9c1){return _0x27f9c1[_0x4a85('0x27')]()[_0x4a85('0x26')](function(){_0x4d3774[_0x4a85('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1075e2,_0x1a9a8c){return function(_0x1b3f6b){if(!_0x1b3f6b){_0x1075e2[_0x4a85('0x19')](0x194);}return _0x1b3f6b;};}function handleError(_0xab59e0,_0x27cab3){_0x27cab3=_0x27cab3||0x1f4;return function(_0x4a34d5){logger[_0x4a85('0x28')](_0x4a34d5[_0x4a85('0x29')]);if(_0x4a34d5[_0x4a85('0x2a')]){delete _0x4a34d5['name'];}_0xab59e0[_0x4a85('0x1b')](_0x27cab3)['send'](_0x4a34d5);};}exports[_0x4a85('0x2b')]=function(_0x1b91ec,_0x264515){var _0x3ade10={},_0x4596c6={},_0x37095a={'count':0x0,'rows':[]};var _0x25ddd5=_[_0x4a85('0x2c')](db['FaxQueueReport'][_0x4a85('0x2d')],function(_0x4eda22){return{'name':_0x4eda22[_0x4a85('0x2e')],'type':_0x4eda22[_0x4a85('0x2f')]['key']};});_0x4596c6[_0x4a85('0x30')]=_[_0x4a85('0x2c')](_0x25ddd5,_0x4a85('0x2a'));_0x4596c6[_0x4a85('0x31')]=_[_0x4a85('0x32')](_0x1b91ec[_0x4a85('0x31')]);_0x4596c6[_0x4a85('0x33')]=_[_0x4a85('0x34')](_0x4596c6[_0x4a85('0x30')],_0x4596c6[_0x4a85('0x31')]);_0x3ade10[_0x4a85('0x35')]=_[_0x4a85('0x34')](_0x4596c6['model'],qs[_0x4a85('0x36')](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x36')]));_0x3ade10[_0x4a85('0x35')]=_0x3ade10['attributes'][_0x4a85('0x37')]?_0x3ade10[_0x4a85('0x35')]:_0x4596c6[_0x4a85('0x30')];if(!_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x38')](_0x4a85('0x39'))){_0x3ade10[_0x4a85('0x1e')]=qs['limit'](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x1e')]);_0x3ade10['offset']=qs[_0x4a85('0x1d')](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x1d')]);}_0x3ade10['order']=qs[_0x4a85('0x3a')](_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x3a')]);_0x3ade10[_0x4a85('0x3b')]=qs[_0x4a85('0x33')](_[_0x4a85('0x3c')](_0x1b91ec[_0x4a85('0x31')],_0x4596c6[_0x4a85('0x33')]),_0x25ddd5);if(_0x1b91ec[_0x4a85('0x31')]['filter']){_0x3ade10[_0x4a85('0x3b')]=_[_0x4a85('0x3d')](_0x3ade10[_0x4a85('0x3b')],{'$or':_['map'](_0x25ddd5,function(_0x3e7e9f){if(_0x3e7e9f['type']!==_0x4a85('0x3e')){var _0x281713={};_0x281713[_0x3e7e9f['name']]={'$like':'%'+_0x1b91ec[_0x4a85('0x31')][_0x4a85('0x3f')]+'%'};return _0x281713;}})});}_0x3ade10=_[_0x4a85('0x3d')]({},_0x3ade10,_0x1b91ec['options']);var _0x48351d={'where':_0x3ade10[_0x4a85('0x3b')]};return db[_0x4a85('0x40')]['count'](_0x48351d)['then'](function(_0x4cde74){_0x37095a[_0x4a85('0x20')]=_0x4cde74;if(_0x1b91ec[_0x4a85('0x31')]['includeAll']){_0x3ade10['include']=[{'all':!![]}];}return db[_0x4a85('0x40')][_0x4a85('0x41')](_0x3ade10);})[_0x4a85('0x26')](function(_0x1b2e49){_0x37095a[_0x4a85('0x42')]=_0x1b2e49;return _0x37095a;})[_0x4a85('0x26')](respondWithFilteredResult(_0x264515,_0x3ade10))[_0x4a85('0x43')](handleError(_0x264515,null));};exports[_0x4a85('0x44')]=function(_0x4ecf67,_0x5b0eb9){var _0x351a1b={'raw':!![],'where':{'id':_0x4ecf67['params']['id']}},_0x49bd4e={};_0x49bd4e[_0x4a85('0x30')]=_[_0x4a85('0x32')](db[_0x4a85('0x40')][_0x4a85('0x2d')]);_0x49bd4e[_0x4a85('0x31')]=_[_0x4a85('0x32')](_0x4ecf67[_0x4a85('0x31')]);_0x49bd4e[_0x4a85('0x33')]=_['intersection'](_0x49bd4e['model'],_0x49bd4e[_0x4a85('0x31')]);_0x351a1b[_0x4a85('0x35')]=_[_0x4a85('0x34')](_0x49bd4e[_0x4a85('0x30')],qs[_0x4a85('0x36')](_0x4ecf67['query']['fields']));_0x351a1b[_0x4a85('0x35')]=_0x351a1b[_0x4a85('0x35')][_0x4a85('0x37')]?_0x351a1b[_0x4a85('0x35')]:_0x49bd4e[_0x4a85('0x30')];if(_0x4ecf67[_0x4a85('0x31')][_0x4a85('0x45')]){_0x351a1b[_0x4a85('0x46')]=[{'all':!![]}];}_0x351a1b=_[_0x4a85('0x3d')]({},_0x351a1b,_0x4ecf67[_0x4a85('0x47')]);return db[_0x4a85('0x40')][_0x4a85('0x48')](_0x351a1b)[_0x4a85('0x26')](handleEntityNotFound(_0x5b0eb9,null))['then'](respondWithResult(_0x5b0eb9,null))[_0x4a85('0x43')](handleError(_0x5b0eb9,null));};exports[_0x4a85('0x49')]=function(_0x1ed775,_0x5b7f9e){return db[_0x4a85('0x40')][_0x4a85('0x49')](_0x1ed775['body'],{})[_0x4a85('0x26')](respondWithResult(_0x5b7f9e,0xc9))[_0x4a85('0x43')](handleError(_0x5b7f9e,null));};exports['update']=function(_0x5cfa99,_0x10b0e1){if(_0x5cfa99['body']['id']){delete _0x5cfa99[_0x4a85('0x4a')]['id'];}return db[_0x4a85('0x40')][_0x4a85('0x48')]({'where':{'id':_0x5cfa99[_0x4a85('0x4b')]['id']}})[_0x4a85('0x26')](handleEntityNotFound(_0x10b0e1,null))[_0x4a85('0x26')](saveUpdates(_0x5cfa99['body'],null))['then'](respondWithResult(_0x10b0e1,null))[_0x4a85('0x43')](handleError(_0x10b0e1,null));};exports[_0x4a85('0x27')]=function(_0x424705,_0xf27adc){return db[_0x4a85('0x40')][_0x4a85('0x48')]({'where':{'id':_0x424705[_0x4a85('0x4b')]['id']}})[_0x4a85('0x26')](handleEntityNotFound(_0xf27adc,null))[_0x4a85('0x26')](removeEntity(_0xf27adc,null))[_0x4a85('0x43')](handleError(_0xf27adc,null));};exports[_0x4a85('0x4c')]=function(_0x17a14e,_0x1b25ca){return db[_0x4a85('0x40')]['describe']()[_0x4a85('0x26')](respondWithResult(_0x1b25ca,null))[_0x4a85('0x43')](handleError(_0x1b25ca,null));}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0da3292..44b6e3f 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x42d012,_0x11caf8){var _0x30df4a=function(_0xfcded6){while(--_0xfcded6){_0x42d012['push'](_0x42d012['shift']());}};_0x30df4a(++_0x11caf8);}(_0x326f,0xd1));var _0xf326=function(_0x326e00,_0x7e164a){_0x326e00=_0x326e00-0x0;var _0x57e222=_0x326f[_0x326e00];return _0x57e222;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 28d154b..11a427d 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 _0x0ddc=['CreateFaxQueueReport','FaxQueueReport','create','body','raw','UpdateFaxQueueReport','update','options','where','limit','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x4f0454,_0x318927){var _0x410dd2=function(_0x2171e5){while(--_0x2171e5){_0x4f0454['push'](_0x4f0454['shift']());}};_0x410dd2(++_0x318927);}(_0x0ddc,0x82));var _0xc0dd=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0ddc[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0xc0dd('0x0'));var moment=require(_0xc0dd('0x1'));var BPromise=require(_0xc0dd('0x2'));var rs=require(_0xc0dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc0dd('0x4'))('rpc');var config=require(_0xc0dd('0x5'));var jayson=require(_0xc0dd('0x6'));var client=jayson['client'][_0xc0dd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f6a0b,_0x4945a3,_0x2e2ef7){return new BPromise(function(_0x4db55d,_0x2ed6e4){return client[_0xc0dd('0x8')](_0x4f6a0b,_0x2e2ef7)[_0xc0dd('0x9')](function(_0x7f12dd){logger[_0xc0dd('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x4945a3,'request\x20sent');logger[_0xc0dd('0xb')](_0xc0dd('0xc'),_0x4945a3,_0xc0dd('0xd'),JSON[_0xc0dd('0xe')](_0x7f12dd));if(_0x7f12dd[_0xc0dd('0xf')]){if(_0x7f12dd[_0xc0dd('0xf')]['code']===0x1f4){logger[_0xc0dd('0xf')](_0xc0dd('0x10'),_0x4945a3,_0x7f12dd[_0xc0dd('0xf')][_0xc0dd('0x11')]);return _0x2ed6e4(_0x7f12dd['error'][_0xc0dd('0x11')]);}logger[_0xc0dd('0xf')](_0xc0dd('0x10'),_0x4945a3,_0x7f12dd[_0xc0dd('0xf')]['message']);return _0x4db55d(_0x7f12dd[_0xc0dd('0xf')][_0xc0dd('0x11')]);}else{logger[_0xc0dd('0xa')](_0xc0dd('0x10'),_0x4945a3,_0xc0dd('0xd'));_0x4db55d(_0x7f12dd[_0xc0dd('0x12')][_0xc0dd('0x11')]);}})[_0xc0dd('0x13')](function(_0x1f2487){logger[_0xc0dd('0xf')](_0xc0dd('0x10'),_0x4945a3,_0x1f2487);_0x2ed6e4(_0x1f2487);});});}exports[_0xc0dd('0x14')]=function(_0x2f6a38){var _0x27e588=this;return new Promise(function(_0x104e4a,_0xc99f){return db[_0xc0dd('0x15')][_0xc0dd('0x16')](_0x2f6a38[_0xc0dd('0x17')],{'raw':_0x2f6a38['options']?_0x2f6a38['options'][_0xc0dd('0x18')]===undefined?!![]:![]:!![]})[_0xc0dd('0x9')](function(_0xb3540f){logger[_0xc0dd('0xa')]('CreateFaxQueueReport',_0x2f6a38);logger['debug'](_0xc0dd('0x14'),_0x2f6a38,JSON['stringify'](_0xb3540f));_0x104e4a(_0xb3540f);})[_0xc0dd('0x13')](function(_0x3e2615){logger[_0xc0dd('0xf')]('CreateFaxQueueReport',_0x3e2615[_0xc0dd('0x11')],_0x2f6a38);_0xc99f(_0x27e588[_0xc0dd('0xf')](0x1f4,_0x3e2615[_0xc0dd('0x11')]));});});};exports[_0xc0dd('0x19')]=function(_0x2c5f54){var _0x51220f=this;return new Promise(function(_0x406cb6,_0x2dda12){return db[_0xc0dd('0x15')][_0xc0dd('0x1a')](_0x2c5f54['body'],{'raw':_0x2c5f54['options']?_0x2c5f54[_0xc0dd('0x1b')][_0xc0dd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c5f54[_0xc0dd('0x1b')]?_0x2c5f54[_0xc0dd('0x1b')][_0xc0dd('0x1c')]||null:null,'attributes':_0x2c5f54[_0xc0dd('0x1b')]?_0x2c5f54['options']['attributes']||null:null,'limit':_0x2c5f54[_0xc0dd('0x1b')]?_0x2c5f54[_0xc0dd('0x1b')][_0xc0dd('0x1d')]||null:null})[_0xc0dd('0x9')](function(_0x5057ed){logger[_0xc0dd('0xa')](_0xc0dd('0x19'),_0x2c5f54);logger[_0xc0dd('0xb')]('UpdateFaxQueueReport',_0x2c5f54,JSON[_0xc0dd('0xe')](_0x5057ed));_0x406cb6(_0x5057ed);})[_0xc0dd('0x13')](function(_0x224acc){logger[_0xc0dd('0xf')](_0xc0dd('0x19'),_0x224acc['message'],_0x2c5f54);_0x2dda12(_0x51220f[_0xc0dd('0xf')](0x1f4,_0x224acc[_0xc0dd('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ffe39bc..aa31d75 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 _0x4a37=['util','express','Router','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x25212e,_0x35c573){var _0xa65397=function(_0x351170){while(--_0x351170){_0x25212e['push'](_0x25212e['shift']());}};_0xa65397(++_0x35c573);}(_0x4a37,0xa9));var _0x74a3=function(_0x4942d7,_0x677e82){_0x4942d7=_0x4942d7-0x0;var _0x235cd0=_0x4a37[_0x4942d7];return _0x235cd0;};'use strict';var multer=require(_0x74a3('0x0'));var util=require(_0x74a3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74a3('0x2'));var router=express[_0x74a3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74a3('0x4'));var config=require('../../config/environment');var controller=require(_0x74a3('0x5'));router[_0x74a3('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x74a3('0x6')]('/describe',auth[_0x74a3('0x7')](),controller[_0x74a3('0x8')]);router[_0x74a3('0x6')](_0x74a3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x74a3('0xa')]('/',auth[_0x74a3('0x7')](),controller[_0x74a3('0xb')]);router[_0x74a3('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x74a3('0xd')]);router[_0x74a3('0xe')](_0x74a3('0x9'),auth[_0x74a3('0x7')](),controller[_0x74a3('0xf')]);module[_0x74a3('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4d1075c..c3d5c45 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x442c9e,_0x26a455){_0x442c9e=_0x442c9e-0x0;var _0x56a8a0=_0xb43b[_0x442c9e];return _0x56a8a0;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index de006ba..5353524 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 _0xdcc2=['end','error','stack','name','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy'];(function(_0x4b0a74,_0x2395d6){var _0x4b7bfc=function(_0xe4cf15){while(--_0xe4cf15){_0x4b0a74['push'](_0x4b0a74['shift']());}};_0x4b7bfc(++_0x2395d6);}(_0xdcc2,0xb0));var _0x2dcc=function(_0x3c2d48,_0x27e0cd){_0x3c2d48=_0x3c2d48-0x0;var _0x1fb1e8=_0xdcc2[_0x3c2d48];return _0x1fb1e8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2dcc('0x0'));var jsonpatch=require(_0x2dcc('0x1'));var rp=require(_0x2dcc('0x2'));var moment=require('moment');var BPromise=require(_0x2dcc('0x3'));var Mustache=require(_0x2dcc('0x4'));var util=require('util');var path=require(_0x2dcc('0x5'));var sox=require(_0x2dcc('0x6'));var csv=require(_0x2dcc('0x7'));var ejs=require(_0x2dcc('0x8'));var fs=require('fs');var fs_extra=require(_0x2dcc('0x9'));var _=require(_0x2dcc('0xa'));var squel=require('squel');var crypto=require(_0x2dcc('0xb'));var jsforce=require(_0x2dcc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2dcc('0xd'));var Redis=require(_0x2dcc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2dcc('0xf'));var as=require(_0x2dcc('0x10'));var hardwareService=require(_0x2dcc('0x11'));var logger=require(_0x2dcc('0x12'))(_0x2dcc('0x13'));var utils=require(_0x2dcc('0x14'));var config=require(_0x2dcc('0x15'));var licenseUtil=require(_0x2dcc('0x16'));var db=require(_0x2dcc('0x17'))['db'];function respondWithStatusCode(_0x3351c5,_0x30ef9c){_0x30ef9c=_0x30ef9c||0xcc;return function(_0x418e6c){if(_0x418e6c){return _0x3351c5[_0x2dcc('0x18')](_0x30ef9c);}return _0x3351c5[_0x2dcc('0x19')](_0x30ef9c)['end']();};}function respondWithResult(_0x45031c,_0x1846ed){_0x1846ed=_0x1846ed||0xc8;return function(_0x2532ce){if(_0x2532ce){return _0x45031c[_0x2dcc('0x19')](_0x1846ed)['json'](_0x2532ce);}};}function respondWithFilteredResult(_0x5d6450,_0x27c62c){return function(_0x47df6c){if(_0x47df6c){var _0x1e7645=typeof _0x27c62c['offset']==='undefined'&&typeof _0x27c62c[_0x2dcc('0x1a')]==='undefined';var _0x5ed77c=_0x47df6c[_0x2dcc('0x1b')];var _0x1a628e=_0x1e7645?0x0:_0x27c62c[_0x2dcc('0x1c')];var _0x5f4541=_0x1e7645?_0x47df6c[_0x2dcc('0x1b')]:_0x27c62c['offset']+_0x27c62c[_0x2dcc('0x1a')];var _0x266a42;if(_0x5f4541>=_0x5ed77c){_0x5f4541=_0x5ed77c;_0x266a42=0xc8;}else{_0x266a42=0xce;}_0x5d6450[_0x2dcc('0x19')](_0x266a42);return _0x5d6450[_0x2dcc('0x1d')](_0x2dcc('0x1e'),_0x1a628e+'-'+_0x5f4541+'/'+_0x5ed77c)[_0x2dcc('0x1f')](_0x47df6c);}return null;};}function patchUpdates(_0x58deed){return function(_0x13c9bd){try{jsonpatch[_0x2dcc('0x20')](_0x13c9bd,_0x58deed,!![]);}catch(_0x5636f2){return BPromise[_0x2dcc('0x21')](_0x5636f2);}return _0x13c9bd['save']();};}function saveUpdates(_0x9a03f8,_0x1c0466){return function(_0x5d5b2f){if(_0x5d5b2f){return _0x5d5b2f[_0x2dcc('0x22')](_0x9a03f8)[_0x2dcc('0x23')](function(_0x408468){return _0x408468;});}return null;};}function removeEntity(_0x4fa0c1,_0x470b57){return function(_0x148784){if(_0x148784){return _0x148784[_0x2dcc('0x24')]()[_0x2dcc('0x23')](function(){_0x4fa0c1[_0x2dcc('0x19')](0xcc)[_0x2dcc('0x25')]();});}};}function handleEntityNotFound(_0x163597,_0x27b4e4){return function(_0x28d9f8){if(!_0x28d9f8){_0x163597[_0x2dcc('0x18')](0x194);}return _0x28d9f8;};}function handleError(_0x6f9d61,_0x12ec46){_0x12ec46=_0x12ec46||0x1f4;return function(_0x5de549){logger[_0x2dcc('0x26')](_0x5de549[_0x2dcc('0x27')]);if(_0x5de549[_0x2dcc('0x28')]){delete _0x5de549[_0x2dcc('0x28')];}_0x6f9d61[_0x2dcc('0x19')](_0x12ec46)['send'](_0x5de549);};}exports['index']=function(_0x354801,_0x25f528){var _0x1139ea={},_0x299b58={},_0x36bfc1={'count':0x0,'rows':[]};var _0x1ef514=_[_0x2dcc('0x29')](db[_0x2dcc('0x2a')][_0x2dcc('0x2b')],function(_0x39b721){return{'name':_0x39b721['fieldName'],'type':_0x39b721[_0x2dcc('0x2c')][_0x2dcc('0x2d')]};});_0x299b58[_0x2dcc('0x2e')]=_['map'](_0x1ef514,'name');_0x299b58[_0x2dcc('0x2f')]=_[_0x2dcc('0x30')](_0x354801[_0x2dcc('0x2f')]);_0x299b58[_0x2dcc('0x31')]=_['intersection'](_0x299b58[_0x2dcc('0x2e')],_0x299b58['query']);_0x1139ea[_0x2dcc('0x32')]=_[_0x2dcc('0x33')](_0x299b58[_0x2dcc('0x2e')],qs[_0x2dcc('0x34')](_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x34')]));_0x1139ea['attributes']=_0x1139ea[_0x2dcc('0x32')][_0x2dcc('0x35')]?_0x1139ea[_0x2dcc('0x32')]:_0x299b58[_0x2dcc('0x2e')];if(!_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x36')](_0x2dcc('0x37'))){_0x1139ea[_0x2dcc('0x1a')]=qs['limit'](_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x1a')]);_0x1139ea[_0x2dcc('0x1c')]=qs[_0x2dcc('0x1c')](_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x1c')]);}_0x1139ea[_0x2dcc('0x38')]=qs[_0x2dcc('0x39')](_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x39')]);_0x1139ea[_0x2dcc('0x3a')]=qs[_0x2dcc('0x31')](_['pick'](_0x354801[_0x2dcc('0x2f')],_0x299b58[_0x2dcc('0x31')]),_0x1ef514);if(_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x3b')]){_0x1139ea[_0x2dcc('0x3a')]=_[_0x2dcc('0x3c')](_0x1139ea[_0x2dcc('0x3a')],{'$or':_[_0x2dcc('0x29')](_0x1ef514,function(_0x3e6cd6){if(_0x3e6cd6['type']!==_0x2dcc('0x3d')){var _0x331857={};_0x331857[_0x3e6cd6[_0x2dcc('0x28')]]={'$like':'%'+_0x354801[_0x2dcc('0x2f')]['filter']+'%'};return _0x331857;}})});}_0x1139ea=_['merge']({},_0x1139ea,_0x354801[_0x2dcc('0x3e')]);var _0xea22d6={'where':_0x1139ea[_0x2dcc('0x3a')]};return db[_0x2dcc('0x2a')]['count'](_0xea22d6)[_0x2dcc('0x23')](function(_0x5d8b15){_0x36bfc1['count']=_0x5d8b15;if(_0x354801[_0x2dcc('0x2f')][_0x2dcc('0x3f')]){_0x1139ea[_0x2dcc('0x40')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x1139ea);})[_0x2dcc('0x23')](function(_0x5cca4b){_0x36bfc1[_0x2dcc('0x41')]=_0x5cca4b;return _0x36bfc1;})[_0x2dcc('0x23')](respondWithFilteredResult(_0x25f528,_0x1139ea))[_0x2dcc('0x42')](handleError(_0x25f528,null));};exports[_0x2dcc('0x43')]=function(_0x340d62,_0x56526c){var _0x2cfad8={'raw':!![],'where':{'id':_0x340d62[_0x2dcc('0x44')]['id']}},_0x56f3b8={};_0x56f3b8[_0x2dcc('0x2e')]=_[_0x2dcc('0x30')](db[_0x2dcc('0x2a')]['rawAttributes']);_0x56f3b8[_0x2dcc('0x2f')]=_[_0x2dcc('0x30')](_0x340d62['query']);_0x56f3b8[_0x2dcc('0x31')]=_[_0x2dcc('0x33')](_0x56f3b8['model'],_0x56f3b8[_0x2dcc('0x2f')]);_0x2cfad8[_0x2dcc('0x32')]=_[_0x2dcc('0x33')](_0x56f3b8[_0x2dcc('0x2e')],qs[_0x2dcc('0x34')](_0x340d62[_0x2dcc('0x2f')][_0x2dcc('0x34')]));_0x2cfad8['attributes']=_0x2cfad8[_0x2dcc('0x32')][_0x2dcc('0x35')]?_0x2cfad8[_0x2dcc('0x32')]:_0x56f3b8[_0x2dcc('0x2e')];if(_0x340d62[_0x2dcc('0x2f')][_0x2dcc('0x3f')]){_0x2cfad8['include']=[{'all':!![]}];}_0x2cfad8=_[_0x2dcc('0x3c')]({},_0x2cfad8,_0x340d62[_0x2dcc('0x3e')]);return db[_0x2dcc('0x2a')][_0x2dcc('0x45')](_0x2cfad8)[_0x2dcc('0x23')](handleEntityNotFound(_0x56526c,null))['then'](respondWithResult(_0x56526c,null))[_0x2dcc('0x42')](handleError(_0x56526c,null));};exports['create']=function(_0x384643,_0x342151){return db[_0x2dcc('0x2a')]['create'](_0x384643['body'],{})[_0x2dcc('0x23')](respondWithResult(_0x342151,0xc9))[_0x2dcc('0x42')](handleError(_0x342151,null));};exports[_0x2dcc('0x22')]=function(_0x9ad265,_0x2a5d78){if(_0x9ad265[_0x2dcc('0x46')]['id']){delete _0x9ad265[_0x2dcc('0x46')]['id'];}return db[_0x2dcc('0x2a')][_0x2dcc('0x45')]({'where':{'id':_0x9ad265['params']['id']}})[_0x2dcc('0x23')](handleEntityNotFound(_0x2a5d78,null))[_0x2dcc('0x23')](saveUpdates(_0x9ad265[_0x2dcc('0x46')],null))[_0x2dcc('0x23')](respondWithResult(_0x2a5d78,null))[_0x2dcc('0x42')](handleError(_0x2a5d78,null));};exports[_0x2dcc('0x24')]=function(_0x46c15b,_0x4689ef){return db['FaxTransferReport'][_0x2dcc('0x45')]({'where':{'id':_0x46c15b['params']['id']}})[_0x2dcc('0x23')](handleEntityNotFound(_0x4689ef,null))[_0x2dcc('0x23')](removeEntity(_0x4689ef,null))[_0x2dcc('0x42')](handleError(_0x4689ef,null));};exports['describe']=function(_0x49e342,_0x4a4af9){return db[_0x2dcc('0x2a')]['describe']()[_0x2dcc('0x23')](respondWithResult(_0x4a4af9,null))['catch'](handleError(_0x4a4af9,null));}; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9ac4945..b06dddb 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 _0xac4a=['moment','bluebird','request-promise','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','util','../../config/logger','api'];(function(_0x312b02,_0x5a4c99){var _0x34a298=function(_0x992e5a){while(--_0x992e5a){_0x312b02['push'](_0x312b02['shift']());}};_0x34a298(++_0x5a4c99);}(_0xac4a,0x1e9));var _0xaac4=function(_0x6466eb,_0x1f9f5e){_0x6466eb=_0x6466eb-0x0;var _0x3378a0=_0xac4a[_0x6466eb];return _0x3378a0;};'use strict';var _=require('lodash');var util=require(_0xaac4('0x0'));var logger=require(_0xaac4('0x1'))(_0xaac4('0x2'));var moment=require(_0xaac4('0x3'));var BPromise=require(_0xaac4('0x4'));var rp=require(_0xaac4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require('../../config/environment');var attributes=require(_0xaac4('0x7'));module[_0xaac4('0x8')]=function(_0x12465c,_0x3b9861){return _0x12465c[_0xaac4('0x9')](_0xaac4('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xaac4('0xb'),'fields':[_0xaac4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c88b01d..567fc05 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 _0xa733=['rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2b395a,_0x35db69){var _0x1beba0=function(_0x2cb135){while(--_0x2cb135){_0x2b395a['push'](_0x2b395a['shift']());}};_0x1beba0(++_0x35db69);}(_0xa733,0x9a));var _0x3a73=function(_0x2f2c29,_0x52ee27){_0x2f2c29=_0x2f2c29-0x0;var _0x15b44d=_0xa733[_0x2f2c29];return _0x15b44d;};'use strict';var _=require(_0x3a73('0x0'));var util=require(_0x3a73('0x1'));var moment=require('moment');var BPromise=require(_0x3a73('0x2'));var rs=require(_0x3a73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a73('0x4'));var logger=require(_0x3a73('0x5'))(_0x3a73('0x6'));var config=require(_0x3a73('0x7'));var jayson=require(_0x3a73('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10b419,_0x2a29ff,_0x5eef31){return new BPromise(function(_0x17fa78,_0x141795){return client[_0x3a73('0x9')](_0x10b419,_0x5eef31)['then'](function(_0xf90ed8){logger[_0x3a73('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x2a29ff,_0x3a73('0xb'));logger[_0x3a73('0xc')](_0x3a73('0xd'),_0x2a29ff,_0x3a73('0xb'),JSON[_0x3a73('0xe')](_0xf90ed8));if(_0xf90ed8[_0x3a73('0xf')]){if(_0xf90ed8['error'][_0x3a73('0x10')]===0x1f4){logger[_0x3a73('0xf')](_0x3a73('0x11'),_0x2a29ff,_0xf90ed8['error']['message']);return _0x141795(_0xf90ed8['error'][_0x3a73('0x12')]);}logger[_0x3a73('0xf')](_0x3a73('0x11'),_0x2a29ff,_0xf90ed8[_0x3a73('0xf')]['message']);return _0x17fa78(_0xf90ed8[_0x3a73('0xf')][_0x3a73('0x12')]);}else{logger[_0x3a73('0xa')](_0x3a73('0x11'),_0x2a29ff,_0x3a73('0xb'));_0x17fa78(_0xf90ed8['result'][_0x3a73('0x12')]);}})[_0x3a73('0x13')](function(_0x34216c){logger[_0x3a73('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x2a29ff,_0x34216c);_0x141795(_0x34216c);});});} \ No newline at end of file +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 diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 9c6bf0d..645bc63 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 _0x1e8e=['../../config/environment','get','index','isAuthenticated','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21eb60,_0x3e832b){var _0x38d90a=function(_0xf30d13){while(--_0xf30d13){_0x21eb60['push'](_0x21eb60['shift']());}};_0x38d90a(++_0x3e832b);}(_0x1e8e,0x161));var _0xe1e8=function(_0x43ef11,_0x1f69fe){_0x43ef11=_0x43ef11-0x0;var _0x2300d9=_0x1e8e[_0x43ef11];return _0x2300d9;};'use strict';var multer=require('multer');var util=require(_0xe1e8('0x0'));var path=require(_0xe1e8('0x1'));var timeout=require(_0xe1e8('0x2'));var express=require(_0xe1e8('0x3'));var router=express[_0xe1e8('0x4')]();var fs_extra=require(_0xe1e8('0x5'));var auth=require(_0xe1e8('0x6'));var interaction=require(_0xe1e8('0x7'));var config=require(_0xe1e8('0x8'));var controller=require('./faxTransferReport.controller');router[_0xe1e8('0x9')]('/',auth['isAuthenticated'](),controller[_0xe1e8('0xa')]);router[_0xe1e8('0x9')]('/describe',auth[_0xe1e8('0xb')](),controller['describe']);router['get'](_0xe1e8('0xc'),auth['isAuthenticated'](),controller[_0xe1e8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe1e8('0xe')]);router[_0xe1e8('0xf')]('/:id',auth[_0xe1e8('0xb')](),controller[_0xe1e8('0x10')]);router[_0xe1e8('0x11')](_0xe1e8('0xc'),auth[_0xe1e8('0xb')](),controller['destroy']);module[_0xe1e8('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 50ba2a0..91731af 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 _0xd139=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','/:id','destroy','multer','util','path'];(function(_0x2ddfba,_0x579f81){var _0x14a249=function(_0xb911ba){while(--_0xb911ba){_0x2ddfba['push'](_0x2ddfba['shift']());}};_0x14a249(++_0x579f81);}(_0xd139,0x115));var _0x9d13=function(_0x23c011,_0x234d6b){_0x23c011=_0x23c011-0x0;var _0x85d3cb=_0xd139[_0x23c011];return _0x85d3cb;};'use strict';var multer=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var path=require(_0x9d13('0x2'));var timeout=require(_0x9d13('0x3'));var express=require('express');var router=express[_0x9d13('0x4')]();var fs_extra=require(_0x9d13('0x5'));var auth=require(_0x9d13('0x6'));var interaction=require(_0x9d13('0x7'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x9d13('0x8')](),controller['index']);router[_0x9d13('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9d13('0x9')](_0x9d13('0xa'),auth[_0x9d13('0x8')](),controller[_0x9d13('0xb')]);router[_0x9d13('0x9')](_0x9d13('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x9d13('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d13('0xe')]);router[_0x9d13('0xd')]('/:id/configurations',auth[_0x9d13('0x8')](),controller[_0x9d13('0xf')]);router[_0x9d13('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9d13('0x11')]);router['delete'](_0x9d13('0x12'),auth[_0x9d13('0x8')](),controller[_0x9d13('0x13')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3985fd1..efe1867 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 _0x10e3=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0xf6219,_0x1cb673){var _0x5f238d=function(_0x4dc0b4){while(--_0x4dc0b4){_0xf6219['push'](_0xf6219['shift']());}};_0x5f238d(++_0x1cb673);}(_0x10e3,0x1a1));var _0x310e=function(_0x198fab,_0x28368a){_0x198fab=_0x198fab-0x0;var _0x40f5e4=_0x10e3[_0x198fab];return _0x40f5e4;};'use strict';var Sequelize=require(_0x310e('0x0'));module[_0x310e('0x1')]={'name':{'type':Sequelize[_0x310e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x310e('0x2')]},'remoteUri':{'type':Sequelize[_0x310e('0x2')]},'authType':{'type':Sequelize[_0x310e('0x3')](_0x310e('0x4')),'defaultValue':_0x310e('0x4')},'password':{'type':Sequelize[_0x310e('0x2')]},'consumerKey':{'type':Sequelize[_0x310e('0x2')]},'consumerSecret':{'type':Sequelize[_0x310e('0x2')]},'token':{'type':Sequelize[_0x310e('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x310e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x310e('0x3')](_0x310e('0x5'),_0x310e('0x6')),'defaultValue':_0x310e('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 79d69e1..26ff4e0 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 _0x73b4=['consumerSecret','token','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','DeskAccount','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x73b4,0x8b));var _0x473b=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x73b4[_0x4bf96c];return _0x281d09;};'use strict';var emlformat=require(_0x473b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x473b('0x1'));var jsonpatch=require(_0x473b('0x2'));var rp=require('request-promise');var moment=require(_0x473b('0x3'));var BPromise=require(_0x473b('0x4'));var Mustache=require(_0x473b('0x5'));var util=require(_0x473b('0x6'));var path=require('path');var sox=require(_0x473b('0x7'));var csv=require(_0x473b('0x8'));var ejs=require(_0x473b('0x9'));var fs=require('fs');var fs_extra=require(_0x473b('0xa'));var _=require(_0x473b('0xb'));var squel=require(_0x473b('0xc'));var crypto=require(_0x473b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x473b('0x8'));var querystring=require(_0x473b('0xe'));var Papa=require(_0x473b('0xf'));var Redis=require(_0x473b('0x10'));var authService=require(_0x473b('0x11'));var qs=require(_0x473b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x473b('0x13'))(_0x473b('0x14'));var utils=require(_0x473b('0x15'));var config=require(_0x473b('0x16'));var licenseUtil=require(_0x473b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x473b('0x18'));function respondWithStatusCode(_0x2a44f1,_0x3e6651){_0x3e6651=_0x3e6651||0xcc;return function(_0x3b6a95){if(_0x3b6a95){return _0x2a44f1[_0x473b('0x19')](_0x3e6651);}return _0x2a44f1[_0x473b('0x1a')](_0x3e6651)[_0x473b('0x1b')]();};}function respondWithResult(_0x36fb0b,_0x2064d1){_0x2064d1=_0x2064d1||0xc8;return function(_0x29821f){if(_0x29821f){return _0x36fb0b[_0x473b('0x1a')](_0x2064d1)['json'](_0x29821f);}};}function respondWithFilteredResult(_0x495d9f,_0x320c68){return function(_0x166b09){if(_0x166b09){var _0xc4d60b=typeof _0x320c68['offset']===_0x473b('0x1c')&&typeof _0x320c68[_0x473b('0x1d')]===_0x473b('0x1c');var _0x3cd566=_0x166b09[_0x473b('0x1e')];var _0x1f0a24=_0xc4d60b?0x0:_0x320c68[_0x473b('0x1f')];var _0x1e8f6c=_0xc4d60b?_0x166b09[_0x473b('0x1e')]:_0x320c68[_0x473b('0x1f')]+_0x320c68[_0x473b('0x1d')];var _0x3cbef0;if(_0x1e8f6c>=_0x3cd566){_0x1e8f6c=_0x3cd566;_0x3cbef0=0xc8;}else{_0x3cbef0=0xce;}_0x495d9f['status'](_0x3cbef0);return _0x495d9f[_0x473b('0x20')]('Content-Range',_0x1f0a24+'-'+_0x1e8f6c+'/'+_0x3cd566)['json'](_0x166b09);}return null;};}function patchUpdates(_0x54e982){return function(_0x177097){try{jsonpatch[_0x473b('0x21')](_0x177097,_0x54e982,!![]);}catch(_0x316bcb){return BPromise[_0x473b('0x22')](_0x316bcb);}return _0x177097[_0x473b('0x23')]();};}function saveUpdates(_0x2aa629,_0x52715e){return function(_0x5ec6d3){if(_0x5ec6d3){return _0x5ec6d3['update'](_0x2aa629)[_0x473b('0x24')](function(_0x539816){return _0x539816;});}return null;};}function removeEntity(_0x2481cc,_0x4751ed){return function(_0x4cffb2){if(_0x4cffb2){return _0x4cffb2[_0x473b('0x25')]()[_0x473b('0x24')](function(){_0x2481cc[_0x473b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0f06,_0x1067c7){return function(_0xa6a562){if(!_0xa6a562){_0x3e0f06['sendStatus'](0x194);}return _0xa6a562;};}function handleError(_0x11a8a9,_0x59da23){_0x59da23=_0x59da23||0x1f4;return function(_0x58dd8a){logger['error'](_0x58dd8a[_0x473b('0x26')]);if(_0x58dd8a[_0x473b('0x27')]){delete _0x58dd8a['name'];}_0x11a8a9['status'](_0x59da23)[_0x473b('0x28')](_0x58dd8a);};}exports[_0x473b('0x29')]=function(_0x3e8fa7,_0x2acbc5){var _0xc835af={},_0x306275={},_0x27fa8a={'count':0x0,'rows':[]};var _0x5e22a8=_['map'](db['DeskAccount'][_0x473b('0x2a')],function(_0x1483e7){return{'name':_0x1483e7[_0x473b('0x2b')],'type':_0x1483e7[_0x473b('0x2c')][_0x473b('0x2d')]};});_0x306275[_0x473b('0x2e')]=_[_0x473b('0x2f')](_0x5e22a8,_0x473b('0x27'));_0x306275[_0x473b('0x30')]=_[_0x473b('0x31')](_0x3e8fa7['query']);_0x306275[_0x473b('0x32')]=_[_0x473b('0x33')](_0x306275[_0x473b('0x2e')],_0x306275[_0x473b('0x30')]);_0xc835af[_0x473b('0x34')]=_['intersection'](_0x306275[_0x473b('0x2e')],qs[_0x473b('0x35')](_0x3e8fa7[_0x473b('0x30')][_0x473b('0x35')]));_0xc835af[_0x473b('0x34')]=_0xc835af[_0x473b('0x34')][_0x473b('0x36')]?_0xc835af[_0x473b('0x34')]:_0x306275[_0x473b('0x2e')];if(!_0x3e8fa7['query']['hasOwnProperty'](_0x473b('0x37'))){_0xc835af['limit']=qs[_0x473b('0x1d')](_0x3e8fa7[_0x473b('0x30')][_0x473b('0x1d')]);_0xc835af[_0x473b('0x1f')]=qs[_0x473b('0x1f')](_0x3e8fa7[_0x473b('0x30')][_0x473b('0x1f')]);}_0xc835af[_0x473b('0x38')]=qs[_0x473b('0x39')](_0x3e8fa7[_0x473b('0x30')][_0x473b('0x39')]);_0xc835af[_0x473b('0x3a')]=qs[_0x473b('0x32')](_[_0x473b('0x3b')](_0x3e8fa7[_0x473b('0x30')],_0x306275['filters']),_0x5e22a8);if(_0x3e8fa7[_0x473b('0x30')]['filter']){_0xc835af[_0x473b('0x3a')]=_[_0x473b('0x3c')](_0xc835af[_0x473b('0x3a')],{'$or':_[_0x473b('0x2f')](_0x5e22a8,function(_0x2ee7b2){if(_0x2ee7b2['type']!=='VIRTUAL'){var _0x32d063={};_0x32d063[_0x2ee7b2[_0x473b('0x27')]]={'$like':'%'+_0x3e8fa7[_0x473b('0x30')][_0x473b('0x3d')]+'%'};return _0x32d063;}})});}_0xc835af=_[_0x473b('0x3c')]({},_0xc835af,_0x3e8fa7[_0x473b('0x3e')]);var _0x509762={'where':_0xc835af[_0x473b('0x3a')]};return db[_0x473b('0x3f')][_0x473b('0x1e')](_0x509762)[_0x473b('0x24')](function(_0x34e43b){_0x27fa8a[_0x473b('0x1e')]=_0x34e43b;if(_0x3e8fa7[_0x473b('0x30')][_0x473b('0x40')]){_0xc835af[_0x473b('0x41')]=[{'all':!![]}];}return db[_0x473b('0x3f')][_0x473b('0x42')](_0xc835af);})[_0x473b('0x24')](function(_0x5efd5e){_0x27fa8a[_0x473b('0x43')]=_0x5efd5e;return _0x27fa8a;})[_0x473b('0x24')](respondWithFilteredResult(_0x2acbc5,_0xc835af))[_0x473b('0x44')](handleError(_0x2acbc5,null));};exports[_0x473b('0x45')]=function(_0x470737,_0x301c73){var _0x2bfbe6={'raw':![],'where':{'id':_0x470737['params']['id']}},_0x2e437d={};_0x2e437d[_0x473b('0x2e')]=_[_0x473b('0x31')](db[_0x473b('0x3f')][_0x473b('0x2a')]);_0x2e437d[_0x473b('0x30')]=_[_0x473b('0x31')](_0x470737[_0x473b('0x30')]);_0x2e437d['filters']=_[_0x473b('0x33')](_0x2e437d[_0x473b('0x2e')],_0x2e437d[_0x473b('0x30')]);_0x2bfbe6['attributes']=_[_0x473b('0x33')](_0x2e437d[_0x473b('0x2e')],qs[_0x473b('0x35')](_0x470737[_0x473b('0x30')][_0x473b('0x35')]));_0x2bfbe6[_0x473b('0x34')]=_0x2bfbe6['attributes']['length']?_0x2bfbe6[_0x473b('0x34')]:_0x2e437d[_0x473b('0x2e')];if(_0x470737[_0x473b('0x30')][_0x473b('0x40')]){_0x2bfbe6[_0x473b('0x41')]=[{'all':!![]}];}_0x2bfbe6=_[_0x473b('0x3c')]({},_0x2bfbe6,_0x470737['options']);return db[_0x473b('0x3f')]['find'](_0x2bfbe6)[_0x473b('0x24')](handleEntityNotFound(_0x301c73,null))[_0x473b('0x24')](respondWithResult(_0x301c73,null))[_0x473b('0x44')](handleError(_0x301c73,null));};exports['create']=function(_0x20e8f1,_0x8cd0da){return db[_0x473b('0x3f')][_0x473b('0x46')](_0x20e8f1[_0x473b('0x47')],{})['then'](respondWithResult(_0x8cd0da,0xc9))['catch'](handleError(_0x8cd0da,null));};exports[_0x473b('0x48')]=function(_0x5ea441,_0x3b71d0){if(_0x5ea441[_0x473b('0x47')]['id']){delete _0x5ea441[_0x473b('0x47')]['id'];}return db['DeskAccount'][_0x473b('0x49')]({'where':{'id':_0x5ea441[_0x473b('0x4a')]['id']}})[_0x473b('0x24')](handleEntityNotFound(_0x3b71d0,null))[_0x473b('0x24')](saveUpdates(_0x5ea441[_0x473b('0x47')],null))[_0x473b('0x24')](respondWithResult(_0x3b71d0,null))[_0x473b('0x44')](handleError(_0x3b71d0,null));};exports['destroy']=function(_0x576966,_0x549b2e){return db[_0x473b('0x3f')][_0x473b('0x49')]({'where':{'id':_0x576966['params']['id']}})[_0x473b('0x24')](handleEntityNotFound(_0x549b2e,null))[_0x473b('0x24')](removeEntity(_0x549b2e,null))[_0x473b('0x44')](handleError(_0x549b2e,null));};exports[_0x473b('0x4b')]=function(_0x35bbd7,_0x31fe2b,_0x159a8f){var _0x245b67={};var _0x5edfde={};var _0x29cbf4;var _0x41f7b2;return db[_0x473b('0x3f')][_0x473b('0x4c')]({'where':{'id':_0x35bbd7[_0x473b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31fe2b,null))[_0x473b('0x24')](function(_0x19e1b6){if(_0x19e1b6){_0x29cbf4=_0x19e1b6;_0x5edfde['model']=_[_0x473b('0x31')](db[_0x473b('0x4d')][_0x473b('0x2a')]);_0x5edfde[_0x473b('0x30')]=_[_0x473b('0x31')](_0x35bbd7[_0x473b('0x30')]);_0x5edfde[_0x473b('0x32')]=_['intersection'](_0x5edfde[_0x473b('0x2e')],_0x5edfde[_0x473b('0x30')]);_0x245b67[_0x473b('0x34')]=_[_0x473b('0x33')](_0x5edfde[_0x473b('0x2e')],qs[_0x473b('0x35')](_0x35bbd7['query'][_0x473b('0x35')]));_0x245b67[_0x473b('0x34')]=_0x245b67[_0x473b('0x34')]['length']?_0x245b67[_0x473b('0x34')]:_0x5edfde[_0x473b('0x2e')];_0x245b67[_0x473b('0x38')]=qs[_0x473b('0x39')](_0x35bbd7[_0x473b('0x30')]['sort']);_0x245b67[_0x473b('0x3a')]=qs['filters'](_['pick'](_0x35bbd7['query'],_0x5edfde[_0x473b('0x32')]));if(_0x35bbd7[_0x473b('0x30')][_0x473b('0x3d')]){_0x245b67[_0x473b('0x3a')]=_['merge'](_0x245b67['where'],{'$or':_[_0x473b('0x2f')](_0x245b67[_0x473b('0x34')],function(_0xfea905){var _0x2ecb1e={};_0x2ecb1e[_0xfea905]={'$like':'%'+_0x35bbd7['query'][_0x473b('0x3d')]+'%'};return _0x2ecb1e;})});}_0x245b67=_[_0x473b('0x3c')]({},_0x245b67,_0x35bbd7[_0x473b('0x3e')]);return _0x29cbf4[_0x473b('0x4b')](_0x245b67);}})[_0x473b('0x24')](function(_0x1aec6b){if(_0x1aec6b){_0x41f7b2=_0x1aec6b['length'];if(!_0x35bbd7[_0x473b('0x30')][_0x473b('0x4e')]('nolimit')){_0x245b67[_0x473b('0x1d')]=qs[_0x473b('0x1d')](_0x35bbd7['query']['limit']);_0x245b67[_0x473b('0x1f')]=qs[_0x473b('0x1f')](_0x35bbd7[_0x473b('0x30')][_0x473b('0x1f')]);}return _0x29cbf4[_0x473b('0x4b')](_0x245b67);}})[_0x473b('0x24')](function(_0x586e35){if(_0x586e35){return _0x586e35?{'count':_0x41f7b2,'rows':_0x586e35}:null;}})[_0x473b('0x24')](respondWithResult(_0x31fe2b,null))[_0x473b('0x44')](handleError(_0x31fe2b,null));};exports['addConfiguration']=function(_0xe10207,_0xfb7832,_0x5d0dd6){if(_0xe10207[_0x473b('0x47')]['id']){delete _0xe10207[_0x473b('0x47')]['id'];}return db[_0x473b('0x3f')][_0x473b('0x4c')]({'where':{'id':_0xe10207[_0x473b('0x4a')]['id']}})['then'](handleEntityNotFound(_0xfb7832,null))[_0x473b('0x24')](function(_0x503cd9){if(_0x503cd9){_0xe10207[_0x473b('0x47')]['AccountId']=_0x503cd9['id'];_0xe10207[_0x473b('0x47')][_0x473b('0x4f')]=integrations[_0x473b('0x50')](_0xe10207[_0x473b('0x47')][_0x473b('0x51')],_0xe10207['body'][_0x473b('0x2c')]);_0xe10207[_0x473b('0x47')][_0x473b('0x52')]=integrations[_0x473b('0x53')](_0xe10207[_0x473b('0x47')][_0x473b('0x51')],_0xe10207[_0x473b('0x47')][_0x473b('0x2c')]);return db[_0x473b('0x4d')][_0x473b('0x46')](_0xe10207[_0x473b('0x47')],{'include':[{'model':db[_0x473b('0x54')],'as':_0x473b('0x4f')},{'model':db['DeskField'],'as':_0x473b('0x52')}]});}return null;})[_0x473b('0x24')](respondWithResult(_0xfb7832,null))[_0x473b('0x44')](handleError(_0xfb7832,null));};exports[_0x473b('0x55')]=function(_0x10fcee,_0x24f513,_0x25ea36){var _0x198997=[{'name':_0x473b('0x56'),'label':_0x473b('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 _0x12c91d='';return db['DeskAccount'][_0x473b('0x4c')]({'where':{'id':_0x10fcee['params']['id']},'attributes':['id',_0x473b('0x57'),_0x473b('0x58'),'username',_0x473b('0x59'),_0x473b('0x5a'),_0x473b('0x5b'),_0x473b('0x5c'),'tokenSecret']})[_0x473b('0x24')](handleEntityNotFound(_0x24f513,null))[_0x473b('0x24')](function(_0x4d8a08){if(_0x4d8a08){_0x12c91d=_0x4d8a08[_0x473b('0x57')];var _0x5c3fa8=_0x12c91d[_0x473b('0x5d')](-0x1);if(_0x5c3fa8==='/'){_0x12c91d=_0x12c91d[_0x473b('0x5e')](0x0,_0x12c91d[_0x473b('0x5f')](_0x5c3fa8));}var _0x570cff={'method':_0x473b('0x60'),'uri':util['format'](_0x473b('0x61'),_0x12c91d),'headers':{'Content-Type':_0x473b('0x62'),'Accept':_0x473b('0x62')},'json':!![]};if(_0x4d8a08[_0x473b('0x58')]===_0x473b('0x63')){_0x570cff['headers'][_0x473b('0x64')]=util[_0x473b('0x65')](_0x473b('0x66'),new Buffer(util[_0x473b('0x65')](_0x473b('0x67'),_0x4d8a08['username'],_0x4d8a08[_0x473b('0x59')]))[_0x473b('0x68')](_0x473b('0x69')));}return rp(_0x570cff)[_0x473b('0x24')](function(_0x22df95){return _0x198997['concat'](_[_0x473b('0x2f')](_0x22df95[_0x473b('0x6a')][_0x473b('0x6b')],function(_0x67cac){return{'id':_0x67cac[_0x473b('0x27')],'name':_0x67cac['name'],'type':_0x67cac[_0x473b('0x2c')],'active':_0x67cac['active'],'label':_0x67cac[_0x473b('0x6c')],'custom':!![]};}));});}})[_0x473b('0x24')](function(_0x1f6c7a){return{'count':_0x1f6c7a['length'],'rows':_0x1f6c7a};})[_0x473b('0x24')](respondWithResult(_0x24f513,null))[_0x473b('0x44')](function(_0xe8131f){var _0x8e4ba4=_0x10fcee[_0x473b('0x30')]['test']?0x1f4:_0xe8131f[_0x473b('0x6d')]||0x1f4;logger[_0x473b('0x6e')](_0x473b('0x6f'),_0x473b('0x55'),_0x8e4ba4,JSON[_0x473b('0x70')](_0xe8131f));delete _0xe8131f['name'];if(_0x8e4ba4===0x191){_0x8e4ba4=0x190;}_0x24f513['status'](_0x8e4ba4)[_0x473b('0x28')](_0x10fcee[_0x473b('0x30')][_0x473b('0x71')]?{'message':_0x473b('0x72'),'statusCode':_0xe8131f[_0x473b('0x6d')]}:_0xe8131f);});}; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 826eeac..7470982 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 _0xf35c=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','moment','bluebird','path'];(function(_0x34adeb,_0x315c72){var _0xc4b5f0=function(_0x388862){while(--_0x388862){_0x34adeb['push'](_0x34adeb['shift']());}};_0xc4b5f0(++_0x315c72);}(_0xf35c,0x89));var _0xcf35=function(_0x384f15,_0x1ae7b4){_0x384f15=_0x384f15-0x0;var _0x48e483=_0xf35c[_0x384f15];return _0x48e483;};'use strict';var _=require('lodash');var util=require(_0xcf35('0x0'));var logger=require(_0xcf35('0x1'))(_0xcf35('0x2'));var moment=require(_0xcf35('0x3'));var BPromise=require(_0xcf35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf35('0x5'));var rimraf=require(_0xcf35('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf35('0x7'));var integrations=require(_0xcf35('0x8'));module[_0xcf35('0x9')]=function(_0x26c0dc,_0x4a7920){return _0x26c0dc[_0xcf35('0xa')](_0xcf35('0xb'),attributes,{'tableName':_0xcf35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index e9fc5a8..a6ce86b 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 _0xbb53=['attributes','limit','include','map','model','ShowDeskAccount','find','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0x1d18ee,_0x483ecc){var _0xc07118=function(_0x468ae0){while(--_0x468ae0){_0x1d18ee['push'](_0x1d18ee['shift']());}};_0xc07118(++_0x483ecc);}(_0xbb53,0x17d));var _0x3bb5=function(_0x2dafea,_0x3d9232){_0x2dafea=_0x2dafea-0x0;var _0x1b1b46=_0xbb53[_0x2dafea];return _0x1b1b46;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3bb5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bb5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3bb5('0x4'))(_0x3bb5('0x5'));var config=require(_0x3bb5('0x6'));var jayson=require(_0x3bb5('0x7'));var client=jayson[_0x3bb5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb708c6,_0x23cb12,_0x2575b4){return new BPromise(function(_0x3b2467,_0x142047){return client['request'](_0xb708c6,_0x2575b4)[_0x3bb5('0x9')](function(_0xc1b10d){logger[_0x3bb5('0xa')](_0x3bb5('0xb'),_0x23cb12,_0x3bb5('0xc'));logger[_0x3bb5('0xd')](_0x3bb5('0xe'),_0x23cb12,'request\x20sent',JSON[_0x3bb5('0xf')](_0xc1b10d));if(_0xc1b10d['error']){if(_0xc1b10d['error'][_0x3bb5('0x10')]===0x1f4){logger[_0x3bb5('0x11')](_0x3bb5('0xb'),_0x23cb12,_0xc1b10d['error'][_0x3bb5('0x12')]);return _0x142047(_0xc1b10d[_0x3bb5('0x11')][_0x3bb5('0x12')]);}logger[_0x3bb5('0x11')](_0x3bb5('0xb'),_0x23cb12,_0xc1b10d['error']['message']);return _0x3b2467(_0xc1b10d['error']['message']);}else{logger[_0x3bb5('0xa')]('DeskAccount,\x20%s,\x20%s',_0x23cb12,'request\x20sent');_0x3b2467(_0xc1b10d[_0x3bb5('0x13')]['message']);}})[_0x3bb5('0x14')](function(_0x18ce3e){logger[_0x3bb5('0x11')]('DeskAccount,\x20%s,\x20%s',_0x23cb12,_0x18ce3e);_0x142047(_0x18ce3e);});});}exports[_0x3bb5('0x15')]=function(_0x181b36){var _0x1db570=this;return new Promise(function(_0x40dc1b,_0x2729c2){return db[_0x3bb5('0x16')][_0x3bb5('0x17')]({'raw':_0x181b36[_0x3bb5('0x18')]?_0x181b36[_0x3bb5('0x18')][_0x3bb5('0x19')]===undefined?!![]:![]:!![],'where':_0x181b36[_0x3bb5('0x18')]?_0x181b36['options'][_0x3bb5('0x1a')]||null:null,'attributes':_0x181b36[_0x3bb5('0x18')]?_0x181b36[_0x3bb5('0x18')][_0x3bb5('0x1b')]||null:null,'limit':_0x181b36[_0x3bb5('0x18')]?_0x181b36[_0x3bb5('0x18')][_0x3bb5('0x1c')]||null:null,'include':_0x181b36[_0x3bb5('0x18')]?_0x181b36[_0x3bb5('0x18')][_0x3bb5('0x1d')]?_[_0x3bb5('0x1e')](_0x181b36[_0x3bb5('0x18')][_0x3bb5('0x1d')],function(_0x37d737){return{'model':db[_0x37d737['model']],'as':_0x37d737['as'],'attributes':_0x37d737[_0x3bb5('0x1b')],'include':_0x37d737[_0x3bb5('0x1d')]?_[_0x3bb5('0x1e')](_0x37d737[_0x3bb5('0x1d')],function(_0xf5918f){return{'model':db[_0xf5918f[_0x3bb5('0x1f')]],'as':_0xf5918f['as'],'attributes':_0xf5918f['attributes'],'include':_0xf5918f[_0x3bb5('0x1d')]?_[_0x3bb5('0x1e')](_0xf5918f['include'],function(_0x4aed1a){return{'model':db[_0x4aed1a[_0x3bb5('0x1f')]],'as':_0x4aed1a['as'],'attributes':_0x4aed1a[_0x3bb5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3bb5('0x9')](function(_0x2427b9){logger[_0x3bb5('0xa')](_0x3bb5('0x15'),_0x181b36);logger[_0x3bb5('0xd')](_0x3bb5('0x15'),_0x181b36,JSON['stringify'](_0x2427b9));_0x40dc1b(_0x2427b9);})[_0x3bb5('0x14')](function(_0x31654d){logger[_0x3bb5('0x11')](_0x3bb5('0x15'),_0x31654d[_0x3bb5('0x12')],_0x181b36);_0x2729c2(_0x1db570[_0x3bb5('0x11')](0x1f4,_0x31654d[_0x3bb5('0x12')]));});});};exports[_0x3bb5('0x20')]=function(_0x3283a3){var _0x249906=this;return new Promise(function(_0x55296d,_0x3c250c){return db[_0x3bb5('0x16')][_0x3bb5('0x21')]({'raw':_0x3283a3[_0x3bb5('0x18')]?_0x3283a3[_0x3bb5('0x18')][_0x3bb5('0x19')]===undefined?!![]:![]:!![],'where':_0x3283a3[_0x3bb5('0x18')]?_0x3283a3['options'][_0x3bb5('0x1a')]||null:null,'attributes':_0x3283a3[_0x3bb5('0x18')]?_0x3283a3['options'][_0x3bb5('0x1b')]||null:null,'include':_0x3283a3[_0x3bb5('0x18')]?_0x3283a3[_0x3bb5('0x18')][_0x3bb5('0x1d')]?_['map'](_0x3283a3[_0x3bb5('0x18')][_0x3bb5('0x1d')],function(_0x358ce9){return{'model':db[_0x358ce9[_0x3bb5('0x1f')]],'as':_0x358ce9['as'],'attributes':_0x358ce9['attributes'],'include':_0x358ce9[_0x3bb5('0x1d')]?_[_0x3bb5('0x1e')](_0x358ce9[_0x3bb5('0x1d')],function(_0x1037a3){return{'model':db[_0x1037a3[_0x3bb5('0x1f')]],'as':_0x1037a3['as'],'attributes':_0x1037a3[_0x3bb5('0x1b')],'include':_0x1037a3[_0x3bb5('0x1d')]?_[_0x3bb5('0x1e')](_0x1037a3[_0x3bb5('0x1d')],function(_0x3ab2ec){return{'model':db[_0x3ab2ec[_0x3bb5('0x1f')]],'as':_0x3ab2ec['as'],'attributes':_0x3ab2ec[_0x3bb5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x381cce){logger['info'](_0x3bb5('0x20'),_0x3283a3);logger['debug']('ShowDeskAccount',_0x3283a3,JSON[_0x3bb5('0xf')](_0x381cce));_0x55296d(_0x381cce);})[_0x3bb5('0x14')](function(_0x3377fa){logger[_0x3bb5('0x11')](_0x3bb5('0x20'),_0x3377fa[_0x3bb5('0x12')],_0x3283a3);_0x3c250c(_0x249906[_0x3bb5('0x11')](0x1f4,_0x3377fa[_0x3bb5('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 92aa0e6..d56ca72 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x461294,_0x4cb967){var _0x2d6110=function(_0x3df465){while(--_0x3df465){_0x461294['push'](_0x461294['shift']());}};_0x2d6110(++_0x4cb967);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 981d284..f0278a4 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 _0x0dcb=['STRING','sequelize','exports'];(function(_0x4b20f6,_0x109e90){var _0x284b06=function(_0x3da82c){while(--_0x3da82c){_0x4b20f6['push'](_0x4b20f6['shift']());}};_0x284b06(++_0x109e90);}(_0x0dcb,0x175));var _0xb0dc=function(_0x24aa9c,_0x5e74e0){_0x24aa9c=_0x24aa9c-0x0;var _0x9029d2=_0x0dcb[_0x24aa9c];return _0x9029d2;};'use strict';var Sequelize=require(_0xb0dc('0x0'));module[_0xb0dc('0x1')]={'name':{'type':Sequelize[_0xb0dc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 5661cba..c3587fa 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 _0xb6e9=['DeskField','getDescriptions','findOne','Tag','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','DeskConfiguration','include','rows','params','includeAll','find','catch','create','body','getFields','pick','getSubjects'];(function(_0x5e13fe,_0x339218){var _0x26f143=function(_0x2990d7){while(--_0x2990d7){_0x5e13fe['push'](_0x5e13fe['shift']());}};_0x26f143(++_0x339218);}(_0xb6e9,0x192));var _0x9b6e=function(_0x26b301,_0xb7c906){_0x26b301=_0x26b301-0x0;var _0x47a86a=_0xb6e9[_0x26b301];return _0x47a86a;};'use strict';var emlformat=require(_0x9b6e('0x0'));var rimraf=require(_0x9b6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b6e('0x2'));var moment=require(_0x9b6e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9b6e('0x4'));var util=require(_0x9b6e('0x5'));var path=require(_0x9b6e('0x6'));var sox=require(_0x9b6e('0x7'));var csv=require(_0x9b6e('0x8'));var ejs=require(_0x9b6e('0x9'));var fs=require('fs');var fs_extra=require(_0x9b6e('0xa'));var _=require(_0x9b6e('0xb'));var squel=require('squel');var crypto=require(_0x9b6e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9b6e('0xd'));var toCsv=require(_0x9b6e('0x8'));var querystring=require(_0x9b6e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9b6e('0xf'));var qs=require(_0x9b6e('0x10'));var as=require(_0x9b6e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9b6e('0x12'));var utils=require(_0x9b6e('0x13'));var config=require(_0x9b6e('0x14'));var licenseUtil=require(_0x9b6e('0x15'));var db=require(_0x9b6e('0x16'))['db'];function respondWithStatusCode(_0xa60cb5,_0x32e9d7){_0x32e9d7=_0x32e9d7||0xcc;return function(_0x389e20){if(_0x389e20){return _0xa60cb5['sendStatus'](_0x32e9d7);}return _0xa60cb5['status'](_0x32e9d7)[_0x9b6e('0x17')]();};}function respondWithResult(_0x29beb6,_0x252858){_0x252858=_0x252858||0xc8;return function(_0xc92ed2){if(_0xc92ed2){return _0x29beb6[_0x9b6e('0x18')](_0x252858)[_0x9b6e('0x19')](_0xc92ed2);}};}function respondWithFilteredResult(_0x43b3fc,_0x5f3f32){return function(_0x2b52f5){if(_0x2b52f5){var _0x2216bb=typeof _0x5f3f32['offset']===_0x9b6e('0x1a')&&typeof _0x5f3f32[_0x9b6e('0x1b')]==='undefined';var _0x332239=_0x2b52f5[_0x9b6e('0x1c')];var _0x60c6d2=_0x2216bb?0x0:_0x5f3f32[_0x9b6e('0x1d')];var _0x36c3e9=_0x2216bb?_0x2b52f5[_0x9b6e('0x1c')]:_0x5f3f32[_0x9b6e('0x1d')]+_0x5f3f32[_0x9b6e('0x1b')];var _0x13667c;if(_0x36c3e9>=_0x332239){_0x36c3e9=_0x332239;_0x13667c=0xc8;}else{_0x13667c=0xce;}_0x43b3fc['status'](_0x13667c);return _0x43b3fc[_0x9b6e('0x1e')]('Content-Range',_0x60c6d2+'-'+_0x36c3e9+'/'+_0x332239)[_0x9b6e('0x19')](_0x2b52f5);}return null;};}function patchUpdates(_0x2d8fa1){return function(_0xa6e395){try{jsonpatch[_0x9b6e('0x1f')](_0xa6e395,_0x2d8fa1,!![]);}catch(_0x34bfee){return BPromise[_0x9b6e('0x20')](_0x34bfee);}return _0xa6e395[_0x9b6e('0x21')]();};}function saveUpdates(_0x2a177b,_0x1e37de){return function(_0x3abfde){if(_0x3abfde){return _0x3abfde[_0x9b6e('0x22')](_0x2a177b)['then'](function(_0x217166){return _0x217166;});}return null;};}function removeEntity(_0x34c45e,_0x3fef45){return function(_0x3c0699){if(_0x3c0699){return _0x3c0699['destroy']()[_0x9b6e('0x23')](function(){_0x34c45e[_0x9b6e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24de95,_0x3d05cd){return function(_0x455623){if(!_0x455623){_0x24de95[_0x9b6e('0x24')](0x194);}return _0x455623;};}function handleError(_0x336bd8,_0x20e97c){_0x20e97c=_0x20e97c||0x1f4;return function(_0x1ba35a){logger['error'](_0x1ba35a[_0x9b6e('0x25')]);if(_0x1ba35a[_0x9b6e('0x26')]){delete _0x1ba35a[_0x9b6e('0x26')];}_0x336bd8[_0x9b6e('0x18')](_0x20e97c)[_0x9b6e('0x27')](_0x1ba35a);};}exports[_0x9b6e('0x28')]=function(_0x581688,_0x182c1f){var _0x2bc4c4={},_0x460e21={},_0x753727={'count':0x0,'rows':[]};var _0x5b9bbb=_[_0x9b6e('0x29')](db['DeskConfiguration'][_0x9b6e('0x2a')],function(_0x2f33e7){return{'name':_0x2f33e7['fieldName'],'type':_0x2f33e7[_0x9b6e('0x2b')]['key']};});_0x460e21[_0x9b6e('0x2c')]=_[_0x9b6e('0x29')](_0x5b9bbb,_0x9b6e('0x26'));_0x460e21[_0x9b6e('0x2d')]=_[_0x9b6e('0x2e')](_0x581688[_0x9b6e('0x2d')]);_0x460e21[_0x9b6e('0x2f')]=_[_0x9b6e('0x30')](_0x460e21['model'],_0x460e21[_0x9b6e('0x2d')]);_0x2bc4c4[_0x9b6e('0x31')]=_[_0x9b6e('0x30')](_0x460e21['model'],qs[_0x9b6e('0x32')](_0x581688[_0x9b6e('0x2d')][_0x9b6e('0x32')]));_0x2bc4c4[_0x9b6e('0x31')]=_0x2bc4c4[_0x9b6e('0x31')][_0x9b6e('0x33')]?_0x2bc4c4[_0x9b6e('0x31')]:_0x460e21[_0x9b6e('0x2c')];if(!_0x581688['query']['hasOwnProperty'](_0x9b6e('0x34'))){_0x2bc4c4[_0x9b6e('0x1b')]=qs[_0x9b6e('0x1b')](_0x581688[_0x9b6e('0x2d')][_0x9b6e('0x1b')]);_0x2bc4c4[_0x9b6e('0x1d')]=qs['offset'](_0x581688[_0x9b6e('0x2d')][_0x9b6e('0x1d')]);}_0x2bc4c4[_0x9b6e('0x35')]=qs[_0x9b6e('0x36')](_0x581688[_0x9b6e('0x2d')][_0x9b6e('0x36')]);_0x2bc4c4[_0x9b6e('0x37')]=qs[_0x9b6e('0x2f')](_['pick'](_0x581688[_0x9b6e('0x2d')],_0x460e21[_0x9b6e('0x2f')]),_0x5b9bbb);if(_0x581688[_0x9b6e('0x2d')][_0x9b6e('0x38')]){_0x2bc4c4['where']=_[_0x9b6e('0x39')](_0x2bc4c4[_0x9b6e('0x37')],{'$or':_['map'](_0x5b9bbb,function(_0x1f7b07){if(_0x1f7b07['type']!==_0x9b6e('0x3a')){var _0x5b67f4={};_0x5b67f4[_0x1f7b07[_0x9b6e('0x26')]]={'$like':'%'+_0x581688[_0x9b6e('0x2d')][_0x9b6e('0x38')]+'%'};return _0x5b67f4;}})});}_0x2bc4c4=_[_0x9b6e('0x39')]({},_0x2bc4c4,_0x581688[_0x9b6e('0x3b')]);var _0xccd78a={'where':_0x2bc4c4[_0x9b6e('0x37')]};return db[_0x9b6e('0x3c')][_0x9b6e('0x1c')](_0xccd78a)['then'](function(_0x5ce486){_0x753727['count']=_0x5ce486;if(_0x581688[_0x9b6e('0x2d')]['includeAll']){_0x2bc4c4[_0x9b6e('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x2bc4c4);})['then'](function(_0x41af73){_0x753727[_0x9b6e('0x3e')]=_0x41af73;return _0x753727;})[_0x9b6e('0x23')](respondWithFilteredResult(_0x182c1f,_0x2bc4c4))['catch'](handleError(_0x182c1f,null));};exports['show']=function(_0x33353a,_0x1a9e06){var _0x4ab9af={'raw':![],'where':{'id':_0x33353a[_0x9b6e('0x3f')]['id']}},_0x49a4f4={};_0x49a4f4[_0x9b6e('0x2c')]=_[_0x9b6e('0x2e')](db['DeskConfiguration'][_0x9b6e('0x2a')]);_0x49a4f4[_0x9b6e('0x2d')]=_['keys'](_0x33353a[_0x9b6e('0x2d')]);_0x49a4f4[_0x9b6e('0x2f')]=_[_0x9b6e('0x30')](_0x49a4f4[_0x9b6e('0x2c')],_0x49a4f4['query']);_0x4ab9af[_0x9b6e('0x31')]=_['intersection'](_0x49a4f4[_0x9b6e('0x2c')],qs[_0x9b6e('0x32')](_0x33353a[_0x9b6e('0x2d')]['fields']));_0x4ab9af['attributes']=_0x4ab9af[_0x9b6e('0x31')][_0x9b6e('0x33')]?_0x4ab9af[_0x9b6e('0x31')]:_0x49a4f4[_0x9b6e('0x2c')];if(_0x33353a['query'][_0x9b6e('0x40')]){_0x4ab9af[_0x9b6e('0x3d')]=[{'all':!![]}];}_0x4ab9af=_[_0x9b6e('0x39')]({},_0x4ab9af,_0x33353a[_0x9b6e('0x3b')]);return db[_0x9b6e('0x3c')][_0x9b6e('0x41')](_0x4ab9af)[_0x9b6e('0x23')](handleEntityNotFound(_0x1a9e06,null))[_0x9b6e('0x23')](respondWithResult(_0x1a9e06,null))[_0x9b6e('0x42')](handleError(_0x1a9e06,null));};exports[_0x9b6e('0x43')]=function(_0x1744f8,_0x5da0d4){return db[_0x9b6e('0x3c')][_0x9b6e('0x43')](_0x1744f8[_0x9b6e('0x44')],{})[_0x9b6e('0x23')](respondWithResult(_0x5da0d4,0xc9))[_0x9b6e('0x42')](handleError(_0x5da0d4,null));};exports[_0x9b6e('0x22')]=function(_0x3a4a57,_0x1dc019){if(_0x3a4a57['body']['id']){delete _0x3a4a57[_0x9b6e('0x44')]['id'];}return db[_0x9b6e('0x3c')][_0x9b6e('0x41')]({'where':{'id':_0x3a4a57[_0x9b6e('0x3f')]['id']}})[_0x9b6e('0x23')](handleEntityNotFound(_0x1dc019,null))[_0x9b6e('0x23')](saveUpdates(_0x3a4a57[_0x9b6e('0x44')],null))[_0x9b6e('0x23')](respondWithResult(_0x1dc019,null))[_0x9b6e('0x42')](handleError(_0x1dc019,null));};exports['destroy']=function(_0x58c71e,_0x2606c6){return db['DeskConfiguration'][_0x9b6e('0x41')]({'where':{'id':_0x58c71e[_0x9b6e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2606c6,null))[_0x9b6e('0x23')](removeEntity(_0x2606c6,null))[_0x9b6e('0x42')](handleError(_0x2606c6,null));};exports[_0x9b6e('0x45')]=function(_0x56ebd4,_0x5b529a,_0x42ecf1){var _0x302cff={};var _0x4fce3d={};var _0x32ea0b;var _0x4a468e;return db[_0x9b6e('0x3c')]['findOne']({'where':{'id':_0x56ebd4['params']['id']}})[_0x9b6e('0x23')](handleEntityNotFound(_0x5b529a,null))['then'](function(_0x52d305){if(_0x52d305){_0x32ea0b=_0x52d305;_0x4fce3d[_0x9b6e('0x2c')]=_[_0x9b6e('0x2e')](db['DeskField']['rawAttributes']);_0x4fce3d[_0x9b6e('0x2d')]=_[_0x9b6e('0x2e')](_0x56ebd4['query']);_0x4fce3d[_0x9b6e('0x2f')]=_[_0x9b6e('0x30')](_0x4fce3d[_0x9b6e('0x2c')],_0x4fce3d[_0x9b6e('0x2d')]);_0x302cff[_0x9b6e('0x31')]=_[_0x9b6e('0x30')](_0x4fce3d[_0x9b6e('0x2c')],qs['fields'](_0x56ebd4[_0x9b6e('0x2d')][_0x9b6e('0x32')]));_0x302cff[_0x9b6e('0x31')]=_0x302cff[_0x9b6e('0x31')][_0x9b6e('0x33')]?_0x302cff[_0x9b6e('0x31')]:_0x4fce3d[_0x9b6e('0x2c')];_0x302cff[_0x9b6e('0x35')]=qs[_0x9b6e('0x36')](_0x56ebd4[_0x9b6e('0x2d')]['sort']);_0x302cff[_0x9b6e('0x37')]=qs[_0x9b6e('0x2f')](_[_0x9b6e('0x46')](_0x56ebd4[_0x9b6e('0x2d')],_0x4fce3d[_0x9b6e('0x2f')]));if(_0x56ebd4[_0x9b6e('0x2d')][_0x9b6e('0x38')]){_0x302cff[_0x9b6e('0x37')]=_[_0x9b6e('0x39')](_0x302cff['where'],{'$or':_[_0x9b6e('0x29')](_0x302cff[_0x9b6e('0x31')],function(_0x1a254d){var _0x69b28c={};_0x69b28c[_0x1a254d]={'$like':'%'+_0x56ebd4['query'][_0x9b6e('0x38')]+'%'};return _0x69b28c;})});}_0x302cff=_['merge']({},_0x302cff,_0x56ebd4[_0x9b6e('0x3b')]);return _0x32ea0b['getFields'](_0x302cff);}})[_0x9b6e('0x23')](function(_0x4cd20b){if(_0x4cd20b){_0x4a468e=_0x4cd20b[_0x9b6e('0x33')];if(!_0x56ebd4[_0x9b6e('0x2d')]['hasOwnProperty'](_0x9b6e('0x34'))){_0x302cff[_0x9b6e('0x1b')]=qs['limit'](_0x56ebd4['query']['limit']);_0x302cff[_0x9b6e('0x1d')]=qs[_0x9b6e('0x1d')](_0x56ebd4['query']['offset']);}return _0x32ea0b[_0x9b6e('0x45')](_0x302cff);}})[_0x9b6e('0x23')](function(_0xfdb707){if(_0xfdb707){return _0xfdb707?{'count':_0x4a468e,'rows':_0xfdb707}:null;}})[_0x9b6e('0x23')](respondWithResult(_0x5b529a,null))['catch'](handleError(_0x5b529a,null));};exports[_0x9b6e('0x47')]=function(_0x29d6ae,_0x4b93b4,_0x3e6960){var _0x435c44={};var _0x281b88={};var _0x5ec168;var _0x536bc1;return db[_0x9b6e('0x3c')]['findOne']({'where':{'id':_0x29d6ae[_0x9b6e('0x3f')]['id']}})[_0x9b6e('0x23')](handleEntityNotFound(_0x4b93b4,null))[_0x9b6e('0x23')](function(_0x1a25ca){if(_0x1a25ca){_0x5ec168=_0x1a25ca;_0x281b88[_0x9b6e('0x2c')]=_['keys'](db[_0x9b6e('0x48')][_0x9b6e('0x2a')]);_0x281b88[_0x9b6e('0x2d')]=_[_0x9b6e('0x2e')](_0x29d6ae[_0x9b6e('0x2d')]);_0x281b88[_0x9b6e('0x2f')]=_[_0x9b6e('0x30')](_0x281b88[_0x9b6e('0x2c')],_0x281b88['query']);_0x435c44[_0x9b6e('0x31')]=_[_0x9b6e('0x30')](_0x281b88[_0x9b6e('0x2c')],qs[_0x9b6e('0x32')](_0x29d6ae[_0x9b6e('0x2d')][_0x9b6e('0x32')]));_0x435c44['attributes']=_0x435c44[_0x9b6e('0x31')][_0x9b6e('0x33')]?_0x435c44[_0x9b6e('0x31')]:_0x281b88['model'];_0x435c44['order']=qs[_0x9b6e('0x36')](_0x29d6ae[_0x9b6e('0x2d')]['sort']);_0x435c44[_0x9b6e('0x37')]=qs[_0x9b6e('0x2f')](_[_0x9b6e('0x46')](_0x29d6ae['query'],_0x281b88['filters']));if(_0x29d6ae[_0x9b6e('0x2d')]['filter']){_0x435c44[_0x9b6e('0x37')]=_[_0x9b6e('0x39')](_0x435c44[_0x9b6e('0x37')],{'$or':_['map'](_0x435c44[_0x9b6e('0x31')],function(_0x18329d){var _0x2c41d6={};_0x2c41d6[_0x18329d]={'$like':'%'+_0x29d6ae[_0x9b6e('0x2d')][_0x9b6e('0x38')]+'%'};return _0x2c41d6;})});}_0x435c44=_[_0x9b6e('0x39')]({},_0x435c44,_0x29d6ae[_0x9b6e('0x3b')]);return _0x5ec168[_0x9b6e('0x47')](_0x435c44);}})[_0x9b6e('0x23')](function(_0x20a4ba){if(_0x20a4ba){_0x536bc1=_0x20a4ba[_0x9b6e('0x33')];if(!_0x29d6ae[_0x9b6e('0x2d')]['hasOwnProperty'](_0x9b6e('0x34'))){_0x435c44[_0x9b6e('0x1b')]=qs[_0x9b6e('0x1b')](_0x29d6ae[_0x9b6e('0x2d')]['limit']);_0x435c44['offset']=qs[_0x9b6e('0x1d')](_0x29d6ae[_0x9b6e('0x2d')][_0x9b6e('0x1d')]);}return _0x5ec168[_0x9b6e('0x47')](_0x435c44);}})[_0x9b6e('0x23')](function(_0x399b52){if(_0x399b52){return _0x399b52?{'count':_0x536bc1,'rows':_0x399b52}:null;}})[_0x9b6e('0x23')](respondWithResult(_0x4b93b4,null))[_0x9b6e('0x42')](handleError(_0x4b93b4,null));};exports[_0x9b6e('0x49')]=function(_0x5d4f57,_0x30f0e6,_0x4d3935){var _0x45c6f9={};var _0x54e970={};var _0x3dee01;var _0x2b7615;return db[_0x9b6e('0x3c')][_0x9b6e('0x4a')]({'where':{'id':_0x5d4f57[_0x9b6e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x30f0e6,null))[_0x9b6e('0x23')](function(_0x396ffb){if(_0x396ffb){_0x3dee01=_0x396ffb;_0x54e970['model']=_['keys'](db[_0x9b6e('0x48')]['rawAttributes']);_0x54e970['query']=_[_0x9b6e('0x2e')](_0x5d4f57[_0x9b6e('0x2d')]);_0x54e970[_0x9b6e('0x2f')]=_[_0x9b6e('0x30')](_0x54e970[_0x9b6e('0x2c')],_0x54e970[_0x9b6e('0x2d')]);_0x45c6f9['attributes']=_['intersection'](_0x54e970[_0x9b6e('0x2c')],qs[_0x9b6e('0x32')](_0x5d4f57[_0x9b6e('0x2d')][_0x9b6e('0x32')]));_0x45c6f9[_0x9b6e('0x31')]=_0x45c6f9[_0x9b6e('0x31')]['length']?_0x45c6f9['attributes']:_0x54e970['model'];_0x45c6f9[_0x9b6e('0x35')]=qs[_0x9b6e('0x36')](_0x5d4f57[_0x9b6e('0x2d')][_0x9b6e('0x36')]);_0x45c6f9['where']=qs[_0x9b6e('0x2f')](_[_0x9b6e('0x46')](_0x5d4f57[_0x9b6e('0x2d')],_0x54e970[_0x9b6e('0x2f')]));if(_0x5d4f57[_0x9b6e('0x2d')][_0x9b6e('0x38')]){_0x45c6f9[_0x9b6e('0x37')]=_[_0x9b6e('0x39')](_0x45c6f9[_0x9b6e('0x37')],{'$or':_['map'](_0x45c6f9[_0x9b6e('0x31')],function(_0x13cb0e){var _0x5d5e97={};_0x5d5e97[_0x13cb0e]={'$like':'%'+_0x5d4f57[_0x9b6e('0x2d')][_0x9b6e('0x38')]+'%'};return _0x5d5e97;})});}_0x45c6f9=_[_0x9b6e('0x39')]({},_0x45c6f9,_0x5d4f57['options']);return _0x3dee01[_0x9b6e('0x49')](_0x45c6f9);}})[_0x9b6e('0x23')](function(_0x38d673){if(_0x38d673){_0x2b7615=_0x38d673[_0x9b6e('0x33')];if(!_0x5d4f57[_0x9b6e('0x2d')]['hasOwnProperty'](_0x9b6e('0x34'))){_0x45c6f9['limit']=qs[_0x9b6e('0x1b')](_0x5d4f57['query']['limit']);_0x45c6f9[_0x9b6e('0x1d')]=qs[_0x9b6e('0x1d')](_0x5d4f57[_0x9b6e('0x2d')][_0x9b6e('0x1d')]);}return _0x3dee01['getDescriptions'](_0x45c6f9);}})[_0x9b6e('0x23')](function(_0x562128){if(_0x562128){return _0x562128?{'count':_0x2b7615,'rows':_0x562128}:null;}})[_0x9b6e('0x23')](respondWithResult(_0x30f0e6,null))['catch'](handleError(_0x30f0e6,null));};exports['getTags']=function(_0x37aab0,_0x154763,_0x596203){var _0x13aefb={};var _0x3a7e89={};var _0x1a34b0;var _0x1df9ff;return db[_0x9b6e('0x3c')][_0x9b6e('0x4a')]({'where':{'id':_0x37aab0['params']['id']}})[_0x9b6e('0x23')](handleEntityNotFound(_0x154763,null))['then'](function(_0x626b9d){if(_0x626b9d){_0x1a34b0=_0x626b9d;_0x3a7e89[_0x9b6e('0x2c')]=_[_0x9b6e('0x2e')](db[_0x9b6e('0x4b')][_0x9b6e('0x2a')]);_0x3a7e89[_0x9b6e('0x2d')]=_[_0x9b6e('0x2e')](_0x37aab0['query']);_0x3a7e89[_0x9b6e('0x2f')]=_[_0x9b6e('0x30')](_0x3a7e89['model'],_0x3a7e89[_0x9b6e('0x2d')]);_0x13aefb[_0x9b6e('0x31')]=_[_0x9b6e('0x30')](_0x3a7e89['model'],qs[_0x9b6e('0x32')](_0x37aab0[_0x9b6e('0x2d')]['fields']));_0x13aefb[_0x9b6e('0x31')]=_0x13aefb['attributes'][_0x9b6e('0x33')]?_0x13aefb[_0x9b6e('0x31')]:_0x3a7e89[_0x9b6e('0x2c')];_0x13aefb[_0x9b6e('0x35')]=qs['sort'](_0x37aab0['query'][_0x9b6e('0x36')]);_0x13aefb['where']=qs['filters'](_[_0x9b6e('0x46')](_0x37aab0['query'],_0x3a7e89[_0x9b6e('0x2f')]));if(_0x37aab0[_0x9b6e('0x2d')][_0x9b6e('0x38')]){_0x13aefb[_0x9b6e('0x37')]=_['merge'](_0x13aefb[_0x9b6e('0x37')],{'$or':_[_0x9b6e('0x29')](_0x13aefb[_0x9b6e('0x31')],function(_0x433d9e){var _0x46d3b9={};_0x46d3b9[_0x433d9e]={'$like':'%'+_0x37aab0['query'][_0x9b6e('0x38')]+'%'};return _0x46d3b9;})});}_0x13aefb=_[_0x9b6e('0x39')]({},_0x13aefb,_0x37aab0[_0x9b6e('0x3b')]);return _0x1a34b0[_0x9b6e('0x4c')](_0x13aefb);}})[_0x9b6e('0x23')](function(_0x4f2075){if(_0x4f2075){_0x1df9ff=_0x4f2075[_0x9b6e('0x33')];if(!_0x37aab0['query']['hasOwnProperty'](_0x9b6e('0x34'))){_0x13aefb[_0x9b6e('0x1b')]=qs['limit'](_0x37aab0['query'][_0x9b6e('0x1b')]);_0x13aefb[_0x9b6e('0x1d')]=qs[_0x9b6e('0x1d')](_0x37aab0[_0x9b6e('0x2d')][_0x9b6e('0x1d')]);}return _0x1a34b0[_0x9b6e('0x4c')](_0x13aefb);}})['then'](function(_0x30729){if(_0x30729){return _0x30729?{'count':_0x1df9ff,'rows':_0x30729}:null;}})[_0x9b6e('0x23')](respondWithResult(_0x154763,null))[_0x9b6e('0x42')](handleError(_0x154763,null));};exports[_0x9b6e('0x4d')]=function(_0x18f1c0,_0x25208b,_0x37deed){if(_0x18f1c0[_0x9b6e('0x44')]['id']){delete _0x18f1c0[_0x9b6e('0x44')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x18f1c0[_0x9b6e('0x3f')]['id']}})[_0x9b6e('0x23')](handleEntityNotFound(_0x25208b,null))[_0x9b6e('0x23')](function(_0x2a46de){if(_0x2a46de){return _0x2a46de[_0x9b6e('0x4d')](_0x18f1c0['body'][_0x9b6e('0x4e')]||[]);}return null;})[_0x9b6e('0x23')](respondWithResult(_0x25208b,null))[_0x9b6e('0x42')](handleError(_0x25208b,null));}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5ed640d..274bf25 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 _0x8eea=['int_desk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8eea,0xd2));var _0xa8ee=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x8eea[_0xa2b098];return _0x29502e;};'use strict';var _=require(_0xa8ee('0x0'));var util=require('util');var logger=require(_0xa8ee('0x1'))(_0xa8ee('0x2'));var moment=require(_0xa8ee('0x3'));var BPromise=require(_0xa8ee('0x4'));var rp=require(_0xa8ee('0x5'));var fs=require('fs');var path=require(_0xa8ee('0x6'));var rimraf=require(_0xa8ee('0x7'));var config=require(_0xa8ee('0x8'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x121281,_0x5aac49){return _0x121281[_0xa8ee('0x9')]('DeskConfiguration',attributes,{'tableName':_0xa8ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index d8792b6..8d412df 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 _0x26bd=['info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x51aa5b,_0x512fc0){var _0x5066d8=function(_0x2bdda9){while(--_0x2bdda9){_0x51aa5b['push'](_0x51aa5b['shift']());}};_0x5066d8(++_0x512fc0);}(_0x26bd,0xaa));var _0xd26b=function(_0x495f78,_0x2c3a7b){_0x495f78=_0x495f78-0x0;var _0x4af069=_0x26bd[_0x495f78];return _0x4af069;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var moment=require(_0xd26b('0x2'));var BPromise=require(_0xd26b('0x3'));var rs=require(_0xd26b('0x4'));var fs=require('fs');var Redis=require(_0xd26b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd26b('0x6'));var logger=require(_0xd26b('0x7'))(_0xd26b('0x8'));var config=require(_0xd26b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd26b('0xa')][_0xd26b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x362214,_0xebc7c8,_0x5555f6){return new BPromise(function(_0xe77d9b,_0x245128){return client[_0xd26b('0xc')](_0x362214,_0x5555f6)[_0xd26b('0xd')](function(_0x363802){logger[_0xd26b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0xd26b('0xf'));logger['debug'](_0xd26b('0x10'),_0xebc7c8,_0xd26b('0xf'),JSON[_0xd26b('0x11')](_0x363802));if(_0x363802[_0xd26b('0x12')]){if(_0x363802[_0xd26b('0x12')][_0xd26b('0x13')]===0x1f4){logger[_0xd26b('0x12')](_0xd26b('0x14'),_0xebc7c8,_0x363802[_0xd26b('0x12')]['message']);return _0x245128(_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);return _0xe77d9b(_0x363802[_0xd26b('0x12')][_0xd26b('0x15')]);}else{logger[_0xd26b('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0xd26b('0xf'));_0xe77d9b(_0x363802['result'][_0xd26b('0x15')]);}})[_0xd26b('0x16')](function(_0x81ccdc){logger[_0xd26b('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xebc7c8,_0x81ccdc);_0x245128(_0x81ccdc);});});} \ No newline at end of file +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 diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index fb4b4b5..7993d31 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 _0x7d9b=['create','put','/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','show','post'];(function(_0x15098c,_0x55b5e4){var _0x6af41=function(_0x1eed08){while(--_0x1eed08){_0x15098c['push'](_0x15098c['shift']());}};_0x6af41(++_0x55b5e4);}(_0x7d9b,0x126));var _0xb7d9=function(_0x66f455,_0x43978d){_0x66f455=_0x66f455-0x0;var _0x2f4d67=_0x7d9b[_0x66f455];return _0x2f4d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb7d9('0x0'));var timeout=require(_0xb7d9('0x1'));var express=require(_0xb7d9('0x2'));var router=express[_0xb7d9('0x3')]();var fs_extra=require(_0xb7d9('0x4'));var auth=require(_0xb7d9('0x5'));var interaction=require(_0xb7d9('0x6'));var config=require('../../config/environment');var controller=require(_0xb7d9('0x7'));router[_0xb7d9('0x8')]('/',auth[_0xb7d9('0x9')](),controller['index']);router[_0xb7d9('0x8')]('/:id',auth[_0xb7d9('0x9')](),controller[_0xb7d9('0xa')]);router[_0xb7d9('0xb')]('/',auth[_0xb7d9('0x9')](),controller[_0xb7d9('0xc')]);router[_0xb7d9('0xd')](_0xb7d9('0xe'),auth[_0xb7d9('0x9')](),controller['update']);router[_0xb7d9('0xf')](_0xb7d9('0xe'),auth[_0xb7d9('0x9')](),controller[_0xb7d9('0x10')]);module[_0xb7d9('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 596ad1d..ea3502a 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 _0x22ac=['string','STRING','ENUM','sequelize','exports','variable','customVariable'];(function(_0x1f1230,_0x12ae82){var _0x3ab793=function(_0x1f62f1){while(--_0x1f62f1){_0x1f1230['push'](_0x1f1230['shift']());}};_0x3ab793(++_0x12ae82);}(_0x22ac,0x129));var _0xc22a=function(_0x4c587a,_0x3bf54a){_0x4c587a=_0x4c587a-0x0;var _0x3e66fc=_0x22ac[_0x4c587a];return _0x3e66fc;};'use strict';var Sequelize=require(_0xc22a('0x0'));module[_0xc22a('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xc22a('0x2'),_0xc22a('0x3'),'keyValue','picklist'),'defaultValue':_0xc22a('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc22a('0x5')]},'keyType':{'type':Sequelize[_0xc22a('0x6')](_0xc22a('0x4'),'variable',_0xc22a('0x3'))},'keyContent':{'type':Sequelize[_0xc22a('0x5')]},'idField':{'type':Sequelize[_0xc22a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 8a26a91..4c272cb 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 _0x8cc1=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','name','index','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','intersection','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1a809c,_0x199a58){var _0x533174=function(_0x18e72e){while(--_0x18e72e){_0x1a809c['push'](_0x1a809c['shift']());}};_0x533174(++_0x199a58);}(_0x8cc1,0x14e));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x18cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18cc('0x1'));var rp=require(_0x18cc('0x2'));var moment=require(_0x18cc('0x3'));var BPromise=require(_0x18cc('0x4'));var Mustache=require('mustache');var util=require(_0x18cc('0x5'));var path=require('path');var sox=require(_0x18cc('0x6'));var csv=require(_0x18cc('0x7'));var ejs=require(_0x18cc('0x8'));var fs=require('fs');var fs_extra=require(_0x18cc('0x9'));var _=require(_0x18cc('0xa'));var squel=require('squel');var crypto=require(_0x18cc('0xb'));var jsforce=require(_0x18cc('0xc'));var deskjs=require(_0x18cc('0xd'));var toCsv=require(_0x18cc('0x7'));var querystring=require(_0x18cc('0xe'));var Papa=require(_0x18cc('0xf'));var Redis=require('ioredis');var authService=require(_0x18cc('0x10'));var qs=require(_0x18cc('0x11'));var as=require(_0x18cc('0x12'));var hardwareService=require(_0x18cc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x18cc('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x18cc('0x15'))['db'];function respondWithStatusCode(_0x38bedc,_0x1903d6){_0x1903d6=_0x1903d6||0xcc;return function(_0x4b0720){if(_0x4b0720){return _0x38bedc[_0x18cc('0x16')](_0x1903d6);}return _0x38bedc[_0x18cc('0x17')](_0x1903d6)['end']();};}function respondWithResult(_0x5c6d68,_0x27394f){_0x27394f=_0x27394f||0xc8;return function(_0x5ccbd4){if(_0x5ccbd4){return _0x5c6d68[_0x18cc('0x17')](_0x27394f)['json'](_0x5ccbd4);}};}function respondWithFilteredResult(_0x24e72b,_0x5dfd5c){return function(_0x343807){if(_0x343807){var _0x439e57=typeof _0x5dfd5c[_0x18cc('0x18')]==='undefined'&&typeof _0x5dfd5c[_0x18cc('0x19')]==='undefined';var _0x4bda78=_0x343807[_0x18cc('0x1a')];var _0x104fc4=_0x439e57?0x0:_0x5dfd5c[_0x18cc('0x18')];var _0x19884a=_0x439e57?_0x343807['count']:_0x5dfd5c[_0x18cc('0x18')]+_0x5dfd5c[_0x18cc('0x19')];var _0x201b2b;if(_0x19884a>=_0x4bda78){_0x19884a=_0x4bda78;_0x201b2b=0xc8;}else{_0x201b2b=0xce;}_0x24e72b[_0x18cc('0x17')](_0x201b2b);return _0x24e72b[_0x18cc('0x1b')](_0x18cc('0x1c'),_0x104fc4+'-'+_0x19884a+'/'+_0x4bda78)[_0x18cc('0x1d')](_0x343807);}return null;};}function patchUpdates(_0x313277){return function(_0x44adfa){try{jsonpatch[_0x18cc('0x1e')](_0x44adfa,_0x313277,!![]);}catch(_0x1259ca){return BPromise[_0x18cc('0x1f')](_0x1259ca);}return _0x44adfa[_0x18cc('0x20')]();};}function saveUpdates(_0x1f1abf,_0x244f3c){return function(_0x2ce670){if(_0x2ce670){return _0x2ce670[_0x18cc('0x21')](_0x1f1abf)[_0x18cc('0x22')](function(_0x2a19cf){return _0x2a19cf;});}return null;};}function removeEntity(_0x53ae78,_0x4b2358){return function(_0x2729b1){if(_0x2729b1){return _0x2729b1['destroy']()['then'](function(){_0x53ae78[_0x18cc('0x17')](0xcc)[_0x18cc('0x23')]();});}};}function handleEntityNotFound(_0x8ebbf4,_0x444c19){return function(_0x2591cf){if(!_0x2591cf){_0x8ebbf4[_0x18cc('0x16')](0x194);}return _0x2591cf;};}function handleError(_0x12cb3c,_0xaccd85){_0xaccd85=_0xaccd85||0x1f4;return function(_0x217793){logger['error'](_0x217793['stack']);if(_0x217793[_0x18cc('0x24')]){delete _0x217793[_0x18cc('0x24')];}_0x12cb3c[_0x18cc('0x17')](_0xaccd85)['send'](_0x217793);};}exports[_0x18cc('0x25')]=function(_0x4e3970,_0x1c5964){var _0x378fb6={},_0x3f1a24={},_0x206175={'count':0x0,'rows':[]};var _0x2cab1e=_[_0x18cc('0x26')](db[_0x18cc('0x27')][_0x18cc('0x28')],function(_0x50af21){return{'name':_0x50af21[_0x18cc('0x29')],'type':_0x50af21[_0x18cc('0x2a')]['key']};});_0x3f1a24[_0x18cc('0x2b')]=_[_0x18cc('0x26')](_0x2cab1e,_0x18cc('0x24'));_0x3f1a24[_0x18cc('0x2c')]=_[_0x18cc('0x2d')](_0x4e3970[_0x18cc('0x2c')]);_0x3f1a24[_0x18cc('0x2e')]=_['intersection'](_0x3f1a24['model'],_0x3f1a24[_0x18cc('0x2c')]);_0x378fb6[_0x18cc('0x2f')]=_['intersection'](_0x3f1a24['model'],qs[_0x18cc('0x30')](_0x4e3970[_0x18cc('0x2c')][_0x18cc('0x30')]));_0x378fb6[_0x18cc('0x2f')]=_0x378fb6[_0x18cc('0x2f')][_0x18cc('0x31')]?_0x378fb6['attributes']:_0x3f1a24[_0x18cc('0x2b')];if(!_0x4e3970[_0x18cc('0x2c')][_0x18cc('0x32')](_0x18cc('0x33'))){_0x378fb6[_0x18cc('0x19')]=qs['limit'](_0x4e3970[_0x18cc('0x2c')][_0x18cc('0x19')]);_0x378fb6[_0x18cc('0x18')]=qs[_0x18cc('0x18')](_0x4e3970[_0x18cc('0x2c')][_0x18cc('0x18')]);}_0x378fb6[_0x18cc('0x34')]=qs['sort'](_0x4e3970[_0x18cc('0x2c')][_0x18cc('0x35')]);_0x378fb6['where']=qs[_0x18cc('0x2e')](_[_0x18cc('0x36')](_0x4e3970[_0x18cc('0x2c')],_0x3f1a24[_0x18cc('0x2e')]),_0x2cab1e);if(_0x4e3970[_0x18cc('0x2c')]['filter']){_0x378fb6[_0x18cc('0x37')]=_[_0x18cc('0x38')](_0x378fb6[_0x18cc('0x37')],{'$or':_['map'](_0x2cab1e,function(_0x519fb1){if(_0x519fb1[_0x18cc('0x2a')]!==_0x18cc('0x39')){var _0x4b679c={};_0x4b679c[_0x519fb1[_0x18cc('0x24')]]={'$like':'%'+_0x4e3970[_0x18cc('0x2c')][_0x18cc('0x3a')]+'%'};return _0x4b679c;}})});}_0x378fb6=_[_0x18cc('0x38')]({},_0x378fb6,_0x4e3970[_0x18cc('0x3b')]);var _0x508e64={'where':_0x378fb6[_0x18cc('0x37')]};return db[_0x18cc('0x27')][_0x18cc('0x1a')](_0x508e64)[_0x18cc('0x22')](function(_0x384dff){_0x206175[_0x18cc('0x1a')]=_0x384dff;if(_0x4e3970['query'][_0x18cc('0x3c')]){_0x378fb6[_0x18cc('0x3d')]=[{'all':!![]}];}return db[_0x18cc('0x27')]['findAll'](_0x378fb6);})[_0x18cc('0x22')](function(_0xb12dee){_0x206175[_0x18cc('0x3e')]=_0xb12dee;return _0x206175;})[_0x18cc('0x22')](respondWithFilteredResult(_0x1c5964,_0x378fb6))[_0x18cc('0x3f')](handleError(_0x1c5964,null));};exports[_0x18cc('0x40')]=function(_0x281774,_0x1dc24f){var _0x257e1e={'raw':!![],'where':{'id':_0x281774[_0x18cc('0x41')]['id']}},_0x175062={};_0x175062[_0x18cc('0x2b')]=_[_0x18cc('0x2d')](db[_0x18cc('0x27')][_0x18cc('0x28')]);_0x175062[_0x18cc('0x2c')]=_[_0x18cc('0x2d')](_0x281774[_0x18cc('0x2c')]);_0x175062[_0x18cc('0x2e')]=_['intersection'](_0x175062[_0x18cc('0x2b')],_0x175062[_0x18cc('0x2c')]);_0x257e1e[_0x18cc('0x2f')]=_[_0x18cc('0x42')](_0x175062[_0x18cc('0x2b')],qs[_0x18cc('0x30')](_0x281774[_0x18cc('0x2c')]['fields']));_0x257e1e[_0x18cc('0x2f')]=_0x257e1e[_0x18cc('0x2f')]['length']?_0x257e1e[_0x18cc('0x2f')]:_0x175062[_0x18cc('0x2b')];if(_0x281774['query']['includeAll']){_0x257e1e[_0x18cc('0x3d')]=[{'all':!![]}];}_0x257e1e=_[_0x18cc('0x38')]({},_0x257e1e,_0x281774[_0x18cc('0x3b')]);return db[_0x18cc('0x27')]['find'](_0x257e1e)[_0x18cc('0x22')](handleEntityNotFound(_0x1dc24f,null))[_0x18cc('0x22')](respondWithResult(_0x1dc24f,null))[_0x18cc('0x3f')](handleError(_0x1dc24f,null));};exports[_0x18cc('0x43')]=function(_0x172867,_0x3566bb){return db[_0x18cc('0x27')]['create'](_0x172867[_0x18cc('0x44')],{})['then'](respondWithResult(_0x3566bb,0xc9))[_0x18cc('0x3f')](handleError(_0x3566bb,null));};exports[_0x18cc('0x21')]=function(_0x3a498a,_0x470709){if(_0x3a498a[_0x18cc('0x44')]['id']){delete _0x3a498a[_0x18cc('0x44')]['id'];}return db[_0x18cc('0x27')][_0x18cc('0x45')]({'where':{'id':_0x3a498a[_0x18cc('0x41')]['id']}})[_0x18cc('0x22')](handleEntityNotFound(_0x470709,null))[_0x18cc('0x22')](saveUpdates(_0x3a498a[_0x18cc('0x44')],null))[_0x18cc('0x22')](respondWithResult(_0x470709,null))[_0x18cc('0x3f')](handleError(_0x470709,null));};exports['destroy']=function(_0x392818,_0x519a91){return db['DeskField']['find']({'where':{'id':_0x392818['params']['id']}})[_0x18cc('0x22')](handleEntityNotFound(_0x519a91,null))[_0x18cc('0x22')](removeEntity(_0x519a91,null))[_0x18cc('0x3f')](handleError(_0x519a91,null));}; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3d4a336..cbc6141 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 _0xe85f=['int_desk_fields','util','../../config/logger','api','path','../../config/environment','define','DeskField'];(function(_0x578bf1,_0x184453){var _0x5be0e1=function(_0xd51b9d){while(--_0xd51b9d){_0x578bf1['push'](_0x578bf1['shift']());}};_0x5be0e1(++_0x184453);}(_0xe85f,0x141));var _0xfe85=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xe85f[_0x1b2ff7];return _0x31656a;};'use strict';var _=require('lodash');var util=require(_0xfe85('0x0'));var logger=require(_0xfe85('0x1'))(_0xfe85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe85('0x3'));var rimraf=require('rimraf');var config=require(_0xfe85('0x4'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x3df5bf,_0x29268a){return _0x3df5bf[_0xfe85('0x5')](_0xfe85('0x6'),attributes,{'tableName':_0xfe85('0x7'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 9ab4cd1..cc9ff7f 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 _0xb501=['jayson/promise','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5477ee,_0x242ee5){var _0x34c663=function(_0x339072){while(--_0x339072){_0x5477ee['push'](_0x5477ee['shift']());}};_0x34c663(++_0x242ee5);}(_0xb501,0x69));var _0x1b50=function(_0xef9421,_0x2b855d){_0xef9421=_0xef9421-0x0;var _0x4537fc=_0xb501[_0xef9421];return _0x4537fc;};'use strict';var _=require(_0x1b50('0x0'));var util=require(_0x1b50('0x1'));var moment=require(_0x1b50('0x2'));var BPromise=require(_0x1b50('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b50('0x4'));var db=require(_0x1b50('0x5'))['db'];var utils=require(_0x1b50('0x6'));var logger=require(_0x1b50('0x7'))(_0x1b50('0x8'));var config=require('../../config/environment');var jayson=require(_0x1b50('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35e8ae,_0x360706,_0x4e1536){return new BPromise(function(_0x261f73,_0x344c03){return client[_0x1b50('0xa')](_0x35e8ae,_0x4e1536)['then'](function(_0x2ce469){logger['info'](_0x1b50('0xb'),_0x360706,_0x1b50('0xc'));logger[_0x1b50('0xd')](_0x1b50('0xe'),_0x360706,'request\x20sent',JSON[_0x1b50('0xf')](_0x2ce469));if(_0x2ce469['error']){if(_0x2ce469[_0x1b50('0x10')][_0x1b50('0x11')]===0x1f4){logger[_0x1b50('0x10')]('DeskField,\x20%s,\x20%s',_0x360706,_0x2ce469[_0x1b50('0x10')][_0x1b50('0x12')]);return _0x344c03(_0x2ce469[_0x1b50('0x10')][_0x1b50('0x12')]);}logger['error'](_0x1b50('0xb'),_0x360706,_0x2ce469[_0x1b50('0x10')]['message']);return _0x261f73(_0x2ce469[_0x1b50('0x10')][_0x1b50('0x12')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x360706,_0x1b50('0xc'));_0x261f73(_0x2ce469['result'][_0x1b50('0x12')]);}})['catch'](function(_0x15fb8c){logger[_0x1b50('0x10')](_0x1b50('0xb'),_0x360706,_0x15fb8c);_0x344c03(_0x15fb8c);});});} \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 37a8cc6..ea14810 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 _0xbbb2=['show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id'];(function(_0x1ac9b6,_0xe2449a){var _0xa0d863=function(_0x1eea3a){while(--_0x1eea3a){_0x1ac9b6['push'](_0x1ac9b6['shift']());}};_0xa0d863(++_0xe2449a);}(_0xbbb2,0x1d8));var _0x2bbb=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xbbb2[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x2bbb('0x0'));var util=require(_0x2bbb('0x1'));var path=require('path');var timeout=require(_0x2bbb('0x2'));var express=require(_0x2bbb('0x3'));var router=express[_0x2bbb('0x4')]();var fs_extra=require(_0x2bbb('0x5'));var auth=require(_0x2bbb('0x6'));var interaction=require(_0x2bbb('0x7'));var config=require(_0x2bbb('0x8'));var controller=require(_0x2bbb('0x9'));router[_0x2bbb('0xa')]('/',auth[_0x2bbb('0xb')](),controller[_0x2bbb('0xc')]);router[_0x2bbb('0xa')](_0x2bbb('0xd'),auth[_0x2bbb('0xb')](),controller[_0x2bbb('0xe')]);router[_0x2bbb('0xa')]('/:id/configurations',auth[_0x2bbb('0xb')](),controller[_0x2bbb('0xf')]);router[_0x2bbb('0xa')](_0x2bbb('0x10'),auth[_0x2bbb('0xb')](),controller[_0x2bbb('0x11')]);router['post']('/',auth[_0x2bbb('0xb')](),controller[_0x2bbb('0x12')]);router[_0x2bbb('0x13')](_0x2bbb('0x14'),auth[_0x2bbb('0xb')](),controller[_0x2bbb('0x15')]);router[_0x2bbb('0x16')](_0x2bbb('0xd'),auth[_0x2bbb('0xb')](),controller[_0x2bbb('0x17')]);router[_0x2bbb('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x2bbb('0x19')]);module[_0x2bbb('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ae1602f..ed2ba24 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 _0x1488=['BOOLEAN','sequelize','STRING'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1488,0x88));var _0x8148=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x1488[_0xd7b0a4];return _0x184e9e;};'use strict';var Sequelize=require(_0x8148('0x0'));module['exports']={'name':{'type':Sequelize[_0x8148('0x1')]},'username':{'type':Sequelize[_0x8148('0x1')]},'password':{'type':Sequelize[_0x8148('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8148('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8148('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8148('0x1')]},'modernAuthentication':{'type':Sequelize[_0x8148('0x2')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index fd9dcd0..c3769ae 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 _0x57a6=['msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data5','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','lastIndexOf','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName','4.0','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','status','sendStatus','stack','name','index','map','Dynamics365Account','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','catch','keys','rawAttributes','create','body','find','params','getConfigurations','findOne','Dynamics365Configuration','options','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','%s/api/data/v9.0/','getFields','incident','Incident','title','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame'];(function(_0x468e5b,_0x4dc571){var _0x40f1e1=function(_0xb9adf8){while(--_0xb9adf8){_0x468e5b['push'](_0x468e5b['shift']());}};_0x40f1e1(++_0x4dc571);}(_0x57a6,0x1bb));var _0x657a=function(_0x182b7f,_0x32d891){_0x182b7f=_0x182b7f-0x0;var _0x41c722=_0x57a6[_0x182b7f];return _0x41c722;};'use strict';var rp=require('request-promise');var util=require(_0x657a('0x0'));var _=require('lodash');var qs=require(_0x657a('0x1'));var logger=require(_0x657a('0x2'))(_0x657a('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x657a('0x4'));function respondWithResult(_0x4afa84,_0x559012){_0x559012=_0x559012||0xc8;return function(_0x3eb690){if(_0x3eb690){return _0x4afa84['status'](_0x559012)[_0x657a('0x5')](_0x3eb690);}};}function respondWithFilteredResult(_0x54fe4a,_0x1df769){return function(_0x35d20d){if(_0x35d20d){var _0x2ccc4f=typeof _0x1df769['offset']===_0x657a('0x6')&&typeof _0x1df769[_0x657a('0x7')]===_0x657a('0x6');var _0x4ca589=_0x35d20d[_0x657a('0x8')];var _0x1b48eb=_0x2ccc4f?0x0:_0x1df769[_0x657a('0x9')];var _0x33bc5f=_0x2ccc4f?_0x35d20d[_0x657a('0x8')]:_0x1df769[_0x657a('0x9')]+_0x1df769['limit'];var _0x63c24c;if(_0x33bc5f>=_0x4ca589){_0x33bc5f=_0x4ca589;_0x63c24c=0xc8;}else{_0x63c24c=0xce;}_0x54fe4a['status'](_0x63c24c);return _0x54fe4a[_0x657a('0xa')](_0x657a('0xb'),_0x1b48eb+'-'+_0x33bc5f+'/'+_0x4ca589)[_0x657a('0x5')](_0x35d20d);}return null;};}function saveUpdates(_0xf83ae5){return function(_0x426971){if(_0x426971){return _0x426971[_0x657a('0xc')](_0xf83ae5)[_0x657a('0xd')](function(_0x6bf8b9){return _0x6bf8b9;});}return null;};}function removeEntity(_0x53110b){return function(_0x242f12){if(_0x242f12){return _0x242f12[_0x657a('0xe')]()[_0x657a('0xd')](function(){_0x53110b[_0x657a('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bac3a){return function(_0x2179f9){if(!_0x2179f9){_0x3bac3a[_0x657a('0x10')](0x194);}return _0x2179f9;};}function handleError(_0x52c994,_0x46c86a){_0x46c86a=_0x46c86a||0x1f4;return function(_0x53be3b){logger['error'](_0x53be3b[_0x657a('0x11')]);if(_0x53be3b[_0x657a('0x12')]){delete _0x53be3b[_0x657a('0x12')];}_0x52c994[_0x657a('0xf')](_0x46c86a)['send'](_0x53be3b);};}exports[_0x657a('0x13')]=function(_0x1bddf3,_0x106629){var _0x5291af={},_0x1b1a4c={},_0x21f0d1={'count':0x0,'rows':[]};var _0x35fa82=_[_0x657a('0x14')](db[_0x657a('0x15')]['rawAttributes'],function(_0x312786){return{'name':_0x312786['fieldName'],'type':_0x312786[_0x657a('0x16')][_0x657a('0x17')]};});_0x1b1a4c[_0x657a('0x18')]=_[_0x657a('0x14')](_0x35fa82,_0x657a('0x12'));_0x1b1a4c[_0x657a('0x19')]=_['keys'](_0x1bddf3[_0x657a('0x19')]);_0x1b1a4c[_0x657a('0x1a')]=_[_0x657a('0x1b')](_0x1b1a4c['model'],_0x1b1a4c['query']);_0x5291af[_0x657a('0x1c')]=_[_0x657a('0x1b')](_0x1b1a4c['model'],qs[_0x657a('0x1d')](_0x1bddf3[_0x657a('0x19')][_0x657a('0x1d')]));_0x5291af[_0x657a('0x1c')]=_0x5291af[_0x657a('0x1c')][_0x657a('0x1e')]?_0x5291af[_0x657a('0x1c')]:_0x1b1a4c[_0x657a('0x18')];if(!_0x1bddf3['query'][_0x657a('0x1f')](_0x657a('0x20'))){_0x5291af['limit']=qs[_0x657a('0x7')](_0x1bddf3[_0x657a('0x19')][_0x657a('0x7')]);_0x5291af[_0x657a('0x9')]=qs[_0x657a('0x9')](_0x1bddf3[_0x657a('0x19')][_0x657a('0x9')]);}_0x5291af['order']=qs[_0x657a('0x21')](_0x1bddf3[_0x657a('0x19')]['sort']);_0x5291af[_0x657a('0x22')]=qs[_0x657a('0x1a')](_[_0x657a('0x23')](_0x1bddf3[_0x657a('0x19')],_0x1b1a4c[_0x657a('0x1a')]),_0x35fa82);if(_0x1bddf3['query'][_0x657a('0x24')]){_0x5291af[_0x657a('0x22')]=_[_0x657a('0x25')](_0x5291af[_0x657a('0x22')],{'$or':_[_0x657a('0x14')](_0x35fa82,function(_0x4c1c71){if(_0x4c1c71[_0x657a('0x16')]!=='VIRTUAL'){var _0x57fa79={};_0x57fa79[_0x4c1c71[_0x657a('0x12')]]={'$like':'%'+_0x1bddf3[_0x657a('0x19')][_0x657a('0x24')]+'%'};return _0x57fa79;}})});}_0x5291af=_[_0x657a('0x25')]({},_0x5291af,_0x1bddf3['options']);var _0x291331={'where':_0x5291af[_0x657a('0x22')]};return db[_0x657a('0x15')][_0x657a('0x8')](_0x291331)[_0x657a('0xd')](function(_0x5aa34e){_0x21f0d1['count']=_0x5aa34e;if(_0x1bddf3[_0x657a('0x19')][_0x657a('0x26')]){_0x5291af[_0x657a('0x27')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x5291af);})[_0x657a('0xd')](function(_0x1176c4){_0x21f0d1['rows']=_0x1176c4;return _0x21f0d1;})[_0x657a('0xd')](respondWithFilteredResult(_0x106629,_0x5291af))[_0x657a('0x28')](handleError(_0x106629,null));};exports['show']=function(_0x2e778f,_0x42e668){var _0x566af6={'raw':![],'where':{'id':_0x2e778f['params']['id']}},_0x1b6212={};_0x1b6212[_0x657a('0x18')]=_[_0x657a('0x29')](db[_0x657a('0x15')][_0x657a('0x2a')]);_0x1b6212[_0x657a('0x19')]=_[_0x657a('0x29')](_0x2e778f[_0x657a('0x19')]);_0x1b6212[_0x657a('0x1a')]=_['intersection'](_0x1b6212[_0x657a('0x18')],_0x1b6212[_0x657a('0x19')]);_0x566af6[_0x657a('0x1c')]=_['intersection'](_0x1b6212['model'],qs['fields'](_0x2e778f[_0x657a('0x19')]['fields']));_0x566af6[_0x657a('0x1c')]=_0x566af6[_0x657a('0x1c')]['length']?_0x566af6['attributes']:_0x1b6212[_0x657a('0x18')];if(_0x2e778f['query'][_0x657a('0x26')]){_0x566af6[_0x657a('0x27')]=[{'all':!![]}];}_0x566af6=_[_0x657a('0x25')]({},_0x566af6,_0x2e778f['options']);return db[_0x657a('0x15')]['find'](_0x566af6)[_0x657a('0xd')](handleEntityNotFound(_0x42e668,null))['then'](respondWithResult(_0x42e668,null))[_0x657a('0x28')](handleError(_0x42e668,null));};exports['create']=function(_0x490ca5,_0x37bda7){return db[_0x657a('0x15')][_0x657a('0x2b')](_0x490ca5[_0x657a('0x2c')],{})['then'](respondWithResult(_0x37bda7,0xc9))[_0x657a('0x28')](handleError(_0x37bda7,null));};exports['update']=function(_0x54da0a,_0x58581b){if(_0x54da0a[_0x657a('0x2c')]['id']){delete _0x54da0a[_0x657a('0x2c')]['id'];}return db[_0x657a('0x15')][_0x657a('0x2d')]({'where':{'id':_0x54da0a['params']['id']}})[_0x657a('0xd')](handleEntityNotFound(_0x58581b,null))['then'](saveUpdates(_0x54da0a[_0x657a('0x2c')],null))[_0x657a('0xd')](respondWithResult(_0x58581b,null))[_0x657a('0x28')](handleError(_0x58581b,null));};exports['destroy']=function(_0xe02ecf,_0x176155){return db[_0x657a('0x15')]['find']({'where':{'id':_0xe02ecf[_0x657a('0x2e')]['id']}})[_0x657a('0xd')](handleEntityNotFound(_0x176155,null))['then'](removeEntity(_0x176155,null))[_0x657a('0x28')](handleError(_0x176155,null));};exports[_0x657a('0x2f')]=function(_0x1227ea,_0x587574){var _0x1d8973={};var _0x43a786={};var _0x284ca0;var _0x9e170c;return db['Dynamics365Account'][_0x657a('0x30')]({'where':{'id':_0x1227ea[_0x657a('0x2e')]['id']}})[_0x657a('0xd')](handleEntityNotFound(_0x587574,null))[_0x657a('0xd')](function(_0x38b7ee){if(_0x38b7ee){_0x284ca0=_0x38b7ee;_0x43a786[_0x657a('0x18')]=_[_0x657a('0x29')](db[_0x657a('0x31')][_0x657a('0x2a')]);_0x43a786[_0x657a('0x19')]=_['keys'](_0x1227ea[_0x657a('0x19')]);_0x43a786[_0x657a('0x1a')]=_[_0x657a('0x1b')](_0x43a786[_0x657a('0x18')],_0x43a786[_0x657a('0x19')]);_0x1d8973[_0x657a('0x1c')]=_[_0x657a('0x1b')](_0x43a786['model'],qs[_0x657a('0x1d')](_0x1227ea[_0x657a('0x19')]['fields']));_0x1d8973['attributes']=_0x1d8973[_0x657a('0x1c')][_0x657a('0x1e')]?_0x1d8973[_0x657a('0x1c')]:_0x43a786[_0x657a('0x18')];_0x1d8973['order']=qs[_0x657a('0x21')](_0x1227ea[_0x657a('0x19')]['sort']);_0x1d8973[_0x657a('0x22')]=qs[_0x657a('0x1a')](_[_0x657a('0x23')](_0x1227ea[_0x657a('0x19')],_0x43a786[_0x657a('0x1a')]));if(_0x1227ea[_0x657a('0x19')][_0x657a('0x24')]){_0x1d8973[_0x657a('0x22')]=_[_0x657a('0x25')](_0x1d8973['where'],{'$or':_[_0x657a('0x14')](_0x1d8973[_0x657a('0x1c')],function(_0x373cf6){var _0x2bc56f={};_0x2bc56f[_0x373cf6]={'$like':'%'+_0x1227ea[_0x657a('0x19')][_0x657a('0x24')]+'%'};return _0x2bc56f;})});}_0x1d8973=_[_0x657a('0x25')]({},_0x1d8973,_0x1227ea[_0x657a('0x32')]);return _0x284ca0[_0x657a('0x2f')](_0x1d8973);}})['then'](function(_0x331c66){if(_0x331c66){_0x9e170c=_0x331c66['length'];if(!_0x1227ea[_0x657a('0x19')]['hasOwnProperty'](_0x657a('0x20'))){_0x1d8973[_0x657a('0x7')]=qs[_0x657a('0x7')](_0x1227ea['query'][_0x657a('0x7')]);_0x1d8973['offset']=qs[_0x657a('0x9')](_0x1227ea['query']['offset']);}return _0x284ca0[_0x657a('0x2f')](_0x1d8973);}})[_0x657a('0xd')](function(_0x3d18b1){if(_0x3d18b1){return _0x3d18b1?{'count':_0x9e170c,'rows':_0x3d18b1}:null;}})[_0x657a('0xd')](respondWithResult(_0x587574,null))['catch'](handleError(_0x587574,null));};exports['addConfiguration']=function(_0x102a75,_0xcb2350){if(_0x102a75[_0x657a('0x2c')]['id']){delete _0x102a75[_0x657a('0x2c')]['id'];}return db[_0x657a('0x15')][_0x657a('0x30')]({'where':{'id':_0x102a75[_0x657a('0x2e')]['id']}})['then'](handleEntityNotFound(_0xcb2350,null))['then'](function(_0x4d67d0){if(_0x4d67d0){_0x102a75[_0x657a('0x2c')]['AccountId']=_0x4d67d0['id'];_0x102a75[_0x657a('0x2c')][_0x657a('0x33')]=integrations['getSubjects'](_0x102a75['body'][_0x657a('0x34')],_0x102a75[_0x657a('0x2c')][_0x657a('0x16')]);_0x102a75[_0x657a('0x2c')][_0x657a('0x35')]=integrations[_0x657a('0x36')](_0x102a75['body'][_0x657a('0x34')],_0x102a75[_0x657a('0x2c')][_0x657a('0x16')]);return db[_0x657a('0x31')]['create'](_0x102a75[_0x657a('0x2c')],{'include':[{'model':db['Dynamics365Field'],'as':_0x657a('0x33')},{'model':db[_0x657a('0x37')],'as':_0x657a('0x35')}]});}return null;})[_0x657a('0xd')](respondWithResult(_0xcb2350,null))[_0x657a('0x28')](handleError(_0xcb2350,null));};function sanitizeRemoteUri(_0x32aa14){var _0x389ff8=_0x32aa14[_0x657a('0x38')](-0x1);if(_0x389ff8==='/')return _0x32aa14[_0x657a('0x39')](0x0,_0x32aa14['lastIndexOf'](_0x389ff8));return _0x32aa14;}function getWebApiUrl(_0x518aed){return util['format'](_0x657a('0x3a'),_0x518aed);}exports[_0x657a('0x3b')]=function(_0x181526,_0x1cbaa0){var _0x14b079=_0x181526[_0x657a('0x19')]['ticketType'];var _0x424149=_0x14b079===_0x657a('0x3c')?_0x657a('0x3d'):'PhoneCall';var _0x1b2841='';var _0x3cd9aa='';var _0x51a8a2='';var _0x824774='';var _0x1d3318='';var _0x3263a1='';var _0x1b7ace='';var _0x1b24a4='';var _0x39af56=[_0x657a('0x3e'),'description','customerid','ownerid',_0x657a('0x3f'),_0x657a('0x40'),_0x657a('0x41'),_0x657a('0x42'),_0x657a('0x43'),_0x657a('0x44')];var _0x138dcf=['accountidname',_0x657a('0x45'),_0x657a('0x46'),_0x657a('0x47'),_0x657a('0x48'),_0x657a('0x49'),_0x657a('0x4a'),_0x657a('0x4b'),_0x657a('0x4c'),_0x657a('0x4d'),_0x657a('0x4e'),_0x657a('0x4f'),_0x657a('0x50'),'createdonbehalfbyname','createdonbehalfbyyominame','customeridname',_0x657a('0x51'),_0x657a('0x52'),'emailaddress',_0x657a('0x53'),_0x657a('0x54'),'entityimage_url',_0x657a('0x55'),_0x657a('0x56'),_0x657a('0x57'),'followupby',_0x657a('0x58'),_0x657a('0x59'),'kbarticleidname',_0x657a('0x5a'),_0x657a('0x5b'),'modifiedbyexternalpartyname',_0x657a('0x5c'),_0x657a('0x5d'),_0x657a('0x5e'),_0x657a('0x5f'),'modifiedonbehalfbyname',_0x657a('0x60'),_0x657a('0x61'),_0x657a('0x62'),_0x657a('0x63'),_0x657a('0x64'),_0x657a('0x65'),'owneridname',_0x657a('0x66'),_0x657a('0x67'),_0x657a('0x68'),_0x657a('0x69'),_0x657a('0x6a'),_0x657a('0x6b'),'productidname',_0x657a('0x6c'),_0x657a('0x6d'),'resolvebykpiidname','responseby','responsiblecontactidname',_0x657a('0x6e'),_0x657a('0x6f'),_0x657a('0x70'),_0x657a('0x71'),_0x657a('0x72'),_0x657a('0x73'),_0x657a('0x74'),_0x657a('0x75'),_0x657a('0x76'),_0x657a('0x77'),_0x657a('0x78'),'traversedpath',_0x657a('0x79'),'versionnumber'];var _0x3e9114=_0x39af56['concat'](_0x138dcf);return db[_0x657a('0x15')][_0x657a('0x30')]({'where':{'id':_0x181526['params']['id']},'attributes':['id',_0x657a('0x7a'),_0x657a('0x7b'),'remoteUri',_0x657a('0x7c'),_0x657a('0x7d'),_0x657a('0x7e'),_0x657a('0x7f')],'include':[{'model':db[_0x657a('0x80')],'as':_0x657a('0x80'),'attributes':['id','data5','data7']}]})[_0x657a('0xd')](handleEntityNotFound(_0x1cbaa0,null))['then'](function(_0x26aff8){if(_0x26aff8){if(_0x26aff8['modernAuthentication']){_0x26aff8[_0x657a('0x81')]=_0x26aff8['CloudProvider'][_0x657a('0x82')];_0x1b24a4=sanitizeRemoteUri(_0x26aff8[_0x657a('0x80')]['data7']);_0x1b7ace=getWebApiUrl(_0x1b24a4);return _0x26aff8;}_0x1b24a4=sanitizeRemoteUri(_0x26aff8[_0x657a('0x83')]);_0x1b7ace=getWebApiUrl(_0x1b24a4);var _0x25430f={'method':_0x657a('0x84'),'uri':_0x657a('0x85')+_0x26aff8['tenantId']+_0x657a('0x86'),'form':{'client_id':_0x26aff8[_0x657a('0x7d')],'resource':_0x1b24a4,'username':_0x26aff8[_0x657a('0x7a')],'password':_0x26aff8[_0x657a('0x7b')],'grant_type':_0x657a('0x7b'),'client_secret':_0x26aff8[_0x657a('0x7e')]},'json':!![]};return rp(_0x25430f);}})[_0x657a('0xd')](function(_0x27fede){_0x3263a1=_0x27fede[_0x657a('0x81')];var _0x16e982={'method':'GET','uri':encodeURI(_0x1b7ace+_0x657a('0x87')+_0x424149+'\x27'),'headers':{'Authorization':_0x657a('0x88')+_0x3263a1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x16e982);})[_0x657a('0xd')](function(_0x3d93d7){var _0x6c0685=_0x3d93d7[_0x657a('0x89')][0x0];var _0x14be23=_0x6c0685[_0x657a('0x8a')];var _0x9c45e={'method':_0x657a('0x8b'),'uri':_0x1b7ace+_0x657a('0x8c')+_0x14be23+_0x657a('0x8d'),'headers':{'Authorization':_0x657a('0x88')+_0x3263a1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x9c45e);})[_0x657a('0xd')](function(_0x460950){_0x1b2841=_0x460950;_0x3cd9aa=_0x1b2841[_0x657a('0x8e')];_0x3cd9aa=_[_0x657a('0x8f')](_0x3cd9aa,function(_0x54f6ef){return!_0x3e9114['includes'](_0x54f6ef[_0x657a('0x90')]);});var _0x26f95b=[];var _0x3c43c2=[];_0x3cd9aa[_0x657a('0x91')](function(_0x123640){if(_0x123640[_0x657a('0x92')]){var _0x121907=_0x123640[_0x657a('0x92')][_0x657a('0x39')](_0x123640[_0x657a('0x92')][_0x657a('0x93')]('.')+0x1);if(_0x121907==='PicklistAttributeMetadata'){_0x26f95b[_0x657a('0x94')](getSelectList(_0x1b7ace,_0x14b079,_0x3c43c2,_0x1b2841[_0x657a('0x8a')],_0x123640[_0x657a('0x8a')],_0x3263a1));}}});return Promise[_0x657a('0x95')](_0x26f95b);})[_0x657a('0xd')](function(_0x22e4d0){_0x51a8a2=_0x22e4d0[0x0];var _0x4cf2ef=[];var _0x366cba=[];_0x3cd9aa[_0x657a('0x91')](function(_0xfb18b8){if(!_[_0x657a('0x96')](_0xfb18b8[_0x657a('0x92')])){var _0x19b2c3=_0xfb18b8[_0x657a('0x92')]['substring'](_0xfb18b8[_0x657a('0x92')][_0x657a('0x93')]('.')+0x1);if(_0x19b2c3===_0x657a('0x97')){_0x4cf2ef['push'](getBooleanList(_0x1b7ace,_0x14b079,_0x366cba,_0x1b2841['MetadataId'],_0xfb18b8[_0x657a('0x8a')],_0x3263a1));}}});return Promise[_0x657a('0x95')](_0x4cf2ef);})[_0x657a('0xd')](function(_0xa200a){_0x824774=_0xa200a[0x0];var _0x95bcd9=[];var _0x2afd5c=[];_0x3cd9aa['forEach'](function(_0x20383d){if(_0x20383d[_0x657a('0x92')]){var _0x42a98d=_0x20383d[_0x657a('0x92')]['substring'](_0x20383d[_0x657a('0x92')][_0x657a('0x93')]('.')+0x1);if(_0x42a98d===_0x657a('0x98')||_0x42a98d===_0x657a('0x99')||_0x42a98d==='BigIntAttributeMetadata'||_0x42a98d===_0x657a('0x9a')||_0x42a98d===_0x657a('0x9b')||_0x42a98d===_0x657a('0x9c')||_0x42a98d===_0x657a('0x9d')||_0x42a98d===_0x657a('0x9e')||_0x42a98d===_0x657a('0x9f')||_0x42a98d===_0x657a('0xa0')){_0x95bcd9[_0x657a('0x94')](getInputList(_0x1b7ace,_0x14b079,_0x42a98d,_0x2afd5c,_0x1b2841[_0x657a('0x8a')],_0x20383d[_0x657a('0x8a')],_0x3263a1));}}});return Promise[_0x657a('0x95')](_0x95bcd9);})['then'](function(_0x2aa909){_0x1d3318=_0x2aa909[0x0];var _0x917bac=_0x51a8a2[_0x657a('0xa1')](_0x824774)[_0x657a('0xa1')](_0x1d3318);var _0x1738d5={'count':_0x917bac[_0x657a('0x1e')],'rows':_0x917bac};return _0x1738d5;})['then'](respondWithResult(_0x1cbaa0,null))[_0x657a('0x28')](function(_0x1ae01c){var _0x411483=_0x181526[_0x657a('0x19')][_0x657a('0xa2')]?0x1f4:_0x1ae01c[_0x657a('0xa3')]||0x1f4;logger[_0x657a('0xa4')](_0x1ae01c[_0x657a('0x11')]);delete _0x1ae01c[_0x657a('0x12')];if(_0x411483===0x191){_0x411483=0x190;}_0x1cbaa0[_0x657a('0xf')](_0x411483)[_0x657a('0xa5')](_0x181526[_0x657a('0x19')][_0x657a('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x1ae01c[_0x657a('0xa3')]}:_0x1ae01c);});};function getSelectList(_0x1c2ffb,_0x53a708,_0x1e114d,_0x44a6c6,_0xc9f136,_0x1249f3){var _0x293ecc={'method':'GET','uri':_0x1c2ffb+_0x657a('0x8c')+_0x44a6c6+_0x657a('0xa6')+_0xc9f136+_0x657a('0xa7')+_0x657a('0xa8'),'headers':{'Authorization':_0x657a('0x88')+_0x1249f3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x293ecc)[_0x657a('0xd')](function(_0x156907){var _0x1997e0=[];var _0x170b06=_0x156907[_0x657a('0xa9')][_0x657a('0xaa')];_0x170b06[_0x657a('0x91')](function(_0x325f22){_0x1997e0['push']({'name':_0x325f22['Label'][_0x657a('0xab')][_0x657a('0xac')],'value':String(_0x325f22[_0x657a('0xad')])});});var _0x258ef7={'id':_0x53a708+'_'+_0x156907['LogicalName'],'name':_0x156907[_0x657a('0xae')][_0x657a('0xab')][_0x657a('0xac')],'custom':![],'options':_0x1997e0};_0x1e114d['push'](_0x258ef7);return _0x1e114d;});}function getBooleanList(_0x58db4c,_0x2bec35,_0x5629e0,_0x1e8d43,_0x4509c4,_0x5974c1){var _0x4c5613={'method':'GET','uri':_0x58db4c+_0x657a('0x8c')+_0x1e8d43+_0x657a('0xa6')+_0x4509c4+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x657a('0x88')+_0x5974c1,'If-None-Match':null,'OData-Version':_0x657a('0xaf')},'json':!![]};return rp(_0x4c5613)[_0x657a('0xd')](function(_0x38886b){var _0x5cf87d=[];_0x5cf87d[_0x657a('0x94')]({'name':_0x38886b[_0x657a('0xa9')][_0x657a('0xb0')]['Label'][_0x657a('0xab')]['Label'],'value':_0x657a('0xb1')},{'name':_0x38886b[_0x657a('0xa9')][_0x657a('0xb2')]['Label'][_0x657a('0xab')]['Label'],'value':'false'});var _0x2a02a5={'id':_0x2bec35+'_'+_0x38886b[_0x657a('0x90')],'name':_0x38886b[_0x657a('0xae')]['UserLocalizedLabel'][_0x657a('0xac')],'custom':![],'options':_0x5cf87d};_0x5629e0[_0x657a('0x94')](_0x2a02a5);return _0x5629e0;});}function getInputList(_0x5e53af,_0x558cf3,_0x28a551,_0x2c4470,_0x16b369,_0x343a7b,_0x5a8d55){var _0x2e94a5={'method':_0x657a('0x8b'),'uri':_0x5e53af+'EntityDefinitions('+_0x16b369+')/Attributes('+_0x343a7b+')/Microsoft.Dynamics.CRM.'+_0x28a551+_0x657a('0xb3'),'headers':{'Authorization':_0x657a('0x88')+_0x5a8d55,'If-None-Match':null,'OData-Version':_0x657a('0xaf')},'json':!![]};return rp(_0x2e94a5)[_0x657a('0xd')](function(_0x28cc86){var _0x149f2a={'id':_0x558cf3+'_'+_0x28cc86[_0x657a('0x90')],'name':_0x28cc86['DisplayName'][_0x657a('0xab')]?_0x28cc86['DisplayName']['UserLocalizedLabel']['Label']:_0x28cc86[_0x657a('0x90')],'custom':![],'options':[]};_0x2c4470[_0x657a('0x94')](_0x149f2a);return _0x2c4470;});} \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index b9f0cf0..6175c1a 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x57fe73,_0x3448c3){var _0x56a23b=function(_0x19accb){while(--_0x19accb){_0x57fe73['push'](_0x57fe73['shift']());}};_0x56a23b(++_0x3448c3);}(_0x757a,0xde));var _0xa757=function(_0x461f37,_0x3caf88){_0x461f37=_0x461f37-0x0;var _0x49249f=_0x757a[_0x461f37];return _0x49249f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 0421eae..415e9df 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 _0x26fc=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','ShowDynamics365Account','find','catch','lodash'];(function(_0x45ef6d,_0x1b965e){var _0x4b585b=function(_0x1064c9){while(--_0x1064c9){_0x45ef6d['push'](_0x45ef6d['shift']());}};_0x4b585b(++_0x1b965e);}(_0x26fc,0x128));var _0xc26f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x26fc[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xc26f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc26f('0x1'));var rs=require(_0xc26f('0x2'));var fs=require('fs');var Redis=require(_0xc26f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc26f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc26f('0x5'));var jayson=require(_0xc26f('0x6'));var client=jayson[_0xc26f('0x7')][_0xc26f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x330281,_0x3ecb06,_0x543d76){return new BPromise(function(_0x5cc050,_0x11dcd0){return client[_0xc26f('0x9')](_0x330281,_0x543d76)[_0xc26f('0xa')](function(_0x262135){logger['info'](_0xc26f('0xb'),_0x3ecb06,_0xc26f('0xc'));logger[_0xc26f('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3ecb06,_0xc26f('0xc'),JSON[_0xc26f('0xe')](_0x262135));if(_0x262135['error']){if(_0x262135[_0xc26f('0xf')][_0xc26f('0x10')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3ecb06,_0x262135[_0xc26f('0xf')][_0xc26f('0x11')]);return _0x11dcd0(_0x262135[_0xc26f('0xf')]['message']);}logger[_0xc26f('0xf')](_0xc26f('0xb'),_0x3ecb06,_0x262135[_0xc26f('0xf')][_0xc26f('0x11')]);return _0x5cc050(_0x262135['error'][_0xc26f('0x11')]);}else{logger[_0xc26f('0x12')](_0xc26f('0xb'),_0x3ecb06,_0xc26f('0xc'));_0x5cc050(_0x262135['result'][_0xc26f('0x11')]);}})['catch'](function(_0x191a62){logger['error'](_0xc26f('0xb'),_0x3ecb06,_0x191a62);_0x11dcd0(_0x191a62);});});}exports[_0xc26f('0x13')]=function(_0x21f4bc){var _0x149478=this;return new Promise(function(_0x57a577,_0x243658){return db[_0xc26f('0x14')][_0xc26f('0x15')]({'raw':_0x21f4bc[_0xc26f('0x16')]?_0x21f4bc['options'][_0xc26f('0x17')]===undefined?!![]:![]:!![],'where':_0x21f4bc[_0xc26f('0x16')]?_0x21f4bc[_0xc26f('0x16')][_0xc26f('0x18')]||null:null,'attributes':_0x21f4bc['options']?_0x21f4bc[_0xc26f('0x16')][_0xc26f('0x19')]||null:null,'limit':_0x21f4bc[_0xc26f('0x16')]?_0x21f4bc[_0xc26f('0x16')][_0xc26f('0x1a')]||null:null,'include':_0x21f4bc['options']?_0x21f4bc[_0xc26f('0x16')][_0xc26f('0x1b')]?_['map'](_0x21f4bc['options'][_0xc26f('0x1b')],function(_0x1d0bd0){return{'model':db[_0x1d0bd0[_0xc26f('0x1c')]],'as':_0x1d0bd0['as'],'attributes':_0x1d0bd0[_0xc26f('0x19')],'include':_0x1d0bd0['include']?_[_0xc26f('0x1d')](_0x1d0bd0[_0xc26f('0x1b')],function(_0x2c3e60){return{'model':db[_0x2c3e60[_0xc26f('0x1c')]],'as':_0x2c3e60['as'],'attributes':_0x2c3e60[_0xc26f('0x19')],'include':_0x2c3e60['include']?_[_0xc26f('0x1d')](_0x2c3e60['include'],function(_0x4b6079){return{'model':db[_0x4b6079['model']],'as':_0x4b6079['as'],'attributes':_0x4b6079[_0xc26f('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x146a14){logger[_0xc26f('0x12')](_0xc26f('0x13'),_0x21f4bc);logger[_0xc26f('0xd')]('GetDynamics365Account',_0x21f4bc,JSON[_0xc26f('0xe')](_0x146a14));_0x57a577(_0x146a14);})['catch'](function(_0x3c63fc){logger[_0xc26f('0xf')](_0xc26f('0x13'),_0x3c63fc[_0xc26f('0x11')],_0x21f4bc);_0x243658(_0x149478['error'](0x1f4,_0x3c63fc['message']));});});};exports[_0xc26f('0x1e')]=function(_0x2afe80){var _0x17c36f=this;return new Promise(function(_0x428bb9,_0x4e620d){return db['Dynamics365Account'][_0xc26f('0x1f')]({'raw':_0x2afe80[_0xc26f('0x16')]?_0x2afe80['options'][_0xc26f('0x17')]===undefined?!![]:![]:!![],'where':_0x2afe80[_0xc26f('0x16')]?_0x2afe80[_0xc26f('0x16')]['where']||null:null,'attributes':_0x2afe80['options']?_0x2afe80[_0xc26f('0x16')][_0xc26f('0x19')]||null:null,'include':_0x2afe80[_0xc26f('0x16')]?_0x2afe80[_0xc26f('0x16')][_0xc26f('0x1b')]?_[_0xc26f('0x1d')](_0x2afe80[_0xc26f('0x16')][_0xc26f('0x1b')],function(_0x195d73){return{'model':db[_0x195d73[_0xc26f('0x1c')]],'as':_0x195d73['as'],'attributes':_0x195d73[_0xc26f('0x19')],'include':_0x195d73[_0xc26f('0x1b')]?_[_0xc26f('0x1d')](_0x195d73['include'],function(_0x1dd498){return{'model':db[_0x1dd498[_0xc26f('0x1c')]],'as':_0x1dd498['as'],'attributes':_0x1dd498[_0xc26f('0x19')],'include':_0x1dd498[_0xc26f('0x1b')]?_[_0xc26f('0x1d')](_0x1dd498[_0xc26f('0x1b')],function(_0x4525d1){return{'model':db[_0x4525d1[_0xc26f('0x1c')]],'as':_0x4525d1['as'],'attributes':_0x4525d1[_0xc26f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc26f('0xa')](function(_0x7a3432){logger[_0xc26f('0x12')](_0xc26f('0x1e'),_0x2afe80);logger['debug'](_0xc26f('0x1e'),_0x2afe80,JSON[_0xc26f('0xe')](_0x7a3432));_0x428bb9(_0x7a3432);})[_0xc26f('0x20')](function(_0x4208ad){logger['error'](_0xc26f('0x1e'),_0x4208ad[_0xc26f('0x11')],_0x2afe80);_0x4e620d(_0x17c36f[_0xc26f('0xf')](0x1f4,_0x4208ad['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 25e769e..ef2cf6d 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 _0xdaf2=['put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x539fe1,_0x4c28db){var _0x43841d=function(_0x365409){while(--_0x365409){_0x539fe1['push'](_0x539fe1['shift']());}};_0x43841d(++_0x4c28db);}(_0xdaf2,0x1cf));var _0x2daf=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xdaf2[_0x2f3794];return _0x1c9fbe;};'use strict';var multer=require('multer');var util=require(_0x2daf('0x0'));var path=require(_0x2daf('0x1'));var timeout=require('connect-timeout');var express=require(_0x2daf('0x2'));var router=express[_0x2daf('0x3')]();var fs_extra=require(_0x2daf('0x4'));var auth=require(_0x2daf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2daf('0x6'));var controller=require(_0x2daf('0x7'));router[_0x2daf('0x8')]('/',auth['isAuthenticated'](),controller[_0x2daf('0x9')]);router['get'](_0x2daf('0xa'),auth[_0x2daf('0xb')](),controller[_0x2daf('0xc')]);router[_0x2daf('0x8')](_0x2daf('0xd'),auth[_0x2daf('0xb')](),controller[_0x2daf('0xe')]);router[_0x2daf('0x8')](_0x2daf('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2daf('0x8')](_0x2daf('0x10'),auth[_0x2daf('0xb')](),controller[_0x2daf('0x11')]);router[_0x2daf('0x12')]('/',auth['isAuthenticated'](),controller[_0x2daf('0x13')]);router[_0x2daf('0x14')](_0x2daf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2daf('0x15')](_0x2daf('0xa'),auth['isAuthenticated'](),controller[_0x2daf('0x16')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index a360e87..a1e0427 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 _0xf4d3=['STRING','incident','nothing','contact','BOOLEAN','sequelize','exports'];(function(_0x2eb028,_0x16b316){var _0x1ff79d=function(_0x504cc7){while(--_0x504cc7){_0x2eb028['push'](_0x2eb028['shift']());}};_0x1ff79d(++_0x16b316);}(_0xf4d3,0x1d3));var _0x3f4d=function(_0x3f9fd7,_0x291610){_0x3f9fd7=_0x3f9fd7-0x0;var _0x5d533e=_0xf4d3[_0x3f9fd7];return _0x5d533e;};'use strict';var Sequelize=require(_0x3f4d('0x0'));module[_0x3f4d('0x1')]={'name':{'type':Sequelize[_0x3f4d('0x2')]},'description':{'type':Sequelize[_0x3f4d('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x3f4d('0x3'),'phonecall'),'defaultValue':_0x3f4d('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x3f4d('0x4')),'defaultValue':_0x3f4d('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3f4d('0x6')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0b319e2..25ff1cc 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 _0x8201=['sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','keys','includeAll','include','find','catch','create','body','params','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x8201,0x175));var _0x1820=function(_0x2a4a1a,_0x20bcc5){_0x2a4a1a=_0x2a4a1a-0x0;var _0x47230d=_0x8201[_0x2a4a1a];return _0x47230d;};'use strict';var emlformat=require(_0x1820('0x0'));var rimraf=require(_0x1820('0x1'));var zipdir=require(_0x1820('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1820('0x3'));var moment=require(_0x1820('0x4'));var BPromise=require(_0x1820('0x5'));var Mustache=require(_0x1820('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1820('0x7'));var csv=require('to-csv');var ejs=require(_0x1820('0x8'));var fs=require('fs');var fs_extra=require(_0x1820('0x9'));var _=require('lodash');var squel=require(_0x1820('0xa'));var crypto=require(_0x1820('0xb'));var jsforce=require(_0x1820('0xc'));var deskjs=require(_0x1820('0xd'));var toCsv=require(_0x1820('0xe'));var querystring=require(_0x1820('0xf'));var Papa=require('papaparse');var Redis=require(_0x1820('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1820('0x11'));var hardwareService=require(_0x1820('0x12'));var logger=require(_0x1820('0x13'))('api');var utils=require(_0x1820('0x14'));var config=require(_0x1820('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1820('0x16'))['db'];function respondWithStatusCode(_0x5d5a6b,_0x465610){_0x465610=_0x465610||0xcc;return function(_0x1ee3f5){if(_0x1ee3f5){return _0x5d5a6b[_0x1820('0x17')](_0x465610);}return _0x5d5a6b[_0x1820('0x18')](_0x465610)[_0x1820('0x19')]();};}function respondWithResult(_0x1b630e,_0x4342b3){_0x4342b3=_0x4342b3||0xc8;return function(_0x6d3720){if(_0x6d3720){return _0x1b630e['status'](_0x4342b3)['json'](_0x6d3720);}};}function respondWithFilteredResult(_0x3ca82a,_0x5590dc){return function(_0x21d97b){if(_0x21d97b){var _0x33a906=typeof _0x5590dc[_0x1820('0x1a')]===_0x1820('0x1b')&&typeof _0x5590dc[_0x1820('0x1c')]==='undefined';var _0x71794f=_0x21d97b[_0x1820('0x1d')];var _0x4c08b8=_0x33a906?0x0:_0x5590dc[_0x1820('0x1a')];var _0x10e670=_0x33a906?_0x21d97b[_0x1820('0x1d')]:_0x5590dc[_0x1820('0x1a')]+_0x5590dc[_0x1820('0x1c')];var _0x3c1d9a;if(_0x10e670>=_0x71794f){_0x10e670=_0x71794f;_0x3c1d9a=0xc8;}else{_0x3c1d9a=0xce;}_0x3ca82a[_0x1820('0x18')](_0x3c1d9a);return _0x3ca82a['set'](_0x1820('0x1e'),_0x4c08b8+'-'+_0x10e670+'/'+_0x71794f)['json'](_0x21d97b);}return null;};}function patchUpdates(_0x33972a){return function(_0x363dd5){try{jsonpatch['apply'](_0x363dd5,_0x33972a,!![]);}catch(_0xf5c154){return BPromise[_0x1820('0x1f')](_0xf5c154);}return _0x363dd5['save']();};}function saveUpdates(_0x14d56,_0x2b1bfe){return function(_0x4d03f4){if(_0x4d03f4){return _0x4d03f4[_0x1820('0x20')](_0x14d56)[_0x1820('0x21')](function(_0x5f73e6){return _0x5f73e6;});}return null;};}function removeEntity(_0x4f507f,_0xe979d9){return function(_0x492a69){if(_0x492a69){return _0x492a69[_0x1820('0x22')]()[_0x1820('0x21')](function(){_0x4f507f[_0x1820('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4489d8,_0x5dcecb){return function(_0xce5c1d){if(!_0xce5c1d){_0x4489d8['sendStatus'](0x194);}return _0xce5c1d;};}function handleError(_0x35f4f0,_0x52dd26){_0x52dd26=_0x52dd26||0x1f4;return function(_0x29a48e){logger['error'](_0x29a48e[_0x1820('0x23')]);if(_0x29a48e[_0x1820('0x24')]){delete _0x29a48e[_0x1820('0x24')];}_0x35f4f0[_0x1820('0x18')](_0x52dd26)[_0x1820('0x25')](_0x29a48e);};}exports['index']=function(_0xa899ae,_0x56cb98){var _0x55a857={},_0x475efb={},_0x3ccb67={'count':0x0,'rows':[]};var _0x168ef6=_[_0x1820('0x26')](db[_0x1820('0x27')][_0x1820('0x28')],function(_0x4587fb){return{'name':_0x4587fb[_0x1820('0x29')],'type':_0x4587fb[_0x1820('0x2a')][_0x1820('0x2b')]};});_0x475efb[_0x1820('0x2c')]=_[_0x1820('0x26')](_0x168ef6,'name');_0x475efb[_0x1820('0x2d')]=_['keys'](_0xa899ae[_0x1820('0x2d')]);_0x475efb[_0x1820('0x2e')]=_['intersection'](_0x475efb[_0x1820('0x2c')],_0x475efb[_0x1820('0x2d')]);_0x55a857[_0x1820('0x2f')]=_[_0x1820('0x30')](_0x475efb[_0x1820('0x2c')],qs['fields'](_0xa899ae['query'][_0x1820('0x31')]));_0x55a857[_0x1820('0x2f')]=_0x55a857[_0x1820('0x2f')][_0x1820('0x32')]?_0x55a857[_0x1820('0x2f')]:_0x475efb[_0x1820('0x2c')];if(!_0xa899ae[_0x1820('0x2d')][_0x1820('0x33')](_0x1820('0x34'))){_0x55a857[_0x1820('0x1c')]=qs[_0x1820('0x1c')](_0xa899ae[_0x1820('0x2d')]['limit']);_0x55a857[_0x1820('0x1a')]=qs['offset'](_0xa899ae[_0x1820('0x2d')][_0x1820('0x1a')]);}_0x55a857[_0x1820('0x35')]=qs[_0x1820('0x36')](_0xa899ae[_0x1820('0x2d')][_0x1820('0x36')]);_0x55a857[_0x1820('0x37')]=qs[_0x1820('0x2e')](_[_0x1820('0x38')](_0xa899ae[_0x1820('0x2d')],_0x475efb[_0x1820('0x2e')]),_0x168ef6);if(_0xa899ae[_0x1820('0x2d')][_0x1820('0x39')]){_0x55a857[_0x1820('0x37')]=_[_0x1820('0x3a')](_0x55a857[_0x1820('0x37')],{'$or':_[_0x1820('0x26')](_0x168ef6,function(_0x11d05d){if(_0x11d05d[_0x1820('0x2a')]!==_0x1820('0x3b')){var _0x5431a5={};_0x5431a5[_0x11d05d[_0x1820('0x24')]]={'$like':'%'+_0xa899ae[_0x1820('0x2d')][_0x1820('0x39')]+'%'};return _0x5431a5;}})});}_0x55a857=_[_0x1820('0x3a')]({},_0x55a857,_0xa899ae[_0x1820('0x3c')]);var _0x28872a={'where':_0x55a857[_0x1820('0x37')]};return db[_0x1820('0x27')]['count'](_0x28872a)[_0x1820('0x21')](function(_0x4cd1e0){_0x3ccb67[_0x1820('0x1d')]=_0x4cd1e0;if(_0xa899ae['query']['includeAll']){_0x55a857['include']=[{'all':!![]}];}return db[_0x1820('0x27')][_0x1820('0x3d')](_0x55a857);})['then'](function(_0x16be25){_0x3ccb67['rows']=_0x16be25;return _0x3ccb67;})[_0x1820('0x21')](respondWithFilteredResult(_0x56cb98,_0x55a857))['catch'](handleError(_0x56cb98,null));};exports[_0x1820('0x3e')]=function(_0x4411b0,_0x24370f){var _0x3d5764={'raw':![],'where':{'id':_0x4411b0['params']['id']}},_0x2be2c3={};_0x2be2c3[_0x1820('0x2c')]=_[_0x1820('0x3f')](db[_0x1820('0x27')][_0x1820('0x28')]);_0x2be2c3[_0x1820('0x2d')]=_[_0x1820('0x3f')](_0x4411b0[_0x1820('0x2d')]);_0x2be2c3[_0x1820('0x2e')]=_[_0x1820('0x30')](_0x2be2c3[_0x1820('0x2c')],_0x2be2c3[_0x1820('0x2d')]);_0x3d5764[_0x1820('0x2f')]=_['intersection'](_0x2be2c3[_0x1820('0x2c')],qs[_0x1820('0x31')](_0x4411b0[_0x1820('0x2d')][_0x1820('0x31')]));_0x3d5764['attributes']=_0x3d5764['attributes'][_0x1820('0x32')]?_0x3d5764[_0x1820('0x2f')]:_0x2be2c3[_0x1820('0x2c')];if(_0x4411b0['query'][_0x1820('0x40')]){_0x3d5764[_0x1820('0x41')]=[{'all':!![]}];}_0x3d5764=_[_0x1820('0x3a')]({},_0x3d5764,_0x4411b0[_0x1820('0x3c')]);return db[_0x1820('0x27')][_0x1820('0x42')](_0x3d5764)[_0x1820('0x21')](handleEntityNotFound(_0x24370f,null))['then'](respondWithResult(_0x24370f,null))[_0x1820('0x43')](handleError(_0x24370f,null));};exports[_0x1820('0x44')]=function(_0x90cea8,_0x3da319){return db[_0x1820('0x27')][_0x1820('0x44')](_0x90cea8[_0x1820('0x45')],{})['then'](respondWithResult(_0x3da319,0xc9))[_0x1820('0x43')](handleError(_0x3da319,null));};exports[_0x1820('0x20')]=function(_0x3b212c,_0x24cf6a){if(_0x3b212c[_0x1820('0x45')]['id']){delete _0x3b212c[_0x1820('0x45')]['id'];}return db[_0x1820('0x27')][_0x1820('0x42')]({'where':{'id':_0x3b212c[_0x1820('0x46')]['id']}})[_0x1820('0x21')](handleEntityNotFound(_0x24cf6a,null))[_0x1820('0x21')](saveUpdates(_0x3b212c[_0x1820('0x45')],null))[_0x1820('0x21')](respondWithResult(_0x24cf6a,null))[_0x1820('0x43')](handleError(_0x24cf6a,null));};exports[_0x1820('0x22')]=function(_0x9eca1d,_0x1e39a7){return db[_0x1820('0x27')][_0x1820('0x42')]({'where':{'id':_0x9eca1d[_0x1820('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e39a7,null))[_0x1820('0x21')](removeEntity(_0x1e39a7,null))['catch'](handleError(_0x1e39a7,null));};exports['getFields']=function(_0x3c4f99,_0x7cd962,_0x434b79){var _0x2c6d53={};var _0x230d33={};var _0x1efe1b;var _0x468acb;return db[_0x1820('0x27')][_0x1820('0x47')]({'where':{'id':_0x3c4f99[_0x1820('0x46')]['id']}})[_0x1820('0x21')](handleEntityNotFound(_0x7cd962,null))['then'](function(_0x5930d4){if(_0x5930d4){_0x1efe1b=_0x5930d4;_0x230d33[_0x1820('0x2c')]=_[_0x1820('0x3f')](db[_0x1820('0x48')][_0x1820('0x28')]);_0x230d33['query']=_['keys'](_0x3c4f99[_0x1820('0x2d')]);_0x230d33['filters']=_[_0x1820('0x30')](_0x230d33['model'],_0x230d33['query']);_0x2c6d53['attributes']=_[_0x1820('0x30')](_0x230d33[_0x1820('0x2c')],qs['fields'](_0x3c4f99[_0x1820('0x2d')]['fields']));_0x2c6d53[_0x1820('0x2f')]=_0x2c6d53[_0x1820('0x2f')]['length']?_0x2c6d53[_0x1820('0x2f')]:_0x230d33['model'];_0x2c6d53[_0x1820('0x35')]=qs[_0x1820('0x36')](_0x3c4f99[_0x1820('0x2d')][_0x1820('0x36')]);_0x2c6d53['where']=qs[_0x1820('0x2e')](_[_0x1820('0x38')](_0x3c4f99[_0x1820('0x2d')],_0x230d33[_0x1820('0x2e')]));if(_0x3c4f99[_0x1820('0x2d')]['filter']){_0x2c6d53[_0x1820('0x37')]=_[_0x1820('0x3a')](_0x2c6d53[_0x1820('0x37')],{'$or':_[_0x1820('0x26')](_0x2c6d53[_0x1820('0x2f')],function(_0x2cf027){var _0x1bc610={};_0x1bc610[_0x2cf027]={'$like':'%'+_0x3c4f99['query'][_0x1820('0x39')]+'%'};return _0x1bc610;})});}_0x2c6d53=_['merge']({},_0x2c6d53,_0x3c4f99['options']);return _0x1efe1b[_0x1820('0x49')](_0x2c6d53);}})[_0x1820('0x21')](function(_0x4061e4){if(_0x4061e4){_0x468acb=_0x4061e4['length'];if(!_0x3c4f99[_0x1820('0x2d')][_0x1820('0x33')]('nolimit')){_0x2c6d53[_0x1820('0x1c')]=qs[_0x1820('0x1c')](_0x3c4f99[_0x1820('0x2d')]['limit']);_0x2c6d53['offset']=qs[_0x1820('0x1a')](_0x3c4f99[_0x1820('0x2d')][_0x1820('0x1a')]);}return _0x1efe1b[_0x1820('0x49')](_0x2c6d53);}})[_0x1820('0x21')](function(_0x300a86){if(_0x300a86){return _0x300a86?{'count':_0x468acb,'rows':_0x300a86}:null;}})[_0x1820('0x21')](respondWithResult(_0x7cd962,null))[_0x1820('0x43')](handleError(_0x7cd962,null));};exports[_0x1820('0x4a')]=function(_0x228b2f,_0x4a81ff,_0x353bd5){var _0x5dea43={};var _0xd370bd={};var _0x44d80b;var _0x10a3ef;return db['Dynamics365Configuration'][_0x1820('0x47')]({'where':{'id':_0x228b2f['params']['id']}})['then'](handleEntityNotFound(_0x4a81ff,null))[_0x1820('0x21')](function(_0x404a77){if(_0x404a77){_0x44d80b=_0x404a77;_0xd370bd[_0x1820('0x2c')]=_['keys'](db[_0x1820('0x48')][_0x1820('0x28')]);_0xd370bd['query']=_[_0x1820('0x3f')](_0x228b2f[_0x1820('0x2d')]);_0xd370bd[_0x1820('0x2e')]=_[_0x1820('0x30')](_0xd370bd[_0x1820('0x2c')],_0xd370bd[_0x1820('0x2d')]);_0x5dea43[_0x1820('0x2f')]=_[_0x1820('0x30')](_0xd370bd[_0x1820('0x2c')],qs[_0x1820('0x31')](_0x228b2f['query']['fields']));_0x5dea43[_0x1820('0x2f')]=_0x5dea43[_0x1820('0x2f')][_0x1820('0x32')]?_0x5dea43[_0x1820('0x2f')]:_0xd370bd[_0x1820('0x2c')];_0x5dea43[_0x1820('0x35')]=qs[_0x1820('0x36')](_0x228b2f['query'][_0x1820('0x36')]);_0x5dea43['where']=qs[_0x1820('0x2e')](_['pick'](_0x228b2f[_0x1820('0x2d')],_0xd370bd['filters']));if(_0x228b2f['query'][_0x1820('0x39')]){_0x5dea43[_0x1820('0x37')]=_[_0x1820('0x3a')](_0x5dea43[_0x1820('0x37')],{'$or':_[_0x1820('0x26')](_0x5dea43[_0x1820('0x2f')],function(_0x3b2f0e){var _0x4a70f7={};_0x4a70f7[_0x3b2f0e]={'$like':'%'+_0x228b2f[_0x1820('0x2d')][_0x1820('0x39')]+'%'};return _0x4a70f7;})});}_0x5dea43=_['merge']({},_0x5dea43,_0x228b2f[_0x1820('0x3c')]);return _0x44d80b[_0x1820('0x4a')](_0x5dea43);}})[_0x1820('0x21')](function(_0x4e3676){if(_0x4e3676){_0x10a3ef=_0x4e3676[_0x1820('0x32')];if(!_0x228b2f[_0x1820('0x2d')][_0x1820('0x33')](_0x1820('0x34'))){_0x5dea43[_0x1820('0x1c')]=qs[_0x1820('0x1c')](_0x228b2f['query'][_0x1820('0x1c')]);_0x5dea43[_0x1820('0x1a')]=qs[_0x1820('0x1a')](_0x228b2f[_0x1820('0x2d')][_0x1820('0x1a')]);}return _0x44d80b[_0x1820('0x4a')](_0x5dea43);}})[_0x1820('0x21')](function(_0x1a9e64){if(_0x1a9e64){return _0x1a9e64?{'count':_0x10a3ef,'rows':_0x1a9e64}:null;}})[_0x1820('0x21')](respondWithResult(_0x4a81ff,null))[_0x1820('0x43')](handleError(_0x4a81ff,null));};exports['getDescriptions']=function(_0x2290d2,_0xdc8770,_0x5117bb){var _0x33622b={};var _0x243614={};var _0x20e7eb;var _0x17077f;return db[_0x1820('0x27')][_0x1820('0x47')]({'where':{'id':_0x2290d2[_0x1820('0x46')]['id']}})[_0x1820('0x21')](handleEntityNotFound(_0xdc8770,null))['then'](function(_0x3c54b){if(_0x3c54b){_0x20e7eb=_0x3c54b;_0x243614['model']=_['keys'](db[_0x1820('0x48')][_0x1820('0x28')]);_0x243614[_0x1820('0x2d')]=_[_0x1820('0x3f')](_0x2290d2[_0x1820('0x2d')]);_0x243614[_0x1820('0x2e')]=_[_0x1820('0x30')](_0x243614[_0x1820('0x2c')],_0x243614[_0x1820('0x2d')]);_0x33622b[_0x1820('0x2f')]=_[_0x1820('0x30')](_0x243614[_0x1820('0x2c')],qs[_0x1820('0x31')](_0x2290d2[_0x1820('0x2d')][_0x1820('0x31')]));_0x33622b[_0x1820('0x2f')]=_0x33622b[_0x1820('0x2f')][_0x1820('0x32')]?_0x33622b[_0x1820('0x2f')]:_0x243614[_0x1820('0x2c')];_0x33622b[_0x1820('0x35')]=qs[_0x1820('0x36')](_0x2290d2[_0x1820('0x2d')][_0x1820('0x36')]);_0x33622b[_0x1820('0x37')]=qs[_0x1820('0x2e')](_[_0x1820('0x38')](_0x2290d2[_0x1820('0x2d')],_0x243614[_0x1820('0x2e')]));if(_0x2290d2['query'][_0x1820('0x39')]){_0x33622b[_0x1820('0x37')]=_[_0x1820('0x3a')](_0x33622b['where'],{'$or':_[_0x1820('0x26')](_0x33622b[_0x1820('0x2f')],function(_0x3f2d21){var _0x511ea7={};_0x511ea7[_0x3f2d21]={'$like':'%'+_0x2290d2[_0x1820('0x2d')][_0x1820('0x39')]+'%'};return _0x511ea7;})});}_0x33622b=_[_0x1820('0x3a')]({},_0x33622b,_0x2290d2[_0x1820('0x3c')]);return _0x20e7eb[_0x1820('0x4b')](_0x33622b);}})[_0x1820('0x21')](function(_0x4b06aa){if(_0x4b06aa){_0x17077f=_0x4b06aa['length'];if(!_0x2290d2['query'][_0x1820('0x33')](_0x1820('0x34'))){_0x33622b['limit']=qs[_0x1820('0x1c')](_0x2290d2[_0x1820('0x2d')][_0x1820('0x1c')]);_0x33622b[_0x1820('0x1a')]=qs[_0x1820('0x1a')](_0x2290d2[_0x1820('0x2d')]['offset']);}return _0x20e7eb[_0x1820('0x4b')](_0x33622b);}})[_0x1820('0x21')](function(_0x2aa670){if(_0x2aa670){return _0x2aa670?{'count':_0x17077f,'rows':_0x2aa670}:null;}})[_0x1820('0x21')](respondWithResult(_0xdc8770,null))[_0x1820('0x43')](handleError(_0xdc8770,null));}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 81e0b45..5c49e10 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x5574ba,_0x1f0b57){var _0x172ffd=function(_0x32eeee){while(--_0x32eeee){_0x5574ba['push'](_0x5574ba['shift']());}};_0x172ffd(++_0x1f0b57);}(_0x84ab,0x12f));var _0xb84a=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x84ab[_0x37756b];return _0x46efec;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index ca77981..d25928e 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 _0x0496=['catch','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1e8ada,_0x197ef3){var _0x3e6bad=function(_0x3f0a59){while(--_0x3f0a59){_0x1e8ada['push'](_0x1e8ada['shift']());}};_0x3e6bad(++_0x197ef3);}(_0x0496,0x10b));var _0x6049=function(_0x288439,_0x592260){_0x288439=_0x288439-0x0;var _0xdf937e=_0x0496[_0x288439];return _0xdf937e;};'use strict';var _=require(_0x6049('0x0'));var util=require('util');var moment=require(_0x6049('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(_0x6049('0x2'));var logger=require(_0x6049('0x3'))(_0x6049('0x4'));var config=require(_0x6049('0x5'));var jayson=require(_0x6049('0x6'));var client=jayson['client'][_0x6049('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xea7d2b,_0x1ccb17,_0x3c2533){return new BPromise(function(_0x908981,_0x50ae5f){return client[_0x6049('0x8')](_0xea7d2b,_0x3c2533)['then'](function(_0x533e58){logger[_0x6049('0x9')](_0x6049('0xa'),_0x1ccb17,_0x6049('0xb'));logger[_0x6049('0xc')](_0x6049('0xd'),_0x1ccb17,_0x6049('0xb'),JSON[_0x6049('0xe')](_0x533e58));if(_0x533e58[_0x6049('0xf')]){if(_0x533e58[_0x6049('0xf')][_0x6049('0x10')]===0x1f4){logger['error'](_0x6049('0xa'),_0x1ccb17,_0x533e58[_0x6049('0xf')][_0x6049('0x11')]);return _0x50ae5f(_0x533e58['error'][_0x6049('0x11')]);}logger[_0x6049('0xf')](_0x6049('0xa'),_0x1ccb17,_0x533e58[_0x6049('0xf')][_0x6049('0x11')]);return _0x908981(_0x533e58[_0x6049('0xf')]['message']);}else{logger[_0x6049('0x9')](_0x6049('0xa'),_0x1ccb17,'request\x20sent');_0x908981(_0x533e58['result'][_0x6049('0x11')]);}})[_0x6049('0x12')](function(_0x4c7789){logger[_0x6049('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1ccb17,_0x4c7789);_0x50ae5f(_0x4c7789);});});} \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c5b2d18..d1527cc 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 _0x52a6=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x41f6d4,_0x255693){var _0x42a2a9=function(_0x1d0a8){while(--_0x1d0a8){_0x41f6d4['push'](_0x41f6d4['shift']());}};_0x42a2a9(++_0x255693);}(_0x52a6,0xf1));var _0x652a=function(_0xa17c89,_0xf1910b){_0xa17c89=_0xa17c89-0x0;var _0x1c9101=_0x52a6[_0xa17c89];return _0x1c9101;};'use strict';var multer=require(_0x652a('0x0'));var util=require(_0x652a('0x1'));var path=require(_0x652a('0x2'));var timeout=require(_0x652a('0x3'));var express=require('express');var router=express[_0x652a('0x4')]();var fs_extra=require(_0x652a('0x5'));var auth=require(_0x652a('0x6'));var interaction=require(_0x652a('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x652a('0x8')]('/',auth[_0x652a('0x9')](),controller[_0x652a('0xa')]);router['get']('/:id',auth[_0x652a('0x9')](),controller[_0x652a('0xb')]);router[_0x652a('0xc')]('/',auth[_0x652a('0x9')](),controller[_0x652a('0xd')]);router[_0x652a('0xe')](_0x652a('0xf'),auth[_0x652a('0x9')](),controller[_0x652a('0x10')]);router[_0x652a('0x11')](_0x652a('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x652a('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5b32bb9..fb36f68 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 _0x9894=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x40c15d,_0x57c427){var _0x41d07a=function(_0x14ea3f){while(--_0x14ea3f){_0x40c15d['push'](_0x40c15d['shift']());}};_0x41d07a(++_0x57c427);}(_0x9894,0xd1));var _0x4989=function(_0x126173,_0x578137){_0x126173=_0x126173-0x0;var _0x5c7d40=_0x9894[_0x126173];return _0x5c7d40;};'use strict';var Sequelize=require(_0x4989('0x0'));module[_0x4989('0x1')]={'type':{'type':Sequelize[_0x4989('0x2')](_0x4989('0x3'),_0x4989('0x4'),_0x4989('0x5'),_0x4989('0x6'),_0x4989('0x7')),'defaultValue':_0x4989('0x3')},'content':{'type':Sequelize[_0x4989('0x8')]},'key':{'type':Sequelize[_0x4989('0x8')]},'keyType':{'type':Sequelize[_0x4989('0x2')](_0x4989('0x3'),_0x4989('0x4'),_0x4989('0x5'))},'keyContent':{'type':Sequelize[_0x4989('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4989('0x8')]},'customField':{'type':Sequelize[_0x4989('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4989('0x8')]}}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ed07e5d..f864d08 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 _0xbcc6=['Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x20dc79,_0x533fc6){var _0x29709a=function(_0x5dfffa){while(--_0x5dfffa){_0x20dc79['push'](_0x20dc79['shift']());}};_0x29709a(++_0x533fc6);}(_0xbcc6,0x70));var _0x6bcc=function(_0x4ceeec,_0x514fe){_0x4ceeec=_0x4ceeec-0x0;var _0x5291d8=_0xbcc6[_0x4ceeec];return _0x5291d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6bcc('0x0'));var jsonpatch=require(_0x6bcc('0x1'));var rp=require(_0x6bcc('0x2'));var moment=require(_0x6bcc('0x3'));var BPromise=require(_0x6bcc('0x4'));var Mustache=require(_0x6bcc('0x5'));var util=require(_0x6bcc('0x6'));var path=require(_0x6bcc('0x7'));var sox=require(_0x6bcc('0x8'));var csv=require(_0x6bcc('0x9'));var ejs=require(_0x6bcc('0xa'));var fs=require('fs');var fs_extra=require(_0x6bcc('0xb'));var _=require(_0x6bcc('0xc'));var squel=require(_0x6bcc('0xd'));var crypto=require(_0x6bcc('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6bcc('0xf'));var toCsv=require(_0x6bcc('0x9'));var querystring=require(_0x6bcc('0x10'));var Papa=require(_0x6bcc('0x11'));var Redis=require('ioredis');var authService=require(_0x6bcc('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bcc('0x13'));var logger=require(_0x6bcc('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6bcc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bcc('0x16'))['db'];function respondWithStatusCode(_0x3ed7e6,_0x2997e8){_0x2997e8=_0x2997e8||0xcc;return function(_0x403d64){if(_0x403d64){return _0x3ed7e6[_0x6bcc('0x17')](_0x2997e8);}return _0x3ed7e6[_0x6bcc('0x18')](_0x2997e8)[_0x6bcc('0x19')]();};}function respondWithResult(_0x477752,_0x28a269){_0x28a269=_0x28a269||0xc8;return function(_0xe05799){if(_0xe05799){return _0x477752[_0x6bcc('0x18')](_0x28a269)[_0x6bcc('0x1a')](_0xe05799);}};}function respondWithFilteredResult(_0x2cc40c,_0x368d7a){return function(_0x39b4fe){if(_0x39b4fe){var _0x6ab730=typeof _0x368d7a[_0x6bcc('0x1b')]==='undefined'&&typeof _0x368d7a[_0x6bcc('0x1c')]===_0x6bcc('0x1d');var _0x53ed21=_0x39b4fe[_0x6bcc('0x1e')];var _0x5dab98=_0x6ab730?0x0:_0x368d7a[_0x6bcc('0x1b')];var _0x311632=_0x6ab730?_0x39b4fe[_0x6bcc('0x1e')]:_0x368d7a['offset']+_0x368d7a[_0x6bcc('0x1c')];var _0x349afc;if(_0x311632>=_0x53ed21){_0x311632=_0x53ed21;_0x349afc=0xc8;}else{_0x349afc=0xce;}_0x2cc40c[_0x6bcc('0x18')](_0x349afc);return _0x2cc40c[_0x6bcc('0x1f')](_0x6bcc('0x20'),_0x5dab98+'-'+_0x311632+'/'+_0x53ed21)[_0x6bcc('0x1a')](_0x39b4fe);}return null;};}function patchUpdates(_0x545c60){return function(_0x23d844){try{jsonpatch[_0x6bcc('0x21')](_0x23d844,_0x545c60,!![]);}catch(_0x122125){return BPromise[_0x6bcc('0x22')](_0x122125);}return _0x23d844[_0x6bcc('0x23')]();};}function saveUpdates(_0x495e40,_0x4302f8){return function(_0x3ddc16){if(_0x3ddc16){return _0x3ddc16[_0x6bcc('0x24')](_0x495e40)[_0x6bcc('0x25')](function(_0x54c827){return _0x54c827;});}return null;};}function removeEntity(_0x24bf43,_0x134746){return function(_0x1e04e7){if(_0x1e04e7){return _0x1e04e7[_0x6bcc('0x26')]()['then'](function(){_0x24bf43['status'](0xcc)[_0x6bcc('0x19')]();});}};}function handleEntityNotFound(_0x5aca4e,_0x9f5ac6){return function(_0x2e9cf8){if(!_0x2e9cf8){_0x5aca4e[_0x6bcc('0x17')](0x194);}return _0x2e9cf8;};}function handleError(_0x527e6f,_0x4f33ac){_0x4f33ac=_0x4f33ac||0x1f4;return function(_0x622e3f){logger[_0x6bcc('0x27')](_0x622e3f['stack']);if(_0x622e3f['name']){delete _0x622e3f[_0x6bcc('0x28')];}_0x527e6f[_0x6bcc('0x18')](_0x4f33ac)[_0x6bcc('0x29')](_0x622e3f);};}exports[_0x6bcc('0x2a')]=function(_0x4a6455,_0x1ea670){var _0x3748d5={},_0x383b35={},_0x58fdc2={'count':0x0,'rows':[]};var _0x2458f5=_[_0x6bcc('0x2b')](db[_0x6bcc('0x2c')][_0x6bcc('0x2d')],function(_0x5eb488){return{'name':_0x5eb488[_0x6bcc('0x2e')],'type':_0x5eb488[_0x6bcc('0x2f')][_0x6bcc('0x30')]};});_0x383b35['model']=_[_0x6bcc('0x2b')](_0x2458f5,'name');_0x383b35[_0x6bcc('0x31')]=_[_0x6bcc('0x32')](_0x4a6455[_0x6bcc('0x31')]);_0x383b35['filters']=_['intersection'](_0x383b35['model'],_0x383b35[_0x6bcc('0x31')]);_0x3748d5[_0x6bcc('0x33')]=_[_0x6bcc('0x34')](_0x383b35[_0x6bcc('0x35')],qs['fields'](_0x4a6455[_0x6bcc('0x31')][_0x6bcc('0x36')]));_0x3748d5[_0x6bcc('0x33')]=_0x3748d5[_0x6bcc('0x33')]['length']?_0x3748d5[_0x6bcc('0x33')]:_0x383b35[_0x6bcc('0x35')];if(!_0x4a6455[_0x6bcc('0x31')][_0x6bcc('0x37')](_0x6bcc('0x38'))){_0x3748d5[_0x6bcc('0x1c')]=qs[_0x6bcc('0x1c')](_0x4a6455['query'][_0x6bcc('0x1c')]);_0x3748d5[_0x6bcc('0x1b')]=qs[_0x6bcc('0x1b')](_0x4a6455[_0x6bcc('0x31')][_0x6bcc('0x1b')]);}_0x3748d5['order']=qs['sort'](_0x4a6455[_0x6bcc('0x31')]['sort']);_0x3748d5[_0x6bcc('0x39')]=qs[_0x6bcc('0x3a')](_['pick'](_0x4a6455['query'],_0x383b35[_0x6bcc('0x3a')]),_0x2458f5);if(_0x4a6455['query'][_0x6bcc('0x3b')]){_0x3748d5['where']=_[_0x6bcc('0x3c')](_0x3748d5[_0x6bcc('0x39')],{'$or':_[_0x6bcc('0x2b')](_0x2458f5,function(_0x3c1766){if(_0x3c1766[_0x6bcc('0x2f')]!==_0x6bcc('0x3d')){var _0x223c3e={};_0x223c3e[_0x3c1766[_0x6bcc('0x28')]]={'$like':'%'+_0x4a6455[_0x6bcc('0x31')][_0x6bcc('0x3b')]+'%'};return _0x223c3e;}})});}_0x3748d5=_[_0x6bcc('0x3c')]({},_0x3748d5,_0x4a6455[_0x6bcc('0x3e')]);var _0x2e16eb={'where':_0x3748d5[_0x6bcc('0x39')]};return db['Dynamics365Field'][_0x6bcc('0x1e')](_0x2e16eb)[_0x6bcc('0x25')](function(_0x13847d){_0x58fdc2[_0x6bcc('0x1e')]=_0x13847d;if(_0x4a6455[_0x6bcc('0x31')]['includeAll']){_0x3748d5[_0x6bcc('0x3f')]=[{'all':!![]}];}return db[_0x6bcc('0x2c')][_0x6bcc('0x40')](_0x3748d5);})[_0x6bcc('0x25')](function(_0x11af2a){_0x58fdc2['rows']=_0x11af2a;return _0x58fdc2;})['then'](respondWithFilteredResult(_0x1ea670,_0x3748d5))[_0x6bcc('0x41')](handleError(_0x1ea670,null));};exports[_0x6bcc('0x42')]=function(_0x222861,_0x494d08){var _0x4c4898={'raw':!![],'where':{'id':_0x222861['params']['id']}},_0xba83ec={};_0xba83ec[_0x6bcc('0x35')]=_[_0x6bcc('0x32')](db[_0x6bcc('0x2c')][_0x6bcc('0x2d')]);_0xba83ec[_0x6bcc('0x31')]=_[_0x6bcc('0x32')](_0x222861['query']);_0xba83ec[_0x6bcc('0x3a')]=_['intersection'](_0xba83ec[_0x6bcc('0x35')],_0xba83ec[_0x6bcc('0x31')]);_0x4c4898['attributes']=_[_0x6bcc('0x34')](_0xba83ec[_0x6bcc('0x35')],qs['fields'](_0x222861['query'][_0x6bcc('0x36')]));_0x4c4898['attributes']=_0x4c4898[_0x6bcc('0x33')][_0x6bcc('0x43')]?_0x4c4898[_0x6bcc('0x33')]:_0xba83ec['model'];if(_0x222861[_0x6bcc('0x31')]['includeAll']){_0x4c4898[_0x6bcc('0x3f')]=[{'all':!![]}];}_0x4c4898=_[_0x6bcc('0x3c')]({},_0x4c4898,_0x222861[_0x6bcc('0x3e')]);return db[_0x6bcc('0x2c')][_0x6bcc('0x44')](_0x4c4898)[_0x6bcc('0x25')](handleEntityNotFound(_0x494d08,null))[_0x6bcc('0x25')](respondWithResult(_0x494d08,null))[_0x6bcc('0x41')](handleError(_0x494d08,null));};exports[_0x6bcc('0x45')]=function(_0x322668,_0x1f39e4){return db[_0x6bcc('0x2c')]['create'](_0x322668[_0x6bcc('0x46')],{})[_0x6bcc('0x25')](respondWithResult(_0x1f39e4,0xc9))[_0x6bcc('0x41')](handleError(_0x1f39e4,null));};exports[_0x6bcc('0x24')]=function(_0x56c765,_0x23c112){if(_0x56c765[_0x6bcc('0x46')]['id']){delete _0x56c765['body']['id'];}return db[_0x6bcc('0x2c')][_0x6bcc('0x44')]({'where':{'id':_0x56c765['params']['id']}})[_0x6bcc('0x25')](handleEntityNotFound(_0x23c112,null))[_0x6bcc('0x25')](saveUpdates(_0x56c765[_0x6bcc('0x46')],null))[_0x6bcc('0x25')](respondWithResult(_0x23c112,null))['catch'](handleError(_0x23c112,null));};exports['destroy']=function(_0x5610cd,_0x5d2cc7){return db[_0x6bcc('0x2c')][_0x6bcc('0x44')]({'where':{'id':_0x5610cd[_0x6bcc('0x47')]['id']}})[_0x6bcc('0x25')](handleEntityNotFound(_0x5d2cc7,null))[_0x6bcc('0x25')](removeEntity(_0x5d2cc7,null))['catch'](handleError(_0x5d2cc7,null));}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7defab9..43248b8 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 _0xb03e=['bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x4d090e,_0x5ea3fe){var _0x314000=function(_0x2163cc){while(--_0x2163cc){_0x4d090e['push'](_0x4d090e['shift']());}};_0x314000(++_0x5ea3fe);}(_0xb03e,0xec));var _0xeb03=function(_0x4c0922,_0x39cdda){_0x4c0922=_0x4c0922-0x0;var _0x12a55f=_0xb03e[_0x4c0922];return _0x12a55f;};'use strict';var _=require(_0xeb03('0x0'));var util=require(_0xeb03('0x1'));var logger=require(_0xeb03('0x2'))(_0xeb03('0x3'));var moment=require('moment');var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var attributes=require(_0xeb03('0x8'));module[_0xeb03('0x9')]=function(_0x251851,_0x284ed5){return _0x251851[_0xeb03('0xa')](_0xeb03('0xb'),attributes,{'tableName':_0xeb03('0xc'),'paranoid':![],'indexes':[{'name':_0xeb03('0xd'),'fields':[_0xeb03('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index a1f4765..dbca389 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 _0x3d5a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring'];(function(_0x46e049,_0x5eca7c){var _0x2c30b6=function(_0x224784){while(--_0x224784){_0x46e049['push'](_0x46e049['shift']());}};_0x2c30b6(++_0x5eca7c);}(_0x3d5a,0x105));var _0xa3d5=function(_0x5b209c,_0x1d3141){_0x5b209c=_0x5b209c-0x0;var _0x1afe7a=_0x3d5a[_0x5b209c];return _0x1afe7a;};'use strict';var _=require(_0xa3d5('0x0'));var util=require('util');var moment=require(_0xa3d5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa3d5('0x2'));var fs=require('fs');var Redis=require(_0xa3d5('0x3'));var db=require(_0xa3d5('0x4'))['db'];var utils=require(_0xa3d5('0x5'));var logger=require(_0xa3d5('0x6'))(_0xa3d5('0x7'));var config=require(_0xa3d5('0x8'));var jayson=require(_0xa3d5('0x9'));var client=jayson[_0xa3d5('0xa')][_0xa3d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cef06,_0x39191b,_0x38c544){return new BPromise(function(_0x41c7d2,_0x4588f7){return client['request'](_0x1cef06,_0x38c544)[_0xa3d5('0xc')](function(_0x4b651f){logger[_0xa3d5('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x39191b,_0xa3d5('0xe'));logger[_0xa3d5('0xf')](_0xa3d5('0x10'),_0x39191b,_0xa3d5('0xe'),JSON[_0xa3d5('0x11')](_0x4b651f));if(_0x4b651f[_0xa3d5('0x12')]){if(_0x4b651f[_0xa3d5('0x12')][_0xa3d5('0x13')]===0x1f4){logger[_0xa3d5('0x12')](_0xa3d5('0x14'),_0x39191b,_0x4b651f[_0xa3d5('0x12')][_0xa3d5('0x15')]);return _0x4588f7(_0x4b651f[_0xa3d5('0x12')][_0xa3d5('0x15')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x39191b,_0x4b651f[_0xa3d5('0x12')][_0xa3d5('0x15')]);return _0x41c7d2(_0x4b651f[_0xa3d5('0x12')][_0xa3d5('0x15')]);}else{logger['info'](_0xa3d5('0x14'),_0x39191b,_0xa3d5('0xe'));_0x41c7d2(_0x4b651f[_0xa3d5('0x16')][_0xa3d5('0x15')]);}})[_0xa3d5('0x17')](function(_0x14b2ec){logger['error'](_0xa3d5('0x14'),_0x39191b,_0x14b2ec);_0x4588f7(_0x14b2ec);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index aefcdca..29c01a8 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 _0x7234=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x7234,0xf3));var _0x4723=function(_0x2c84e5,_0x58a7c7){_0x2c84e5=_0x2c84e5-0x0;var _0x4990ec=_0x7234[_0x2c84e5];return _0x4990ec;};'use strict';var multer=require(_0x4723('0x0'));var util=require(_0x4723('0x1'));var path=require(_0x4723('0x2'));var timeout=require(_0x4723('0x3'));var express=require(_0x4723('0x4'));var router=express[_0x4723('0x5')]();var fs_extra=require(_0x4723('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4723('0x7'));var config=require(_0x4723('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x4723('0x9')]('/',auth[_0x4723('0xa')](),controller[_0x4723('0xb')]);router[_0x4723('0x9')](_0x4723('0xc'),auth['isAuthenticated'](),controller[_0x4723('0xd')]);router[_0x4723('0x9')](_0x4723('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x4723('0x9')](_0x4723('0xf'),auth[_0x4723('0xa')](),controller[_0x4723('0x10')]);router[_0x4723('0x11')]('/',auth[_0x4723('0xa')](),controller[_0x4723('0x12')]);router[_0x4723('0x11')](_0x4723('0xe'),auth[_0x4723('0xa')](),controller[_0x4723('0x13')]);router[_0x4723('0x14')](_0x4723('0xc'),auth['isAuthenticated'](),controller[_0x4723('0x15')]);router[_0x4723('0x16')](_0x4723('0xc'),auth[_0x4723('0xa')](),controller[_0x4723('0x17')]);module[_0x4723('0x18')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index a6c44d5..46a2148 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 _0x1a37=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2f8255,_0x44ff85){var _0x2207f6=function(_0x30c5c2){while(--_0x30c5c2){_0x2f8255['push'](_0x2f8255['shift']());}};_0x2207f6(++_0x44ff85);}(_0x1a37,0xb4));var _0x71a3=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x1a37[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'apiKey':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'serverUrl':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6d88a6f..b8c8d7b 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 _0x8a9a=['hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','substring','lastIndexOf','GET','format','%s:X','toString','base64','requester','subject','agent','description','priority','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x8a9a,0x193));var _0xa8a9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8a9a[_0x209941];return _0x1e8729;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8a9('0x0'));var jsonpatch=require(_0xa8a9('0x1'));var rp=require(_0xa8a9('0x2'));var moment=require('moment');var BPromise=require(_0xa8a9('0x3'));var Mustache=require(_0xa8a9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa8a9('0x5'));var csv=require(_0xa8a9('0x6'));var ejs=require(_0xa8a9('0x7'));var fs=require('fs');var fs_extra=require(_0xa8a9('0x8'));var _=require(_0xa8a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8a9('0xa'));var deskjs=require(_0xa8a9('0xb'));var toCsv=require(_0xa8a9('0x6'));var querystring=require(_0xa8a9('0xc'));var Papa=require(_0xa8a9('0xd'));var Redis=require(_0xa8a9('0xe'));var authService=require(_0xa8a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8a9('0x11'))('api');var utils=require(_0xa8a9('0x12'));var config=require(_0xa8a9('0x13'));var licenseUtil=require(_0xa8a9('0x14'));var db=require(_0xa8a9('0x15'))['db'];var integrations=require(_0xa8a9('0x16'));function respondWithStatusCode(_0x16d838,_0x53fbc5){_0x53fbc5=_0x53fbc5||0xcc;return function(_0x493884){if(_0x493884){return _0x16d838[_0xa8a9('0x17')](_0x53fbc5);}return _0x16d838['status'](_0x53fbc5)[_0xa8a9('0x18')]();};}function respondWithResult(_0x34bec9,_0x3a0e08){_0x3a0e08=_0x3a0e08||0xc8;return function(_0xf662a6){if(_0xf662a6){return _0x34bec9[_0xa8a9('0x19')](_0x3a0e08)['json'](_0xf662a6);}};}function respondWithFilteredResult(_0x3593fa,_0x5c2cde){return function(_0x1c7d52){if(_0x1c7d52){var _0x4d55e1=typeof _0x5c2cde[_0xa8a9('0x1a')]===_0xa8a9('0x1b')&&typeof _0x5c2cde['limit']===_0xa8a9('0x1b');var _0x5f5bf0=_0x1c7d52[_0xa8a9('0x1c')];var _0x304a50=_0x4d55e1?0x0:_0x5c2cde[_0xa8a9('0x1a')];var _0x18cc67=_0x4d55e1?_0x1c7d52['count']:_0x5c2cde['offset']+_0x5c2cde[_0xa8a9('0x1d')];var _0x4c1c6e;if(_0x18cc67>=_0x5f5bf0){_0x18cc67=_0x5f5bf0;_0x4c1c6e=0xc8;}else{_0x4c1c6e=0xce;}_0x3593fa[_0xa8a9('0x19')](_0x4c1c6e);return _0x3593fa[_0xa8a9('0x1e')](_0xa8a9('0x1f'),_0x304a50+'-'+_0x18cc67+'/'+_0x5f5bf0)[_0xa8a9('0x20')](_0x1c7d52);}return null;};}function patchUpdates(_0x126648){return function(_0x3c4bac){try{jsonpatch[_0xa8a9('0x21')](_0x3c4bac,_0x126648,!![]);}catch(_0x159586){return BPromise[_0xa8a9('0x22')](_0x159586);}return _0x3c4bac[_0xa8a9('0x23')]();};}function saveUpdates(_0x1cc77a,_0x2fd285){return function(_0x433a63){if(_0x433a63){return _0x433a63['update'](_0x1cc77a)['then'](function(_0x4343f4){return _0x4343f4;});}return null;};}function removeEntity(_0xa4c41a,_0x32e784){return function(_0x546467){if(_0x546467){return _0x546467[_0xa8a9('0x24')]()[_0xa8a9('0x25')](function(){_0xa4c41a[_0xa8a9('0x19')](0xcc)[_0xa8a9('0x18')]();});}};}function handleEntityNotFound(_0x488791,_0x20fb5a){return function(_0x2ef0f2){if(!_0x2ef0f2){_0x488791[_0xa8a9('0x17')](0x194);}return _0x2ef0f2;};}function handleError(_0x1aef34,_0x5f0c62){_0x5f0c62=_0x5f0c62||0x1f4;return function(_0x5bcc97){logger[_0xa8a9('0x26')](_0x5bcc97[_0xa8a9('0x27')]);if(_0x5bcc97[_0xa8a9('0x28')]){delete _0x5bcc97[_0xa8a9('0x28')];}_0x1aef34[_0xa8a9('0x19')](_0x5f0c62)[_0xa8a9('0x29')](_0x5bcc97);};}exports[_0xa8a9('0x2a')]=function(_0x155527,_0x4c87d4){var _0x45714a={},_0x444b7a={},_0x128727={'count':0x0,'rows':[]};var _0x2977aa=_[_0xa8a9('0x2b')](db[_0xa8a9('0x2c')][_0xa8a9('0x2d')],function(_0x21177e){return{'name':_0x21177e[_0xa8a9('0x2e')],'type':_0x21177e[_0xa8a9('0x2f')][_0xa8a9('0x30')]};});_0x444b7a[_0xa8a9('0x31')]=_[_0xa8a9('0x2b')](_0x2977aa,_0xa8a9('0x28'));_0x444b7a[_0xa8a9('0x32')]=_[_0xa8a9('0x33')](_0x155527['query']);_0x444b7a[_0xa8a9('0x34')]=_[_0xa8a9('0x35')](_0x444b7a[_0xa8a9('0x31')],_0x444b7a[_0xa8a9('0x32')]);_0x45714a['attributes']=_[_0xa8a9('0x35')](_0x444b7a[_0xa8a9('0x31')],qs['fields'](_0x155527[_0xa8a9('0x32')][_0xa8a9('0x36')]));_0x45714a[_0xa8a9('0x37')]=_0x45714a[_0xa8a9('0x37')][_0xa8a9('0x38')]?_0x45714a['attributes']:_0x444b7a[_0xa8a9('0x31')];if(!_0x155527[_0xa8a9('0x32')][_0xa8a9('0x39')](_0xa8a9('0x3a'))){_0x45714a[_0xa8a9('0x1d')]=qs[_0xa8a9('0x1d')](_0x155527['query'][_0xa8a9('0x1d')]);_0x45714a['offset']=qs['offset'](_0x155527['query']['offset']);}_0x45714a[_0xa8a9('0x3b')]=qs['sort'](_0x155527[_0xa8a9('0x32')]['sort']);_0x45714a[_0xa8a9('0x3c')]=qs[_0xa8a9('0x34')](_[_0xa8a9('0x3d')](_0x155527[_0xa8a9('0x32')],_0x444b7a[_0xa8a9('0x34')]),_0x2977aa);if(_0x155527[_0xa8a9('0x32')][_0xa8a9('0x3e')]){_0x45714a[_0xa8a9('0x3c')]=_['merge'](_0x45714a[_0xa8a9('0x3c')],{'$or':_[_0xa8a9('0x2b')](_0x2977aa,function(_0x3eae47){if(_0x3eae47[_0xa8a9('0x2f')]!==_0xa8a9('0x3f')){var _0x17b76a={};_0x17b76a[_0x3eae47[_0xa8a9('0x28')]]={'$like':'%'+_0x155527[_0xa8a9('0x32')][_0xa8a9('0x3e')]+'%'};return _0x17b76a;}})});}_0x45714a=_[_0xa8a9('0x40')]({},_0x45714a,_0x155527[_0xa8a9('0x41')]);var _0x34dee0={'where':_0x45714a[_0xa8a9('0x3c')]};return db[_0xa8a9('0x2c')][_0xa8a9('0x1c')](_0x34dee0)[_0xa8a9('0x25')](function(_0x13540c){_0x128727['count']=_0x13540c;if(_0x155527[_0xa8a9('0x32')][_0xa8a9('0x42')]){_0x45714a[_0xa8a9('0x43')]=[{'all':!![]}];}return db[_0xa8a9('0x2c')][_0xa8a9('0x44')](_0x45714a);})[_0xa8a9('0x25')](function(_0x1db3c0){_0x128727[_0xa8a9('0x45')]=_0x1db3c0;return _0x128727;})[_0xa8a9('0x25')](respondWithFilteredResult(_0x4c87d4,_0x45714a))[_0xa8a9('0x46')](handleError(_0x4c87d4,null));};exports[_0xa8a9('0x47')]=function(_0xf1d7c6,_0x12e535){var _0x49381e={'raw':![],'where':{'id':_0xf1d7c6[_0xa8a9('0x48')]['id']}},_0x495be3={};_0x495be3['model']=_[_0xa8a9('0x33')](db[_0xa8a9('0x2c')][_0xa8a9('0x2d')]);_0x495be3['query']=_[_0xa8a9('0x33')](_0xf1d7c6[_0xa8a9('0x32')]);_0x495be3[_0xa8a9('0x34')]=_[_0xa8a9('0x35')](_0x495be3[_0xa8a9('0x31')],_0x495be3['query']);_0x49381e[_0xa8a9('0x37')]=_[_0xa8a9('0x35')](_0x495be3[_0xa8a9('0x31')],qs[_0xa8a9('0x36')](_0xf1d7c6[_0xa8a9('0x32')][_0xa8a9('0x36')]));_0x49381e['attributes']=_0x49381e[_0xa8a9('0x37')][_0xa8a9('0x38')]?_0x49381e['attributes']:_0x495be3[_0xa8a9('0x31')];if(_0xf1d7c6[_0xa8a9('0x32')][_0xa8a9('0x42')]){_0x49381e[_0xa8a9('0x43')]=[{'all':!![]}];}_0x49381e=_[_0xa8a9('0x40')]({},_0x49381e,_0xf1d7c6[_0xa8a9('0x41')]);return db[_0xa8a9('0x2c')][_0xa8a9('0x49')](_0x49381e)[_0xa8a9('0x25')](handleEntityNotFound(_0x12e535,null))[_0xa8a9('0x25')](respondWithResult(_0x12e535,null))['catch'](handleError(_0x12e535,null));};exports[_0xa8a9('0x4a')]=function(_0x17e43c,_0x17e720){return db[_0xa8a9('0x2c')][_0xa8a9('0x4a')](_0x17e43c[_0xa8a9('0x4b')],{})[_0xa8a9('0x25')](respondWithResult(_0x17e720,0xc9))[_0xa8a9('0x46')](handleError(_0x17e720,null));};exports[_0xa8a9('0x4c')]=function(_0x43e080,_0x4e4973){if(_0x43e080['body']['id']){delete _0x43e080[_0xa8a9('0x4b')]['id'];}return db[_0xa8a9('0x2c')][_0xa8a9('0x49')]({'where':{'id':_0x43e080['params']['id']}})[_0xa8a9('0x25')](handleEntityNotFound(_0x4e4973,null))['then'](saveUpdates(_0x43e080[_0xa8a9('0x4b')],null))[_0xa8a9('0x25')](respondWithResult(_0x4e4973,null))['catch'](handleError(_0x4e4973,null));};exports[_0xa8a9('0x24')]=function(_0x506e40,_0x124e3c){return db[_0xa8a9('0x2c')][_0xa8a9('0x49')]({'where':{'id':_0x506e40['params']['id']}})['then'](handleEntityNotFound(_0x124e3c,null))[_0xa8a9('0x25')](removeEntity(_0x124e3c,null))[_0xa8a9('0x46')](handleError(_0x124e3c,null));};exports[_0xa8a9('0x4d')]=function(_0xa2f468,_0x1f8c03,_0x44e4de){var _0xa29b5d={};var _0x4f3893={};var _0x114769;var _0x4157ef;return db[_0xa8a9('0x2c')][_0xa8a9('0x4e')]({'where':{'id':_0xa2f468[_0xa8a9('0x48')]['id']}})[_0xa8a9('0x25')](handleEntityNotFound(_0x1f8c03,null))['then'](function(_0x31141a){if(_0x31141a){_0x114769=_0x31141a;_0x4f3893['model']=_['keys'](db[_0xa8a9('0x4f')][_0xa8a9('0x2d')]);_0x4f3893[_0xa8a9('0x32')]=_['keys'](_0xa2f468[_0xa8a9('0x32')]);_0x4f3893[_0xa8a9('0x34')]=_['intersection'](_0x4f3893[_0xa8a9('0x31')],_0x4f3893[_0xa8a9('0x32')]);_0xa29b5d['attributes']=_[_0xa8a9('0x35')](_0x4f3893[_0xa8a9('0x31')],qs[_0xa8a9('0x36')](_0xa2f468['query'][_0xa8a9('0x36')]));_0xa29b5d[_0xa8a9('0x37')]=_0xa29b5d[_0xa8a9('0x37')]['length']?_0xa29b5d['attributes']:_0x4f3893[_0xa8a9('0x31')];_0xa29b5d[_0xa8a9('0x3b')]=qs[_0xa8a9('0x50')](_0xa2f468[_0xa8a9('0x32')]['sort']);_0xa29b5d['where']=qs[_0xa8a9('0x34')](_['pick'](_0xa2f468['query'],_0x4f3893['filters']));if(_0xa2f468[_0xa8a9('0x32')][_0xa8a9('0x3e')]){_0xa29b5d['where']=_[_0xa8a9('0x40')](_0xa29b5d[_0xa8a9('0x3c')],{'$or':_[_0xa8a9('0x2b')](_0xa29b5d[_0xa8a9('0x37')],function(_0x429b11){var _0x36446f={};_0x36446f[_0x429b11]={'$like':'%'+_0xa2f468['query']['filter']+'%'};return _0x36446f;})});}_0xa29b5d=_[_0xa8a9('0x40')]({},_0xa29b5d,_0xa2f468[_0xa8a9('0x41')]);return _0x114769[_0xa8a9('0x4d')](_0xa29b5d);}})[_0xa8a9('0x25')](function(_0x2527bf){if(_0x2527bf){_0x4157ef=_0x2527bf['length'];if(!_0xa2f468[_0xa8a9('0x32')][_0xa8a9('0x39')]('nolimit')){_0xa29b5d[_0xa8a9('0x1d')]=qs[_0xa8a9('0x1d')](_0xa2f468['query'][_0xa8a9('0x1d')]);_0xa29b5d[_0xa8a9('0x1a')]=qs[_0xa8a9('0x1a')](_0xa2f468[_0xa8a9('0x32')][_0xa8a9('0x1a')]);}return _0x114769[_0xa8a9('0x4d')](_0xa29b5d);}})[_0xa8a9('0x25')](function(_0x4d162e){if(_0x4d162e){return _0x4d162e?{'count':_0x4157ef,'rows':_0x4d162e}:null;}})[_0xa8a9('0x25')](respondWithResult(_0x1f8c03,null))[_0xa8a9('0x46')](handleError(_0x1f8c03,null));};exports[_0xa8a9('0x51')]=function(_0x1a3bdc,_0x2fdc6f,_0x4a3fea){if(_0x1a3bdc[_0xa8a9('0x4b')]['id']){delete _0x1a3bdc[_0xa8a9('0x4b')]['id'];}return db[_0xa8a9('0x2c')][_0xa8a9('0x4e')]({'where':{'id':_0x1a3bdc[_0xa8a9('0x48')]['id']}})[_0xa8a9('0x25')](handleEntityNotFound(_0x2fdc6f,null))[_0xa8a9('0x25')](function(_0x3252c7){if(_0x3252c7){_0x1a3bdc['body'][_0xa8a9('0x52')]=_0x3252c7['id'];_0x1a3bdc[_0xa8a9('0x4b')][_0xa8a9('0x53')]=integrations[_0xa8a9('0x54')](_0x1a3bdc[_0xa8a9('0x4b')][_0xa8a9('0x55')],_0x1a3bdc['body'][_0xa8a9('0x2f')]);_0x1a3bdc[_0xa8a9('0x4b')][_0xa8a9('0x56')]=integrations['getDescriptions'](_0x1a3bdc[_0xa8a9('0x4b')][_0xa8a9('0x55')],_0x1a3bdc[_0xa8a9('0x4b')][_0xa8a9('0x2f')]);return db['FreshdeskConfiguration']['create'](_0x1a3bdc['body'],{'include':[{'model':db[_0xa8a9('0x57')],'as':'Subjects'},{'model':db[_0xa8a9('0x57')],'as':_0xa8a9('0x56')}]});}return null;})['then'](respondWithResult(_0x2fdc6f,null))[_0xa8a9('0x46')](handleError(_0x2fdc6f,null));};exports[_0xa8a9('0x58')]=function(_0x181095,_0x278a95,_0x5d89bd){var _0x16730c='';return db['FreshdeskAccount'][_0xa8a9('0x4e')]({'where':{'id':_0x181095[_0xa8a9('0x48')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xa8a9('0x25')](handleEntityNotFound(_0x278a95,null))['then'](function(_0xd8b7fc){if(_0xd8b7fc){_0x16730c=_0xd8b7fc[_0xa8a9('0x59')];var _0x41c148=_0x16730c['slice'](-0x1);if(_0x41c148==='/'){_0x16730c=_0x16730c[_0xa8a9('0x5a')](0x0,_0x16730c[_0xa8a9('0x5b')](_0x41c148));}return rp({'method':_0xa8a9('0x5c'),'uri':util[_0xa8a9('0x5d')]('%s/%s',_0x16730c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xa8a9('0x5d')]('Basic\x20%s',new Buffer(util['format'](_0xa8a9('0x5e'),_0xd8b7fc['apiKey']))[_0xa8a9('0x5f')](_0xa8a9('0x60')))},'json':!![]});}})[_0xa8a9('0x25')](function(_0x2879ec){if(_0x2879ec){var _0x2a1442=[_0xa8a9('0x61'),_0xa8a9('0x62'),_0xa8a9('0x63'),_0xa8a9('0x64'),'status',_0xa8a9('0x65'),'group','source',_0xa8a9('0x66'),_0xa8a9('0x67'),'company'];_[_0xa8a9('0x68')](_0x2879ec,function(_0x5dffd0){return _0x2a1442[_0xa8a9('0x69')](_0x5dffd0['name'])||!_0x5dffd0[_0xa8a9('0x6a')]&&_0x5dffd0[_0xa8a9('0x2f')]!==_0xa8a9('0x6b')&&_0x5dffd0['type']!==_0xa8a9('0x6c');});return{'count':_0x2879ec[_0xa8a9('0x38')],'rows':_['map'](_0x2879ec,function(_0xe19d8){return{'id':_0xe19d8[_0xa8a9('0x28')],'name':_0xe19d8[_0xa8a9('0x6d')],'custom':!_0xe19d8[_0xa8a9('0x6a')],'options':_0xe19d8[_0xa8a9('0x6e')]?_[_0xa8a9('0x2b')](_0xe19d8[_0xa8a9('0x6e')],function(_0x703d10){return{'name':_['capitalize'](_0x703d10),'value':_0x703d10};}):[]};})};}})[_0xa8a9('0x25')](respondWithResult(_0x278a95,null))['catch'](function(_0x558ce7){var _0x4d9015=_0x181095[_0xa8a9('0x32')][_0xa8a9('0x6f')]?0x1f4:_0x558ce7[_0xa8a9('0x70')]||0x1f4;logger[_0xa8a9('0x26')](_0xa8a9('0x71'),_0xa8a9('0x58'),_0x4d9015,JSON[_0xa8a9('0x72')](_0x558ce7));delete _0x558ce7['name'];if(_0x4d9015===0x191){_0x4d9015=0x190;}_0x278a95[_0xa8a9('0x19')](_0x4d9015)[_0xa8a9('0x29')](_0x181095[_0xa8a9('0x32')][_0xa8a9('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x558ce7[_0xa8a9('0x70')]}:_0x558ce7);});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b6e948a..621b3ea 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 _0xd655=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xd655,0x17c));var _0x5d65=function(_0xe6e78c,_0x582369){_0xe6e78c=_0xe6e78c-0x0;var _0x2a09c8=_0xd655[_0xe6e78c];return _0x2a09c8;};'use strict';var _=require(_0x5d65('0x0'));var util=require(_0x5d65('0x1'));var logger=require(_0x5d65('0x2'))(_0x5d65('0x3'));var moment=require(_0x5d65('0x4'));var BPromise=require(_0x5d65('0x5'));var rp=require(_0x5d65('0x6'));var fs=require('fs');var path=require(_0x5d65('0x7'));var rimraf=require(_0x5d65('0x8'));var config=require(_0x5d65('0x9'));var attributes=require(_0x5d65('0xa'));var integrations=require(_0x5d65('0xb'));module['exports']=function(_0x246d1c,_0x2ce5c5){return _0x246d1c[_0x5d65('0xc')](_0x5d65('0xd'),attributes,{'tableName':_0x5d65('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f844c80..b6056ab 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 _0x6113=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0x6113,0x1c8));var _0x3611=function(_0x57607a,_0x34187c){_0x57607a=_0x57607a-0x0;var _0x22473a=_0x6113[_0x57607a];return _0x22473a;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var moment=require(_0x3611('0x2'));var BPromise=require('bluebird');var rs=require(_0x3611('0x3'));var fs=require('fs');var Redis=require(_0x3611('0x4'));var db=require(_0x3611('0x5'))['db'];var utils=require(_0x3611('0x6'));var logger=require(_0x3611('0x7'))(_0x3611('0x8'));var config=require(_0x3611('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3611('0xa')][_0x3611('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12a094,_0x4fa163,_0x47435b){return new BPromise(function(_0x454512,_0x26211a){return client['request'](_0x12a094,_0x47435b)[_0x3611('0xc')](function(_0x54a372){logger[_0x3611('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fa163,_0x3611('0xe'));logger[_0x3611('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x4fa163,_0x3611('0xe'),JSON[_0x3611('0x10')](_0x54a372));if(_0x54a372[_0x3611('0x11')]){if(_0x54a372['error']['code']===0x1f4){logger[_0x3611('0x11')](_0x3611('0x12'),_0x4fa163,_0x54a372[_0x3611('0x11')][_0x3611('0x13')]);return _0x26211a(_0x54a372[_0x3611('0x11')][_0x3611('0x13')]);}logger[_0x3611('0x11')](_0x3611('0x12'),_0x4fa163,_0x54a372[_0x3611('0x11')]['message']);return _0x454512(_0x54a372[_0x3611('0x11')][_0x3611('0x13')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4fa163,'request\x20sent');_0x454512(_0x54a372['result'][_0x3611('0x13')]);}})[_0x3611('0x14')](function(_0x233723){logger[_0x3611('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x4fa163,_0x233723);_0x26211a(_0x233723);});});}exports[_0x3611('0x15')]=function(_0x51e16d){var _0x3b91d4=this;return new Promise(function(_0x244293,_0xbc528b){return db[_0x3611('0x16')][_0x3611('0x17')]({'raw':_0x51e16d[_0x3611('0x18')]?_0x51e16d[_0x3611('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x51e16d[_0x3611('0x18')]?_0x51e16d[_0x3611('0x18')][_0x3611('0x19')]||null:null,'attributes':_0x51e16d[_0x3611('0x18')]?_0x51e16d[_0x3611('0x18')][_0x3611('0x1a')]||null:null,'limit':_0x51e16d[_0x3611('0x18')]?_0x51e16d[_0x3611('0x18')][_0x3611('0x1b')]||null:null,'include':_0x51e16d[_0x3611('0x18')]?_0x51e16d[_0x3611('0x18')]['include']?_[_0x3611('0x1c')](_0x51e16d[_0x3611('0x18')][_0x3611('0x1d')],function(_0x418713){return{'model':db[_0x418713[_0x3611('0x1e')]],'as':_0x418713['as'],'attributes':_0x418713['attributes'],'include':_0x418713['include']?_[_0x3611('0x1c')](_0x418713['include'],function(_0x159866){return{'model':db[_0x159866['model']],'as':_0x159866['as'],'attributes':_0x159866[_0x3611('0x1a')],'include':_0x159866['include']?_['map'](_0x159866[_0x3611('0x1d')],function(_0x1c1a6a){return{'model':db[_0x1c1a6a[_0x3611('0x1e')]],'as':_0x1c1a6a['as'],'attributes':_0x1c1a6a[_0x3611('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3611('0xc')](function(_0x5635c5){logger[_0x3611('0xd')]('GetFreshdeskAccount',_0x51e16d);logger[_0x3611('0xf')](_0x3611('0x15'),_0x51e16d,JSON['stringify'](_0x5635c5));_0x244293(_0x5635c5);})[_0x3611('0x14')](function(_0xea46af){logger['error'](_0x3611('0x15'),_0xea46af['message'],_0x51e16d);_0xbc528b(_0x3b91d4[_0x3611('0x11')](0x1f4,_0xea46af['message']));});});};exports[_0x3611('0x1f')]=function(_0x16f24c){var _0xe4d93d=this;return new Promise(function(_0x2575da,_0x5b6289){return db[_0x3611('0x16')][_0x3611('0x20')]({'raw':_0x16f24c[_0x3611('0x18')]?_0x16f24c['options']['raw']===undefined?!![]:![]:!![],'where':_0x16f24c[_0x3611('0x18')]?_0x16f24c[_0x3611('0x18')][_0x3611('0x19')]||null:null,'attributes':_0x16f24c[_0x3611('0x18')]?_0x16f24c['options'][_0x3611('0x1a')]||null:null,'include':_0x16f24c[_0x3611('0x18')]?_0x16f24c['options']['include']?_[_0x3611('0x1c')](_0x16f24c[_0x3611('0x18')][_0x3611('0x1d')],function(_0x19ffcb){return{'model':db[_0x19ffcb[_0x3611('0x1e')]],'as':_0x19ffcb['as'],'attributes':_0x19ffcb[_0x3611('0x1a')],'include':_0x19ffcb[_0x3611('0x1d')]?_['map'](_0x19ffcb[_0x3611('0x1d')],function(_0x14c783){return{'model':db[_0x14c783[_0x3611('0x1e')]],'as':_0x14c783['as'],'attributes':_0x14c783[_0x3611('0x1a')],'include':_0x14c783[_0x3611('0x1d')]?_[_0x3611('0x1c')](_0x14c783[_0x3611('0x1d')],function(_0x4deddb){return{'model':db[_0x4deddb[_0x3611('0x1e')]],'as':_0x4deddb['as'],'attributes':_0x4deddb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x96e094){logger[_0x3611('0xd')](_0x3611('0x1f'),_0x16f24c);logger[_0x3611('0xf')](_0x3611('0x1f'),_0x16f24c,JSON[_0x3611('0x10')](_0x96e094));_0x2575da(_0x96e094);})['catch'](function(_0x57a540){logger[_0x3611('0x11')](_0x3611('0x1f'),_0x57a540['message'],_0x16f24c);_0x5b6289(_0xe4d93d['error'](0x1f4,_0x57a540[_0x3611('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index dd5ef5f..8a359f2 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 _0xc82a=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put'];(function(_0x7ea4af,_0x3f0526){var _0x21a0cc=function(_0x2f1bdf){while(--_0x2f1bdf){_0x7ea4af['push'](_0x7ea4af['shift']());}};_0x21a0cc(++_0x3f0526);}(_0xc82a,0xa5));var _0xac82=function(_0x6da129,_0x40948d){_0x6da129=_0x6da129-0x0;var _0x1349d6=_0xc82a[_0x6da129];return _0x1349d6;};'use strict';var multer=require(_0xac82('0x0'));var util=require(_0xac82('0x1'));var path=require(_0xac82('0x2'));var timeout=require(_0xac82('0x3'));var express=require(_0xac82('0x4'));var router=express[_0xac82('0x5')]();var fs_extra=require(_0xac82('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xac82('0x7'));var config=require(_0xac82('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xac82('0x9')]('/',auth[_0xac82('0xa')](),controller[_0xac82('0xb')]);router[_0xac82('0x9')](_0xac82('0xc'),auth[_0xac82('0xa')](),controller[_0xac82('0xd')]);router['get']('/:id/fields',auth[_0xac82('0xa')](),controller['getFields']);router['get'](_0xac82('0xe'),auth['isAuthenticated'](),controller[_0xac82('0xf')]);router[_0xac82('0x9')](_0xac82('0x10'),auth[_0xac82('0xa')](),controller[_0xac82('0x11')]);router['get'](_0xac82('0x12'),auth[_0xac82('0xa')](),controller[_0xac82('0x13')]);router[_0xac82('0x14')]('/',auth[_0xac82('0xa')](),controller[_0xac82('0x15')]);router[_0xac82('0x14')](_0xac82('0x12'),auth[_0xac82('0xa')](),controller[_0xac82('0x16')]);router[_0xac82('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xac82('0x18')]);router[_0xac82('0x19')](_0xac82('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xac82('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 15430f9..c25c788 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 _0x315f=['STRING','sequelize'];(function(_0x4ebce7,_0x44fbaf){var _0x8a07c9=function(_0x1f57d2){while(--_0x1f57d2){_0x4ebce7['push'](_0x4ebce7['shift']());}};_0x8a07c9(++_0x44fbaf);}(_0x315f,0x183));var _0xf315=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0x315f[_0x39a2d6];return _0x23af66;};'use strict';var Sequelize=require(_0xf315('0x0'));module['exports']={'name':{'type':Sequelize[_0xf315('0x1')]},'description':{'type':Sequelize[_0xf315('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6720bac..375e8a7 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 _0x41c8=['FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','FreshdeskConfiguration','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne'];(function(_0x3b546b,_0x39f552){var _0x574d9f=function(_0x1eaec9){while(--_0x1eaec9){_0x3b546b['push'](_0x3b546b['shift']());}};_0x574d9f(++_0x39f552);}(_0x41c8,0x100));var _0x841c=function(_0x6f394e,_0x1677b0){_0x6f394e=_0x6f394e-0x0;var _0x43d480=_0x41c8[_0x6f394e];return _0x43d480;};'use strict';var emlformat=require(_0x841c('0x0'));var rimraf=require(_0x841c('0x1'));var zipdir=require(_0x841c('0x2'));var jsonpatch=require(_0x841c('0x3'));var rp=require(_0x841c('0x4'));var moment=require('moment');var BPromise=require(_0x841c('0x5'));var Mustache=require(_0x841c('0x6'));var util=require(_0x841c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x841c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x841c('0x9'));var _=require('lodash');var squel=require(_0x841c('0xa'));var crypto=require(_0x841c('0xb'));var jsforce=require(_0x841c('0xc'));var deskjs=require(_0x841c('0xd'));var toCsv=require(_0x841c('0x8'));var querystring=require(_0x841c('0xe'));var Papa=require(_0x841c('0xf'));var Redis=require('ioredis');var authService=require(_0x841c('0x10'));var qs=require(_0x841c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x841c('0x12'));var logger=require(_0x841c('0x13'))(_0x841c('0x14'));var utils=require(_0x841c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x841c('0x16'));var db=require(_0x841c('0x17'))['db'];function respondWithStatusCode(_0x40519e,_0x5d2815){_0x5d2815=_0x5d2815||0xcc;return function(_0xef7224){if(_0xef7224){return _0x40519e[_0x841c('0x18')](_0x5d2815);}return _0x40519e['status'](_0x5d2815)[_0x841c('0x19')]();};}function respondWithResult(_0x39f852,_0x1ed152){_0x1ed152=_0x1ed152||0xc8;return function(_0x46b815){if(_0x46b815){return _0x39f852[_0x841c('0x1a')](_0x1ed152)[_0x841c('0x1b')](_0x46b815);}};}function respondWithFilteredResult(_0x108e8c,_0x3eb7bd){return function(_0x202304){if(_0x202304){var _0x12aed8=typeof _0x3eb7bd[_0x841c('0x1c')]===_0x841c('0x1d')&&typeof _0x3eb7bd[_0x841c('0x1e')]==='undefined';var _0x1f7e48=_0x202304['count'];var _0x3edd3f=_0x12aed8?0x0:_0x3eb7bd[_0x841c('0x1c')];var _0x5ca353=_0x12aed8?_0x202304[_0x841c('0x1f')]:_0x3eb7bd['offset']+_0x3eb7bd['limit'];var _0x17b5dc;if(_0x5ca353>=_0x1f7e48){_0x5ca353=_0x1f7e48;_0x17b5dc=0xc8;}else{_0x17b5dc=0xce;}_0x108e8c[_0x841c('0x1a')](_0x17b5dc);return _0x108e8c[_0x841c('0x20')](_0x841c('0x21'),_0x3edd3f+'-'+_0x5ca353+'/'+_0x1f7e48)[_0x841c('0x1b')](_0x202304);}return null;};}function patchUpdates(_0xf1b75d){return function(_0x570c83){try{jsonpatch[_0x841c('0x22')](_0x570c83,_0xf1b75d,!![]);}catch(_0x4f5e6c){return BPromise[_0x841c('0x23')](_0x4f5e6c);}return _0x570c83[_0x841c('0x24')]();};}function saveUpdates(_0x3dbf16,_0x31365d){return function(_0x4794e2){if(_0x4794e2){return _0x4794e2[_0x841c('0x25')](_0x3dbf16)[_0x841c('0x26')](function(_0x24cccb){return _0x24cccb;});}return null;};}function removeEntity(_0xc5eb29,_0x377f07){return function(_0x42ec43){if(_0x42ec43){return _0x42ec43[_0x841c('0x27')]()[_0x841c('0x26')](function(){_0xc5eb29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e130,_0x1ec4ba){return function(_0x2ca8f5){if(!_0x2ca8f5){_0x45e130[_0x841c('0x18')](0x194);}return _0x2ca8f5;};}function handleError(_0x3cae11,_0x5b7a12){_0x5b7a12=_0x5b7a12||0x1f4;return function(_0x4cbb4f){logger[_0x841c('0x28')](_0x4cbb4f[_0x841c('0x29')]);if(_0x4cbb4f[_0x841c('0x2a')]){delete _0x4cbb4f['name'];}_0x3cae11[_0x841c('0x1a')](_0x5b7a12)['send'](_0x4cbb4f);};}exports['index']=function(_0x1f3792,_0x4b8594){var _0x104c86={},_0x3149c1={},_0x2cf110={'count':0x0,'rows':[]};var _0x35518b=_['map'](db[_0x841c('0x2b')][_0x841c('0x2c')],function(_0x3d3ee9){return{'name':_0x3d3ee9['fieldName'],'type':_0x3d3ee9['type']['key']};});_0x3149c1[_0x841c('0x2d')]=_[_0x841c('0x2e')](_0x35518b,_0x841c('0x2a'));_0x3149c1['query']=_[_0x841c('0x2f')](_0x1f3792[_0x841c('0x30')]);_0x3149c1[_0x841c('0x31')]=_[_0x841c('0x32')](_0x3149c1[_0x841c('0x2d')],_0x3149c1[_0x841c('0x30')]);_0x104c86[_0x841c('0x33')]=_['intersection'](_0x3149c1['model'],qs[_0x841c('0x34')](_0x1f3792[_0x841c('0x30')][_0x841c('0x34')]));_0x104c86['attributes']=_0x104c86['attributes'][_0x841c('0x35')]?_0x104c86[_0x841c('0x33')]:_0x3149c1[_0x841c('0x2d')];if(!_0x1f3792[_0x841c('0x30')]['hasOwnProperty'](_0x841c('0x36'))){_0x104c86[_0x841c('0x1e')]=qs['limit'](_0x1f3792['query'][_0x841c('0x1e')]);_0x104c86[_0x841c('0x1c')]=qs['offset'](_0x1f3792[_0x841c('0x30')][_0x841c('0x1c')]);}_0x104c86[_0x841c('0x37')]=qs['sort'](_0x1f3792['query'][_0x841c('0x38')]);_0x104c86[_0x841c('0x39')]=qs[_0x841c('0x31')](_[_0x841c('0x3a')](_0x1f3792['query'],_0x3149c1[_0x841c('0x31')]),_0x35518b);if(_0x1f3792[_0x841c('0x30')][_0x841c('0x3b')]){_0x104c86[_0x841c('0x39')]=_['merge'](_0x104c86[_0x841c('0x39')],{'$or':_[_0x841c('0x2e')](_0x35518b,function(_0x571c0f){if(_0x571c0f[_0x841c('0x3c')]!==_0x841c('0x3d')){var _0x4faa35={};_0x4faa35[_0x571c0f['name']]={'$like':'%'+_0x1f3792[_0x841c('0x30')][_0x841c('0x3b')]+'%'};return _0x4faa35;}})});}_0x104c86=_[_0x841c('0x3e')]({},_0x104c86,_0x1f3792[_0x841c('0x3f')]);var _0x3c947d={'where':_0x104c86[_0x841c('0x39')]};return db[_0x841c('0x2b')]['count'](_0x3c947d)[_0x841c('0x26')](function(_0x39560a){_0x2cf110[_0x841c('0x1f')]=_0x39560a;if(_0x1f3792[_0x841c('0x30')][_0x841c('0x40')]){_0x104c86[_0x841c('0x41')]=[{'all':!![]}];}return db[_0x841c('0x2b')][_0x841c('0x42')](_0x104c86);})[_0x841c('0x26')](function(_0x4d1e93){_0x2cf110[_0x841c('0x43')]=_0x4d1e93;return _0x2cf110;})['then'](respondWithFilteredResult(_0x4b8594,_0x104c86))[_0x841c('0x44')](handleError(_0x4b8594,null));};exports[_0x841c('0x45')]=function(_0x3c95e5,_0x3c0bc1){var _0x33b210={'raw':![],'where':{'id':_0x3c95e5['params']['id']}},_0x189810={};_0x189810['model']=_[_0x841c('0x2f')](db['FreshdeskConfiguration'][_0x841c('0x2c')]);_0x189810[_0x841c('0x30')]=_[_0x841c('0x2f')](_0x3c95e5['query']);_0x189810['filters']=_[_0x841c('0x32')](_0x189810[_0x841c('0x2d')],_0x189810[_0x841c('0x30')]);_0x33b210[_0x841c('0x33')]=_[_0x841c('0x32')](_0x189810[_0x841c('0x2d')],qs['fields'](_0x3c95e5[_0x841c('0x30')][_0x841c('0x34')]));_0x33b210[_0x841c('0x33')]=_0x33b210[_0x841c('0x33')][_0x841c('0x35')]?_0x33b210[_0x841c('0x33')]:_0x189810[_0x841c('0x2d')];if(_0x3c95e5['query'][_0x841c('0x40')]){_0x33b210[_0x841c('0x41')]=[{'all':!![]}];}_0x33b210=_['merge']({},_0x33b210,_0x3c95e5[_0x841c('0x3f')]);return db[_0x841c('0x2b')][_0x841c('0x46')](_0x33b210)[_0x841c('0x26')](handleEntityNotFound(_0x3c0bc1,null))[_0x841c('0x26')](respondWithResult(_0x3c0bc1,null))['catch'](handleError(_0x3c0bc1,null));};exports['create']=function(_0x4f2611,_0x364d53){return db[_0x841c('0x2b')][_0x841c('0x47')](_0x4f2611[_0x841c('0x48')],{})['then'](respondWithResult(_0x364d53,0xc9))[_0x841c('0x44')](handleError(_0x364d53,null));};exports[_0x841c('0x25')]=function(_0x2591e2,_0x4253fd){if(_0x2591e2[_0x841c('0x48')]['id']){delete _0x2591e2[_0x841c('0x48')]['id'];}return db[_0x841c('0x2b')][_0x841c('0x46')]({'where':{'id':_0x2591e2[_0x841c('0x49')]['id']}})[_0x841c('0x26')](handleEntityNotFound(_0x4253fd,null))[_0x841c('0x26')](saveUpdates(_0x2591e2[_0x841c('0x48')],null))['then'](respondWithResult(_0x4253fd,null))['catch'](handleError(_0x4253fd,null));};exports[_0x841c('0x27')]=function(_0x3c0a65,_0x9236e6){return db[_0x841c('0x2b')][_0x841c('0x46')]({'where':{'id':_0x3c0a65[_0x841c('0x49')]['id']}})[_0x841c('0x26')](handleEntityNotFound(_0x9236e6,null))['then'](removeEntity(_0x9236e6,null))[_0x841c('0x44')](handleError(_0x9236e6,null));};exports[_0x841c('0x4a')]=function(_0x54a09c,_0x33f481,_0x2a2c1f){var _0x14c56a={};var _0x181703={};var _0x31e4cf;var _0x41318a;return db['FreshdeskConfiguration'][_0x841c('0x4b')]({'where':{'id':_0x54a09c[_0x841c('0x49')]['id']}})[_0x841c('0x26')](handleEntityNotFound(_0x33f481,null))[_0x841c('0x26')](function(_0x3b54c6){if(_0x3b54c6){_0x31e4cf=_0x3b54c6;_0x181703[_0x841c('0x2d')]=_['keys'](db[_0x841c('0x4c')][_0x841c('0x2c')]);_0x181703[_0x841c('0x30')]=_[_0x841c('0x2f')](_0x54a09c[_0x841c('0x30')]);_0x181703[_0x841c('0x31')]=_[_0x841c('0x32')](_0x181703[_0x841c('0x2d')],_0x181703[_0x841c('0x30')]);_0x14c56a[_0x841c('0x33')]=_[_0x841c('0x32')](_0x181703[_0x841c('0x2d')],qs[_0x841c('0x34')](_0x54a09c[_0x841c('0x30')]['fields']));_0x14c56a[_0x841c('0x33')]=_0x14c56a[_0x841c('0x33')]['length']?_0x14c56a[_0x841c('0x33')]:_0x181703[_0x841c('0x2d')];_0x14c56a[_0x841c('0x37')]=qs[_0x841c('0x38')](_0x54a09c[_0x841c('0x30')]['sort']);_0x14c56a['where']=qs[_0x841c('0x31')](_[_0x841c('0x3a')](_0x54a09c[_0x841c('0x30')],_0x181703[_0x841c('0x31')]));if(_0x54a09c['query'][_0x841c('0x3b')]){_0x14c56a[_0x841c('0x39')]=_['merge'](_0x14c56a[_0x841c('0x39')],{'$or':_[_0x841c('0x2e')](_0x14c56a[_0x841c('0x33')],function(_0x3d3476){var _0x49415d={};_0x49415d[_0x3d3476]={'$like':'%'+_0x54a09c['query'][_0x841c('0x3b')]+'%'};return _0x49415d;})});}_0x14c56a=_[_0x841c('0x3e')]({},_0x14c56a,_0x54a09c[_0x841c('0x3f')]);return _0x31e4cf[_0x841c('0x4a')](_0x14c56a);}})[_0x841c('0x26')](function(_0x3e9c5f){if(_0x3e9c5f){_0x41318a=_0x3e9c5f[_0x841c('0x35')];if(!_0x54a09c[_0x841c('0x30')][_0x841c('0x4d')](_0x841c('0x36'))){_0x14c56a['limit']=qs[_0x841c('0x1e')](_0x54a09c[_0x841c('0x30')][_0x841c('0x1e')]);_0x14c56a[_0x841c('0x1c')]=qs['offset'](_0x54a09c[_0x841c('0x30')]['offset']);}return _0x31e4cf[_0x841c('0x4a')](_0x14c56a);}})[_0x841c('0x26')](function(_0x4b864a){if(_0x4b864a){return _0x4b864a?{'count':_0x41318a,'rows':_0x4b864a}:null;}})[_0x841c('0x26')](respondWithResult(_0x33f481,null))[_0x841c('0x44')](handleError(_0x33f481,null));};exports[_0x841c('0x4e')]=function(_0x13c9e9,_0x37b108,_0x59d20c){var _0x2262b3={};var _0x43c590={};var _0x429026;var _0x2b32bb;return db[_0x841c('0x2b')]['findOne']({'where':{'id':_0x13c9e9[_0x841c('0x49')]['id']}})[_0x841c('0x26')](handleEntityNotFound(_0x37b108,null))[_0x841c('0x26')](function(_0x566298){if(_0x566298){_0x429026=_0x566298;_0x43c590[_0x841c('0x2d')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x43c590[_0x841c('0x30')]=_[_0x841c('0x2f')](_0x13c9e9[_0x841c('0x30')]);_0x43c590[_0x841c('0x31')]=_[_0x841c('0x32')](_0x43c590[_0x841c('0x2d')],_0x43c590[_0x841c('0x30')]);_0x2262b3[_0x841c('0x33')]=_[_0x841c('0x32')](_0x43c590[_0x841c('0x2d')],qs[_0x841c('0x34')](_0x13c9e9[_0x841c('0x30')][_0x841c('0x34')]));_0x2262b3[_0x841c('0x33')]=_0x2262b3[_0x841c('0x33')]['length']?_0x2262b3[_0x841c('0x33')]:_0x43c590['model'];_0x2262b3['order']=qs[_0x841c('0x38')](_0x13c9e9['query']['sort']);_0x2262b3[_0x841c('0x39')]=qs[_0x841c('0x31')](_[_0x841c('0x3a')](_0x13c9e9[_0x841c('0x30')],_0x43c590['filters']));if(_0x13c9e9[_0x841c('0x30')][_0x841c('0x3b')]){_0x2262b3['where']=_['merge'](_0x2262b3[_0x841c('0x39')],{'$or':_[_0x841c('0x2e')](_0x2262b3[_0x841c('0x33')],function(_0x3ad41f){var _0x5b4708={};_0x5b4708[_0x3ad41f]={'$like':'%'+_0x13c9e9[_0x841c('0x30')][_0x841c('0x3b')]+'%'};return _0x5b4708;})});}_0x2262b3=_[_0x841c('0x3e')]({},_0x2262b3,_0x13c9e9[_0x841c('0x3f')]);return _0x429026[_0x841c('0x4e')](_0x2262b3);}})[_0x841c('0x26')](function(_0x4c26c6){if(_0x4c26c6){_0x2b32bb=_0x4c26c6['length'];if(!_0x13c9e9['query']['hasOwnProperty'](_0x841c('0x36'))){_0x2262b3['limit']=qs[_0x841c('0x1e')](_0x13c9e9['query']['limit']);_0x2262b3[_0x841c('0x1c')]=qs[_0x841c('0x1c')](_0x13c9e9['query'][_0x841c('0x1c')]);}return _0x429026[_0x841c('0x4e')](_0x2262b3);}})['then'](function(_0x529636){if(_0x529636){return _0x529636?{'count':_0x2b32bb,'rows':_0x529636}:null;}})['then'](respondWithResult(_0x37b108,null))[_0x841c('0x44')](handleError(_0x37b108,null));};exports[_0x841c('0x4f')]=function(_0x31ec7d,_0x16a845,_0x1e582a){var _0x48d836={};var _0x4be595={};var _0x108e20;var _0x39b9f5;return db[_0x841c('0x2b')]['findOne']({'where':{'id':_0x31ec7d[_0x841c('0x49')]['id']}})[_0x841c('0x26')](handleEntityNotFound(_0x16a845,null))['then'](function(_0x665d4e){if(_0x665d4e){_0x108e20=_0x665d4e;_0x4be595[_0x841c('0x2d')]=_[_0x841c('0x2f')](db[_0x841c('0x4c')][_0x841c('0x2c')]);_0x4be595[_0x841c('0x30')]=_[_0x841c('0x2f')](_0x31ec7d[_0x841c('0x30')]);_0x4be595[_0x841c('0x31')]=_[_0x841c('0x32')](_0x4be595[_0x841c('0x2d')],_0x4be595['query']);_0x48d836[_0x841c('0x33')]=_['intersection'](_0x4be595[_0x841c('0x2d')],qs[_0x841c('0x34')](_0x31ec7d[_0x841c('0x30')][_0x841c('0x34')]));_0x48d836[_0x841c('0x33')]=_0x48d836[_0x841c('0x33')][_0x841c('0x35')]?_0x48d836[_0x841c('0x33')]:_0x4be595['model'];_0x48d836[_0x841c('0x37')]=qs[_0x841c('0x38')](_0x31ec7d[_0x841c('0x30')][_0x841c('0x38')]);_0x48d836['where']=qs['filters'](_[_0x841c('0x3a')](_0x31ec7d[_0x841c('0x30')],_0x4be595[_0x841c('0x31')]));if(_0x31ec7d[_0x841c('0x30')][_0x841c('0x3b')]){_0x48d836[_0x841c('0x39')]=_[_0x841c('0x3e')](_0x48d836[_0x841c('0x39')],{'$or':_[_0x841c('0x2e')](_0x48d836[_0x841c('0x33')],function(_0xf86bf5){var _0x2e7e3b={};_0x2e7e3b[_0xf86bf5]={'$like':'%'+_0x31ec7d['query'][_0x841c('0x3b')]+'%'};return _0x2e7e3b;})});}_0x48d836=_[_0x841c('0x3e')]({},_0x48d836,_0x31ec7d[_0x841c('0x3f')]);return _0x108e20[_0x841c('0x4f')](_0x48d836);}})[_0x841c('0x26')](function(_0x23ed21){if(_0x23ed21){_0x39b9f5=_0x23ed21[_0x841c('0x35')];if(!_0x31ec7d[_0x841c('0x30')][_0x841c('0x4d')](_0x841c('0x36'))){_0x48d836[_0x841c('0x1e')]=qs[_0x841c('0x1e')](_0x31ec7d[_0x841c('0x30')]['limit']);_0x48d836[_0x841c('0x1c')]=qs[_0x841c('0x1c')](_0x31ec7d['query'][_0x841c('0x1c')]);}return _0x108e20[_0x841c('0x4f')](_0x48d836);}})['then'](function(_0x489af3){if(_0x489af3){return _0x489af3?{'count':_0x39b9f5,'rows':_0x489af3}:null;}})[_0x841c('0x26')](respondWithResult(_0x16a845,null))[_0x841c('0x44')](handleError(_0x16a845,null));};exports['getTags']=function(_0x3bff1e,_0x4b1391,_0x4befb1){var _0x428691={};var _0x49d086={};var _0x1ecfac;var _0x38daff;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3bff1e[_0x841c('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b1391,null))[_0x841c('0x26')](function(_0x384764){if(_0x384764){_0x1ecfac=_0x384764;_0x49d086[_0x841c('0x2d')]=_[_0x841c('0x2f')](db[_0x841c('0x50')][_0x841c('0x2c')]);_0x49d086[_0x841c('0x30')]=_[_0x841c('0x2f')](_0x3bff1e[_0x841c('0x30')]);_0x49d086['filters']=_['intersection'](_0x49d086[_0x841c('0x2d')],_0x49d086[_0x841c('0x30')]);_0x428691[_0x841c('0x33')]=_[_0x841c('0x32')](_0x49d086[_0x841c('0x2d')],qs['fields'](_0x3bff1e['query'][_0x841c('0x34')]));_0x428691[_0x841c('0x33')]=_0x428691['attributes'][_0x841c('0x35')]?_0x428691['attributes']:_0x49d086[_0x841c('0x2d')];_0x428691[_0x841c('0x37')]=qs[_0x841c('0x38')](_0x3bff1e[_0x841c('0x30')][_0x841c('0x38')]);_0x428691[_0x841c('0x39')]=qs[_0x841c('0x31')](_[_0x841c('0x3a')](_0x3bff1e['query'],_0x49d086[_0x841c('0x31')]));if(_0x3bff1e[_0x841c('0x30')][_0x841c('0x3b')]){_0x428691[_0x841c('0x39')]=_['merge'](_0x428691[_0x841c('0x39')],{'$or':_['map'](_0x428691['attributes'],function(_0xd63652){var _0x5ee46d={};_0x5ee46d[_0xd63652]={'$like':'%'+_0x3bff1e[_0x841c('0x30')]['filter']+'%'};return _0x5ee46d;})});}_0x428691=_[_0x841c('0x3e')]({},_0x428691,_0x3bff1e[_0x841c('0x3f')]);return _0x1ecfac['getTags'](_0x428691);}})[_0x841c('0x26')](function(_0x7bbc66){if(_0x7bbc66){_0x38daff=_0x7bbc66[_0x841c('0x35')];if(!_0x3bff1e['query'][_0x841c('0x4d')](_0x841c('0x36'))){_0x428691[_0x841c('0x1e')]=qs[_0x841c('0x1e')](_0x3bff1e['query'][_0x841c('0x1e')]);_0x428691[_0x841c('0x1c')]=qs[_0x841c('0x1c')](_0x3bff1e[_0x841c('0x30')][_0x841c('0x1c')]);}return _0x1ecfac[_0x841c('0x51')](_0x428691);}})[_0x841c('0x26')](function(_0x244f28){if(_0x244f28){return _0x244f28?{'count':_0x38daff,'rows':_0x244f28}:null;}})['then'](respondWithResult(_0x4b1391,null))[_0x841c('0x44')](handleError(_0x4b1391,null));};exports[_0x841c('0x52')]=function(_0x254951,_0x1ff4c5,_0x2cc94e){if(_0x254951[_0x841c('0x48')]['id']){delete _0x254951[_0x841c('0x48')]['id'];}return db[_0x841c('0x2b')]['findOne']({'where':{'id':_0x254951[_0x841c('0x49')]['id']}})[_0x841c('0x26')](handleEntityNotFound(_0x1ff4c5,null))['then'](function(_0x4fc8aa){if(_0x4fc8aa){return _0x4fc8aa[_0x841c('0x52')](_0x254951['body']['ids']||[]);}return null;})[_0x841c('0x26')](respondWithResult(_0x1ff4c5,null))[_0x841c('0x44')](handleError(_0x1ff4c5,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6d1c8d6..97a3f15 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 _0x3caf=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x2e5a8c,_0x35f4bf){var _0x5816ec=function(_0x27cf55){while(--_0x27cf55){_0x2e5a8c['push'](_0x2e5a8c['shift']());}};_0x5816ec(++_0x35f4bf);}(_0x3caf,0xb3));var _0xf3ca=function(_0x56e911,_0x4e0aa2){_0x56e911=_0x56e911-0x0;var _0x455636=_0x3caf[_0x56e911];return _0x455636;};'use strict';var _=require(_0xf3ca('0x0'));var util=require(_0xf3ca('0x1'));var logger=require(_0xf3ca('0x2'))(_0xf3ca('0x3'));var moment=require('moment');var BPromise=require(_0xf3ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf3ca('0x5'));var attributes=require(_0xf3ca('0x6'));module[_0xf3ca('0x7')]=function(_0x49803b,_0x46dfdb){return _0x49803b[_0xf3ca('0x8')](_0xf3ca('0x9'),attributes,{'tableName':_0xf3ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5283bbe..4adeed6 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 _0x2585=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message'];(function(_0x81d7c0,_0x11ac68){var _0x3d8ff5=function(_0x2280ea){while(--_0x2280ea){_0x81d7c0['push'](_0x81d7c0['shift']());}};_0x3d8ff5(++_0x11ac68);}(_0x2585,0xf3));var _0x5258=function(_0x1ba88a,_0x30b1d8){_0x1ba88a=_0x1ba88a-0x0;var _0x5d0fe7=_0x2585[_0x1ba88a];return _0x5d0fe7;};'use strict';var _=require(_0x5258('0x0'));var util=require(_0x5258('0x1'));var moment=require('moment');var BPromise=require(_0x5258('0x2'));var rs=require(_0x5258('0x3'));var fs=require('fs');var Redis=require(_0x5258('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5258('0x5'))('rpc');var config=require(_0x5258('0x6'));var jayson=require(_0x5258('0x7'));var client=jayson[_0x5258('0x8')][_0x5258('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x323fae,_0x3b59d7,_0x56a314){return new BPromise(function(_0x11061a,_0x30311b){return client['request'](_0x323fae,_0x56a314)[_0x5258('0xa')](function(_0x3ebc28){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3b59d7,_0x5258('0xb'));logger['debug'](_0x5258('0xc'),_0x3b59d7,_0x5258('0xb'),JSON[_0x5258('0xd')](_0x3ebc28));if(_0x3ebc28[_0x5258('0xe')]){if(_0x3ebc28[_0x5258('0xe')]['code']===0x1f4){logger[_0x5258('0xe')](_0x5258('0xf'),_0x3b59d7,_0x3ebc28['error'][_0x5258('0x10')]);return _0x30311b(_0x3ebc28['error']['message']);}logger[_0x5258('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3b59d7,_0x3ebc28[_0x5258('0xe')]['message']);return _0x11061a(_0x3ebc28[_0x5258('0xe')]['message']);}else{logger[_0x5258('0x11')](_0x5258('0xf'),_0x3b59d7,'request\x20sent');_0x11061a(_0x3ebc28[_0x5258('0x12')][_0x5258('0x10')]);}})[_0x5258('0x13')](function(_0x4c8c35){logger[_0x5258('0xe')](_0x5258('0xf'),_0x3b59d7,_0x4c8c35);_0x30311b(_0x4c8c35);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index bb0fe3d..be9f626 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 _0xe68a=['../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1eea6a,_0x5f4475){var _0x49365f=function(_0x393c3a){while(--_0x393c3a){_0x1eea6a['push'](_0x1eea6a['shift']());}};_0x49365f(++_0x5f4475);}(_0xe68a,0x188));var _0xae68=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0xe68a[_0x315add];return _0x40956b;};'use strict';var multer=require(_0xae68('0x0'));var util=require(_0xae68('0x1'));var path=require(_0xae68('0x2'));var timeout=require(_0xae68('0x3'));var express=require(_0xae68('0x4'));var router=express[_0xae68('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xae68('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae68('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xae68('0x8')]('/',auth[_0xae68('0x9')](),controller[_0xae68('0xa')]);router[_0xae68('0x8')]('/:id',auth[_0xae68('0x9')](),controller[_0xae68('0xb')]);router[_0xae68('0xc')]('/',auth[_0xae68('0x9')](),controller[_0xae68('0xd')]);router[_0xae68('0xe')](_0xae68('0xf'),auth['isAuthenticated'](),controller[_0xae68('0x10')]);router[_0xae68('0x11')](_0xae68('0xf'),auth[_0xae68('0x9')](),controller['destroy']);module[_0xae68('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 4279cd8..61feee0 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 _0xd491=['exports','string','variable','customVariable','STRING','ENUM','sequelize'];(function(_0x10db88,_0x8bf030){var _0x2dc5e6=function(_0x15fa0c){while(--_0x15fa0c){_0x10db88['push'](_0x10db88['shift']());}};_0x2dc5e6(++_0x8bf030);}(_0xd491,0xd8));var _0x1d49=function(_0x31c1cd,_0x59f7a5){_0x31c1cd=_0x31c1cd-0x0;var _0x203bb6=_0xd491[_0x31c1cd];return _0x203bb6;};'use strict';var Sequelize=require(_0x1d49('0x0'));module[_0x1d49('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1d49('0x2'),_0x1d49('0x3'),_0x1d49('0x4'),'keyValue','picklist'),'defaultValue':_0x1d49('0x2')},'content':{'type':Sequelize[_0x1d49('0x5')]},'key':{'type':Sequelize[_0x1d49('0x5')]},'keyType':{'type':Sequelize[_0x1d49('0x6')]('string',_0x1d49('0x3'),_0x1d49('0x4'))},'keyContent':{'type':Sequelize[_0x1d49('0x5')]},'idField':{'type':Sequelize[_0x1d49('0x5')]},'nameField':{'type':Sequelize[_0x1d49('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d49('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 30f333b..47f96c1 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 _0xbb53=['include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','keys','length'];(function(_0x513dde,_0x17140a){var _0x419e19=function(_0x494071){while(--_0x494071){_0x513dde['push'](_0x513dde['shift']());}};_0x419e19(++_0x17140a);}(_0xbb53,0x121));var _0x3bb5=function(_0x2d848f,_0x4dd225){_0x2d848f=_0x2d848f-0x0;var _0x20146d=_0xbb53[_0x2d848f];return _0x20146d;};'use strict';var emlformat=require(_0x3bb5('0x0'));var rimraf=require(_0x3bb5('0x1'));var zipdir=require(_0x3bb5('0x2'));var jsonpatch=require(_0x3bb5('0x3'));var rp=require(_0x3bb5('0x4'));var moment=require(_0x3bb5('0x5'));var BPromise=require(_0x3bb5('0x6'));var Mustache=require(_0x3bb5('0x7'));var util=require(_0x3bb5('0x8'));var path=require(_0x3bb5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bb5('0xa'));var fs=require('fs');var fs_extra=require(_0x3bb5('0xb'));var _=require(_0x3bb5('0xc'));var squel=require(_0x3bb5('0xd'));var crypto=require(_0x3bb5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3bb5('0xf'));var Papa=require(_0x3bb5('0x10'));var Redis=require(_0x3bb5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3bb5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bb5('0x13'))(_0x3bb5('0x14'));var utils=require('../../config/utils');var config=require(_0x3bb5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bb5('0x16'))['db'];function respondWithStatusCode(_0x511bd8,_0x526bf0){_0x526bf0=_0x526bf0||0xcc;return function(_0x223356){if(_0x223356){return _0x511bd8[_0x3bb5('0x17')](_0x526bf0);}return _0x511bd8[_0x3bb5('0x18')](_0x526bf0)['end']();};}function respondWithResult(_0xd578fc,_0x12e409){_0x12e409=_0x12e409||0xc8;return function(_0x519123){if(_0x519123){return _0xd578fc[_0x3bb5('0x18')](_0x12e409)[_0x3bb5('0x19')](_0x519123);}};}function respondWithFilteredResult(_0x5cec77,_0x5ca99f){return function(_0x50617f){if(_0x50617f){var _0x42ef1b=typeof _0x5ca99f[_0x3bb5('0x1a')]==='undefined'&&typeof _0x5ca99f[_0x3bb5('0x1b')]===_0x3bb5('0x1c');var _0x4656c4=_0x50617f[_0x3bb5('0x1d')];var _0x48bc25=_0x42ef1b?0x0:_0x5ca99f[_0x3bb5('0x1a')];var _0x1109d0=_0x42ef1b?_0x50617f[_0x3bb5('0x1d')]:_0x5ca99f['offset']+_0x5ca99f['limit'];var _0x19b177;if(_0x1109d0>=_0x4656c4){_0x1109d0=_0x4656c4;_0x19b177=0xc8;}else{_0x19b177=0xce;}_0x5cec77[_0x3bb5('0x18')](_0x19b177);return _0x5cec77[_0x3bb5('0x1e')]('Content-Range',_0x48bc25+'-'+_0x1109d0+'/'+_0x4656c4)[_0x3bb5('0x19')](_0x50617f);}return null;};}function patchUpdates(_0x2afe6e){return function(_0x3f94ad){try{jsonpatch[_0x3bb5('0x1f')](_0x3f94ad,_0x2afe6e,!![]);}catch(_0x21a3ff){return BPromise[_0x3bb5('0x20')](_0x21a3ff);}return _0x3f94ad['save']();};}function saveUpdates(_0x37444e,_0x3eae85){return function(_0x438a8d){if(_0x438a8d){return _0x438a8d[_0x3bb5('0x21')](_0x37444e)[_0x3bb5('0x22')](function(_0xfb9e8){return _0xfb9e8;});}return null;};}function removeEntity(_0x341a3f,_0x58c10f){return function(_0x1d2a24){if(_0x1d2a24){return _0x1d2a24[_0x3bb5('0x23')]()['then'](function(){_0x341a3f['status'](0xcc)[_0x3bb5('0x24')]();});}};}function handleEntityNotFound(_0x36cfda,_0x58acdb){return function(_0x483689){if(!_0x483689){_0x36cfda[_0x3bb5('0x17')](0x194);}return _0x483689;};}function handleError(_0x77a60f,_0x2fc543){_0x2fc543=_0x2fc543||0x1f4;return function(_0xc1c149){logger['error'](_0xc1c149['stack']);if(_0xc1c149[_0x3bb5('0x25')]){delete _0xc1c149['name'];}_0x77a60f[_0x3bb5('0x18')](_0x2fc543)[_0x3bb5('0x26')](_0xc1c149);};}exports[_0x3bb5('0x27')]=function(_0x534b15,_0x5f40ac){var _0x19e61d={},_0x39f1ad={},_0x17ada7={'count':0x0,'rows':[]};var _0x18304c=_[_0x3bb5('0x28')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')],function(_0x5ce225){return{'name':_0x5ce225[_0x3bb5('0x2b')],'type':_0x5ce225[_0x3bb5('0x2c')][_0x3bb5('0x2d')]};});_0x39f1ad[_0x3bb5('0x2e')]=_[_0x3bb5('0x28')](_0x18304c,_0x3bb5('0x25'));_0x39f1ad[_0x3bb5('0x2f')]=_['keys'](_0x534b15[_0x3bb5('0x2f')]);_0x39f1ad[_0x3bb5('0x30')]=_['intersection'](_0x39f1ad[_0x3bb5('0x2e')],_0x39f1ad[_0x3bb5('0x2f')]);_0x19e61d[_0x3bb5('0x31')]=_[_0x3bb5('0x32')](_0x39f1ad[_0x3bb5('0x2e')],qs['fields'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x19e61d[_0x3bb5('0x31')]=_0x19e61d[_0x3bb5('0x31')]['length']?_0x19e61d['attributes']:_0x39f1ad[_0x3bb5('0x2e')];if(!_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x34')](_0x3bb5('0x35'))){_0x19e61d[_0x3bb5('0x1b')]=qs[_0x3bb5('0x1b')](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1b')]);_0x19e61d[_0x3bb5('0x1a')]=qs['offset'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x1a')]);}_0x19e61d['order']=qs['sort'](_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x36')]);_0x19e61d[_0x3bb5('0x37')]=qs[_0x3bb5('0x30')](_['pick'](_0x534b15['query'],_0x39f1ad[_0x3bb5('0x30')]),_0x18304c);if(_0x534b15['query'][_0x3bb5('0x38')]){_0x19e61d['where']=_['merge'](_0x19e61d[_0x3bb5('0x37')],{'$or':_['map'](_0x18304c,function(_0x5edb47){if(_0x5edb47[_0x3bb5('0x2c')]!==_0x3bb5('0x39')){var _0x1384cd={};_0x1384cd[_0x5edb47['name']]={'$like':'%'+_0x534b15[_0x3bb5('0x2f')]['filter']+'%'};return _0x1384cd;}})});}_0x19e61d=_[_0x3bb5('0x3a')]({},_0x19e61d,_0x534b15['options']);var _0x235e3={'where':_0x19e61d[_0x3bb5('0x37')]};return db[_0x3bb5('0x29')][_0x3bb5('0x1d')](_0x235e3)[_0x3bb5('0x22')](function(_0x261d7b){_0x17ada7['count']=_0x261d7b;if(_0x534b15[_0x3bb5('0x2f')][_0x3bb5('0x3b')]){_0x19e61d['include']=[{'all':!![]}];}return db[_0x3bb5('0x29')][_0x3bb5('0x3c')](_0x19e61d);})[_0x3bb5('0x22')](function(_0x5cfb72){_0x17ada7[_0x3bb5('0x3d')]=_0x5cfb72;return _0x17ada7;})[_0x3bb5('0x22')](respondWithFilteredResult(_0x5f40ac,_0x19e61d))['catch'](handleError(_0x5f40ac,null));};exports[_0x3bb5('0x3e')]=function(_0x40da23,_0x7a294e){var _0x2291e9={'raw':!![],'where':{'id':_0x40da23[_0x3bb5('0x3f')]['id']}},_0x663685={};_0x663685[_0x3bb5('0x2e')]=_[_0x3bb5('0x40')](db[_0x3bb5('0x29')][_0x3bb5('0x2a')]);_0x663685[_0x3bb5('0x2f')]=_[_0x3bb5('0x40')](_0x40da23[_0x3bb5('0x2f')]);_0x663685[_0x3bb5('0x30')]=_['intersection'](_0x663685[_0x3bb5('0x2e')],_0x663685[_0x3bb5('0x2f')]);_0x2291e9['attributes']=_['intersection'](_0x663685[_0x3bb5('0x2e')],qs[_0x3bb5('0x33')](_0x40da23[_0x3bb5('0x2f')][_0x3bb5('0x33')]));_0x2291e9[_0x3bb5('0x31')]=_0x2291e9[_0x3bb5('0x31')][_0x3bb5('0x41')]?_0x2291e9[_0x3bb5('0x31')]:_0x663685['model'];if(_0x40da23['query'][_0x3bb5('0x3b')]){_0x2291e9[_0x3bb5('0x42')]=[{'all':!![]}];}_0x2291e9=_[_0x3bb5('0x3a')]({},_0x2291e9,_0x40da23['options']);return db[_0x3bb5('0x29')]['find'](_0x2291e9)[_0x3bb5('0x22')](handleEntityNotFound(_0x7a294e,null))[_0x3bb5('0x22')](respondWithResult(_0x7a294e,null))[_0x3bb5('0x43')](handleError(_0x7a294e,null));};exports[_0x3bb5('0x44')]=function(_0x11352e,_0x2b7c68){return db['FreshdeskField'][_0x3bb5('0x44')](_0x11352e[_0x3bb5('0x45')],{})['then'](respondWithResult(_0x2b7c68,0xc9))[_0x3bb5('0x43')](handleError(_0x2b7c68,null));};exports[_0x3bb5('0x21')]=function(_0x5075bd,_0x41edf7){if(_0x5075bd[_0x3bb5('0x45')]['id']){delete _0x5075bd[_0x3bb5('0x45')]['id'];}return db[_0x3bb5('0x29')][_0x3bb5('0x46')]({'where':{'id':_0x5075bd['params']['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x41edf7,null))[_0x3bb5('0x22')](saveUpdates(_0x5075bd['body'],null))['then'](respondWithResult(_0x41edf7,null))[_0x3bb5('0x43')](handleError(_0x41edf7,null));};exports[_0x3bb5('0x23')]=function(_0x1e5b64,_0x90d5b6){return db[_0x3bb5('0x29')]['find']({'where':{'id':_0x1e5b64[_0x3bb5('0x3f')]['id']}})[_0x3bb5('0x22')](handleEntityNotFound(_0x90d5b6,null))[_0x3bb5('0x22')](removeEntity(_0x90d5b6,null))[_0x3bb5('0x43')](handleError(_0x90d5b6,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 27c29e8..0929d85 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 _0x0585=['./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0x0585,0x1ba));var _0x5058=function(_0x3f9289,_0x4bb3a2){_0x3f9289=_0x3f9289-0x0;var _0x362e39=_0x0585[_0x3f9289];return _0x362e39;};'use strict';var _=require(_0x5058('0x0'));var util=require(_0x5058('0x1'));var logger=require('../../config/logger')(_0x5058('0x2'));var moment=require('moment');var BPromise=require(_0x5058('0x3'));var rp=require(_0x5058('0x4'));var fs=require('fs');var path=require(_0x5058('0x5'));var rimraf=require(_0x5058('0x6'));var config=require(_0x5058('0x7'));var attributes=require(_0x5058('0x8'));module[_0x5058('0x9')]=function(_0x58841b,_0x3992c9){return _0x58841b[_0x5058('0xa')](_0x5058('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5058('0xc'),'fields':[_0x5058('0xd'),_0x5058('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 3411b3b..267c49e 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 _0xc690=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x428f5c,_0x14d4eb){var _0x3df5ee=function(_0xad8aa3){while(--_0xad8aa3){_0x428f5c['push'](_0x428f5c['shift']());}};_0x3df5ee(++_0x14d4eb);}(_0xc690,0x6a));var _0x0c69=function(_0x348883,_0x503fac){_0x348883=_0x348883-0x0;var _0x18fcd2=_0xc690[_0x348883];return _0x18fcd2;};'use strict';var _=require(_0x0c69('0x0'));var util=require(_0x0c69('0x1'));var moment=require(_0x0c69('0x2'));var BPromise=require(_0x0c69('0x3'));var rs=require(_0x0c69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c69('0x5'))['db'];var utils=require(_0x0c69('0x6'));var logger=require(_0x0c69('0x7'))(_0x0c69('0x8'));var config=require(_0x0c69('0x9'));var jayson=require(_0x0c69('0xa'));var client=jayson[_0x0c69('0xb')][_0x0c69('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x375f59,_0x227888,_0xe468f1){return new BPromise(function(_0x4b5bd3,_0x38a8d9){return client[_0x0c69('0xd')](_0x375f59,_0xe468f1)['then'](function(_0x39c2f0){logger['info'](_0x0c69('0xe'),_0x227888,_0x0c69('0xf'));logger[_0x0c69('0x10')](_0x0c69('0x11'),_0x227888,_0x0c69('0xf'),JSON[_0x0c69('0x12')](_0x39c2f0));if(_0x39c2f0[_0x0c69('0x13')]){if(_0x39c2f0['error']['code']===0x1f4){logger[_0x0c69('0x13')](_0x0c69('0xe'),_0x227888,_0x39c2f0[_0x0c69('0x13')][_0x0c69('0x14')]);return _0x38a8d9(_0x39c2f0[_0x0c69('0x13')][_0x0c69('0x14')]);}logger['error'](_0x0c69('0xe'),_0x227888,_0x39c2f0['error']['message']);return _0x4b5bd3(_0x39c2f0[_0x0c69('0x13')][_0x0c69('0x14')]);}else{logger[_0x0c69('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x227888,_0x0c69('0xf'));_0x4b5bd3(_0x39c2f0[_0x0c69('0x16')][_0x0c69('0x14')]);}})[_0x0c69('0x17')](function(_0xa28d23){logger[_0x0c69('0x13')](_0x0c69('0xe'),_0x227888,_0xa28d23);_0x38a8d9(_0xa28d23);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 699e11f..40b9377 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 _0xb9be=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x4eed04,_0x310fe4){var _0x473c4f=function(_0x26d5d3){while(--_0x26d5d3){_0x4eed04['push'](_0x4eed04['shift']());}};_0x473c4f(++_0x310fe4);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xb9be[_0x3a1ea5];return _0xfac9b2;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xeb9b('0x9')]('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['get'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xd')]);router[_0xeb9b('0x9')](_0xeb9b('0xe'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xf')]);router[_0xeb9b('0x9')](_0xeb9b('0x10'),auth['isAuthenticated'](),controller[_0xeb9b('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb9b('0x12')]);router[_0xeb9b('0x13')]('/:id/configurations',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x14')]);router[_0xeb9b('0x15')](_0xeb9b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 034979d..231bcd1 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 _0x3a6d=['exports','STRING','username','sequelize'];(function(_0x388d7c,_0x292afd){var _0x5d1184=function(_0x36fb60){while(--_0x36fb60){_0x388d7c['push'](_0x388d7c['shift']());}};_0x5d1184(++_0x292afd);}(_0x3a6d,0x143));var _0xd3a6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3a6d[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0xd3a6('0x0'));module[_0xd3a6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3a6('0x2')]},'username':{'type':Sequelize[_0xd3a6('0x2')],'unique':_0xd3a6('0x3')},'apiKey':{'type':Sequelize[_0xd3a6('0x2')]},'remoteUri':{'type':Sequelize[_0xd3a6('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd3a6('0x2')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index acfeff1..edde92b 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 _0xec7a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','name','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','channel','Descriptions','FreshsalesField','username','apiKey','remoteUri','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x21e742,_0x272027){var _0x1672c8=function(_0x166baa){while(--_0x166baa){_0x21e742['push'](_0x21e742['shift']());}};_0x1672c8(++_0x272027);}(_0xec7a,0x182));var _0xaec7=function(_0x4b2ed7,_0x5b3100){_0x4b2ed7=_0x4b2ed7-0x0;var _0x55a953=_0xec7a[_0x4b2ed7];return _0x55a953;};'use strict';var emlformat=require(_0xaec7('0x0'));var rimraf=require(_0xaec7('0x1'));var zipdir=require(_0xaec7('0x2'));var jsonpatch=require(_0xaec7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaec7('0x4'));var Mustache=require(_0xaec7('0x5'));var util=require(_0xaec7('0x6'));var path=require(_0xaec7('0x7'));var sox=require(_0xaec7('0x8'));var csv=require(_0xaec7('0x9'));var ejs=require(_0xaec7('0xa'));var fs=require('fs');var fs_extra=require(_0xaec7('0xb'));var _=require(_0xaec7('0xc'));var squel=require(_0xaec7('0xd'));var crypto=require('crypto');var jsforce=require(_0xaec7('0xe'));var deskjs=require(_0xaec7('0xf'));var toCsv=require(_0xaec7('0x9'));var querystring=require(_0xaec7('0x10'));var Papa=require('papaparse');var Redis=require(_0xaec7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaec7('0x12'));var as=require(_0xaec7('0x13'));var hardwareService=require(_0xaec7('0x14'));var logger=require(_0xaec7('0x15'))(_0xaec7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaec7('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaec7('0x18'));function respondWithStatusCode(_0x235059,_0x5042cb){_0x5042cb=_0x5042cb||0xcc;return function(_0x1a0b2a){if(_0x1a0b2a){return _0x235059['sendStatus'](_0x5042cb);}return _0x235059[_0xaec7('0x19')](_0x5042cb)[_0xaec7('0x1a')]();};}function respondWithResult(_0x522efb,_0x37d1e4){_0x37d1e4=_0x37d1e4||0xc8;return function(_0x2af525){if(_0x2af525){return _0x522efb[_0xaec7('0x19')](_0x37d1e4)[_0xaec7('0x1b')](_0x2af525);}};}function respondWithFilteredResult(_0x21335c,_0xf6e256){return function(_0x2b50bd){if(_0x2b50bd){var _0x12da7f=typeof _0xf6e256[_0xaec7('0x1c')]===_0xaec7('0x1d')&&typeof _0xf6e256[_0xaec7('0x1e')]===_0xaec7('0x1d');var _0x32791e=_0x2b50bd[_0xaec7('0x1f')];var _0x2246ed=_0x12da7f?0x0:_0xf6e256[_0xaec7('0x1c')];var _0x2fcc0d=_0x12da7f?_0x2b50bd[_0xaec7('0x1f')]:_0xf6e256[_0xaec7('0x1c')]+_0xf6e256[_0xaec7('0x1e')];var _0x6d65dd;if(_0x2fcc0d>=_0x32791e){_0x2fcc0d=_0x32791e;_0x6d65dd=0xc8;}else{_0x6d65dd=0xce;}_0x21335c[_0xaec7('0x19')](_0x6d65dd);return _0x21335c[_0xaec7('0x20')]('Content-Range',_0x2246ed+'-'+_0x2fcc0d+'/'+_0x32791e)['json'](_0x2b50bd);}return null;};}function patchUpdates(_0x21f530){return function(_0x506e1c){try{jsonpatch[_0xaec7('0x21')](_0x506e1c,_0x21f530,!![]);}catch(_0x6a87d6){return BPromise[_0xaec7('0x22')](_0x6a87d6);}return _0x506e1c[_0xaec7('0x23')]();};}function saveUpdates(_0x273a0a,_0x31e0c5){return function(_0x1eba35){if(_0x1eba35){return _0x1eba35[_0xaec7('0x24')](_0x273a0a)[_0xaec7('0x25')](function(_0x6ea3c0){return _0x6ea3c0;});}return null;};}function removeEntity(_0x5ca99f,_0x2114f4){return function(_0x2cb13a){if(_0x2cb13a){return _0x2cb13a[_0xaec7('0x26')]()['then'](function(){_0x5ca99f[_0xaec7('0x19')](0xcc)[_0xaec7('0x1a')]();});}};}function handleEntityNotFound(_0x2cc5a4,_0x389933){return function(_0x3271ef){if(!_0x3271ef){_0x2cc5a4[_0xaec7('0x27')](0x194);}return _0x3271ef;};}function handleError(_0x2dad20,_0xb6702a){_0xb6702a=_0xb6702a||0x1f4;return function(_0x2d60ad){logger[_0xaec7('0x28')](_0x2d60ad['stack']);if(_0x2d60ad['name']){delete _0x2d60ad['name'];}_0x2dad20['status'](_0xb6702a)[_0xaec7('0x29')](_0x2d60ad);};}exports[_0xaec7('0x2a')]=function(_0x59bcf5,_0x297965){var _0x3e83c5={},_0x2b2bc5={},_0x44efc6={'count':0x0,'rows':[]};var _0x45472e=_[_0xaec7('0x2b')](db[_0xaec7('0x2c')][_0xaec7('0x2d')],function(_0xf19bb3){return{'name':_0xf19bb3[_0xaec7('0x2e')],'type':_0xf19bb3['type'][_0xaec7('0x2f')]};});_0x2b2bc5['model']=_[_0xaec7('0x2b')](_0x45472e,_0xaec7('0x30'));_0x2b2bc5[_0xaec7('0x31')]=_['keys'](_0x59bcf5[_0xaec7('0x31')]);_0x2b2bc5[_0xaec7('0x32')]=_[_0xaec7('0x33')](_0x2b2bc5[_0xaec7('0x34')],_0x2b2bc5[_0xaec7('0x31')]);_0x3e83c5[_0xaec7('0x35')]=_[_0xaec7('0x33')](_0x2b2bc5[_0xaec7('0x34')],qs[_0xaec7('0x36')](_0x59bcf5[_0xaec7('0x31')][_0xaec7('0x36')]));_0x3e83c5[_0xaec7('0x35')]=_0x3e83c5[_0xaec7('0x35')][_0xaec7('0x37')]?_0x3e83c5[_0xaec7('0x35')]:_0x2b2bc5[_0xaec7('0x34')];if(!_0x59bcf5['query']['hasOwnProperty'](_0xaec7('0x38'))){_0x3e83c5[_0xaec7('0x1e')]=qs['limit'](_0x59bcf5[_0xaec7('0x31')]['limit']);_0x3e83c5['offset']=qs[_0xaec7('0x1c')](_0x59bcf5[_0xaec7('0x31')][_0xaec7('0x1c')]);}_0x3e83c5[_0xaec7('0x39')]=qs['sort'](_0x59bcf5[_0xaec7('0x31')][_0xaec7('0x3a')]);_0x3e83c5[_0xaec7('0x3b')]=qs['filters'](_['pick'](_0x59bcf5[_0xaec7('0x31')],_0x2b2bc5['filters']),_0x45472e);if(_0x59bcf5[_0xaec7('0x31')][_0xaec7('0x3c')]){_0x3e83c5[_0xaec7('0x3b')]=_[_0xaec7('0x3d')](_0x3e83c5[_0xaec7('0x3b')],{'$or':_[_0xaec7('0x2b')](_0x45472e,function(_0xdf2820){if(_0xdf2820[_0xaec7('0x3e')]!=='VIRTUAL'){var _0xdda358={};_0xdda358[_0xdf2820[_0xaec7('0x30')]]={'$like':'%'+_0x59bcf5[_0xaec7('0x31')][_0xaec7('0x3c')]+'%'};return _0xdda358;}})});}_0x3e83c5=_[_0xaec7('0x3d')]({},_0x3e83c5,_0x59bcf5[_0xaec7('0x3f')]);var _0x2ee05a={'where':_0x3e83c5['where']};return db['FreshsalesAccount'][_0xaec7('0x1f')](_0x2ee05a)[_0xaec7('0x25')](function(_0x43bcdb){_0x44efc6[_0xaec7('0x1f')]=_0x43bcdb;if(_0x59bcf5[_0xaec7('0x31')][_0xaec7('0x40')]){_0x3e83c5[_0xaec7('0x41')]=[{'all':!![]}];}return db[_0xaec7('0x2c')][_0xaec7('0x42')](_0x3e83c5);})[_0xaec7('0x25')](function(_0x37e808){_0x44efc6[_0xaec7('0x43')]=_0x37e808;return _0x44efc6;})[_0xaec7('0x25')](respondWithFilteredResult(_0x297965,_0x3e83c5))['catch'](handleError(_0x297965,null));};exports[_0xaec7('0x44')]=function(_0x46798a,_0x3fbc0c){var _0x3fce49={'raw':![],'where':{'id':_0x46798a[_0xaec7('0x45')]['id']}},_0x3e9118={};_0x3e9118[_0xaec7('0x34')]=_[_0xaec7('0x46')](db['FreshsalesAccount']['rawAttributes']);_0x3e9118[_0xaec7('0x31')]=_[_0xaec7('0x46')](_0x46798a[_0xaec7('0x31')]);_0x3e9118['filters']=_['intersection'](_0x3e9118[_0xaec7('0x34')],_0x3e9118[_0xaec7('0x31')]);_0x3fce49[_0xaec7('0x35')]=_['intersection'](_0x3e9118[_0xaec7('0x34')],qs[_0xaec7('0x36')](_0x46798a[_0xaec7('0x31')][_0xaec7('0x36')]));_0x3fce49['attributes']=_0x3fce49[_0xaec7('0x35')][_0xaec7('0x37')]?_0x3fce49[_0xaec7('0x35')]:_0x3e9118['model'];if(_0x46798a[_0xaec7('0x31')][_0xaec7('0x40')]){_0x3fce49[_0xaec7('0x41')]=[{'all':!![]}];}_0x3fce49=_[_0xaec7('0x3d')]({},_0x3fce49,_0x46798a['options']);return db[_0xaec7('0x2c')]['find'](_0x3fce49)[_0xaec7('0x25')](handleEntityNotFound(_0x3fbc0c,null))[_0xaec7('0x25')](respondWithResult(_0x3fbc0c,null))[_0xaec7('0x47')](handleError(_0x3fbc0c,null));};exports[_0xaec7('0x48')]=function(_0x372924,_0x1344dd){return db[_0xaec7('0x2c')][_0xaec7('0x48')](_0x372924[_0xaec7('0x49')],{})[_0xaec7('0x25')](respondWithResult(_0x1344dd,0xc9))[_0xaec7('0x47')](handleError(_0x1344dd,null));};exports[_0xaec7('0x24')]=function(_0x308ccd,_0x3b2a5b){if(_0x308ccd[_0xaec7('0x49')]['id']){delete _0x308ccd[_0xaec7('0x49')]['id'];}return db[_0xaec7('0x2c')][_0xaec7('0x4a')]({'where':{'id':_0x308ccd[_0xaec7('0x45')]['id']}})[_0xaec7('0x25')](handleEntityNotFound(_0x3b2a5b,null))[_0xaec7('0x25')](saveUpdates(_0x308ccd['body'],null))[_0xaec7('0x25')](respondWithResult(_0x3b2a5b,null))[_0xaec7('0x47')](handleError(_0x3b2a5b,null));};exports[_0xaec7('0x26')]=function(_0x2ecfa7,_0xa600c0){return db['FreshsalesAccount'][_0xaec7('0x4a')]({'where':{'id':_0x2ecfa7[_0xaec7('0x45')]['id']}})[_0xaec7('0x25')](handleEntityNotFound(_0xa600c0,null))['then'](removeEntity(_0xa600c0,null))[_0xaec7('0x47')](handleError(_0xa600c0,null));};exports[_0xaec7('0x4b')]=function(_0x40935d,_0x38c421,_0x34d5e6){var _0x17a64d={};var _0x312936={};var _0x18bc69;var _0x2cd2a3;return db[_0xaec7('0x2c')][_0xaec7('0x4c')]({'where':{'id':_0x40935d[_0xaec7('0x45')]['id']}})['then'](handleEntityNotFound(_0x38c421,null))[_0xaec7('0x25')](function(_0x9df721){if(_0x9df721){_0x18bc69=_0x9df721;_0x312936['model']=_['keys'](db[_0xaec7('0x4d')]['rawAttributes']);_0x312936[_0xaec7('0x31')]=_[_0xaec7('0x46')](_0x40935d[_0xaec7('0x31')]);_0x312936['filters']=_[_0xaec7('0x33')](_0x312936[_0xaec7('0x34')],_0x312936[_0xaec7('0x31')]);_0x17a64d['attributes']=_[_0xaec7('0x33')](_0x312936[_0xaec7('0x34')],qs[_0xaec7('0x36')](_0x40935d['query'][_0xaec7('0x36')]));_0x17a64d['attributes']=_0x17a64d['attributes'][_0xaec7('0x37')]?_0x17a64d[_0xaec7('0x35')]:_0x312936[_0xaec7('0x34')];_0x17a64d[_0xaec7('0x39')]=qs[_0xaec7('0x3a')](_0x40935d[_0xaec7('0x31')][_0xaec7('0x3a')]);_0x17a64d['where']=qs[_0xaec7('0x32')](_[_0xaec7('0x4e')](_0x40935d[_0xaec7('0x31')],_0x312936['filters']));if(_0x40935d[_0xaec7('0x31')]['filter']){_0x17a64d[_0xaec7('0x3b')]=_['merge'](_0x17a64d[_0xaec7('0x3b')],{'$or':_['map'](_0x17a64d[_0xaec7('0x35')],function(_0x22e3ad){var _0x59e9eb={};_0x59e9eb[_0x22e3ad]={'$like':'%'+_0x40935d['query']['filter']+'%'};return _0x59e9eb;})});}_0x17a64d=_[_0xaec7('0x3d')]({},_0x17a64d,_0x40935d[_0xaec7('0x3f')]);return _0x18bc69[_0xaec7('0x4b')](_0x17a64d);}})[_0xaec7('0x25')](function(_0x39bb0c){if(_0x39bb0c){_0x2cd2a3=_0x39bb0c[_0xaec7('0x37')];if(!_0x40935d['query'][_0xaec7('0x4f')](_0xaec7('0x38'))){_0x17a64d[_0xaec7('0x1e')]=qs[_0xaec7('0x1e')](_0x40935d['query'][_0xaec7('0x1e')]);_0x17a64d[_0xaec7('0x1c')]=qs[_0xaec7('0x1c')](_0x40935d[_0xaec7('0x31')][_0xaec7('0x1c')]);}return _0x18bc69[_0xaec7('0x4b')](_0x17a64d);}})[_0xaec7('0x25')](function(_0x5b3844){if(_0x5b3844){return _0x5b3844?{'count':_0x2cd2a3,'rows':_0x5b3844}:null;}})[_0xaec7('0x25')](respondWithResult(_0x38c421,null))[_0xaec7('0x47')](handleError(_0x38c421,null));};exports[_0xaec7('0x50')]=function(_0x5e3987,_0x2da45a,_0x3d5b91){if(_0x5e3987[_0xaec7('0x49')]['id']){delete _0x5e3987['body']['id'];}return db['FreshsalesAccount'][_0xaec7('0x4c')]({'where':{'id':_0x5e3987[_0xaec7('0x45')]['id']}})[_0xaec7('0x25')](handleEntityNotFound(_0x2da45a,null))[_0xaec7('0x25')](function(_0x48dff2){if(_0x48dff2){_0x5e3987[_0xaec7('0x49')]['AccountId']=_0x48dff2['id'];_0x5e3987[_0xaec7('0x49')][_0xaec7('0x51')]=integrations['getSubjects'](_0x5e3987[_0xaec7('0x49')][_0xaec7('0x52')],_0x5e3987[_0xaec7('0x49')]['type']);_0x5e3987[_0xaec7('0x49')][_0xaec7('0x53')]=integrations['getDescriptions'](_0x5e3987[_0xaec7('0x49')][_0xaec7('0x52')],_0x5e3987['body'][_0xaec7('0x3e')]);return db[_0xaec7('0x4d')]['create'](_0x5e3987[_0xaec7('0x49')],{'include':[{'model':db[_0xaec7('0x54')],'as':_0xaec7('0x51')},{'model':db[_0xaec7('0x54')],'as':_0xaec7('0x53')}]});}return null;})['then'](respondWithResult(_0x2da45a,null))[_0xaec7('0x47')](handleError(_0x2da45a,null));};exports['getFields']=function(_0x4a76a7,_0x4a6619,_0x40433f){var _0x24eb8e='';var _0x3aa048='';return db['FreshsalesAccount'][_0xaec7('0x4c')]({'where':{'id':_0x4a76a7[_0xaec7('0x45')]['id']},'attributes':['id',_0xaec7('0x55'),'remoteUri',_0xaec7('0x56')]})[_0xaec7('0x25')](handleEntityNotFound(_0x4a6619,null))[_0xaec7('0x25')](function(_0x2084f4){if(_0x2084f4){_0x3aa048=_0x2084f4[_0xaec7('0x55')];_0x24eb8e=_0x2084f4[_0xaec7('0x57')];var _0x5c00ba=_0x2084f4[_0xaec7('0x57')][_0xaec7('0x58')](-0x1);if(_0x5c00ba==='/'){_0x24eb8e=_0x24eb8e[_0xaec7('0x59')](0x0,_0x24eb8e['lastIndexOf'](_0x5c00ba));}return rp({'method':_0xaec7('0x5a'),'uri':util['format'](_0xaec7('0x5b'),_0x24eb8e,_0xaec7('0x5c')),'headers':{'Authorization':_0xaec7('0x5d')+_0x2084f4[_0xaec7('0x56')]},'json':!![]});}})[_0xaec7('0x25')](function(_0x437e77){if(_0x437e77){var _0x225ad9=_0x437e77[_0xaec7('0x5e')];var _0x33bf83=![];var _0x49dc96=null;for(_0x49dc96=0x0;_0x49dc96<_0x225ad9[_0xaec7('0x37')];_0x49dc96++){if(_0x225ad9[_0x49dc96][_0xaec7('0x5f')]===_0x3aa048){_0x33bf83=!![];}}if(_0x33bf83){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xaec7('0x60')});}}})['then'](respondWithResult(_0x4a6619,null))[_0xaec7('0x47')](function(_0x105e04){var _0x1bee56=_0x4a76a7['query'][_0xaec7('0x61')]?0x1f4:_0x105e04[_0xaec7('0x62')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1bee56,JSON[_0xaec7('0x63')](_0x105e04));delete _0x105e04[_0xaec7('0x30')];if(_0x1bee56===0x191){_0x1bee56=0x190;}_0x4a6619[_0xaec7('0x19')](_0x1bee56)['send'](_0x4a76a7[_0xaec7('0x31')][_0xaec7('0x61')]?{'message':_0xaec7('0x64'),'statusCode':_0x105e04['statusCode']}:_0x105e04);});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 72baccb..9f70db8 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 _0x187d=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x17e75e,_0x24753e){var _0x25f451=function(_0x36d907){while(--_0x36d907){_0x17e75e['push'](_0x17e75e['shift']());}};_0x25f451(++_0x24753e);}(_0x187d,0x93));var _0xd187=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x187d[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','../../components/integrations/configuration','exports','define','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 diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 0d6b24a..96bc33b 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 _0x6050=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x259a62,_0x116d76){var _0x224bcd=function(_0x8300ad){while(--_0x8300ad){_0x259a62['push'](_0x259a62['shift']());}};_0x224bcd(++_0x116d76);}(_0x6050,0x196));var _0x0605=function(_0xb8f87e,_0x1aee71){_0xb8f87e=_0xb8f87e-0x0;var _0x497628=_0x6050[_0xb8f87e];return _0x497628;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});}exports[_0x0605('0x16')]=function(_0x2b7b5a){var _0x1d57ba=this;return new Promise(function(_0x193520,_0x40abb2){return db[_0x0605('0x17')][_0x0605('0x18')]({'raw':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1a')]||null:null,'attributes':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'limit':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1c')]||null:null,'include':_0x2b7b5a['options']?_0x2b7b5a[_0x0605('0x19')]['include']?_[_0x0605('0x1d')](_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1e')],function(_0xf182c4){return{'model':db[_0xf182c4[_0x0605('0x1f')]],'as':_0xf182c4['as'],'attributes':_0xf182c4[_0x0605('0x1b')],'include':_0xf182c4[_0x0605('0x1e')]?_[_0x0605('0x1d')](_0xf182c4[_0x0605('0x1e')],function(_0x2896d7){return{'model':db[_0x2896d7[_0x0605('0x1f')]],'as':_0x2896d7['as'],'attributes':_0x2896d7[_0x0605('0x1b')],'include':_0x2896d7['include']?_[_0x0605('0x1d')](_0x2896d7[_0x0605('0x1e')],function(_0x4b1e0c){return{'model':db[_0x4b1e0c['model']],'as':_0x4b1e0c['as'],'attributes':_0x4b1e0c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x226825){logger[_0x0605('0x14')](_0x0605('0x16'),_0x2b7b5a);logger[_0x0605('0xe')](_0x0605('0x16'),_0x2b7b5a,JSON['stringify'](_0x226825));_0x193520(_0x226825);})[_0x0605('0x15')](function(_0x5daef6){logger[_0x0605('0x11')](_0x0605('0x16'),_0x5daef6[_0x0605('0x13')],_0x2b7b5a);_0x40abb2(_0x1d57ba[_0x0605('0x11')](0x1f4,_0x5daef6[_0x0605('0x13')]));});});};exports[_0x0605('0x20')]=function(_0x56dd1a){var _0x165a0c=this;return new Promise(function(_0xf885cc,_0x2764b6){return db[_0x0605('0x17')][_0x0605('0x21')]({'raw':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x22')]===undefined?!![]:![]:!![],'where':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1a')]||null:null,'attributes':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'include':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1e')]?_[_0x0605('0x1d')](_0x56dd1a[_0x0605('0x19')][_0x0605('0x1e')],function(_0x3a1c75){return{'model':db[_0x3a1c75[_0x0605('0x1f')]],'as':_0x3a1c75['as'],'attributes':_0x3a1c75[_0x0605('0x1b')],'include':_0x3a1c75[_0x0605('0x1e')]?_[_0x0605('0x1d')](_0x3a1c75[_0x0605('0x1e')],function(_0xe7701d){return{'model':db[_0xe7701d['model']],'as':_0xe7701d['as'],'attributes':_0xe7701d[_0x0605('0x1b')],'include':_0xe7701d[_0x0605('0x1e')]?_['map'](_0xe7701d[_0x0605('0x1e')],function(_0x128428){return{'model':db[_0x128428['model']],'as':_0x128428['as'],'attributes':_0x128428[_0x0605('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x239e8f){logger[_0x0605('0x14')](_0x0605('0x20'),_0x56dd1a);logger[_0x0605('0xe')]('ShowFreshsalesAccount',_0x56dd1a,JSON['stringify'](_0x239e8f));_0xf885cc(_0x239e8f);})[_0x0605('0x15')](function(_0x18f7f2){logger[_0x0605('0x11')]('ShowFreshsalesAccount',_0x18f7f2[_0x0605('0x13')],_0x56dd1a);_0x2764b6(_0x165a0c['error'](0x1f4,_0x18f7f2[_0x0605('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2535a94..42c94b2 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 _0x3256=['../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x22d53d,_0x339808){var _0x40dd91=function(_0x1ea0a6){while(--_0x1ea0a6){_0x22d53d['push'](_0x22d53d['shift']());}};_0x40dd91(++_0x339808);}(_0x3256,0x1c8));var _0x6325=function(_0xc3b84d,_0x505f8f){_0xc3b84d=_0xc3b84d-0x0;var _0x3c9805=_0x3256[_0xc3b84d];return _0x3c9805;};'use strict';var multer=require(_0x6325('0x0'));var util=require(_0x6325('0x1'));var path=require(_0x6325('0x2'));var timeout=require(_0x6325('0x3'));var express=require('express');var router=express[_0x6325('0x4')]();var fs_extra=require(_0x6325('0x5'));var auth=require(_0x6325('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6325('0x7'));var controller=require(_0x6325('0x8'));router[_0x6325('0x9')]('/',auth[_0x6325('0xa')](),controller['index']);router[_0x6325('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6325('0xb')]);router['get'](_0x6325('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x6325('0x9')]('/:id/descriptions',auth[_0x6325('0xa')](),controller[_0x6325('0xd')]);router[_0x6325('0x9')](_0x6325('0xe'),auth[_0x6325('0xa')](),controller[_0x6325('0xf')]);router[_0x6325('0x10')]('/',auth[_0x6325('0xa')](),controller['create']);router[_0x6325('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6325('0x12')]);router['delete'](_0x6325('0x13'),auth[_0x6325('0xa')](),controller[_0x6325('0x14')]);module[_0x6325('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index da352c8..1a683c2 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 _0xe3b3=['STRING'];(function(_0x44313a,_0x45638d){var _0x244a43=function(_0x1236e4){while(--_0x1236e4){_0x44313a['push'](_0x44313a['shift']());}};_0x244a43(++_0x45638d);}(_0xe3b3,0x72));var _0x3e3b=function(_0x50d8b2,_0x13011a){_0x50d8b2=_0x50d8b2-0x0;var _0x3cffa8=_0xe3b3[_0x50d8b2];return _0x3cffa8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3e3b('0x0')]},'description':{'type':Sequelize[_0x3e3b('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 12919c0..f68c78a 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 _0x1a76=['to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','filter','includeAll','include','findAll','params','fields','options','find','catch','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a76,0x1c8));var _0x61a7=function(_0xe3bb46,_0x4ba544){_0xe3bb46=_0xe3bb46-0x0;var _0x45001c=_0x1a76[_0xe3bb46];return _0x45001c;};'use strict';var emlformat=require(_0x61a7('0x0'));var rimraf=require(_0x61a7('0x1'));var zipdir=require(_0x61a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61a7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x61a7('0x4'));var util=require(_0x61a7('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x61a7('0x6'));var ejs=require(_0x61a7('0x7'));var fs=require('fs');var fs_extra=require(_0x61a7('0x8'));var _=require('lodash');var squel=require(_0x61a7('0x9'));var crypto=require(_0x61a7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x61a7('0x6'));var querystring=require('querystring');var Papa=require(_0x61a7('0xb'));var Redis=require(_0x61a7('0xc'));var authService=require(_0x61a7('0xd'));var qs=require(_0x61a7('0xe'));var as=require(_0x61a7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61a7('0x10'))(_0x61a7('0x11'));var utils=require(_0x61a7('0x12'));var config=require(_0x61a7('0x13'));var licenseUtil=require(_0x61a7('0x14'));var db=require(_0x61a7('0x15'))['db'];function respondWithStatusCode(_0x15aaa2,_0x392324){_0x392324=_0x392324||0xcc;return function(_0x31f803){if(_0x31f803){return _0x15aaa2[_0x61a7('0x16')](_0x392324);}return _0x15aaa2[_0x61a7('0x17')](_0x392324)[_0x61a7('0x18')]();};}function respondWithResult(_0x1d174f,_0x1a4be3){_0x1a4be3=_0x1a4be3||0xc8;return function(_0x5f008e){if(_0x5f008e){return _0x1d174f[_0x61a7('0x17')](_0x1a4be3)[_0x61a7('0x19')](_0x5f008e);}};}function respondWithFilteredResult(_0x129b8c,_0xb09c1f){return function(_0x65acca){if(_0x65acca){var _0x5500c0=typeof _0xb09c1f[_0x61a7('0x1a')]===_0x61a7('0x1b')&&typeof _0xb09c1f['limit']==='undefined';var _0x809f3b=_0x65acca[_0x61a7('0x1c')];var _0x3f7549=_0x5500c0?0x0:_0xb09c1f['offset'];var _0x24f339=_0x5500c0?_0x65acca[_0x61a7('0x1c')]:_0xb09c1f[_0x61a7('0x1a')]+_0xb09c1f[_0x61a7('0x1d')];var _0x5ac12a;if(_0x24f339>=_0x809f3b){_0x24f339=_0x809f3b;_0x5ac12a=0xc8;}else{_0x5ac12a=0xce;}_0x129b8c['status'](_0x5ac12a);return _0x129b8c[_0x61a7('0x1e')]('Content-Range',_0x3f7549+'-'+_0x24f339+'/'+_0x809f3b)[_0x61a7('0x19')](_0x65acca);}return null;};}function patchUpdates(_0x433405){return function(_0x4c9723){try{jsonpatch[_0x61a7('0x1f')](_0x4c9723,_0x433405,!![]);}catch(_0x43afb0){return BPromise[_0x61a7('0x20')](_0x43afb0);}return _0x4c9723[_0x61a7('0x21')]();};}function saveUpdates(_0x342b87,_0x11e916){return function(_0x4c595b){if(_0x4c595b){return _0x4c595b[_0x61a7('0x22')](_0x342b87)[_0x61a7('0x23')](function(_0x20e82d){return _0x20e82d;});}return null;};}function removeEntity(_0x41d710,_0x1174c0){return function(_0xe23e7f){if(_0xe23e7f){return _0xe23e7f['destroy']()[_0x61a7('0x23')](function(){_0x41d710[_0x61a7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1304b1,_0x59b60a){return function(_0x2dda08){if(!_0x2dda08){_0x1304b1[_0x61a7('0x16')](0x194);}return _0x2dda08;};}function handleError(_0x2d9a6f,_0x2d31f0){_0x2d31f0=_0x2d31f0||0x1f4;return function(_0x117f61){logger[_0x61a7('0x24')](_0x117f61[_0x61a7('0x25')]);if(_0x117f61[_0x61a7('0x26')]){delete _0x117f61[_0x61a7('0x26')];}_0x2d9a6f['status'](_0x2d31f0)[_0x61a7('0x27')](_0x117f61);};}exports[_0x61a7('0x28')]=function(_0x5f2f4f,_0x213cff){var _0x31ac52={},_0x85e32b={},_0x239db1={'count':0x0,'rows':[]};var _0x120787=_[_0x61a7('0x29')](db[_0x61a7('0x2a')][_0x61a7('0x2b')],function(_0x2e30d6){return{'name':_0x2e30d6[_0x61a7('0x2c')],'type':_0x2e30d6[_0x61a7('0x2d')][_0x61a7('0x2e')]};});_0x85e32b[_0x61a7('0x2f')]=_['map'](_0x120787,_0x61a7('0x26'));_0x85e32b[_0x61a7('0x30')]=_[_0x61a7('0x31')](_0x5f2f4f[_0x61a7('0x30')]);_0x85e32b['filters']=_[_0x61a7('0x32')](_0x85e32b[_0x61a7('0x2f')],_0x85e32b[_0x61a7('0x30')]);_0x31ac52[_0x61a7('0x33')]=_[_0x61a7('0x32')](_0x85e32b[_0x61a7('0x2f')],qs['fields'](_0x5f2f4f[_0x61a7('0x30')]['fields']));_0x31ac52[_0x61a7('0x33')]=_0x31ac52[_0x61a7('0x33')][_0x61a7('0x34')]?_0x31ac52[_0x61a7('0x33')]:_0x85e32b['model'];if(!_0x5f2f4f['query'][_0x61a7('0x35')](_0x61a7('0x36'))){_0x31ac52[_0x61a7('0x1d')]=qs[_0x61a7('0x1d')](_0x5f2f4f[_0x61a7('0x30')]['limit']);_0x31ac52[_0x61a7('0x1a')]=qs[_0x61a7('0x1a')](_0x5f2f4f[_0x61a7('0x30')]['offset']);}_0x31ac52[_0x61a7('0x37')]=qs[_0x61a7('0x38')](_0x5f2f4f[_0x61a7('0x30')][_0x61a7('0x38')]);_0x31ac52['where']=qs[_0x61a7('0x39')](_[_0x61a7('0x3a')](_0x5f2f4f[_0x61a7('0x30')],_0x85e32b[_0x61a7('0x39')]),_0x120787);if(_0x5f2f4f[_0x61a7('0x30')]['filter']){_0x31ac52['where']=_[_0x61a7('0x3b')](_0x31ac52[_0x61a7('0x3c')],{'$or':_[_0x61a7('0x29')](_0x120787,function(_0x2581f0){if(_0x2581f0['type']!=='VIRTUAL'){var _0x115e84={};_0x115e84[_0x2581f0['name']]={'$like':'%'+_0x5f2f4f[_0x61a7('0x30')][_0x61a7('0x3d')]+'%'};return _0x115e84;}})});}_0x31ac52=_[_0x61a7('0x3b')]({},_0x31ac52,_0x5f2f4f['options']);var _0x25f034={'where':_0x31ac52[_0x61a7('0x3c')]};return db[_0x61a7('0x2a')][_0x61a7('0x1c')](_0x25f034)['then'](function(_0x111c07){_0x239db1[_0x61a7('0x1c')]=_0x111c07;if(_0x5f2f4f[_0x61a7('0x30')][_0x61a7('0x3e')]){_0x31ac52[_0x61a7('0x3f')]=[{'all':!![]}];}return db[_0x61a7('0x2a')][_0x61a7('0x40')](_0x31ac52);})[_0x61a7('0x23')](function(_0x2fd515){_0x239db1['rows']=_0x2fd515;return _0x239db1;})[_0x61a7('0x23')](respondWithFilteredResult(_0x213cff,_0x31ac52))['catch'](handleError(_0x213cff,null));};exports['show']=function(_0x4bbe70,_0x20dc8d){var _0xd0908b={'raw':![],'where':{'id':_0x4bbe70[_0x61a7('0x41')]['id']}},_0x2f2b70={};_0x2f2b70['model']=_[_0x61a7('0x31')](db[_0x61a7('0x2a')][_0x61a7('0x2b')]);_0x2f2b70[_0x61a7('0x30')]=_[_0x61a7('0x31')](_0x4bbe70[_0x61a7('0x30')]);_0x2f2b70[_0x61a7('0x39')]=_['intersection'](_0x2f2b70[_0x61a7('0x2f')],_0x2f2b70['query']);_0xd0908b['attributes']=_['intersection'](_0x2f2b70['model'],qs[_0x61a7('0x42')](_0x4bbe70[_0x61a7('0x30')]['fields']));_0xd0908b['attributes']=_0xd0908b[_0x61a7('0x33')]['length']?_0xd0908b[_0x61a7('0x33')]:_0x2f2b70[_0x61a7('0x2f')];if(_0x4bbe70[_0x61a7('0x30')][_0x61a7('0x3e')]){_0xd0908b['include']=[{'all':!![]}];}_0xd0908b=_['merge']({},_0xd0908b,_0x4bbe70[_0x61a7('0x43')]);return db[_0x61a7('0x2a')][_0x61a7('0x44')](_0xd0908b)['then'](handleEntityNotFound(_0x20dc8d,null))[_0x61a7('0x23')](respondWithResult(_0x20dc8d,null))[_0x61a7('0x45')](handleError(_0x20dc8d,null));};exports[_0x61a7('0x46')]=function(_0x5e3206,_0x4c5eba){return db['FreshsalesConfiguration']['create'](_0x5e3206[_0x61a7('0x47')],{})[_0x61a7('0x23')](respondWithResult(_0x4c5eba,0xc9))[_0x61a7('0x45')](handleError(_0x4c5eba,null));};exports[_0x61a7('0x22')]=function(_0x10d4b2,_0x35c70b){if(_0x10d4b2[_0x61a7('0x47')]['id']){delete _0x10d4b2[_0x61a7('0x47')]['id'];}return db[_0x61a7('0x2a')][_0x61a7('0x44')]({'where':{'id':_0x10d4b2[_0x61a7('0x41')]['id']}})[_0x61a7('0x23')](handleEntityNotFound(_0x35c70b,null))[_0x61a7('0x23')](saveUpdates(_0x10d4b2[_0x61a7('0x47')],null))[_0x61a7('0x23')](respondWithResult(_0x35c70b,null))[_0x61a7('0x45')](handleError(_0x35c70b,null));};exports['destroy']=function(_0x39bb30,_0x127a27){return db[_0x61a7('0x2a')][_0x61a7('0x44')]({'where':{'id':_0x39bb30['params']['id']}})[_0x61a7('0x23')](handleEntityNotFound(_0x127a27,null))[_0x61a7('0x23')](removeEntity(_0x127a27,null))['catch'](handleError(_0x127a27,null));};exports[_0x61a7('0x48')]=function(_0x1773e9,_0x201296,_0x1d872a){var _0x455fa0={};var _0x4a23f9={};var _0xee3ce2;var _0x4a6f3e;return db[_0x61a7('0x2a')][_0x61a7('0x49')]({'where':{'id':_0x1773e9[_0x61a7('0x41')]['id']}})[_0x61a7('0x23')](handleEntityNotFound(_0x201296,null))[_0x61a7('0x23')](function(_0x42aff4){if(_0x42aff4){_0xee3ce2=_0x42aff4;_0x4a23f9[_0x61a7('0x2f')]=_[_0x61a7('0x31')](db[_0x61a7('0x4a')][_0x61a7('0x2b')]);_0x4a23f9['query']=_[_0x61a7('0x31')](_0x1773e9['query']);_0x4a23f9[_0x61a7('0x39')]=_[_0x61a7('0x32')](_0x4a23f9[_0x61a7('0x2f')],_0x4a23f9[_0x61a7('0x30')]);_0x455fa0['attributes']=_['intersection'](_0x4a23f9[_0x61a7('0x2f')],qs[_0x61a7('0x42')](_0x1773e9['query'][_0x61a7('0x42')]));_0x455fa0[_0x61a7('0x33')]=_0x455fa0['attributes'][_0x61a7('0x34')]?_0x455fa0[_0x61a7('0x33')]:_0x4a23f9[_0x61a7('0x2f')];_0x455fa0[_0x61a7('0x37')]=qs[_0x61a7('0x38')](_0x1773e9[_0x61a7('0x30')]['sort']);_0x455fa0['where']=qs['filters'](_['pick'](_0x1773e9[_0x61a7('0x30')],_0x4a23f9[_0x61a7('0x39')]));if(_0x1773e9[_0x61a7('0x30')][_0x61a7('0x3d')]){_0x455fa0[_0x61a7('0x3c')]=_[_0x61a7('0x3b')](_0x455fa0[_0x61a7('0x3c')],{'$or':_[_0x61a7('0x29')](_0x455fa0[_0x61a7('0x33')],function(_0x45067d){var _0x35523b={};_0x35523b[_0x45067d]={'$like':'%'+_0x1773e9['query'][_0x61a7('0x3d')]+'%'};return _0x35523b;})});}_0x455fa0=_[_0x61a7('0x3b')]({},_0x455fa0,_0x1773e9[_0x61a7('0x43')]);return _0xee3ce2[_0x61a7('0x48')](_0x455fa0);}})[_0x61a7('0x23')](function(_0x29a713){if(_0x29a713){_0x4a6f3e=_0x29a713['length'];if(!_0x1773e9[_0x61a7('0x30')][_0x61a7('0x35')](_0x61a7('0x36'))){_0x455fa0[_0x61a7('0x1d')]=qs[_0x61a7('0x1d')](_0x1773e9['query'][_0x61a7('0x1d')]);_0x455fa0[_0x61a7('0x1a')]=qs[_0x61a7('0x1a')](_0x1773e9['query'][_0x61a7('0x1a')]);}return _0xee3ce2[_0x61a7('0x48')](_0x455fa0);}})[_0x61a7('0x23')](function(_0xb51394){if(_0xb51394){return _0xb51394?{'count':_0x4a6f3e,'rows':_0xb51394}:null;}})[_0x61a7('0x23')](respondWithResult(_0x201296,null))[_0x61a7('0x45')](handleError(_0x201296,null));};exports[_0x61a7('0x4b')]=function(_0x3ea291,_0x286116,_0x4f520c){var _0x29788e={};var _0xccf2b1={};var _0x54a94b;var _0x311e8e;return db[_0x61a7('0x2a')][_0x61a7('0x49')]({'where':{'id':_0x3ea291['params']['id']}})['then'](handleEntityNotFound(_0x286116,null))[_0x61a7('0x23')](function(_0x1321d3){if(_0x1321d3){_0x54a94b=_0x1321d3;_0xccf2b1[_0x61a7('0x2f')]=_['keys'](db[_0x61a7('0x4a')]['rawAttributes']);_0xccf2b1[_0x61a7('0x30')]=_['keys'](_0x3ea291[_0x61a7('0x30')]);_0xccf2b1[_0x61a7('0x39')]=_['intersection'](_0xccf2b1[_0x61a7('0x2f')],_0xccf2b1[_0x61a7('0x30')]);_0x29788e[_0x61a7('0x33')]=_[_0x61a7('0x32')](_0xccf2b1[_0x61a7('0x2f')],qs['fields'](_0x3ea291['query'][_0x61a7('0x42')]));_0x29788e[_0x61a7('0x33')]=_0x29788e[_0x61a7('0x33')][_0x61a7('0x34')]?_0x29788e[_0x61a7('0x33')]:_0xccf2b1[_0x61a7('0x2f')];_0x29788e[_0x61a7('0x37')]=qs['sort'](_0x3ea291[_0x61a7('0x30')][_0x61a7('0x38')]);_0x29788e[_0x61a7('0x3c')]=qs[_0x61a7('0x39')](_[_0x61a7('0x3a')](_0x3ea291['query'],_0xccf2b1[_0x61a7('0x39')]));if(_0x3ea291[_0x61a7('0x30')]['filter']){_0x29788e[_0x61a7('0x3c')]=_[_0x61a7('0x3b')](_0x29788e['where'],{'$or':_[_0x61a7('0x29')](_0x29788e['attributes'],function(_0x497626){var _0x46b7e3={};_0x46b7e3[_0x497626]={'$like':'%'+_0x3ea291[_0x61a7('0x30')][_0x61a7('0x3d')]+'%'};return _0x46b7e3;})});}_0x29788e=_['merge']({},_0x29788e,_0x3ea291[_0x61a7('0x43')]);return _0x54a94b[_0x61a7('0x4b')](_0x29788e);}})['then'](function(_0x4c1ab8){if(_0x4c1ab8){_0x311e8e=_0x4c1ab8['length'];if(!_0x3ea291[_0x61a7('0x30')][_0x61a7('0x35')](_0x61a7('0x36'))){_0x29788e['limit']=qs[_0x61a7('0x1d')](_0x3ea291['query'][_0x61a7('0x1d')]);_0x29788e[_0x61a7('0x1a')]=qs[_0x61a7('0x1a')](_0x3ea291[_0x61a7('0x30')][_0x61a7('0x1a')]);}return _0x54a94b[_0x61a7('0x4b')](_0x29788e);}})['then'](function(_0x1d70d2){if(_0x1d70d2){return _0x1d70d2?{'count':_0x311e8e,'rows':_0x1d70d2}:null;}})[_0x61a7('0x23')](respondWithResult(_0x286116,null))['catch'](handleError(_0x286116,null));};exports[_0x61a7('0x4c')]=function(_0x505c06,_0x5d5579,_0x14ae45){var _0x54db8b={};var _0x225fd3={};var _0x163bb8;var _0x3aae1d;return db[_0x61a7('0x2a')][_0x61a7('0x49')]({'where':{'id':_0x505c06[_0x61a7('0x41')]['id']}})[_0x61a7('0x23')](handleEntityNotFound(_0x5d5579,null))['then'](function(_0x242f1c){if(_0x242f1c){_0x163bb8=_0x242f1c;_0x225fd3[_0x61a7('0x2f')]=_['keys'](db[_0x61a7('0x4a')]['rawAttributes']);_0x225fd3['query']=_[_0x61a7('0x31')](_0x505c06['query']);_0x225fd3[_0x61a7('0x39')]=_['intersection'](_0x225fd3[_0x61a7('0x2f')],_0x225fd3['query']);_0x54db8b[_0x61a7('0x33')]=_['intersection'](_0x225fd3['model'],qs['fields'](_0x505c06['query']['fields']));_0x54db8b['attributes']=_0x54db8b[_0x61a7('0x33')][_0x61a7('0x34')]?_0x54db8b[_0x61a7('0x33')]:_0x225fd3[_0x61a7('0x2f')];_0x54db8b[_0x61a7('0x37')]=qs[_0x61a7('0x38')](_0x505c06[_0x61a7('0x30')][_0x61a7('0x38')]);_0x54db8b['where']=qs['filters'](_[_0x61a7('0x3a')](_0x505c06['query'],_0x225fd3['filters']));if(_0x505c06[_0x61a7('0x30')]['filter']){_0x54db8b[_0x61a7('0x3c')]=_['merge'](_0x54db8b[_0x61a7('0x3c')],{'$or':_[_0x61a7('0x29')](_0x54db8b[_0x61a7('0x33')],function(_0x7a8a08){var _0x42ee52={};_0x42ee52[_0x7a8a08]={'$like':'%'+_0x505c06[_0x61a7('0x30')][_0x61a7('0x3d')]+'%'};return _0x42ee52;})});}_0x54db8b=_[_0x61a7('0x3b')]({},_0x54db8b,_0x505c06[_0x61a7('0x43')]);return _0x163bb8[_0x61a7('0x4c')](_0x54db8b);}})[_0x61a7('0x23')](function(_0x24fd70){if(_0x24fd70){_0x3aae1d=_0x24fd70[_0x61a7('0x34')];if(!_0x505c06['query'][_0x61a7('0x35')]('nolimit')){_0x54db8b['limit']=qs[_0x61a7('0x1d')](_0x505c06[_0x61a7('0x30')][_0x61a7('0x1d')]);_0x54db8b['offset']=qs[_0x61a7('0x1a')](_0x505c06[_0x61a7('0x30')][_0x61a7('0x1a')]);}return _0x163bb8[_0x61a7('0x4c')](_0x54db8b);}})['then'](function(_0x37bff4){if(_0x37bff4){return _0x37bff4?{'count':_0x3aae1d,'rows':_0x37bff4}:null;}})[_0x61a7('0x23')](respondWithResult(_0x5d5579,null))[_0x61a7('0x45')](handleError(_0x5d5579,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1611e3d..f9ed844 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 _0x1ef9=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5b903f,_0xc6d088){var _0x301f03=function(_0x5e12a8){while(--_0x5e12a8){_0x5b903f['push'](_0x5b903f['shift']());}};_0x301f03(++_0xc6d088);}(_0x1ef9,0x1d7));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91ef('0x0'));var util=require(_0x91ef('0x1'));var logger=require(_0x91ef('0x2'))('api');var moment=require(_0x91ef('0x3'));var BPromise=require(_0x91ef('0x4'));var rp=require(_0x91ef('0x5'));var fs=require('fs');var path=require(_0x91ef('0x6'));var rimraf=require(_0x91ef('0x7'));var config=require(_0x91ef('0x8'));var attributes=require(_0x91ef('0x9'));module[_0x91ef('0xa')]=function(_0x5a4717,_0xf0cc0b){return _0x5a4717[_0x91ef('0xb')](_0x91ef('0xc'),attributes,{'tableName':_0x91ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index c817c84..9a76875 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 _0xd21d=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x51b211,_0x31ff1e){var _0x33e795=function(_0x2b71c9){while(--_0x2b71c9){_0x51b211['push'](_0x51b211['shift']());}};_0x33e795(++_0x31ff1e);}(_0xd21d,0x136));var _0xdd21=function(_0x131712,_0x2ed068){_0x131712=_0x131712-0x0;var _0x292b97=_0xd21d[_0x131712];return _0x292b97;};'use strict';var _=require(_0xdd21('0x0'));var util=require(_0xdd21('0x1'));var moment=require(_0xdd21('0x2'));var BPromise=require(_0xdd21('0x3'));var rs=require(_0xdd21('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd21('0x5'))['db'];var utils=require(_0xdd21('0x6'));var logger=require('../../config/logger')(_0xdd21('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd21('0x8'));var client=jayson[_0xdd21('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x565b7a,_0x8946b,_0x469a91){return new BPromise(function(_0x59fa85,_0x5551bb){return client[_0xdd21('0xa')](_0x565b7a,_0x469a91)[_0xdd21('0xb')](function(_0x2308d2){logger[_0xdd21('0xc')](_0xdd21('0xd'),_0x8946b,'request\x20sent');logger[_0xdd21('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x8946b,_0xdd21('0xf'),JSON[_0xdd21('0x10')](_0x2308d2));if(_0x2308d2[_0xdd21('0x11')]){if(_0x2308d2[_0xdd21('0x11')][_0xdd21('0x12')]===0x1f4){logger['error'](_0xdd21('0xd'),_0x8946b,_0x2308d2[_0xdd21('0x11')][_0xdd21('0x13')]);return _0x5551bb(_0x2308d2[_0xdd21('0x11')][_0xdd21('0x13')]);}logger['error'](_0xdd21('0xd'),_0x8946b,_0x2308d2[_0xdd21('0x11')][_0xdd21('0x13')]);return _0x59fa85(_0x2308d2['error'][_0xdd21('0x13')]);}else{logger[_0xdd21('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x8946b,_0xdd21('0xf'));_0x59fa85(_0x2308d2[_0xdd21('0x14')][_0xdd21('0x13')]);}})[_0xdd21('0x15')](function(_0x544f16){logger['error'](_0xdd21('0xd'),_0x8946b,_0x544f16);_0x5551bb(_0x544f16);});});} \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 5674e80..dbec97c 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 _0xc17f=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x544c7c,_0x10ca34){var _0x266350=function(_0x410d4a){while(--_0x410d4a){_0x544c7c['push'](_0x544c7c['shift']());}};_0x266350(++_0x10ca34);}(_0xc17f,0xb8));var _0xfc17=function(_0x403f02,_0x13e3e6){_0x403f02=_0x403f02-0x0;var _0x2dc64f=_0xc17f[_0x403f02];return _0x2dc64f;};'use strict';var multer=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var path=require(_0xfc17('0x2'));var timeout=require(_0xfc17('0x3'));var express=require(_0xfc17('0x4'));var router=express[_0xfc17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc17('0x6'));var interaction=require(_0xfc17('0x7'));var config=require(_0xfc17('0x8'));var controller=require(_0xfc17('0x9'));router['get']('/',auth[_0xfc17('0xa')](),controller[_0xfc17('0xb')]);router[_0xfc17('0xc')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0xe')]);router[_0xfc17('0xf')]('/',auth[_0xfc17('0xa')](),controller['create']);router[_0xfc17('0x10')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x11')]);router['delete']('/:id',auth[_0xfc17('0xa')](),controller[_0xfc17('0x12')]);module[_0xfc17('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0e67b08..25de499 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 _0x333d=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x333d,0xe3));var _0xd333=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0x333d[_0x22d1ef];return _0x47c5a3;};'use strict';var Sequelize=require('sequelize');module[_0xd333('0x0')]={'type':{'type':Sequelize[_0xd333('0x1')](_0xd333('0x2'),_0xd333('0x3'),_0xd333('0x4'),_0xd333('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd333('0x6')]},'key':{'type':Sequelize[_0xd333('0x6')]},'keyType':{'type':Sequelize[_0xd333('0x1')](_0xd333('0x2'),_0xd333('0x3'),_0xd333('0x4'))},'keyContent':{'type':Sequelize[_0xd333('0x6')]},'idField':{'type':Sequelize[_0xd333('0x6')]},'nameField':{'type':Sequelize[_0xd333('0x6')]},'customField':{'type':Sequelize[_0xd333('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd333('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 1faacf7..36d7f9c 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 _0x27ec=['fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','findAll','rows','catch','show','fields','includeAll','include','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','FreshsalesField','rawAttributes'];(function(_0x56becd,_0x152b74){var _0x3be6c7=function(_0x447d2d){while(--_0x447d2d){_0x56becd['push'](_0x56becd['shift']());}};_0x3be6c7(++_0x152b74);}(_0x27ec,0x151));var _0xc27e=function(_0x2e29b5,_0x3c124d){_0x2e29b5=_0x2e29b5-0x0;var _0xd008cb=_0x27ec[_0x2e29b5];return _0xd008cb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc27e('0x0'));var jsonpatch=require(_0xc27e('0x1'));var rp=require(_0xc27e('0x2'));var moment=require(_0xc27e('0x3'));var BPromise=require(_0xc27e('0x4'));var Mustache=require('mustache');var util=require(_0xc27e('0x5'));var path=require(_0xc27e('0x6'));var sox=require(_0xc27e('0x7'));var csv=require(_0xc27e('0x8'));var ejs=require(_0xc27e('0x9'));var fs=require('fs');var fs_extra=require(_0xc27e('0xa'));var _=require(_0xc27e('0xb'));var squel=require(_0xc27e('0xc'));var crypto=require(_0xc27e('0xd'));var jsforce=require(_0xc27e('0xe'));var deskjs=require(_0xc27e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc27e('0x10'));var Redis=require(_0xc27e('0x11'));var authService=require(_0xc27e('0x12'));var qs=require(_0xc27e('0x13'));var as=require(_0xc27e('0x14'));var hardwareService=require(_0xc27e('0x15'));var logger=require(_0xc27e('0x16'))(_0xc27e('0x17'));var utils=require(_0xc27e('0x18'));var config=require(_0xc27e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc27e('0x1a'))['db'];function respondWithStatusCode(_0x5cf1fd,_0x380076){_0x380076=_0x380076||0xcc;return function(_0x3463a8){if(_0x3463a8){return _0x5cf1fd[_0xc27e('0x1b')](_0x380076);}return _0x5cf1fd[_0xc27e('0x1c')](_0x380076)[_0xc27e('0x1d')]();};}function respondWithResult(_0x5e2146,_0x238b98){_0x238b98=_0x238b98||0xc8;return function(_0x16e11b){if(_0x16e11b){return _0x5e2146[_0xc27e('0x1c')](_0x238b98)[_0xc27e('0x1e')](_0x16e11b);}};}function respondWithFilteredResult(_0x25ecc2,_0x122788){return function(_0x1a15eb){if(_0x1a15eb){var _0x4b74ba=typeof _0x122788[_0xc27e('0x1f')]===_0xc27e('0x20')&&typeof _0x122788[_0xc27e('0x21')]==='undefined';var _0x3e90de=_0x1a15eb[_0xc27e('0x22')];var _0x14b06a=_0x4b74ba?0x0:_0x122788[_0xc27e('0x1f')];var _0x4a968c=_0x4b74ba?_0x1a15eb['count']:_0x122788[_0xc27e('0x1f')]+_0x122788[_0xc27e('0x21')];var _0x5cb4b8;if(_0x4a968c>=_0x3e90de){_0x4a968c=_0x3e90de;_0x5cb4b8=0xc8;}else{_0x5cb4b8=0xce;}_0x25ecc2[_0xc27e('0x1c')](_0x5cb4b8);return _0x25ecc2[_0xc27e('0x23')](_0xc27e('0x24'),_0x14b06a+'-'+_0x4a968c+'/'+_0x3e90de)[_0xc27e('0x1e')](_0x1a15eb);}return null;};}function patchUpdates(_0x24be06){return function(_0x6e70d2){try{jsonpatch['apply'](_0x6e70d2,_0x24be06,!![]);}catch(_0xc9854c){return BPromise[_0xc27e('0x25')](_0xc9854c);}return _0x6e70d2[_0xc27e('0x26')]();};}function saveUpdates(_0x299c6f,_0x4a3e64){return function(_0x48cf9d){if(_0x48cf9d){return _0x48cf9d[_0xc27e('0x27')](_0x299c6f)[_0xc27e('0x28')](function(_0x19c19e){return _0x19c19e;});}return null;};}function removeEntity(_0x579d14,_0x40ed59){return function(_0xfa2341){if(_0xfa2341){return _0xfa2341[_0xc27e('0x29')]()['then'](function(){_0x579d14['status'](0xcc)[_0xc27e('0x1d')]();});}};}function handleEntityNotFound(_0x410fe8,_0x36e779){return function(_0x3ab06c){if(!_0x3ab06c){_0x410fe8[_0xc27e('0x1b')](0x194);}return _0x3ab06c;};}function handleError(_0xb686a9,_0x17175f){_0x17175f=_0x17175f||0x1f4;return function(_0x2d0a9f){logger[_0xc27e('0x2a')](_0x2d0a9f[_0xc27e('0x2b')]);if(_0x2d0a9f[_0xc27e('0x2c')]){delete _0x2d0a9f['name'];}_0xb686a9[_0xc27e('0x1c')](_0x17175f)['send'](_0x2d0a9f);};}exports[_0xc27e('0x2d')]=function(_0x3cb09d,_0x5506f7){var _0x461363={},_0x50c9ca={},_0x335bc2={'count':0x0,'rows':[]};var _0x56842f=_['map'](db[_0xc27e('0x2e')][_0xc27e('0x2f')],function(_0x385a22){return{'name':_0x385a22[_0xc27e('0x30')],'type':_0x385a22[_0xc27e('0x31')]['key']};});_0x50c9ca[_0xc27e('0x32')]=_['map'](_0x56842f,_0xc27e('0x2c'));_0x50c9ca[_0xc27e('0x33')]=_[_0xc27e('0x34')](_0x3cb09d['query']);_0x50c9ca[_0xc27e('0x35')]=_[_0xc27e('0x36')](_0x50c9ca[_0xc27e('0x32')],_0x50c9ca['query']);_0x461363[_0xc27e('0x37')]=_['intersection'](_0x50c9ca['model'],qs['fields'](_0x3cb09d[_0xc27e('0x33')]['fields']));_0x461363[_0xc27e('0x37')]=_0x461363[_0xc27e('0x37')][_0xc27e('0x38')]?_0x461363[_0xc27e('0x37')]:_0x50c9ca[_0xc27e('0x32')];if(!_0x3cb09d[_0xc27e('0x33')]['hasOwnProperty'](_0xc27e('0x39'))){_0x461363[_0xc27e('0x21')]=qs['limit'](_0x3cb09d[_0xc27e('0x33')][_0xc27e('0x21')]);_0x461363['offset']=qs[_0xc27e('0x1f')](_0x3cb09d[_0xc27e('0x33')][_0xc27e('0x1f')]);}_0x461363[_0xc27e('0x3a')]=qs[_0xc27e('0x3b')](_0x3cb09d[_0xc27e('0x33')][_0xc27e('0x3b')]);_0x461363[_0xc27e('0x3c')]=qs[_0xc27e('0x35')](_['pick'](_0x3cb09d[_0xc27e('0x33')],_0x50c9ca[_0xc27e('0x35')]),_0x56842f);if(_0x3cb09d['query']['filter']){_0x461363[_0xc27e('0x3c')]=_[_0xc27e('0x3d')](_0x461363[_0xc27e('0x3c')],{'$or':_[_0xc27e('0x3e')](_0x56842f,function(_0x5d5b02){if(_0x5d5b02[_0xc27e('0x31')]!==_0xc27e('0x3f')){var _0x2a9f6f={};_0x2a9f6f[_0x5d5b02[_0xc27e('0x2c')]]={'$like':'%'+_0x3cb09d['query'][_0xc27e('0x40')]+'%'};return _0x2a9f6f;}})});}_0x461363=_[_0xc27e('0x3d')]({},_0x461363,_0x3cb09d[_0xc27e('0x41')]);var _0x270577={'where':_0x461363[_0xc27e('0x3c')]};return db[_0xc27e('0x2e')][_0xc27e('0x22')](_0x270577)[_0xc27e('0x28')](function(_0x46ef06){_0x335bc2['count']=_0x46ef06;if(_0x3cb09d[_0xc27e('0x33')]['includeAll']){_0x461363['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xc27e('0x42')](_0x461363);})[_0xc27e('0x28')](function(_0x298c36){_0x335bc2[_0xc27e('0x43')]=_0x298c36;return _0x335bc2;})[_0xc27e('0x28')](respondWithFilteredResult(_0x5506f7,_0x461363))[_0xc27e('0x44')](handleError(_0x5506f7,null));};exports[_0xc27e('0x45')]=function(_0x4bcebb,_0x5e0084){var _0x71f224={'raw':!![],'where':{'id':_0x4bcebb['params']['id']}},_0x507574={};_0x507574['model']=_[_0xc27e('0x34')](db[_0xc27e('0x2e')][_0xc27e('0x2f')]);_0x507574[_0xc27e('0x33')]=_['keys'](_0x4bcebb[_0xc27e('0x33')]);_0x507574[_0xc27e('0x35')]=_['intersection'](_0x507574[_0xc27e('0x32')],_0x507574['query']);_0x71f224['attributes']=_['intersection'](_0x507574['model'],qs['fields'](_0x4bcebb['query'][_0xc27e('0x46')]));_0x71f224['attributes']=_0x71f224[_0xc27e('0x37')][_0xc27e('0x38')]?_0x71f224[_0xc27e('0x37')]:_0x507574[_0xc27e('0x32')];if(_0x4bcebb[_0xc27e('0x33')][_0xc27e('0x47')]){_0x71f224[_0xc27e('0x48')]=[{'all':!![]}];}_0x71f224=_[_0xc27e('0x3d')]({},_0x71f224,_0x4bcebb[_0xc27e('0x41')]);return db[_0xc27e('0x2e')][_0xc27e('0x49')](_0x71f224)['then'](handleEntityNotFound(_0x5e0084,null))[_0xc27e('0x28')](respondWithResult(_0x5e0084,null))[_0xc27e('0x44')](handleError(_0x5e0084,null));};exports[_0xc27e('0x4a')]=function(_0x59b3a9,_0x1e98eb){return db[_0xc27e('0x2e')][_0xc27e('0x4a')](_0x59b3a9['body'],{})['then'](respondWithResult(_0x1e98eb,0xc9))[_0xc27e('0x44')](handleError(_0x1e98eb,null));};exports[_0xc27e('0x27')]=function(_0x10485b,_0x118c2e){if(_0x10485b[_0xc27e('0x4b')]['id']){delete _0x10485b[_0xc27e('0x4b')]['id'];}return db[_0xc27e('0x2e')][_0xc27e('0x49')]({'where':{'id':_0x10485b[_0xc27e('0x4c')]['id']}})[_0xc27e('0x28')](handleEntityNotFound(_0x118c2e,null))[_0xc27e('0x28')](saveUpdates(_0x10485b[_0xc27e('0x4b')],null))['then'](respondWithResult(_0x118c2e,null))['catch'](handleError(_0x118c2e,null));};exports[_0xc27e('0x29')]=function(_0x289cf1,_0x5f5c85){return db['FreshsalesField']['find']({'where':{'id':_0x289cf1['params']['id']}})['then'](handleEntityNotFound(_0x5f5c85,null))[_0xc27e('0x28')](removeEntity(_0x5f5c85,null))[_0xc27e('0x44')](handleError(_0x5f5c85,null));}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2aa5d5d..e1de9ac 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 _0x5386=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5386,0x1e1));var _0x6538=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x5386[_0x284506];return _0x1e9ee5;};'use strict';var _=require(_0x6538('0x0'));var util=require(_0x6538('0x1'));var logger=require(_0x6538('0x2'))(_0x6538('0x3'));var moment=require('moment');var BPromise=require(_0x6538('0x4'));var rp=require(_0x6538('0x5'));var fs=require('fs');var path=require(_0x6538('0x6'));var rimraf=require(_0x6538('0x7'));var config=require(_0x6538('0x8'));var attributes=require(_0x6538('0x9'));module[_0x6538('0xa')]=function(_0x2433c9,_0x4ed3fa){return _0x2433c9[_0x6538('0xb')]('FreshsalesField',attributes,{'tableName':_0x6538('0xc'),'paranoid':![],'indexes':[{'name':_0x6538('0xd'),'fields':[_0x6538('0xe'),_0x6538('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 332dc32..bbd6d8a 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 _0xc6ac=['http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x109817,_0x39192a){var _0x8afb41=function(_0x1a4e41){while(--_0x1a4e41){_0x109817['push'](_0x109817['shift']());}};_0x8afb41(++_0x39192a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x20a17a,_0x134495){_0x20a17a=_0x20a17a-0x0;var _0x5bb07b=_0xc6ac[_0x20a17a];return _0x5bb07b;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7748219..8aa69b8 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5144c0,_0x3e225e){var _0x2471e8=function(_0x56ca85){while(--_0x56ca85){_0x5144c0['push'](_0x5144c0['shift']());}};_0x2471e8(++_0x3e225e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 11ae814..cce1918 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 _0x91ed=['integrationTab','STRING','username','ENUM'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x91ed,0x99));var _0xd91e=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x91ed[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd91e('0x0')]},'description':{'type':Sequelize[_0xd91e('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xd91e('0x1')},'remoteUri':{'type':Sequelize[_0xd91e('0x0')]},'password':{'type':Sequelize[_0xd91e('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xd91e('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xd91e('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xd91e('0x2')](_0xd91e('0x3'),'newTab'),'defaultValue':_0xd91e('0x3')}}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b11a890..b574266 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 _0x4259=['email','textarea','includes','label','custom','picklistValues','value','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','status','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','SalesforceAccount','includeAll','include','findAll','rows','catch','length','merge','options','find','create','body','destroy','params','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean'];(function(_0x26bf58,_0x4416dc){var _0x147906=function(_0x129612){while(--_0x129612){_0x26bf58['push'](_0x26bf58['shift']());}};_0x147906(++_0x4416dc);}(_0x4259,0x188));var _0x9425=function(_0x5511f7,_0x25a104){_0x5511f7=_0x5511f7-0x0;var _0xd453ff=_0x4259[_0x5511f7];return _0xd453ff;};'use strict';var emlformat=require(_0x9425('0x0'));var rimraf=require(_0x9425('0x1'));var zipdir=require(_0x9425('0x2'));var jsonpatch=require(_0x9425('0x3'));var rp=require(_0x9425('0x4'));var moment=require(_0x9425('0x5'));var BPromise=require(_0x9425('0x6'));var Mustache=require(_0x9425('0x7'));var util=require('util');var path=require(_0x9425('0x8'));var sox=require('sox');var csv=require(_0x9425('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9425('0xa'));var _=require(_0x9425('0xb'));var squel=require('squel');var crypto=require(_0x9425('0xc'));var jsforce=require(_0x9425('0xd'));var deskjs=require(_0x9425('0xe'));var toCsv=require(_0x9425('0x9'));var querystring=require(_0x9425('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9425('0x10'));var qs=require(_0x9425('0x11'));var as=require(_0x9425('0x12'));var hardwareService=require(_0x9425('0x13'));var logger=require(_0x9425('0x14'))(_0x9425('0x15'));var utils=require(_0x9425('0x16'));var config=require(_0x9425('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9425('0x18'))['db'];var integrations=require(_0x9425('0x19'));function respondWithStatusCode(_0x33e074,_0x4fdab8){_0x4fdab8=_0x4fdab8||0xcc;return function(_0x22f965){if(_0x22f965){return _0x33e074[_0x9425('0x1a')](_0x4fdab8);}return _0x33e074['status'](_0x4fdab8)['end']();};}function respondWithResult(_0x5c5425,_0x295d6f){_0x295d6f=_0x295d6f||0xc8;return function(_0x4fd511){if(_0x4fd511){return _0x5c5425['status'](_0x295d6f)['json'](_0x4fd511);}};}function respondWithFilteredResult(_0x597d95,_0x406db4){return function(_0x2f5c23){if(_0x2f5c23){var _0x48526b=typeof _0x406db4[_0x9425('0x1b')]==='undefined'&&typeof _0x406db4[_0x9425('0x1c')]===_0x9425('0x1d');var _0x4d91a5=_0x2f5c23['count'];var _0x3cc279=_0x48526b?0x0:_0x406db4[_0x9425('0x1b')];var _0x5d43c7=_0x48526b?_0x2f5c23[_0x9425('0x1e')]:_0x406db4['offset']+_0x406db4[_0x9425('0x1c')];var _0x5ef9e1;if(_0x5d43c7>=_0x4d91a5){_0x5d43c7=_0x4d91a5;_0x5ef9e1=0xc8;}else{_0x5ef9e1=0xce;}_0x597d95['status'](_0x5ef9e1);return _0x597d95['set'](_0x9425('0x1f'),_0x3cc279+'-'+_0x5d43c7+'/'+_0x4d91a5)[_0x9425('0x20')](_0x2f5c23);}return null;};}function patchUpdates(_0x39be0e){return function(_0x57ff4c){try{jsonpatch['apply'](_0x57ff4c,_0x39be0e,!![]);}catch(_0x47b2ec){return BPromise[_0x9425('0x21')](_0x47b2ec);}return _0x57ff4c[_0x9425('0x22')]();};}function saveUpdates(_0x52d9f6,_0x3e0578){return function(_0x448600){if(_0x448600){return _0x448600[_0x9425('0x23')](_0x52d9f6)[_0x9425('0x24')](function(_0x6ff6aa){return _0x6ff6aa;});}return null;};}function removeEntity(_0x4a957b,_0x3be583){return function(_0x465794){if(_0x465794){return _0x465794['destroy']()[_0x9425('0x24')](function(){_0x4a957b[_0x9425('0x25')](0xcc)[_0x9425('0x26')]();});}};}function handleEntityNotFound(_0x131613,_0x2a4d2c){return function(_0x192b52){if(!_0x192b52){_0x131613['sendStatus'](0x194);}return _0x192b52;};}function handleError(_0xdf6f7c,_0x5748c1){_0x5748c1=_0x5748c1||0x1f4;return function(_0x5077b4){logger[_0x9425('0x27')](_0x5077b4[_0x9425('0x28')]);if(_0x5077b4['name']){delete _0x5077b4[_0x9425('0x29')];}_0xdf6f7c['status'](_0x5748c1)[_0x9425('0x2a')](_0x5077b4);};}exports[_0x9425('0x2b')]=function(_0x3047d7,_0x5b82d1){var _0x2188b2={},_0x122830={},_0x3e48e5={'count':0x0,'rows':[]};var _0x20b19a=_[_0x9425('0x2c')](db['SalesforceAccount'][_0x9425('0x2d')],function(_0x33c084){return{'name':_0x33c084[_0x9425('0x2e')],'type':_0x33c084[_0x9425('0x2f')]['key']};});_0x122830['model']=_[_0x9425('0x2c')](_0x20b19a,_0x9425('0x29'));_0x122830[_0x9425('0x30')]=_[_0x9425('0x31')](_0x3047d7[_0x9425('0x30')]);_0x122830[_0x9425('0x32')]=_[_0x9425('0x33')](_0x122830[_0x9425('0x34')],_0x122830['query']);_0x2188b2[_0x9425('0x35')]=_['intersection'](_0x122830[_0x9425('0x34')],qs[_0x9425('0x36')](_0x3047d7[_0x9425('0x30')][_0x9425('0x36')]));_0x2188b2[_0x9425('0x35')]=_0x2188b2[_0x9425('0x35')]['length']?_0x2188b2[_0x9425('0x35')]:_0x122830[_0x9425('0x34')];if(!_0x3047d7[_0x9425('0x30')][_0x9425('0x37')](_0x9425('0x38'))){_0x2188b2[_0x9425('0x1c')]=qs[_0x9425('0x1c')](_0x3047d7[_0x9425('0x30')]['limit']);_0x2188b2[_0x9425('0x1b')]=qs[_0x9425('0x1b')](_0x3047d7[_0x9425('0x30')]['offset']);}_0x2188b2[_0x9425('0x39')]=qs[_0x9425('0x3a')](_0x3047d7[_0x9425('0x30')][_0x9425('0x3a')]);_0x2188b2[_0x9425('0x3b')]=qs['filters'](_[_0x9425('0x3c')](_0x3047d7[_0x9425('0x30')],_0x122830['filters']),_0x20b19a);if(_0x3047d7[_0x9425('0x30')][_0x9425('0x3d')]){_0x2188b2['where']=_['merge'](_0x2188b2[_0x9425('0x3b')],{'$or':_[_0x9425('0x2c')](_0x20b19a,function(_0x4ffd5b){if(_0x4ffd5b['type']!=='VIRTUAL'){var _0x5925f4={};_0x5925f4[_0x4ffd5b[_0x9425('0x29')]]={'$like':'%'+_0x3047d7[_0x9425('0x30')][_0x9425('0x3d')]+'%'};return _0x5925f4;}})});}_0x2188b2=_['merge']({},_0x2188b2,_0x3047d7['options']);var _0x40e874={'where':_0x2188b2[_0x9425('0x3b')]};return db[_0x9425('0x3e')][_0x9425('0x1e')](_0x40e874)[_0x9425('0x24')](function(_0x3d3c43){_0x3e48e5[_0x9425('0x1e')]=_0x3d3c43;if(_0x3047d7['query'][_0x9425('0x3f')]){_0x2188b2[_0x9425('0x40')]=[{'all':!![]}];}return db[_0x9425('0x3e')][_0x9425('0x41')](_0x2188b2);})[_0x9425('0x24')](function(_0x6d3e27){_0x3e48e5[_0x9425('0x42')]=_0x6d3e27;return _0x3e48e5;})[_0x9425('0x24')](respondWithFilteredResult(_0x5b82d1,_0x2188b2))[_0x9425('0x43')](handleError(_0x5b82d1,null));};exports['show']=function(_0x1ef722,_0x3733b8){var _0x37dd3c={'raw':![],'where':{'id':_0x1ef722['params']['id']}},_0x5ca185={};_0x5ca185['model']=_['keys'](db[_0x9425('0x3e')][_0x9425('0x2d')]);_0x5ca185[_0x9425('0x30')]=_[_0x9425('0x31')](_0x1ef722[_0x9425('0x30')]);_0x5ca185[_0x9425('0x32')]=_[_0x9425('0x33')](_0x5ca185[_0x9425('0x34')],_0x5ca185['query']);_0x37dd3c['attributes']=_[_0x9425('0x33')](_0x5ca185[_0x9425('0x34')],qs[_0x9425('0x36')](_0x1ef722['query'][_0x9425('0x36')]));_0x37dd3c[_0x9425('0x35')]=_0x37dd3c[_0x9425('0x35')][_0x9425('0x44')]?_0x37dd3c[_0x9425('0x35')]:_0x5ca185[_0x9425('0x34')];if(_0x1ef722[_0x9425('0x30')][_0x9425('0x3f')]){_0x37dd3c[_0x9425('0x40')]=[{'all':!![]}];}_0x37dd3c=_[_0x9425('0x45')]({},_0x37dd3c,_0x1ef722[_0x9425('0x46')]);return db[_0x9425('0x3e')][_0x9425('0x47')](_0x37dd3c)[_0x9425('0x24')](handleEntityNotFound(_0x3733b8,null))[_0x9425('0x24')](respondWithResult(_0x3733b8,null))[_0x9425('0x43')](handleError(_0x3733b8,null));};exports[_0x9425('0x48')]=function(_0x26bad9,_0x1fcd29){return db[_0x9425('0x3e')][_0x9425('0x48')](_0x26bad9[_0x9425('0x49')],{})[_0x9425('0x24')](respondWithResult(_0x1fcd29,0xc9))[_0x9425('0x43')](handleError(_0x1fcd29,null));};exports[_0x9425('0x23')]=function(_0x3d8ad5,_0x69d41a){if(_0x3d8ad5[_0x9425('0x49')]['id']){delete _0x3d8ad5['body']['id'];}return db[_0x9425('0x3e')][_0x9425('0x47')]({'where':{'id':_0x3d8ad5['params']['id']}})[_0x9425('0x24')](handleEntityNotFound(_0x69d41a,null))[_0x9425('0x24')](saveUpdates(_0x3d8ad5[_0x9425('0x49')],null))[_0x9425('0x24')](respondWithResult(_0x69d41a,null))[_0x9425('0x43')](handleError(_0x69d41a,null));};exports[_0x9425('0x4a')]=function(_0x527c1c,_0xb1e1c2){return db[_0x9425('0x3e')]['find']({'where':{'id':_0x527c1c[_0x9425('0x4b')]['id']}})[_0x9425('0x24')](handleEntityNotFound(_0xb1e1c2,null))[_0x9425('0x24')](removeEntity(_0xb1e1c2,null))[_0x9425('0x43')](handleError(_0xb1e1c2,null));};exports['getConfigurations']=function(_0x1a3418,_0xb42275,_0x2c9ad8){var _0x442005={};var _0x3832ed={};var _0x589f01;var _0x577ede;return db[_0x9425('0x3e')][_0x9425('0x4c')]({'where':{'id':_0x1a3418['params']['id']}})[_0x9425('0x24')](handleEntityNotFound(_0xb42275,null))[_0x9425('0x24')](function(_0x1a6d27){if(_0x1a6d27){_0x589f01=_0x1a6d27;_0x3832ed[_0x9425('0x34')]=_[_0x9425('0x31')](db[_0x9425('0x4d')][_0x9425('0x2d')]);_0x3832ed[_0x9425('0x30')]=_[_0x9425('0x31')](_0x1a3418[_0x9425('0x30')]);_0x3832ed[_0x9425('0x32')]=_[_0x9425('0x33')](_0x3832ed['model'],_0x3832ed[_0x9425('0x30')]);_0x442005[_0x9425('0x35')]=_[_0x9425('0x33')](_0x3832ed[_0x9425('0x34')],qs[_0x9425('0x36')](_0x1a3418[_0x9425('0x30')]['fields']));_0x442005['attributes']=_0x442005[_0x9425('0x35')][_0x9425('0x44')]?_0x442005[_0x9425('0x35')]:_0x3832ed[_0x9425('0x34')];_0x442005[_0x9425('0x39')]=qs[_0x9425('0x3a')](_0x1a3418['query'][_0x9425('0x3a')]);_0x442005[_0x9425('0x3b')]=qs[_0x9425('0x32')](_['pick'](_0x1a3418[_0x9425('0x30')],_0x3832ed['filters']));if(_0x1a3418[_0x9425('0x30')][_0x9425('0x3d')]){_0x442005[_0x9425('0x3b')]=_[_0x9425('0x45')](_0x442005[_0x9425('0x3b')],{'$or':_[_0x9425('0x2c')](_0x442005[_0x9425('0x35')],function(_0x2deda9){var _0xb3850f={};_0xb3850f[_0x2deda9]={'$like':'%'+_0x1a3418[_0x9425('0x30')][_0x9425('0x3d')]+'%'};return _0xb3850f;})});}_0x442005=_[_0x9425('0x45')]({},_0x442005,_0x1a3418['options']);return _0x589f01[_0x9425('0x4e')](_0x442005);}})[_0x9425('0x24')](function(_0x33c0c4){if(_0x33c0c4){_0x577ede=_0x33c0c4[_0x9425('0x44')];if(!_0x1a3418[_0x9425('0x30')][_0x9425('0x37')]('nolimit')){_0x442005[_0x9425('0x1c')]=qs[_0x9425('0x1c')](_0x1a3418['query'][_0x9425('0x1c')]);_0x442005[_0x9425('0x1b')]=qs[_0x9425('0x1b')](_0x1a3418[_0x9425('0x30')]['offset']);}return _0x589f01[_0x9425('0x4e')](_0x442005);}})[_0x9425('0x24')](function(_0x2d515d){if(_0x2d515d){return _0x2d515d?{'count':_0x577ede,'rows':_0x2d515d}:null;}})[_0x9425('0x24')](respondWithResult(_0xb42275,null))['catch'](handleError(_0xb42275,null));};exports[_0x9425('0x4f')]=function(_0x14230d,_0xd103b2,_0x54782c){if(_0x14230d[_0x9425('0x49')]['id']){delete _0x14230d[_0x9425('0x49')]['id'];}return db['SalesforceAccount'][_0x9425('0x4c')]({'where':{'id':_0x14230d[_0x9425('0x4b')]['id']}})[_0x9425('0x24')](handleEntityNotFound(_0xd103b2,null))[_0x9425('0x24')](function(_0x1e7fa){if(_0x1e7fa){_0x14230d['body'][_0x9425('0x50')]=_0x1e7fa['id'];_0x14230d[_0x9425('0x49')]['Subjects']=integrations[_0x9425('0x51')](_0x14230d[_0x9425('0x49')][_0x9425('0x52')],_0x14230d[_0x9425('0x49')]['type']);_0x14230d[_0x9425('0x49')][_0x9425('0x53')]=integrations[_0x9425('0x54')](_0x14230d['body'][_0x9425('0x52')],_0x14230d[_0x9425('0x49')]['type']);return db[_0x9425('0x4d')][_0x9425('0x48')](_0x14230d[_0x9425('0x49')],{'include':[{'model':db['SalesforceField'],'as':_0x9425('0x55')},{'model':db[_0x9425('0x56')],'as':_0x9425('0x53')}]});}return null;})['then'](respondWithResult(_0xd103b2,null))[_0x9425('0x43')](handleError(_0xd103b2,null));};exports[_0x9425('0x57')]=function(_0x27c408,_0x5a888d,_0x3c17f0){var _0x32f586;var _0x1c88a2='';var _0x35041f=_0x9425('0x58');return db['SalesforceAccount'][_0x9425('0x4c')]({'where':{'id':_0x27c408[_0x9425('0x4b')]['id']},'attributes':['id',_0x9425('0x59'),_0x9425('0x5a'),_0x9425('0x5b'),_0x9425('0x5c'),'password',_0x9425('0x5d')]})[_0x9425('0x24')](handleEntityNotFound(_0x5a888d,null))['then'](function(_0x244ad9){if(_0x244ad9){_0x1c88a2=_0x244ad9[_0x9425('0x59')];var _0x3fc05e=_0x1c88a2[_0x9425('0x5e')](-0x1);if(_0x3fc05e==='/'){_0x1c88a2=_0x1c88a2[_0x9425('0x5f')](0x0,_0x1c88a2[_0x9425('0x60')](_0x3fc05e));}_0x32f586=new jsforce[(_0x9425('0x61'))]({'oauth2':{'loginUrl':_0x1c88a2,'clientId':_0x244ad9[_0x9425('0x5a')],'clientSecret':_0x244ad9['clientSecret']}});return _0x32f586['login'](_0x244ad9[_0x9425('0x5c')],_0x244ad9[_0x9425('0x62')][_0x9425('0x63')](_0x244ad9['securityToken']));}})[_0x9425('0x24')](function(_0x2289ef){if(_0x2289ef){if(!_[_0x9425('0x64')](_0x27c408[_0x9425('0x30')][_0x9425('0x65')])){_0x35041f=_0x27c408[_0x9425('0x30')][_0x9425('0x65')];}return _0x32f586[_0x9425('0x66')](_0x35041f)[_0x9425('0x67')]();}})[_0x9425('0x24')](function(_0x2b66c3){var _0x2b04c6=[_0x9425('0x68'),'ActivityDate',_0x9425('0x69'),_0x9425('0x6a'),'Subject',_0x9425('0x6b')];var _0x2c4195=[_0x9425('0x6c'),_0x9425('0x6d'),_0x9425('0x6e'),_0x9425('0x6f'),_0x9425('0x70'),_0x9425('0x71'),'phone'];if(_0x2b66c3){_['remove'](_0x2b66c3['fields'],function(_0x466fad){return _0x2b04c6['includes'](_0x466fad['name'])||!_0x2c4195[_0x9425('0x72')](_0x466fad['type']);});return{'count':_0x2b66c3[_0x9425('0x36')][_0x9425('0x44')],'rows':_[_0x9425('0x2c')](_0x2b66c3[_0x9425('0x36')],function(_0x52fb4e){return{'id':_0x52fb4e['name'],'name':_0x52fb4e[_0x9425('0x73')],'custom':_0x52fb4e[_0x9425('0x74')],'options':_0x52fb4e[_0x9425('0x75')][_0x9425('0x44')]>0x0?_[_0x9425('0x2c')](_0x52fb4e[_0x9425('0x75')],function(_0x2e58ff){return{'name':_0x2e58ff[_0x9425('0x73')],'value':_0x2e58ff[_0x9425('0x76')]};}):_0x52fb4e[_0x9425('0x2f')]==_0x9425('0x6f')?[{'name':'True','value':_0x9425('0x77')},{'name':_0x9425('0x78'),'value':_0x9425('0x79')}]:[]};})};}})[_0x9425('0x24')](respondWithResult(_0x5a888d,null))[_0x9425('0x43')](function(_0x13bd82){var _0x50ff86=_0x27c408[_0x9425('0x30')][_0x9425('0x7a')]?0x1f4:_0x13bd82['statusCode']||0x1f4;logger['error'](_0x9425('0x7b'),_0x9425('0x57'),_0x50ff86,JSON['stringify'](_0x13bd82));delete _0x13bd82[_0x9425('0x29')];if(_0x50ff86===0x191){_0x50ff86=0x190;}_0x5a888d['status'](_0x50ff86)[_0x9425('0x2a')](_0x27c408[_0x9425('0x30')][_0x9425('0x7a')]?{'message':_0x9425('0x7c'),'statusCode':_0x13bd82[_0x9425('0x7d')]}:_0x13bd82);});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index cec4cd0..7406fdc 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 _0xcbd6=['define','SalesforceAccount','int_salesforce_accounts','util','api','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x54769f,_0x4588ad){var _0x3f3622=function(_0x485856){while(--_0x485856){_0x54769f['push'](_0x54769f['shift']());}};_0x3f3622(++_0x4588ad);}(_0xcbd6,0x7b));var _0x6cbd=function(_0xe1e7c3,_0x58d8d3){_0xe1e7c3=_0xe1e7c3-0x0;var _0x29dc0b=_0xcbd6[_0xe1e7c3];return _0x29dc0b;};'use strict';var _=require('lodash');var util=require(_0x6cbd('0x0'));var logger=require('../../config/logger')(_0x6cbd('0x1'));var moment=require('moment');var BPromise=require(_0x6cbd('0x2'));var rp=require(_0x6cbd('0x3'));var fs=require('fs');var path=require(_0x6cbd('0x4'));var rimraf=require('rimraf');var config=require(_0x6cbd('0x5'));var attributes=require(_0x6cbd('0x6'));var integrations=require(_0x6cbd('0x7'));module[_0x6cbd('0x8')]=function(_0x4d5669,_0x4e2156){return _0x4d5669[_0x6cbd('0x9')](_0x6cbd('0xa'),attributes,{'tableName':_0x6cbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 1fc99c8..e8a6ed4 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 _0x13ae=['where','attributes','limit','include','map','model','then','SalesforceAccount','raw','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','findAll','options'];(function(_0x3a82b1,_0x265e4c){var _0x1352ee=function(_0x193b41){while(--_0x193b41){_0x3a82b1['push'](_0x3a82b1['shift']());}};_0x1352ee(++_0x265e4c);}(_0x13ae,0x1f4));var _0xe13a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x13ae[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xe13a('0x0'));var util=require(_0xe13a('0x1'));var moment=require(_0xe13a('0x2'));var BPromise=require(_0xe13a('0x3'));var rs=require(_0xe13a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe13a('0x5'))['db'];var utils=require(_0xe13a('0x6'));var logger=require(_0xe13a('0x7'))(_0xe13a('0x8'));var config=require(_0xe13a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe13a('0xa')][_0xe13a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274f26,_0x5044b5,_0x486411){return new BPromise(function(_0x56f656,_0x474377){return client[_0xe13a('0xc')](_0x274f26,_0x486411)['then'](function(_0x5150ba){logger[_0xe13a('0xd')](_0xe13a('0xe'),_0x5044b5,_0xe13a('0xf'));logger[_0xe13a('0x10')](_0xe13a('0x11'),_0x5044b5,_0xe13a('0xf'),JSON[_0xe13a('0x12')](_0x5150ba));if(_0x5150ba[_0xe13a('0x13')]){if(_0x5150ba[_0xe13a('0x13')]['code']===0x1f4){logger['error'](_0xe13a('0xe'),_0x5044b5,_0x5150ba[_0xe13a('0x13')]['message']);return _0x474377(_0x5150ba[_0xe13a('0x13')][_0xe13a('0x14')]);}logger[_0xe13a('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x5044b5,_0x5150ba['error'][_0xe13a('0x14')]);return _0x56f656(_0x5150ba[_0xe13a('0x13')]['message']);}else{logger[_0xe13a('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x5044b5,_0xe13a('0xf'));_0x56f656(_0x5150ba['result'][_0xe13a('0x14')]);}})[_0xe13a('0x15')](function(_0x5428e1){logger[_0xe13a('0x13')](_0xe13a('0xe'),_0x5044b5,_0x5428e1);_0x474377(_0x5428e1);});});}exports[_0xe13a('0x16')]=function(_0x3b7f7d){var _0x3fbbcb=this;return new Promise(function(_0x44cd22,_0x5a9906){return db['SalesforceAccount'][_0xe13a('0x17')]({'raw':_0x3b7f7d[_0xe13a('0x18')]?_0x3b7f7d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b7f7d[_0xe13a('0x18')]?_0x3b7f7d['options'][_0xe13a('0x19')]||null:null,'attributes':_0x3b7f7d[_0xe13a('0x18')]?_0x3b7f7d[_0xe13a('0x18')][_0xe13a('0x1a')]||null:null,'limit':_0x3b7f7d[_0xe13a('0x18')]?_0x3b7f7d['options'][_0xe13a('0x1b')]||null:null,'include':_0x3b7f7d['options']?_0x3b7f7d[_0xe13a('0x18')][_0xe13a('0x1c')]?_[_0xe13a('0x1d')](_0x3b7f7d[_0xe13a('0x18')]['include'],function(_0x40008c){return{'model':db[_0x40008c[_0xe13a('0x1e')]],'as':_0x40008c['as'],'attributes':_0x40008c[_0xe13a('0x1a')],'include':_0x40008c[_0xe13a('0x1c')]?_['map'](_0x40008c[_0xe13a('0x1c')],function(_0x27ea42){return{'model':db[_0x27ea42['model']],'as':_0x27ea42['as'],'attributes':_0x27ea42[_0xe13a('0x1a')],'include':_0x27ea42[_0xe13a('0x1c')]?_['map'](_0x27ea42[_0xe13a('0x1c')],function(_0x49a017){return{'model':db[_0x49a017[_0xe13a('0x1e')]],'as':_0x49a017['as'],'attributes':_0x49a017[_0xe13a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe13a('0x1f')](function(_0x1f78f4){logger['info'](_0xe13a('0x16'),_0x3b7f7d);logger[_0xe13a('0x10')](_0xe13a('0x16'),_0x3b7f7d,JSON[_0xe13a('0x12')](_0x1f78f4));_0x44cd22(_0x1f78f4);})[_0xe13a('0x15')](function(_0x4f77b0){logger[_0xe13a('0x13')]('GetSalesforceAccount',_0x4f77b0[_0xe13a('0x14')],_0x3b7f7d);_0x5a9906(_0x3fbbcb['error'](0x1f4,_0x4f77b0[_0xe13a('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x34bc86){var _0x16ce7a=this;return new Promise(function(_0x55ed98,_0xc8944a){return db[_0xe13a('0x20')]['find']({'raw':_0x34bc86['options']?_0x34bc86[_0xe13a('0x18')][_0xe13a('0x21')]===undefined?!![]:![]:!![],'where':_0x34bc86['options']?_0x34bc86[_0xe13a('0x18')]['where']||null:null,'attributes':_0x34bc86[_0xe13a('0x18')]?_0x34bc86[_0xe13a('0x18')][_0xe13a('0x1a')]||null:null,'include':_0x34bc86['options']?_0x34bc86['options']['include']?_[_0xe13a('0x1d')](_0x34bc86[_0xe13a('0x18')][_0xe13a('0x1c')],function(_0x415710){return{'model':db[_0x415710[_0xe13a('0x1e')]],'as':_0x415710['as'],'attributes':_0x415710[_0xe13a('0x1a')],'include':_0x415710['include']?_[_0xe13a('0x1d')](_0x415710[_0xe13a('0x1c')],function(_0x32dbf9){return{'model':db[_0x32dbf9[_0xe13a('0x1e')]],'as':_0x32dbf9['as'],'attributes':_0x32dbf9[_0xe13a('0x1a')],'include':_0x32dbf9[_0xe13a('0x1c')]?_[_0xe13a('0x1d')](_0x32dbf9['include'],function(_0x394229){return{'model':db[_0x394229[_0xe13a('0x1e')]],'as':_0x394229['as'],'attributes':_0x394229['attributes']};}):[]};}):[]};}):[]:[]})[_0xe13a('0x1f')](function(_0x1406e6){logger[_0xe13a('0xd')](_0xe13a('0x22'),_0x34bc86);logger[_0xe13a('0x10')]('ShowSalesforceAccount',_0x34bc86,JSON['stringify'](_0x1406e6));_0x55ed98(_0x1406e6);})[_0xe13a('0x15')](function(_0x2becba){logger[_0xe13a('0x13')](_0xe13a('0x22'),_0x2becba[_0xe13a('0x14')],_0x34bc86);_0xc8944a(_0x16ce7a['error'](0x1f4,_0x2becba[_0xe13a('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 540f8b1..52fa7b1 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(_0x15a42e,_0x3ff0e8){var _0x45461c=function(_0x315cd6){while(--_0x315cd6){_0x15a42e['push'](_0x15a42e['shift']());}};_0x45461c(++_0x3ff0e8);}(_0x7a54,0x106));var _0x47a5=function(_0xb57bd2,_0x573f98){_0xb57bd2=_0xb57bd2-0x0;var _0x43cc76=_0x7a54[_0xb57bd2];return _0x43cc76;};'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 _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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9047b35..b63732c 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 _0x6587=['contact_lead','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account'];(function(_0x4ee964,_0x211d6b){var _0x247d94=function(_0x849167){while(--_0x849167){_0x4ee964['push'](_0x4ee964['shift']());}};_0x247d94(++_0x211d6b);}(_0x6587,0x86));var _0x7658=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x6587[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require(_0x7658('0x0'));module[_0x7658('0x1')]={'name':{'type':Sequelize[_0x7658('0x2')]},'description':{'type':Sequelize[_0x7658('0x2')]},'ticketType':{'type':Sequelize[_0x7658('0x3')](_0x7658('0x4'),_0x7658('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x7658('0x6'),_0x7658('0x7'),'account_contact_lead',_0x7658('0x8')),'defaultValue':_0x7658('0x9')},'moduleCreate':{'type':Sequelize['ENUM'](_0x7658('0xa'),_0x7658('0x6'),_0x7658('0x7'),_0x7658('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x7658('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x7658('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6debaf7..6e0cdc9 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 _0xef0d=['update','then','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','getFields','SalesforceField','order','getSubjects','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x492705,_0x3875ff){var _0x881175=function(_0xc0d1eb){while(--_0xc0d1eb){_0x492705['push'](_0x492705['shift']());}};_0x881175(++_0x3875ff);}(_0xef0d,0x7d));var _0xdef0=function(_0x100450,_0x165756){_0x100450=_0x100450-0x0;var _0x407221=_0xef0d[_0x100450];return _0x407221;};'use strict';var emlformat=require(_0xdef0('0x0'));var rimraf=require(_0xdef0('0x1'));var zipdir=require(_0xdef0('0x2'));var jsonpatch=require(_0xdef0('0x3'));var rp=require('request-promise');var moment=require(_0xdef0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdef0('0x5'));var ejs=require(_0xdef0('0x6'));var fs=require('fs');var fs_extra=require(_0xdef0('0x7'));var _=require(_0xdef0('0x8'));var squel=require(_0xdef0('0x9'));var crypto=require(_0xdef0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdef0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdef0('0xc'));var Redis=require(_0xdef0('0xd'));var authService=require(_0xdef0('0xe'));var qs=require(_0xdef0('0xf'));var as=require(_0xdef0('0x10'));var hardwareService=require(_0xdef0('0x11'));var logger=require(_0xdef0('0x12'))(_0xdef0('0x13'));var utils=require(_0xdef0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdef0('0x15'));var db=require(_0xdef0('0x16'))['db'];function respondWithStatusCode(_0x128521,_0x136a26){_0x136a26=_0x136a26||0xcc;return function(_0x529a52){if(_0x529a52){return _0x128521[_0xdef0('0x17')](_0x136a26);}return _0x128521[_0xdef0('0x18')](_0x136a26)[_0xdef0('0x19')]();};}function respondWithResult(_0xb9dd6d,_0x4f3005){_0x4f3005=_0x4f3005||0xc8;return function(_0x28e80b){if(_0x28e80b){return _0xb9dd6d['status'](_0x4f3005)['json'](_0x28e80b);}};}function respondWithFilteredResult(_0x30b05d,_0x297368){return function(_0x4e3be2){if(_0x4e3be2){var _0x472f9b=typeof _0x297368[_0xdef0('0x1a')]===_0xdef0('0x1b')&&typeof _0x297368[_0xdef0('0x1c')]===_0xdef0('0x1b');var _0x5c9cf8=_0x4e3be2[_0xdef0('0x1d')];var _0x46d330=_0x472f9b?0x0:_0x297368[_0xdef0('0x1a')];var _0x514c84=_0x472f9b?_0x4e3be2[_0xdef0('0x1d')]:_0x297368['offset']+_0x297368['limit'];var _0x1e2dca;if(_0x514c84>=_0x5c9cf8){_0x514c84=_0x5c9cf8;_0x1e2dca=0xc8;}else{_0x1e2dca=0xce;}_0x30b05d['status'](_0x1e2dca);return _0x30b05d[_0xdef0('0x1e')](_0xdef0('0x1f'),_0x46d330+'-'+_0x514c84+'/'+_0x5c9cf8)[_0xdef0('0x20')](_0x4e3be2);}return null;};}function patchUpdates(_0x387f29){return function(_0xa0ab0c){try{jsonpatch[_0xdef0('0x21')](_0xa0ab0c,_0x387f29,!![]);}catch(_0x18a64b){return BPromise[_0xdef0('0x22')](_0x18a64b);}return _0xa0ab0c['save']();};}function saveUpdates(_0x356263,_0x45db66){return function(_0x5d6a21){if(_0x5d6a21){return _0x5d6a21[_0xdef0('0x23')](_0x356263)[_0xdef0('0x24')](function(_0x1ef2ec){return _0x1ef2ec;});}return null;};}function removeEntity(_0x130302,_0x3824e4){return function(_0x33a16f){if(_0x33a16f){return _0x33a16f[_0xdef0('0x25')]()[_0xdef0('0x24')](function(){_0x130302['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd24cef,_0x5b0440){return function(_0x452728){if(!_0x452728){_0xd24cef[_0xdef0('0x17')](0x194);}return _0x452728;};}function handleError(_0x58519f,_0x21b422){_0x21b422=_0x21b422||0x1f4;return function(_0x45ad28){logger['error'](_0x45ad28[_0xdef0('0x26')]);if(_0x45ad28[_0xdef0('0x27')]){delete _0x45ad28[_0xdef0('0x27')];}_0x58519f['status'](_0x21b422)[_0xdef0('0x28')](_0x45ad28);};}exports[_0xdef0('0x29')]=function(_0x433deb,_0x3f8b23){var _0x371d65={},_0x28921b={},_0x263793={'count':0x0,'rows':[]};var _0x1ba2e0=_['map'](db[_0xdef0('0x2a')][_0xdef0('0x2b')],function(_0x1065b9){return{'name':_0x1065b9[_0xdef0('0x2c')],'type':_0x1065b9[_0xdef0('0x2d')][_0xdef0('0x2e')]};});_0x28921b[_0xdef0('0x2f')]=_[_0xdef0('0x30')](_0x1ba2e0,_0xdef0('0x27'));_0x28921b['query']=_[_0xdef0('0x31')](_0x433deb['query']);_0x28921b[_0xdef0('0x32')]=_[_0xdef0('0x33')](_0x28921b[_0xdef0('0x2f')],_0x28921b[_0xdef0('0x34')]);_0x371d65['attributes']=_[_0xdef0('0x33')](_0x28921b[_0xdef0('0x2f')],qs['fields'](_0x433deb[_0xdef0('0x34')]['fields']));_0x371d65[_0xdef0('0x35')]=_0x371d65['attributes'][_0xdef0('0x36')]?_0x371d65['attributes']:_0x28921b['model'];if(!_0x433deb[_0xdef0('0x34')][_0xdef0('0x37')](_0xdef0('0x38'))){_0x371d65[_0xdef0('0x1c')]=qs[_0xdef0('0x1c')](_0x433deb['query'][_0xdef0('0x1c')]);_0x371d65[_0xdef0('0x1a')]=qs[_0xdef0('0x1a')](_0x433deb['query'][_0xdef0('0x1a')]);}_0x371d65['order']=qs['sort'](_0x433deb['query'][_0xdef0('0x39')]);_0x371d65[_0xdef0('0x3a')]=qs[_0xdef0('0x32')](_[_0xdef0('0x3b')](_0x433deb[_0xdef0('0x34')],_0x28921b[_0xdef0('0x32')]),_0x1ba2e0);if(_0x433deb[_0xdef0('0x34')][_0xdef0('0x3c')]){_0x371d65[_0xdef0('0x3a')]=_[_0xdef0('0x3d')](_0x371d65[_0xdef0('0x3a')],{'$or':_['map'](_0x1ba2e0,function(_0x2e5a9b){if(_0x2e5a9b[_0xdef0('0x2d')]!==_0xdef0('0x3e')){var _0x3a5c9f={};_0x3a5c9f[_0x2e5a9b['name']]={'$like':'%'+_0x433deb['query'][_0xdef0('0x3c')]+'%'};return _0x3a5c9f;}})});}_0x371d65=_[_0xdef0('0x3d')]({},_0x371d65,_0x433deb[_0xdef0('0x3f')]);var _0x111186={'where':_0x371d65['where']};return db['SalesforceConfiguration'][_0xdef0('0x1d')](_0x111186)[_0xdef0('0x24')](function(_0x409a5c){_0x263793['count']=_0x409a5c;if(_0x433deb['query'][_0xdef0('0x40')]){_0x371d65[_0xdef0('0x41')]=[{'all':!![]}];}return db[_0xdef0('0x2a')][_0xdef0('0x42')](_0x371d65);})['then'](function(_0x3e55de){_0x263793[_0xdef0('0x43')]=_0x3e55de;return _0x263793;})[_0xdef0('0x24')](respondWithFilteredResult(_0x3f8b23,_0x371d65))[_0xdef0('0x44')](handleError(_0x3f8b23,null));};exports[_0xdef0('0x45')]=function(_0x6c73a3,_0x361136){var _0x35f970={'raw':![],'where':{'id':_0x6c73a3[_0xdef0('0x46')]['id']}},_0x30ee41={};_0x30ee41['model']=_[_0xdef0('0x31')](db[_0xdef0('0x2a')][_0xdef0('0x2b')]);_0x30ee41[_0xdef0('0x34')]=_[_0xdef0('0x31')](_0x6c73a3[_0xdef0('0x34')]);_0x30ee41[_0xdef0('0x32')]=_['intersection'](_0x30ee41[_0xdef0('0x2f')],_0x30ee41['query']);_0x35f970[_0xdef0('0x35')]=_[_0xdef0('0x33')](_0x30ee41[_0xdef0('0x2f')],qs[_0xdef0('0x47')](_0x6c73a3[_0xdef0('0x34')][_0xdef0('0x47')]));_0x35f970['attributes']=_0x35f970['attributes']['length']?_0x35f970[_0xdef0('0x35')]:_0x30ee41[_0xdef0('0x2f')];if(_0x6c73a3[_0xdef0('0x34')][_0xdef0('0x40')]){_0x35f970[_0xdef0('0x41')]=[{'all':!![]}];}_0x35f970=_[_0xdef0('0x3d')]({},_0x35f970,_0x6c73a3[_0xdef0('0x3f')]);return db[_0xdef0('0x2a')][_0xdef0('0x48')](_0x35f970)[_0xdef0('0x24')](handleEntityNotFound(_0x361136,null))[_0xdef0('0x24')](respondWithResult(_0x361136,null))[_0xdef0('0x44')](handleError(_0x361136,null));};exports['create']=function(_0x41a9fc,_0x5350ab){return db[_0xdef0('0x2a')][_0xdef0('0x49')](_0x41a9fc[_0xdef0('0x4a')],{})[_0xdef0('0x24')](respondWithResult(_0x5350ab,0xc9))['catch'](handleError(_0x5350ab,null));};exports[_0xdef0('0x23')]=function(_0x4a92eb,_0x7eafa8){if(_0x4a92eb['body']['id']){delete _0x4a92eb[_0xdef0('0x4a')]['id'];}return db[_0xdef0('0x2a')][_0xdef0('0x48')]({'where':{'id':_0x4a92eb[_0xdef0('0x46')]['id']}})['then'](handleEntityNotFound(_0x7eafa8,null))['then'](saveUpdates(_0x4a92eb[_0xdef0('0x4a')],null))[_0xdef0('0x24')](respondWithResult(_0x7eafa8,null))['catch'](handleError(_0x7eafa8,null));};exports['destroy']=function(_0x356b13,_0x5f4f3e){return db['SalesforceConfiguration'][_0xdef0('0x48')]({'where':{'id':_0x356b13[_0xdef0('0x46')]['id']}})[_0xdef0('0x24')](handleEntityNotFound(_0x5f4f3e,null))[_0xdef0('0x24')](removeEntity(_0x5f4f3e,null))[_0xdef0('0x44')](handleError(_0x5f4f3e,null));};exports[_0xdef0('0x4b')]=function(_0x342be5,_0x4e46e6,_0x33ef35){var _0x212507={};var _0x2ef421={};var _0x15bd40;var _0x170323;return db[_0xdef0('0x2a')]['findOne']({'where':{'id':_0x342be5[_0xdef0('0x46')]['id']}})[_0xdef0('0x24')](handleEntityNotFound(_0x4e46e6,null))[_0xdef0('0x24')](function(_0x151159){if(_0x151159){_0x15bd40=_0x151159;_0x2ef421['model']=_[_0xdef0('0x31')](db[_0xdef0('0x4c')][_0xdef0('0x2b')]);_0x2ef421[_0xdef0('0x34')]=_['keys'](_0x342be5[_0xdef0('0x34')]);_0x2ef421['filters']=_[_0xdef0('0x33')](_0x2ef421['model'],_0x2ef421[_0xdef0('0x34')]);_0x212507[_0xdef0('0x35')]=_[_0xdef0('0x33')](_0x2ef421['model'],qs[_0xdef0('0x47')](_0x342be5['query']['fields']));_0x212507[_0xdef0('0x35')]=_0x212507[_0xdef0('0x35')][_0xdef0('0x36')]?_0x212507[_0xdef0('0x35')]:_0x2ef421[_0xdef0('0x2f')];_0x212507[_0xdef0('0x4d')]=qs[_0xdef0('0x39')](_0x342be5[_0xdef0('0x34')][_0xdef0('0x39')]);_0x212507[_0xdef0('0x3a')]=qs['filters'](_[_0xdef0('0x3b')](_0x342be5[_0xdef0('0x34')],_0x2ef421['filters']));if(_0x342be5[_0xdef0('0x34')][_0xdef0('0x3c')]){_0x212507[_0xdef0('0x3a')]=_[_0xdef0('0x3d')](_0x212507[_0xdef0('0x3a')],{'$or':_[_0xdef0('0x30')](_0x212507[_0xdef0('0x35')],function(_0x4ad06c){var _0x4e01cc={};_0x4e01cc[_0x4ad06c]={'$like':'%'+_0x342be5[_0xdef0('0x34')][_0xdef0('0x3c')]+'%'};return _0x4e01cc;})});}_0x212507=_[_0xdef0('0x3d')]({},_0x212507,_0x342be5[_0xdef0('0x3f')]);return _0x15bd40[_0xdef0('0x4b')](_0x212507);}})[_0xdef0('0x24')](function(_0x4fe8e8){if(_0x4fe8e8){_0x170323=_0x4fe8e8[_0xdef0('0x36')];if(!_0x342be5[_0xdef0('0x34')][_0xdef0('0x37')]('nolimit')){_0x212507[_0xdef0('0x1c')]=qs[_0xdef0('0x1c')](_0x342be5[_0xdef0('0x34')]['limit']);_0x212507[_0xdef0('0x1a')]=qs[_0xdef0('0x1a')](_0x342be5[_0xdef0('0x34')][_0xdef0('0x1a')]);}return _0x15bd40[_0xdef0('0x4b')](_0x212507);}})[_0xdef0('0x24')](function(_0x154c3a){if(_0x154c3a){return _0x154c3a?{'count':_0x170323,'rows':_0x154c3a}:null;}})['then'](respondWithResult(_0x4e46e6,null))[_0xdef0('0x44')](handleError(_0x4e46e6,null));};exports[_0xdef0('0x4e')]=function(_0x38aefd,_0x493142,_0x89517f){var _0x3f56ef={};var _0x48fe0f={};var _0x25998e;var _0x519ed6;return db[_0xdef0('0x2a')][_0xdef0('0x4f')]({'where':{'id':_0x38aefd[_0xdef0('0x46')]['id']}})['then'](handleEntityNotFound(_0x493142,null))[_0xdef0('0x24')](function(_0x1a8165){if(_0x1a8165){_0x25998e=_0x1a8165;_0x48fe0f['model']=_[_0xdef0('0x31')](db['SalesforceField'][_0xdef0('0x2b')]);_0x48fe0f[_0xdef0('0x34')]=_['keys'](_0x38aefd[_0xdef0('0x34')]);_0x48fe0f['filters']=_[_0xdef0('0x33')](_0x48fe0f['model'],_0x48fe0f['query']);_0x3f56ef[_0xdef0('0x35')]=_[_0xdef0('0x33')](_0x48fe0f[_0xdef0('0x2f')],qs[_0xdef0('0x47')](_0x38aefd[_0xdef0('0x34')]['fields']));_0x3f56ef[_0xdef0('0x35')]=_0x3f56ef[_0xdef0('0x35')][_0xdef0('0x36')]?_0x3f56ef['attributes']:_0x48fe0f['model'];_0x3f56ef['order']=qs['sort'](_0x38aefd[_0xdef0('0x34')]['sort']);_0x3f56ef['where']=qs[_0xdef0('0x32')](_['pick'](_0x38aefd[_0xdef0('0x34')],_0x48fe0f[_0xdef0('0x32')]));if(_0x38aefd[_0xdef0('0x34')][_0xdef0('0x3c')]){_0x3f56ef['where']=_[_0xdef0('0x3d')](_0x3f56ef['where'],{'$or':_['map'](_0x3f56ef['attributes'],function(_0x48c023){var _0x4a687c={};_0x4a687c[_0x48c023]={'$like':'%'+_0x38aefd[_0xdef0('0x34')][_0xdef0('0x3c')]+'%'};return _0x4a687c;})});}_0x3f56ef=_[_0xdef0('0x3d')]({},_0x3f56ef,_0x38aefd[_0xdef0('0x3f')]);return _0x25998e[_0xdef0('0x4e')](_0x3f56ef);}})['then'](function(_0x82822c){if(_0x82822c){_0x519ed6=_0x82822c['length'];if(!_0x38aefd[_0xdef0('0x34')]['hasOwnProperty'](_0xdef0('0x38'))){_0x3f56ef[_0xdef0('0x1c')]=qs[_0xdef0('0x1c')](_0x38aefd[_0xdef0('0x34')][_0xdef0('0x1c')]);_0x3f56ef['offset']=qs[_0xdef0('0x1a')](_0x38aefd['query'][_0xdef0('0x1a')]);}return _0x25998e[_0xdef0('0x4e')](_0x3f56ef);}})[_0xdef0('0x24')](function(_0x3bddd6){if(_0x3bddd6){return _0x3bddd6?{'count':_0x519ed6,'rows':_0x3bddd6}:null;}})[_0xdef0('0x24')](respondWithResult(_0x493142,null))[_0xdef0('0x44')](handleError(_0x493142,null));};exports['getDescriptions']=function(_0x5c7924,_0x1bdaa3,_0xcd4696){var _0x840666={};var _0x2624cf={};var _0x55202a;var _0x333f18;return db[_0xdef0('0x2a')][_0xdef0('0x4f')]({'where':{'id':_0x5c7924[_0xdef0('0x46')]['id']}})[_0xdef0('0x24')](handleEntityNotFound(_0x1bdaa3,null))[_0xdef0('0x24')](function(_0x19b336){if(_0x19b336){_0x55202a=_0x19b336;_0x2624cf['model']=_['keys'](db[_0xdef0('0x4c')][_0xdef0('0x2b')]);_0x2624cf[_0xdef0('0x34')]=_['keys'](_0x5c7924[_0xdef0('0x34')]);_0x2624cf[_0xdef0('0x32')]=_[_0xdef0('0x33')](_0x2624cf[_0xdef0('0x2f')],_0x2624cf[_0xdef0('0x34')]);_0x840666[_0xdef0('0x35')]=_[_0xdef0('0x33')](_0x2624cf[_0xdef0('0x2f')],qs[_0xdef0('0x47')](_0x5c7924[_0xdef0('0x34')][_0xdef0('0x47')]));_0x840666['attributes']=_0x840666[_0xdef0('0x35')]['length']?_0x840666[_0xdef0('0x35')]:_0x2624cf[_0xdef0('0x2f')];_0x840666[_0xdef0('0x4d')]=qs[_0xdef0('0x39')](_0x5c7924[_0xdef0('0x34')][_0xdef0('0x39')]);_0x840666['where']=qs['filters'](_['pick'](_0x5c7924[_0xdef0('0x34')],_0x2624cf[_0xdef0('0x32')]));if(_0x5c7924[_0xdef0('0x34')]['filter']){_0x840666[_0xdef0('0x3a')]=_[_0xdef0('0x3d')](_0x840666[_0xdef0('0x3a')],{'$or':_[_0xdef0('0x30')](_0x840666[_0xdef0('0x35')],function(_0x168c74){var _0x50fdc1={};_0x50fdc1[_0x168c74]={'$like':'%'+_0x5c7924['query'][_0xdef0('0x3c')]+'%'};return _0x50fdc1;})});}_0x840666=_['merge']({},_0x840666,_0x5c7924[_0xdef0('0x3f')]);return _0x55202a['getDescriptions'](_0x840666);}})[_0xdef0('0x24')](function(_0x182479){if(_0x182479){_0x333f18=_0x182479['length'];if(!_0x5c7924[_0xdef0('0x34')][_0xdef0('0x37')](_0xdef0('0x38'))){_0x840666['limit']=qs[_0xdef0('0x1c')](_0x5c7924[_0xdef0('0x34')][_0xdef0('0x1c')]);_0x840666[_0xdef0('0x1a')]=qs[_0xdef0('0x1a')](_0x5c7924[_0xdef0('0x34')][_0xdef0('0x1a')]);}return _0x55202a['getDescriptions'](_0x840666);}})[_0xdef0('0x24')](function(_0x372ae6){if(_0x372ae6){return _0x372ae6?{'count':_0x333f18,'rows':_0x372ae6}:null;}})[_0xdef0('0x24')](respondWithResult(_0x1bdaa3,null))[_0xdef0('0x44')](handleError(_0x1bdaa3,null));}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 216c37c..766ab01 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 _0x826f=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x826f,0x81));var _0xf826=function(_0x48626c,_0x2e1720){_0x48626c=_0x48626c-0x0;var _0x10b70e=_0x826f[_0x48626c];return _0x10b70e;};'use strict';var _=require(_0xf826('0x0'));var util=require(_0xf826('0x1'));var logger=require(_0xf826('0x2'))(_0xf826('0x3'));var moment=require(_0xf826('0x4'));var BPromise=require(_0xf826('0x5'));var rp=require(_0xf826('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf826('0x7'));var config=require(_0xf826('0x8'));var attributes=require(_0xf826('0x9'));module[_0xf826('0xa')]=function(_0x2206e0,_0x438358){return _0x2206e0[_0xf826('0xb')](_0xf826('0xc'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 97b5dd5..5e7281b 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 _0x65b7=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3f1f3c,_0x376a51){var _0x5f296d=function(_0x3a2abf){while(--_0x3a2abf){_0x3f1f3c['push'](_0x3f1f3c['shift']());}};_0x5f296d(++_0x376a51);}(_0x65b7,0xa8));var _0x765b=function(_0x4fb677,_0x2fb321){_0x4fb677=_0x4fb677-0x0;var _0x5581b6=_0x65b7[_0x4fb677];return _0x5581b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x765b('0x0'));var BPromise=require(_0x765b('0x1'));var rs=require(_0x765b('0x2'));var fs=require('fs');var Redis=require(_0x765b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x765b('0x4'))(_0x765b('0x5'));var config=require(_0x765b('0x6'));var jayson=require(_0x765b('0x7'));var client=jayson[_0x765b('0x8')][_0x765b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x211666,_0x545722,_0x4cbade){return new BPromise(function(_0x5c285b,_0x4f320e){return client[_0x765b('0xa')](_0x211666,_0x4cbade)['then'](function(_0x5dbfa4){logger[_0x765b('0xb')](_0x765b('0xc'),_0x545722,'request\x20sent');logger['debug'](_0x765b('0xd'),_0x545722,_0x765b('0xe'),JSON[_0x765b('0xf')](_0x5dbfa4));if(_0x5dbfa4[_0x765b('0x10')]){if(_0x5dbfa4['error'][_0x765b('0x11')]===0x1f4){logger[_0x765b('0x10')](_0x765b('0xc'),_0x545722,_0x5dbfa4[_0x765b('0x10')][_0x765b('0x12')]);return _0x4f320e(_0x5dbfa4['error'][_0x765b('0x12')]);}logger['error'](_0x765b('0xc'),_0x545722,_0x5dbfa4[_0x765b('0x10')][_0x765b('0x12')]);return _0x5c285b(_0x5dbfa4[_0x765b('0x10')]['message']);}else{logger[_0x765b('0xb')](_0x765b('0xc'),_0x545722,_0x765b('0xe'));_0x5c285b(_0x5dbfa4[_0x765b('0x13')][_0x765b('0x12')]);}})[_0x765b('0x14')](function(_0x383624){logger[_0x765b('0x10')](_0x765b('0xc'),_0x545722,_0x383624);_0x4f320e(_0x383624);});});} \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5800ee9..0900c85 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 _0xfc50=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','update','delete','destroy'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xfc50,0xbf));var _0x0fc5=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xfc50[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require('multer');var util=require(_0x0fc5('0x0'));var path=require(_0x0fc5('0x1'));var timeout=require(_0x0fc5('0x2'));var express=require('express');var router=express[_0x0fc5('0x3')]();var fs_extra=require(_0x0fc5('0x4'));var auth=require(_0x0fc5('0x5'));var interaction=require(_0x0fc5('0x6'));var config=require(_0x0fc5('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x0fc5('0x8')](),controller[_0x0fc5('0x9')]);router[_0x0fc5('0xa')]('/:id',auth[_0x0fc5('0x8')](),controller[_0x0fc5('0xb')]);router[_0x0fc5('0xc')]('/',auth[_0x0fc5('0x8')](),controller[_0x0fc5('0xd')]);router[_0x0fc5('0xe')]('/:id',auth[_0x0fc5('0x8')](),controller[_0x0fc5('0xf')]);router[_0x0fc5('0x10')]('/:id',auth[_0x0fc5('0x8')](),controller[_0x0fc5('0x11')]);module[_0x0fc5('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6eaeaaa..0d0c073 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 _0x3d93=['picklist','customVariable','STRING','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x2bde9f,_0x3ccd1b){var _0x3e8886=function(_0x3984bf){while(--_0x3984bf){_0x2bde9f['push'](_0x2bde9f['shift']());}};_0x3e8886(++_0x3ccd1b);}(_0x3d93,0x198));var _0x33d9=function(_0x4aee2d,_0x139f0d){_0x4aee2d=_0x4aee2d-0x0;var _0xdcf9da=_0x3d93[_0x4aee2d];return _0xdcf9da;};'use strict';var Sequelize=require(_0x33d9('0x0'));module[_0x33d9('0x1')]={'type':{'type':Sequelize[_0x33d9('0x2')](_0x33d9('0x3'),_0x33d9('0x4'),'customVariable',_0x33d9('0x5'),_0x33d9('0x6')),'defaultValue':_0x33d9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x33d9('0x2')](_0x33d9('0x3'),_0x33d9('0x4'),_0x33d9('0x7'))},'keyContent':{'type':Sequelize[_0x33d9('0x8')]},'idField':{'type':Sequelize[_0x33d9('0x8')]},'variableName':{'type':Sequelize[_0x33d9('0x8')]}}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a6692c6..26c20ac 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 _0xe6c9=['request-promise','moment','bluebird','path','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','name','send','index','SalesforceField','rawAttributes','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','zip-dir'];(function(_0x31b14c,_0x23c44a){var _0x4b37f3=function(_0x175cb6){while(--_0x175cb6){_0x31b14c['push'](_0x31b14c['shift']());}};_0x4b37f3(++_0x23c44a);}(_0xe6c9,0x152));var _0x9e6c=function(_0x5c1f30,_0x5a5fa9){_0x5c1f30=_0x5c1f30-0x0;var _0x218752=_0xe6c9[_0x5c1f30];return _0x218752;};'use strict';var emlformat=require(_0x9e6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e6c('0x2'));var moment=require(_0x9e6c('0x3'));var BPromise=require(_0x9e6c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e6c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9e6c('0x6'));var fs=require('fs');var fs_extra=require(_0x9e6c('0x7'));var _=require('lodash');var squel=require(_0x9e6c('0x8'));var crypto=require(_0x9e6c('0x9'));var jsforce=require(_0x9e6c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e6c('0xb'));var Redis=require(_0x9e6c('0xc'));var authService=require(_0x9e6c('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e6c('0xe'));var logger=require('../../config/logger')(_0x9e6c('0xf'));var utils=require(_0x9e6c('0x10'));var config=require(_0x9e6c('0x11'));var licenseUtil=require(_0x9e6c('0x12'));var db=require(_0x9e6c('0x13'))['db'];function respondWithStatusCode(_0xe38c8,_0x5d0837){_0x5d0837=_0x5d0837||0xcc;return function(_0x4e9b42){if(_0x4e9b42){return _0xe38c8[_0x9e6c('0x14')](_0x5d0837);}return _0xe38c8[_0x9e6c('0x15')](_0x5d0837)[_0x9e6c('0x16')]();};}function respondWithResult(_0x50d6e6,_0x279e7a){_0x279e7a=_0x279e7a||0xc8;return function(_0xf641f0){if(_0xf641f0){return _0x50d6e6['status'](_0x279e7a)['json'](_0xf641f0);}};}function respondWithFilteredResult(_0x136687,_0x378abe){return function(_0x434014){if(_0x434014){var _0x2fd15e=typeof _0x378abe[_0x9e6c('0x17')]===_0x9e6c('0x18')&&typeof _0x378abe[_0x9e6c('0x19')]===_0x9e6c('0x18');var _0x50af30=_0x434014[_0x9e6c('0x1a')];var _0x15e6b2=_0x2fd15e?0x0:_0x378abe['offset'];var _0x44a01e=_0x2fd15e?_0x434014[_0x9e6c('0x1a')]:_0x378abe[_0x9e6c('0x17')]+_0x378abe['limit'];var _0x403283;if(_0x44a01e>=_0x50af30){_0x44a01e=_0x50af30;_0x403283=0xc8;}else{_0x403283=0xce;}_0x136687[_0x9e6c('0x15')](_0x403283);return _0x136687['set'](_0x9e6c('0x1b'),_0x15e6b2+'-'+_0x44a01e+'/'+_0x50af30)[_0x9e6c('0x1c')](_0x434014);}return null;};}function patchUpdates(_0x4bd9a7){return function(_0xf7e67a){try{jsonpatch[_0x9e6c('0x1d')](_0xf7e67a,_0x4bd9a7,!![]);}catch(_0x3c14d4){return BPromise[_0x9e6c('0x1e')](_0x3c14d4);}return _0xf7e67a['save']();};}function saveUpdates(_0x42cca6,_0x1850ce){return function(_0x962dbd){if(_0x962dbd){return _0x962dbd[_0x9e6c('0x1f')](_0x42cca6)[_0x9e6c('0x20')](function(_0x1e85dd){return _0x1e85dd;});}return null;};}function removeEntity(_0x1ee7c8,_0x4a7934){return function(_0x5db3b7){if(_0x5db3b7){return _0x5db3b7['destroy']()[_0x9e6c('0x20')](function(){_0x1ee7c8['status'](0xcc)[_0x9e6c('0x16')]();});}};}function handleEntityNotFound(_0x3023b0,_0xddf380){return function(_0x36635c){if(!_0x36635c){_0x3023b0['sendStatus'](0x194);}return _0x36635c;};}function handleError(_0xe7e8d8,_0x41954d){_0x41954d=_0x41954d||0x1f4;return function(_0xe80de5){logger['error'](_0xe80de5['stack']);if(_0xe80de5[_0x9e6c('0x21')]){delete _0xe80de5['name'];}_0xe7e8d8[_0x9e6c('0x15')](_0x41954d)[_0x9e6c('0x22')](_0xe80de5);};}exports[_0x9e6c('0x23')]=function(_0x114eb8,_0x18bacc){var _0x524132={},_0x1ec2dd={},_0x2627d0={'count':0x0,'rows':[]};var _0x148bf8=_['map'](db[_0x9e6c('0x24')][_0x9e6c('0x25')],function(_0x198087){return{'name':_0x198087['fieldName'],'type':_0x198087[_0x9e6c('0x26')][_0x9e6c('0x27')]};});_0x1ec2dd[_0x9e6c('0x28')]=_[_0x9e6c('0x29')](_0x148bf8,'name');_0x1ec2dd['query']=_[_0x9e6c('0x2a')](_0x114eb8[_0x9e6c('0x2b')]);_0x1ec2dd['filters']=_[_0x9e6c('0x2c')](_0x1ec2dd[_0x9e6c('0x28')],_0x1ec2dd[_0x9e6c('0x2b')]);_0x524132[_0x9e6c('0x2d')]=_[_0x9e6c('0x2c')](_0x1ec2dd['model'],qs[_0x9e6c('0x2e')](_0x114eb8[_0x9e6c('0x2b')]['fields']));_0x524132[_0x9e6c('0x2d')]=_0x524132[_0x9e6c('0x2d')][_0x9e6c('0x2f')]?_0x524132['attributes']:_0x1ec2dd[_0x9e6c('0x28')];if(!_0x114eb8['query'][_0x9e6c('0x30')](_0x9e6c('0x31'))){_0x524132[_0x9e6c('0x19')]=qs[_0x9e6c('0x19')](_0x114eb8[_0x9e6c('0x2b')]['limit']);_0x524132[_0x9e6c('0x17')]=qs[_0x9e6c('0x17')](_0x114eb8[_0x9e6c('0x2b')]['offset']);}_0x524132['order']=qs[_0x9e6c('0x32')](_0x114eb8[_0x9e6c('0x2b')][_0x9e6c('0x32')]);_0x524132[_0x9e6c('0x33')]=qs['filters'](_[_0x9e6c('0x34')](_0x114eb8[_0x9e6c('0x2b')],_0x1ec2dd[_0x9e6c('0x35')]),_0x148bf8);if(_0x114eb8[_0x9e6c('0x2b')][_0x9e6c('0x36')]){_0x524132[_0x9e6c('0x33')]=_[_0x9e6c('0x37')](_0x524132[_0x9e6c('0x33')],{'$or':_[_0x9e6c('0x29')](_0x148bf8,function(_0x43195c){if(_0x43195c[_0x9e6c('0x26')]!==_0x9e6c('0x38')){var _0x256b82={};_0x256b82[_0x43195c[_0x9e6c('0x21')]]={'$like':'%'+_0x114eb8[_0x9e6c('0x2b')][_0x9e6c('0x36')]+'%'};return _0x256b82;}})});}_0x524132=_[_0x9e6c('0x37')]({},_0x524132,_0x114eb8[_0x9e6c('0x39')]);var _0x4e4947={'where':_0x524132[_0x9e6c('0x33')]};return db[_0x9e6c('0x24')][_0x9e6c('0x1a')](_0x4e4947)[_0x9e6c('0x20')](function(_0x255f0a){_0x2627d0[_0x9e6c('0x1a')]=_0x255f0a;if(_0x114eb8[_0x9e6c('0x2b')][_0x9e6c('0x3a')]){_0x524132[_0x9e6c('0x3b')]=[{'all':!![]}];}return db[_0x9e6c('0x24')][_0x9e6c('0x3c')](_0x524132);})[_0x9e6c('0x20')](function(_0x306aa9){_0x2627d0[_0x9e6c('0x3d')]=_0x306aa9;return _0x2627d0;})['then'](respondWithFilteredResult(_0x18bacc,_0x524132))['catch'](handleError(_0x18bacc,null));};exports[_0x9e6c('0x3e')]=function(_0x4ba9ca,_0x1c97f0){var _0x322e0a={'raw':!![],'where':{'id':_0x4ba9ca[_0x9e6c('0x3f')]['id']}},_0x58e8d4={};_0x58e8d4[_0x9e6c('0x28')]=_['keys'](db[_0x9e6c('0x24')][_0x9e6c('0x25')]);_0x58e8d4[_0x9e6c('0x2b')]=_['keys'](_0x4ba9ca[_0x9e6c('0x2b')]);_0x58e8d4['filters']=_[_0x9e6c('0x2c')](_0x58e8d4[_0x9e6c('0x28')],_0x58e8d4[_0x9e6c('0x2b')]);_0x322e0a[_0x9e6c('0x2d')]=_[_0x9e6c('0x2c')](_0x58e8d4['model'],qs[_0x9e6c('0x2e')](_0x4ba9ca['query'][_0x9e6c('0x2e')]));_0x322e0a[_0x9e6c('0x2d')]=_0x322e0a[_0x9e6c('0x2d')][_0x9e6c('0x2f')]?_0x322e0a[_0x9e6c('0x2d')]:_0x58e8d4[_0x9e6c('0x28')];if(_0x4ba9ca['query']['includeAll']){_0x322e0a[_0x9e6c('0x3b')]=[{'all':!![]}];}_0x322e0a=_[_0x9e6c('0x37')]({},_0x322e0a,_0x4ba9ca[_0x9e6c('0x39')]);return db[_0x9e6c('0x24')][_0x9e6c('0x40')](_0x322e0a)[_0x9e6c('0x20')](handleEntityNotFound(_0x1c97f0,null))[_0x9e6c('0x20')](respondWithResult(_0x1c97f0,null))[_0x9e6c('0x41')](handleError(_0x1c97f0,null));};exports[_0x9e6c('0x42')]=function(_0x40b6ce,_0x3e13ec){return db[_0x9e6c('0x24')][_0x9e6c('0x42')](_0x40b6ce[_0x9e6c('0x43')],{})[_0x9e6c('0x20')](respondWithResult(_0x3e13ec,0xc9))[_0x9e6c('0x41')](handleError(_0x3e13ec,null));};exports[_0x9e6c('0x1f')]=function(_0x221c81,_0x5a0758){if(_0x221c81[_0x9e6c('0x43')]['id']){delete _0x221c81['body']['id'];}return db['SalesforceField'][_0x9e6c('0x40')]({'where':{'id':_0x221c81[_0x9e6c('0x3f')]['id']}})[_0x9e6c('0x20')](handleEntityNotFound(_0x5a0758,null))[_0x9e6c('0x20')](saveUpdates(_0x221c81['body'],null))[_0x9e6c('0x20')](respondWithResult(_0x5a0758,null))[_0x9e6c('0x41')](handleError(_0x5a0758,null));};exports['destroy']=function(_0x504cdd,_0x5a0b1a){return db[_0x9e6c('0x24')][_0x9e6c('0x40')]({'where':{'id':_0x504cdd[_0x9e6c('0x3f')]['id']}})[_0x9e6c('0x20')](handleEntityNotFound(_0x5a0b1a,null))['then'](removeEntity(_0x5a0b1a,null))[_0x9e6c('0x41')](handleError(_0x5a0b1a,null));}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 725f99d..ebe86cd 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 _0x2b4e=['moment','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2b4e,0x74));var _0xe2b4=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x2b4e[_0x1d87fc];return _0x492b56;};'use strict';var _=require('lodash');var util=require(_0xe2b4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe2b4('0x1'));var BPromise=require('bluebird');var rp=require(_0xe2b4('0x2'));var fs=require('fs');var path=require(_0xe2b4('0x3'));var rimraf=require(_0xe2b4('0x4'));var config=require(_0xe2b4('0x5'));var attributes=require('./intSalesforceField.attributes');module[_0xe2b4('0x6')]=function(_0x4bfd02,_0x4c2f28){return _0x4bfd02[_0xe2b4('0x7')](_0xe2b4('0x8'),attributes,{'tableName':_0xe2b4('0x9'),'paranoid':![],'indexes':[{'name':_0xe2b4('0xa'),'fields':[_0xe2b4('0xb'),_0xe2b4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 0053f56..33843e9 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 _0x6db0=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6db0,0x1a1));var _0x06db=function(_0x4dd9db,_0x37a33b){_0x4dd9db=_0x4dd9db-0x0;var _0x24cbf0=_0x6db0[_0x4dd9db];return _0x24cbf0;};'use strict';var _=require(_0x06db('0x0'));var util=require('util');var moment=require(_0x06db('0x1'));var BPromise=require(_0x06db('0x2'));var rs=require(_0x06db('0x3'));var fs=require('fs');var Redis=require(_0x06db('0x4'));var db=require(_0x06db('0x5'))['db'];var utils=require(_0x06db('0x6'));var logger=require(_0x06db('0x7'))(_0x06db('0x8'));var config=require(_0x06db('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x06db('0xa')][_0x06db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5543a9,_0x24c077,_0x5921c0){return new BPromise(function(_0x20e340,_0x492fd5){return client['request'](_0x5543a9,_0x5921c0)[_0x06db('0xc')](function(_0x201ba2){logger[_0x06db('0xd')]('SalesforceField,\x20%s,\x20%s',_0x24c077,'request\x20sent');logger[_0x06db('0xe')](_0x06db('0xf'),_0x24c077,'request\x20sent',JSON[_0x06db('0x10')](_0x201ba2));if(_0x201ba2['error']){if(_0x201ba2[_0x06db('0x11')][_0x06db('0x12')]===0x1f4){logger[_0x06db('0x11')](_0x06db('0x13'),_0x24c077,_0x201ba2[_0x06db('0x11')]['message']);return _0x492fd5(_0x201ba2[_0x06db('0x11')][_0x06db('0x14')]);}logger['error'](_0x06db('0x13'),_0x24c077,_0x201ba2['error'][_0x06db('0x14')]);return _0x20e340(_0x201ba2[_0x06db('0x11')][_0x06db('0x14')]);}else{logger[_0x06db('0xd')](_0x06db('0x13'),_0x24c077,_0x06db('0x15'));_0x20e340(_0x201ba2[_0x06db('0x16')][_0x06db('0x14')]);}})[_0x06db('0x17')](function(_0x462ef8){logger[_0x06db('0x11')](_0x06db('0x13'),_0x24c077,_0x462ef8);_0x492fd5(_0x462ef8);});});} \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index cf5d064..0a44e6e 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 _0x564a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','update','exports','multer','util','path','connect-timeout'];(function(_0x5929fc,_0x2058ef){var _0x9fca4b=function(_0x5aafbd){while(--_0x5aafbd){_0x5929fc['push'](_0x5929fc['shift']());}};_0x9fca4b(++_0x2058ef);}(_0x564a,0x183));var _0xa564=function(_0x312d37,_0x19c884){_0x312d37=_0x312d37-0x0;var _0x5001b3=_0x564a[_0x312d37];return _0x5001b3;};'use strict';var multer=require(_0xa564('0x0'));var util=require(_0xa564('0x1'));var path=require(_0xa564('0x2'));var timeout=require(_0xa564('0x3'));var express=require(_0xa564('0x4'));var router=express[_0xa564('0x5')]();var fs_extra=require(_0xa564('0x6'));var auth=require(_0xa564('0x7'));var interaction=require(_0xa564('0x8'));var config=require(_0xa564('0x9'));var controller=require('./intServicenowAccount.controller');router[_0xa564('0xa')]('/',auth[_0xa564('0xb')](),controller[_0xa564('0xc')]);router[_0xa564('0xa')](_0xa564('0xd'),auth[_0xa564('0xb')](),controller[_0xa564('0xe')]);router[_0xa564('0xa')](_0xa564('0xf'),auth[_0xa564('0xb')](),controller[_0xa564('0x10')]);router[_0xa564('0xa')](_0xa564('0x11'),auth[_0xa564('0xb')](),controller[_0xa564('0x12')]);router['post']('/',auth[_0xa564('0xb')](),controller[_0xa564('0x13')]);router['post'](_0xa564('0xf'),auth[_0xa564('0xb')](),controller[_0xa564('0x14')]);router['put'](_0xa564('0xd'),auth[_0xa564('0xb')](),controller[_0xa564('0x15')]);router['delete'](_0xa564('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa564('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a989320..ec7ce1d 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 _0x4f69=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1f8490,_0xf8509b){var _0x295061=function(_0xa4b16){while(--_0xa4b16){_0x1f8490['push'](_0x1f8490['shift']());}};_0x295061(++_0xf8509b);}(_0x4f69,0x163));var _0x94f6=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x4f69[_0x1f6f84];return _0x177f40;};'use strict';var Sequelize=require(_0x94f6('0x0'));module[_0x94f6('0x1')]={'name':{'type':Sequelize[_0x94f6('0x2')]},'description':{'type':Sequelize[_0x94f6('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x94f6('0x3')},'password':{'type':Sequelize[_0x94f6('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x94f6('0x2')],'unique':_0x94f6('0x4')},'serverUrl':{'type':Sequelize[_0x94f6('0x2')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 60ca718..ad3692e 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 _0xf5ce=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ServicenowAccount','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','ServicenowConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','hold_reason','close_code','notify','incident_state','severity','category','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','opened_by','user_input','sys_domain','state','knowledge','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','result','log','incident\x20table\x20objects','remove','includes','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x2acf2b,_0x42b33f){var _0x4b659e=function(_0x4b22c1){while(--_0x4b22c1){_0x2acf2b['push'](_0x2acf2b['shift']());}};_0x4b659e(++_0x42b33f);}(_0xf5ce,0xa7));var _0xef5c=function(_0x34a512,_0x4533d2){_0x34a512=_0x34a512-0x0;var _0x3a22df=_0xf5ce[_0x34a512];return _0x3a22df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef5c('0x0'));var zipdir=require(_0xef5c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef5c('0x2'));var moment=require(_0xef5c('0x3'));var BPromise=require(_0xef5c('0x4'));var Mustache=require(_0xef5c('0x5'));var util=require(_0xef5c('0x6'));var path=require('path');var sox=require(_0xef5c('0x7'));var csv=require(_0xef5c('0x8'));var ejs=require(_0xef5c('0x9'));var fs=require('fs');var fs_extra=require(_0xef5c('0xa'));var _=require(_0xef5c('0xb'));var squel=require('squel');var crypto=require(_0xef5c('0xc'));var jsforce=require(_0xef5c('0xd'));var deskjs=require(_0xef5c('0xe'));var toCsv=require(_0xef5c('0x8'));var querystring=require(_0xef5c('0xf'));var Papa=require('papaparse');var Redis=require(_0xef5c('0x10'));var authService=require(_0xef5c('0x11'));var qs=require(_0xef5c('0x12'));var as=require(_0xef5c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xef5c('0x14'))(_0xef5c('0x15'));var utils=require(_0xef5c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xef5c('0x17'));var db=require(_0xef5c('0x18'))['db'];var integrations=require(_0xef5c('0x19'));function respondWithStatusCode(_0xee1273,_0x2fae33){_0x2fae33=_0x2fae33||0xcc;return function(_0x45f011){if(_0x45f011){return _0xee1273['sendStatus'](_0x2fae33);}return _0xee1273[_0xef5c('0x1a')](_0x2fae33)[_0xef5c('0x1b')]();};}function respondWithResult(_0x5437a7,_0xa10b75){_0xa10b75=_0xa10b75||0xc8;return function(_0x11f89f){if(_0x11f89f){return _0x5437a7[_0xef5c('0x1a')](_0xa10b75)[_0xef5c('0x1c')](_0x11f89f);}};}function respondWithFilteredResult(_0x53efee,_0xb8c3b4){return function(_0x160c82){if(_0x160c82){var _0x2922f8=typeof _0xb8c3b4['offset']==='undefined'&&typeof _0xb8c3b4[_0xef5c('0x1d')]===_0xef5c('0x1e');var _0x14e5c8=_0x160c82['count'];var _0x4ed1c4=_0x2922f8?0x0:_0xb8c3b4[_0xef5c('0x1f')];var _0x49e72a=_0x2922f8?_0x160c82[_0xef5c('0x20')]:_0xb8c3b4[_0xef5c('0x1f')]+_0xb8c3b4[_0xef5c('0x1d')];var _0x149b4e;if(_0x49e72a>=_0x14e5c8){_0x49e72a=_0x14e5c8;_0x149b4e=0xc8;}else{_0x149b4e=0xce;}_0x53efee[_0xef5c('0x1a')](_0x149b4e);return _0x53efee['set'](_0xef5c('0x21'),_0x4ed1c4+'-'+_0x49e72a+'/'+_0x14e5c8)['json'](_0x160c82);}return null;};}function patchUpdates(_0x4ee8c5){return function(_0x1ad14f){try{jsonpatch[_0xef5c('0x22')](_0x1ad14f,_0x4ee8c5,!![]);}catch(_0x2a05c7){return BPromise[_0xef5c('0x23')](_0x2a05c7);}return _0x1ad14f[_0xef5c('0x24')]();};}function saveUpdates(_0x129381,_0x24e891){return function(_0x4f4805){if(_0x4f4805){return _0x4f4805[_0xef5c('0x25')](_0x129381)[_0xef5c('0x26')](function(_0x12e166){return _0x12e166;});}return null;};}function removeEntity(_0x456247,_0x206617){return function(_0xf4f3e){if(_0xf4f3e){return _0xf4f3e[_0xef5c('0x27')]()[_0xef5c('0x26')](function(){_0x456247[_0xef5c('0x1a')](0xcc)[_0xef5c('0x1b')]();});}};}function handleEntityNotFound(_0x4a476c,_0xe9055a){return function(_0x5873cb){if(!_0x5873cb){_0x4a476c[_0xef5c('0x28')](0x194);}return _0x5873cb;};}function handleError(_0x52fc62,_0x2f3c20){_0x2f3c20=_0x2f3c20||0x1f4;return function(_0x473f3f){logger['error'](_0x473f3f[_0xef5c('0x29')]);if(_0x473f3f[_0xef5c('0x2a')]){delete _0x473f3f['name'];}_0x52fc62['status'](_0x2f3c20)[_0xef5c('0x2b')](_0x473f3f);};}exports['index']=function(_0x45c0cd,_0xa56de6){var _0x21e260={},_0x4ebb64={},_0x55e7ae={'count':0x0,'rows':[]};var _0xa3f0a3=_[_0xef5c('0x2c')](db['ServicenowAccount'][_0xef5c('0x2d')],function(_0x27a70f){return{'name':_0x27a70f['fieldName'],'type':_0x27a70f['type'][_0xef5c('0x2e')]};});_0x4ebb64[_0xef5c('0x2f')]=_[_0xef5c('0x2c')](_0xa3f0a3,'name');_0x4ebb64[_0xef5c('0x30')]=_[_0xef5c('0x31')](_0x45c0cd[_0xef5c('0x30')]);_0x4ebb64[_0xef5c('0x32')]=_[_0xef5c('0x33')](_0x4ebb64[_0xef5c('0x2f')],_0x4ebb64[_0xef5c('0x30')]);_0x21e260[_0xef5c('0x34')]=_[_0xef5c('0x33')](_0x4ebb64[_0xef5c('0x2f')],qs['fields'](_0x45c0cd['query'][_0xef5c('0x35')]));_0x21e260['attributes']=_0x21e260[_0xef5c('0x34')][_0xef5c('0x36')]?_0x21e260[_0xef5c('0x34')]:_0x4ebb64[_0xef5c('0x2f')];if(!_0x45c0cd[_0xef5c('0x30')][_0xef5c('0x37')](_0xef5c('0x38'))){_0x21e260['limit']=qs[_0xef5c('0x1d')](_0x45c0cd[_0xef5c('0x30')]['limit']);_0x21e260[_0xef5c('0x1f')]=qs[_0xef5c('0x1f')](_0x45c0cd[_0xef5c('0x30')][_0xef5c('0x1f')]);}_0x21e260[_0xef5c('0x39')]=qs[_0xef5c('0x3a')](_0x45c0cd[_0xef5c('0x30')][_0xef5c('0x3a')]);_0x21e260[_0xef5c('0x3b')]=qs['filters'](_[_0xef5c('0x3c')](_0x45c0cd['query'],_0x4ebb64[_0xef5c('0x32')]),_0xa3f0a3);if(_0x45c0cd['query']['filter']){_0x21e260[_0xef5c('0x3b')]=_[_0xef5c('0x3d')](_0x21e260[_0xef5c('0x3b')],{'$or':_[_0xef5c('0x2c')](_0xa3f0a3,function(_0x4cdbdf){if(_0x4cdbdf[_0xef5c('0x3e')]!==_0xef5c('0x3f')){var _0x41eadb={};_0x41eadb[_0x4cdbdf[_0xef5c('0x2a')]]={'$like':'%'+_0x45c0cd[_0xef5c('0x30')][_0xef5c('0x40')]+'%'};return _0x41eadb;}})});}_0x21e260=_[_0xef5c('0x3d')]({},_0x21e260,_0x45c0cd[_0xef5c('0x41')]);var _0x10eee9={'where':_0x21e260['where']};return db[_0xef5c('0x42')]['count'](_0x10eee9)[_0xef5c('0x26')](function(_0x4dfab6){_0x55e7ae['count']=_0x4dfab6;if(_0x45c0cd[_0xef5c('0x30')]['includeAll']){_0x21e260[_0xef5c('0x43')]=[{'all':!![]}];}return db[_0xef5c('0x42')]['findAll'](_0x21e260);})[_0xef5c('0x26')](function(_0x1b15c0){_0x55e7ae[_0xef5c('0x44')]=_0x1b15c0;return _0x55e7ae;})[_0xef5c('0x26')](respondWithFilteredResult(_0xa56de6,_0x21e260))[_0xef5c('0x45')](handleError(_0xa56de6,null));};exports[_0xef5c('0x46')]=function(_0x504ffa,_0x5ca248){var _0x2ba0e2={'raw':![],'where':{'id':_0x504ffa[_0xef5c('0x47')]['id']}},_0x9ce218={};_0x9ce218['model']=_[_0xef5c('0x31')](db[_0xef5c('0x42')][_0xef5c('0x2d')]);_0x9ce218[_0xef5c('0x30')]=_['keys'](_0x504ffa['query']);_0x9ce218[_0xef5c('0x32')]=_['intersection'](_0x9ce218[_0xef5c('0x2f')],_0x9ce218[_0xef5c('0x30')]);_0x2ba0e2[_0xef5c('0x34')]=_['intersection'](_0x9ce218['model'],qs[_0xef5c('0x35')](_0x504ffa[_0xef5c('0x30')]['fields']));_0x2ba0e2['attributes']=_0x2ba0e2[_0xef5c('0x34')][_0xef5c('0x36')]?_0x2ba0e2[_0xef5c('0x34')]:_0x9ce218[_0xef5c('0x2f')];if(_0x504ffa[_0xef5c('0x30')][_0xef5c('0x48')]){_0x2ba0e2[_0xef5c('0x43')]=[{'all':!![]}];}_0x2ba0e2=_[_0xef5c('0x3d')]({},_0x2ba0e2,_0x504ffa[_0xef5c('0x41')]);return db[_0xef5c('0x42')][_0xef5c('0x49')](_0x2ba0e2)['then'](handleEntityNotFound(_0x5ca248,null))[_0xef5c('0x26')](respondWithResult(_0x5ca248,null))[_0xef5c('0x45')](handleError(_0x5ca248,null));};exports[_0xef5c('0x4a')]=function(_0x23cae6,_0x4c599a){return db[_0xef5c('0x42')][_0xef5c('0x4a')](_0x23cae6[_0xef5c('0x4b')],{})[_0xef5c('0x26')](respondWithResult(_0x4c599a,0xc9))[_0xef5c('0x45')](handleError(_0x4c599a,null));};exports[_0xef5c('0x25')]=function(_0x2ad918,_0x2a84e3){if(_0x2ad918[_0xef5c('0x4b')]['id']){delete _0x2ad918[_0xef5c('0x4b')]['id'];}return db[_0xef5c('0x42')][_0xef5c('0x49')]({'where':{'id':_0x2ad918[_0xef5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a84e3,null))[_0xef5c('0x26')](saveUpdates(_0x2ad918['body'],null))[_0xef5c('0x26')](respondWithResult(_0x2a84e3,null))[_0xef5c('0x45')](handleError(_0x2a84e3,null));};exports['destroy']=function(_0x18be37,_0x55e0d0){return db[_0xef5c('0x42')][_0xef5c('0x49')]({'where':{'id':_0x18be37[_0xef5c('0x47')]['id']}})[_0xef5c('0x26')](handleEntityNotFound(_0x55e0d0,null))['then'](removeEntity(_0x55e0d0,null))[_0xef5c('0x45')](handleError(_0x55e0d0,null));};exports[_0xef5c('0x4c')]=function(_0x533e8b,_0x273a9a,_0x1bfe4d){var _0x1a596f={};var _0x35df6c={};var _0x4bb0ec;var _0x52db71;return db['ServicenowAccount'][_0xef5c('0x4d')]({'where':{'id':_0x533e8b[_0xef5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x273a9a,null))['then'](function(_0x41a3dc){if(_0x41a3dc){_0x4bb0ec=_0x41a3dc;_0x35df6c[_0xef5c('0x2f')]=_[_0xef5c('0x31')](db[_0xef5c('0x4e')][_0xef5c('0x2d')]);_0x35df6c[_0xef5c('0x30')]=_[_0xef5c('0x31')](_0x533e8b[_0xef5c('0x30')]);_0x35df6c['filters']=_['intersection'](_0x35df6c[_0xef5c('0x2f')],_0x35df6c[_0xef5c('0x30')]);_0x1a596f[_0xef5c('0x34')]=_[_0xef5c('0x33')](_0x35df6c['model'],qs[_0xef5c('0x35')](_0x533e8b['query'][_0xef5c('0x35')]));_0x1a596f[_0xef5c('0x34')]=_0x1a596f[_0xef5c('0x34')][_0xef5c('0x36')]?_0x1a596f[_0xef5c('0x34')]:_0x35df6c[_0xef5c('0x2f')];_0x1a596f[_0xef5c('0x39')]=qs[_0xef5c('0x3a')](_0x533e8b[_0xef5c('0x30')]['sort']);_0x1a596f['where']=qs[_0xef5c('0x32')](_['pick'](_0x533e8b['query'],_0x35df6c[_0xef5c('0x32')]));if(_0x533e8b[_0xef5c('0x30')][_0xef5c('0x40')]){_0x1a596f['where']=_['merge'](_0x1a596f[_0xef5c('0x3b')],{'$or':_['map'](_0x1a596f['attributes'],function(_0x4d3284){var _0xb94c15={};_0xb94c15[_0x4d3284]={'$like':'%'+_0x533e8b[_0xef5c('0x30')]['filter']+'%'};return _0xb94c15;})});}_0x1a596f=_[_0xef5c('0x3d')]({},_0x1a596f,_0x533e8b[_0xef5c('0x41')]);return _0x4bb0ec[_0xef5c('0x4c')](_0x1a596f);}})[_0xef5c('0x26')](function(_0x4b5150){if(_0x4b5150){_0x52db71=_0x4b5150['length'];if(!_0x533e8b[_0xef5c('0x30')][_0xef5c('0x37')](_0xef5c('0x38'))){_0x1a596f['limit']=qs[_0xef5c('0x1d')](_0x533e8b['query'][_0xef5c('0x1d')]);_0x1a596f[_0xef5c('0x1f')]=qs[_0xef5c('0x1f')](_0x533e8b[_0xef5c('0x30')][_0xef5c('0x1f')]);}return _0x4bb0ec['getConfigurations'](_0x1a596f);}})[_0xef5c('0x26')](function(_0x4ec03a){if(_0x4ec03a){return _0x4ec03a?{'count':_0x52db71,'rows':_0x4ec03a}:null;}})[_0xef5c('0x26')](respondWithResult(_0x273a9a,null))[_0xef5c('0x45')](handleError(_0x273a9a,null));};exports['addConfiguration']=function(_0x5e60cd,_0x6e887a,_0x369313){if(_0x5e60cd['body']['id']){delete _0x5e60cd[_0xef5c('0x4b')]['id'];}return db['ServicenowAccount'][_0xef5c('0x4d')]({'where':{'id':_0x5e60cd[_0xef5c('0x47')]['id']}})[_0xef5c('0x26')](handleEntityNotFound(_0x6e887a,null))['then'](function(_0x3ebdbb){if(_0x3ebdbb){_0x5e60cd['body'][_0xef5c('0x4f')]=_0x3ebdbb['id'];_0x5e60cd[_0xef5c('0x4b')][_0xef5c('0x50')]=integrations[_0xef5c('0x51')](_0x5e60cd[_0xef5c('0x4b')]['channel'],_0x5e60cd[_0xef5c('0x4b')][_0xef5c('0x3e')]);_0x5e60cd[_0xef5c('0x4b')][_0xef5c('0x52')]=integrations[_0xef5c('0x53')](_0x5e60cd[_0xef5c('0x4b')][_0xef5c('0x54')],_0x5e60cd[_0xef5c('0x4b')][_0xef5c('0x3e')]);return db[_0xef5c('0x4e')][_0xef5c('0x4a')](_0x5e60cd[_0xef5c('0x4b')],{'include':[{'model':db['ServicenowField'],'as':_0xef5c('0x50')},{'model':db['ServicenowField'],'as':_0xef5c('0x52')}]});}return null;})[_0xef5c('0x26')](respondWithResult(_0x6e887a,null))['catch'](handleError(_0x6e887a,null));};exports[_0xef5c('0x55')]=function(_0x546fa8,_0x230df6,_0x1bc0a8){var _0xe30138=['made_sla',_0xef5c('0x56'),'knowledge','subcategory',_0xef5c('0x57'),_0xef5c('0x58'),_0xef5c('0x59'),_0xef5c('0x5a'),_0xef5c('0x5b')];var _0x2dce5f=['parent',_0xef5c('0x5c'),_0xef5c('0x5d'),_0xef5c('0x5e'),_0xef5c('0x5f'),_0xef5c('0x60'),_0xef5c('0x61'),'hold_reason','approval_history',_0xef5c('0x62'),_0xef5c('0x63'),'sys_updated_by',_0xef5c('0x64'),_0xef5c('0x65'),'sys_created_on',_0xef5c('0x66'),_0xef5c('0x67'),'sys_created_by',_0xef5c('0x68'),_0xef5c('0x39'),_0xef5c('0x69'),'closed_at',_0xef5c('0x6a'),_0xef5c('0x6b'),_0xef5c('0x6c'),_0xef5c('0x6d'),_0xef5c('0x6e'),_0xef5c('0x6f'),'priority','sys_domain_path','rfc',_0xef5c('0x70'),_0xef5c('0x71'),_0xef5c('0x72'),'business_duration',_0xef5c('0x73'),_0xef5c('0x74'),_0xef5c('0x75'),_0xef5c('0x76'),_0xef5c('0x77'),_0xef5c('0x78'),_0xef5c('0x79'),'work_notes',_0xef5c('0x7a'),_0xef5c('0x57'),'correlation_display',_0xef5c('0x7b'),_0xef5c('0x7c'),'assignment_group',_0xef5c('0x7d'),_0xef5c('0x7e'),_0xef5c('0x7f'),_0xef5c('0x80'),_0xef5c('0x58'),_0xef5c('0x81'),_0xef5c('0x82'),'closed_by','follow_up',_0xef5c('0x83'),_0xef5c('0x84'),_0xef5c('0x85'),_0xef5c('0x86'),'incident_state',_0xef5c('0x87'),_0xef5c('0x88'),_0xef5c('0x89'),_0xef5c('0x8a'),'activity_due',_0xef5c('0x8b'),_0xef5c('0x5a'),_0xef5c('0x8c'),_0xef5c('0x8d'),'approval',_0xef5c('0x8e'),_0xef5c('0x8f'),_0xef5c('0x90'),_0xef5c('0x91'),'sys_tags',_0xef5c('0x92'),'upon_approval',_0xef5c('0x93'),_0xef5c('0x94'),'category'];var _0x531b10='';var _0x403350='';var _0x227980=[];var _0x30f668='';var _0x155fef='';var _0x78bbc1=[];var _0x4d40d6='';var _0x1b3d68='';var _0xfd88bb={};var _0x1cbfec='';return db[_0xef5c('0x42')]['findOne']({'where':{'id':_0x546fa8[_0xef5c('0x47')]['id']},'attributes':['id',_0xef5c('0x95'),_0xef5c('0x96'),'email',_0xef5c('0x97'),'serverUrl']})[_0xef5c('0x26')](handleEntityNotFound(_0x230df6,null))['then'](function(_0x4664d4){if(_0x4664d4){_0x1cbfec=_0x4664d4[_0xef5c('0x97')];var _0x4ee464=_0x1cbfec[_0xef5c('0x98')](-0x1);if(_0x4ee464==='/'){_0x1cbfec=_0x1cbfec[_0xef5c('0x99')](0x0,_0x1cbfec[_0xef5c('0x9a')](_0x4ee464));}_0x1b3d68=util[_0xef5c('0x9b')](_0xef5c('0x9c'),_0x1cbfec);_0x4d40d6=util[_0xef5c('0x9b')](_0xef5c('0x9d'),_0x1cbfec);_0xfd88bb={'user':_0x4664d4[_0xef5c('0x95')],'pass':_0x4664d4['password']};var _0x11c124={'method':'GET','uri':_0x1b3d68+'incident?sysparm_display_value=all','auth':_0xfd88bb,'json':!![]};return rp(_0x11c124);}})[_0xef5c('0x26')](function(_0x2887f3){if(_0x2887f3[_0xef5c('0x9e')][_0xef5c('0x36')]>0x0){_0x531b10=_0x2887f3[_0xef5c('0x9e')];}console[_0xef5c('0x9f')](_0xef5c('0xa0'),_0x531b10);_0x78bbc1=[];_0x403350=Object['assign']([],_0x531b10);_[_0xef5c('0xa1')](_0x403350,function(_0x572a27){return!_0xe30138[_0xef5c('0xa2')](_0x572a27[_0xef5c('0x2a')]);});_0x403350['forEach'](function(_0x4a8a41){var _0x4d8026=createFieldObject(_0x4d40d6,_0xfd88bb,_0x4a8a41['internalType'],_0x4a8a41[_0xef5c('0x2a')],_0x4a8a41[_0xef5c('0xa3')],![]);_0x78bbc1[_0xef5c('0xa4')](_0x4d8026);});return Promise[_0xef5c('0xa5')](_0x78bbc1);})[_0xef5c('0x26')](function(_0x59f1ba){_0x227980=_0x59f1ba;_0x30f668=Object[_0xef5c('0xa6')]([],_0x531b10);console[_0xef5c('0x9f')](_0xef5c('0xa7'),_0x531b10);_[_0xef5c('0xa1')](_0x30f668,function(_0x5bf32c){return _0x2dce5f[_0xef5c('0xa2')](_0x5bf32c['name']);});console[_0xef5c('0x9f')](_0xef5c('0xa8'),_0x30f668);_0x78bbc1=[];_0x30f668[_0xef5c('0xa9')](function(_0x22722c){var _0x5b8b5b=createFieldObject(_0x4d40d6,_0xfd88bb,_0x22722c[_0xef5c('0xaa')],_0x22722c[_0xef5c('0x2a')],_0x22722c[_0xef5c('0xa3')],!![]);_0x78bbc1[_0xef5c('0xa4')](_0x5b8b5b);});return Promise[_0xef5c('0xa5')](_0x78bbc1);})[_0xef5c('0x26')](function(_0x21d856){_0x155fef=_0x21d856;var _0x138d09=_0x227980[_0xef5c('0xab')](_0x155fef);return{'count':_0x138d09[_0xef5c('0x36')],'rows':_0x138d09};})['then'](respondWithResult(_0x230df6,null))[_0xef5c('0x45')](function(_0x10267f){console[_0xef5c('0x9f')](_0xef5c('0xac')+_0x10267f);var _0x358be6=_0x546fa8[_0xef5c('0x30')][_0xef5c('0xad')]?0x1f4:_0x10267f['statusCode']||0x1f4;logger['error'](_0x10267f[_0xef5c('0x29')]);delete _0x10267f[_0xef5c('0x2a')];if(_0x358be6===0x191){_0x358be6=0x190;}_0x230df6[_0xef5c('0x1a')](_0x358be6)[_0xef5c('0x2b')](_0x546fa8[_0xef5c('0x30')][_0xef5c('0xad')]?{'message':_0xef5c('0xae'),'statusCode':_0x10267f[_0xef5c('0xaf')]}:_0x10267f);});};function createFieldObject(_0x169dd3,_0x16f431,_0x38452c,_0xb3b2b8,_0x4505f8,_0x5e6cd7){return new Promise(function(_0xf2988f,_0xf5063a){var _0x2f60eb={'id':_0xb3b2b8,'name':_0x4505f8,'custom':_0x5e6cd7};if(_0x38452c===_0xef5c('0xb0')){_0x2f60eb[_0xef5c('0x41')]=[{'name':'True','value':_0xef5c('0xb1')},{'name':_0xef5c('0xb2'),'value':'false'}];_0xf2988f(_0x2f60eb);}else{var _0x2b8a39={'method':_0xef5c('0xb3'),'uri':_0x169dd3+_0xef5c('0xb4')+_0xb3b2b8,'auth':_0x16f431,'json':!![]};return rp(_0x2b8a39)[_0xef5c('0x26')](function(_0x10d7a2){var _0x23b39b=[];if(_0x10d7a2[_0xef5c('0x9e')][_0xef5c('0x36')]>0x0){_0x10d7a2['result'][_0xef5c('0xa9')](function(_0xf3b21f){if(_0xf3b21f[_0xef5c('0xb5')]===_0xef5c('0xb6')){var _0x4315b8={'name':_0xf3b21f[_0xef5c('0xa3')],'value':_0xf3b21f['value']};_0x23b39b[_0xef5c('0xa4')](_0x4315b8);}});}_0x2f60eb[_0xef5c('0x41')]=_0x23b39b;if(_0x2f60eb[_0xef5c('0x41')][_0xef5c('0x36')]>0x0){_0xf2988f(_0x2f60eb);}else{if(_0x5e6cd7==![]){_0xf2988f();}else{_0xf2988f(_0x2f60eb);}}});}});} \ No newline at end of file +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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f812466..41394de 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x247ca4,_0x1e7ec5){_0x247ca4=_0x247ca4-0x0;var _0x432c92=_0x7fbe[_0x247ca4];return _0x432c92;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index a1f2c14..5bd94e9 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 _0xb7db=['http','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','debug','ShowServicenowAccount','ServicenowAccount','find','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x437873,_0x1d3846){var _0x341e60=function(_0xb13da0){while(--_0xb13da0){_0x437873['push'](_0x437873['shift']());}};_0x341e60(++_0x1d3846);}(_0xb7db,0x19a));var _0xbb7d=function(_0x5b1211,_0x1d1341){_0x5b1211=_0x5b1211-0x0;var _0x138dfc=_0xb7db[_0x5b1211];return _0x138dfc;};'use strict';var _=require(_0xbb7d('0x0'));var util=require(_0xbb7d('0x1'));var moment=require(_0xbb7d('0x2'));var BPromise=require(_0xbb7d('0x3'));var rs=require(_0xbb7d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb7d('0x5'))['db'];var utils=require(_0xbb7d('0x6'));var logger=require('../../config/logger')(_0xbb7d('0x7'));var config=require(_0xbb7d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbb7d('0x9')][_0xbb7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9bfe18,_0x5e70f7,_0x2d32e4){return new BPromise(function(_0x4c7f90,_0x11c92f){return client['request'](_0x9bfe18,_0x2d32e4)['then'](function(_0x203bde){logger[_0xbb7d('0xb')](_0xbb7d('0xc'),_0x5e70f7,_0xbb7d('0xd'));logger['debug'](_0xbb7d('0xe'),_0x5e70f7,_0xbb7d('0xd'),JSON[_0xbb7d('0xf')](_0x203bde));if(_0x203bde[_0xbb7d('0x10')]){if(_0x203bde['error'][_0xbb7d('0x11')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5e70f7,_0x203bde[_0xbb7d('0x10')][_0xbb7d('0x12')]);return _0x11c92f(_0x203bde[_0xbb7d('0x10')][_0xbb7d('0x12')]);}logger['error'](_0xbb7d('0xc'),_0x5e70f7,_0x203bde['error'][_0xbb7d('0x12')]);return _0x4c7f90(_0x203bde[_0xbb7d('0x10')]['message']);}else{logger[_0xbb7d('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x5e70f7,'request\x20sent');_0x4c7f90(_0x203bde[_0xbb7d('0x13')]['message']);}})[_0xbb7d('0x14')](function(_0x5fd8c0){logger[_0xbb7d('0x10')](_0xbb7d('0xc'),_0x5e70f7,_0x5fd8c0);_0x11c92f(_0x5fd8c0);});});}exports['GetServicenowAccount']=function(_0x51d90f){var _0x5ec381=this;return new Promise(function(_0x6918ad,_0x96376c){return db['ServicenowAccount']['findAll']({'raw':_0x51d90f['options']?_0x51d90f[_0xbb7d('0x15')][_0xbb7d('0x16')]===undefined?!![]:![]:!![],'where':_0x51d90f[_0xbb7d('0x15')]?_0x51d90f[_0xbb7d('0x15')][_0xbb7d('0x17')]||null:null,'attributes':_0x51d90f[_0xbb7d('0x15')]?_0x51d90f[_0xbb7d('0x15')][_0xbb7d('0x18')]||null:null,'limit':_0x51d90f[_0xbb7d('0x15')]?_0x51d90f[_0xbb7d('0x15')][_0xbb7d('0x19')]||null:null,'include':_0x51d90f[_0xbb7d('0x15')]?_0x51d90f[_0xbb7d('0x15')][_0xbb7d('0x1a')]?_[_0xbb7d('0x1b')](_0x51d90f[_0xbb7d('0x15')]['include'],function(_0x5cb833){return{'model':db[_0x5cb833['model']],'as':_0x5cb833['as'],'attributes':_0x5cb833['attributes'],'include':_0x5cb833[_0xbb7d('0x1a')]?_[_0xbb7d('0x1b')](_0x5cb833[_0xbb7d('0x1a')],function(_0x4e8dea){return{'model':db[_0x4e8dea[_0xbb7d('0x1c')]],'as':_0x4e8dea['as'],'attributes':_0x4e8dea['attributes'],'include':_0x4e8dea[_0xbb7d('0x1a')]?_[_0xbb7d('0x1b')](_0x4e8dea[_0xbb7d('0x1a')],function(_0x7ad627){return{'model':db[_0x7ad627[_0xbb7d('0x1c')]],'as':_0x7ad627['as'],'attributes':_0x7ad627[_0xbb7d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ac35b){logger['info'](_0xbb7d('0x1d'),_0x51d90f);logger[_0xbb7d('0x1e')]('GetServicenowAccount',_0x51d90f,JSON['stringify'](_0x3ac35b));_0x6918ad(_0x3ac35b);})[_0xbb7d('0x14')](function(_0xf3653c){logger['error'](_0xbb7d('0x1d'),_0xf3653c[_0xbb7d('0x12')],_0x51d90f);_0x96376c(_0x5ec381['error'](0x1f4,_0xf3653c[_0xbb7d('0x12')]));});});};exports[_0xbb7d('0x1f')]=function(_0x5135c8){var _0x184afa=this;return new Promise(function(_0x379f66,_0x47dbf5){return db[_0xbb7d('0x20')][_0xbb7d('0x21')]({'raw':_0x5135c8['options']?_0x5135c8[_0xbb7d('0x15')][_0xbb7d('0x16')]===undefined?!![]:![]:!![],'where':_0x5135c8[_0xbb7d('0x15')]?_0x5135c8[_0xbb7d('0x15')]['where']||null:null,'attributes':_0x5135c8[_0xbb7d('0x15')]?_0x5135c8[_0xbb7d('0x15')]['attributes']||null:null,'include':_0x5135c8['options']?_0x5135c8['options'][_0xbb7d('0x1a')]?_[_0xbb7d('0x1b')](_0x5135c8[_0xbb7d('0x15')][_0xbb7d('0x1a')],function(_0x10f886){return{'model':db[_0x10f886['model']],'as':_0x10f886['as'],'attributes':_0x10f886[_0xbb7d('0x18')],'include':_0x10f886[_0xbb7d('0x1a')]?_[_0xbb7d('0x1b')](_0x10f886[_0xbb7d('0x1a')],function(_0x50d143){return{'model':db[_0x50d143[_0xbb7d('0x1c')]],'as':_0x50d143['as'],'attributes':_0x50d143[_0xbb7d('0x18')],'include':_0x50d143[_0xbb7d('0x1a')]?_[_0xbb7d('0x1b')](_0x50d143[_0xbb7d('0x1a')],function(_0x2536e5){return{'model':db[_0x2536e5[_0xbb7d('0x1c')]],'as':_0x2536e5['as'],'attributes':_0x2536e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb7d('0x22')](function(_0x50f837){logger['info'](_0xbb7d('0x1f'),_0x5135c8);logger['debug'](_0xbb7d('0x1f'),_0x5135c8,JSON[_0xbb7d('0xf')](_0x50f837));_0x379f66(_0x50f837);})['catch'](function(_0x44b1f3){logger[_0xbb7d('0x10')](_0xbb7d('0x1f'),_0x44b1f3['message'],_0x5135c8);_0x47dbf5(_0x184afa['error'](0x1f4,_0x44b1f3[_0xbb7d('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d604b3d..6d06eb9 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 _0xcbbb=['getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcbbb,0x1a7));var _0xbcbb=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xcbbb[_0xe45118];return _0x15e15d;};'use strict';var multer=require(_0xbcbb('0x0'));var util=require(_0xbcbb('0x1'));var path=require(_0xbcbb('0x2'));var timeout=require(_0xbcbb('0x3'));var express=require(_0xbcbb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbcbb('0x5'));var interaction=require(_0xbcbb('0x6'));var config=require(_0xbcbb('0x7'));var controller=require(_0xbcbb('0x8'));router[_0xbcbb('0x9')]('/',auth[_0xbcbb('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbcbb('0xb')]);router[_0xbcbb('0x9')]('/:id/fields',auth[_0xbcbb('0xa')](),controller[_0xbcbb('0xc')]);router[_0xbcbb('0x9')](_0xbcbb('0xd'),auth['isAuthenticated'](),controller[_0xbcbb('0xe')]);router[_0xbcbb('0x9')](_0xbcbb('0xf'),auth[_0xbcbb('0xa')](),controller[_0xbcbb('0x10')]);router['post']('/',auth[_0xbcbb('0xa')](),controller[_0xbcbb('0x11')]);router[_0xbcbb('0x12')](_0xbcbb('0x13'),auth[_0xbcbb('0xa')](),controller[_0xbcbb('0x14')]);router[_0xbcbb('0x15')](_0xbcbb('0x13'),auth['isAuthenticated'](),controller[_0xbcbb('0x16')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 009b33f..28db5ed 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 _0xf20f=['sequelize','exports','STRING'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xf20f,0x75));var _0xff20=function(_0x2c05c7,_0x116499){_0x2c05c7=_0x2c05c7-0x0;var _0xd3ace8=_0xf20f[_0x2c05c7];return _0xd3ace8;};'use strict';var Sequelize=require(_0xff20('0x0'));module[_0xff20('0x1')]={'name':{'type':Sequelize[_0xff20('0x2')]},'description':{'type':Sequelize[_0xff20('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 474f616..fe81222 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 _0x4431=['fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','ServicenowField','order','pick','hasOwnProperty','getSubjects','getDescriptions','findOne','nolimit','eml-format','rimraf','zip-dir'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4431,0x1b9));var _0x1443=function(_0x91d9ab,_0x517949){_0x91d9ab=_0x91d9ab-0x0;var _0x6c1add=_0x4431[_0x91d9ab];return _0x6c1add;};'use strict';var emlformat=require(_0x1443('0x0'));var rimraf=require(_0x1443('0x1'));var zipdir=require(_0x1443('0x2'));var jsonpatch=require(_0x1443('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1443('0x4'));var Mustache=require(_0x1443('0x5'));var util=require(_0x1443('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1443('0x7'));var ejs=require(_0x1443('0x8'));var fs=require('fs');var fs_extra=require(_0x1443('0x9'));var _=require(_0x1443('0xa'));var squel=require('squel');var crypto=require(_0x1443('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1443('0xc'));var toCsv=require(_0x1443('0x7'));var querystring=require(_0x1443('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1443('0xe'));var qs=require(_0x1443('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1443('0x10'));var logger=require(_0x1443('0x11'))('api');var utils=require(_0x1443('0x12'));var config=require(_0x1443('0x13'));var licenseUtil=require(_0x1443('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48ed06,_0x4a0e6c){_0x4a0e6c=_0x4a0e6c||0xcc;return function(_0x25295e){if(_0x25295e){return _0x48ed06['sendStatus'](_0x4a0e6c);}return _0x48ed06[_0x1443('0x15')](_0x4a0e6c)[_0x1443('0x16')]();};}function respondWithResult(_0x4d404a,_0x2a5567){_0x2a5567=_0x2a5567||0xc8;return function(_0x581b89){if(_0x581b89){return _0x4d404a[_0x1443('0x15')](_0x2a5567)[_0x1443('0x17')](_0x581b89);}};}function respondWithFilteredResult(_0x528a7a,_0x30362c){return function(_0x84db4e){if(_0x84db4e){var _0x727b1c=typeof _0x30362c[_0x1443('0x18')]===_0x1443('0x19')&&typeof _0x30362c[_0x1443('0x1a')]==='undefined';var _0x2cfa2c=_0x84db4e['count'];var _0x20f1c2=_0x727b1c?0x0:_0x30362c['offset'];var _0x401737=_0x727b1c?_0x84db4e[_0x1443('0x1b')]:_0x30362c[_0x1443('0x18')]+_0x30362c[_0x1443('0x1a')];var _0xdffc2b;if(_0x401737>=_0x2cfa2c){_0x401737=_0x2cfa2c;_0xdffc2b=0xc8;}else{_0xdffc2b=0xce;}_0x528a7a[_0x1443('0x15')](_0xdffc2b);return _0x528a7a[_0x1443('0x1c')](_0x1443('0x1d'),_0x20f1c2+'-'+_0x401737+'/'+_0x2cfa2c)[_0x1443('0x17')](_0x84db4e);}return null;};}function patchUpdates(_0x1e950c){return function(_0x1ed58a){try{jsonpatch['apply'](_0x1ed58a,_0x1e950c,!![]);}catch(_0x56af4f){return BPromise['reject'](_0x56af4f);}return _0x1ed58a['save']();};}function saveUpdates(_0x105bf1,_0x2e089b){return function(_0x468e08){if(_0x468e08){return _0x468e08[_0x1443('0x1e')](_0x105bf1)[_0x1443('0x1f')](function(_0x3b8db6){return _0x3b8db6;});}return null;};}function removeEntity(_0x229766,_0x16068a){return function(_0x12ccc4){if(_0x12ccc4){return _0x12ccc4['destroy']()[_0x1443('0x1f')](function(){_0x229766[_0x1443('0x15')](0xcc)[_0x1443('0x16')]();});}};}function handleEntityNotFound(_0x561969,_0x56b097){return function(_0x1e941b){if(!_0x1e941b){_0x561969[_0x1443('0x20')](0x194);}return _0x1e941b;};}function handleError(_0x3f0ff7,_0x2e2552){_0x2e2552=_0x2e2552||0x1f4;return function(_0x17aeac){logger[_0x1443('0x21')](_0x17aeac[_0x1443('0x22')]);if(_0x17aeac[_0x1443('0x23')]){delete _0x17aeac[_0x1443('0x23')];}_0x3f0ff7[_0x1443('0x15')](_0x2e2552)['send'](_0x17aeac);};}exports[_0x1443('0x24')]=function(_0x5bd9ea,_0x2907b6){var _0x1d8c8c={},_0x18890c={},_0x4de0ce={'count':0x0,'rows':[]};var _0x536995=_[_0x1443('0x25')](db[_0x1443('0x26')][_0x1443('0x27')],function(_0x210fdc){return{'name':_0x210fdc['fieldName'],'type':_0x210fdc[_0x1443('0x28')]['key']};});_0x18890c[_0x1443('0x29')]=_['map'](_0x536995,_0x1443('0x23'));_0x18890c[_0x1443('0x2a')]=_[_0x1443('0x2b')](_0x5bd9ea[_0x1443('0x2a')]);_0x18890c[_0x1443('0x2c')]=_['intersection'](_0x18890c['model'],_0x18890c['query']);_0x1d8c8c['attributes']=_[_0x1443('0x2d')](_0x18890c[_0x1443('0x29')],qs[_0x1443('0x2e')](_0x5bd9ea[_0x1443('0x2a')][_0x1443('0x2e')]));_0x1d8c8c[_0x1443('0x2f')]=_0x1d8c8c[_0x1443('0x2f')][_0x1443('0x30')]?_0x1d8c8c[_0x1443('0x2f')]:_0x18890c[_0x1443('0x29')];if(!_0x5bd9ea[_0x1443('0x2a')]['hasOwnProperty']('nolimit')){_0x1d8c8c[_0x1443('0x1a')]=qs[_0x1443('0x1a')](_0x5bd9ea[_0x1443('0x2a')][_0x1443('0x1a')]);_0x1d8c8c['offset']=qs[_0x1443('0x18')](_0x5bd9ea['query']['offset']);}_0x1d8c8c['order']=qs[_0x1443('0x31')](_0x5bd9ea[_0x1443('0x2a')][_0x1443('0x31')]);_0x1d8c8c[_0x1443('0x32')]=qs['filters'](_['pick'](_0x5bd9ea[_0x1443('0x2a')],_0x18890c[_0x1443('0x2c')]),_0x536995);if(_0x5bd9ea[_0x1443('0x2a')][_0x1443('0x33')]){_0x1d8c8c[_0x1443('0x32')]=_[_0x1443('0x34')](_0x1d8c8c[_0x1443('0x32')],{'$or':_[_0x1443('0x25')](_0x536995,function(_0x2c94ae){if(_0x2c94ae['type']!==_0x1443('0x35')){var _0x1fc767={};_0x1fc767[_0x2c94ae['name']]={'$like':'%'+_0x5bd9ea['query'][_0x1443('0x33')]+'%'};return _0x1fc767;}})});}_0x1d8c8c=_[_0x1443('0x34')]({},_0x1d8c8c,_0x5bd9ea[_0x1443('0x36')]);var _0x424762={'where':_0x1d8c8c[_0x1443('0x32')]};return db[_0x1443('0x26')][_0x1443('0x1b')](_0x424762)[_0x1443('0x1f')](function(_0x4a3c21){_0x4de0ce[_0x1443('0x1b')]=_0x4a3c21;if(_0x5bd9ea[_0x1443('0x2a')][_0x1443('0x37')]){_0x1d8c8c[_0x1443('0x38')]=[{'all':!![]}];}return db[_0x1443('0x26')][_0x1443('0x39')](_0x1d8c8c);})[_0x1443('0x1f')](function(_0xa964a4){_0x4de0ce[_0x1443('0x3a')]=_0xa964a4;return _0x4de0ce;})['then'](respondWithFilteredResult(_0x2907b6,_0x1d8c8c))['catch'](handleError(_0x2907b6,null));};exports[_0x1443('0x3b')]=function(_0x126bc0,_0x55b532){var _0x13f912={'raw':![],'where':{'id':_0x126bc0[_0x1443('0x3c')]['id']}},_0x4d6f84={};_0x4d6f84[_0x1443('0x29')]=_['keys'](db[_0x1443('0x26')][_0x1443('0x27')]);_0x4d6f84[_0x1443('0x2a')]=_[_0x1443('0x2b')](_0x126bc0[_0x1443('0x2a')]);_0x4d6f84['filters']=_[_0x1443('0x2d')](_0x4d6f84[_0x1443('0x29')],_0x4d6f84[_0x1443('0x2a')]);_0x13f912[_0x1443('0x2f')]=_[_0x1443('0x2d')](_0x4d6f84[_0x1443('0x29')],qs[_0x1443('0x2e')](_0x126bc0[_0x1443('0x2a')][_0x1443('0x2e')]));_0x13f912['attributes']=_0x13f912[_0x1443('0x2f')][_0x1443('0x30')]?_0x13f912['attributes']:_0x4d6f84[_0x1443('0x29')];if(_0x126bc0[_0x1443('0x2a')][_0x1443('0x37')]){_0x13f912[_0x1443('0x38')]=[{'all':!![]}];}_0x13f912=_[_0x1443('0x34')]({},_0x13f912,_0x126bc0[_0x1443('0x36')]);return db[_0x1443('0x26')][_0x1443('0x3d')](_0x13f912)[_0x1443('0x1f')](handleEntityNotFound(_0x55b532,null))[_0x1443('0x1f')](respondWithResult(_0x55b532,null))[_0x1443('0x3e')](handleError(_0x55b532,null));};exports[_0x1443('0x3f')]=function(_0x393478,_0x309f4f){return db[_0x1443('0x26')][_0x1443('0x3f')](_0x393478[_0x1443('0x40')],{})['then'](respondWithResult(_0x309f4f,0xc9))['catch'](handleError(_0x309f4f,null));};exports[_0x1443('0x1e')]=function(_0x861011,_0x520024){if(_0x861011[_0x1443('0x40')]['id']){delete _0x861011[_0x1443('0x40')]['id'];}return db[_0x1443('0x26')][_0x1443('0x3d')]({'where':{'id':_0x861011[_0x1443('0x3c')]['id']}})[_0x1443('0x1f')](handleEntityNotFound(_0x520024,null))[_0x1443('0x1f')](saveUpdates(_0x861011[_0x1443('0x40')],null))[_0x1443('0x1f')](respondWithResult(_0x520024,null))[_0x1443('0x3e')](handleError(_0x520024,null));};exports['destroy']=function(_0x2d6ec2,_0x3b9881){return db['ServicenowConfiguration'][_0x1443('0x3d')]({'where':{'id':_0x2d6ec2['params']['id']}})[_0x1443('0x1f')](handleEntityNotFound(_0x3b9881,null))[_0x1443('0x1f')](removeEntity(_0x3b9881,null))[_0x1443('0x3e')](handleError(_0x3b9881,null));};exports[_0x1443('0x41')]=function(_0x40a298,_0x31d525,_0x52cf0b){var _0x526f3f={};var _0x29e7c8={};var _0x3c0b28;var _0x4508a4;return db[_0x1443('0x26')]['findOne']({'where':{'id':_0x40a298[_0x1443('0x3c')]['id']}})[_0x1443('0x1f')](handleEntityNotFound(_0x31d525,null))['then'](function(_0x3f6f36){if(_0x3f6f36){_0x3c0b28=_0x3f6f36;_0x29e7c8[_0x1443('0x29')]=_['keys'](db[_0x1443('0x42')][_0x1443('0x27')]);_0x29e7c8['query']=_[_0x1443('0x2b')](_0x40a298['query']);_0x29e7c8[_0x1443('0x2c')]=_[_0x1443('0x2d')](_0x29e7c8[_0x1443('0x29')],_0x29e7c8[_0x1443('0x2a')]);_0x526f3f[_0x1443('0x2f')]=_[_0x1443('0x2d')](_0x29e7c8[_0x1443('0x29')],qs[_0x1443('0x2e')](_0x40a298['query'][_0x1443('0x2e')]));_0x526f3f[_0x1443('0x2f')]=_0x526f3f[_0x1443('0x2f')][_0x1443('0x30')]?_0x526f3f[_0x1443('0x2f')]:_0x29e7c8['model'];_0x526f3f[_0x1443('0x43')]=qs['sort'](_0x40a298['query'][_0x1443('0x31')]);_0x526f3f[_0x1443('0x32')]=qs[_0x1443('0x2c')](_[_0x1443('0x44')](_0x40a298[_0x1443('0x2a')],_0x29e7c8[_0x1443('0x2c')]));if(_0x40a298[_0x1443('0x2a')][_0x1443('0x33')]){_0x526f3f[_0x1443('0x32')]=_[_0x1443('0x34')](_0x526f3f[_0x1443('0x32')],{'$or':_[_0x1443('0x25')](_0x526f3f['attributes'],function(_0x1b1e4f){var _0x4c0d64={};_0x4c0d64[_0x1b1e4f]={'$like':'%'+_0x40a298[_0x1443('0x2a')][_0x1443('0x33')]+'%'};return _0x4c0d64;})});}_0x526f3f=_[_0x1443('0x34')]({},_0x526f3f,_0x40a298[_0x1443('0x36')]);return _0x3c0b28[_0x1443('0x41')](_0x526f3f);}})['then'](function(_0x689925){if(_0x689925){_0x4508a4=_0x689925[_0x1443('0x30')];if(!_0x40a298[_0x1443('0x2a')][_0x1443('0x45')]('nolimit')){_0x526f3f['limit']=qs['limit'](_0x40a298[_0x1443('0x2a')]['limit']);_0x526f3f[_0x1443('0x18')]=qs[_0x1443('0x18')](_0x40a298[_0x1443('0x2a')][_0x1443('0x18')]);}return _0x3c0b28[_0x1443('0x41')](_0x526f3f);}})[_0x1443('0x1f')](function(_0xd5893e){if(_0xd5893e){return _0xd5893e?{'count':_0x4508a4,'rows':_0xd5893e}:null;}})[_0x1443('0x1f')](respondWithResult(_0x31d525,null))[_0x1443('0x3e')](handleError(_0x31d525,null));};exports['getSubjects']=function(_0xa0cc7c,_0xd4e3d2,_0x4d5348){var _0x5b62ea={};var _0x74ec9e={};var _0x4dab97;var _0x931700;return db[_0x1443('0x26')]['findOne']({'where':{'id':_0xa0cc7c[_0x1443('0x3c')]['id']}})[_0x1443('0x1f')](handleEntityNotFound(_0xd4e3d2,null))[_0x1443('0x1f')](function(_0x4be92a){if(_0x4be92a){_0x4dab97=_0x4be92a;_0x74ec9e['model']=_['keys'](db[_0x1443('0x42')][_0x1443('0x27')]);_0x74ec9e[_0x1443('0x2a')]=_[_0x1443('0x2b')](_0xa0cc7c['query']);_0x74ec9e[_0x1443('0x2c')]=_['intersection'](_0x74ec9e[_0x1443('0x29')],_0x74ec9e[_0x1443('0x2a')]);_0x5b62ea[_0x1443('0x2f')]=_[_0x1443('0x2d')](_0x74ec9e[_0x1443('0x29')],qs[_0x1443('0x2e')](_0xa0cc7c[_0x1443('0x2a')][_0x1443('0x2e')]));_0x5b62ea[_0x1443('0x2f')]=_0x5b62ea['attributes']['length']?_0x5b62ea['attributes']:_0x74ec9e[_0x1443('0x29')];_0x5b62ea[_0x1443('0x43')]=qs[_0x1443('0x31')](_0xa0cc7c['query']['sort']);_0x5b62ea[_0x1443('0x32')]=qs[_0x1443('0x2c')](_[_0x1443('0x44')](_0xa0cc7c[_0x1443('0x2a')],_0x74ec9e[_0x1443('0x2c')]));if(_0xa0cc7c['query'][_0x1443('0x33')]){_0x5b62ea['where']=_['merge'](_0x5b62ea['where'],{'$or':_['map'](_0x5b62ea[_0x1443('0x2f')],function(_0x13b831){var _0x4d3d8b={};_0x4d3d8b[_0x13b831]={'$like':'%'+_0xa0cc7c[_0x1443('0x2a')][_0x1443('0x33')]+'%'};return _0x4d3d8b;})});}_0x5b62ea=_[_0x1443('0x34')]({},_0x5b62ea,_0xa0cc7c[_0x1443('0x36')]);return _0x4dab97[_0x1443('0x46')](_0x5b62ea);}})[_0x1443('0x1f')](function(_0x2969a6){if(_0x2969a6){_0x931700=_0x2969a6[_0x1443('0x30')];if(!_0xa0cc7c[_0x1443('0x2a')][_0x1443('0x45')]('nolimit')){_0x5b62ea[_0x1443('0x1a')]=qs['limit'](_0xa0cc7c['query'][_0x1443('0x1a')]);_0x5b62ea[_0x1443('0x18')]=qs[_0x1443('0x18')](_0xa0cc7c[_0x1443('0x2a')][_0x1443('0x18')]);}return _0x4dab97[_0x1443('0x46')](_0x5b62ea);}})['then'](function(_0x5a7227){if(_0x5a7227){return _0x5a7227?{'count':_0x931700,'rows':_0x5a7227}:null;}})['then'](respondWithResult(_0xd4e3d2,null))[_0x1443('0x3e')](handleError(_0xd4e3d2,null));};exports[_0x1443('0x47')]=function(_0x21561e,_0x50afbe,_0x322b79){var _0x399ddb={};var _0xec16eb={};var _0xa042b6;var _0x14d3f2;return db[_0x1443('0x26')][_0x1443('0x48')]({'where':{'id':_0x21561e[_0x1443('0x3c')]['id']}})[_0x1443('0x1f')](handleEntityNotFound(_0x50afbe,null))[_0x1443('0x1f')](function(_0x294411){if(_0x294411){_0xa042b6=_0x294411;_0xec16eb[_0x1443('0x29')]=_[_0x1443('0x2b')](db[_0x1443('0x42')][_0x1443('0x27')]);_0xec16eb[_0x1443('0x2a')]=_['keys'](_0x21561e['query']);_0xec16eb[_0x1443('0x2c')]=_[_0x1443('0x2d')](_0xec16eb[_0x1443('0x29')],_0xec16eb[_0x1443('0x2a')]);_0x399ddb[_0x1443('0x2f')]=_[_0x1443('0x2d')](_0xec16eb[_0x1443('0x29')],qs['fields'](_0x21561e[_0x1443('0x2a')][_0x1443('0x2e')]));_0x399ddb['attributes']=_0x399ddb[_0x1443('0x2f')]['length']?_0x399ddb[_0x1443('0x2f')]:_0xec16eb[_0x1443('0x29')];_0x399ddb[_0x1443('0x43')]=qs[_0x1443('0x31')](_0x21561e['query'][_0x1443('0x31')]);_0x399ddb[_0x1443('0x32')]=qs[_0x1443('0x2c')](_[_0x1443('0x44')](_0x21561e[_0x1443('0x2a')],_0xec16eb[_0x1443('0x2c')]));if(_0x21561e[_0x1443('0x2a')]['filter']){_0x399ddb[_0x1443('0x32')]=_[_0x1443('0x34')](_0x399ddb[_0x1443('0x32')],{'$or':_['map'](_0x399ddb['attributes'],function(_0x246f0c){var _0x3b958b={};_0x3b958b[_0x246f0c]={'$like':'%'+_0x21561e['query'][_0x1443('0x33')]+'%'};return _0x3b958b;})});}_0x399ddb=_[_0x1443('0x34')]({},_0x399ddb,_0x21561e[_0x1443('0x36')]);return _0xa042b6['getDescriptions'](_0x399ddb);}})[_0x1443('0x1f')](function(_0x4ac0aa){if(_0x4ac0aa){_0x14d3f2=_0x4ac0aa[_0x1443('0x30')];if(!_0x21561e['query']['hasOwnProperty'](_0x1443('0x49'))){_0x399ddb[_0x1443('0x1a')]=qs[_0x1443('0x1a')](_0x21561e[_0x1443('0x2a')][_0x1443('0x1a')]);_0x399ddb[_0x1443('0x18')]=qs[_0x1443('0x18')](_0x21561e[_0x1443('0x2a')][_0x1443('0x18')]);}return _0xa042b6['getDescriptions'](_0x399ddb);}})[_0x1443('0x1f')](function(_0x50ffa5){if(_0x50ffa5){return _0x50ffa5?{'count':_0x14d3f2,'rows':_0x50ffa5}:null;}})[_0x1443('0x1f')](respondWithResult(_0x50afbe,null))[_0x1443('0x3e')](handleError(_0x50afbe,null));}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 341a545..a9bdaca 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 _0xae1b=['util','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xae1b,0x96));var _0xbae1=function(_0x416df5,_0x5cd9e7){_0x416df5=_0x416df5-0x0;var _0x53235b=_0xae1b[_0x416df5];return _0x53235b;};'use strict';var _=require('lodash');var util=require(_0xbae1('0x0'));var logger=require('../../config/logger')(_0xbae1('0x1'));var moment=require(_0xbae1('0x2'));var BPromise=require(_0xbae1('0x3'));var rp=require(_0xbae1('0x4'));var fs=require('fs');var path=require(_0xbae1('0x5'));var rimraf=require(_0xbae1('0x6'));var config=require('../../config/environment');var attributes=require(_0xbae1('0x7'));module[_0xbae1('0x8')]=function(_0x5b8d9d,_0x447cd9){return _0x5b8d9d['define'](_0xbae1('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index bb1a20d..065723c 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 _0x8b02=['rpc','../../config/environment','jayson/promise','http','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','randomstring','ioredis','../../mysqldb'];(function(_0x52f1e6,_0xf70489){var _0x21f104=function(_0xb89f9e){while(--_0xb89f9e){_0x52f1e6['push'](_0x52f1e6['shift']());}};_0x21f104(++_0xf70489);}(_0x8b02,0x94));var _0x28b0=function(_0x53276c,_0x537154){_0x53276c=_0x53276c-0x0;var _0x2aae0b=_0x8b02[_0x53276c];return _0x2aae0b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x28b0('0x0'));var BPromise=require('bluebird');var rs=require(_0x28b0('0x1'));var fs=require('fs');var Redis=require(_0x28b0('0x2'));var db=require(_0x28b0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28b0('0x4'));var config=require(_0x28b0('0x5'));var jayson=require(_0x28b0('0x6'));var client=jayson['client'][_0x28b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a053c,_0x169a90,_0x3c8a91){return new BPromise(function(_0x138684,_0x2e83f3){return client['request'](_0x1a053c,_0x3c8a91)[_0x28b0('0x8')](function(_0x163f1d){logger['info'](_0x28b0('0x9'),_0x169a90,'request\x20sent');logger[_0x28b0('0xa')](_0x28b0('0xb'),_0x169a90,_0x28b0('0xc'),JSON[_0x28b0('0xd')](_0x163f1d));if(_0x163f1d[_0x28b0('0xe')]){if(_0x163f1d[_0x28b0('0xe')][_0x28b0('0xf')]===0x1f4){logger[_0x28b0('0xe')](_0x28b0('0x9'),_0x169a90,_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);return _0x2e83f3(_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);}logger[_0x28b0('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x169a90,_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);return _0x138684(_0x163f1d[_0x28b0('0xe')][_0x28b0('0x10')]);}else{logger[_0x28b0('0x11')](_0x28b0('0x9'),_0x169a90,_0x28b0('0xc'));_0x138684(_0x163f1d['result'][_0x28b0('0x10')]);}})[_0x28b0('0x12')](function(_0xe1750){logger[_0x28b0('0xe')](_0x28b0('0x9'),_0x169a90,_0xe1750);_0x2e83f3(_0xe1750);});});} \ No newline at end of file +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 diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7229d20..f1161f8 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 _0xb88b=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xb88b,0x10d));var _0xbb88=function(_0x3f863b,_0x2c14c8){_0x3f863b=_0x3f863b-0x0;var _0x1e385a=_0xb88b[_0x3f863b];return _0x1e385a;};'use strict';var multer=require('multer');var util=require(_0xbb88('0x0'));var path=require(_0xbb88('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb88('0x2')]();var fs_extra=require(_0xbb88('0x3'));var auth=require(_0xbb88('0x4'));var interaction=require(_0xbb88('0x5'));var config=require(_0xbb88('0x6'));var controller=require(_0xbb88('0x7'));router['get']('/',auth[_0xbb88('0x8')](),controller['index']);router[_0xbb88('0x9')]('/:id',auth[_0xbb88('0x8')](),controller[_0xbb88('0xa')]);router[_0xbb88('0xb')]('/',auth[_0xbb88('0x8')](),controller[_0xbb88('0xc')]);router[_0xbb88('0xd')](_0xbb88('0xe'),auth['isAuthenticated'](),controller[_0xbb88('0xf')]);router['delete']('/:id',auth[_0xbb88('0x8')](),controller[_0xbb88('0x10')]);module[_0xbb88('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e5bd48c..39b1a44 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 _0x1330=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x11c551,_0x1028d2){var _0x14756e=function(_0x5e2b3f){while(--_0x5e2b3f){_0x11c551['push'](_0x11c551['shift']());}};_0x14756e(++_0x1028d2);}(_0x1330,0xce));var _0x0133=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x1330[_0x680821];return _0x3f132c;};'use strict';var Sequelize=require(_0x0133('0x0'));module['exports']={'type':{'type':Sequelize[_0x0133('0x1')](_0x0133('0x2'),_0x0133('0x3'),_0x0133('0x4'),_0x0133('0x5'),_0x0133('0x6')),'defaultValue':_0x0133('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0133('0x7')]},'keyType':{'type':Sequelize[_0x0133('0x1')](_0x0133('0x2'),_0x0133('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0133('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0133('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0133('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 440784e..70fa353 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 _0x5511=['to-csv','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','reject','save','destroy','then','sendStatus','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox'];(function(_0xa85f4,_0x197ba3){var _0x33b215=function(_0x41183e){while(--_0x41183e){_0xa85f4['push'](_0xa85f4['shift']());}};_0x33b215(++_0x197ba3);}(_0x5511,0x1a6));var _0x1551=function(_0x4b3b96,_0x5ea6d6){_0x4b3b96=_0x4b3b96-0x0;var _0x504bdb=_0x5511[_0x4b3b96];return _0x504bdb;};'use strict';var emlformat=require(_0x1551('0x0'));var rimraf=require(_0x1551('0x1'));var zipdir=require(_0x1551('0x2'));var jsonpatch=require(_0x1551('0x3'));var rp=require(_0x1551('0x4'));var moment=require(_0x1551('0x5'));var BPromise=require(_0x1551('0x6'));var Mustache=require('mustache');var util=require(_0x1551('0x7'));var path=require(_0x1551('0x8'));var sox=require(_0x1551('0x9'));var csv=require(_0x1551('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1551('0xb'));var squel=require(_0x1551('0xc'));var crypto=require('crypto');var jsforce=require(_0x1551('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1551('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1551('0xe'));var qs=require(_0x1551('0xf'));var as=require(_0x1551('0x10'));var hardwareService=require(_0x1551('0x11'));var logger=require(_0x1551('0x12'))(_0x1551('0x13'));var utils=require(_0x1551('0x14'));var config=require(_0x1551('0x15'));var licenseUtil=require(_0x1551('0x16'));var db=require(_0x1551('0x17'))['db'];function respondWithStatusCode(_0x257bb8,_0x21ddaf){_0x21ddaf=_0x21ddaf||0xcc;return function(_0x3774cb){if(_0x3774cb){return _0x257bb8['sendStatus'](_0x21ddaf);}return _0x257bb8[_0x1551('0x18')](_0x21ddaf)[_0x1551('0x19')]();};}function respondWithResult(_0x3257b9,_0x1f4852){_0x1f4852=_0x1f4852||0xc8;return function(_0x33504b){if(_0x33504b){return _0x3257b9['status'](_0x1f4852)[_0x1551('0x1a')](_0x33504b);}};}function respondWithFilteredResult(_0x57961e,_0x40fc5c){return function(_0x58bdf4){if(_0x58bdf4){var _0x165bcb=typeof _0x40fc5c['offset']===_0x1551('0x1b')&&typeof _0x40fc5c[_0x1551('0x1c')]===_0x1551('0x1b');var _0xdb0a4a=_0x58bdf4[_0x1551('0x1d')];var _0x33eaa1=_0x165bcb?0x0:_0x40fc5c['offset'];var _0x1ef48a=_0x165bcb?_0x58bdf4[_0x1551('0x1d')]:_0x40fc5c[_0x1551('0x1e')]+_0x40fc5c[_0x1551('0x1c')];var _0x237e36;if(_0x1ef48a>=_0xdb0a4a){_0x1ef48a=_0xdb0a4a;_0x237e36=0xc8;}else{_0x237e36=0xce;}_0x57961e['status'](_0x237e36);return _0x57961e[_0x1551('0x1f')]('Content-Range',_0x33eaa1+'-'+_0x1ef48a+'/'+_0xdb0a4a)[_0x1551('0x1a')](_0x58bdf4);}return null;};}function patchUpdates(_0xd2fd0e){return function(_0x5196e4){try{jsonpatch['apply'](_0x5196e4,_0xd2fd0e,!![]);}catch(_0x24a4bd){return BPromise[_0x1551('0x20')](_0x24a4bd);}return _0x5196e4[_0x1551('0x21')]();};}function saveUpdates(_0x404d8b,_0x31dea5){return function(_0x191107){if(_0x191107){return _0x191107['update'](_0x404d8b)['then'](function(_0x507a0a){return _0x507a0a;});}return null;};}function removeEntity(_0x2cbcff,_0x2f640d){return function(_0x16a4c0){if(_0x16a4c0){return _0x16a4c0[_0x1551('0x22')]()[_0x1551('0x23')](function(){_0x2cbcff[_0x1551('0x18')](0xcc)[_0x1551('0x19')]();});}};}function handleEntityNotFound(_0x4c66bf,_0x14a024){return function(_0x4191a2){if(!_0x4191a2){_0x4c66bf[_0x1551('0x24')](0x194);}return _0x4191a2;};}function handleError(_0xb41819,_0x8367a7){_0x8367a7=_0x8367a7||0x1f4;return function(_0x415f73){logger['error'](_0x415f73[_0x1551('0x25')]);if(_0x415f73[_0x1551('0x26')]){delete _0x415f73[_0x1551('0x26')];}_0xb41819[_0x1551('0x18')](_0x8367a7)[_0x1551('0x27')](_0x415f73);};}exports[_0x1551('0x28')]=function(_0x85ccf6,_0x5a8938){var _0x3309d2={},_0x3c7b94={},_0xc47731={'count':0x0,'rows':[]};var _0x56039b=_[_0x1551('0x29')](db[_0x1551('0x2a')][_0x1551('0x2b')],function(_0x199267){return{'name':_0x199267[_0x1551('0x2c')],'type':_0x199267[_0x1551('0x2d')]['key']};});_0x3c7b94['model']=_[_0x1551('0x29')](_0x56039b,_0x1551('0x26'));_0x3c7b94[_0x1551('0x2e')]=_[_0x1551('0x2f')](_0x85ccf6[_0x1551('0x2e')]);_0x3c7b94[_0x1551('0x30')]=_[_0x1551('0x31')](_0x3c7b94[_0x1551('0x32')],_0x3c7b94[_0x1551('0x2e')]);_0x3309d2[_0x1551('0x33')]=_[_0x1551('0x31')](_0x3c7b94['model'],qs[_0x1551('0x34')](_0x85ccf6[_0x1551('0x2e')][_0x1551('0x34')]));_0x3309d2[_0x1551('0x33')]=_0x3309d2[_0x1551('0x33')][_0x1551('0x35')]?_0x3309d2['attributes']:_0x3c7b94[_0x1551('0x32')];if(!_0x85ccf6['query'][_0x1551('0x36')](_0x1551('0x37'))){_0x3309d2[_0x1551('0x1c')]=qs['limit'](_0x85ccf6[_0x1551('0x2e')][_0x1551('0x1c')]);_0x3309d2[_0x1551('0x1e')]=qs[_0x1551('0x1e')](_0x85ccf6[_0x1551('0x2e')][_0x1551('0x1e')]);}_0x3309d2[_0x1551('0x38')]=qs[_0x1551('0x39')](_0x85ccf6['query'][_0x1551('0x39')]);_0x3309d2[_0x1551('0x3a')]=qs[_0x1551('0x30')](_['pick'](_0x85ccf6[_0x1551('0x2e')],_0x3c7b94[_0x1551('0x30')]),_0x56039b);if(_0x85ccf6[_0x1551('0x2e')][_0x1551('0x3b')]){_0x3309d2[_0x1551('0x3a')]=_[_0x1551('0x3c')](_0x3309d2[_0x1551('0x3a')],{'$or':_['map'](_0x56039b,function(_0x1eb201){if(_0x1eb201[_0x1551('0x2d')]!==_0x1551('0x3d')){var _0x55a45b={};_0x55a45b[_0x1eb201[_0x1551('0x26')]]={'$like':'%'+_0x85ccf6[_0x1551('0x2e')]['filter']+'%'};return _0x55a45b;}})});}_0x3309d2=_['merge']({},_0x3309d2,_0x85ccf6['options']);var _0x3c8a0a={'where':_0x3309d2[_0x1551('0x3a')]};return db['ServicenowField'][_0x1551('0x1d')](_0x3c8a0a)[_0x1551('0x23')](function(_0x407588){_0xc47731[_0x1551('0x1d')]=_0x407588;if(_0x85ccf6['query'][_0x1551('0x3e')]){_0x3309d2[_0x1551('0x3f')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x3309d2);})[_0x1551('0x23')](function(_0x21319d){_0xc47731['rows']=_0x21319d;return _0xc47731;})['then'](respondWithFilteredResult(_0x5a8938,_0x3309d2))[_0x1551('0x40')](handleError(_0x5a8938,null));};exports[_0x1551('0x41')]=function(_0x46f7ba,_0x16072f){var _0x41d5bb={'raw':!![],'where':{'id':_0x46f7ba[_0x1551('0x42')]['id']}},_0x1f80a7={};_0x1f80a7[_0x1551('0x32')]=_['keys'](db[_0x1551('0x2a')][_0x1551('0x2b')]);_0x1f80a7[_0x1551('0x2e')]=_[_0x1551('0x2f')](_0x46f7ba[_0x1551('0x2e')]);_0x1f80a7[_0x1551('0x30')]=_[_0x1551('0x31')](_0x1f80a7['model'],_0x1f80a7[_0x1551('0x2e')]);_0x41d5bb[_0x1551('0x33')]=_[_0x1551('0x31')](_0x1f80a7[_0x1551('0x32')],qs[_0x1551('0x34')](_0x46f7ba['query'][_0x1551('0x34')]));_0x41d5bb[_0x1551('0x33')]=_0x41d5bb[_0x1551('0x33')][_0x1551('0x35')]?_0x41d5bb[_0x1551('0x33')]:_0x1f80a7[_0x1551('0x32')];if(_0x46f7ba['query'][_0x1551('0x3e')]){_0x41d5bb[_0x1551('0x3f')]=[{'all':!![]}];}_0x41d5bb=_['merge']({},_0x41d5bb,_0x46f7ba[_0x1551('0x43')]);return db[_0x1551('0x2a')][_0x1551('0x44')](_0x41d5bb)[_0x1551('0x23')](handleEntityNotFound(_0x16072f,null))[_0x1551('0x23')](respondWithResult(_0x16072f,null))[_0x1551('0x40')](handleError(_0x16072f,null));};exports[_0x1551('0x45')]=function(_0x589d2b,_0x4b469b){return db[_0x1551('0x2a')][_0x1551('0x45')](_0x589d2b[_0x1551('0x46')],{})[_0x1551('0x23')](respondWithResult(_0x4b469b,0xc9))['catch'](handleError(_0x4b469b,null));};exports[_0x1551('0x47')]=function(_0x222289,_0x4b5a90){if(_0x222289[_0x1551('0x46')]['id']){delete _0x222289[_0x1551('0x46')]['id'];}return db[_0x1551('0x2a')][_0x1551('0x44')]({'where':{'id':_0x222289[_0x1551('0x42')]['id']}})[_0x1551('0x23')](handleEntityNotFound(_0x4b5a90,null))[_0x1551('0x23')](saveUpdates(_0x222289['body'],null))[_0x1551('0x23')](respondWithResult(_0x4b5a90,null))[_0x1551('0x40')](handleError(_0x4b5a90,null));};exports[_0x1551('0x22')]=function(_0x554ee9,_0x1a4097){return db[_0x1551('0x2a')]['find']({'where':{'id':_0x554ee9[_0x1551('0x42')]['id']}})[_0x1551('0x23')](handleEntityNotFound(_0x1a4097,null))[_0x1551('0x23')](removeEntity(_0x1a4097,null))[_0x1551('0x40')](handleError(_0x1a4097,null));}; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 81bfce8..12e7f82 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 _0x5d1f=['bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x5ccb33,_0xa4bcbe){var _0x4c1db8=function(_0x195494){while(--_0x195494){_0x5ccb33['push'](_0x5ccb33['shift']());}};_0x4c1db8(++_0xa4bcbe);}(_0x5d1f,0x168));var _0xf5d1=function(_0x426816,_0x2331ad){_0x426816=_0x426816-0x0;var _0x3f57b4=_0x5d1f[_0x426816];return _0x3f57b4;};'use strict';var _=require(_0xf5d1('0x0'));var util=require(_0xf5d1('0x1'));var logger=require(_0xf5d1('0x2'))('api');var moment=require(_0xf5d1('0x3'));var BPromise=require(_0xf5d1('0x4'));var rp=require(_0xf5d1('0x5'));var fs=require('fs');var path=require(_0xf5d1('0x6'));var rimraf=require('rimraf');var config=require(_0xf5d1('0x7'));var attributes=require(_0xf5d1('0x8'));module[_0xf5d1('0x9')]=function(_0x23b0a9,_0x245290){return _0x23b0a9['define'](_0xf5d1('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xf5d1('0xb'),'fields':['idField',_0xf5d1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index b3f6095..a7659c2 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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 _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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 43c4d8c..041d9ab 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(_0x5cb767,_0x29ad7e){var _0x59e363=function(_0x52edf2){while(--_0x52edf2){_0x5cb767['push'](_0x5cb767['shift']());}};_0x59e363(++_0x29ad7e);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3bf8fc5..4b7974e 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(_0x2439d4,_0x1eed28){var _0x2a6349=function(_0x4a788b){while(--_0x4a788b){_0x2439d4['push'](_0x2439d4['shift']());}};_0x2a6349(++_0x1eed28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 95fdb8f..05e93ae 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 _0x3bb3=['find','create','body','getConfigurations','SugarcrmConfiguration','findOne','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','slice','lastIndexOf','format','%s%s','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','destroy','then','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x3bb3,0x9c));var _0x33bb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3bb3[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x33bb('0x0'));var rimraf=require(_0x33bb('0x1'));var zipdir=require(_0x33bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x33bb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x33bb('0x4'));var util=require(_0x33bb('0x5'));var path=require(_0x33bb('0x6'));var sox=require(_0x33bb('0x7'));var csv=require(_0x33bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33bb('0x9'));var _=require(_0x33bb('0xa'));var squel=require('squel');var crypto=require(_0x33bb('0xb'));var jsforce=require(_0x33bb('0xc'));var deskjs=require(_0x33bb('0xd'));var toCsv=require(_0x33bb('0x8'));var querystring=require(_0x33bb('0xe'));var Papa=require('papaparse');var Redis=require(_0x33bb('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x33bb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bb('0x11'))(_0x33bb('0x12'));var utils=require('../../config/utils');var config=require(_0x33bb('0x13'));var licenseUtil=require(_0x33bb('0x14'));var db=require(_0x33bb('0x15'))['db'];var integrations=require(_0x33bb('0x16'));function respondWithStatusCode(_0x4da02f,_0x35f1de){_0x35f1de=_0x35f1de||0xcc;return function(_0xe4dc97){if(_0xe4dc97){return _0x4da02f[_0x33bb('0x17')](_0x35f1de);}return _0x4da02f[_0x33bb('0x18')](_0x35f1de)[_0x33bb('0x19')]();};}function respondWithResult(_0xabc41f,_0x67daee){_0x67daee=_0x67daee||0xc8;return function(_0xf4d55e){if(_0xf4d55e){return _0xabc41f[_0x33bb('0x18')](_0x67daee)[_0x33bb('0x1a')](_0xf4d55e);}};}function respondWithFilteredResult(_0x5d690f,_0x26a46b){return function(_0x150f19){if(_0x150f19){var _0x2135ef=typeof _0x26a46b['offset']===_0x33bb('0x1b')&&typeof _0x26a46b[_0x33bb('0x1c')]==='undefined';var _0x2b170d=_0x150f19[_0x33bb('0x1d')];var _0x3cb093=_0x2135ef?0x0:_0x26a46b[_0x33bb('0x1e')];var _0x40e618=_0x2135ef?_0x150f19[_0x33bb('0x1d')]:_0x26a46b[_0x33bb('0x1e')]+_0x26a46b[_0x33bb('0x1c')];var _0x71c92c;if(_0x40e618>=_0x2b170d){_0x40e618=_0x2b170d;_0x71c92c=0xc8;}else{_0x71c92c=0xce;}_0x5d690f[_0x33bb('0x18')](_0x71c92c);return _0x5d690f[_0x33bb('0x1f')]('Content-Range',_0x3cb093+'-'+_0x40e618+'/'+_0x2b170d)[_0x33bb('0x1a')](_0x150f19);}return null;};}function patchUpdates(_0x34934d){return function(_0x45194e){try{jsonpatch[_0x33bb('0x20')](_0x45194e,_0x34934d,!![]);}catch(_0x2c02a4){return BPromise[_0x33bb('0x21')](_0x2c02a4);}return _0x45194e['save']();};}function saveUpdates(_0x355c35,_0x2a8d3c){return function(_0x189dcb){if(_0x189dcb){return _0x189dcb['update'](_0x355c35)['then'](function(_0x2a30e9){return _0x2a30e9;});}return null;};}function removeEntity(_0x43cbfd,_0x2192c8){return function(_0x5e4bc4){if(_0x5e4bc4){return _0x5e4bc4[_0x33bb('0x22')]()[_0x33bb('0x23')](function(){_0x43cbfd['status'](0xcc)[_0x33bb('0x19')]();});}};}function handleEntityNotFound(_0x519c41,_0x397698){return function(_0x2cef84){if(!_0x2cef84){_0x519c41['sendStatus'](0x194);}return _0x2cef84;};}function handleError(_0x23ac43,_0x146c33){_0x146c33=_0x146c33||0x1f4;return function(_0x122739){logger['error'](_0x122739[_0x33bb('0x24')]);if(_0x122739[_0x33bb('0x25')]){delete _0x122739['name'];}_0x23ac43[_0x33bb('0x18')](_0x146c33)[_0x33bb('0x26')](_0x122739);};}exports[_0x33bb('0x27')]=function(_0x948246,_0x351aa2){var _0x62d62d={},_0xb3e25f={},_0x463d00={'count':0x0,'rows':[]};var _0x55408b=_[_0x33bb('0x28')](db[_0x33bb('0x29')][_0x33bb('0x2a')],function(_0x5a86fc){return{'name':_0x5a86fc[_0x33bb('0x2b')],'type':_0x5a86fc[_0x33bb('0x2c')]['key']};});_0xb3e25f[_0x33bb('0x2d')]=_[_0x33bb('0x28')](_0x55408b,_0x33bb('0x25'));_0xb3e25f[_0x33bb('0x2e')]=_[_0x33bb('0x2f')](_0x948246[_0x33bb('0x2e')]);_0xb3e25f[_0x33bb('0x30')]=_[_0x33bb('0x31')](_0xb3e25f[_0x33bb('0x2d')],_0xb3e25f[_0x33bb('0x2e')]);_0x62d62d[_0x33bb('0x32')]=_[_0x33bb('0x31')](_0xb3e25f[_0x33bb('0x2d')],qs[_0x33bb('0x33')](_0x948246[_0x33bb('0x2e')][_0x33bb('0x33')]));_0x62d62d[_0x33bb('0x32')]=_0x62d62d[_0x33bb('0x32')][_0x33bb('0x34')]?_0x62d62d[_0x33bb('0x32')]:_0xb3e25f[_0x33bb('0x2d')];if(!_0x948246[_0x33bb('0x2e')][_0x33bb('0x35')](_0x33bb('0x36'))){_0x62d62d['limit']=qs[_0x33bb('0x1c')](_0x948246[_0x33bb('0x2e')][_0x33bb('0x1c')]);_0x62d62d[_0x33bb('0x1e')]=qs[_0x33bb('0x1e')](_0x948246[_0x33bb('0x2e')][_0x33bb('0x1e')]);}_0x62d62d[_0x33bb('0x37')]=qs['sort'](_0x948246[_0x33bb('0x2e')][_0x33bb('0x38')]);_0x62d62d['where']=qs['filters'](_[_0x33bb('0x39')](_0x948246[_0x33bb('0x2e')],_0xb3e25f['filters']),_0x55408b);if(_0x948246[_0x33bb('0x2e')][_0x33bb('0x3a')]){_0x62d62d[_0x33bb('0x3b')]=_[_0x33bb('0x3c')](_0x62d62d[_0x33bb('0x3b')],{'$or':_['map'](_0x55408b,function(_0x21cefa){if(_0x21cefa[_0x33bb('0x2c')]!==_0x33bb('0x3d')){var _0x12357f={};_0x12357f[_0x21cefa[_0x33bb('0x25')]]={'$like':'%'+_0x948246['query'][_0x33bb('0x3a')]+'%'};return _0x12357f;}})});}_0x62d62d=_[_0x33bb('0x3c')]({},_0x62d62d,_0x948246[_0x33bb('0x3e')]);var _0x293ee1={'where':_0x62d62d['where']};return db['SugarcrmAccount'][_0x33bb('0x1d')](_0x293ee1)[_0x33bb('0x23')](function(_0x52d353){_0x463d00[_0x33bb('0x1d')]=_0x52d353;if(_0x948246['query'][_0x33bb('0x3f')]){_0x62d62d[_0x33bb('0x40')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x33bb('0x41')](_0x62d62d);})[_0x33bb('0x23')](function(_0x336021){_0x463d00[_0x33bb('0x42')]=_0x336021;return _0x463d00;})[_0x33bb('0x23')](respondWithFilteredResult(_0x351aa2,_0x62d62d))[_0x33bb('0x43')](handleError(_0x351aa2,null));};exports[_0x33bb('0x44')]=function(_0x185589,_0x474792){var _0xacfa25={'raw':![],'where':{'id':_0x185589[_0x33bb('0x45')]['id']}},_0x206d4f={};_0x206d4f['model']=_[_0x33bb('0x2f')](db['SugarcrmAccount'][_0x33bb('0x2a')]);_0x206d4f[_0x33bb('0x2e')]=_[_0x33bb('0x2f')](_0x185589[_0x33bb('0x2e')]);_0x206d4f[_0x33bb('0x30')]=_[_0x33bb('0x31')](_0x206d4f[_0x33bb('0x2d')],_0x206d4f['query']);_0xacfa25[_0x33bb('0x32')]=_[_0x33bb('0x31')](_0x206d4f[_0x33bb('0x2d')],qs[_0x33bb('0x33')](_0x185589[_0x33bb('0x2e')][_0x33bb('0x33')]));_0xacfa25['attributes']=_0xacfa25[_0x33bb('0x32')][_0x33bb('0x34')]?_0xacfa25[_0x33bb('0x32')]:_0x206d4f[_0x33bb('0x2d')];if(_0x185589['query']['includeAll']){_0xacfa25[_0x33bb('0x40')]=[{'all':!![]}];}_0xacfa25=_[_0x33bb('0x3c')]({},_0xacfa25,_0x185589[_0x33bb('0x3e')]);return db[_0x33bb('0x29')][_0x33bb('0x46')](_0xacfa25)['then'](handleEntityNotFound(_0x474792,null))[_0x33bb('0x23')](respondWithResult(_0x474792,null))[_0x33bb('0x43')](handleError(_0x474792,null));};exports[_0x33bb('0x47')]=function(_0x561b24,_0x925fd8){return db['SugarcrmAccount']['create'](_0x561b24[_0x33bb('0x48')],{})[_0x33bb('0x23')](respondWithResult(_0x925fd8,0xc9))[_0x33bb('0x43')](handleError(_0x925fd8,null));};exports['update']=function(_0x32ff4e,_0x5eb741){if(_0x32ff4e['body']['id']){delete _0x32ff4e[_0x33bb('0x48')]['id'];}return db[_0x33bb('0x29')][_0x33bb('0x46')]({'where':{'id':_0x32ff4e[_0x33bb('0x45')]['id']}})['then'](handleEntityNotFound(_0x5eb741,null))[_0x33bb('0x23')](saveUpdates(_0x32ff4e[_0x33bb('0x48')],null))['then'](respondWithResult(_0x5eb741,null))[_0x33bb('0x43')](handleError(_0x5eb741,null));};exports[_0x33bb('0x22')]=function(_0x20ba85,_0xfa2a3d){return db[_0x33bb('0x29')]['find']({'where':{'id':_0x20ba85['params']['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0xfa2a3d,null))['then'](removeEntity(_0xfa2a3d,null))['catch'](handleError(_0xfa2a3d,null));};exports[_0x33bb('0x49')]=function(_0xe30574,_0x3e6ded,_0x152aa8){var _0x26bc97={};var _0x16e2f6={};var _0x35f709;var _0x2492b2;return db[_0x33bb('0x29')]['findOne']({'where':{'id':_0xe30574[_0x33bb('0x45')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x3e6ded,null))[_0x33bb('0x23')](function(_0x14f9a3){if(_0x14f9a3){_0x35f709=_0x14f9a3;_0x16e2f6[_0x33bb('0x2d')]=_[_0x33bb('0x2f')](db[_0x33bb('0x4a')][_0x33bb('0x2a')]);_0x16e2f6[_0x33bb('0x2e')]=_[_0x33bb('0x2f')](_0xe30574[_0x33bb('0x2e')]);_0x16e2f6[_0x33bb('0x30')]=_[_0x33bb('0x31')](_0x16e2f6[_0x33bb('0x2d')],_0x16e2f6[_0x33bb('0x2e')]);_0x26bc97[_0x33bb('0x32')]=_[_0x33bb('0x31')](_0x16e2f6[_0x33bb('0x2d')],qs['fields'](_0xe30574['query'][_0x33bb('0x33')]));_0x26bc97[_0x33bb('0x32')]=_0x26bc97[_0x33bb('0x32')]['length']?_0x26bc97[_0x33bb('0x32')]:_0x16e2f6[_0x33bb('0x2d')];_0x26bc97['order']=qs[_0x33bb('0x38')](_0xe30574[_0x33bb('0x2e')][_0x33bb('0x38')]);_0x26bc97[_0x33bb('0x3b')]=qs[_0x33bb('0x30')](_[_0x33bb('0x39')](_0xe30574[_0x33bb('0x2e')],_0x16e2f6[_0x33bb('0x30')]));if(_0xe30574['query']['filter']){_0x26bc97[_0x33bb('0x3b')]=_[_0x33bb('0x3c')](_0x26bc97['where'],{'$or':_[_0x33bb('0x28')](_0x26bc97[_0x33bb('0x32')],function(_0x3c02f0){var _0x2ec5c9={};_0x2ec5c9[_0x3c02f0]={'$like':'%'+_0xe30574[_0x33bb('0x2e')][_0x33bb('0x3a')]+'%'};return _0x2ec5c9;})});}_0x26bc97=_[_0x33bb('0x3c')]({},_0x26bc97,_0xe30574['options']);return _0x35f709[_0x33bb('0x49')](_0x26bc97);}})[_0x33bb('0x23')](function(_0x565864){if(_0x565864){_0x2492b2=_0x565864[_0x33bb('0x34')];if(!_0xe30574[_0x33bb('0x2e')][_0x33bb('0x35')](_0x33bb('0x36'))){_0x26bc97[_0x33bb('0x1c')]=qs[_0x33bb('0x1c')](_0xe30574[_0x33bb('0x2e')]['limit']);_0x26bc97[_0x33bb('0x1e')]=qs['offset'](_0xe30574[_0x33bb('0x2e')][_0x33bb('0x1e')]);}return _0x35f709['getConfigurations'](_0x26bc97);}})[_0x33bb('0x23')](function(_0x4b2fb3){if(_0x4b2fb3){return _0x4b2fb3?{'count':_0x2492b2,'rows':_0x4b2fb3}:null;}})['then'](respondWithResult(_0x3e6ded,null))[_0x33bb('0x43')](handleError(_0x3e6ded,null));};exports['addConfiguration']=function(_0x52129f,_0x49f90a,_0x16cfdf){if(_0x52129f[_0x33bb('0x48')]['id']){delete _0x52129f[_0x33bb('0x48')]['id'];}return db[_0x33bb('0x29')][_0x33bb('0x4b')]({'where':{'id':_0x52129f[_0x33bb('0x45')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x49f90a,null))[_0x33bb('0x23')](function(_0x23988a){if(_0x23988a){_0x52129f[_0x33bb('0x48')]['AccountId']=_0x23988a['id'];_0x52129f[_0x33bb('0x48')][_0x33bb('0x4c')]=integrations['getSubjects'](_0x52129f[_0x33bb('0x48')][_0x33bb('0x4d')],_0x52129f[_0x33bb('0x48')][_0x33bb('0x2c')]);_0x52129f[_0x33bb('0x48')]['Descriptions']=integrations[_0x33bb('0x4e')](_0x52129f[_0x33bb('0x48')][_0x33bb('0x4d')],_0x52129f['body'][_0x33bb('0x2c')]);return db[_0x33bb('0x4a')]['create'](_0x52129f['body'],{'include':[{'model':db[_0x33bb('0x4f')],'as':_0x33bb('0x4c')},{'model':db[_0x33bb('0x4f')],'as':_0x33bb('0x50')}]});}return null;})[_0x33bb('0x23')](respondWithResult(_0x49f90a,null))[_0x33bb('0x43')](handleError(_0x49f90a,null));};exports[_0x33bb('0x51')]=function(_0x4f48cd,_0x2a6a4a,_0x5d2b8c){var _0x97e3e3='';var _0x129b14=['id',_0x33bb('0x25'),_0x33bb('0x52'),'created_by',_0x33bb('0x53'),_0x33bb('0x54'),_0x33bb('0x55'),'duration_minutes',_0x33bb('0x56'),_0x33bb('0x57'),'parent_name',_0x33bb('0x58')];return db[_0x33bb('0x29')][_0x33bb('0x4b')]({'where':{'id':_0x4f48cd['params']['id']},'attributes':['id',_0x33bb('0x59'),_0x33bb('0x5a'),'remoteUri']})['then'](handleEntityNotFound(_0x2a6a4a,null))[_0x33bb('0x23')](function(_0x591507){if(_0x591507){_0x97e3e3=_0x591507[_0x33bb('0x5b')];var _0x5b27a2=_0x97e3e3[_0x33bb('0x5c')](-0x1);if(_0x5b27a2==='/'){_0x97e3e3=_0x97e3e3['substring'](0x0,_0x97e3e3[_0x33bb('0x5d')](_0x5b27a2));}return rp({'method':'POST','uri':util[_0x33bb('0x5e')](_0x33bb('0x5f'),_0x97e3e3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x33bb('0x60'),'response_type':_0x33bb('0x60'),'rest_data':JSON[_0x33bb('0x61')]({'user_auth':{'user_name':_0x591507['username'],'password':_0x591507['password'],'encryption':'PLAIN'},'application':_0x33bb('0x62')})}});}})[_0x33bb('0x23')](function(_0x39c6d2){if(_0x39c6d2&&_0x39c6d2[_0x33bb('0x25')]!=='Invalid\x20Login'&&_0x39c6d2[_0x33bb('0x25')]!==_0x33bb('0x63')){return rp({'method':'POST','uri':util[_0x33bb('0x5e')](_0x33bb('0x5f'),_0x97e3e3,_0x33bb('0x64')),'json':!![],'form':{'method':_0x33bb('0x65'),'input_type':_0x33bb('0x60'),'response_type':_0x33bb('0x60'),'rest_data':JSON['stringify']({'session':_0x39c6d2['id'],'module_name':_0x33bb('0x66')})}})[_0x33bb('0x23')](function(_0x47e418){if(_0x47e418){var _0x9729ae=_[_0x33bb('0x67')](_0x47e418[_0x33bb('0x68')]);_[_0x33bb('0x69')](_0x9729ae,function(_0x44312c){return _0x129b14[_0x33bb('0x6a')](_0x44312c[_0x33bb('0x25')]);});return{'count':_0x9729ae['length'],'rows':_[_0x33bb('0x28')](_0x9729ae,function(_0x39e376){return{'id':_0x39e376[_0x33bb('0x25')],'name':_0x39e376[_0x33bb('0x6b')],'custom':_[_0x33bb('0x6c')](_0x39e376[_0x33bb('0x25')],'_c')?!![]:![],'options':_0x39e376[_0x33bb('0x3e')]?_[_0x33bb('0x28')](_[_0x33bb('0x67')](_0x39e376['options']),function(_0x15ab6a){return{'name':_0x15ab6a[_0x33bb('0x6d')],'value':_0x15ab6a[_0x33bb('0x25')]};}):[]};})};}})[_0x33bb('0x23')](respondWithResult(_0x2a6a4a,null))[_0x33bb('0x43')](function(_0x5bd9a6){var _0x42fb74=_0x4f48cd[_0x33bb('0x2e')][_0x33bb('0x6e')]?0x1f4:_0x5bd9a6[_0x33bb('0x6f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x33bb('0x51'),_0x42fb74,JSON['stringify'](_0x5bd9a6));delete _0x5bd9a6[_0x33bb('0x25')];if(_0x42fb74===0x191){_0x42fb74=0x190;}_0x2a6a4a[_0x33bb('0x18')](_0x42fb74)[_0x33bb('0x26')](_0x4f48cd[_0x33bb('0x2e')][_0x33bb('0x6e')]?{'message':_0x33bb('0x70'),'statusCode':_0x5bd9a6[_0x33bb('0x6f')]}:_0x5bd9a6);});}else{var _0x356133=0x1f4;_0x2a6a4a[_0x33bb('0x18')](_0x356133)[_0x33bb('0x26')]({'message':_0x33bb('0x70'),'statusCode':0x190});}});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index dd6a386..2b50b65 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 _0xeda7=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x166431,_0x4f12e1){var _0x52ba56=function(_0x536274){while(--_0x536274){_0x166431['push'](_0x166431['shift']());}};_0x52ba56(++_0x4f12e1);}(_0xeda7,0x196));var _0x7eda=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xeda7[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var logger=require(_0x7eda('0x2'))(_0x7eda('0x3'));var moment=require(_0x7eda('0x4'));var BPromise=require(_0x7eda('0x5'));var rp=require(_0x7eda('0x6'));var fs=require('fs');var path=require(_0x7eda('0x7'));var rimraf=require(_0x7eda('0x8'));var config=require(_0x7eda('0x9'));var attributes=require(_0x7eda('0xa'));var integrations=require(_0x7eda('0xb'));module[_0x7eda('0xc')]=function(_0x328430,_0x314602){return _0x328430[_0x7eda('0xd')](_0x7eda('0xe'),attributes,{'tableName':_0x7eda('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 9b9876e..265e4ee 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 _0x0273=['SugarcrmAccount','findAll','options','raw','attributes','limit','include','map','GetSugarcrmAccount','stringify','ShowSugarcrmAccount','find','where','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x2344fb,_0x4ea75d){var _0x5c71b7=function(_0x3acfa5){while(--_0x3acfa5){_0x2344fb['push'](_0x2344fb['shift']());}};_0x5c71b7(++_0x4ea75d);}(_0x0273,0xf2));var _0x3027=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0273[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3027('0x0'));var util=require(_0x3027('0x1'));var moment=require(_0x3027('0x2'));var BPromise=require('bluebird');var rs=require(_0x3027('0x3'));var fs=require('fs');var Redis=require(_0x3027('0x4'));var db=require(_0x3027('0x5'))['db'];var utils=require(_0x3027('0x6'));var logger=require(_0x3027('0x7'))(_0x3027('0x8'));var config=require(_0x3027('0x9'));var jayson=require(_0x3027('0xa'));var client=jayson[_0x3027('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc81a0b,_0x31b975,_0x4f8ac3){return new BPromise(function(_0x156389,_0x392e08){return client[_0x3027('0xc')](_0xc81a0b,_0x4f8ac3)[_0x3027('0xd')](function(_0x200b7b){logger[_0x3027('0xe')](_0x3027('0xf'),_0x31b975,'request\x20sent');logger[_0x3027('0x10')](_0x3027('0x11'),_0x31b975,_0x3027('0x12'),JSON['stringify'](_0x200b7b));if(_0x200b7b[_0x3027('0x13')]){if(_0x200b7b['error'][_0x3027('0x14')]===0x1f4){logger[_0x3027('0x13')](_0x3027('0xf'),_0x31b975,_0x200b7b[_0x3027('0x13')][_0x3027('0x15')]);return _0x392e08(_0x200b7b[_0x3027('0x13')][_0x3027('0x15')]);}logger[_0x3027('0x13')](_0x3027('0xf'),_0x31b975,_0x200b7b[_0x3027('0x13')][_0x3027('0x15')]);return _0x156389(_0x200b7b[_0x3027('0x13')][_0x3027('0x15')]);}else{logger[_0x3027('0xe')](_0x3027('0xf'),_0x31b975,_0x3027('0x12'));_0x156389(_0x200b7b[_0x3027('0x16')][_0x3027('0x15')]);}})[_0x3027('0x17')](function(_0x5dc8c8){logger[_0x3027('0x13')](_0x3027('0xf'),_0x31b975,_0x5dc8c8);_0x392e08(_0x5dc8c8);});});}exports['GetSugarcrmAccount']=function(_0x5409f2){var _0x54b094=this;return new Promise(function(_0xc93640,_0x1e4c6c){return db[_0x3027('0x18')][_0x3027('0x19')]({'raw':_0x5409f2[_0x3027('0x1a')]?_0x5409f2[_0x3027('0x1a')][_0x3027('0x1b')]===undefined?!![]:![]:!![],'where':_0x5409f2[_0x3027('0x1a')]?_0x5409f2[_0x3027('0x1a')]['where']||null:null,'attributes':_0x5409f2['options']?_0x5409f2[_0x3027('0x1a')][_0x3027('0x1c')]||null:null,'limit':_0x5409f2[_0x3027('0x1a')]?_0x5409f2[_0x3027('0x1a')][_0x3027('0x1d')]||null:null,'include':_0x5409f2[_0x3027('0x1a')]?_0x5409f2[_0x3027('0x1a')][_0x3027('0x1e')]?_[_0x3027('0x1f')](_0x5409f2[_0x3027('0x1a')][_0x3027('0x1e')],function(_0x3c2838){return{'model':db[_0x3c2838['model']],'as':_0x3c2838['as'],'attributes':_0x3c2838[_0x3027('0x1c')],'include':_0x3c2838[_0x3027('0x1e')]?_[_0x3027('0x1f')](_0x3c2838['include'],function(_0x7e4315){return{'model':db[_0x7e4315['model']],'as':_0x7e4315['as'],'attributes':_0x7e4315[_0x3027('0x1c')],'include':_0x7e4315[_0x3027('0x1e')]?_[_0x3027('0x1f')](_0x7e4315[_0x3027('0x1e')],function(_0x3a769c){return{'model':db[_0x3a769c['model']],'as':_0x3a769c['as'],'attributes':_0x3a769c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3027('0xd')](function(_0x5f5048){logger[_0x3027('0xe')](_0x3027('0x20'),_0x5409f2);logger[_0x3027('0x10')](_0x3027('0x20'),_0x5409f2,JSON[_0x3027('0x21')](_0x5f5048));_0xc93640(_0x5f5048);})[_0x3027('0x17')](function(_0x1597a8){logger[_0x3027('0x13')]('GetSugarcrmAccount',_0x1597a8[_0x3027('0x15')],_0x5409f2);_0x1e4c6c(_0x54b094[_0x3027('0x13')](0x1f4,_0x1597a8[_0x3027('0x15')]));});});};exports[_0x3027('0x22')]=function(_0x1cb1af){var _0x2e3f07=this;return new Promise(function(_0x3aee9b,_0x347add){return db[_0x3027('0x18')][_0x3027('0x23')]({'raw':_0x1cb1af['options']?_0x1cb1af[_0x3027('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1cb1af[_0x3027('0x1a')]?_0x1cb1af[_0x3027('0x1a')][_0x3027('0x24')]||null:null,'attributes':_0x1cb1af['options']?_0x1cb1af[_0x3027('0x1a')][_0x3027('0x1c')]||null:null,'include':_0x1cb1af[_0x3027('0x1a')]?_0x1cb1af['options'][_0x3027('0x1e')]?_[_0x3027('0x1f')](_0x1cb1af[_0x3027('0x1a')][_0x3027('0x1e')],function(_0x4dca98){return{'model':db[_0x4dca98[_0x3027('0x25')]],'as':_0x4dca98['as'],'attributes':_0x4dca98[_0x3027('0x1c')],'include':_0x4dca98['include']?_['map'](_0x4dca98[_0x3027('0x1e')],function(_0x2e1f54){return{'model':db[_0x2e1f54[_0x3027('0x25')]],'as':_0x2e1f54['as'],'attributes':_0x2e1f54[_0x3027('0x1c')],'include':_0x2e1f54[_0x3027('0x1e')]?_[_0x3027('0x1f')](_0x2e1f54[_0x3027('0x1e')],function(_0x57dc60){return{'model':db[_0x57dc60['model']],'as':_0x57dc60['as'],'attributes':_0x57dc60[_0x3027('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3027('0xd')](function(_0x5281d0){logger[_0x3027('0xe')](_0x3027('0x22'),_0x1cb1af);logger[_0x3027('0x10')](_0x3027('0x22'),_0x1cb1af,JSON[_0x3027('0x21')](_0x5281d0));_0x3aee9b(_0x5281d0);})['catch'](function(_0x1d878c){logger[_0x3027('0x13')](_0x3027('0x22'),_0x1d878c['message'],_0x1cb1af);_0x347add(_0x2e3f07[_0x3027('0x13')](0x1f4,_0x1d878c[_0x3027('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 64d0e56..b462b19 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 _0xdb5a=['getDescriptions','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5997cb,_0x172d53){var _0xdd9494=function(_0x19eb7d){while(--_0x19eb7d){_0x5997cb['push'](_0x5997cb['shift']());}};_0xdd9494(++_0x172d53);}(_0xdb5a,0x1c1));var _0xadb5=function(_0x1de081,_0x143380){_0x1de081=_0x1de081-0x0;var _0x425d12=_0xdb5a[_0x1de081];return _0x425d12;};'use strict';var multer=require(_0xadb5('0x0'));var util=require(_0xadb5('0x1'));var path=require(_0xadb5('0x2'));var timeout=require(_0xadb5('0x3'));var express=require(_0xadb5('0x4'));var router=express[_0xadb5('0x5')]();var fs_extra=require(_0xadb5('0x6'));var auth=require(_0xadb5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xadb5('0x8'));var controller=require(_0xadb5('0x9'));router[_0xadb5('0xa')]('/',auth[_0xadb5('0xb')](),controller[_0xadb5('0xc')]);router[_0xadb5('0xa')]('/:id',auth[_0xadb5('0xb')](),controller[_0xadb5('0xd')]);router[_0xadb5('0xa')](_0xadb5('0xe'),auth['isAuthenticated'](),controller[_0xadb5('0xf')]);router['get'](_0xadb5('0x10'),auth[_0xadb5('0xb')](),controller[_0xadb5('0x11')]);router[_0xadb5('0xa')](_0xadb5('0x12'),auth[_0xadb5('0xb')](),controller[_0xadb5('0x13')]);router[_0xadb5('0x14')]('/',auth[_0xadb5('0xb')](),controller[_0xadb5('0x15')]);router['put'](_0xadb5('0x16'),auth['isAuthenticated'](),controller[_0xadb5('0x17')]);router[_0xadb5('0x18')](_0xadb5('0x16'),auth['isAuthenticated'](),controller[_0xadb5('0x19')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 26353ae..cc403f3 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 _0x8f62=['STRING','sequelize','exports'];(function(_0x537f8b,_0x36a16c){var _0x4db385=function(_0xc73ecd){while(--_0xc73ecd){_0x537f8b['push'](_0x537f8b['shift']());}};_0x4db385(++_0x36a16c);}(_0x8f62,0x1e4));var _0x28f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f62[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x28f6('0x0'));module[_0x28f6('0x1')]={'name':{'type':Sequelize[_0x28f6('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 00361ac..5a10421 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 _0x32f6=['key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','SugarcrmConfiguration','includeAll','options','find','catch','create','body','params','destroy','getFields','findOne','hasOwnProperty','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','type'];(function(_0x27a7cf,_0x2139b2){var _0x55ef94=function(_0x3a6abe){while(--_0x3a6abe){_0x27a7cf['push'](_0x27a7cf['shift']());}};_0x55ef94(++_0x2139b2);}(_0x32f6,0x15d));var _0x632f=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x32f6[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require(_0x632f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x632f('0x1'));var jsonpatch=require(_0x632f('0x2'));var rp=require(_0x632f('0x3'));var moment=require(_0x632f('0x4'));var BPromise=require(_0x632f('0x5'));var Mustache=require(_0x632f('0x6'));var util=require('util');var path=require(_0x632f('0x7'));var sox=require('sox');var csv=require(_0x632f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x632f('0x9'));var _=require(_0x632f('0xa'));var squel=require(_0x632f('0xb'));var crypto=require(_0x632f('0xc'));var jsforce=require(_0x632f('0xd'));var deskjs=require(_0x632f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x632f('0xf'));var Papa=require(_0x632f('0x10'));var Redis=require(_0x632f('0x11'));var authService=require(_0x632f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x632f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x632f('0x14'));var utils=require(_0x632f('0x15'));var config=require(_0x632f('0x16'));var licenseUtil=require(_0x632f('0x17'));var db=require(_0x632f('0x18'))['db'];function respondWithStatusCode(_0x4bc328,_0x502a37){_0x502a37=_0x502a37||0xcc;return function(_0x2ed0eb){if(_0x2ed0eb){return _0x4bc328[_0x632f('0x19')](_0x502a37);}return _0x4bc328[_0x632f('0x1a')](_0x502a37)[_0x632f('0x1b')]();};}function respondWithResult(_0x137506,_0x5ab24b){_0x5ab24b=_0x5ab24b||0xc8;return function(_0x50e496){if(_0x50e496){return _0x137506[_0x632f('0x1a')](_0x5ab24b)[_0x632f('0x1c')](_0x50e496);}};}function respondWithFilteredResult(_0x1a642b,_0x1a03e0){return function(_0x1edcfa){if(_0x1edcfa){var _0xbf535a=typeof _0x1a03e0['offset']==='undefined'&&typeof _0x1a03e0[_0x632f('0x1d')]===_0x632f('0x1e');var _0x13c1af=_0x1edcfa[_0x632f('0x1f')];var _0x38bd4a=_0xbf535a?0x0:_0x1a03e0[_0x632f('0x20')];var _0x540aff=_0xbf535a?_0x1edcfa[_0x632f('0x1f')]:_0x1a03e0[_0x632f('0x20')]+_0x1a03e0[_0x632f('0x1d')];var _0x32c388;if(_0x540aff>=_0x13c1af){_0x540aff=_0x13c1af;_0x32c388=0xc8;}else{_0x32c388=0xce;}_0x1a642b['status'](_0x32c388);return _0x1a642b['set'](_0x632f('0x21'),_0x38bd4a+'-'+_0x540aff+'/'+_0x13c1af)[_0x632f('0x1c')](_0x1edcfa);}return null;};}function patchUpdates(_0x4e19a1){return function(_0x4b4b89){try{jsonpatch['apply'](_0x4b4b89,_0x4e19a1,!![]);}catch(_0x2df8eb){return BPromise[_0x632f('0x22')](_0x2df8eb);}return _0x4b4b89[_0x632f('0x23')]();};}function saveUpdates(_0x48ec95,_0x3c9ac8){return function(_0x2d712b){if(_0x2d712b){return _0x2d712b[_0x632f('0x24')](_0x48ec95)[_0x632f('0x25')](function(_0x1487ed){return _0x1487ed;});}return null;};}function removeEntity(_0x4df1f3,_0x39e68d){return function(_0x41179b){if(_0x41179b){return _0x41179b['destroy']()[_0x632f('0x25')](function(){_0x4df1f3[_0x632f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe5b70,_0x4f8b26){return function(_0x32cb44){if(!_0x32cb44){_0xfe5b70[_0x632f('0x19')](0x194);}return _0x32cb44;};}function handleError(_0x164173,_0x3dc7b9){_0x3dc7b9=_0x3dc7b9||0x1f4;return function(_0x38519c){logger[_0x632f('0x26')](_0x38519c[_0x632f('0x27')]);if(_0x38519c[_0x632f('0x28')]){delete _0x38519c[_0x632f('0x28')];}_0x164173[_0x632f('0x1a')](_0x3dc7b9)[_0x632f('0x29')](_0x38519c);};}exports[_0x632f('0x2a')]=function(_0x14b2d5,_0x445896){var _0xb21c84={},_0x438b54={},_0x105f3e={'count':0x0,'rows':[]};var _0x3549d1=_[_0x632f('0x2b')](db['SugarcrmConfiguration'][_0x632f('0x2c')],function(_0x5376eb){return{'name':_0x5376eb['fieldName'],'type':_0x5376eb[_0x632f('0x2d')][_0x632f('0x2e')]};});_0x438b54[_0x632f('0x2f')]=_[_0x632f('0x2b')](_0x3549d1,_0x632f('0x28'));_0x438b54[_0x632f('0x30')]=_[_0x632f('0x31')](_0x14b2d5['query']);_0x438b54[_0x632f('0x32')]=_[_0x632f('0x33')](_0x438b54[_0x632f('0x2f')],_0x438b54[_0x632f('0x30')]);_0xb21c84['attributes']=_[_0x632f('0x33')](_0x438b54[_0x632f('0x2f')],qs[_0x632f('0x34')](_0x14b2d5['query'][_0x632f('0x34')]));_0xb21c84[_0x632f('0x35')]=_0xb21c84[_0x632f('0x35')][_0x632f('0x36')]?_0xb21c84['attributes']:_0x438b54['model'];if(!_0x14b2d5[_0x632f('0x30')]['hasOwnProperty'](_0x632f('0x37'))){_0xb21c84['limit']=qs[_0x632f('0x1d')](_0x14b2d5[_0x632f('0x30')][_0x632f('0x1d')]);_0xb21c84[_0x632f('0x20')]=qs['offset'](_0x14b2d5[_0x632f('0x30')][_0x632f('0x20')]);}_0xb21c84[_0x632f('0x38')]=qs['sort'](_0x14b2d5[_0x632f('0x30')][_0x632f('0x39')]);_0xb21c84[_0x632f('0x3a')]=qs['filters'](_[_0x632f('0x3b')](_0x14b2d5[_0x632f('0x30')],_0x438b54[_0x632f('0x32')]),_0x3549d1);if(_0x14b2d5[_0x632f('0x30')][_0x632f('0x3c')]){_0xb21c84[_0x632f('0x3a')]=_[_0x632f('0x3d')](_0xb21c84['where'],{'$or':_['map'](_0x3549d1,function(_0x5e090c){if(_0x5e090c[_0x632f('0x2d')]!==_0x632f('0x3e')){var _0x60eb4e={};_0x60eb4e[_0x5e090c[_0x632f('0x28')]]={'$like':'%'+_0x14b2d5[_0x632f('0x30')][_0x632f('0x3c')]+'%'};return _0x60eb4e;}})});}_0xb21c84=_[_0x632f('0x3d')]({},_0xb21c84,_0x14b2d5['options']);var _0x3ef709={'where':_0xb21c84[_0x632f('0x3a')]};return db['SugarcrmConfiguration'][_0x632f('0x1f')](_0x3ef709)['then'](function(_0x2c24b2){_0x105f3e[_0x632f('0x1f')]=_0x2c24b2;if(_0x14b2d5[_0x632f('0x30')]['includeAll']){_0xb21c84[_0x632f('0x3f')]=[{'all':!![]}];}return db[_0x632f('0x40')]['findAll'](_0xb21c84);})[_0x632f('0x25')](function(_0x5a0a43){_0x105f3e['rows']=_0x5a0a43;return _0x105f3e;})[_0x632f('0x25')](respondWithFilteredResult(_0x445896,_0xb21c84))['catch'](handleError(_0x445896,null));};exports['show']=function(_0x327bda,_0x438dd9){var _0x825a56={'raw':![],'where':{'id':_0x327bda['params']['id']}},_0x16fcf8={};_0x16fcf8['model']=_[_0x632f('0x31')](db[_0x632f('0x40')][_0x632f('0x2c')]);_0x16fcf8[_0x632f('0x30')]=_[_0x632f('0x31')](_0x327bda[_0x632f('0x30')]);_0x16fcf8[_0x632f('0x32')]=_['intersection'](_0x16fcf8[_0x632f('0x2f')],_0x16fcf8[_0x632f('0x30')]);_0x825a56[_0x632f('0x35')]=_[_0x632f('0x33')](_0x16fcf8['model'],qs['fields'](_0x327bda['query'][_0x632f('0x34')]));_0x825a56['attributes']=_0x825a56['attributes'][_0x632f('0x36')]?_0x825a56['attributes']:_0x16fcf8['model'];if(_0x327bda[_0x632f('0x30')][_0x632f('0x41')]){_0x825a56['include']=[{'all':!![]}];}_0x825a56=_[_0x632f('0x3d')]({},_0x825a56,_0x327bda[_0x632f('0x42')]);return db[_0x632f('0x40')][_0x632f('0x43')](_0x825a56)[_0x632f('0x25')](handleEntityNotFound(_0x438dd9,null))[_0x632f('0x25')](respondWithResult(_0x438dd9,null))[_0x632f('0x44')](handleError(_0x438dd9,null));};exports['create']=function(_0x4af71c,_0x3dd31b){return db['SugarcrmConfiguration'][_0x632f('0x45')](_0x4af71c[_0x632f('0x46')],{})[_0x632f('0x25')](respondWithResult(_0x3dd31b,0xc9))[_0x632f('0x44')](handleError(_0x3dd31b,null));};exports[_0x632f('0x24')]=function(_0xf0a7bb,_0x2f30a3){if(_0xf0a7bb[_0x632f('0x46')]['id']){delete _0xf0a7bb['body']['id'];}return db['SugarcrmConfiguration'][_0x632f('0x43')]({'where':{'id':_0xf0a7bb[_0x632f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f30a3,null))[_0x632f('0x25')](saveUpdates(_0xf0a7bb[_0x632f('0x46')],null))[_0x632f('0x25')](respondWithResult(_0x2f30a3,null))['catch'](handleError(_0x2f30a3,null));};exports[_0x632f('0x48')]=function(_0x1ed22f,_0x1dccde){return db['SugarcrmConfiguration'][_0x632f('0x43')]({'where':{'id':_0x1ed22f[_0x632f('0x47')]['id']}})['then'](handleEntityNotFound(_0x1dccde,null))[_0x632f('0x25')](removeEntity(_0x1dccde,null))[_0x632f('0x44')](handleError(_0x1dccde,null));};exports[_0x632f('0x49')]=function(_0x282732,_0x4977bf,_0x1b16f9){var _0x2a2726={};var _0x277070={};var _0xaeb78a;var _0x597644;return db[_0x632f('0x40')][_0x632f('0x4a')]({'where':{'id':_0x282732[_0x632f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4977bf,null))['then'](function(_0x2b9e5b){if(_0x2b9e5b){_0xaeb78a=_0x2b9e5b;_0x277070[_0x632f('0x2f')]=_['keys'](db['SugarcrmField'][_0x632f('0x2c')]);_0x277070[_0x632f('0x30')]=_[_0x632f('0x31')](_0x282732[_0x632f('0x30')]);_0x277070[_0x632f('0x32')]=_[_0x632f('0x33')](_0x277070['model'],_0x277070[_0x632f('0x30')]);_0x2a2726['attributes']=_[_0x632f('0x33')](_0x277070[_0x632f('0x2f')],qs[_0x632f('0x34')](_0x282732[_0x632f('0x30')]['fields']));_0x2a2726['attributes']=_0x2a2726[_0x632f('0x35')]['length']?_0x2a2726[_0x632f('0x35')]:_0x277070[_0x632f('0x2f')];_0x2a2726[_0x632f('0x38')]=qs[_0x632f('0x39')](_0x282732[_0x632f('0x30')]['sort']);_0x2a2726[_0x632f('0x3a')]=qs[_0x632f('0x32')](_[_0x632f('0x3b')](_0x282732['query'],_0x277070[_0x632f('0x32')]));if(_0x282732['query'][_0x632f('0x3c')]){_0x2a2726[_0x632f('0x3a')]=_[_0x632f('0x3d')](_0x2a2726[_0x632f('0x3a')],{'$or':_['map'](_0x2a2726[_0x632f('0x35')],function(_0x122b39){var _0x1fc210={};_0x1fc210[_0x122b39]={'$like':'%'+_0x282732[_0x632f('0x30')]['filter']+'%'};return _0x1fc210;})});}_0x2a2726=_['merge']({},_0x2a2726,_0x282732[_0x632f('0x42')]);return _0xaeb78a[_0x632f('0x49')](_0x2a2726);}})[_0x632f('0x25')](function(_0x30bacb){if(_0x30bacb){_0x597644=_0x30bacb[_0x632f('0x36')];if(!_0x282732[_0x632f('0x30')][_0x632f('0x4b')]('nolimit')){_0x2a2726[_0x632f('0x1d')]=qs[_0x632f('0x1d')](_0x282732[_0x632f('0x30')]['limit']);_0x2a2726[_0x632f('0x20')]=qs[_0x632f('0x20')](_0x282732[_0x632f('0x30')][_0x632f('0x20')]);}return _0xaeb78a[_0x632f('0x49')](_0x2a2726);}})[_0x632f('0x25')](function(_0x50a07f){if(_0x50a07f){return _0x50a07f?{'count':_0x597644,'rows':_0x50a07f}:null;}})[_0x632f('0x25')](respondWithResult(_0x4977bf,null))[_0x632f('0x44')](handleError(_0x4977bf,null));};exports[_0x632f('0x4c')]=function(_0xb44612,_0x1277c5,_0x327186){var _0x3f247f={};var _0x4604c5={};var _0x51123e;var _0x227f56;return db[_0x632f('0x40')][_0x632f('0x4a')]({'where':{'id':_0xb44612[_0x632f('0x47')]['id']}})[_0x632f('0x25')](handleEntityNotFound(_0x1277c5,null))[_0x632f('0x25')](function(_0x5028a1){if(_0x5028a1){_0x51123e=_0x5028a1;_0x4604c5[_0x632f('0x2f')]=_[_0x632f('0x31')](db[_0x632f('0x4d')]['rawAttributes']);_0x4604c5['query']=_[_0x632f('0x31')](_0xb44612[_0x632f('0x30')]);_0x4604c5['filters']=_[_0x632f('0x33')](_0x4604c5[_0x632f('0x2f')],_0x4604c5[_0x632f('0x30')]);_0x3f247f['attributes']=_[_0x632f('0x33')](_0x4604c5[_0x632f('0x2f')],qs[_0x632f('0x34')](_0xb44612['query'][_0x632f('0x34')]));_0x3f247f['attributes']=_0x3f247f[_0x632f('0x35')][_0x632f('0x36')]?_0x3f247f['attributes']:_0x4604c5[_0x632f('0x2f')];_0x3f247f['order']=qs[_0x632f('0x39')](_0xb44612[_0x632f('0x30')][_0x632f('0x39')]);_0x3f247f[_0x632f('0x3a')]=qs[_0x632f('0x32')](_[_0x632f('0x3b')](_0xb44612[_0x632f('0x30')],_0x4604c5[_0x632f('0x32')]));if(_0xb44612[_0x632f('0x30')]['filter']){_0x3f247f['where']=_[_0x632f('0x3d')](_0x3f247f[_0x632f('0x3a')],{'$or':_['map'](_0x3f247f['attributes'],function(_0x344d21){var _0x53d81e={};_0x53d81e[_0x344d21]={'$like':'%'+_0xb44612[_0x632f('0x30')][_0x632f('0x3c')]+'%'};return _0x53d81e;})});}_0x3f247f=_[_0x632f('0x3d')]({},_0x3f247f,_0xb44612[_0x632f('0x42')]);return _0x51123e[_0x632f('0x4c')](_0x3f247f);}})['then'](function(_0x1115dd){if(_0x1115dd){_0x227f56=_0x1115dd[_0x632f('0x36')];if(!_0xb44612[_0x632f('0x30')][_0x632f('0x4b')](_0x632f('0x37'))){_0x3f247f['limit']=qs['limit'](_0xb44612[_0x632f('0x30')][_0x632f('0x1d')]);_0x3f247f[_0x632f('0x20')]=qs[_0x632f('0x20')](_0xb44612['query'][_0x632f('0x20')]);}return _0x51123e['getSubjects'](_0x3f247f);}})[_0x632f('0x25')](function(_0x3d6420){if(_0x3d6420){return _0x3d6420?{'count':_0x227f56,'rows':_0x3d6420}:null;}})[_0x632f('0x25')](respondWithResult(_0x1277c5,null))[_0x632f('0x44')](handleError(_0x1277c5,null));};exports[_0x632f('0x4e')]=function(_0x49a3b9,_0x25f154,_0x3721f9){var _0x3ae1c9={};var _0x16d5a4={};var _0x7eb454;var _0x116dd3;return db[_0x632f('0x40')]['findOne']({'where':{'id':_0x49a3b9['params']['id']}})[_0x632f('0x25')](handleEntityNotFound(_0x25f154,null))[_0x632f('0x25')](function(_0x1c3c70){if(_0x1c3c70){_0x7eb454=_0x1c3c70;_0x16d5a4[_0x632f('0x2f')]=_[_0x632f('0x31')](db[_0x632f('0x4d')][_0x632f('0x2c')]);_0x16d5a4['query']=_['keys'](_0x49a3b9[_0x632f('0x30')]);_0x16d5a4['filters']=_['intersection'](_0x16d5a4['model'],_0x16d5a4[_0x632f('0x30')]);_0x3ae1c9[_0x632f('0x35')]=_[_0x632f('0x33')](_0x16d5a4[_0x632f('0x2f')],qs['fields'](_0x49a3b9[_0x632f('0x30')][_0x632f('0x34')]));_0x3ae1c9[_0x632f('0x35')]=_0x3ae1c9[_0x632f('0x35')][_0x632f('0x36')]?_0x3ae1c9[_0x632f('0x35')]:_0x16d5a4['model'];_0x3ae1c9[_0x632f('0x38')]=qs[_0x632f('0x39')](_0x49a3b9['query'][_0x632f('0x39')]);_0x3ae1c9[_0x632f('0x3a')]=qs[_0x632f('0x32')](_[_0x632f('0x3b')](_0x49a3b9[_0x632f('0x30')],_0x16d5a4['filters']));if(_0x49a3b9['query']['filter']){_0x3ae1c9[_0x632f('0x3a')]=_[_0x632f('0x3d')](_0x3ae1c9[_0x632f('0x3a')],{'$or':_[_0x632f('0x2b')](_0x3ae1c9[_0x632f('0x35')],function(_0x30451b){var _0x34e50a={};_0x34e50a[_0x30451b]={'$like':'%'+_0x49a3b9[_0x632f('0x30')]['filter']+'%'};return _0x34e50a;})});}_0x3ae1c9=_[_0x632f('0x3d')]({},_0x3ae1c9,_0x49a3b9[_0x632f('0x42')]);return _0x7eb454['getDescriptions'](_0x3ae1c9);}})['then'](function(_0x54fb62){if(_0x54fb62){_0x116dd3=_0x54fb62[_0x632f('0x36')];if(!_0x49a3b9[_0x632f('0x30')]['hasOwnProperty'](_0x632f('0x37'))){_0x3ae1c9[_0x632f('0x1d')]=qs[_0x632f('0x1d')](_0x49a3b9[_0x632f('0x30')][_0x632f('0x1d')]);_0x3ae1c9[_0x632f('0x20')]=qs['offset'](_0x49a3b9[_0x632f('0x30')]['offset']);}return _0x7eb454[_0x632f('0x4e')](_0x3ae1c9);}})['then'](function(_0x35b7bc){if(_0x35b7bc){return _0x35b7bc?{'count':_0x116dd3,'rows':_0x35b7bc}:null;}})['then'](respondWithResult(_0x25f154,null))[_0x632f('0x44')](handleError(_0x25f154,null));}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a7b35f1..edd792d 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 _0x42bb=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x33c42e,_0x170930){var _0xfddb2b=function(_0x382a0e){while(--_0x382a0e){_0x33c42e['push'](_0x33c42e['shift']());}};_0xfddb2b(++_0x170930);}(_0x42bb,0xdc));var _0xb42b=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x42bb[_0x166d93];return _0xba708;};'use strict';var _=require(_0xb42b('0x0'));var util=require(_0xb42b('0x1'));var logger=require('../../config/logger')(_0xb42b('0x2'));var moment=require(_0xb42b('0x3'));var BPromise=require(_0xb42b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb42b('0x5'));var rimraf=require(_0xb42b('0x6'));var config=require(_0xb42b('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xb42b('0x8')]=function(_0x55d022,_0x3634d1){return _0x55d022['define'](_0xb42b('0x9'),attributes,{'tableName':_0xb42b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index d97619a..53303a1 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 _0x9c56=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9c56,0x1cd));var _0x69c5=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x9c56[_0x2080a3];return _0x8d7d17;};'use strict';var _=require(_0x69c5('0x0'));var util=require(_0x69c5('0x1'));var moment=require(_0x69c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x69c5('0x3'));var fs=require('fs');var Redis=require(_0x69c5('0x4'));var db=require(_0x69c5('0x5'))['db'];var utils=require(_0x69c5('0x6'));var logger=require('../../config/logger')(_0x69c5('0x7'));var config=require('../../config/environment');var jayson=require(_0x69c5('0x8'));var client=jayson[_0x69c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd74d2b,_0x344c48,_0x1a22e1){return new BPromise(function(_0x5951af,_0x4590ac){return client[_0x69c5('0xa')](_0xd74d2b,_0x1a22e1)[_0x69c5('0xb')](function(_0x58c433){logger[_0x69c5('0xc')](_0x69c5('0xd'),_0x344c48,'request\x20sent');logger[_0x69c5('0xe')](_0x69c5('0xf'),_0x344c48,_0x69c5('0x10'),JSON[_0x69c5('0x11')](_0x58c433));if(_0x58c433[_0x69c5('0x12')]){if(_0x58c433['error'][_0x69c5('0x13')]===0x1f4){logger[_0x69c5('0x12')](_0x69c5('0xd'),_0x344c48,_0x58c433['error'][_0x69c5('0x14')]);return _0x4590ac(_0x58c433['error'][_0x69c5('0x14')]);}logger[_0x69c5('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x344c48,_0x58c433['error'][_0x69c5('0x14')]);return _0x5951af(_0x58c433[_0x69c5('0x12')][_0x69c5('0x14')]);}else{logger[_0x69c5('0xc')](_0x69c5('0xd'),_0x344c48,_0x69c5('0x10'));_0x5951af(_0x58c433['result'][_0x69c5('0x14')]);}})['catch'](function(_0x3effc7){logger[_0x69c5('0x12')](_0x69c5('0xd'),_0x344c48,_0x3effc7);_0x4590ac(_0x3effc7);});});} \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index e9f767f..15e5845 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 _0xd1b7=['../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','delete','destroy','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x59a9c9,_0x671ed6){var _0x476d06=function(_0x5f4629){while(--_0x5f4629){_0x59a9c9['push'](_0x59a9c9['shift']());}};_0x476d06(++_0x671ed6);}(_0xd1b7,0x1b6));var _0x7d1b=function(_0x25e9fc,_0x2b7a23){_0x25e9fc=_0x25e9fc-0x0;var _0x34aaf5=_0xd1b7[_0x25e9fc];return _0x34aaf5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7d1b('0x0'));var express=require('express');var router=express[_0x7d1b('0x1')]();var fs_extra=require(_0x7d1b('0x2'));var auth=require(_0x7d1b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7d1b('0x4'));var controller=require(_0x7d1b('0x5'));router[_0x7d1b('0x6')]('/',auth['isAuthenticated'](),controller[_0x7d1b('0x7')]);router[_0x7d1b('0x6')](_0x7d1b('0x8'),auth[_0x7d1b('0x9')](),controller[_0x7d1b('0xa')]);router['post']('/',auth[_0x7d1b('0x9')](),controller['create']);router['put'](_0x7d1b('0x8'),auth[_0x7d1b('0x9')](),controller['update']);router[_0x7d1b('0xb')](_0x7d1b('0x8'),auth[_0x7d1b('0x9')](),controller[_0x7d1b('0xc')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 436b58d..ef5db62 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 _0xe5ce=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING'];(function(_0x1e91bc,_0x3bb24e){var _0x1e02b6=function(_0x1ae4ec){while(--_0x1ae4ec){_0x1e91bc['push'](_0x1e91bc['shift']());}};_0x1e02b6(++_0x3bb24e);}(_0xe5ce,0x161));var _0xee5c=function(_0x2c9cb3,_0x196caa){_0x2c9cb3=_0x2c9cb3-0x0;var _0x419547=_0xe5ce[_0x2c9cb3];return _0x419547;};'use strict';var Sequelize=require(_0xee5c('0x0'));module[_0xee5c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xee5c('0x2'),_0xee5c('0x3'),_0xee5c('0x4'),'keyValue',_0xee5c('0x5')),'defaultValue':_0xee5c('0x2')},'content':{'type':Sequelize[_0xee5c('0x6')]},'key':{'type':Sequelize[_0xee5c('0x6')]},'keyType':{'type':Sequelize[_0xee5c('0x7')](_0xee5c('0x2'),_0xee5c('0x3'),_0xee5c('0x4'))},'keyContent':{'type':Sequelize[_0xee5c('0x6')]},'idField':{'type':Sequelize[_0xee5c('0x6')]},'nameField':{'type':Sequelize[_0xee5c('0x6')]},'customField':{'type':Sequelize[_0xee5c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee5c('0x6')]}}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0a0358e..c3b1cce 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 _0x7b32=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0x7b32,0x127));var _0x27b3=function(_0x37516d,_0x2fb435){_0x37516d=_0x37516d-0x0;var _0x282667=_0x7b32[_0x37516d];return _0x282667;};'use strict';var emlformat=require(_0x27b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27b3('0x1'));var jsonpatch=require(_0x27b3('0x2'));var rp=require('request-promise');var moment=require(_0x27b3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x27b3('0x4'));var util=require(_0x27b3('0x5'));var path=require(_0x27b3('0x6'));var sox=require(_0x27b3('0x7'));var csv=require('to-csv');var ejs=require(_0x27b3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27b3('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x27b3('0xa'));var deskjs=require(_0x27b3('0xb'));var toCsv=require(_0x27b3('0xc'));var querystring=require(_0x27b3('0xd'));var Papa=require(_0x27b3('0xe'));var Redis=require(_0x27b3('0xf'));var authService=require(_0x27b3('0x10'));var qs=require(_0x27b3('0x11'));var as=require(_0x27b3('0x12'));var hardwareService=require(_0x27b3('0x13'));var logger=require(_0x27b3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27b3('0x15'));var licenseUtil=require(_0x27b3('0x16'));var db=require(_0x27b3('0x17'))['db'];function respondWithStatusCode(_0x1d380f,_0x4de080){_0x4de080=_0x4de080||0xcc;return function(_0x1e223b){if(_0x1e223b){return _0x1d380f[_0x27b3('0x18')](_0x4de080);}return _0x1d380f['status'](_0x4de080)['end']();};}function respondWithResult(_0x346440,_0x10a6a7){_0x10a6a7=_0x10a6a7||0xc8;return function(_0x4c8e06){if(_0x4c8e06){return _0x346440['status'](_0x10a6a7)[_0x27b3('0x19')](_0x4c8e06);}};}function respondWithFilteredResult(_0x312bb0,_0x5c03d2){return function(_0x55440a){if(_0x55440a){var _0x227a8b=typeof _0x5c03d2[_0x27b3('0x1a')]===_0x27b3('0x1b')&&typeof _0x5c03d2[_0x27b3('0x1c')]==='undefined';var _0x5215a0=_0x55440a[_0x27b3('0x1d')];var _0x32bbb4=_0x227a8b?0x0:_0x5c03d2[_0x27b3('0x1a')];var _0x2b5249=_0x227a8b?_0x55440a[_0x27b3('0x1d')]:_0x5c03d2[_0x27b3('0x1a')]+_0x5c03d2['limit'];var _0x1b1350;if(_0x2b5249>=_0x5215a0){_0x2b5249=_0x5215a0;_0x1b1350=0xc8;}else{_0x1b1350=0xce;}_0x312bb0[_0x27b3('0x1e')](_0x1b1350);return _0x312bb0[_0x27b3('0x1f')](_0x27b3('0x20'),_0x32bbb4+'-'+_0x2b5249+'/'+_0x5215a0)[_0x27b3('0x19')](_0x55440a);}return null;};}function patchUpdates(_0x4d7a05){return function(_0x272492){try{jsonpatch['apply'](_0x272492,_0x4d7a05,!![]);}catch(_0x5b0999){return BPromise[_0x27b3('0x21')](_0x5b0999);}return _0x272492[_0x27b3('0x22')]();};}function saveUpdates(_0x391d0f,_0x237336){return function(_0x1c9767){if(_0x1c9767){return _0x1c9767[_0x27b3('0x23')](_0x391d0f)['then'](function(_0x51853e){return _0x51853e;});}return null;};}function removeEntity(_0x59a696,_0x5d0227){return function(_0x162322){if(_0x162322){return _0x162322[_0x27b3('0x24')]()[_0x27b3('0x25')](function(){_0x59a696['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d043e,_0x2ba4da){return function(_0x66e014){if(!_0x66e014){_0x4d043e['sendStatus'](0x194);}return _0x66e014;};}function handleError(_0x2090bc,_0x1560ee){_0x1560ee=_0x1560ee||0x1f4;return function(_0x5a4427){logger[_0x27b3('0x26')](_0x5a4427[_0x27b3('0x27')]);if(_0x5a4427[_0x27b3('0x28')]){delete _0x5a4427[_0x27b3('0x28')];}_0x2090bc[_0x27b3('0x1e')](_0x1560ee)['send'](_0x5a4427);};}exports[_0x27b3('0x29')]=function(_0x3a8d79,_0x353e6c){var _0x2134ef={},_0x443897={},_0x3d9733={'count':0x0,'rows':[]};var _0x45a855=_['map'](db[_0x27b3('0x2a')][_0x27b3('0x2b')],function(_0x8a6d4a){return{'name':_0x8a6d4a[_0x27b3('0x2c')],'type':_0x8a6d4a[_0x27b3('0x2d')][_0x27b3('0x2e')]};});_0x443897['model']=_[_0x27b3('0x2f')](_0x45a855,_0x27b3('0x28'));_0x443897[_0x27b3('0x30')]=_['keys'](_0x3a8d79[_0x27b3('0x30')]);_0x443897[_0x27b3('0x31')]=_[_0x27b3('0x32')](_0x443897['model'],_0x443897[_0x27b3('0x30')]);_0x2134ef['attributes']=_[_0x27b3('0x32')](_0x443897[_0x27b3('0x33')],qs[_0x27b3('0x34')](_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x34')]));_0x2134ef['attributes']=_0x2134ef[_0x27b3('0x35')][_0x27b3('0x36')]?_0x2134ef[_0x27b3('0x35')]:_0x443897[_0x27b3('0x33')];if(!_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x37')](_0x27b3('0x38'))){_0x2134ef['limit']=qs[_0x27b3('0x1c')](_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x1c')]);_0x2134ef[_0x27b3('0x1a')]=qs[_0x27b3('0x1a')](_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x1a')]);}_0x2134ef[_0x27b3('0x39')]=qs['sort'](_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x3a')]);_0x2134ef[_0x27b3('0x3b')]=qs[_0x27b3('0x31')](_[_0x27b3('0x3c')](_0x3a8d79['query'],_0x443897['filters']),_0x45a855);if(_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x3d')]){_0x2134ef[_0x27b3('0x3b')]=_[_0x27b3('0x3e')](_0x2134ef[_0x27b3('0x3b')],{'$or':_[_0x27b3('0x2f')](_0x45a855,function(_0x48f2ac){if(_0x48f2ac[_0x27b3('0x2d')]!=='VIRTUAL'){var _0x3529de={};_0x3529de[_0x48f2ac[_0x27b3('0x28')]]={'$like':'%'+_0x3a8d79[_0x27b3('0x30')]['filter']+'%'};return _0x3529de;}})});}_0x2134ef=_[_0x27b3('0x3e')]({},_0x2134ef,_0x3a8d79[_0x27b3('0x3f')]);var _0x3a56c7={'where':_0x2134ef[_0x27b3('0x3b')]};return db[_0x27b3('0x2a')][_0x27b3('0x1d')](_0x3a56c7)[_0x27b3('0x25')](function(_0x2ada73){_0x3d9733['count']=_0x2ada73;if(_0x3a8d79[_0x27b3('0x30')][_0x27b3('0x40')]){_0x2134ef[_0x27b3('0x41')]=[{'all':!![]}];}return db['SugarcrmField'][_0x27b3('0x42')](_0x2134ef);})[_0x27b3('0x25')](function(_0x31297f){_0x3d9733['rows']=_0x31297f;return _0x3d9733;})[_0x27b3('0x25')](respondWithFilteredResult(_0x353e6c,_0x2134ef))[_0x27b3('0x43')](handleError(_0x353e6c,null));};exports[_0x27b3('0x44')]=function(_0x11b942,_0x4b3c1b){var _0x36ea22={'raw':!![],'where':{'id':_0x11b942[_0x27b3('0x45')]['id']}},_0x2c783e={};_0x2c783e['model']=_[_0x27b3('0x46')](db[_0x27b3('0x2a')][_0x27b3('0x2b')]);_0x2c783e['query']=_['keys'](_0x11b942[_0x27b3('0x30')]);_0x2c783e[_0x27b3('0x31')]=_[_0x27b3('0x32')](_0x2c783e[_0x27b3('0x33')],_0x2c783e[_0x27b3('0x30')]);_0x36ea22[_0x27b3('0x35')]=_['intersection'](_0x2c783e[_0x27b3('0x33')],qs['fields'](_0x11b942[_0x27b3('0x30')][_0x27b3('0x34')]));_0x36ea22['attributes']=_0x36ea22[_0x27b3('0x35')][_0x27b3('0x36')]?_0x36ea22['attributes']:_0x2c783e[_0x27b3('0x33')];if(_0x11b942[_0x27b3('0x30')]['includeAll']){_0x36ea22[_0x27b3('0x41')]=[{'all':!![]}];}_0x36ea22=_[_0x27b3('0x3e')]({},_0x36ea22,_0x11b942['options']);return db[_0x27b3('0x2a')][_0x27b3('0x47')](_0x36ea22)[_0x27b3('0x25')](handleEntityNotFound(_0x4b3c1b,null))['then'](respondWithResult(_0x4b3c1b,null))[_0x27b3('0x43')](handleError(_0x4b3c1b,null));};exports[_0x27b3('0x48')]=function(_0x1ec925,_0x157c76){return db[_0x27b3('0x2a')][_0x27b3('0x48')](_0x1ec925['body'],{})['then'](respondWithResult(_0x157c76,0xc9))[_0x27b3('0x43')](handleError(_0x157c76,null));};exports[_0x27b3('0x23')]=function(_0x100008,_0x31cb74){if(_0x100008[_0x27b3('0x49')]['id']){delete _0x100008['body']['id'];}return db[_0x27b3('0x2a')]['find']({'where':{'id':_0x100008['params']['id']}})[_0x27b3('0x25')](handleEntityNotFound(_0x31cb74,null))[_0x27b3('0x25')](saveUpdates(_0x100008[_0x27b3('0x49')],null))[_0x27b3('0x25')](respondWithResult(_0x31cb74,null))['catch'](handleError(_0x31cb74,null));};exports['destroy']=function(_0x39333a,_0x5e2dbf){return db[_0x27b3('0x2a')][_0x27b3('0x47')]({'where':{'id':_0x39333a[_0x27b3('0x45')]['id']}})[_0x27b3('0x25')](handleEntityNotFound(_0x5e2dbf,null))[_0x27b3('0x25')](removeEntity(_0x5e2dbf,null))[_0x27b3('0x43')](handleError(_0x5e2dbf,null));}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 84a2c3d..b8f9d19 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 _0x6ed7=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','lodash','util'];(function(_0x2258e8,_0x396f17){var _0x539892=function(_0x5cd308){while(--_0x5cd308){_0x2258e8['push'](_0x2258e8['shift']());}};_0x539892(++_0x396f17);}(_0x6ed7,0x175));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ed('0x0'));var util=require(_0x76ed('0x1'));var logger=require(_0x76ed('0x2'))(_0x76ed('0x3'));var moment=require(_0x76ed('0x4'));var BPromise=require(_0x76ed('0x5'));var rp=require(_0x76ed('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76ed('0x7'));var config=require(_0x76ed('0x8'));var attributes=require(_0x76ed('0x9'));module[_0x76ed('0xa')]=function(_0x1f3ff2,_0x259a53){return _0x1f3ff2[_0x76ed('0xb')](_0x76ed('0xc'),attributes,{'tableName':_0x76ed('0xd'),'paranoid':![],'indexes':[{'name':_0x76ed('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index f732fa5..7006bd3 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 _0x66b0=['../../config/environment','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x66b0,0x1c6));var _0x066b=function(_0x271bc6,_0x334745){_0x271bc6=_0x271bc6-0x0;var _0x318b08=_0x66b0[_0x271bc6];return _0x318b08;};'use strict';var _=require(_0x066b('0x0'));var util=require(_0x066b('0x1'));var moment=require('moment');var BPromise=require(_0x066b('0x2'));var rs=require(_0x066b('0x3'));var fs=require('fs');var Redis=require(_0x066b('0x4'));var db=require(_0x066b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x066b('0x6'))(_0x066b('0x7'));var config=require(_0x066b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x066b('0x9')][_0x066b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e80e2,_0x35d1b0,_0x231f0c){return new BPromise(function(_0x4d4e1c,_0x247f40){return client[_0x066b('0xb')](_0x1e80e2,_0x231f0c)['then'](function(_0x2ab662){logger['info'](_0x066b('0xc'),_0x35d1b0,_0x066b('0xd'));logger[_0x066b('0xe')](_0x066b('0xf'),_0x35d1b0,_0x066b('0xd'),JSON[_0x066b('0x10')](_0x2ab662));if(_0x2ab662['error']){if(_0x2ab662['error'][_0x066b('0x11')]===0x1f4){logger[_0x066b('0x12')](_0x066b('0xc'),_0x35d1b0,_0x2ab662[_0x066b('0x12')][_0x066b('0x13')]);return _0x247f40(_0x2ab662['error'][_0x066b('0x13')]);}logger[_0x066b('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x35d1b0,_0x2ab662[_0x066b('0x12')][_0x066b('0x13')]);return _0x4d4e1c(_0x2ab662[_0x066b('0x12')][_0x066b('0x13')]);}else{logger['info'](_0x066b('0xc'),_0x35d1b0,_0x066b('0xd'));_0x4d4e1c(_0x2ab662['result'][_0x066b('0x13')]);}})[_0x066b('0x14')](function(_0x40db77){logger[_0x066b('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x35d1b0,_0x40db77);_0x247f40(_0x40db77);});});} \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index fc5f10c..16c69b3 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 _0xde9d=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/configurations','addConfiguration','update','destroy'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var path=require(_0xdde9('0x2'));var timeout=require(_0xdde9('0x3'));var express=require(_0xdde9('0x4'));var router=express['Router']();var fs_extra=require(_0xdde9('0x5'));var auth=require(_0xdde9('0x6'));var interaction=require(_0xdde9('0x7'));var config=require('../../config/environment');var controller=require(_0xdde9('0x8'));router[_0xdde9('0x9')]('/',auth[_0xdde9('0xa')](),controller['index']);router[_0xdde9('0x9')](_0xdde9('0xb'),auth[_0xdde9('0xa')](),controller[_0xdde9('0xc')]);router[_0xdde9('0x9')]('/:id/configurations',auth[_0xdde9('0xa')](),controller['getConfigurations']);router['get'](_0xdde9('0xd'),auth[_0xdde9('0xa')](),controller[_0xdde9('0xe')]);router['post']('/',auth[_0xdde9('0xa')](),controller['create']);router['post'](_0xdde9('0xf'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x10')]);router['put']('/:id',auth[_0xdde9('0xa')](),controller[_0xdde9('0x11')]);router['delete']('/:id',auth[_0xdde9('0xa')](),controller[_0xdde9('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 95ceaa1..5a02e69 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 _0xc812=['exports','STRING','HelpDesk','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc812,0x19f));var _0x2c81=function(_0x4d82e8,_0x244656){_0x4d82e8=_0x4d82e8-0x0;var _0x54d6e1=_0xc812[_0x4d82e8];return _0x54d6e1;};'use strict';var Sequelize=require(_0x2c81('0x0'));module[_0x2c81('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2c81('0x2')]},'username':{'type':Sequelize[_0x2c81('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2c81('0x2')],'allowNull':![],'defaultValue':_0x2c81('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2c81('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2c81('0x2')],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 48253c2..7935df0 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 _0x39eb=['path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','json','apply','save','update','then','destroy','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','options','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','reference','owner','remove','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x18d15e,_0x3f73cd){var _0x5c1661=function(_0x4610a1){while(--_0x4610a1){_0x18d15e['push'](_0x18d15e['shift']());}};_0x5c1661(++_0x3f73cd);}(_0x39eb,0xe4));var _0xb39e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x39eb[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xb39e('0x0'));var rimraf=require(_0xb39e('0x1'));var zipdir=require(_0xb39e('0x2'));var jsonpatch=require(_0xb39e('0x3'));var rp=require(_0xb39e('0x4'));var moment=require(_0xb39e('0x5'));var BPromise=require(_0xb39e('0x6'));var Mustache=require(_0xb39e('0x7'));var util=require('util');var path=require(_0xb39e('0x8'));var sox=require(_0xb39e('0x9'));var csv=require(_0xb39e('0xa'));var ejs=require(_0xb39e('0xb'));var fs=require('fs');var fs_extra=require(_0xb39e('0xc'));var _=require('lodash');var squel=require(_0xb39e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb39e('0xe'));var toCsv=require(_0xb39e('0xa'));var querystring=require(_0xb39e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb39e('0x10'));var qs=require(_0xb39e('0x11'));var as=require(_0xb39e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb39e('0x13'))(_0xb39e('0x14'));var utils=require(_0xb39e('0x15'));var config=require(_0xb39e('0x16'));var licenseUtil=require(_0xb39e('0x17'));var db=require(_0xb39e('0x18'))['db'];var integrations=require(_0xb39e('0x19'));function respondWithStatusCode(_0x5b1891,_0xd8a15a){_0xd8a15a=_0xd8a15a||0xcc;return function(_0x218a76){if(_0x218a76){return _0x5b1891[_0xb39e('0x1a')](_0xd8a15a);}return _0x5b1891[_0xb39e('0x1b')](_0xd8a15a)[_0xb39e('0x1c')]();};}function respondWithResult(_0x50c1a1,_0x1fbeb1){_0x1fbeb1=_0x1fbeb1||0xc8;return function(_0x193943){if(_0x193943){return _0x50c1a1[_0xb39e('0x1b')](_0x1fbeb1)['json'](_0x193943);}};}function respondWithFilteredResult(_0x263d4a,_0x393734){return function(_0x316208){if(_0x316208){var _0xc3de71=typeof _0x393734['offset']===_0xb39e('0x1d')&&typeof _0x393734[_0xb39e('0x1e')]===_0xb39e('0x1d');var _0x147f7f=_0x316208[_0xb39e('0x1f')];var _0xc2c76a=_0xc3de71?0x0:_0x393734[_0xb39e('0x20')];var _0xb89706=_0xc3de71?_0x316208[_0xb39e('0x1f')]:_0x393734[_0xb39e('0x20')]+_0x393734[_0xb39e('0x1e')];var _0x5a9ed3;if(_0xb89706>=_0x147f7f){_0xb89706=_0x147f7f;_0x5a9ed3=0xc8;}else{_0x5a9ed3=0xce;}_0x263d4a['status'](_0x5a9ed3);return _0x263d4a['set']('Content-Range',_0xc2c76a+'-'+_0xb89706+'/'+_0x147f7f)[_0xb39e('0x21')](_0x316208);}return null;};}function patchUpdates(_0x3f35b1){return function(_0x2e1fe5){try{jsonpatch[_0xb39e('0x22')](_0x2e1fe5,_0x3f35b1,!![]);}catch(_0x32d6b7){return BPromise['reject'](_0x32d6b7);}return _0x2e1fe5[_0xb39e('0x23')]();};}function saveUpdates(_0x55083c,_0x1a6a8d){return function(_0x299317){if(_0x299317){return _0x299317[_0xb39e('0x24')](_0x55083c)[_0xb39e('0x25')](function(_0x4b55ad){return _0x4b55ad;});}return null;};}function removeEntity(_0x24b910,_0x23f466){return function(_0x391f64){if(_0x391f64){return _0x391f64[_0xb39e('0x26')]()[_0xb39e('0x25')](function(){_0x24b910[_0xb39e('0x1b')](0xcc)[_0xb39e('0x1c')]();});}};}function handleEntityNotFound(_0x1e9305,_0x539a66){return function(_0x462e41){if(!_0x462e41){_0x1e9305[_0xb39e('0x1a')](0x194);}return _0x462e41;};}function handleError(_0x525dcd,_0x2ca343){_0x2ca343=_0x2ca343||0x1f4;return function(_0x35c56e){logger['error'](_0x35c56e['stack']);if(_0x35c56e['name']){delete _0x35c56e[_0xb39e('0x27')];}_0x525dcd['status'](_0x2ca343)[_0xb39e('0x28')](_0x35c56e);};}exports['index']=function(_0x104a5c,_0x329d88){var _0x11099f={},_0x4b4b8a={},_0x58407b={'count':0x0,'rows':[]};var _0x3f4f31=_[_0xb39e('0x29')](db[_0xb39e('0x2a')][_0xb39e('0x2b')],function(_0x154ad8){return{'name':_0x154ad8[_0xb39e('0x2c')],'type':_0x154ad8[_0xb39e('0x2d')][_0xb39e('0x2e')]};});_0x4b4b8a[_0xb39e('0x2f')]=_['map'](_0x3f4f31,_0xb39e('0x27'));_0x4b4b8a['query']=_[_0xb39e('0x30')](_0x104a5c[_0xb39e('0x31')]);_0x4b4b8a['filters']=_[_0xb39e('0x32')](_0x4b4b8a[_0xb39e('0x2f')],_0x4b4b8a['query']);_0x11099f[_0xb39e('0x33')]=_[_0xb39e('0x32')](_0x4b4b8a[_0xb39e('0x2f')],qs[_0xb39e('0x34')](_0x104a5c['query'][_0xb39e('0x34')]));_0x11099f[_0xb39e('0x33')]=_0x11099f[_0xb39e('0x33')][_0xb39e('0x35')]?_0x11099f['attributes']:_0x4b4b8a[_0xb39e('0x2f')];if(!_0x104a5c[_0xb39e('0x31')][_0xb39e('0x36')](_0xb39e('0x37'))){_0x11099f[_0xb39e('0x1e')]=qs[_0xb39e('0x1e')](_0x104a5c[_0xb39e('0x31')][_0xb39e('0x1e')]);_0x11099f['offset']=qs[_0xb39e('0x20')](_0x104a5c[_0xb39e('0x31')][_0xb39e('0x20')]);}_0x11099f[_0xb39e('0x38')]=qs[_0xb39e('0x39')](_0x104a5c[_0xb39e('0x31')][_0xb39e('0x39')]);_0x11099f[_0xb39e('0x3a')]=qs[_0xb39e('0x3b')](_[_0xb39e('0x3c')](_0x104a5c[_0xb39e('0x31')],_0x4b4b8a['filters']),_0x3f4f31);if(_0x104a5c[_0xb39e('0x31')][_0xb39e('0x3d')]){_0x11099f[_0xb39e('0x3a')]=_['merge'](_0x11099f[_0xb39e('0x3a')],{'$or':_[_0xb39e('0x29')](_0x3f4f31,function(_0x16f63d){if(_0x16f63d['type']!=='VIRTUAL'){var _0x2c1644={};_0x2c1644[_0x16f63d[_0xb39e('0x27')]]={'$like':'%'+_0x104a5c[_0xb39e('0x31')][_0xb39e('0x3d')]+'%'};return _0x2c1644;}})});}_0x11099f=_[_0xb39e('0x3e')]({},_0x11099f,_0x104a5c['options']);var _0x34b465={'where':_0x11099f[_0xb39e('0x3a')]};return db[_0xb39e('0x2a')][_0xb39e('0x1f')](_0x34b465)[_0xb39e('0x25')](function(_0x4ec047){_0x58407b[_0xb39e('0x1f')]=_0x4ec047;if(_0x104a5c[_0xb39e('0x31')][_0xb39e('0x3f')]){_0x11099f['include']=[{'all':!![]}];}return db[_0xb39e('0x2a')][_0xb39e('0x40')](_0x11099f);})[_0xb39e('0x25')](function(_0x29d6a4){_0x58407b[_0xb39e('0x41')]=_0x29d6a4;return _0x58407b;})['then'](respondWithFilteredResult(_0x329d88,_0x11099f))[_0xb39e('0x42')](handleError(_0x329d88,null));};exports[_0xb39e('0x43')]=function(_0x9b63d9,_0x1b47fe){var _0x55cf42={'raw':![],'where':{'id':_0x9b63d9[_0xb39e('0x44')]['id']}},_0x3980f8={};_0x3980f8[_0xb39e('0x2f')]=_[_0xb39e('0x30')](db[_0xb39e('0x2a')][_0xb39e('0x2b')]);_0x3980f8[_0xb39e('0x31')]=_[_0xb39e('0x30')](_0x9b63d9[_0xb39e('0x31')]);_0x3980f8['filters']=_[_0xb39e('0x32')](_0x3980f8[_0xb39e('0x2f')],_0x3980f8[_0xb39e('0x31')]);_0x55cf42['attributes']=_['intersection'](_0x3980f8[_0xb39e('0x2f')],qs[_0xb39e('0x34')](_0x9b63d9['query'][_0xb39e('0x34')]));_0x55cf42[_0xb39e('0x33')]=_0x55cf42['attributes'][_0xb39e('0x35')]?_0x55cf42['attributes']:_0x3980f8[_0xb39e('0x2f')];if(_0x9b63d9[_0xb39e('0x31')]['includeAll']){_0x55cf42[_0xb39e('0x45')]=[{'all':!![]}];}_0x55cf42=_['merge']({},_0x55cf42,_0x9b63d9['options']);return db['VtigerAccount'][_0xb39e('0x46')](_0x55cf42)[_0xb39e('0x25')](handleEntityNotFound(_0x1b47fe,null))[_0xb39e('0x25')](respondWithResult(_0x1b47fe,null))[_0xb39e('0x42')](handleError(_0x1b47fe,null));};exports[_0xb39e('0x47')]=function(_0x177c03,_0x21589f){return db['VtigerAccount'][_0xb39e('0x47')](_0x177c03[_0xb39e('0x48')],{})[_0xb39e('0x25')](respondWithResult(_0x21589f,0xc9))['catch'](handleError(_0x21589f,null));};exports[_0xb39e('0x24')]=function(_0x1a4aaa,_0x47266a){if(_0x1a4aaa[_0xb39e('0x48')]['id']){delete _0x1a4aaa[_0xb39e('0x48')]['id'];}return db[_0xb39e('0x2a')][_0xb39e('0x46')]({'where':{'id':_0x1a4aaa[_0xb39e('0x44')]['id']}})['then'](handleEntityNotFound(_0x47266a,null))[_0xb39e('0x25')](saveUpdates(_0x1a4aaa['body'],null))['then'](respondWithResult(_0x47266a,null))[_0xb39e('0x42')](handleError(_0x47266a,null));};exports[_0xb39e('0x26')]=function(_0x146bb9,_0x11479c){return db[_0xb39e('0x2a')][_0xb39e('0x46')]({'where':{'id':_0x146bb9['params']['id']}})['then'](handleEntityNotFound(_0x11479c,null))[_0xb39e('0x25')](removeEntity(_0x11479c,null))[_0xb39e('0x42')](handleError(_0x11479c,null));};exports[_0xb39e('0x49')]=function(_0x555384,_0x3262e8,_0x54e06b){var _0xc1f3d5={};var _0x2f68f1={};var _0x36a723;var _0x141934;return db[_0xb39e('0x2a')][_0xb39e('0x4a')]({'where':{'id':_0x555384['params']['id']}})['then'](handleEntityNotFound(_0x3262e8,null))[_0xb39e('0x25')](function(_0x1b7cf1){if(_0x1b7cf1){_0x36a723=_0x1b7cf1;_0x2f68f1[_0xb39e('0x2f')]=_[_0xb39e('0x30')](db['VtigerConfiguration'][_0xb39e('0x2b')]);_0x2f68f1[_0xb39e('0x31')]=_['keys'](_0x555384[_0xb39e('0x31')]);_0x2f68f1[_0xb39e('0x3b')]=_['intersection'](_0x2f68f1[_0xb39e('0x2f')],_0x2f68f1[_0xb39e('0x31')]);_0xc1f3d5[_0xb39e('0x33')]=_[_0xb39e('0x32')](_0x2f68f1[_0xb39e('0x2f')],qs[_0xb39e('0x34')](_0x555384[_0xb39e('0x31')][_0xb39e('0x34')]));_0xc1f3d5[_0xb39e('0x33')]=_0xc1f3d5[_0xb39e('0x33')]['length']?_0xc1f3d5[_0xb39e('0x33')]:_0x2f68f1[_0xb39e('0x2f')];_0xc1f3d5[_0xb39e('0x38')]=qs[_0xb39e('0x39')](_0x555384[_0xb39e('0x31')][_0xb39e('0x39')]);_0xc1f3d5[_0xb39e('0x3a')]=qs[_0xb39e('0x3b')](_[_0xb39e('0x3c')](_0x555384[_0xb39e('0x31')],_0x2f68f1[_0xb39e('0x3b')]));if(_0x555384['query'][_0xb39e('0x3d')]){_0xc1f3d5[_0xb39e('0x3a')]=_[_0xb39e('0x3e')](_0xc1f3d5[_0xb39e('0x3a')],{'$or':_[_0xb39e('0x29')](_0xc1f3d5[_0xb39e('0x33')],function(_0x2d770d){var _0x394aef={};_0x394aef[_0x2d770d]={'$like':'%'+_0x555384['query'][_0xb39e('0x3d')]+'%'};return _0x394aef;})});}_0xc1f3d5=_[_0xb39e('0x3e')]({},_0xc1f3d5,_0x555384[_0xb39e('0x4b')]);return _0x36a723[_0xb39e('0x49')](_0xc1f3d5);}})[_0xb39e('0x25')](function(_0x203766){if(_0x203766){_0x141934=_0x203766[_0xb39e('0x35')];if(!_0x555384[_0xb39e('0x31')][_0xb39e('0x36')]('nolimit')){_0xc1f3d5['limit']=qs['limit'](_0x555384[_0xb39e('0x31')][_0xb39e('0x1e')]);_0xc1f3d5[_0xb39e('0x20')]=qs[_0xb39e('0x20')](_0x555384[_0xb39e('0x31')][_0xb39e('0x20')]);}return _0x36a723[_0xb39e('0x49')](_0xc1f3d5);}})[_0xb39e('0x25')](function(_0x1d253a){if(_0x1d253a){return _0x1d253a?{'count':_0x141934,'rows':_0x1d253a}:null;}})[_0xb39e('0x25')](respondWithResult(_0x3262e8,null))[_0xb39e('0x42')](handleError(_0x3262e8,null));};exports[_0xb39e('0x4c')]=function(_0x51d7b1,_0x99fca,_0x4c3469){if(_0x51d7b1[_0xb39e('0x48')]['id']){delete _0x51d7b1[_0xb39e('0x48')]['id'];}return db[_0xb39e('0x2a')][_0xb39e('0x4a')]({'where':{'id':_0x51d7b1[_0xb39e('0x44')]['id']}})[_0xb39e('0x25')](handleEntityNotFound(_0x99fca,null))[_0xb39e('0x25')](function(_0x57fdf2){if(_0x57fdf2){_0x51d7b1['body'][_0xb39e('0x4d')]=_0x57fdf2['id'];_0x51d7b1[_0xb39e('0x48')][_0xb39e('0x4e')]=integrations['getSubjects'](_0x51d7b1[_0xb39e('0x48')]['channel'],_0x51d7b1['body'][_0xb39e('0x2d')]);_0x51d7b1[_0xb39e('0x48')][_0xb39e('0x4f')]=integrations[_0xb39e('0x50')](_0x51d7b1[_0xb39e('0x48')][_0xb39e('0x51')],_0x51d7b1[_0xb39e('0x48')][_0xb39e('0x2d')]);return db['VtigerConfiguration'][_0xb39e('0x47')](_0x51d7b1[_0xb39e('0x48')],{'include':[{'model':db['VtigerField'],'as':_0xb39e('0x4e')},{'model':db[_0xb39e('0x52')],'as':_0xb39e('0x4f')}]});}return null;})[_0xb39e('0x25')](respondWithResult(_0x99fca,null))[_0xb39e('0x42')](handleError(_0x99fca,null));};var md5=require('md5');exports[_0xb39e('0x53')]=function(_0x8bca7c,_0x4142a7,_0x12b1ef){var _0xe845b3=null;var _0x13a97c=null;var _0x3a8b01=null;var _0x5edf32=null;var _0x2be836='';return db[_0xb39e('0x2a')][_0xb39e('0x4a')]({'where':{'id':_0x8bca7c[_0xb39e('0x44')]['id']},'attributes':['id',_0xb39e('0x27'),_0xb39e('0x54'),_0xb39e('0x55'),_0xb39e('0x56'),'remoteUri',_0xb39e('0x57'),_0xb39e('0x58')]})[_0xb39e('0x25')](handleEntityNotFound(_0x4142a7,null))['then'](function(_0x4a1d05){if(_0x4a1d05){_0xe845b3=_0x4a1d05[_0xb39e('0x54')];_0x13a97c=_0x4a1d05['accessKey'];_0x3a8b01=_0x4a1d05['moduleName'];_0x2be836=_0x4a1d05[_0xb39e('0x59')];var _0x2d12fd=_0x2be836['slice'](-0x1);if(_0x2d12fd==='/'){_0x2be836=_0x2be836['substring'](0x0,_0x2be836[_0xb39e('0x5a')](_0x2d12fd));}_0x5edf32=util[_0xb39e('0x5b')](_0xb39e('0x5c'),_0x2be836);var _0x5434e3={'method':'GET','uri':_0x5edf32,'qs':{'operation':_0xb39e('0x5d'),'username':_0x4a1d05[_0xb39e('0x54')]},'json':!![]};return rp(_0x5434e3);}})['then'](function(_0x173207){if(_0x173207[_0xb39e('0x5e')]){var _0x5cc749={'method':_0xb39e('0x5f'),'uri':_0x5edf32,'form':{'operation':_0xb39e('0x60'),'username':_0xe845b3,'accessKey':md5(_0x173207[_0xb39e('0x61')][_0xb39e('0x62')]+_0x13a97c)},'json':!![]};return rp(_0x5cc749);}})[_0xb39e('0x25')](function(_0x3a6967){if(_0x3a6967[_0xb39e('0x5e')]){var _0x323611={'method':_0xb39e('0x63'),'uri':_0x5edf32,'qs':{'operation':'describe','username':_0xe845b3,'sessionName':_0x3a6967[_0xb39e('0x61')]['sessionName'],'elementType':_0x3a8b01},'json':!![]};return rp(_0x323611);}})[_0xb39e('0x25')](function(_0x128c78){if(_0x128c78[_0xb39e('0x5e')]){var _0x366943=['autogenerated',_0xb39e('0x64'),_0xb39e('0x65')];_[_0xb39e('0x66')](_0x128c78[_0xb39e('0x61')]['fields'],function(_0x2dd481){return _0x366943['includes'](_0x2dd481[_0xb39e('0x2d')]['name']);});_['remove'](_0x128c78[_0xb39e('0x61')][_0xb39e('0x34')],function(_0x2bb273){return _0x2bb273[_0xb39e('0x67')]===_0xb39e('0x68');});return{'count':_0x128c78[_0xb39e('0x61')][_0xb39e('0x34')][_0xb39e('0x35')],'rows':_[_0xb39e('0x29')](_0x128c78[_0xb39e('0x61')][_0xb39e('0x34')],function(_0x3108a0){return{'id':_0x3108a0[_0xb39e('0x27')],'name':_0x3108a0[_0xb39e('0x69')],'custom':_[_0xb39e('0x6a')](_0x3108a0[_0xb39e('0x27')],'cf_')?!![]:![],'options':_0x3108a0[_0xb39e('0x2d')][_0xb39e('0x27')]===_0xb39e('0x6b')&&_0x3108a0[_0xb39e('0x2d')][_0xb39e('0x6c')][_0xb39e('0x35')]>0x0?_[_0xb39e('0x29')](_0x3108a0[_0xb39e('0x2d')][_0xb39e('0x6c')],function(_0x19a6d8){return{'name':_0x19a6d8['label'],'value':_0x19a6d8[_0xb39e('0x6d')]};}):[]};})};}})[_0xb39e('0x25')](respondWithResult(_0x4142a7,null))['catch'](function(_0x576553){console[_0xb39e('0x6e')](_0xb39e('0x6f')+_0x576553);var _0x319d76=_0x8bca7c[_0xb39e('0x31')]['test']?0x1f4:_0x576553['statusCode']||0x1f4;logger[_0xb39e('0x70')](_0xb39e('0x71'),_0xb39e('0x53'),_0x319d76,JSON[_0xb39e('0x72')](_0x576553));delete _0x576553['name'];if(_0x319d76===0x191){_0x319d76=0x190;}_0x4142a7['status'](_0x319d76)[_0xb39e('0x28')](_0x8bca7c[_0xb39e('0x31')][_0xb39e('0x73')]?{'message':_0xb39e('0x74'),'statusCode':_0x576553[_0xb39e('0x75')]}:_0x576553);});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ea87cf7..08dfa29 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 _0x3718=['VtigerAccount','int_vtiger_accounts','lodash','api','bluebird','request-promise','../../config/environment','./intVtigerAccount.attributes','define'];(function(_0x8deafb,_0x3ff314){var _0x3a7269=function(_0x33eb70){while(--_0x33eb70){_0x8deafb['push'](_0x8deafb['shift']());}};_0x3a7269(++_0x3ff314);}(_0x3718,0xda));var _0x8371=function(_0x1291e4,_0x1cc691){_0x1291e4=_0x1291e4-0x0;var _0x315b9d=_0x3718[_0x1291e4];return _0x315b9d;};'use strict';var _=require(_0x8371('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8371('0x1'));var moment=require('moment');var BPromise=require(_0x8371('0x2'));var rp=require(_0x8371('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8371('0x4'));var attributes=require(_0x8371('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x566a7f,_0x38e283){return _0x566a7f[_0x8371('0x6')](_0x8371('0x7'),attributes,{'tableName':_0x8371('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 5a3bbc8..9410c6a 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 _0x757a=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x22ec77,_0x13b543){var _0x50a916=function(_0x539a3a){while(--_0x539a3a){_0x22ec77['push'](_0x22ec77['shift']());}};_0x50a916(++_0x13b543);}(_0x757a,0xde));var _0xa757=function(_0x55a09a,_0x3c2faa){_0x55a09a=_0x55a09a-0x0;var _0xc2b30f=_0x757a[_0x55a09a];return _0xc2b30f;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetVtigerAccount',_0x4d9f58);logger['debug']('GetVtigerAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetVtigerAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7c47d95..fb4c015 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 _0x7a24=['index','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get'];(function(_0x3a0362,_0x152148){var _0x42ffe9=function(_0x28383a){while(--_0x28383a){_0x3a0362['push'](_0x3a0362['shift']());}};_0x42ffe9(++_0x152148);}(_0x7a24,0x1f2));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x47a2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x47a2('0x1'));var router=express[_0x47a2('0x2')]();var fs_extra=require(_0x47a2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x47a2('0x4'));var config=require(_0x47a2('0x5'));var controller=require(_0x47a2('0x6'));router[_0x47a2('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a2('0x8')]);router[_0x47a2('0x7')]('/:id',auth[_0x47a2('0x9')](),controller['show']);router[_0x47a2('0x7')](_0x47a2('0xa'),auth[_0x47a2('0x9')](),controller['getFields']);router[_0x47a2('0x7')](_0x47a2('0xb'),auth[_0x47a2('0x9')](),controller[_0x47a2('0xc')]);router[_0x47a2('0x7')](_0x47a2('0xd'),auth[_0x47a2('0x9')](),controller[_0x47a2('0xe')]);router[_0x47a2('0xf')]('/',auth['isAuthenticated'](),controller[_0x47a2('0x10')]);router[_0x47a2('0x11')](_0x47a2('0x12'),auth[_0x47a2('0x9')](),controller[_0x47a2('0x13')]);router[_0x47a2('0x14')](_0x47a2('0x12'),auth[_0x47a2('0x9')](),controller[_0x47a2('0x15')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ede0d40..e7ee698 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 _0xda50=['exports','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xda50,0x1ae));var _0x0da5=function(_0x53fad0,_0xd788fd){_0x53fad0=_0x53fad0-0x0;var _0x5284da=_0xda50[_0x53fad0];return _0x5284da;};'use strict';var Sequelize=require('sequelize');module[_0x0da5('0x0')]={'name':{'type':Sequelize[_0x0da5('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d7dccf5..169ee2d 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 _0x39d6=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x5bb274,_0x34d3ff){var _0x6b8de4=function(_0x4c5e41){while(--_0x4c5e41){_0x5bb274['push'](_0x5bb274['shift']());}};_0x6b8de4(++_0x34d3ff);}(_0x39d6,0x8a));var _0x639d=function(_0x4cc815,_0x1d6f0c){_0x4cc815=_0x4cc815-0x0;var _0x34731e=_0x39d6[_0x4cc815];return _0x34731e;};'use strict';var emlformat=require(_0x639d('0x0'));var rimraf=require(_0x639d('0x1'));var zipdir=require(_0x639d('0x2'));var jsonpatch=require(_0x639d('0x3'));var rp=require(_0x639d('0x4'));var moment=require(_0x639d('0x5'));var BPromise=require(_0x639d('0x6'));var Mustache=require(_0x639d('0x7'));var util=require(_0x639d('0x8'));var path=require(_0x639d('0x9'));var sox=require('sox');var csv=require(_0x639d('0xa'));var ejs=require(_0x639d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x639d('0xc'));var crypto=require('crypto');var jsforce=require(_0x639d('0xd'));var deskjs=require(_0x639d('0xe'));var toCsv=require(_0x639d('0xa'));var querystring=require(_0x639d('0xf'));var Papa=require(_0x639d('0x10'));var Redis=require('ioredis');var authService=require(_0x639d('0x11'));var qs=require(_0x639d('0x12'));var as=require(_0x639d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x639d('0x14'))('api');var utils=require(_0x639d('0x15'));var config=require(_0x639d('0x16'));var licenseUtil=require(_0x639d('0x17'));var db=require(_0x639d('0x18'))['db'];function respondWithStatusCode(_0xf1358b,_0x424521){_0x424521=_0x424521||0xcc;return function(_0x47d2b5){if(_0x47d2b5){return _0xf1358b[_0x639d('0x19')](_0x424521);}return _0xf1358b[_0x639d('0x1a')](_0x424521)[_0x639d('0x1b')]();};}function respondWithResult(_0x184a6a,_0x5582d9){_0x5582d9=_0x5582d9||0xc8;return function(_0x46e6e8){if(_0x46e6e8){return _0x184a6a[_0x639d('0x1a')](_0x5582d9)[_0x639d('0x1c')](_0x46e6e8);}};}function respondWithFilteredResult(_0x302511,_0x2fafc1){return function(_0x33ee8d){if(_0x33ee8d){var _0x2fea80=typeof _0x2fafc1[_0x639d('0x1d')]===_0x639d('0x1e')&&typeof _0x2fafc1[_0x639d('0x1f')]===_0x639d('0x1e');var _0x5858de=_0x33ee8d[_0x639d('0x20')];var _0x2d1820=_0x2fea80?0x0:_0x2fafc1[_0x639d('0x1d')];var _0x4ba54b=_0x2fea80?_0x33ee8d[_0x639d('0x20')]:_0x2fafc1['offset']+_0x2fafc1[_0x639d('0x1f')];var _0x209d10;if(_0x4ba54b>=_0x5858de){_0x4ba54b=_0x5858de;_0x209d10=0xc8;}else{_0x209d10=0xce;}_0x302511[_0x639d('0x1a')](_0x209d10);return _0x302511[_0x639d('0x21')]('Content-Range',_0x2d1820+'-'+_0x4ba54b+'/'+_0x5858de)[_0x639d('0x1c')](_0x33ee8d);}return null;};}function patchUpdates(_0x548a6d){return function(_0x34b01b){try{jsonpatch[_0x639d('0x22')](_0x34b01b,_0x548a6d,!![]);}catch(_0x244c1c){return BPromise[_0x639d('0x23')](_0x244c1c);}return _0x34b01b['save']();};}function saveUpdates(_0x4b08af,_0x1cbbff){return function(_0x23caeb){if(_0x23caeb){return _0x23caeb['update'](_0x4b08af)['then'](function(_0x3b35be){return _0x3b35be;});}return null;};}function removeEntity(_0x206fa6,_0x504ec0){return function(_0x1c5413){if(_0x1c5413){return _0x1c5413[_0x639d('0x24')]()[_0x639d('0x25')](function(){_0x206fa6[_0x639d('0x1a')](0xcc)[_0x639d('0x1b')]();});}};}function handleEntityNotFound(_0x1019fb,_0x701c0f){return function(_0x4d5ba1){if(!_0x4d5ba1){_0x1019fb[_0x639d('0x19')](0x194);}return _0x4d5ba1;};}function handleError(_0x3042ef,_0x5d4dfe){_0x5d4dfe=_0x5d4dfe||0x1f4;return function(_0x575da4){logger[_0x639d('0x26')](_0x575da4[_0x639d('0x27')]);if(_0x575da4['name']){delete _0x575da4[_0x639d('0x28')];}_0x3042ef['status'](_0x5d4dfe)[_0x639d('0x29')](_0x575da4);};}exports[_0x639d('0x2a')]=function(_0x420a35,_0x14bdd2){var _0x27a8ee={},_0x5d14a5={},_0xf25931={'count':0x0,'rows':[]};var _0x227a39=_[_0x639d('0x2b')](db[_0x639d('0x2c')][_0x639d('0x2d')],function(_0x2f24fd){return{'name':_0x2f24fd[_0x639d('0x2e')],'type':_0x2f24fd[_0x639d('0x2f')]['key']};});_0x5d14a5[_0x639d('0x30')]=_[_0x639d('0x2b')](_0x227a39,'name');_0x5d14a5[_0x639d('0x31')]=_[_0x639d('0x32')](_0x420a35[_0x639d('0x31')]);_0x5d14a5[_0x639d('0x33')]=_[_0x639d('0x34')](_0x5d14a5[_0x639d('0x30')],_0x5d14a5[_0x639d('0x31')]);_0x27a8ee['attributes']=_[_0x639d('0x34')](_0x5d14a5['model'],qs[_0x639d('0x35')](_0x420a35['query']['fields']));_0x27a8ee[_0x639d('0x36')]=_0x27a8ee[_0x639d('0x36')][_0x639d('0x37')]?_0x27a8ee[_0x639d('0x36')]:_0x5d14a5[_0x639d('0x30')];if(!_0x420a35[_0x639d('0x31')]['hasOwnProperty'](_0x639d('0x38'))){_0x27a8ee[_0x639d('0x1f')]=qs[_0x639d('0x1f')](_0x420a35[_0x639d('0x31')][_0x639d('0x1f')]);_0x27a8ee[_0x639d('0x1d')]=qs['offset'](_0x420a35[_0x639d('0x31')][_0x639d('0x1d')]);}_0x27a8ee[_0x639d('0x39')]=qs['sort'](_0x420a35[_0x639d('0x31')][_0x639d('0x3a')]);_0x27a8ee[_0x639d('0x3b')]=qs[_0x639d('0x33')](_[_0x639d('0x3c')](_0x420a35[_0x639d('0x31')],_0x5d14a5[_0x639d('0x33')]),_0x227a39);if(_0x420a35[_0x639d('0x31')][_0x639d('0x3d')]){_0x27a8ee['where']=_[_0x639d('0x3e')](_0x27a8ee[_0x639d('0x3b')],{'$or':_[_0x639d('0x2b')](_0x227a39,function(_0x66caf8){if(_0x66caf8[_0x639d('0x2f')]!==_0x639d('0x3f')){var _0x20604c={};_0x20604c[_0x66caf8[_0x639d('0x28')]]={'$like':'%'+_0x420a35[_0x639d('0x31')]['filter']+'%'};return _0x20604c;}})});}_0x27a8ee=_[_0x639d('0x3e')]({},_0x27a8ee,_0x420a35[_0x639d('0x40')]);var _0x3b5ce6={'where':_0x27a8ee[_0x639d('0x3b')]};return db[_0x639d('0x2c')]['count'](_0x3b5ce6)[_0x639d('0x25')](function(_0x393ff9){_0xf25931[_0x639d('0x20')]=_0x393ff9;if(_0x420a35['query']['includeAll']){_0x27a8ee[_0x639d('0x41')]=[{'all':!![]}];}return db[_0x639d('0x2c')][_0x639d('0x42')](_0x27a8ee);})[_0x639d('0x25')](function(_0x3e04a5){_0xf25931[_0x639d('0x43')]=_0x3e04a5;return _0xf25931;})[_0x639d('0x25')](respondWithFilteredResult(_0x14bdd2,_0x27a8ee))[_0x639d('0x44')](handleError(_0x14bdd2,null));};exports['show']=function(_0x493b99,_0x1ce6c2){var _0x3e9207={'raw':![],'where':{'id':_0x493b99[_0x639d('0x45')]['id']}},_0x2e491f={};_0x2e491f[_0x639d('0x30')]=_[_0x639d('0x32')](db['VtigerConfiguration'][_0x639d('0x2d')]);_0x2e491f[_0x639d('0x31')]=_['keys'](_0x493b99[_0x639d('0x31')]);_0x2e491f['filters']=_[_0x639d('0x34')](_0x2e491f[_0x639d('0x30')],_0x2e491f[_0x639d('0x31')]);_0x3e9207[_0x639d('0x36')]=_[_0x639d('0x34')](_0x2e491f[_0x639d('0x30')],qs[_0x639d('0x35')](_0x493b99['query'][_0x639d('0x35')]));_0x3e9207[_0x639d('0x36')]=_0x3e9207[_0x639d('0x36')][_0x639d('0x37')]?_0x3e9207[_0x639d('0x36')]:_0x2e491f[_0x639d('0x30')];if(_0x493b99[_0x639d('0x31')][_0x639d('0x46')]){_0x3e9207[_0x639d('0x41')]=[{'all':!![]}];}_0x3e9207=_[_0x639d('0x3e')]({},_0x3e9207,_0x493b99[_0x639d('0x40')]);return db[_0x639d('0x2c')]['find'](_0x3e9207)['then'](handleEntityNotFound(_0x1ce6c2,null))[_0x639d('0x25')](respondWithResult(_0x1ce6c2,null))[_0x639d('0x44')](handleError(_0x1ce6c2,null));};exports[_0x639d('0x47')]=function(_0x15f0f4,_0x2b8eeb){return db['VtigerConfiguration']['create'](_0x15f0f4[_0x639d('0x48')],{})[_0x639d('0x25')](respondWithResult(_0x2b8eeb,0xc9))[_0x639d('0x44')](handleError(_0x2b8eeb,null));};exports['update']=function(_0x5d9e5f,_0x17cdca){if(_0x5d9e5f['body']['id']){delete _0x5d9e5f[_0x639d('0x48')]['id'];}return db[_0x639d('0x2c')][_0x639d('0x49')]({'where':{'id':_0x5d9e5f[_0x639d('0x45')]['id']}})['then'](handleEntityNotFound(_0x17cdca,null))[_0x639d('0x25')](saveUpdates(_0x5d9e5f[_0x639d('0x48')],null))[_0x639d('0x25')](respondWithResult(_0x17cdca,null))[_0x639d('0x44')](handleError(_0x17cdca,null));};exports[_0x639d('0x24')]=function(_0x30fe35,_0x2720b1){return db[_0x639d('0x2c')]['find']({'where':{'id':_0x30fe35[_0x639d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2720b1,null))['then'](removeEntity(_0x2720b1,null))[_0x639d('0x44')](handleError(_0x2720b1,null));};exports[_0x639d('0x4a')]=function(_0x54eee2,_0x3fd177,_0x5f3103){var _0x53113d={};var _0x128467={};var _0x49b970;var _0x2e80e9;return db['VtigerConfiguration'][_0x639d('0x4b')]({'where':{'id':_0x54eee2['params']['id']}})[_0x639d('0x25')](handleEntityNotFound(_0x3fd177,null))[_0x639d('0x25')](function(_0x47db6e){if(_0x47db6e){_0x49b970=_0x47db6e;_0x128467[_0x639d('0x30')]=_['keys'](db['VtigerField'][_0x639d('0x2d')]);_0x128467[_0x639d('0x31')]=_[_0x639d('0x32')](_0x54eee2[_0x639d('0x31')]);_0x128467[_0x639d('0x33')]=_[_0x639d('0x34')](_0x128467[_0x639d('0x30')],_0x128467[_0x639d('0x31')]);_0x53113d[_0x639d('0x36')]=_[_0x639d('0x34')](_0x128467[_0x639d('0x30')],qs[_0x639d('0x35')](_0x54eee2[_0x639d('0x31')][_0x639d('0x35')]));_0x53113d['attributes']=_0x53113d[_0x639d('0x36')][_0x639d('0x37')]?_0x53113d[_0x639d('0x36')]:_0x128467['model'];_0x53113d['order']=qs[_0x639d('0x3a')](_0x54eee2[_0x639d('0x31')][_0x639d('0x3a')]);_0x53113d[_0x639d('0x3b')]=qs[_0x639d('0x33')](_[_0x639d('0x3c')](_0x54eee2[_0x639d('0x31')],_0x128467['filters']));if(_0x54eee2[_0x639d('0x31')][_0x639d('0x3d')]){_0x53113d[_0x639d('0x3b')]=_['merge'](_0x53113d[_0x639d('0x3b')],{'$or':_['map'](_0x53113d[_0x639d('0x36')],function(_0xab2403){var _0x4ad4c1={};_0x4ad4c1[_0xab2403]={'$like':'%'+_0x54eee2[_0x639d('0x31')][_0x639d('0x3d')]+'%'};return _0x4ad4c1;})});}_0x53113d=_[_0x639d('0x3e')]({},_0x53113d,_0x54eee2[_0x639d('0x40')]);return _0x49b970[_0x639d('0x4a')](_0x53113d);}})[_0x639d('0x25')](function(_0x1d7e55){if(_0x1d7e55){_0x2e80e9=_0x1d7e55[_0x639d('0x37')];if(!_0x54eee2['query'][_0x639d('0x4c')](_0x639d('0x38'))){_0x53113d[_0x639d('0x1f')]=qs['limit'](_0x54eee2[_0x639d('0x31')][_0x639d('0x1f')]);_0x53113d[_0x639d('0x1d')]=qs[_0x639d('0x1d')](_0x54eee2[_0x639d('0x31')][_0x639d('0x1d')]);}return _0x49b970['getFields'](_0x53113d);}})[_0x639d('0x25')](function(_0xdab231){if(_0xdab231){return _0xdab231?{'count':_0x2e80e9,'rows':_0xdab231}:null;}})['then'](respondWithResult(_0x3fd177,null))[_0x639d('0x44')](handleError(_0x3fd177,null));};exports[_0x639d('0x4d')]=function(_0x1d7e60,_0x322cfd,_0x3093c9){var _0x57acd7={};var _0x2f4a73={};var _0x32e34b;var _0x51545b;return db[_0x639d('0x2c')][_0x639d('0x4b')]({'where':{'id':_0x1d7e60[_0x639d('0x45')]['id']}})[_0x639d('0x25')](handleEntityNotFound(_0x322cfd,null))[_0x639d('0x25')](function(_0x512294){if(_0x512294){_0x32e34b=_0x512294;_0x2f4a73[_0x639d('0x30')]=_['keys'](db[_0x639d('0x4e')][_0x639d('0x2d')]);_0x2f4a73[_0x639d('0x31')]=_[_0x639d('0x32')](_0x1d7e60[_0x639d('0x31')]);_0x2f4a73[_0x639d('0x33')]=_[_0x639d('0x34')](_0x2f4a73[_0x639d('0x30')],_0x2f4a73[_0x639d('0x31')]);_0x57acd7[_0x639d('0x36')]=_[_0x639d('0x34')](_0x2f4a73[_0x639d('0x30')],qs[_0x639d('0x35')](_0x1d7e60['query']['fields']));_0x57acd7[_0x639d('0x36')]=_0x57acd7[_0x639d('0x36')]['length']?_0x57acd7['attributes']:_0x2f4a73[_0x639d('0x30')];_0x57acd7[_0x639d('0x39')]=qs[_0x639d('0x3a')](_0x1d7e60[_0x639d('0x31')][_0x639d('0x3a')]);_0x57acd7[_0x639d('0x3b')]=qs[_0x639d('0x33')](_[_0x639d('0x3c')](_0x1d7e60[_0x639d('0x31')],_0x2f4a73[_0x639d('0x33')]));if(_0x1d7e60[_0x639d('0x31')][_0x639d('0x3d')]){_0x57acd7[_0x639d('0x3b')]=_[_0x639d('0x3e')](_0x57acd7['where'],{'$or':_[_0x639d('0x2b')](_0x57acd7['attributes'],function(_0x34e958){var _0x164523={};_0x164523[_0x34e958]={'$like':'%'+_0x1d7e60[_0x639d('0x31')][_0x639d('0x3d')]+'%'};return _0x164523;})});}_0x57acd7=_['merge']({},_0x57acd7,_0x1d7e60[_0x639d('0x40')]);return _0x32e34b[_0x639d('0x4d')](_0x57acd7);}})['then'](function(_0x2e3d54){if(_0x2e3d54){_0x51545b=_0x2e3d54[_0x639d('0x37')];if(!_0x1d7e60[_0x639d('0x31')][_0x639d('0x4c')](_0x639d('0x38'))){_0x57acd7[_0x639d('0x1f')]=qs[_0x639d('0x1f')](_0x1d7e60[_0x639d('0x31')][_0x639d('0x1f')]);_0x57acd7[_0x639d('0x1d')]=qs['offset'](_0x1d7e60[_0x639d('0x31')][_0x639d('0x1d')]);}return _0x32e34b[_0x639d('0x4d')](_0x57acd7);}})[_0x639d('0x25')](function(_0x5242d7){if(_0x5242d7){return _0x5242d7?{'count':_0x51545b,'rows':_0x5242d7}:null;}})['then'](respondWithResult(_0x322cfd,null))[_0x639d('0x44')](handleError(_0x322cfd,null));};exports[_0x639d('0x4f')]=function(_0x489d2f,_0x5d76f9,_0x45c11f){var _0x40cbca={};var _0x9d7b7c={};var _0x767a9a;var _0x42e13f;return db[_0x639d('0x2c')]['findOne']({'where':{'id':_0x489d2f[_0x639d('0x45')]['id']}})[_0x639d('0x25')](handleEntityNotFound(_0x5d76f9,null))[_0x639d('0x25')](function(_0x456350){if(_0x456350){_0x767a9a=_0x456350;_0x9d7b7c[_0x639d('0x30')]=_[_0x639d('0x32')](db[_0x639d('0x4e')][_0x639d('0x2d')]);_0x9d7b7c['query']=_['keys'](_0x489d2f[_0x639d('0x31')]);_0x9d7b7c[_0x639d('0x33')]=_['intersection'](_0x9d7b7c[_0x639d('0x30')],_0x9d7b7c[_0x639d('0x31')]);_0x40cbca[_0x639d('0x36')]=_[_0x639d('0x34')](_0x9d7b7c[_0x639d('0x30')],qs[_0x639d('0x35')](_0x489d2f[_0x639d('0x31')][_0x639d('0x35')]));_0x40cbca['attributes']=_0x40cbca[_0x639d('0x36')][_0x639d('0x37')]?_0x40cbca['attributes']:_0x9d7b7c[_0x639d('0x30')];_0x40cbca[_0x639d('0x39')]=qs['sort'](_0x489d2f['query'][_0x639d('0x3a')]);_0x40cbca[_0x639d('0x3b')]=qs[_0x639d('0x33')](_['pick'](_0x489d2f[_0x639d('0x31')],_0x9d7b7c['filters']));if(_0x489d2f['query'][_0x639d('0x3d')]){_0x40cbca['where']=_[_0x639d('0x3e')](_0x40cbca[_0x639d('0x3b')],{'$or':_[_0x639d('0x2b')](_0x40cbca['attributes'],function(_0x290e53){var _0x2c69c7={};_0x2c69c7[_0x290e53]={'$like':'%'+_0x489d2f[_0x639d('0x31')][_0x639d('0x3d')]+'%'};return _0x2c69c7;})});}_0x40cbca=_[_0x639d('0x3e')]({},_0x40cbca,_0x489d2f['options']);return _0x767a9a[_0x639d('0x4f')](_0x40cbca);}})[_0x639d('0x25')](function(_0x30ed76){if(_0x30ed76){_0x42e13f=_0x30ed76[_0x639d('0x37')];if(!_0x489d2f[_0x639d('0x31')][_0x639d('0x4c')](_0x639d('0x38'))){_0x40cbca[_0x639d('0x1f')]=qs[_0x639d('0x1f')](_0x489d2f[_0x639d('0x31')][_0x639d('0x1f')]);_0x40cbca[_0x639d('0x1d')]=qs['offset'](_0x489d2f[_0x639d('0x31')][_0x639d('0x1d')]);}return _0x767a9a[_0x639d('0x4f')](_0x40cbca);}})[_0x639d('0x25')](function(_0x1dc211){if(_0x1dc211){return _0x1dc211?{'count':_0x42e13f,'rows':_0x1dc211}:null;}})[_0x639d('0x25')](respondWithResult(_0x5d76f9,null))['catch'](handleError(_0x5d76f9,null));}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7379f41..ee28433 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 _0xb9da=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9da,0xb5));var _0xab9d=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0xb9da[_0x471273];return _0x56c63e;};'use strict';var _=require(_0xab9d('0x0'));var util=require(_0xab9d('0x1'));var logger=require(_0xab9d('0x2'))(_0xab9d('0x3'));var moment=require(_0xab9d('0x4'));var BPromise=require(_0xab9d('0x5'));var rp=require(_0xab9d('0x6'));var fs=require('fs');var path=require(_0xab9d('0x7'));var rimraf=require(_0xab9d('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0xab9d('0x9')]=function(_0x5d1cde,_0x401bfd){return _0x5d1cde[_0xab9d('0xa')](_0xab9d('0xb'),attributes,{'tableName':_0xab9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 2982a6f..7ed02af 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 _0x82e7=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4007f0,_0x35f8f0){var _0x3e4af4=function(_0x2883e5){while(--_0x2883e5){_0x4007f0['push'](_0x4007f0['shift']());}};_0x3e4af4(++_0x35f8f0);}(_0x82e7,0x17c));var _0x782e=function(_0x341468,_0x277a26){_0x341468=_0x341468-0x0;var _0x5e6909=_0x82e7[_0x341468];return _0x5e6909;};'use strict';var _=require(_0x782e('0x0'));var util=require(_0x782e('0x1'));var moment=require(_0x782e('0x2'));var BPromise=require(_0x782e('0x3'));var rs=require(_0x782e('0x4'));var fs=require('fs');var Redis=require(_0x782e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x782e('0x6'));var logger=require('../../config/logger')(_0x782e('0x7'));var config=require(_0x782e('0x8'));var jayson=require(_0x782e('0x9'));var client=jayson[_0x782e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4953a7,_0x4b63cd,_0x59b38d){return new BPromise(function(_0x36260f,_0x222e69){return client[_0x782e('0xb')](_0x4953a7,_0x59b38d)[_0x782e('0xc')](function(_0x47efc2){logger['info'](_0x782e('0xd'),_0x4b63cd,_0x782e('0xe'));logger[_0x782e('0xf')](_0x782e('0x10'),_0x4b63cd,'request\x20sent',JSON[_0x782e('0x11')](_0x47efc2));if(_0x47efc2[_0x782e('0x12')]){if(_0x47efc2[_0x782e('0x12')]['code']===0x1f4){logger[_0x782e('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b63cd,_0x47efc2[_0x782e('0x12')][_0x782e('0x13')]);return _0x222e69(_0x47efc2[_0x782e('0x12')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4b63cd,_0x47efc2['error']['message']);return _0x36260f(_0x47efc2[_0x782e('0x12')][_0x782e('0x13')]);}else{logger['info'](_0x782e('0xd'),_0x4b63cd,_0x782e('0xe'));_0x36260f(_0x47efc2[_0x782e('0x14')][_0x782e('0x13')]);}})[_0x782e('0x15')](function(_0x3a6bcb){logger[_0x782e('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x4b63cd,_0x3a6bcb);_0x222e69(_0x3a6bcb);});});} \ No newline at end of file +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 diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d1e3710..6cd7478 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 _0x5a7d=['../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x9e712e,_0x2b2137){var _0x36d9ce=function(_0x284ca3){while(--_0x284ca3){_0x9e712e['push'](_0x9e712e['shift']());}};_0x36d9ce(++_0x2b2137);}(_0x5a7d,0xb4));var _0xd5a7=function(_0xea1570,_0x2f7856){_0xea1570=_0xea1570-0x0;var _0x579e74=_0x5a7d[_0xea1570];return _0x579e74;};'use strict';var multer=require(_0xd5a7('0x0'));var util=require(_0xd5a7('0x1'));var path=require(_0xd5a7('0x2'));var timeout=require(_0xd5a7('0x3'));var express=require(_0xd5a7('0x4'));var router=express['Router']();var fs_extra=require(_0xd5a7('0x5'));var auth=require(_0xd5a7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd5a7('0x7'));var controller=require('./intVtigerField.controller');router[_0xd5a7('0x8')]('/',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0xa')]);router[_0xd5a7('0x8')]('/:id',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0xb')]);router[_0xd5a7('0xc')]('/',auth[_0xd5a7('0x9')](),controller[_0xd5a7('0xd')]);router[_0xd5a7('0xe')](_0xd5a7('0xf'),auth[_0xd5a7('0x9')](),controller[_0xd5a7('0x10')]);router['delete'](_0xd5a7('0xf'),auth[_0xd5a7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 606d086..6e2710c 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 _0x9179=['string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING'];(function(_0x331be9,_0x330e60){var _0x1c0011=function(_0x225952){while(--_0x225952){_0x331be9['push'](_0x331be9['shift']());}};_0x1c0011(++_0x330e60);}(_0x9179,0x106));var _0x9917=function(_0x4e4ceb,_0x33194e){_0x4e4ceb=_0x4e4ceb-0x0;var _0x34d8d0=_0x9179[_0x4e4ceb];return _0x34d8d0;};'use strict';var Sequelize=require(_0x9917('0x0'));module[_0x9917('0x1')]={'type':{'type':Sequelize[_0x9917('0x2')]('string',_0x9917('0x3'),_0x9917('0x4'),_0x9917('0x5'),_0x9917('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9917('0x7')]},'key':{'type':Sequelize[_0x9917('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9917('0x8'),_0x9917('0x3'),_0x9917('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9917('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9917('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9917('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 486d8dc..a9a24a1 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 _0x5997=['hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','VtigerField','findAll','rows','catch','show','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','set','Content-Range','save','destroy','then','error','stack','name','send','index','rawAttributes','key','keys','filters','intersection','attributes','model','fields','query','length'];(function(_0x5b330a,_0x496c56){var _0x16be89=function(_0x319744){while(--_0x319744){_0x5b330a['push'](_0x5b330a['shift']());}};_0x16be89(++_0x496c56);}(_0x5997,0x18a));var _0x7599=function(_0x150023,_0x2807a5){_0x150023=_0x150023-0x0;var _0x344bb3=_0x5997[_0x150023];return _0x344bb3;};'use strict';var emlformat=require(_0x7599('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7599('0x1'));var jsonpatch=require(_0x7599('0x2'));var rp=require(_0x7599('0x3'));var moment=require(_0x7599('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7599('0x5'));var util=require('util');var path=require(_0x7599('0x6'));var sox=require(_0x7599('0x7'));var csv=require(_0x7599('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7599('0x9'));var squel=require(_0x7599('0xa'));var crypto=require(_0x7599('0xb'));var jsforce=require(_0x7599('0xc'));var deskjs=require(_0x7599('0xd'));var toCsv=require(_0x7599('0x8'));var querystring=require(_0x7599('0xe'));var Papa=require('papaparse');var Redis=require(_0x7599('0xf'));var authService=require(_0x7599('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7599('0x11'));var hardwareService=require(_0x7599('0x12'));var logger=require('../../config/logger')(_0x7599('0x13'));var utils=require('../../config/utils');var config=require(_0x7599('0x14'));var licenseUtil=require(_0x7599('0x15'));var db=require(_0x7599('0x16'))['db'];function respondWithStatusCode(_0x21f2d7,_0xfcf4bd){_0xfcf4bd=_0xfcf4bd||0xcc;return function(_0x2120ca){if(_0x2120ca){return _0x21f2d7[_0x7599('0x17')](_0xfcf4bd);}return _0x21f2d7['status'](_0xfcf4bd)[_0x7599('0x18')]();};}function respondWithResult(_0x588fd8,_0x3993e6){_0x3993e6=_0x3993e6||0xc8;return function(_0x12a4c4){if(_0x12a4c4){return _0x588fd8[_0x7599('0x19')](_0x3993e6)[_0x7599('0x1a')](_0x12a4c4);}};}function respondWithFilteredResult(_0x445729,_0xb8427e){return function(_0x278152){if(_0x278152){var _0x1ef443=typeof _0xb8427e['offset']==='undefined'&&typeof _0xb8427e['limit']===_0x7599('0x1b');var _0x11fbb3=_0x278152['count'];var _0x22ae2f=_0x1ef443?0x0:_0xb8427e[_0x7599('0x1c')];var _0x412b13=_0x1ef443?_0x278152[_0x7599('0x1d')]:_0xb8427e['offset']+_0xb8427e['limit'];var _0x46e930;if(_0x412b13>=_0x11fbb3){_0x412b13=_0x11fbb3;_0x46e930=0xc8;}else{_0x46e930=0xce;}_0x445729[_0x7599('0x19')](_0x46e930);return _0x445729[_0x7599('0x1e')](_0x7599('0x1f'),_0x22ae2f+'-'+_0x412b13+'/'+_0x11fbb3)[_0x7599('0x1a')](_0x278152);}return null;};}function patchUpdates(_0x2f7712){return function(_0x14dea0){try{jsonpatch['apply'](_0x14dea0,_0x2f7712,!![]);}catch(_0x1386f2){return BPromise['reject'](_0x1386f2);}return _0x14dea0[_0x7599('0x20')]();};}function saveUpdates(_0x3d0de6,_0x27c818){return function(_0xc51f3){if(_0xc51f3){return _0xc51f3['update'](_0x3d0de6)['then'](function(_0x49ed66){return _0x49ed66;});}return null;};}function removeEntity(_0x141b34,_0x1c2bcf){return function(_0x4f6a6){if(_0x4f6a6){return _0x4f6a6[_0x7599('0x21')]()[_0x7599('0x22')](function(){_0x141b34[_0x7599('0x19')](0xcc)[_0x7599('0x18')]();});}};}function handleEntityNotFound(_0x4808a0,_0x28b1ad){return function(_0xe1e27e){if(!_0xe1e27e){_0x4808a0[_0x7599('0x17')](0x194);}return _0xe1e27e;};}function handleError(_0x142620,_0xeb0e30){_0xeb0e30=_0xeb0e30||0x1f4;return function(_0x656355){logger[_0x7599('0x23')](_0x656355[_0x7599('0x24')]);if(_0x656355['name']){delete _0x656355[_0x7599('0x25')];}_0x142620['status'](_0xeb0e30)[_0x7599('0x26')](_0x656355);};}exports[_0x7599('0x27')]=function(_0x1cc692,_0x3972e9){var _0x259840={},_0x21d6c2={},_0x36152f={'count':0x0,'rows':[]};var _0x4dfd93=_['map'](db['VtigerField'][_0x7599('0x28')],function(_0x37e2b4){return{'name':_0x37e2b4['fieldName'],'type':_0x37e2b4['type'][_0x7599('0x29')]};});_0x21d6c2['model']=_['map'](_0x4dfd93,'name');_0x21d6c2['query']=_[_0x7599('0x2a')](_0x1cc692['query']);_0x21d6c2[_0x7599('0x2b')]=_[_0x7599('0x2c')](_0x21d6c2['model'],_0x21d6c2['query']);_0x259840[_0x7599('0x2d')]=_[_0x7599('0x2c')](_0x21d6c2[_0x7599('0x2e')],qs[_0x7599('0x2f')](_0x1cc692[_0x7599('0x30')][_0x7599('0x2f')]));_0x259840['attributes']=_0x259840[_0x7599('0x2d')][_0x7599('0x31')]?_0x259840[_0x7599('0x2d')]:_0x21d6c2[_0x7599('0x2e')];if(!_0x1cc692[_0x7599('0x30')][_0x7599('0x32')](_0x7599('0x33'))){_0x259840[_0x7599('0x34')]=qs[_0x7599('0x34')](_0x1cc692['query'][_0x7599('0x34')]);_0x259840[_0x7599('0x1c')]=qs['offset'](_0x1cc692[_0x7599('0x30')][_0x7599('0x1c')]);}_0x259840[_0x7599('0x35')]=qs['sort'](_0x1cc692[_0x7599('0x30')][_0x7599('0x36')]);_0x259840[_0x7599('0x37')]=qs[_0x7599('0x2b')](_[_0x7599('0x38')](_0x1cc692['query'],_0x21d6c2[_0x7599('0x2b')]),_0x4dfd93);if(_0x1cc692[_0x7599('0x30')]['filter']){_0x259840[_0x7599('0x37')]=_[_0x7599('0x39')](_0x259840[_0x7599('0x37')],{'$or':_['map'](_0x4dfd93,function(_0x162cae){if(_0x162cae[_0x7599('0x3a')]!==_0x7599('0x3b')){var _0x40a70d={};_0x40a70d[_0x162cae[_0x7599('0x25')]]={'$like':'%'+_0x1cc692[_0x7599('0x30')][_0x7599('0x3c')]+'%'};return _0x40a70d;}})});}_0x259840=_[_0x7599('0x39')]({},_0x259840,_0x1cc692[_0x7599('0x3d')]);var _0x200461={'where':_0x259840[_0x7599('0x37')]};return db['VtigerField'][_0x7599('0x1d')](_0x200461)[_0x7599('0x22')](function(_0x49c3b8){_0x36152f['count']=_0x49c3b8;if(_0x1cc692[_0x7599('0x30')][_0x7599('0x3e')]){_0x259840[_0x7599('0x3f')]=[{'all':!![]}];}return db[_0x7599('0x40')][_0x7599('0x41')](_0x259840);})[_0x7599('0x22')](function(_0x13246c){_0x36152f[_0x7599('0x42')]=_0x13246c;return _0x36152f;})[_0x7599('0x22')](respondWithFilteredResult(_0x3972e9,_0x259840))[_0x7599('0x43')](handleError(_0x3972e9,null));};exports[_0x7599('0x44')]=function(_0x2208c7,_0x53eae3){var _0x18e119={'raw':!![],'where':{'id':_0x2208c7['params']['id']}},_0x8b09dd={};_0x8b09dd[_0x7599('0x2e')]=_['keys'](db[_0x7599('0x40')][_0x7599('0x28')]);_0x8b09dd[_0x7599('0x30')]=_[_0x7599('0x2a')](_0x2208c7[_0x7599('0x30')]);_0x8b09dd[_0x7599('0x2b')]=_[_0x7599('0x2c')](_0x8b09dd[_0x7599('0x2e')],_0x8b09dd['query']);_0x18e119[_0x7599('0x2d')]=_[_0x7599('0x2c')](_0x8b09dd[_0x7599('0x2e')],qs['fields'](_0x2208c7[_0x7599('0x30')][_0x7599('0x2f')]));_0x18e119[_0x7599('0x2d')]=_0x18e119[_0x7599('0x2d')]['length']?_0x18e119['attributes']:_0x8b09dd['model'];if(_0x2208c7[_0x7599('0x30')]['includeAll']){_0x18e119[_0x7599('0x3f')]=[{'all':!![]}];}_0x18e119=_[_0x7599('0x39')]({},_0x18e119,_0x2208c7[_0x7599('0x3d')]);return db[_0x7599('0x40')][_0x7599('0x45')](_0x18e119)[_0x7599('0x22')](handleEntityNotFound(_0x53eae3,null))[_0x7599('0x22')](respondWithResult(_0x53eae3,null))[_0x7599('0x43')](handleError(_0x53eae3,null));};exports[_0x7599('0x46')]=function(_0x435a04,_0x270632){return db[_0x7599('0x40')]['create'](_0x435a04[_0x7599('0x47')],{})[_0x7599('0x22')](respondWithResult(_0x270632,0xc9))['catch'](handleError(_0x270632,null));};exports[_0x7599('0x48')]=function(_0x5dfefa,_0x3ea5b9){if(_0x5dfefa[_0x7599('0x47')]['id']){delete _0x5dfefa[_0x7599('0x47')]['id'];}return db[_0x7599('0x40')][_0x7599('0x45')]({'where':{'id':_0x5dfefa[_0x7599('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ea5b9,null))[_0x7599('0x22')](saveUpdates(_0x5dfefa[_0x7599('0x47')],null))['then'](respondWithResult(_0x3ea5b9,null))['catch'](handleError(_0x3ea5b9,null));};exports[_0x7599('0x21')]=function(_0x465ea9,_0xbf7d3d){return db[_0x7599('0x40')][_0x7599('0x45')]({'where':{'id':_0x465ea9[_0x7599('0x49')]['id']}})['then'](handleEntityNotFound(_0xbf7d3d,null))[_0x7599('0x22')](removeEntity(_0xbf7d3d,null))['catch'](handleError(_0xbf7d3d,null));}; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9eea9a0..b38f6a4 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 _0x2197=['request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','api','bluebird'];(function(_0xdc8201,_0x55df93){var _0x10e22f=function(_0xe52167){while(--_0xe52167){_0xdc8201['push'](_0xdc8201['shift']());}};_0x10e22f(++_0x55df93);}(_0x2197,0xe1));var _0x7219=function(_0x57ca20,_0x49336b){_0x57ca20=_0x57ca20-0x0;var _0x4d595f=_0x2197[_0x57ca20];return _0x4d595f;};'use strict';var _=require(_0x7219('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7219('0x1'));var moment=require('moment');var BPromise=require(_0x7219('0x2'));var rp=require(_0x7219('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7219('0x4'));var config=require(_0x7219('0x5'));var attributes=require(_0x7219('0x6'));module[_0x7219('0x7')]=function(_0x255f2a,_0x27e0a9){return _0x255f2a[_0x7219('0x8')]('VtigerField',attributes,{'tableName':_0x7219('0x9'),'paranoid':![],'indexes':[{'name':_0x7219('0xa'),'fields':['idField',_0x7219('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 4509978..85e9e1d 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 _0xf170=['request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x33582f,_0x28c9d1){var _0x42e73e=function(_0x13f65e){while(--_0x13f65e){_0x33582f['push'](_0x33582f['shift']());}};_0x42e73e(++_0x28c9d1);}(_0xf170,0x1d4));var _0x0f17=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0xf170[_0x5090d4];return _0x56c310;};'use strict';var _=require('lodash');var util=require(_0x0f17('0x0'));var moment=require(_0x0f17('0x1'));var BPromise=require(_0x0f17('0x2'));var rs=require(_0x0f17('0x3'));var fs=require('fs');var Redis=require(_0x0f17('0x4'));var db=require(_0x0f17('0x5'))['db'];var utils=require(_0x0f17('0x6'));var logger=require(_0x0f17('0x7'))('rpc');var config=require(_0x0f17('0x8'));var jayson=require(_0x0f17('0x9'));var client=jayson[_0x0f17('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d8cf4,_0x1804b3,_0x2f0c7f){return new BPromise(function(_0x50821a,_0xd16dce){return client[_0x0f17('0xb')](_0x5d8cf4,_0x2f0c7f)['then'](function(_0x134e28){logger[_0x0f17('0xc')](_0x0f17('0xd'),_0x1804b3,'request\x20sent');logger[_0x0f17('0xe')](_0x0f17('0xf'),_0x1804b3,_0x0f17('0x10'),JSON['stringify'](_0x134e28));if(_0x134e28['error']){if(_0x134e28[_0x0f17('0x11')][_0x0f17('0x12')]===0x1f4){logger[_0x0f17('0x11')]('VtigerField,\x20%s,\x20%s',_0x1804b3,_0x134e28['error']['message']);return _0xd16dce(_0x134e28[_0x0f17('0x11')][_0x0f17('0x13')]);}logger['error'](_0x0f17('0xd'),_0x1804b3,_0x134e28[_0x0f17('0x11')]['message']);return _0x50821a(_0x134e28['error'][_0x0f17('0x13')]);}else{logger[_0x0f17('0xc')](_0x0f17('0xd'),_0x1804b3,_0x0f17('0x10'));_0x50821a(_0x134e28[_0x0f17('0x14')][_0x0f17('0x13')]);}})[_0x0f17('0x15')](function(_0x42fbbd){logger[_0x0f17('0x11')](_0x0f17('0xd'),_0x1804b3,_0x42fbbd);_0xd16dce(_0x42fbbd);});});} \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9b6e7f8..d89493e 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 _0x2186=['/:id','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x5f15ad,_0x569a6b){var _0x6d243a=function(_0x269cdf){while(--_0x269cdf){_0x5f15ad['push'](_0x5f15ad['shift']());}};_0x6d243a(++_0x569a6b);}(_0x2186,0x1ca));var _0x6218=function(_0x34848b,_0x1e8296){_0x34848b=_0x34848b-0x0;var _0xa6c9d2=_0x2186[_0x34848b];return _0xa6c9d2;};'use strict';var multer=require(_0x6218('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6218('0x1'));var router=express[_0x6218('0x2')]();var fs_extra=require(_0x6218('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6218('0x4'));var config=require(_0x6218('0x5'));var controller=require(_0x6218('0x6'));router[_0x6218('0x7')]('/',auth[_0x6218('0x8')](),controller['index']);router['get']('/:id',auth[_0x6218('0x8')](),controller[_0x6218('0x9')]);router[_0x6218('0x7')](_0x6218('0xa'),auth[_0x6218('0x8')](),controller['getConfigurations']);router[_0x6218('0x7')](_0x6218('0xb'),auth[_0x6218('0x8')](),controller[_0x6218('0xc')]);router[_0x6218('0xd')]('/',auth[_0x6218('0x8')](),controller[_0x6218('0xe')]);router['post'](_0x6218('0xa'),auth[_0x6218('0x8')](),controller[_0x6218('0xf')]);router[_0x6218('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x6218('0x11'),auth[_0x6218('0x8')](),controller['destroy']);module[_0x6218('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fc5eb14..22a474e 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 _0x06ae=['username','remoteUri','password','ENUM','integrationTab','newTab','exports','STRING'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xe06a('0x0')]={'name':{'type':Sequelize[_0xe06a('0x1')]},'description':{'type':Sequelize[_0xe06a('0x1')]},'username':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x2')},'password':{'type':Sequelize[_0xe06a('0x1')]},'token':{'type':Sequelize[_0xe06a('0x1')]},'remoteUri':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x3')},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0xe06a('0x4')},'serverUrl':{'type':Sequelize[_0xe06a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe06a('0x5')](_0xe06a('0x6'),_0xe06a('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2b15070..755224a 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 _0x5c00=['getDescriptions','username','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','password','%s:%s','toString','headers','format','Basic\x20%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','options','find','catch','create','body','destroy','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','channel'];(function(_0x3518b6,_0x1d6005){var _0x55a221=function(_0x25ebfa){while(--_0x25ebfa){_0x3518b6['push'](_0x3518b6['shift']());}};_0x55a221(++_0x1d6005);}(_0x5c00,0x17e));var _0x05c0=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0x5c00[_0x4af01e];return _0x178c11;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e39d4,_0x5eec41){_0x5eec41=_0x5eec41||0xcc;return function(_0x16a290){if(_0x16a290){return _0x4e39d4[_0x05c0('0x19')](_0x5eec41);}return _0x4e39d4[_0x05c0('0x1a')](_0x5eec41)[_0x05c0('0x1b')]();};}function respondWithResult(_0x25764b,_0xe57ed0){_0xe57ed0=_0xe57ed0||0xc8;return function(_0x331799){if(_0x331799){return _0x25764b[_0x05c0('0x1a')](_0xe57ed0)['json'](_0x331799);}};}function respondWithFilteredResult(_0x238e25,_0x161a5f){return function(_0x4bb164){if(_0x4bb164){var _0x29e6b0=typeof _0x161a5f[_0x05c0('0x1c')]===_0x05c0('0x1d')&&typeof _0x161a5f[_0x05c0('0x1e')]===_0x05c0('0x1d');var _0x38f994=_0x4bb164['count'];var _0x422401=_0x29e6b0?0x0:_0x161a5f[_0x05c0('0x1c')];var _0x4613c0=_0x29e6b0?_0x4bb164['count']:_0x161a5f[_0x05c0('0x1c')]+_0x161a5f[_0x05c0('0x1e')];var _0x10685b;if(_0x4613c0>=_0x38f994){_0x4613c0=_0x38f994;_0x10685b=0xc8;}else{_0x10685b=0xce;}_0x238e25[_0x05c0('0x1a')](_0x10685b);return _0x238e25[_0x05c0('0x1f')]('Content-Range',_0x422401+'-'+_0x4613c0+'/'+_0x38f994)[_0x05c0('0x20')](_0x4bb164);}return null;};}function patchUpdates(_0x1014ef){return function(_0x5313b0){try{jsonpatch['apply'](_0x5313b0,_0x1014ef,!![]);}catch(_0x5e4b80){return BPromise[_0x05c0('0x21')](_0x5e4b80);}return _0x5313b0[_0x05c0('0x22')]();};}function saveUpdates(_0x83f29,_0x8e2d4){return function(_0x5b3acb){if(_0x5b3acb){return _0x5b3acb[_0x05c0('0x23')](_0x83f29)[_0x05c0('0x24')](function(_0x5b4eef){return _0x5b4eef;});}return null;};}function removeEntity(_0x9b4930,_0x1abbf3){return function(_0x4ba978){if(_0x4ba978){return _0x4ba978['destroy']()['then'](function(){_0x9b4930['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df135,_0x15b497){return function(_0x48b56f){if(!_0x48b56f){_0x3df135[_0x05c0('0x19')](0x194);}return _0x48b56f;};}function handleError(_0x336e1b,_0x3617dc){_0x3617dc=_0x3617dc||0x1f4;return function(_0x889c75){logger['error'](_0x889c75[_0x05c0('0x25')]);if(_0x889c75[_0x05c0('0x26')]){delete _0x889c75[_0x05c0('0x26')];}_0x336e1b[_0x05c0('0x1a')](_0x3617dc)[_0x05c0('0x27')](_0x889c75);};}exports[_0x05c0('0x28')]=function(_0x57886b,_0x56ba64){var _0x2df109={},_0xbe7d9e={},_0x2053d5={'count':0x0,'rows':[]};var _0xd6574e=_[_0x05c0('0x29')](db[_0x05c0('0x2a')][_0x05c0('0x2b')],function(_0x3c9eb1){return{'name':_0x3c9eb1[_0x05c0('0x2c')],'type':_0x3c9eb1[_0x05c0('0x2d')][_0x05c0('0x2e')]};});_0xbe7d9e[_0x05c0('0x2f')]=_['map'](_0xd6574e,'name');_0xbe7d9e[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x57886b[_0x05c0('0x30')]);_0xbe7d9e['filters']=_[_0x05c0('0x32')](_0xbe7d9e[_0x05c0('0x2f')],_0xbe7d9e['query']);_0x2df109[_0x05c0('0x33')]=_['intersection'](_0xbe7d9e[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x34')]));_0x2df109[_0x05c0('0x33')]=_0x2df109[_0x05c0('0x33')][_0x05c0('0x35')]?_0x2df109[_0x05c0('0x33')]:_0xbe7d9e[_0x05c0('0x2f')];if(!_0x57886b[_0x05c0('0x30')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x2df109[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x2df109[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1c')]);}_0x2df109[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x39')]);_0x2df109[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x57886b[_0x05c0('0x30')],_0xbe7d9e[_0x05c0('0x3b')]),_0xd6574e);if(_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]){_0x2df109[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x2df109['where'],{'$or':_[_0x05c0('0x29')](_0xd6574e,function(_0x249101){if(_0x249101[_0x05c0('0x2d')]!==_0x05c0('0x3f')){var _0x49f829={};_0x49f829[_0x249101['name']]={'$like':'%'+_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x49f829;}})});}_0x2df109=_[_0x05c0('0x3e')]({},_0x2df109,_0x57886b['options']);var _0x29dc87={'where':_0x2df109[_0x05c0('0x3a')]};return db[_0x05c0('0x2a')][_0x05c0('0x40')](_0x29dc87)['then'](function(_0x152c6a){_0x2053d5[_0x05c0('0x40')]=_0x152c6a;if(_0x57886b['query'][_0x05c0('0x41')]){_0x2df109[_0x05c0('0x42')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x43')](_0x2df109);})[_0x05c0('0x24')](function(_0x398a6e){_0x2053d5[_0x05c0('0x44')]=_0x398a6e;return _0x2053d5;})['then'](respondWithFilteredResult(_0x56ba64,_0x2df109))['catch'](handleError(_0x56ba64,null));};exports[_0x05c0('0x45')]=function(_0x1d1d94,_0xaa5d53){var _0x11f079={'raw':![],'where':{'id':_0x1d1d94['params']['id']}},_0x14aba3={};_0x14aba3[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x2a')][_0x05c0('0x2b')]);_0x14aba3[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x1d1d94[_0x05c0('0x30')]);_0x14aba3['filters']=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],_0x14aba3[_0x05c0('0x30')]);_0x11f079[_0x05c0('0x33')]=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x34')]));_0x11f079[_0x05c0('0x33')]=_0x11f079[_0x05c0('0x33')]['length']?_0x11f079['attributes']:_0x14aba3[_0x05c0('0x2f')];if(_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x41')]){_0x11f079[_0x05c0('0x42')]=[{'all':!![]}];}_0x11f079=_[_0x05c0('0x3e')]({},_0x11f079,_0x1d1d94[_0x05c0('0x46')]);return db['ZendeskAccount'][_0x05c0('0x47')](_0x11f079)[_0x05c0('0x24')](handleEntityNotFound(_0xaa5d53,null))[_0x05c0('0x24')](respondWithResult(_0xaa5d53,null))[_0x05c0('0x48')](handleError(_0xaa5d53,null));};exports['create']=function(_0x34e94e,_0x2440e8){return db[_0x05c0('0x2a')][_0x05c0('0x49')](_0x34e94e['body'],{})[_0x05c0('0x24')](respondWithResult(_0x2440e8,0xc9))[_0x05c0('0x48')](handleError(_0x2440e8,null));};exports[_0x05c0('0x23')]=function(_0x9b521b,_0x5ef6cf){if(_0x9b521b[_0x05c0('0x4a')]['id']){delete _0x9b521b[_0x05c0('0x4a')]['id'];}return db['ZendeskAccount'][_0x05c0('0x47')]({'where':{'id':_0x9b521b['params']['id']}})['then'](handleEntityNotFound(_0x5ef6cf,null))[_0x05c0('0x24')](saveUpdates(_0x9b521b['body'],null))[_0x05c0('0x24')](respondWithResult(_0x5ef6cf,null))[_0x05c0('0x48')](handleError(_0x5ef6cf,null));};exports[_0x05c0('0x4b')]=function(_0x371aff,_0x3ccae9){return db[_0x05c0('0x2a')]['find']({'where':{'id':_0x371aff[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ccae9,null))[_0x05c0('0x24')](removeEntity(_0x3ccae9,null))[_0x05c0('0x48')](handleError(_0x3ccae9,null));};exports[_0x05c0('0x4d')]=function(_0x13ad38,_0x1496d4,_0x37ad50){var _0x156087={};var _0x551b7b={};var _0x5215b4;var _0x523153;return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x13ad38['params']['id']}})['then'](handleEntityNotFound(_0x1496d4,null))[_0x05c0('0x24')](function(_0x1a72d6){if(_0x1a72d6){_0x5215b4=_0x1a72d6;_0x551b7b[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x4f')][_0x05c0('0x2b')]);_0x551b7b[_0x05c0('0x30')]=_['keys'](_0x13ad38[_0x05c0('0x30')]);_0x551b7b[_0x05c0('0x3b')]=_[_0x05c0('0x32')](_0x551b7b[_0x05c0('0x2f')],_0x551b7b['query']);_0x156087[_0x05c0('0x33')]=_['intersection'](_0x551b7b[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x13ad38['query'][_0x05c0('0x34')]));_0x156087['attributes']=_0x156087[_0x05c0('0x33')][_0x05c0('0x35')]?_0x156087[_0x05c0('0x33')]:_0x551b7b[_0x05c0('0x2f')];_0x156087[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x13ad38['query'][_0x05c0('0x39')]);_0x156087[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x13ad38[_0x05c0('0x30')],_0x551b7b[_0x05c0('0x3b')]));if(_0x13ad38['query'][_0x05c0('0x3d')]){_0x156087[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x156087[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x156087[_0x05c0('0x33')],function(_0xf5e123){var _0x866523={};_0x866523[_0xf5e123]={'$like':'%'+_0x13ad38[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x866523;})});}_0x156087=_[_0x05c0('0x3e')]({},_0x156087,_0x13ad38[_0x05c0('0x46')]);return _0x5215b4['getConfigurations'](_0x156087);}})['then'](function(_0x5269b4){if(_0x5269b4){_0x523153=_0x5269b4[_0x05c0('0x35')];if(!_0x13ad38[_0x05c0('0x30')][_0x05c0('0x36')]('nolimit')){_0x156087[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x13ad38[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x156087[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x13ad38[_0x05c0('0x30')]['offset']);}return _0x5215b4[_0x05c0('0x4d')](_0x156087);}})[_0x05c0('0x24')](function(_0x355b44){if(_0x355b44){return _0x355b44?{'count':_0x523153,'rows':_0x355b44}:null;}})[_0x05c0('0x24')](respondWithResult(_0x1496d4,null))['catch'](handleError(_0x1496d4,null));};exports['addConfiguration']=function(_0x5e4941,_0x3b74c5,_0x2b8a13){if(_0x5e4941[_0x05c0('0x4a')]['id']){delete _0x5e4941[_0x05c0('0x4a')]['id'];}return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x5e4941[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b74c5,null))[_0x05c0('0x24')](function(_0x225397){if(_0x225397){_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x50')]=_0x225397['id'];_0x5e4941[_0x05c0('0x4a')]['Subjects']=integrations['getSubjects'](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body'][_0x05c0('0x2d')]);_0x5e4941['body']['Descriptions']=integrations[_0x05c0('0x52')](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body']['type']);return db[_0x05c0('0x4f')][_0x05c0('0x49')](_0x5e4941[_0x05c0('0x4a')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3b74c5,null))[_0x05c0('0x48')](handleError(_0x3b74c5,null));};exports['getFields']=function(_0x496acf,_0x5bb9ef,_0xd7a2f3){var _0x1a6dc4='';return db[_0x05c0('0x2a')]['findOne']({'where':{'id':_0x496acf[_0x05c0('0x4c')]['id']},'attributes':['id',_0x05c0('0x53'),'password',_0x05c0('0x54'),_0x05c0('0x55'),_0x05c0('0x56')]})[_0x05c0('0x24')](handleEntityNotFound(_0x5bb9ef,null))['then'](function(_0x35ef76){if(_0x35ef76){_0x1a6dc4=_0x35ef76[_0x05c0('0x56')];var _0xc150e3=_0x1a6dc4[_0x05c0('0x57')](-0x1);if(_0xc150e3==='/'){_0x1a6dc4=_0x1a6dc4[_0x05c0('0x58')](0x0,_0x1a6dc4['lastIndexOf'](_0xc150e3));}var _0x4aee38={'method':_0x05c0('0x59'),'uri':util['format'](_0x05c0('0x5a'),_0x1a6dc4,_0x05c0('0x5b')),'json':!![]};switch(_0x35ef76['authType']){case _0x05c0('0x5c'):_0x4aee38['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x05c0('0x5d'),_0x35ef76[_0x05c0('0x53')],_0x35ef76[_0x05c0('0x5c')]))[_0x05c0('0x5e')]('base64'))};break;case _0x05c0('0x54'):_0x4aee38[_0x05c0('0x5f')]={'Authorization':util[_0x05c0('0x60')](_0x05c0('0x61'),new Buffer(util[_0x05c0('0x60')]('%s/token:%s',_0x35ef76[_0x05c0('0x53')],_0x35ef76['token']))['toString'](_0x05c0('0x62')))};break;default:throw new db[(_0x05c0('0x63'))][(_0x05c0('0x64'))](_0x05c0('0x65'));}return rp(_0x4aee38);}})[_0x05c0('0x24')](function(_0x4577ee){if(_0x4577ee){var _0x4c3c73=['subject',_0x05c0('0x66'),_0x05c0('0x67'),_0x05c0('0x68')];_['remove'](_0x4577ee[_0x05c0('0x5b')],function(_0x7c5ce6){return _0x4c3c73[_0x05c0('0x69')](_0x7c5ce6[_0x05c0('0x2d')]);});return{'count':_0x4577ee[_0x05c0('0x5b')][_0x05c0('0x35')],'rows':_['map'](_0x4577ee[_0x05c0('0x5b')],function(_0x464ae0){return{'id':_0x464ae0['id'],'name':_0x464ae0['position']>0x7?_0x464ae0[_0x05c0('0x6a')]:_0x464ae0[_0x05c0('0x2d')],'custom':_0x464ae0['position']>0x7?!![]:![],'options':_0x464ae0[_0x05c0('0x6b')]?_0x464ae0[_0x05c0('0x6b')]:_0x464ae0[_0x05c0('0x6c')]?_0x464ae0[_0x05c0('0x6c')]:[]};})};}})[_0x05c0('0x24')](respondWithResult(_0x5bb9ef,null))[_0x05c0('0x48')](function(_0x544d6c){var _0x63f20=_0x496acf['query'][_0x05c0('0x6d')]?0x1f4:_0x544d6c[_0x05c0('0x6e')]||0x1f4;logger[_0x05c0('0x6f')](_0x05c0('0x70'),_0x05c0('0x71'),_0x63f20,JSON[_0x05c0('0x72')](_0x544d6c));delete _0x544d6c[_0x05c0('0x26')];if(_0x63f20===0x191){_0x63f20=0x190;}_0x5bb9ef[_0x05c0('0x1a')](_0x63f20)[_0x05c0('0x27')](_0x496acf[_0x05c0('0x30')]['test']?{'message':_0x05c0('0x73'),'statusCode':_0x544d6c['statusCode']}:_0x544d6c);});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 513a105..c1f9336 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 _0x4145=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4145,0x17a));var _0x5414=function(_0x2139d0,_0x5b5c17){_0x2139d0=_0x2139d0-0x0;var _0x53eea3=_0x4145[_0x2139d0];return _0x53eea3;};'use strict';var _=require(_0x5414('0x0'));var util=require(_0x5414('0x1'));var logger=require(_0x5414('0x2'))(_0x5414('0x3'));var moment=require(_0x5414('0x4'));var BPromise=require('bluebird');var rp=require(_0x5414('0x5'));var fs=require('fs');var path=require(_0x5414('0x6'));var rimraf=require(_0x5414('0x7'));var config=require(_0x5414('0x8'));var attributes=require(_0x5414('0x9'));var integrations=require(_0x5414('0xa'));module[_0x5414('0xb')]=function(_0x1caf2f,_0x5173e4){return _0x1caf2f['define'](_0x5414('0xc'),attributes,{'tableName':_0x5414('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 94e7953..890aceb 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 _0x5f5d=['message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowZendeskAccount','find','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x58c116,_0x1cf47e){var _0x49836b=function(_0x137330){while(--_0x137330){_0x58c116['push'](_0x58c116['shift']());}};_0x49836b(++_0x1cf47e);}(_0x5f5d,0x15d));var _0xd5f5=function(_0x2b15f6,_0x54f5e3){_0x2b15f6=_0x2b15f6-0x0;var _0x309456=_0x5f5d[_0x2b15f6];return _0x309456;};'use strict';var _=require('lodash');var util=require(_0xd5f5('0x0'));var moment=require(_0xd5f5('0x1'));var BPromise=require(_0xd5f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5f5('0x4'));var logger=require(_0xd5f5('0x5'))(_0xd5f5('0x6'));var config=require(_0xd5f5('0x7'));var jayson=require(_0xd5f5('0x8'));var client=jayson[_0xd5f5('0x9')][_0xd5f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe3f28a,_0x41ba92,_0x50e511){return new BPromise(function(_0x257471,_0x335e39){return client[_0xd5f5('0xb')](_0xe3f28a,_0x50e511)[_0xd5f5('0xc')](function(_0x384d45){logger[_0xd5f5('0xd')](_0xd5f5('0xe'),_0x41ba92,_0xd5f5('0xf'));logger[_0xd5f5('0x10')](_0xd5f5('0x11'),_0x41ba92,_0xd5f5('0xf'),JSON[_0xd5f5('0x12')](_0x384d45));if(_0x384d45['error']){if(_0x384d45[_0xd5f5('0x13')][_0xd5f5('0x14')]===0x1f4){logger[_0xd5f5('0x13')](_0xd5f5('0xe'),_0x41ba92,_0x384d45[_0xd5f5('0x13')][_0xd5f5('0x15')]);return _0x335e39(_0x384d45[_0xd5f5('0x13')][_0xd5f5('0x15')]);}logger['error'](_0xd5f5('0xe'),_0x41ba92,_0x384d45['error'][_0xd5f5('0x15')]);return _0x257471(_0x384d45['error'][_0xd5f5('0x15')]);}else{logger[_0xd5f5('0xd')](_0xd5f5('0xe'),_0x41ba92,_0xd5f5('0xf'));_0x257471(_0x384d45[_0xd5f5('0x16')][_0xd5f5('0x15')]);}})['catch'](function(_0x19f24c){logger['error'](_0xd5f5('0xe'),_0x41ba92,_0x19f24c);_0x335e39(_0x19f24c);});});}exports[_0xd5f5('0x17')]=function(_0x49e266){var _0x106951=this;return new Promise(function(_0x3b2e28,_0x2dbd35){return db[_0xd5f5('0x18')][_0xd5f5('0x19')]({'raw':_0x49e266[_0xd5f5('0x1a')]?_0x49e266['options'][_0xd5f5('0x1b')]===undefined?!![]:![]:!![],'where':_0x49e266[_0xd5f5('0x1a')]?_0x49e266[_0xd5f5('0x1a')][_0xd5f5('0x1c')]||null:null,'attributes':_0x49e266[_0xd5f5('0x1a')]?_0x49e266[_0xd5f5('0x1a')]['attributes']||null:null,'limit':_0x49e266[_0xd5f5('0x1a')]?_0x49e266[_0xd5f5('0x1a')][_0xd5f5('0x1d')]||null:null,'include':_0x49e266[_0xd5f5('0x1a')]?_0x49e266[_0xd5f5('0x1a')][_0xd5f5('0x1e')]?_['map'](_0x49e266[_0xd5f5('0x1a')][_0xd5f5('0x1e')],function(_0x494106){return{'model':db[_0x494106['model']],'as':_0x494106['as'],'attributes':_0x494106['attributes'],'include':_0x494106[_0xd5f5('0x1e')]?_[_0xd5f5('0x1f')](_0x494106['include'],function(_0x16e4ea){return{'model':db[_0x16e4ea[_0xd5f5('0x20')]],'as':_0x16e4ea['as'],'attributes':_0x16e4ea['attributes'],'include':_0x16e4ea[_0xd5f5('0x1e')]?_[_0xd5f5('0x1f')](_0x16e4ea['include'],function(_0x46e064){return{'model':db[_0x46e064[_0xd5f5('0x20')]],'as':_0x46e064['as'],'attributes':_0x46e064[_0xd5f5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd5f5('0xc')](function(_0x533fa1){logger['info']('GetZendeskAccount',_0x49e266);logger['debug']('GetZendeskAccount',_0x49e266,JSON[_0xd5f5('0x12')](_0x533fa1));_0x3b2e28(_0x533fa1);})['catch'](function(_0x80a0df){logger[_0xd5f5('0x13')](_0xd5f5('0x17'),_0x80a0df[_0xd5f5('0x15')],_0x49e266);_0x2dbd35(_0x106951[_0xd5f5('0x13')](0x1f4,_0x80a0df['message']));});});};exports[_0xd5f5('0x22')]=function(_0x50d2fc){var _0x31960a=this;return new Promise(function(_0x36ed2f,_0x2372f1){return db['ZendeskAccount'][_0xd5f5('0x23')]({'raw':_0x50d2fc[_0xd5f5('0x1a')]?_0x50d2fc[_0xd5f5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x50d2fc[_0xd5f5('0x1a')]?_0x50d2fc[_0xd5f5('0x1a')][_0xd5f5('0x1c')]||null:null,'attributes':_0x50d2fc[_0xd5f5('0x1a')]?_0x50d2fc[_0xd5f5('0x1a')]['attributes']||null:null,'include':_0x50d2fc[_0xd5f5('0x1a')]?_0x50d2fc[_0xd5f5('0x1a')][_0xd5f5('0x1e')]?_['map'](_0x50d2fc[_0xd5f5('0x1a')][_0xd5f5('0x1e')],function(_0x2e7d4d){return{'model':db[_0x2e7d4d['model']],'as':_0x2e7d4d['as'],'attributes':_0x2e7d4d[_0xd5f5('0x21')],'include':_0x2e7d4d[_0xd5f5('0x1e')]?_[_0xd5f5('0x1f')](_0x2e7d4d[_0xd5f5('0x1e')],function(_0x86a83a){return{'model':db[_0x86a83a['model']],'as':_0x86a83a['as'],'attributes':_0x86a83a[_0xd5f5('0x21')],'include':_0x86a83a['include']?_[_0xd5f5('0x1f')](_0x86a83a[_0xd5f5('0x1e')],function(_0x17ddc4){return{'model':db[_0x17ddc4[_0xd5f5('0x20')]],'as':_0x17ddc4['as'],'attributes':_0x17ddc4[_0xd5f5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd5f5('0xc')](function(_0x242d98){logger[_0xd5f5('0xd')](_0xd5f5('0x22'),_0x50d2fc);logger['debug'](_0xd5f5('0x22'),_0x50d2fc,JSON[_0xd5f5('0x12')](_0x242d98));_0x36ed2f(_0x242d98);})[_0xd5f5('0x24')](function(_0x5efb80){logger[_0xd5f5('0x13')](_0xd5f5('0x22'),_0x5efb80[_0xd5f5('0x15')],_0x50d2fc);_0x2372f1(_0x31960a[_0xd5f5('0x13')](0x1f4,_0x5efb80[_0xd5f5('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 749b0e1..21d8fd2 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xb688,0xcf));var _0x8b68=function(_0x26ceff,_0x1cc271){_0x26ceff=_0x26ceff-0x0;var _0x7478cf=_0xb688[_0x26ceff];return _0x7478cf;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5a029cd..4023292 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 _0xfb7a=['sequelize','exports','STRING'];(function(_0x8d3f44,_0x51010c){var _0x5e4918=function(_0x4a6a37){while(--_0x4a6a37){_0x8d3f44['push'](_0x8d3f44['shift']());}};_0x5e4918(++_0x51010c);}(_0xfb7a,0xc0));var _0xafb7=function(_0x2e1387,_0x2fd52a){_0x2e1387=_0x2e1387-0x0;var _0xda65a6=_0xfb7a[_0x2e1387];return _0xda65a6;};'use strict';var Sequelize=require(_0xafb7('0x0'));module[_0xafb7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xafb7('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5f25bb5..1713789 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 _0xbc40=['zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','findOne','ZendeskField','getFields','getSubjects','order','getDescriptions','pick','getTags','setTags','ids'];(function(_0x5caecb,_0x1204de){var _0x539a9b=function(_0x5660d1){while(--_0x5660d1){_0x5caecb['push'](_0x5caecb['shift']());}};_0x539a9b(++_0x1204de);}(_0xbc40,0xfc));var _0x0bc4=function(_0xdbc228,_0x29e147){_0xdbc228=_0xdbc228-0x0;var _0x522c46=_0xbc40[_0xdbc228];return _0x522c46;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0bc4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bc4('0x1'));var moment=require('moment');var BPromise=require(_0x0bc4('0x2'));var Mustache=require(_0x0bc4('0x3'));var util=require('util');var path=require(_0x0bc4('0x4'));var sox=require(_0x0bc4('0x5'));var csv=require(_0x0bc4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bc4('0x7'));var _=require(_0x0bc4('0x8'));var squel=require(_0x0bc4('0x9'));var crypto=require(_0x0bc4('0xa'));var jsforce=require(_0x0bc4('0xb'));var deskjs=require(_0x0bc4('0xc'));var toCsv=require(_0x0bc4('0x6'));var querystring=require(_0x0bc4('0xd'));var Papa=require(_0x0bc4('0xe'));var Redis=require('ioredis');var authService=require(_0x0bc4('0xf'));var qs=require(_0x0bc4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bc4('0x11'));var logger=require(_0x0bc4('0x12'))('api');var utils=require(_0x0bc4('0x13'));var config=require(_0x0bc4('0x14'));var licenseUtil=require(_0x0bc4('0x15'));var db=require(_0x0bc4('0x16'))['db'];function respondWithStatusCode(_0x42fdab,_0x1394c3){_0x1394c3=_0x1394c3||0xcc;return function(_0x195d88){if(_0x195d88){return _0x42fdab[_0x0bc4('0x17')](_0x1394c3);}return _0x42fdab[_0x0bc4('0x18')](_0x1394c3)['end']();};}function respondWithResult(_0xfd3b3,_0x1cf5b0){_0x1cf5b0=_0x1cf5b0||0xc8;return function(_0x58e9be){if(_0x58e9be){return _0xfd3b3['status'](_0x1cf5b0)[_0x0bc4('0x19')](_0x58e9be);}};}function respondWithFilteredResult(_0x34ccb7,_0x1cf529){return function(_0x4f4f2a){if(_0x4f4f2a){var _0x290a20=typeof _0x1cf529[_0x0bc4('0x1a')]==='undefined'&&typeof _0x1cf529[_0x0bc4('0x1b')]===_0x0bc4('0x1c');var _0x5523ba=_0x4f4f2a[_0x0bc4('0x1d')];var _0x400ee4=_0x290a20?0x0:_0x1cf529[_0x0bc4('0x1a')];var _0x43366b=_0x290a20?_0x4f4f2a[_0x0bc4('0x1d')]:_0x1cf529[_0x0bc4('0x1a')]+_0x1cf529[_0x0bc4('0x1b')];var _0x47f9c3;if(_0x43366b>=_0x5523ba){_0x43366b=_0x5523ba;_0x47f9c3=0xc8;}else{_0x47f9c3=0xce;}_0x34ccb7['status'](_0x47f9c3);return _0x34ccb7[_0x0bc4('0x1e')](_0x0bc4('0x1f'),_0x400ee4+'-'+_0x43366b+'/'+_0x5523ba)[_0x0bc4('0x19')](_0x4f4f2a);}return null;};}function patchUpdates(_0x122712){return function(_0x182dcf){try{jsonpatch[_0x0bc4('0x20')](_0x182dcf,_0x122712,!![]);}catch(_0x273cb0){return BPromise[_0x0bc4('0x21')](_0x273cb0);}return _0x182dcf[_0x0bc4('0x22')]();};}function saveUpdates(_0x5c00fc,_0x250c45){return function(_0x3912f5){if(_0x3912f5){return _0x3912f5[_0x0bc4('0x23')](_0x5c00fc)[_0x0bc4('0x24')](function(_0x26f419){return _0x26f419;});}return null;};}function removeEntity(_0x51d533,_0x32fc82){return function(_0x553248){if(_0x553248){return _0x553248['destroy']()[_0x0bc4('0x24')](function(){_0x51d533[_0x0bc4('0x18')](0xcc)[_0x0bc4('0x25')]();});}};}function handleEntityNotFound(_0x4e85f3,_0x1b723a){return function(_0x227d2e){if(!_0x227d2e){_0x4e85f3[_0x0bc4('0x17')](0x194);}return _0x227d2e;};}function handleError(_0xbb0051,_0x2c80aa){_0x2c80aa=_0x2c80aa||0x1f4;return function(_0x4269eb){logger[_0x0bc4('0x26')](_0x4269eb[_0x0bc4('0x27')]);if(_0x4269eb[_0x0bc4('0x28')]){delete _0x4269eb[_0x0bc4('0x28')];}_0xbb0051['status'](_0x2c80aa)[_0x0bc4('0x29')](_0x4269eb);};}exports[_0x0bc4('0x2a')]=function(_0x324da1,_0x3eaa4b){var _0x27488f={},_0x1abb1b={},_0x18a81a={'count':0x0,'rows':[]};var _0x4fef4f=_[_0x0bc4('0x2b')](db[_0x0bc4('0x2c')][_0x0bc4('0x2d')],function(_0xf21517){return{'name':_0xf21517[_0x0bc4('0x2e')],'type':_0xf21517[_0x0bc4('0x2f')][_0x0bc4('0x30')]};});_0x1abb1b[_0x0bc4('0x31')]=_[_0x0bc4('0x2b')](_0x4fef4f,_0x0bc4('0x28'));_0x1abb1b['query']=_[_0x0bc4('0x32')](_0x324da1[_0x0bc4('0x33')]);_0x1abb1b[_0x0bc4('0x34')]=_[_0x0bc4('0x35')](_0x1abb1b[_0x0bc4('0x31')],_0x1abb1b['query']);_0x27488f[_0x0bc4('0x36')]=_['intersection'](_0x1abb1b['model'],qs['fields'](_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x37')]));_0x27488f[_0x0bc4('0x36')]=_0x27488f[_0x0bc4('0x36')][_0x0bc4('0x38')]?_0x27488f['attributes']:_0x1abb1b[_0x0bc4('0x31')];if(!_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x39')](_0x0bc4('0x3a'))){_0x27488f[_0x0bc4('0x1b')]=qs[_0x0bc4('0x1b')](_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x1b')]);_0x27488f[_0x0bc4('0x1a')]=qs[_0x0bc4('0x1a')](_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x1a')]);}_0x27488f['order']=qs[_0x0bc4('0x3b')](_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x3b')]);_0x27488f[_0x0bc4('0x3c')]=qs['filters'](_['pick'](_0x324da1[_0x0bc4('0x33')],_0x1abb1b[_0x0bc4('0x34')]),_0x4fef4f);if(_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x3d')]){_0x27488f['where']=_['merge'](_0x27488f[_0x0bc4('0x3c')],{'$or':_['map'](_0x4fef4f,function(_0x5ecccc){if(_0x5ecccc['type']!==_0x0bc4('0x3e')){var _0x168774={};_0x168774[_0x5ecccc['name']]={'$like':'%'+_0x324da1[_0x0bc4('0x33')][_0x0bc4('0x3d')]+'%'};return _0x168774;}})});}_0x27488f=_['merge']({},_0x27488f,_0x324da1[_0x0bc4('0x3f')]);var _0x9f0ac7={'where':_0x27488f['where']};return db[_0x0bc4('0x2c')][_0x0bc4('0x1d')](_0x9f0ac7)[_0x0bc4('0x24')](function(_0x18a04a){_0x18a81a[_0x0bc4('0x1d')]=_0x18a04a;if(_0x324da1['query'][_0x0bc4('0x40')]){_0x27488f[_0x0bc4('0x41')]=[{'all':!![]}];}return db[_0x0bc4('0x2c')][_0x0bc4('0x42')](_0x27488f);})[_0x0bc4('0x24')](function(_0x45c985){_0x18a81a[_0x0bc4('0x43')]=_0x45c985;return _0x18a81a;})['then'](respondWithFilteredResult(_0x3eaa4b,_0x27488f))[_0x0bc4('0x44')](handleError(_0x3eaa4b,null));};exports['show']=function(_0x1047cf,_0x36156d){var _0x14ded9={'raw':![],'where':{'id':_0x1047cf[_0x0bc4('0x45')]['id']}},_0x1e1633={};_0x1e1633['model']=_[_0x0bc4('0x32')](db['ZendeskConfiguration'][_0x0bc4('0x2d')]);_0x1e1633[_0x0bc4('0x33')]=_['keys'](_0x1047cf['query']);_0x1e1633[_0x0bc4('0x34')]=_[_0x0bc4('0x35')](_0x1e1633['model'],_0x1e1633['query']);_0x14ded9[_0x0bc4('0x36')]=_['intersection'](_0x1e1633[_0x0bc4('0x31')],qs[_0x0bc4('0x37')](_0x1047cf[_0x0bc4('0x33')]['fields']));_0x14ded9[_0x0bc4('0x36')]=_0x14ded9[_0x0bc4('0x36')]['length']?_0x14ded9['attributes']:_0x1e1633[_0x0bc4('0x31')];if(_0x1047cf[_0x0bc4('0x33')][_0x0bc4('0x40')]){_0x14ded9['include']=[{'all':!![]}];}_0x14ded9=_[_0x0bc4('0x46')]({},_0x14ded9,_0x1047cf[_0x0bc4('0x3f')]);return db[_0x0bc4('0x2c')][_0x0bc4('0x47')](_0x14ded9)[_0x0bc4('0x24')](handleEntityNotFound(_0x36156d,null))['then'](respondWithResult(_0x36156d,null))[_0x0bc4('0x44')](handleError(_0x36156d,null));};exports[_0x0bc4('0x48')]=function(_0x34d2b4,_0x493ac8){return db['ZendeskConfiguration'][_0x0bc4('0x48')](_0x34d2b4[_0x0bc4('0x49')],{})[_0x0bc4('0x24')](respondWithResult(_0x493ac8,0xc9))[_0x0bc4('0x44')](handleError(_0x493ac8,null));};exports[_0x0bc4('0x23')]=function(_0x2480ed,_0x20b8d9){if(_0x2480ed[_0x0bc4('0x49')]['id']){delete _0x2480ed[_0x0bc4('0x49')]['id'];}return db['ZendeskConfiguration'][_0x0bc4('0x47')]({'where':{'id':_0x2480ed[_0x0bc4('0x45')]['id']}})['then'](handleEntityNotFound(_0x20b8d9,null))[_0x0bc4('0x24')](saveUpdates(_0x2480ed[_0x0bc4('0x49')],null))['then'](respondWithResult(_0x20b8d9,null))['catch'](handleError(_0x20b8d9,null));};exports['destroy']=function(_0x5d6ac9,_0x304d0d){return db['ZendeskConfiguration'][_0x0bc4('0x47')]({'where':{'id':_0x5d6ac9['params']['id']}})[_0x0bc4('0x24')](handleEntityNotFound(_0x304d0d,null))[_0x0bc4('0x24')](removeEntity(_0x304d0d,null))[_0x0bc4('0x44')](handleError(_0x304d0d,null));};exports['getFields']=function(_0x2e7c8b,_0x5577df,_0x31c56a){var _0x75f2fe={};var _0x4c6f95={};var _0x827641;var _0x1988eb;return db[_0x0bc4('0x2c')][_0x0bc4('0x4a')]({'where':{'id':_0x2e7c8b[_0x0bc4('0x45')]['id']}})['then'](handleEntityNotFound(_0x5577df,null))[_0x0bc4('0x24')](function(_0x590c91){if(_0x590c91){_0x827641=_0x590c91;_0x4c6f95[_0x0bc4('0x31')]=_[_0x0bc4('0x32')](db[_0x0bc4('0x4b')][_0x0bc4('0x2d')]);_0x4c6f95[_0x0bc4('0x33')]=_[_0x0bc4('0x32')](_0x2e7c8b[_0x0bc4('0x33')]);_0x4c6f95[_0x0bc4('0x34')]=_[_0x0bc4('0x35')](_0x4c6f95[_0x0bc4('0x31')],_0x4c6f95['query']);_0x75f2fe['attributes']=_['intersection'](_0x4c6f95[_0x0bc4('0x31')],qs[_0x0bc4('0x37')](_0x2e7c8b['query']['fields']));_0x75f2fe[_0x0bc4('0x36')]=_0x75f2fe['attributes'][_0x0bc4('0x38')]?_0x75f2fe[_0x0bc4('0x36')]:_0x4c6f95[_0x0bc4('0x31')];_0x75f2fe['order']=qs[_0x0bc4('0x3b')](_0x2e7c8b['query'][_0x0bc4('0x3b')]);_0x75f2fe[_0x0bc4('0x3c')]=qs[_0x0bc4('0x34')](_['pick'](_0x2e7c8b[_0x0bc4('0x33')],_0x4c6f95[_0x0bc4('0x34')]));if(_0x2e7c8b[_0x0bc4('0x33')]['filter']){_0x75f2fe[_0x0bc4('0x3c')]=_['merge'](_0x75f2fe['where'],{'$or':_[_0x0bc4('0x2b')](_0x75f2fe[_0x0bc4('0x36')],function(_0x257284){var _0x4deb4f={};_0x4deb4f[_0x257284]={'$like':'%'+_0x2e7c8b[_0x0bc4('0x33')][_0x0bc4('0x3d')]+'%'};return _0x4deb4f;})});}_0x75f2fe=_[_0x0bc4('0x46')]({},_0x75f2fe,_0x2e7c8b['options']);return _0x827641[_0x0bc4('0x4c')](_0x75f2fe);}})[_0x0bc4('0x24')](function(_0x140e00){if(_0x140e00){_0x1988eb=_0x140e00['length'];if(!_0x2e7c8b['query'][_0x0bc4('0x39')](_0x0bc4('0x3a'))){_0x75f2fe[_0x0bc4('0x1b')]=qs['limit'](_0x2e7c8b[_0x0bc4('0x33')][_0x0bc4('0x1b')]);_0x75f2fe[_0x0bc4('0x1a')]=qs[_0x0bc4('0x1a')](_0x2e7c8b[_0x0bc4('0x33')][_0x0bc4('0x1a')]);}return _0x827641['getFields'](_0x75f2fe);}})['then'](function(_0x5dda4d){if(_0x5dda4d){return _0x5dda4d?{'count':_0x1988eb,'rows':_0x5dda4d}:null;}})[_0x0bc4('0x24')](respondWithResult(_0x5577df,null))[_0x0bc4('0x44')](handleError(_0x5577df,null));};exports[_0x0bc4('0x4d')]=function(_0x2da941,_0x344fbd,_0x4d2f7f){var _0x5d0e1a={};var _0x911725={};var _0x327526;var _0x1120e8;return db[_0x0bc4('0x2c')][_0x0bc4('0x4a')]({'where':{'id':_0x2da941[_0x0bc4('0x45')]['id']}})[_0x0bc4('0x24')](handleEntityNotFound(_0x344fbd,null))[_0x0bc4('0x24')](function(_0x477a1e){if(_0x477a1e){_0x327526=_0x477a1e;_0x911725['model']=_[_0x0bc4('0x32')](db['ZendeskField'][_0x0bc4('0x2d')]);_0x911725['query']=_[_0x0bc4('0x32')](_0x2da941[_0x0bc4('0x33')]);_0x911725[_0x0bc4('0x34')]=_['intersection'](_0x911725[_0x0bc4('0x31')],_0x911725[_0x0bc4('0x33')]);_0x5d0e1a[_0x0bc4('0x36')]=_[_0x0bc4('0x35')](_0x911725[_0x0bc4('0x31')],qs[_0x0bc4('0x37')](_0x2da941[_0x0bc4('0x33')][_0x0bc4('0x37')]));_0x5d0e1a[_0x0bc4('0x36')]=_0x5d0e1a['attributes'][_0x0bc4('0x38')]?_0x5d0e1a['attributes']:_0x911725[_0x0bc4('0x31')];_0x5d0e1a[_0x0bc4('0x4e')]=qs[_0x0bc4('0x3b')](_0x2da941[_0x0bc4('0x33')][_0x0bc4('0x3b')]);_0x5d0e1a[_0x0bc4('0x3c')]=qs[_0x0bc4('0x34')](_['pick'](_0x2da941['query'],_0x911725['filters']));if(_0x2da941['query'][_0x0bc4('0x3d')]){_0x5d0e1a['where']=_[_0x0bc4('0x46')](_0x5d0e1a[_0x0bc4('0x3c')],{'$or':_[_0x0bc4('0x2b')](_0x5d0e1a[_0x0bc4('0x36')],function(_0x52bf89){var _0x49d108={};_0x49d108[_0x52bf89]={'$like':'%'+_0x2da941['query'][_0x0bc4('0x3d')]+'%'};return _0x49d108;})});}_0x5d0e1a=_[_0x0bc4('0x46')]({},_0x5d0e1a,_0x2da941['options']);return _0x327526['getSubjects'](_0x5d0e1a);}})['then'](function(_0x350358){if(_0x350358){_0x1120e8=_0x350358[_0x0bc4('0x38')];if(!_0x2da941[_0x0bc4('0x33')][_0x0bc4('0x39')](_0x0bc4('0x3a'))){_0x5d0e1a[_0x0bc4('0x1b')]=qs[_0x0bc4('0x1b')](_0x2da941[_0x0bc4('0x33')]['limit']);_0x5d0e1a[_0x0bc4('0x1a')]=qs[_0x0bc4('0x1a')](_0x2da941[_0x0bc4('0x33')][_0x0bc4('0x1a')]);}return _0x327526[_0x0bc4('0x4d')](_0x5d0e1a);}})[_0x0bc4('0x24')](function(_0x2c25ba){if(_0x2c25ba){return _0x2c25ba?{'count':_0x1120e8,'rows':_0x2c25ba}:null;}})[_0x0bc4('0x24')](respondWithResult(_0x344fbd,null))[_0x0bc4('0x44')](handleError(_0x344fbd,null));};exports[_0x0bc4('0x4f')]=function(_0x12038c,_0x2bfbb3,_0x3ddda6){var _0x5083ca={};var _0x26331e={};var _0x2edfe6;var _0x50e726;return db[_0x0bc4('0x2c')][_0x0bc4('0x4a')]({'where':{'id':_0x12038c[_0x0bc4('0x45')]['id']}})[_0x0bc4('0x24')](handleEntityNotFound(_0x2bfbb3,null))['then'](function(_0x301457){if(_0x301457){_0x2edfe6=_0x301457;_0x26331e[_0x0bc4('0x31')]=_[_0x0bc4('0x32')](db[_0x0bc4('0x4b')][_0x0bc4('0x2d')]);_0x26331e[_0x0bc4('0x33')]=_[_0x0bc4('0x32')](_0x12038c[_0x0bc4('0x33')]);_0x26331e[_0x0bc4('0x34')]=_[_0x0bc4('0x35')](_0x26331e[_0x0bc4('0x31')],_0x26331e[_0x0bc4('0x33')]);_0x5083ca[_0x0bc4('0x36')]=_[_0x0bc4('0x35')](_0x26331e['model'],qs[_0x0bc4('0x37')](_0x12038c[_0x0bc4('0x33')][_0x0bc4('0x37')]));_0x5083ca[_0x0bc4('0x36')]=_0x5083ca[_0x0bc4('0x36')][_0x0bc4('0x38')]?_0x5083ca[_0x0bc4('0x36')]:_0x26331e[_0x0bc4('0x31')];_0x5083ca[_0x0bc4('0x4e')]=qs[_0x0bc4('0x3b')](_0x12038c[_0x0bc4('0x33')][_0x0bc4('0x3b')]);_0x5083ca[_0x0bc4('0x3c')]=qs[_0x0bc4('0x34')](_[_0x0bc4('0x50')](_0x12038c[_0x0bc4('0x33')],_0x26331e['filters']));if(_0x12038c[_0x0bc4('0x33')][_0x0bc4('0x3d')]){_0x5083ca['where']=_[_0x0bc4('0x46')](_0x5083ca['where'],{'$or':_[_0x0bc4('0x2b')](_0x5083ca[_0x0bc4('0x36')],function(_0x5dcfef){var _0x332961={};_0x332961[_0x5dcfef]={'$like':'%'+_0x12038c[_0x0bc4('0x33')]['filter']+'%'};return _0x332961;})});}_0x5083ca=_['merge']({},_0x5083ca,_0x12038c['options']);return _0x2edfe6[_0x0bc4('0x4f')](_0x5083ca);}})['then'](function(_0x57633c){if(_0x57633c){_0x50e726=_0x57633c[_0x0bc4('0x38')];if(!_0x12038c['query'][_0x0bc4('0x39')](_0x0bc4('0x3a'))){_0x5083ca[_0x0bc4('0x1b')]=qs[_0x0bc4('0x1b')](_0x12038c[_0x0bc4('0x33')][_0x0bc4('0x1b')]);_0x5083ca[_0x0bc4('0x1a')]=qs['offset'](_0x12038c['query'][_0x0bc4('0x1a')]);}return _0x2edfe6['getDescriptions'](_0x5083ca);}})[_0x0bc4('0x24')](function(_0x427952){if(_0x427952){return _0x427952?{'count':_0x50e726,'rows':_0x427952}:null;}})[_0x0bc4('0x24')](respondWithResult(_0x2bfbb3,null))[_0x0bc4('0x44')](handleError(_0x2bfbb3,null));};exports[_0x0bc4('0x51')]=function(_0x1d4fdd,_0x2a6b89,_0x875ad){var _0x5c45cb={};var _0x3a4cf9={};var _0x45e155;var _0x353150;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1d4fdd[_0x0bc4('0x45')]['id']}})[_0x0bc4('0x24')](handleEntityNotFound(_0x2a6b89,null))['then'](function(_0x2dfec2){if(_0x2dfec2){_0x45e155=_0x2dfec2;_0x3a4cf9[_0x0bc4('0x31')]=_[_0x0bc4('0x32')](db['Tag']['rawAttributes']);_0x3a4cf9[_0x0bc4('0x33')]=_['keys'](_0x1d4fdd[_0x0bc4('0x33')]);_0x3a4cf9[_0x0bc4('0x34')]=_[_0x0bc4('0x35')](_0x3a4cf9[_0x0bc4('0x31')],_0x3a4cf9['query']);_0x5c45cb[_0x0bc4('0x36')]=_[_0x0bc4('0x35')](_0x3a4cf9[_0x0bc4('0x31')],qs['fields'](_0x1d4fdd['query'][_0x0bc4('0x37')]));_0x5c45cb[_0x0bc4('0x36')]=_0x5c45cb[_0x0bc4('0x36')][_0x0bc4('0x38')]?_0x5c45cb[_0x0bc4('0x36')]:_0x3a4cf9[_0x0bc4('0x31')];_0x5c45cb[_0x0bc4('0x4e')]=qs[_0x0bc4('0x3b')](_0x1d4fdd[_0x0bc4('0x33')][_0x0bc4('0x3b')]);_0x5c45cb['where']=qs['filters'](_[_0x0bc4('0x50')](_0x1d4fdd[_0x0bc4('0x33')],_0x3a4cf9[_0x0bc4('0x34')]));if(_0x1d4fdd['query']['filter']){_0x5c45cb[_0x0bc4('0x3c')]=_[_0x0bc4('0x46')](_0x5c45cb[_0x0bc4('0x3c')],{'$or':_[_0x0bc4('0x2b')](_0x5c45cb['attributes'],function(_0x1b02b7){var _0x3982fe={};_0x3982fe[_0x1b02b7]={'$like':'%'+_0x1d4fdd[_0x0bc4('0x33')]['filter']+'%'};return _0x3982fe;})});}_0x5c45cb=_['merge']({},_0x5c45cb,_0x1d4fdd[_0x0bc4('0x3f')]);return _0x45e155[_0x0bc4('0x51')](_0x5c45cb);}})[_0x0bc4('0x24')](function(_0x5f5b3a){if(_0x5f5b3a){_0x353150=_0x5f5b3a[_0x0bc4('0x38')];if(!_0x1d4fdd['query']['hasOwnProperty'](_0x0bc4('0x3a'))){_0x5c45cb[_0x0bc4('0x1b')]=qs[_0x0bc4('0x1b')](_0x1d4fdd[_0x0bc4('0x33')][_0x0bc4('0x1b')]);_0x5c45cb[_0x0bc4('0x1a')]=qs[_0x0bc4('0x1a')](_0x1d4fdd[_0x0bc4('0x33')][_0x0bc4('0x1a')]);}return _0x45e155['getTags'](_0x5c45cb);}})['then'](function(_0x9c8ec6){if(_0x9c8ec6){return _0x9c8ec6?{'count':_0x353150,'rows':_0x9c8ec6}:null;}})['then'](respondWithResult(_0x2a6b89,null))[_0x0bc4('0x44')](handleError(_0x2a6b89,null));};exports['setTags']=function(_0x5edf9c,_0x4b6ec0,_0x9a48b4){if(_0x5edf9c[_0x0bc4('0x49')]['id']){delete _0x5edf9c[_0x0bc4('0x49')]['id'];}return db['ZendeskConfiguration'][_0x0bc4('0x4a')]({'where':{'id':_0x5edf9c['params']['id']}})[_0x0bc4('0x24')](handleEntityNotFound(_0x4b6ec0,null))['then'](function(_0x31f356){if(_0x31f356){return _0x31f356[_0x0bc4('0x52')](_0x5edf9c['body'][_0x0bc4('0x53')]||[]);}return null;})[_0x0bc4('0x24')](respondWithResult(_0x4b6ec0,null))['catch'](handleError(_0x4b6ec0,null));}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index daa89a8..561285d 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 _0x34b7=['request-promise','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x34b7,0x196));var _0x734b=function(_0x13b8b1,_0x42882a){_0x13b8b1=_0x13b8b1-0x0;var _0x467f68=_0x34b7[_0x13b8b1];return _0x467f68;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index c28ae0b..570a0a3 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 _0xbb58=['../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5378ca,_0x302111){var _0x267a9d=function(_0xb840fd){while(--_0xb840fd){_0x5378ca['push'](_0x5378ca['shift']());}};_0x267a9d(++_0x302111);}(_0xbb58,0x18a));var _0x8bb5=function(_0x1730ec,_0x5bd5ef){_0x1730ec=_0x1730ec-0x0;var _0x47d8fa=_0xbb58[_0x1730ec];return _0x47d8fa;};'use strict';var _=require(_0x8bb5('0x0'));var util=require(_0x8bb5('0x1'));var moment=require(_0x8bb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bb5('0x3'));var fs=require('fs');var Redis=require(_0x8bb5('0x4'));var db=require(_0x8bb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8bb5('0x6'));var jayson=require(_0x8bb5('0x7'));var client=jayson[_0x8bb5('0x8')][_0x8bb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3781bb,_0x2cb776,_0x56b9a4){return new BPromise(function(_0x21b6dc,_0x344316){return client[_0x8bb5('0xa')](_0x3781bb,_0x56b9a4)['then'](function(_0x3709b1){logger['info'](_0x8bb5('0xb'),_0x2cb776,'request\x20sent');logger['debug'](_0x8bb5('0xc'),_0x2cb776,'request\x20sent',JSON[_0x8bb5('0xd')](_0x3709b1));if(_0x3709b1[_0x8bb5('0xe')]){if(_0x3709b1[_0x8bb5('0xe')][_0x8bb5('0xf')]===0x1f4){logger[_0x8bb5('0xe')](_0x8bb5('0xb'),_0x2cb776,_0x3709b1['error'][_0x8bb5('0x10')]);return _0x344316(_0x3709b1[_0x8bb5('0xe')][_0x8bb5('0x10')]);}logger[_0x8bb5('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2cb776,_0x3709b1[_0x8bb5('0xe')]['message']);return _0x21b6dc(_0x3709b1['error'][_0x8bb5('0x10')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x2cb776,_0x8bb5('0x11'));_0x21b6dc(_0x3709b1[_0x8bb5('0x12')][_0x8bb5('0x10')]);}})[_0x8bb5('0x13')](function(_0x4fd5c8){logger[_0x8bb5('0xe')](_0x8bb5('0xb'),_0x2cb776,_0x4fd5c8);_0x344316(_0x4fd5c8);});});} \ No newline at end of file +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 diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e7244c2..c09f053 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 _0x11b5=['express','Router','fs-extra','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x240edb,_0x4222c1){var _0x124286=function(_0x55891f){while(--_0x55891f){_0x240edb['push'](_0x240edb['shift']());}};_0x124286(++_0x4222c1);}(_0x11b5,0x1d0));var _0x511b=function(_0x17d940,_0x29be4e){_0x17d940=_0x17d940-0x0;var _0x546066=_0x11b5[_0x17d940];return _0x546066;};'use strict';var multer=require(_0x511b('0x0'));var util=require(_0x511b('0x1'));var path=require(_0x511b('0x2'));var timeout=require(_0x511b('0x3'));var express=require(_0x511b('0x4'));var router=express[_0x511b('0x5')]();var fs_extra=require(_0x511b('0x6'));var auth=require(_0x511b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x511b('0x8'));router[_0x511b('0x9')]('/',auth[_0x511b('0xa')](),controller[_0x511b('0xb')]);router[_0x511b('0x9')](_0x511b('0xc'),auth[_0x511b('0xa')](),controller['show']);router[_0x511b('0xd')]('/',auth[_0x511b('0xa')](),controller[_0x511b('0xe')]);router[_0x511b('0xf')]('/:id',auth[_0x511b('0xa')](),controller[_0x511b('0x10')]);router['delete'](_0x511b('0xc'),auth[_0x511b('0xa')](),controller[_0x511b('0x11')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c5285cb..d182d46 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 _0x128f=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x43f85b,_0x28d21a){var _0x59ba3a=function(_0x1aff15){while(--_0x1aff15){_0x43f85b['push'](_0x43f85b['shift']());}};_0x59ba3a(++_0x28d21a);}(_0x128f,0x126));var _0xf128=function(_0x5679a4,_0x1f420b){_0x5679a4=_0x5679a4-0x0;var _0x397109=_0x128f[_0x5679a4];return _0x397109;};'use strict';var Sequelize=require(_0xf128('0x0'));module[_0xf128('0x1')]={'type':{'type':Sequelize[_0xf128('0x2')](_0xf128('0x3'),_0xf128('0x4'),_0xf128('0x5'),'keyValue',_0xf128('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf128('0x7')]},'keyType':{'type':Sequelize[_0xf128('0x2')](_0xf128('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf128('0x7')]},'idField':{'type':Sequelize[_0xf128('0x7')]},'nameField':{'type':Sequelize[_0xf128('0x7')]},'customField':{'type':Sequelize[_0xf128('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index edf4425..d9e9ae5 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 _0x0e4f=['set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','ZendeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x0e4f,0x1f4));var _0xf0e4=function(_0x36ad80,_0x46f873){_0x36ad80=_0x36ad80-0x0;var _0x296f99=_0x0e4f[_0x36ad80];return _0x296f99;};'use strict';var emlformat=require(_0xf0e4('0x0'));var rimraf=require(_0xf0e4('0x1'));var zipdir=require(_0xf0e4('0x2'));var jsonpatch=require(_0xf0e4('0x3'));var rp=require(_0xf0e4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf0e4('0x5'));var util=require(_0xf0e4('0x6'));var path=require('path');var sox=require(_0xf0e4('0x7'));var csv=require(_0xf0e4('0x8'));var ejs=require(_0xf0e4('0x9'));var fs=require('fs');var fs_extra=require(_0xf0e4('0xa'));var _=require(_0xf0e4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf0e4('0xc'));var deskjs=require(_0xf0e4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf0e4('0xe'));var Redis=require(_0xf0e4('0xf'));var authService=require(_0xf0e4('0x10'));var qs=require(_0xf0e4('0x11'));var as=require(_0xf0e4('0x12'));var hardwareService=require(_0xf0e4('0x13'));var logger=require(_0xf0e4('0x14'))(_0xf0e4('0x15'));var utils=require(_0xf0e4('0x16'));var config=require(_0xf0e4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0e4('0x18'))['db'];function respondWithStatusCode(_0x74147c,_0x5e40ed){_0x5e40ed=_0x5e40ed||0xcc;return function(_0x3c20fb){if(_0x3c20fb){return _0x74147c['sendStatus'](_0x5e40ed);}return _0x74147c[_0xf0e4('0x19')](_0x5e40ed)[_0xf0e4('0x1a')]();};}function respondWithResult(_0x230d65,_0x10cb52){_0x10cb52=_0x10cb52||0xc8;return function(_0x133467){if(_0x133467){return _0x230d65['status'](_0x10cb52)[_0xf0e4('0x1b')](_0x133467);}};}function respondWithFilteredResult(_0x3ec20b,_0x502ccd){return function(_0x473b64){if(_0x473b64){var _0x2aa64d=typeof _0x502ccd[_0xf0e4('0x1c')]===_0xf0e4('0x1d')&&typeof _0x502ccd[_0xf0e4('0x1e')]==='undefined';var _0x45723d=_0x473b64[_0xf0e4('0x1f')];var _0x4568d2=_0x2aa64d?0x0:_0x502ccd[_0xf0e4('0x1c')];var _0x226fa7=_0x2aa64d?_0x473b64[_0xf0e4('0x1f')]:_0x502ccd[_0xf0e4('0x1c')]+_0x502ccd['limit'];var _0x594897;if(_0x226fa7>=_0x45723d){_0x226fa7=_0x45723d;_0x594897=0xc8;}else{_0x594897=0xce;}_0x3ec20b[_0xf0e4('0x19')](_0x594897);return _0x3ec20b[_0xf0e4('0x20')](_0xf0e4('0x21'),_0x4568d2+'-'+_0x226fa7+'/'+_0x45723d)['json'](_0x473b64);}return null;};}function patchUpdates(_0x2915b0){return function(_0x1bc148){try{jsonpatch[_0xf0e4('0x22')](_0x1bc148,_0x2915b0,!![]);}catch(_0x11c07f){return BPromise[_0xf0e4('0x23')](_0x11c07f);}return _0x1bc148[_0xf0e4('0x24')]();};}function saveUpdates(_0xb449f4,_0x14440a){return function(_0x27df91){if(_0x27df91){return _0x27df91['update'](_0xb449f4)[_0xf0e4('0x25')](function(_0x537b49){return _0x537b49;});}return null;};}function removeEntity(_0x54e3a4,_0x3c87d9){return function(_0x336fc6){if(_0x336fc6){return _0x336fc6[_0xf0e4('0x26')]()['then'](function(){_0x54e3a4[_0xf0e4('0x19')](0xcc)[_0xf0e4('0x1a')]();});}};}function handleEntityNotFound(_0x323af6,_0x20107e){return function(_0xc5131c){if(!_0xc5131c){_0x323af6[_0xf0e4('0x27')](0x194);}return _0xc5131c;};}function handleError(_0x247497,_0x41bb0e){_0x41bb0e=_0x41bb0e||0x1f4;return function(_0x31b72d){logger[_0xf0e4('0x28')](_0x31b72d['stack']);if(_0x31b72d[_0xf0e4('0x29')]){delete _0x31b72d[_0xf0e4('0x29')];}_0x247497[_0xf0e4('0x19')](_0x41bb0e)[_0xf0e4('0x2a')](_0x31b72d);};}exports[_0xf0e4('0x2b')]=function(_0x491041,_0x389dd4){var _0x4c2e01={},_0x4c9f84={},_0x5b92af={'count':0x0,'rows':[]};var _0x813905=_[_0xf0e4('0x2c')](db[_0xf0e4('0x2d')][_0xf0e4('0x2e')],function(_0x75eee){return{'name':_0x75eee['fieldName'],'type':_0x75eee[_0xf0e4('0x2f')][_0xf0e4('0x30')]};});_0x4c9f84[_0xf0e4('0x31')]=_[_0xf0e4('0x2c')](_0x813905,_0xf0e4('0x29'));_0x4c9f84['query']=_[_0xf0e4('0x32')](_0x491041[_0xf0e4('0x33')]);_0x4c9f84[_0xf0e4('0x34')]=_[_0xf0e4('0x35')](_0x4c9f84[_0xf0e4('0x31')],_0x4c9f84['query']);_0x4c2e01[_0xf0e4('0x36')]=_[_0xf0e4('0x35')](_0x4c9f84[_0xf0e4('0x31')],qs[_0xf0e4('0x37')](_0x491041['query'][_0xf0e4('0x37')]));_0x4c2e01[_0xf0e4('0x36')]=_0x4c2e01[_0xf0e4('0x36')][_0xf0e4('0x38')]?_0x4c2e01[_0xf0e4('0x36')]:_0x4c9f84[_0xf0e4('0x31')];if(!_0x491041[_0xf0e4('0x33')][_0xf0e4('0x39')]('nolimit')){_0x4c2e01[_0xf0e4('0x1e')]=qs[_0xf0e4('0x1e')](_0x491041['query']['limit']);_0x4c2e01[_0xf0e4('0x1c')]=qs[_0xf0e4('0x1c')](_0x491041['query'][_0xf0e4('0x1c')]);}_0x4c2e01[_0xf0e4('0x3a')]=qs[_0xf0e4('0x3b')](_0x491041[_0xf0e4('0x33')][_0xf0e4('0x3b')]);_0x4c2e01['where']=qs[_0xf0e4('0x34')](_[_0xf0e4('0x3c')](_0x491041[_0xf0e4('0x33')],_0x4c9f84[_0xf0e4('0x34')]),_0x813905);if(_0x491041[_0xf0e4('0x33')][_0xf0e4('0x3d')]){_0x4c2e01[_0xf0e4('0x3e')]=_['merge'](_0x4c2e01[_0xf0e4('0x3e')],{'$or':_[_0xf0e4('0x2c')](_0x813905,function(_0x5672d6){if(_0x5672d6[_0xf0e4('0x2f')]!==_0xf0e4('0x3f')){var _0x4561f3={};_0x4561f3[_0x5672d6[_0xf0e4('0x29')]]={'$like':'%'+_0x491041[_0xf0e4('0x33')][_0xf0e4('0x3d')]+'%'};return _0x4561f3;}})});}_0x4c2e01=_[_0xf0e4('0x40')]({},_0x4c2e01,_0x491041[_0xf0e4('0x41')]);var _0x1171dc={'where':_0x4c2e01[_0xf0e4('0x3e')]};return db[_0xf0e4('0x2d')][_0xf0e4('0x1f')](_0x1171dc)[_0xf0e4('0x25')](function(_0x351925){_0x5b92af[_0xf0e4('0x1f')]=_0x351925;if(_0x491041['query']['includeAll']){_0x4c2e01[_0xf0e4('0x42')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x4c2e01);})[_0xf0e4('0x25')](function(_0xb5a8cd){_0x5b92af[_0xf0e4('0x43')]=_0xb5a8cd;return _0x5b92af;})[_0xf0e4('0x25')](respondWithFilteredResult(_0x389dd4,_0x4c2e01))['catch'](handleError(_0x389dd4,null));};exports[_0xf0e4('0x44')]=function(_0x364269,_0x2bf12c){var _0xeba915={'raw':!![],'where':{'id':_0x364269[_0xf0e4('0x45')]['id']}},_0x59f1c3={};_0x59f1c3[_0xf0e4('0x31')]=_[_0xf0e4('0x32')](db['ZendeskField'][_0xf0e4('0x2e')]);_0x59f1c3[_0xf0e4('0x33')]=_[_0xf0e4('0x32')](_0x364269[_0xf0e4('0x33')]);_0x59f1c3[_0xf0e4('0x34')]=_[_0xf0e4('0x35')](_0x59f1c3[_0xf0e4('0x31')],_0x59f1c3[_0xf0e4('0x33')]);_0xeba915[_0xf0e4('0x36')]=_[_0xf0e4('0x35')](_0x59f1c3['model'],qs['fields'](_0x364269['query'][_0xf0e4('0x37')]));_0xeba915[_0xf0e4('0x36')]=_0xeba915[_0xf0e4('0x36')][_0xf0e4('0x38')]?_0xeba915[_0xf0e4('0x36')]:_0x59f1c3[_0xf0e4('0x31')];if(_0x364269[_0xf0e4('0x33')][_0xf0e4('0x46')]){_0xeba915[_0xf0e4('0x42')]=[{'all':!![]}];}_0xeba915=_[_0xf0e4('0x40')]({},_0xeba915,_0x364269[_0xf0e4('0x41')]);return db[_0xf0e4('0x2d')][_0xf0e4('0x47')](_0xeba915)[_0xf0e4('0x25')](handleEntityNotFound(_0x2bf12c,null))['then'](respondWithResult(_0x2bf12c,null))[_0xf0e4('0x48')](handleError(_0x2bf12c,null));};exports[_0xf0e4('0x49')]=function(_0x3968cf,_0x49654f){return db['ZendeskField'][_0xf0e4('0x49')](_0x3968cf['body'],{})[_0xf0e4('0x25')](respondWithResult(_0x49654f,0xc9))[_0xf0e4('0x48')](handleError(_0x49654f,null));};exports[_0xf0e4('0x4a')]=function(_0x4b4e8e,_0x2e88c3){if(_0x4b4e8e[_0xf0e4('0x4b')]['id']){delete _0x4b4e8e[_0xf0e4('0x4b')]['id'];}return db[_0xf0e4('0x2d')][_0xf0e4('0x47')]({'where':{'id':_0x4b4e8e[_0xf0e4('0x45')]['id']}})[_0xf0e4('0x25')](handleEntityNotFound(_0x2e88c3,null))[_0xf0e4('0x25')](saveUpdates(_0x4b4e8e[_0xf0e4('0x4b')],null))[_0xf0e4('0x25')](respondWithResult(_0x2e88c3,null))['catch'](handleError(_0x2e88c3,null));};exports[_0xf0e4('0x26')]=function(_0x5f2990,_0x5d4962){return db[_0xf0e4('0x2d')][_0xf0e4('0x47')]({'where':{'id':_0x5f2990['params']['id']}})[_0xf0e4('0x25')](handleEntityNotFound(_0x5d4962,null))[_0xf0e4('0x25')](removeEntity(_0x5d4962,null))['catch'](handleError(_0x5d4962,null));}; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c03d208..bc9a9ee 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 _0x2784=['int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField'];(function(_0x326a44,_0x41c393){var _0x218e10=function(_0x4ef0a6){while(--_0x4ef0a6){_0x326a44['push'](_0x326a44['shift']());}};_0x218e10(++_0x41c393);}(_0x2784,0xfa));var _0x4278=function(_0x53527a,_0x51c931){_0x53527a=_0x53527a-0x0;var _0x3d6e4e=_0x2784[_0x53527a];return _0x3d6e4e;};'use strict';var _=require(_0x4278('0x0'));var util=require(_0x4278('0x1'));var logger=require(_0x4278('0x2'))(_0x4278('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4278('0x4'));var fs=require('fs');var path=require(_0x4278('0x5'));var rimraf=require('rimraf');var config=require(_0x4278('0x6'));var attributes=require(_0x4278('0x7'));module[_0x4278('0x8')]=function(_0x5e4397,_0x16058f){return _0x5e4397['define'](_0x4278('0x9'),attributes,{'tableName':_0x4278('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x4278('0xb'),_0x4278('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 6c068b9..b9cc7c2 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 _0xa72d=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa72d,0x111));var _0xda72=function(_0x43984e,_0x373098){_0x43984e=_0x43984e-0x0;var _0x52bab0=_0xa72d[_0x43984e];return _0x52bab0;};'use strict';var _=require('lodash');var util=require(_0xda72('0x0'));var moment=require(_0xda72('0x1'));var BPromise=require(_0xda72('0x2'));var rs=require(_0xda72('0x3'));var fs=require('fs');var Redis=require(_0xda72('0x4'));var db=require(_0xda72('0x5'))['db'];var utils=require(_0xda72('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xda72('0x7'));var client=jayson[_0xda72('0x8')][_0xda72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f1daf,_0x245e52,_0x508d16){return new BPromise(function(_0x597862,_0xeca146){return client[_0xda72('0xa')](_0x3f1daf,_0x508d16)[_0xda72('0xb')](function(_0x322818){logger[_0xda72('0xc')](_0xda72('0xd'),_0x245e52,_0xda72('0xe'));logger[_0xda72('0xf')](_0xda72('0x10'),_0x245e52,_0xda72('0xe'),JSON[_0xda72('0x11')](_0x322818));if(_0x322818['error']){if(_0x322818['error'][_0xda72('0x12')]===0x1f4){logger[_0xda72('0x13')]('ZendeskField,\x20%s,\x20%s',_0x245e52,_0x322818[_0xda72('0x13')][_0xda72('0x14')]);return _0xeca146(_0x322818['error'][_0xda72('0x14')]);}logger[_0xda72('0x13')](_0xda72('0xd'),_0x245e52,_0x322818[_0xda72('0x13')]['message']);return _0x597862(_0x322818[_0xda72('0x13')][_0xda72('0x14')]);}else{logger[_0xda72('0xc')](_0xda72('0xd'),_0x245e52,_0xda72('0xe'));_0x597862(_0x322818['result'][_0xda72('0x14')]);}})[_0xda72('0x15')](function(_0x347bb6){logger[_0xda72('0x13')]('ZendeskField,\x20%s,\x20%s',_0x245e52,_0x347bb6);_0xeca146(_0x347bb6);});});} \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ee788f6..6ad1af4 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 _0x5f41=['/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','path','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x307070,_0x34ce6c){var _0x33cccb=function(_0x180084){while(--_0x180084){_0x307070['push'](_0x307070['shift']());}};_0x33cccb(++_0x34ce6c);}(_0x5f41,0xf1));var _0x15f4=function(_0x569471,_0x523730){_0x569471=_0x569471-0x0;var _0x33c943=_0x5f41[_0x569471];return _0x33c943;};'use strict';var multer=require(_0x15f4('0x0'));var util=require('util');var path=require(_0x15f4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15f4('0x2')]();var fs_extra=require(_0x15f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x15f4('0x4'));var config=require('../../config/environment');var controller=require(_0x15f4('0x5'));router[_0x15f4('0x6')]('/',auth[_0x15f4('0x7')](),controller[_0x15f4('0x8')]);router[_0x15f4('0x6')]('/:id',auth[_0x15f4('0x7')](),controller[_0x15f4('0x9')]);router[_0x15f4('0x6')](_0x15f4('0xa'),auth[_0x15f4('0x7')](),controller['getConfigurations']);router[_0x15f4('0x6')](_0x15f4('0xb'),auth[_0x15f4('0x7')](),controller[_0x15f4('0xc')]);router['post']('/',auth[_0x15f4('0x7')](),controller[_0x15f4('0xd')]);router[_0x15f4('0xe')]('/:id/configurations',auth[_0x15f4('0x7')](),controller[_0x15f4('0xf')]);router[_0x15f4('0x10')](_0x15f4('0x11'),auth[_0x15f4('0x7')](),controller[_0x15f4('0x12')]);router[_0x15f4('0x13')](_0x15f4('0x11'),auth[_0x15f4('0x7')](),controller[_0x15f4('0x14')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0097a12..b6a4b8d 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 _0x4bc3=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0x16e));var _0x34bc=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x4bc3[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x34bc('0x0'));module[_0x34bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x34bc('0x2')]},'host':{'type':Sequelize[_0x34bc('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x34bc('0x2')]},'clientSecret':{'type':Sequelize[_0x34bc('0x2')]},'serverUrl':{'type':Sequelize[_0x34bc('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x34bc('0x2')]},'refreshToken':{'type':Sequelize[_0x34bc('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7e180a6..81354dd 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 _0x3527=['Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','getFields','zone','clientSecret','serverUrl','code','host','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ZohoAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId'];(function(_0x3ca349,_0x203ed0){var _0xeac360=function(_0x1ba652){while(--_0x1ba652){_0x3ca349['push'](_0x3ca349['shift']());}};_0xeac360(++_0x203ed0);}(_0x3527,0x1a7));var _0x7352=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x3527[_0x10291b];return _0x1d5fbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7352('0x0'));var zipdir=require(_0x7352('0x1'));var jsonpatch=require(_0x7352('0x2'));var rp=require('request-promise');var moment=require(_0x7352('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7352('0x4'));var sox=require(_0x7352('0x5'));var csv=require('to-csv');var ejs=require(_0x7352('0x6'));var fs=require('fs');var fs_extra=require(_0x7352('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7352('0x8'));var jsforce=require(_0x7352('0x9'));var deskjs=require(_0x7352('0xa'));var toCsv=require(_0x7352('0xb'));var querystring=require(_0x7352('0xc'));var Papa=require('papaparse');var Redis=require(_0x7352('0xd'));var authService=require(_0x7352('0xe'));var qs=require(_0x7352('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7352('0x10'));var logger=require(_0x7352('0x11'))(_0x7352('0x12'));var utils=require(_0x7352('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7352('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7352('0x15'));function respondWithStatusCode(_0x465f1b,_0x1cf532){_0x1cf532=_0x1cf532||0xcc;return function(_0x492850){if(_0x492850){return _0x465f1b['sendStatus'](_0x1cf532);}return _0x465f1b[_0x7352('0x16')](_0x1cf532)[_0x7352('0x17')]();};}function respondWithResult(_0x30b872,_0x5b3fff){_0x5b3fff=_0x5b3fff||0xc8;return function(_0x40281d){if(_0x40281d){return _0x30b872[_0x7352('0x16')](_0x5b3fff)[_0x7352('0x18')](_0x40281d);}};}function respondWithFilteredResult(_0xe11c8a,_0x6e10ac){return function(_0x1ce0fc){if(_0x1ce0fc){var _0xcc41fa=typeof _0x6e10ac[_0x7352('0x19')]===_0x7352('0x1a')&&typeof _0x6e10ac[_0x7352('0x1b')]==='undefined';var _0x11f8ff=_0x1ce0fc[_0x7352('0x1c')];var _0x19af33=_0xcc41fa?0x0:_0x6e10ac[_0x7352('0x19')];var _0x9c0e2a=_0xcc41fa?_0x1ce0fc[_0x7352('0x1c')]:_0x6e10ac[_0x7352('0x19')]+_0x6e10ac['limit'];var _0x16aa82;if(_0x9c0e2a>=_0x11f8ff){_0x9c0e2a=_0x11f8ff;_0x16aa82=0xc8;}else{_0x16aa82=0xce;}_0xe11c8a['status'](_0x16aa82);return _0xe11c8a['set'](_0x7352('0x1d'),_0x19af33+'-'+_0x9c0e2a+'/'+_0x11f8ff)[_0x7352('0x18')](_0x1ce0fc);}return null;};}function patchUpdates(_0x436c91){return function(_0x1c9cc1){try{jsonpatch['apply'](_0x1c9cc1,_0x436c91,!![]);}catch(_0x185a2b){return BPromise[_0x7352('0x1e')](_0x185a2b);}return _0x1c9cc1[_0x7352('0x1f')]();};}function saveUpdates(_0x2b6b42,_0x1c7706){return function(_0x3002a5){if(_0x3002a5){return _0x3002a5[_0x7352('0x20')](_0x2b6b42)[_0x7352('0x21')](function(_0x5c19fc){return _0x5c19fc;});}return null;};}function removeEntity(_0x3b652d,_0x9f99d0){return function(_0x423700){if(_0x423700){return _0x423700[_0x7352('0x22')]()[_0x7352('0x21')](function(){_0x3b652d[_0x7352('0x16')](0xcc)[_0x7352('0x17')]();});}};}function handleEntityNotFound(_0x4ab9cc,_0x2924da){return function(_0x170a8b){if(!_0x170a8b){_0x4ab9cc[_0x7352('0x23')](0x194);}return _0x170a8b;};}function handleError(_0x342dc8,_0x4c1434){_0x4c1434=_0x4c1434||0x1f4;return function(_0x202b79){logger[_0x7352('0x24')](_0x202b79[_0x7352('0x25')]);if(_0x202b79[_0x7352('0x26')]){delete _0x202b79[_0x7352('0x26')];}_0x342dc8['status'](_0x4c1434)[_0x7352('0x27')](_0x202b79);};}exports['index']=function(_0x171971,_0x1495d1){var _0x43acf4={},_0x1fc19c={},_0x1cae28={'count':0x0,'rows':[]};var _0x5d58d7=_[_0x7352('0x28')](db[_0x7352('0x29')]['rawAttributes'],function(_0x256c60){return{'name':_0x256c60[_0x7352('0x2a')],'type':_0x256c60[_0x7352('0x2b')]['key']};});_0x1fc19c[_0x7352('0x2c')]=_[_0x7352('0x28')](_0x5d58d7,_0x7352('0x26'));_0x1fc19c[_0x7352('0x2d')]=_[_0x7352('0x2e')](_0x171971['query']);_0x1fc19c[_0x7352('0x2f')]=_[_0x7352('0x30')](_0x1fc19c[_0x7352('0x2c')],_0x1fc19c[_0x7352('0x2d')]);_0x43acf4['attributes']=_[_0x7352('0x30')](_0x1fc19c[_0x7352('0x2c')],qs[_0x7352('0x31')](_0x171971['query'][_0x7352('0x31')]));_0x43acf4['attributes']=_0x43acf4[_0x7352('0x32')][_0x7352('0x33')]?_0x43acf4[_0x7352('0x32')]:_0x1fc19c[_0x7352('0x2c')];if(!_0x171971[_0x7352('0x2d')][_0x7352('0x34')](_0x7352('0x35'))){_0x43acf4[_0x7352('0x1b')]=qs[_0x7352('0x1b')](_0x171971[_0x7352('0x2d')][_0x7352('0x1b')]);_0x43acf4['offset']=qs[_0x7352('0x19')](_0x171971['query']['offset']);}_0x43acf4[_0x7352('0x36')]=qs['sort'](_0x171971[_0x7352('0x2d')][_0x7352('0x37')]);_0x43acf4['where']=qs[_0x7352('0x2f')](_[_0x7352('0x38')](_0x171971[_0x7352('0x2d')],_0x1fc19c['filters']),_0x5d58d7);if(_0x171971[_0x7352('0x2d')][_0x7352('0x39')]){_0x43acf4[_0x7352('0x3a')]=_[_0x7352('0x3b')](_0x43acf4['where'],{'$or':_[_0x7352('0x28')](_0x5d58d7,function(_0x35a80d){if(_0x35a80d[_0x7352('0x2b')]!==_0x7352('0x3c')){var _0x1e3f98={};_0x1e3f98[_0x35a80d['name']]={'$like':'%'+_0x171971[_0x7352('0x2d')]['filter']+'%'};return _0x1e3f98;}})});}_0x43acf4=_[_0x7352('0x3b')]({},_0x43acf4,_0x171971[_0x7352('0x3d')]);var _0x5f0f36={'where':_0x43acf4[_0x7352('0x3a')]};return db[_0x7352('0x29')][_0x7352('0x1c')](_0x5f0f36)[_0x7352('0x21')](function(_0x353e75){_0x1cae28['count']=_0x353e75;if(_0x171971[_0x7352('0x2d')][_0x7352('0x3e')]){_0x43acf4[_0x7352('0x3f')]=[{'all':!![]}];}return db[_0x7352('0x29')][_0x7352('0x40')](_0x43acf4);})[_0x7352('0x21')](function(_0x22930e){_0x1cae28[_0x7352('0x41')]=_0x22930e;return _0x1cae28;})[_0x7352('0x21')](respondWithFilteredResult(_0x1495d1,_0x43acf4))[_0x7352('0x42')](handleError(_0x1495d1,null));};exports[_0x7352('0x43')]=function(_0x59adc0,_0x3342a0){var _0xd2f4c3={'raw':![],'where':{'id':_0x59adc0[_0x7352('0x44')]['id']}},_0x58f6ec={};_0x58f6ec['model']=_[_0x7352('0x2e')](db[_0x7352('0x29')]['rawAttributes']);_0x58f6ec[_0x7352('0x2d')]=_['keys'](_0x59adc0[_0x7352('0x2d')]);_0x58f6ec[_0x7352('0x2f')]=_[_0x7352('0x30')](_0x58f6ec[_0x7352('0x2c')],_0x58f6ec[_0x7352('0x2d')]);_0xd2f4c3[_0x7352('0x32')]=_[_0x7352('0x30')](_0x58f6ec[_0x7352('0x2c')],qs['fields'](_0x59adc0[_0x7352('0x2d')][_0x7352('0x31')]));_0xd2f4c3[_0x7352('0x32')]=_0xd2f4c3[_0x7352('0x32')][_0x7352('0x33')]?_0xd2f4c3[_0x7352('0x32')]:_0x58f6ec[_0x7352('0x2c')];if(_0x59adc0[_0x7352('0x2d')][_0x7352('0x3e')]){_0xd2f4c3['include']=[{'all':!![]}];}_0xd2f4c3=_[_0x7352('0x3b')]({},_0xd2f4c3,_0x59adc0[_0x7352('0x3d')]);return db[_0x7352('0x29')][_0x7352('0x45')](_0xd2f4c3)[_0x7352('0x21')](handleEntityNotFound(_0x3342a0,null))[_0x7352('0x21')](respondWithResult(_0x3342a0,null))[_0x7352('0x42')](handleError(_0x3342a0,null));};exports[_0x7352('0x46')]=function(_0x1c765f,_0x246956){return db['ZohoAccount'][_0x7352('0x46')](_0x1c765f[_0x7352('0x47')],{})['then'](respondWithResult(_0x246956,0xc9))['catch'](handleError(_0x246956,null));};exports['update']=function(_0x4ae24e,_0x2e08e0){if(_0x4ae24e[_0x7352('0x47')]['id']){delete _0x4ae24e[_0x7352('0x47')]['id'];}return db['ZohoAccount'][_0x7352('0x45')]({'where':{'id':_0x4ae24e[_0x7352('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e08e0,null))[_0x7352('0x21')](saveUpdates(_0x4ae24e[_0x7352('0x47')],null))[_0x7352('0x21')](respondWithResult(_0x2e08e0,null))[_0x7352('0x42')](handleError(_0x2e08e0,null));};exports[_0x7352('0x22')]=function(_0x3d2b4c,_0x47a54a){return db['ZohoAccount'][_0x7352('0x45')]({'where':{'id':_0x3d2b4c['params']['id']}})['then'](handleEntityNotFound(_0x47a54a,null))[_0x7352('0x21')](removeEntity(_0x47a54a,null))[_0x7352('0x42')](handleError(_0x47a54a,null));};exports['getConfigurations']=function(_0x518105,_0xe61eb3,_0x5e1e6c){var _0x3aa892={};var _0x133a0c={};var _0x5447dd;var _0x449462;return db[_0x7352('0x29')][_0x7352('0x48')]({'where':{'id':_0x518105['params']['id']}})['then'](handleEntityNotFound(_0xe61eb3,null))[_0x7352('0x21')](function(_0x3c52fb){if(_0x3c52fb){_0x5447dd=_0x3c52fb;_0x133a0c['model']=_[_0x7352('0x2e')](db[_0x7352('0x49')]['rawAttributes']);_0x133a0c[_0x7352('0x2d')]=_['keys'](_0x518105[_0x7352('0x2d')]);_0x133a0c[_0x7352('0x2f')]=_['intersection'](_0x133a0c[_0x7352('0x2c')],_0x133a0c['query']);_0x3aa892[_0x7352('0x32')]=_['intersection'](_0x133a0c[_0x7352('0x2c')],qs['fields'](_0x518105[_0x7352('0x2d')][_0x7352('0x31')]));_0x3aa892['attributes']=_0x3aa892[_0x7352('0x32')]['length']?_0x3aa892[_0x7352('0x32')]:_0x133a0c[_0x7352('0x2c')];_0x3aa892['order']=qs[_0x7352('0x37')](_0x518105[_0x7352('0x2d')][_0x7352('0x37')]);_0x3aa892[_0x7352('0x3a')]=qs[_0x7352('0x2f')](_[_0x7352('0x38')](_0x518105[_0x7352('0x2d')],_0x133a0c[_0x7352('0x2f')]));if(_0x518105[_0x7352('0x2d')]['filter']){_0x3aa892[_0x7352('0x3a')]=_[_0x7352('0x3b')](_0x3aa892[_0x7352('0x3a')],{'$or':_[_0x7352('0x28')](_0x3aa892[_0x7352('0x32')],function(_0x2e2f9){var _0x2c9886={};_0x2c9886[_0x2e2f9]={'$like':'%'+_0x518105['query']['filter']+'%'};return _0x2c9886;})});}_0x3aa892=_[_0x7352('0x3b')]({},_0x3aa892,_0x518105['options']);return _0x5447dd[_0x7352('0x4a')](_0x3aa892);}})[_0x7352('0x21')](function(_0x519da1){if(_0x519da1){_0x449462=_0x519da1['length'];if(!_0x518105[_0x7352('0x2d')]['hasOwnProperty'](_0x7352('0x35'))){_0x3aa892[_0x7352('0x1b')]=qs[_0x7352('0x1b')](_0x518105[_0x7352('0x2d')][_0x7352('0x1b')]);_0x3aa892['offset']=qs['offset'](_0x518105[_0x7352('0x2d')][_0x7352('0x19')]);}return _0x5447dd[_0x7352('0x4a')](_0x3aa892);}})[_0x7352('0x21')](function(_0xc48189){if(_0xc48189){return _0xc48189?{'count':_0x449462,'rows':_0xc48189}:null;}})[_0x7352('0x21')](respondWithResult(_0xe61eb3,null))[_0x7352('0x42')](handleError(_0xe61eb3,null));};exports[_0x7352('0x4b')]=function(_0x433aa0,_0xd4fc8a,_0x3c155e){if(_0x433aa0[_0x7352('0x47')]['id']){delete _0x433aa0[_0x7352('0x47')]['id'];}return db[_0x7352('0x29')][_0x7352('0x48')]({'where':{'id':_0x433aa0['params']['id']}})[_0x7352('0x21')](handleEntityNotFound(_0xd4fc8a,null))['then'](function(_0x26339d){if(_0x26339d){_0x433aa0[_0x7352('0x47')][_0x7352('0x4c')]=_0x26339d['id'];_0x433aa0['body'][_0x7352('0x4d')]=integrations[_0x7352('0x4e')](_0x433aa0[_0x7352('0x47')]['channel'],_0x433aa0[_0x7352('0x47')][_0x7352('0x2b')]);_0x433aa0[_0x7352('0x47')][_0x7352('0x4f')]=integrations[_0x7352('0x50')](_0x433aa0[_0x7352('0x47')][_0x7352('0x51')],_0x433aa0['body'][_0x7352('0x2b')]);return db[_0x7352('0x49')][_0x7352('0x46')](_0x433aa0[_0x7352('0x47')],{'include':[{'model':db[_0x7352('0x52')],'as':_0x7352('0x4d')},{'model':db['ZohoField'],'as':_0x7352('0x4f')}]});}return null;})[_0x7352('0x21')](respondWithResult(_0xd4fc8a,null))[_0x7352('0x42')](handleError(_0xd4fc8a,null));};function getAccessToken(_0x41a00c){return new Promise(function(_0x249651,_0x4e00f5){var _0x30ff2e;switch(_0x41a00c['zone']){case'US':_0x30ff2e=_0x7352('0x53');break;case'AU':_0x30ff2e=_0x7352('0x54');break;case'EU':_0x30ff2e=_0x7352('0x55');break;case'IN':_0x30ff2e=_0x7352('0x56');break;case'CN':_0x30ff2e='https://accounts.zoho.com.cn';break;default:_0x30ff2e='https://accounts.zoho.eu';break;}var _0x265d09={'method':_0x7352('0x57'),'uri':_0x30ff2e+_0x7352('0x58'),'qs':{'refresh_token':_0x41a00c[_0x7352('0x59')],'client_id':_0x41a00c[_0x7352('0x5a')],'client_secret':_0x41a00c['clientSecret'],'grant_type':_0x7352('0x5b')},'json':!![]};return rp(_0x265d09)[_0x7352('0x21')](function(_0x2c46db){if(_0x2c46db[_0x7352('0x5c')]){_0x249651(_0x2c46db[_0x7352('0x5c')]);}else{_0x4e00f5('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x7352('0x42')](function(_0x39e858){_0x4e00f5(_0x39e858);});});}exports[_0x7352('0x5d')]=function(_0xcc54c9,_0xf0da05,_0x205c6b){var _0x4087de,_0x145c3b,_0x4c8c7e,_0x379806,_0x574b76;return db[_0x7352('0x29')][_0x7352('0x48')]({'where':{'id':_0xcc54c9[_0x7352('0x44')]['id']},'attributes':['id','host',_0x7352('0x5e'),'clientId',_0x7352('0x5f'),_0x7352('0x60'),_0x7352('0x61'),_0x7352('0x59')]})[_0x7352('0x21')](handleEntityNotFound(_0xf0da05,null))[_0x7352('0x21')](function(_0x437b60){_0x574b76=_0x437b60;_0x4087de=_0x574b76[_0x7352('0x62')];_0x145c3b=_0x4087de==='zoho.eu'?'eu':_0x7352('0x63');_0x4c8c7e=_0x574b76[_0x7352('0x60')];var _0x26d2b5=_0x4c8c7e['slice'](-0x1);if(_0x26d2b5==='/'||_0x26d2b5==='\x5c'||_0x26d2b5===':'){_0x4c8c7e=_0x4c8c7e['substring'](0x0,_0x4c8c7e[_0x7352('0x64')](_0x26d2b5));}if(!_0x574b76[_0x7352('0x59')]){throw new Error(_0x7352('0x65'));}return getAccessToken(_0x574b76);})[_0x7352('0x21')](function(_0x237201){if(_0x237201){return rp({'method':_0x7352('0x66'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x145c3b),'qs':{'module':_0x7352('0x67')},'headers':{'Authorization':_0x7352('0x68')+_0x237201},'json':!![]});}})[_0x7352('0x21')](function(_0x1562f3){if(_0x1562f3){if(_0x1562f3['response']&&_0x1562f3[_0x7352('0x69')]['error']){throw new Error(_0x1562f3['response'][_0x7352('0x24')]['message']);}var _0x5d32d2=[];var _0x586be6=[];var _0x5a033f=[_0x7352('0x6a'),_0x7352('0x6b'),_0x7352('0x6c'),_0x7352('0x6d'),_0x7352('0x6e'),_0x7352('0x6f'),_0x7352('0x70'),_0x7352('0x71')];_0x586be6=_[_0x7352('0x72')](_0x1562f3[_0x7352('0x31')],function(_0x44a7e3){return _0x5a033f[_0x7352('0x73')](_0x44a7e3[_0x7352('0x74')]);});for(var _0x7fffac=0x0;_0x7fffac<_0x586be6[_0x7352('0x33')];_0x7fffac++){if(_0x586be6[_0x7fffac][_0x7352('0x75')]===![]){_0x5d32d2['push']({'id':_0x586be6[_0x7fffac]['id'],'name':_0x586be6[_0x7fffac][_0x7352('0x76')],'custom':_0x586be6[_0x7fffac]['custom_field'],'options':_0x586be6[_0x7fffac]['data_type']===_0x7352('0x77')&&_0x586be6[_0x7fffac][_0x7352('0x78')]['length']>-0x1?_[_0x7352('0x28')](_0x586be6[_0x7fffac][_0x7352('0x78')],function(_0x4ed1fa){return{'name':_0x4ed1fa,'value':_0x4ed1fa};}):[]});}}return{'count':_0x5d32d2[_0x7352('0x33')],'rows':_0x5d32d2};}else{return{'count':0x0,'rows':[]};}})[_0x7352('0x21')](respondWithResult(_0xf0da05,null))['catch'](function(_0x57ed88){var _0x526497=_0xcc54c9[_0x7352('0x2d')][_0x7352('0x79')]?0x1f4:_0x57ed88[_0x7352('0x7a')]||0x1f4;logger['error'](_0x7352('0x7b'),_0x7352('0x5d'),_0x526497,JSON['stringify'](_0x57ed88));delete _0x57ed88[_0x7352('0x26')];if(_0x526497===0x191){_0x526497=0x190;}_0xf0da05[_0x7352('0x16')](_0x526497)['send'](_0xcc54c9[_0x7352('0x2d')]['test']?{'message':_0x7352('0x7c'),'statusCode':_0x57ed88['statusCode']}:_0x57ed88);});}; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c5fb4de..e830f6a 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 _0x985c=['format','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','host','substring','lastIndexOf','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','then','refreshToken','catch','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','code','serverUrl','slice','zone','https://accounts.zoho.com.cn','authorization_code','clientSecret','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0xf18cdd,_0xfed9ab){var _0x5149f2=function(_0x743dba){while(--_0x743dba){_0xf18cdd['push'](_0xf18cdd['shift']());}};_0x5149f2(++_0xfed9ab);}(_0x985c,0x15e));var _0xc985=function(_0x2a8a44,_0x4f3bbb){_0x2a8a44=_0x2a8a44-0x0;var _0x266731=_0x985c[_0x2a8a44];return _0x266731;};'use strict';var _=require(_0xc985('0x0'));var util=require('util');var logger=require(_0xc985('0x1'))(_0xc985('0x2'));var moment=require(_0xc985('0x3'));var BPromise=require(_0xc985('0x4'));var rp=require(_0xc985('0x5'));var fs=require('fs');var path=require(_0xc985('0x6'));var rimraf=require(_0xc985('0x7'));var config=require(_0xc985('0x8'));var attributes=require(_0xc985('0x9'));var integrations=require(_0xc985('0xa'));module[_0xc985('0xb')]=function(_0x3959d4,_0x7abaa7){return _0x3959d4[_0xc985('0xc')](_0xc985('0xd'),attributes,{'tableName':_0xc985('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1bce42,_0x11996f,_0x3de7a6){if(_0x1bce42[_0xc985('0xf')]('zone')||_0x1bce42['changed']('serverUrl')||_0x1bce42[_0xc985('0xf')](_0xc985('0x10'))||_0x1bce42[_0xc985('0xf')]('clientSecret')||_0x1bce42['changed'](_0xc985('0x11'))||_0x1bce42[_0xc985('0xf')]('host')){var _0x532666,_0x432a6f;_0x532666=_0x1bce42[_0xc985('0x12')];var _0x5de93b=_0x532666[_0xc985('0x13')](-0x1);if(_0x5de93b==='/'||_0x5de93b==='\x5c'||_0x5de93b===':'){_0x532666=_0x532666['substring'](0x0,_0x532666['lastIndexOf'](_0x5de93b));}switch(_0x1bce42[_0xc985('0x14')]){case'US':_0x432a6f='https://accounts.zoho.com';break;case'AU':_0x432a6f='https://accounts.zoho.com.au';break;case'IN':_0x432a6f='https://accounts.zoho.in';break;case'CN':_0x432a6f=_0xc985('0x15');break;default:_0x432a6f='https://accounts.zoho.eu';break;}var _0x16716e={'method':'POST','uri':_0x432a6f+'/oauth/v2/token','form':{'grant_type':_0xc985('0x16'),'client_id':_0x1bce42['clientId'],'client_secret':_0x1bce42[_0xc985('0x17')],'redirect_uri':_0x1bce42['serverUrl'],'code':_0x1bce42[_0xc985('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x16716e)['then'](function(_0x38eb75){var _0x13a284=JSON[_0xc985('0x18')](_0x38eb75);if(_0x13a284[_0xc985('0x19')]){_0x1bce42['refreshToken']=_0x13a284[_0xc985('0x19')];logger[_0xc985('0x1a')](util['format'](_0xc985('0x1b'),_0x1bce42['name'],_0x1bce42['id']));}else{logger['error'](util[_0xc985('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1bce42['name'],_0x1bce42['id']),util[_0xc985('0x1d')](_0x13a284,{'showHidden':![],'depth':null}));}return _0x3de7a6(null,_0x11996f);})['catch'](function(_0x54ede7){logger['error'](util[_0xc985('0x1c')](_0xc985('0x1e'),_0x1bce42[_0xc985('0x1f')],_0x1bce42['id']),util[_0xc985('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x3de7a6(_0x54ede7);});}else{return _0x3de7a6(null,_0x11996f);}},'beforeUpdate':function(_0x7dfd28,_0x1e3e55,_0x5906c3){if(_0x7dfd28[_0xc985('0xf')](_0xc985('0x14'))||_0x7dfd28[_0xc985('0xf')](_0xc985('0x12'))||_0x7dfd28['changed'](_0xc985('0x10'))||_0x7dfd28[_0xc985('0xf')]('clientSecret')||_0x7dfd28[_0xc985('0xf')](_0xc985('0x11'))||_0x7dfd28[_0xc985('0xf')](_0xc985('0x20'))){var _0x4132f9,_0x19fb12;_0x4132f9=_0x7dfd28[_0xc985('0x12')];var _0x375076=_0x4132f9[_0xc985('0x13')](-0x1);if(_0x375076==='/'||_0x375076==='\x5c'||_0x375076===':'){_0x4132f9=_0x4132f9[_0xc985('0x21')](0x0,_0x4132f9[_0xc985('0x22')](_0x375076));}switch(_0x7dfd28[_0xc985('0x14')]){case'US':_0x19fb12='https://accounts.zoho.com';break;case'AU':_0x19fb12='https://accounts.zoho.com.au';break;case'IN':_0x19fb12=_0xc985('0x23');break;case'CN':_0x19fb12='https://accounts.zoho.com.cn';break;default:_0x19fb12=_0xc985('0x24');break;}var _0x3c4716={'method':_0xc985('0x25'),'uri':_0x19fb12+_0xc985('0x26'),'form':{'grant_type':'authorization_code','client_id':_0x7dfd28['clientId'],'client_secret':_0x7dfd28['clientSecret'],'redirect_uri':_0x7dfd28[_0xc985('0x12')],'code':_0x7dfd28[_0xc985('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3c4716)[_0xc985('0x27')](function(_0x442874){var _0x4eadbd=JSON[_0xc985('0x18')](_0x442874);if(_0x4eadbd[_0xc985('0x19')]){_0x7dfd28[_0xc985('0x28')]=_0x4eadbd['refresh_token'];logger[_0xc985('0x1a')](util[_0xc985('0x1c')](_0xc985('0x1b'),_0x7dfd28[_0xc985('0x1f')],_0x7dfd28['id']));}else{logger['error'](util['format'](_0xc985('0x1e'),_0x7dfd28[_0xc985('0x1f')],_0x7dfd28['id']),util[_0xc985('0x1d')](_0x4eadbd,{'showHidden':![],'depth':null}));}return _0x5906c3(null,_0x1e3e55);})[_0xc985('0x29')](function(_0x127cb8){logger['error'](util[_0xc985('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7dfd28[_0xc985('0x1f')],_0x7dfd28['id']),util[_0xc985('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x5906c3(_0x127cb8);});}else{return _0x5906c3(null,_0x1e3e55);}}}});}; \ No newline at end of file +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 diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 31bf401..2db20b9 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 _0x4bd3=['where','attributes','limit','include','model','map','stringify','find','ShowZohoAccount','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x4bd3,0x174));var _0x34bd=function(_0x1e3362,_0x15f3d0){_0x1e3362=_0x1e3362-0x0;var _0x568fdd=_0x4bd3[_0x1e3362];return _0x568fdd;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});}exports[_0x34bd('0x13')]=function(_0x3b4bf8){var _0x72b197=this;return new Promise(function(_0x4b5ebb,_0x48d2ba){return db[_0x34bd('0x14')][_0x34bd('0x15')]({'raw':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options'][_0x34bd('0x19')]||null:null,'limit':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8[_0x34bd('0x16')][_0x34bd('0x1a')]||null:null,'include':_0x3b4bf8[_0x34bd('0x16')]?_0x3b4bf8['options']['include']?_['map'](_0x3b4bf8['options'][_0x34bd('0x1b')],function(_0x503a60){return{'model':db[_0x503a60[_0x34bd('0x1c')]],'as':_0x503a60['as'],'attributes':_0x503a60[_0x34bd('0x19')],'include':_0x503a60[_0x34bd('0x1b')]?_['map'](_0x503a60[_0x34bd('0x1b')],function(_0x14479a){return{'model':db[_0x14479a[_0x34bd('0x1c')]],'as':_0x14479a['as'],'attributes':_0x14479a[_0x34bd('0x19')],'include':_0x14479a['include']?_[_0x34bd('0x1d')](_0x14479a[_0x34bd('0x1b')],function(_0x264c94){return{'model':db[_0x264c94[_0x34bd('0x1c')]],'as':_0x264c94['as'],'attributes':_0x264c94['attributes']};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x3fe8b0){logger['info'](_0x34bd('0x13'),_0x3b4bf8);logger[_0x34bd('0xc')](_0x34bd('0x13'),_0x3b4bf8,JSON[_0x34bd('0x1e')](_0x3fe8b0));_0x4b5ebb(_0x3fe8b0);})[_0x34bd('0x12')](function(_0x4500c8){logger[_0x34bd('0xe')]('GetZohoAccount',_0x4500c8[_0x34bd('0x10')],_0x3b4bf8);_0x48d2ba(_0x72b197[_0x34bd('0xe')](0x1f4,_0x4500c8['message']));});});};exports['ShowZohoAccount']=function(_0x38bdba){var _0xca9897=this;return new Promise(function(_0xd176f7,_0x536b2c){return db['ZohoAccount'][_0x34bd('0x1f')]({'raw':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x17')]===undefined?!![]:![]:!![],'where':_0x38bdba['options']?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x18')]||null:null,'attributes':_0x38bdba[_0x34bd('0x16')]?_0x38bdba[_0x34bd('0x16')][_0x34bd('0x19')]||null:null,'include':_0x38bdba[_0x34bd('0x16')]?_0x38bdba['options'][_0x34bd('0x1b')]?_['map'](_0x38bdba[_0x34bd('0x16')][_0x34bd('0x1b')],function(_0xf12ee6){return{'model':db[_0xf12ee6['model']],'as':_0xf12ee6['as'],'attributes':_0xf12ee6[_0x34bd('0x19')],'include':_0xf12ee6[_0x34bd('0x1b')]?_['map'](_0xf12ee6[_0x34bd('0x1b')],function(_0x21c7d6){return{'model':db[_0x21c7d6[_0x34bd('0x1c')]],'as':_0x21c7d6['as'],'attributes':_0x21c7d6['attributes'],'include':_0x21c7d6[_0x34bd('0x1b')]?_[_0x34bd('0x1d')](_0x21c7d6['include'],function(_0x117188){return{'model':db[_0x117188[_0x34bd('0x1c')]],'as':_0x117188['as'],'attributes':_0x117188[_0x34bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x34bd('0x9')](function(_0x320643){logger[_0x34bd('0xa')]('ShowZohoAccount',_0x38bdba);logger['debug']('ShowZohoAccount',_0x38bdba,JSON[_0x34bd('0x1e')](_0x320643));_0xd176f7(_0x320643);})[_0x34bd('0x12')](function(_0x5e30c5){logger['error'](_0x34bd('0x20'),_0x5e30c5['message'],_0x38bdba);_0x536b2c(_0xca9897['error'](0x1f4,_0x5e30c5[_0x34bd('0x10')]));});});}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f0ce65f..a949186 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 _0x230a=['/:id/descriptions','getDescriptions','post','create','put','delete','multer','path','Router','fs-extra','get','isAuthenticated','/:id','show','getFields','/:id/subjects'];(function(_0x52b8c8,_0x5a31ea){var _0x42393c=function(_0x2b3b9f){while(--_0x2b3b9f){_0x52b8c8['push'](_0x52b8c8['shift']());}};_0x42393c(++_0x5a31ea);}(_0x230a,0x1a6));var _0xa230=function(_0x4fc23f,_0x2ca197){_0x4fc23f=_0x4fc23f-0x0;var _0x4409eb=_0x230a[_0x4fc23f];return _0x4409eb;};'use strict';var multer=require(_0xa230('0x0'));var util=require('util');var path=require(_0xa230('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa230('0x2')]();var fs_extra=require(_0xa230('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xa230('0x4')]('/',auth[_0xa230('0x5')](),controller['index']);router['get'](_0xa230('0x6'),auth[_0xa230('0x5')](),controller[_0xa230('0x7')]);router[_0xa230('0x4')]('/:id/fields',auth['isAuthenticated'](),controller[_0xa230('0x8')]);router[_0xa230('0x4')](_0xa230('0x9'),auth[_0xa230('0x5')](),controller['getSubjects']);router['get'](_0xa230('0xa'),auth[_0xa230('0x5')](),controller[_0xa230('0xb')]);router[_0xa230('0xc')]('/',auth[_0xa230('0x5')](),controller[_0xa230('0xd')]);router[_0xa230('0xe')]('/:id',auth[_0xa230('0x5')](),controller['update']);router[_0xa230('0xf')](_0xa230('0x6'),auth[_0xa230('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0c442a8..56ba72d 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 _0x0a2a=['STRING','ENUM','nothing','lead','contact_lead','contact','sequelize','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x0a2a,0x186));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa0a2('0x0'));module[_0xa0a2('0x1')]={'name':{'type':Sequelize[_0xa0a2('0x2')]},'moduleCreate':{'type':Sequelize[_0xa0a2('0x3')]('lead','contact',_0xa0a2('0x4')),'defaultValue':_0xa0a2('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0xa0a2('0x6'),_0xa0a2('0x7'),_0xa0a2('0x5')),'defaultValue':_0xa0a2('0x6')},'description':{'type':Sequelize[_0xa0a2('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4db427f..3c7ca85 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 _0x5a49=['body','ZohoField','getFields','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','ZohoConfiguration','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create'];(function(_0xcca4b0,_0x1dfb1a){var _0x50c333=function(_0x2ebfe3){while(--_0x2ebfe3){_0xcca4b0['push'](_0xcca4b0['shift']());}};_0x50c333(++_0x1dfb1a);}(_0x5a49,0xf3));var _0x95a4=function(_0x3a6ade,_0x7a8970){_0x3a6ade=_0x3a6ade-0x0;var _0x1e386d=_0x5a49[_0x3a6ade];return _0x1e386d;};'use strict';var emlformat=require(_0x95a4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95a4('0x1'));var jsonpatch=require(_0x95a4('0x2'));var rp=require(_0x95a4('0x3'));var moment=require(_0x95a4('0x4'));var BPromise=require(_0x95a4('0x5'));var Mustache=require(_0x95a4('0x6'));var util=require(_0x95a4('0x7'));var path=require(_0x95a4('0x8'));var sox=require(_0x95a4('0x9'));var csv=require(_0x95a4('0xa'));var ejs=require(_0x95a4('0xb'));var fs=require('fs');var fs_extra=require(_0x95a4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x95a4('0xa'));var querystring=require(_0x95a4('0xd'));var Papa=require('papaparse');var Redis=require(_0x95a4('0xe'));var authService=require(_0x95a4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x95a4('0x10'));var hardwareService=require(_0x95a4('0x11'));var logger=require('../../config/logger')(_0x95a4('0x12'));var utils=require(_0x95a4('0x13'));var config=require(_0x95a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x440a01,_0x2a5e37){_0x2a5e37=_0x2a5e37||0xcc;return function(_0x8d4f22){if(_0x8d4f22){return _0x440a01['sendStatus'](_0x2a5e37);}return _0x440a01[_0x95a4('0x15')](_0x2a5e37)[_0x95a4('0x16')]();};}function respondWithResult(_0xa4f110,_0x653385){_0x653385=_0x653385||0xc8;return function(_0x362852){if(_0x362852){return _0xa4f110[_0x95a4('0x15')](_0x653385)[_0x95a4('0x17')](_0x362852);}};}function respondWithFilteredResult(_0x251bcd,_0x53cae4){return function(_0x177220){if(_0x177220){var _0x10a647=typeof _0x53cae4[_0x95a4('0x18')]===_0x95a4('0x19')&&typeof _0x53cae4[_0x95a4('0x1a')]==='undefined';var _0x122b23=_0x177220[_0x95a4('0x1b')];var _0x295570=_0x10a647?0x0:_0x53cae4[_0x95a4('0x18')];var _0x446959=_0x10a647?_0x177220[_0x95a4('0x1b')]:_0x53cae4[_0x95a4('0x18')]+_0x53cae4[_0x95a4('0x1a')];var _0x425179;if(_0x446959>=_0x122b23){_0x446959=_0x122b23;_0x425179=0xc8;}else{_0x425179=0xce;}_0x251bcd[_0x95a4('0x15')](_0x425179);return _0x251bcd[_0x95a4('0x1c')](_0x95a4('0x1d'),_0x295570+'-'+_0x446959+'/'+_0x122b23)[_0x95a4('0x17')](_0x177220);}return null;};}function patchUpdates(_0x66a128){return function(_0x576632){try{jsonpatch[_0x95a4('0x1e')](_0x576632,_0x66a128,!![]);}catch(_0x4150e2){return BPromise[_0x95a4('0x1f')](_0x4150e2);}return _0x576632['save']();};}function saveUpdates(_0x40e7f4,_0x5a2eb9){return function(_0x30dfd5){if(_0x30dfd5){return _0x30dfd5[_0x95a4('0x20')](_0x40e7f4)['then'](function(_0x18f81d){return _0x18f81d;});}return null;};}function removeEntity(_0x2e042d,_0x478e87){return function(_0x3e433b){if(_0x3e433b){return _0x3e433b[_0x95a4('0x21')]()[_0x95a4('0x22')](function(){_0x2e042d[_0x95a4('0x15')](0xcc)[_0x95a4('0x16')]();});}};}function handleEntityNotFound(_0x513927,_0x3f01e3){return function(_0xc0045b){if(!_0xc0045b){_0x513927[_0x95a4('0x23')](0x194);}return _0xc0045b;};}function handleError(_0xa6d079,_0x223444){_0x223444=_0x223444||0x1f4;return function(_0x262b45){logger['error'](_0x262b45[_0x95a4('0x24')]);if(_0x262b45[_0x95a4('0x25')]){delete _0x262b45[_0x95a4('0x25')];}_0xa6d079[_0x95a4('0x15')](_0x223444)[_0x95a4('0x26')](_0x262b45);};}exports[_0x95a4('0x27')]=function(_0x444e3e,_0x203b98){var _0x3cdd02={},_0x3fe17c={},_0x44dfcd={'count':0x0,'rows':[]};var _0xdc0849=_[_0x95a4('0x28')](db[_0x95a4('0x29')]['rawAttributes'],function(_0x15f3d1){return{'name':_0x15f3d1[_0x95a4('0x2a')],'type':_0x15f3d1[_0x95a4('0x2b')][_0x95a4('0x2c')]};});_0x3fe17c[_0x95a4('0x2d')]=_[_0x95a4('0x28')](_0xdc0849,_0x95a4('0x25'));_0x3fe17c[_0x95a4('0x2e')]=_[_0x95a4('0x2f')](_0x444e3e[_0x95a4('0x2e')]);_0x3fe17c[_0x95a4('0x30')]=_[_0x95a4('0x31')](_0x3fe17c[_0x95a4('0x2d')],_0x3fe17c['query']);_0x3cdd02['attributes']=_['intersection'](_0x3fe17c[_0x95a4('0x2d')],qs[_0x95a4('0x32')](_0x444e3e[_0x95a4('0x2e')][_0x95a4('0x32')]));_0x3cdd02[_0x95a4('0x33')]=_0x3cdd02[_0x95a4('0x33')][_0x95a4('0x34')]?_0x3cdd02[_0x95a4('0x33')]:_0x3fe17c[_0x95a4('0x2d')];if(!_0x444e3e['query'][_0x95a4('0x35')](_0x95a4('0x36'))){_0x3cdd02[_0x95a4('0x1a')]=qs[_0x95a4('0x1a')](_0x444e3e['query'][_0x95a4('0x1a')]);_0x3cdd02[_0x95a4('0x18')]=qs[_0x95a4('0x18')](_0x444e3e[_0x95a4('0x2e')]['offset']);}_0x3cdd02[_0x95a4('0x37')]=qs[_0x95a4('0x38')](_0x444e3e[_0x95a4('0x2e')][_0x95a4('0x38')]);_0x3cdd02[_0x95a4('0x39')]=qs[_0x95a4('0x30')](_[_0x95a4('0x3a')](_0x444e3e['query'],_0x3fe17c['filters']),_0xdc0849);if(_0x444e3e[_0x95a4('0x2e')][_0x95a4('0x3b')]){_0x3cdd02[_0x95a4('0x39')]=_[_0x95a4('0x3c')](_0x3cdd02['where'],{'$or':_[_0x95a4('0x28')](_0xdc0849,function(_0x93db34){if(_0x93db34[_0x95a4('0x2b')]!==_0x95a4('0x3d')){var _0x56b6bf={};_0x56b6bf[_0x93db34[_0x95a4('0x25')]]={'$like':'%'+_0x444e3e[_0x95a4('0x2e')][_0x95a4('0x3b')]+'%'};return _0x56b6bf;}})});}_0x3cdd02=_[_0x95a4('0x3c')]({},_0x3cdd02,_0x444e3e[_0x95a4('0x3e')]);var _0x4ea9f6={'where':_0x3cdd02[_0x95a4('0x39')]};return db['ZohoConfiguration'][_0x95a4('0x1b')](_0x4ea9f6)[_0x95a4('0x22')](function(_0x144a3c){_0x44dfcd[_0x95a4('0x1b')]=_0x144a3c;if(_0x444e3e[_0x95a4('0x2e')]['includeAll']){_0x3cdd02[_0x95a4('0x3f')]=[{'all':!![]}];}return db[_0x95a4('0x29')][_0x95a4('0x40')](_0x3cdd02);})[_0x95a4('0x22')](function(_0x2b4a43){_0x44dfcd[_0x95a4('0x41')]=_0x2b4a43;return _0x44dfcd;})[_0x95a4('0x22')](respondWithFilteredResult(_0x203b98,_0x3cdd02))[_0x95a4('0x42')](handleError(_0x203b98,null));};exports[_0x95a4('0x43')]=function(_0x5afca0,_0x23e63c){var _0x55953a={'raw':![],'where':{'id':_0x5afca0[_0x95a4('0x44')]['id']}},_0x6221eb={};_0x6221eb['model']=_[_0x95a4('0x2f')](db[_0x95a4('0x29')][_0x95a4('0x45')]);_0x6221eb[_0x95a4('0x2e')]=_[_0x95a4('0x2f')](_0x5afca0[_0x95a4('0x2e')]);_0x6221eb['filters']=_[_0x95a4('0x31')](_0x6221eb[_0x95a4('0x2d')],_0x6221eb['query']);_0x55953a[_0x95a4('0x33')]=_[_0x95a4('0x31')](_0x6221eb[_0x95a4('0x2d')],qs['fields'](_0x5afca0[_0x95a4('0x2e')][_0x95a4('0x32')]));_0x55953a['attributes']=_0x55953a[_0x95a4('0x33')][_0x95a4('0x34')]?_0x55953a[_0x95a4('0x33')]:_0x6221eb[_0x95a4('0x2d')];if(_0x5afca0[_0x95a4('0x2e')][_0x95a4('0x46')]){_0x55953a[_0x95a4('0x3f')]=[{'all':!![]}];}_0x55953a=_[_0x95a4('0x3c')]({},_0x55953a,_0x5afca0[_0x95a4('0x3e')]);return db[_0x95a4('0x29')][_0x95a4('0x47')](_0x55953a)[_0x95a4('0x22')](handleEntityNotFound(_0x23e63c,null))[_0x95a4('0x22')](respondWithResult(_0x23e63c,null))[_0x95a4('0x42')](handleError(_0x23e63c,null));};exports[_0x95a4('0x48')]=function(_0x3c26e3,_0x246156){return db[_0x95a4('0x29')][_0x95a4('0x48')](_0x3c26e3[_0x95a4('0x49')],{})[_0x95a4('0x22')](respondWithResult(_0x246156,0xc9))[_0x95a4('0x42')](handleError(_0x246156,null));};exports['update']=function(_0x14ab3f,_0x1fc973){if(_0x14ab3f[_0x95a4('0x49')]['id']){delete _0x14ab3f[_0x95a4('0x49')]['id'];}return db['ZohoConfiguration'][_0x95a4('0x47')]({'where':{'id':_0x14ab3f[_0x95a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1fc973,null))[_0x95a4('0x22')](saveUpdates(_0x14ab3f[_0x95a4('0x49')],null))['then'](respondWithResult(_0x1fc973,null))[_0x95a4('0x42')](handleError(_0x1fc973,null));};exports['destroy']=function(_0x1aefb2,_0x4b9f86){return db[_0x95a4('0x29')][_0x95a4('0x47')]({'where':{'id':_0x1aefb2[_0x95a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b9f86,null))[_0x95a4('0x22')](removeEntity(_0x4b9f86,null))[_0x95a4('0x42')](handleError(_0x4b9f86,null));};exports['getFields']=function(_0x1b7509,_0xd4221b,_0x44c321){var _0x46842e={};var _0x85a0f5={};var _0x276ef0;var _0x1811c3;return db[_0x95a4('0x29')]['findOne']({'where':{'id':_0x1b7509[_0x95a4('0x44')]['id']}})['then'](handleEntityNotFound(_0xd4221b,null))[_0x95a4('0x22')](function(_0x52138c){if(_0x52138c){_0x276ef0=_0x52138c;_0x85a0f5['model']=_[_0x95a4('0x2f')](db[_0x95a4('0x4a')][_0x95a4('0x45')]);_0x85a0f5[_0x95a4('0x2e')]=_[_0x95a4('0x2f')](_0x1b7509[_0x95a4('0x2e')]);_0x85a0f5['filters']=_[_0x95a4('0x31')](_0x85a0f5['model'],_0x85a0f5['query']);_0x46842e[_0x95a4('0x33')]=_[_0x95a4('0x31')](_0x85a0f5[_0x95a4('0x2d')],qs['fields'](_0x1b7509['query'][_0x95a4('0x32')]));_0x46842e['attributes']=_0x46842e[_0x95a4('0x33')][_0x95a4('0x34')]?_0x46842e['attributes']:_0x85a0f5[_0x95a4('0x2d')];_0x46842e[_0x95a4('0x37')]=qs[_0x95a4('0x38')](_0x1b7509[_0x95a4('0x2e')][_0x95a4('0x38')]);_0x46842e[_0x95a4('0x39')]=qs[_0x95a4('0x30')](_[_0x95a4('0x3a')](_0x1b7509[_0x95a4('0x2e')],_0x85a0f5[_0x95a4('0x30')]));if(_0x1b7509[_0x95a4('0x2e')][_0x95a4('0x3b')]){_0x46842e[_0x95a4('0x39')]=_[_0x95a4('0x3c')](_0x46842e[_0x95a4('0x39')],{'$or':_[_0x95a4('0x28')](_0x46842e[_0x95a4('0x33')],function(_0x589208){var _0xa8adbd={};_0xa8adbd[_0x589208]={'$like':'%'+_0x1b7509[_0x95a4('0x2e')]['filter']+'%'};return _0xa8adbd;})});}_0x46842e=_[_0x95a4('0x3c')]({},_0x46842e,_0x1b7509[_0x95a4('0x3e')]);return _0x276ef0['getFields'](_0x46842e);}})[_0x95a4('0x22')](function(_0x28a35d){if(_0x28a35d){_0x1811c3=_0x28a35d[_0x95a4('0x34')];if(!_0x1b7509[_0x95a4('0x2e')][_0x95a4('0x35')](_0x95a4('0x36'))){_0x46842e[_0x95a4('0x1a')]=qs[_0x95a4('0x1a')](_0x1b7509[_0x95a4('0x2e')]['limit']);_0x46842e[_0x95a4('0x18')]=qs[_0x95a4('0x18')](_0x1b7509['query'][_0x95a4('0x18')]);}return _0x276ef0[_0x95a4('0x4b')](_0x46842e);}})[_0x95a4('0x22')](function(_0x5c23db){if(_0x5c23db){return _0x5c23db?{'count':_0x1811c3,'rows':_0x5c23db}:null;}})[_0x95a4('0x22')](respondWithResult(_0xd4221b,null))[_0x95a4('0x42')](handleError(_0xd4221b,null));};exports[_0x95a4('0x4c')]=function(_0x3c75fb,_0x4a4c1b,_0x22e943){var _0x33e739={};var _0x5ec894={};var _0x4a4b84;var _0x30df1d;return db[_0x95a4('0x29')]['findOne']({'where':{'id':_0x3c75fb[_0x95a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a4c1b,null))[_0x95a4('0x22')](function(_0x53eb2d){if(_0x53eb2d){_0x4a4b84=_0x53eb2d;_0x5ec894[_0x95a4('0x2d')]=_['keys'](db[_0x95a4('0x4a')]['rawAttributes']);_0x5ec894['query']=_[_0x95a4('0x2f')](_0x3c75fb['query']);_0x5ec894[_0x95a4('0x30')]=_[_0x95a4('0x31')](_0x5ec894['model'],_0x5ec894[_0x95a4('0x2e')]);_0x33e739[_0x95a4('0x33')]=_[_0x95a4('0x31')](_0x5ec894[_0x95a4('0x2d')],qs[_0x95a4('0x32')](_0x3c75fb[_0x95a4('0x2e')][_0x95a4('0x32')]));_0x33e739[_0x95a4('0x33')]=_0x33e739['attributes'][_0x95a4('0x34')]?_0x33e739[_0x95a4('0x33')]:_0x5ec894[_0x95a4('0x2d')];_0x33e739[_0x95a4('0x37')]=qs[_0x95a4('0x38')](_0x3c75fb[_0x95a4('0x2e')][_0x95a4('0x38')]);_0x33e739[_0x95a4('0x39')]=qs[_0x95a4('0x30')](_[_0x95a4('0x3a')](_0x3c75fb['query'],_0x5ec894[_0x95a4('0x30')]));if(_0x3c75fb[_0x95a4('0x2e')][_0x95a4('0x3b')]){_0x33e739[_0x95a4('0x39')]=_[_0x95a4('0x3c')](_0x33e739['where'],{'$or':_['map'](_0x33e739[_0x95a4('0x33')],function(_0x403bdf){var _0x6a25c5={};_0x6a25c5[_0x403bdf]={'$like':'%'+_0x3c75fb['query'][_0x95a4('0x3b')]+'%'};return _0x6a25c5;})});}_0x33e739=_[_0x95a4('0x3c')]({},_0x33e739,_0x3c75fb[_0x95a4('0x3e')]);return _0x4a4b84[_0x95a4('0x4c')](_0x33e739);}})['then'](function(_0x369ae0){if(_0x369ae0){_0x30df1d=_0x369ae0[_0x95a4('0x34')];if(!_0x3c75fb[_0x95a4('0x2e')][_0x95a4('0x35')](_0x95a4('0x36'))){_0x33e739['limit']=qs[_0x95a4('0x1a')](_0x3c75fb[_0x95a4('0x2e')]['limit']);_0x33e739[_0x95a4('0x18')]=qs[_0x95a4('0x18')](_0x3c75fb['query'][_0x95a4('0x18')]);}return _0x4a4b84[_0x95a4('0x4c')](_0x33e739);}})[_0x95a4('0x22')](function(_0x497abb){if(_0x497abb){return _0x497abb?{'count':_0x30df1d,'rows':_0x497abb}:null;}})[_0x95a4('0x22')](respondWithResult(_0x4a4c1b,null))[_0x95a4('0x42')](handleError(_0x4a4c1b,null));};exports[_0x95a4('0x4d')]=function(_0x2962c7,_0x5de004,_0x59a1c6){var _0x4813ba={};var _0x3629e6={};var _0x4fa666;var _0x463627;return db[_0x95a4('0x29')][_0x95a4('0x4e')]({'where':{'id':_0x2962c7[_0x95a4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de004,null))[_0x95a4('0x22')](function(_0x23356c){if(_0x23356c){_0x4fa666=_0x23356c;_0x3629e6[_0x95a4('0x2d')]=_[_0x95a4('0x2f')](db['ZohoField'][_0x95a4('0x45')]);_0x3629e6[_0x95a4('0x2e')]=_['keys'](_0x2962c7['query']);_0x3629e6[_0x95a4('0x30')]=_[_0x95a4('0x31')](_0x3629e6['model'],_0x3629e6[_0x95a4('0x2e')]);_0x4813ba[_0x95a4('0x33')]=_['intersection'](_0x3629e6[_0x95a4('0x2d')],qs['fields'](_0x2962c7[_0x95a4('0x2e')][_0x95a4('0x32')]));_0x4813ba[_0x95a4('0x33')]=_0x4813ba[_0x95a4('0x33')][_0x95a4('0x34')]?_0x4813ba['attributes']:_0x3629e6[_0x95a4('0x2d')];_0x4813ba[_0x95a4('0x37')]=qs[_0x95a4('0x38')](_0x2962c7[_0x95a4('0x2e')][_0x95a4('0x38')]);_0x4813ba[_0x95a4('0x39')]=qs[_0x95a4('0x30')](_['pick'](_0x2962c7[_0x95a4('0x2e')],_0x3629e6[_0x95a4('0x30')]));if(_0x2962c7[_0x95a4('0x2e')][_0x95a4('0x3b')]){_0x4813ba[_0x95a4('0x39')]=_[_0x95a4('0x3c')](_0x4813ba[_0x95a4('0x39')],{'$or':_[_0x95a4('0x28')](_0x4813ba[_0x95a4('0x33')],function(_0xab7a03){var _0x5e14a4={};_0x5e14a4[_0xab7a03]={'$like':'%'+_0x2962c7[_0x95a4('0x2e')][_0x95a4('0x3b')]+'%'};return _0x5e14a4;})});}_0x4813ba=_['merge']({},_0x4813ba,_0x2962c7[_0x95a4('0x3e')]);return _0x4fa666[_0x95a4('0x4d')](_0x4813ba);}})[_0x95a4('0x22')](function(_0x44f79a){if(_0x44f79a){_0x463627=_0x44f79a['length'];if(!_0x2962c7['query'][_0x95a4('0x35')](_0x95a4('0x36'))){_0x4813ba[_0x95a4('0x1a')]=qs['limit'](_0x2962c7[_0x95a4('0x2e')]['limit']);_0x4813ba[_0x95a4('0x18')]=qs['offset'](_0x2962c7['query']['offset']);}return _0x4fa666[_0x95a4('0x4d')](_0x4813ba);}})[_0x95a4('0x22')](function(_0x1ebbb7){if(_0x1ebbb7){return _0x1ebbb7?{'count':_0x463627,'rows':_0x1ebbb7}:null;}})['then'](respondWithResult(_0x5de004,null))[_0x95a4('0x42')](handleError(_0x5de004,null));}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5994754..3025105 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 _0x1feb=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','../../config/logger'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1feb,0x66));var _0xb1fe=function(_0x7d9614,_0x395397){_0x7d9614=_0x7d9614-0x0;var _0x3ba5c2=_0x1feb[_0x7d9614];return _0x3ba5c2;};'use strict';var _=require(_0xb1fe('0x0'));var util=require('util');var logger=require(_0xb1fe('0x1'))(_0xb1fe('0x2'));var moment=require(_0xb1fe('0x3'));var BPromise=require(_0xb1fe('0x4'));var rp=require(_0xb1fe('0x5'));var fs=require('fs');var path=require(_0xb1fe('0x6'));var rimraf=require(_0xb1fe('0x7'));var config=require(_0xb1fe('0x8'));var attributes=require(_0xb1fe('0x9'));module[_0xb1fe('0xa')]=function(_0x100685,_0x4a0cd9){return _0x100685[_0xb1fe('0xb')]('ZohoConfiguration',attributes,{'tableName':_0xb1fe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 7ed59f3..3056be1 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 _0x3ef8=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3ef8,0x196));var _0x83ef=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3ef8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x83ef('0x0'));var util=require(_0x83ef('0x1'));var moment=require('moment');var BPromise=require(_0x83ef('0x2'));var rs=require(_0x83ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83ef('0x4'))['db'];var utils=require(_0x83ef('0x5'));var logger=require(_0x83ef('0x6'))(_0x83ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x83ef('0x8'));var client=jayson[_0x83ef('0x9')][_0x83ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x190459,_0xd97e0e,_0x4f852f){return new BPromise(function(_0x3d0130,_0x2d66dc){return client['request'](_0x190459,_0x4f852f)[_0x83ef('0xb')](function(_0x4ff9bf){logger[_0x83ef('0xc')](_0x83ef('0xd'),_0xd97e0e,_0x83ef('0xe'));logger[_0x83ef('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xd97e0e,_0x83ef('0xe'),JSON['stringify'](_0x4ff9bf));if(_0x4ff9bf[_0x83ef('0x10')]){if(_0x4ff9bf['error']['code']===0x1f4){logger[_0x83ef('0x10')](_0x83ef('0xd'),_0xd97e0e,_0x4ff9bf[_0x83ef('0x10')]['message']);return _0x2d66dc(_0x4ff9bf[_0x83ef('0x10')]['message']);}logger[_0x83ef('0x10')](_0x83ef('0xd'),_0xd97e0e,_0x4ff9bf[_0x83ef('0x10')][_0x83ef('0x11')]);return _0x3d0130(_0x4ff9bf[_0x83ef('0x10')][_0x83ef('0x11')]);}else{logger['info'](_0x83ef('0xd'),_0xd97e0e,_0x83ef('0xe'));_0x3d0130(_0x4ff9bf[_0x83ef('0x12')]['message']);}})['catch'](function(_0x3ed78d){logger[_0x83ef('0x10')](_0x83ef('0xd'),_0xd97e0e,_0x3ed78d);_0x2d66dc(_0x3ed78d);});});} \ No newline at end of file +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 diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 12f39ce..8bbc7cf 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 _0x141d=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','isAuthenticated','show','create','put','update','delete','/:id','destroy','multer'];(function(_0xf5a29e,_0x4fec1b){var _0x286259=function(_0x26b8b6){while(--_0x26b8b6){_0xf5a29e['push'](_0xf5a29e['shift']());}};_0x286259(++_0x4fec1b);}(_0x141d,0xd1));var _0xd141=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x141d[_0x32d457];return _0x338386;};'use strict';var multer=require(_0xd141('0x0'));var util=require(_0xd141('0x1'));var path=require(_0xd141('0x2'));var timeout=require(_0xd141('0x3'));var express=require(_0xd141('0x4'));var router=express[_0xd141('0x5')]();var fs_extra=require(_0xd141('0x6'));var auth=require(_0xd141('0x7'));var interaction=require(_0xd141('0x8'));var config=require(_0xd141('0x9'));var controller=require(_0xd141('0xa'));router[_0xd141('0xb')]('/',auth['isAuthenticated'](),controller[_0xd141('0xc')]);router[_0xd141('0xb')]('/:id',auth[_0xd141('0xd')](),controller[_0xd141('0xe')]);router['post']('/',auth[_0xd141('0xd')](),controller[_0xd141('0xf')]);router[_0xd141('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd141('0x11')]);router[_0xd141('0x12')](_0xd141('0x13'),auth['isAuthenticated'](),controller[_0xd141('0x14')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 4485170..8b5bbc2 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 _0xf35c=['customVariable','keyValue','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x4ec207,_0x247782){var _0xcf3cdf=function(_0x1b362c){while(--_0x1b362c){_0x4ec207['push'](_0x4ec207['shift']());}};_0xcf3cdf(++_0x247782);}(_0xf35c,0x94));var _0xcf35=function(_0x5759a2,_0x5144da){_0x5759a2=_0x5759a2-0x0;var _0x48abe2=_0xf35c[_0x5759a2];return _0x48abe2;};'use strict';var Sequelize=require(_0xcf35('0x0'));module['exports']={'type':{'type':Sequelize[_0xcf35('0x1')](_0xcf35('0x2'),_0xcf35('0x3'),_0xcf35('0x4'),_0xcf35('0x5'),_0xcf35('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcf35('0x7')]},'key':{'type':Sequelize[_0xcf35('0x7')]},'keyType':{'type':Sequelize[_0xcf35('0x1')]('string',_0xcf35('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xcf35('0x7')]},'idField':{'type':Sequelize[_0xcf35('0x7')]},'nameField':{'type':Sequelize[_0xcf35('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf35('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 8ae23ce..fb0a3a5 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 _0x8b13=['params','keys','includeAll','create','body','find','eml-format','rimraf','zip-dir','mustache','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','stack','name','send','index','ZohoField','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','include','findAll','rows','catch','show'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x8b13,0x1aa));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x38b1('0x0'));var rimraf=require(_0x38b1('0x1'));var zipdir=require(_0x38b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x38b1('0x3'));var util=require('util');var path=require(_0x38b1('0x4'));var sox=require(_0x38b1('0x5'));var csv=require('to-csv');var ejs=require(_0x38b1('0x6'));var fs=require('fs');var fs_extra=require(_0x38b1('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38b1('0x8'));var deskjs=require(_0x38b1('0x9'));var toCsv=require(_0x38b1('0xa'));var querystring=require(_0x38b1('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x38b1('0xc'));var qs=require(_0x38b1('0xd'));var as=require(_0x38b1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38b1('0xf'))(_0x38b1('0x10'));var utils=require(_0x38b1('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x38b1('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409400,_0x4ae708){_0x4ae708=_0x4ae708||0xcc;return function(_0x2e6d6d){if(_0x2e6d6d){return _0x409400[_0x38b1('0x13')](_0x4ae708);}return _0x409400[_0x38b1('0x14')](_0x4ae708)[_0x38b1('0x15')]();};}function respondWithResult(_0x23c6a6,_0x4016a6){_0x4016a6=_0x4016a6||0xc8;return function(_0x4f322f){if(_0x4f322f){return _0x23c6a6[_0x38b1('0x14')](_0x4016a6)['json'](_0x4f322f);}};}function respondWithFilteredResult(_0x5e46f3,_0x4dd879){return function(_0x19c8be){if(_0x19c8be){var _0x596b75=typeof _0x4dd879[_0x38b1('0x16')]===_0x38b1('0x17')&&typeof _0x4dd879[_0x38b1('0x18')]==='undefined';var _0x1c76c3=_0x19c8be['count'];var _0x26821c=_0x596b75?0x0:_0x4dd879[_0x38b1('0x16')];var _0x3fd365=_0x596b75?_0x19c8be[_0x38b1('0x19')]:_0x4dd879['offset']+_0x4dd879[_0x38b1('0x18')];var _0x3b1ae4;if(_0x3fd365>=_0x1c76c3){_0x3fd365=_0x1c76c3;_0x3b1ae4=0xc8;}else{_0x3b1ae4=0xce;}_0x5e46f3[_0x38b1('0x14')](_0x3b1ae4);return _0x5e46f3[_0x38b1('0x1a')]('Content-Range',_0x26821c+'-'+_0x3fd365+'/'+_0x1c76c3)[_0x38b1('0x1b')](_0x19c8be);}return null;};}function patchUpdates(_0x133639){return function(_0x35a608){try{jsonpatch[_0x38b1('0x1c')](_0x35a608,_0x133639,!![]);}catch(_0x5275a1){return BPromise[_0x38b1('0x1d')](_0x5275a1);}return _0x35a608[_0x38b1('0x1e')]();};}function saveUpdates(_0x373a7f,_0x18be78){return function(_0x2545df){if(_0x2545df){return _0x2545df[_0x38b1('0x1f')](_0x373a7f)[_0x38b1('0x20')](function(_0x45dd94){return _0x45dd94;});}return null;};}function removeEntity(_0x2c7ffb,_0xe0bfff){return function(_0x4c4672){if(_0x4c4672){return _0x4c4672['destroy']()['then'](function(){_0x2c7ffb['status'](0xcc)[_0x38b1('0x15')]();});}};}function handleEntityNotFound(_0x3483b3,_0x1ae194){return function(_0x2fbf2f){if(!_0x2fbf2f){_0x3483b3[_0x38b1('0x13')](0x194);}return _0x2fbf2f;};}function handleError(_0x710f5,_0x5c9b49){_0x5c9b49=_0x5c9b49||0x1f4;return function(_0x4afceb){logger['error'](_0x4afceb[_0x38b1('0x21')]);if(_0x4afceb[_0x38b1('0x22')]){delete _0x4afceb['name'];}_0x710f5['status'](_0x5c9b49)[_0x38b1('0x23')](_0x4afceb);};}exports[_0x38b1('0x24')]=function(_0x3bf05c,_0x2cb29b){var _0x59c270={},_0x521f45={},_0x2a7c2f={'count':0x0,'rows':[]};var _0x424ad4=_['map'](db[_0x38b1('0x25')][_0x38b1('0x26')],function(_0x4be43f){return{'name':_0x4be43f[_0x38b1('0x27')],'type':_0x4be43f['type']['key']};});_0x521f45[_0x38b1('0x28')]=_[_0x38b1('0x29')](_0x424ad4,_0x38b1('0x22'));_0x521f45[_0x38b1('0x2a')]=_['keys'](_0x3bf05c[_0x38b1('0x2a')]);_0x521f45[_0x38b1('0x2b')]=_[_0x38b1('0x2c')](_0x521f45[_0x38b1('0x28')],_0x521f45[_0x38b1('0x2a')]);_0x59c270[_0x38b1('0x2d')]=_[_0x38b1('0x2c')](_0x521f45[_0x38b1('0x28')],qs[_0x38b1('0x2e')](_0x3bf05c[_0x38b1('0x2a')][_0x38b1('0x2e')]));_0x59c270[_0x38b1('0x2d')]=_0x59c270['attributes'][_0x38b1('0x2f')]?_0x59c270[_0x38b1('0x2d')]:_0x521f45[_0x38b1('0x28')];if(!_0x3bf05c[_0x38b1('0x2a')][_0x38b1('0x30')](_0x38b1('0x31'))){_0x59c270[_0x38b1('0x18')]=qs[_0x38b1('0x18')](_0x3bf05c['query'][_0x38b1('0x18')]);_0x59c270['offset']=qs['offset'](_0x3bf05c[_0x38b1('0x2a')][_0x38b1('0x16')]);}_0x59c270[_0x38b1('0x32')]=qs[_0x38b1('0x33')](_0x3bf05c[_0x38b1('0x2a')][_0x38b1('0x33')]);_0x59c270['where']=qs['filters'](_[_0x38b1('0x34')](_0x3bf05c[_0x38b1('0x2a')],_0x521f45['filters']),_0x424ad4);if(_0x3bf05c['query'][_0x38b1('0x35')]){_0x59c270['where']=_[_0x38b1('0x36')](_0x59c270['where'],{'$or':_[_0x38b1('0x29')](_0x424ad4,function(_0x2bf699){if(_0x2bf699[_0x38b1('0x37')]!==_0x38b1('0x38')){var _0xfc1ed9={};_0xfc1ed9[_0x2bf699['name']]={'$like':'%'+_0x3bf05c[_0x38b1('0x2a')][_0x38b1('0x35')]+'%'};return _0xfc1ed9;}})});}_0x59c270=_['merge']({},_0x59c270,_0x3bf05c[_0x38b1('0x39')]);var _0x237513={'where':_0x59c270[_0x38b1('0x3a')]};return db['ZohoField'][_0x38b1('0x19')](_0x237513)['then'](function(_0x2eaaae){_0x2a7c2f[_0x38b1('0x19')]=_0x2eaaae;if(_0x3bf05c[_0x38b1('0x2a')]['includeAll']){_0x59c270[_0x38b1('0x3b')]=[{'all':!![]}];}return db[_0x38b1('0x25')][_0x38b1('0x3c')](_0x59c270);})['then'](function(_0x21407f){_0x2a7c2f[_0x38b1('0x3d')]=_0x21407f;return _0x2a7c2f;})[_0x38b1('0x20')](respondWithFilteredResult(_0x2cb29b,_0x59c270))[_0x38b1('0x3e')](handleError(_0x2cb29b,null));};exports[_0x38b1('0x3f')]=function(_0x189d85,_0x12bbed){var _0x266e6d={'raw':!![],'where':{'id':_0x189d85[_0x38b1('0x40')]['id']}},_0x2dce62={};_0x2dce62['model']=_[_0x38b1('0x41')](db[_0x38b1('0x25')]['rawAttributes']);_0x2dce62['query']=_['keys'](_0x189d85[_0x38b1('0x2a')]);_0x2dce62['filters']=_[_0x38b1('0x2c')](_0x2dce62[_0x38b1('0x28')],_0x2dce62[_0x38b1('0x2a')]);_0x266e6d['attributes']=_[_0x38b1('0x2c')](_0x2dce62[_0x38b1('0x28')],qs[_0x38b1('0x2e')](_0x189d85['query'][_0x38b1('0x2e')]));_0x266e6d['attributes']=_0x266e6d['attributes'][_0x38b1('0x2f')]?_0x266e6d[_0x38b1('0x2d')]:_0x2dce62[_0x38b1('0x28')];if(_0x189d85['query'][_0x38b1('0x42')]){_0x266e6d[_0x38b1('0x3b')]=[{'all':!![]}];}_0x266e6d=_[_0x38b1('0x36')]({},_0x266e6d,_0x189d85[_0x38b1('0x39')]);return db[_0x38b1('0x25')]['find'](_0x266e6d)[_0x38b1('0x20')](handleEntityNotFound(_0x12bbed,null))[_0x38b1('0x20')](respondWithResult(_0x12bbed,null))['catch'](handleError(_0x12bbed,null));};exports[_0x38b1('0x43')]=function(_0x1395e4,_0x5af092){return db[_0x38b1('0x25')]['create'](_0x1395e4[_0x38b1('0x44')],{})[_0x38b1('0x20')](respondWithResult(_0x5af092,0xc9))[_0x38b1('0x3e')](handleError(_0x5af092,null));};exports[_0x38b1('0x1f')]=function(_0x5d3e2b,_0x190a59){if(_0x5d3e2b[_0x38b1('0x44')]['id']){delete _0x5d3e2b['body']['id'];}return db[_0x38b1('0x25')]['find']({'where':{'id':_0x5d3e2b['params']['id']}})[_0x38b1('0x20')](handleEntityNotFound(_0x190a59,null))[_0x38b1('0x20')](saveUpdates(_0x5d3e2b['body'],null))[_0x38b1('0x20')](respondWithResult(_0x190a59,null))[_0x38b1('0x3e')](handleError(_0x190a59,null));};exports['destroy']=function(_0x34776e,_0x41109d){return db[_0x38b1('0x25')][_0x38b1('0x45')]({'where':{'id':_0x34776e[_0x38b1('0x40')]['id']}})['then'](handleEntityNotFound(_0x41109d,null))[_0x38b1('0x20')](removeEntity(_0x41109d,null))[_0x38b1('0x3e')](handleError(_0x41109d,null));}; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f9bcf1a..d0015cf 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 _0xfb11=['bluebird','path','../../config/environment','./intZohoField.attributes','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x5807ed,_0x1bf9db){var _0x24f550=function(_0x203969){while(--_0x203969){_0x5807ed['push'](_0x5807ed['shift']());}};_0x24f550(++_0x1bf9db);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xfb11[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[{'name':_0x1fb1('0x9'),'fields':[_0x1fb1('0xa'),_0x1fb1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9562174..4682706 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 _0xe0b8=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4e5f6a,_0x3344c0){var _0x2bde9f=function(_0x57c18c){while(--_0x57c18c){_0x4e5f6a['push'](_0x4e5f6a['shift']());}};_0x2bde9f(++_0x3344c0);}(_0xe0b8,0xc0));var _0x8e0b=function(_0x23bf29,_0xf7c112){_0x23bf29=_0x23bf29-0x0;var _0x37c7ee=_0xe0b8[_0x23bf29];return _0x37c7ee;};'use strict';var _=require(_0x8e0b('0x0'));var util=require('util');var moment=require(_0x8e0b('0x1'));var BPromise=require(_0x8e0b('0x2'));var rs=require(_0x8e0b('0x3'));var fs=require('fs');var Redis=require(_0x8e0b('0x4'));var db=require(_0x8e0b('0x5'))['db'];var utils=require(_0x8e0b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8e0b('0x7'));var jayson=require(_0x8e0b('0x8'));var client=jayson[_0x8e0b('0x9')][_0x8e0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26b98d,_0x598949,_0x180387){return new BPromise(function(_0x1b6493,_0x3768ba){return client[_0x8e0b('0xb')](_0x26b98d,_0x180387)[_0x8e0b('0xc')](function(_0x4d558d){logger[_0x8e0b('0xd')](_0x8e0b('0xe'),_0x598949,_0x8e0b('0xf'));logger[_0x8e0b('0x10')](_0x8e0b('0x11'),_0x598949,_0x8e0b('0xf'),JSON[_0x8e0b('0x12')](_0x4d558d));if(_0x4d558d[_0x8e0b('0x13')]){if(_0x4d558d['error'][_0x8e0b('0x14')]===0x1f4){logger[_0x8e0b('0x13')]('ZohoField,\x20%s,\x20%s',_0x598949,_0x4d558d[_0x8e0b('0x13')]['message']);return _0x3768ba(_0x4d558d[_0x8e0b('0x13')][_0x8e0b('0x15')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x598949,_0x4d558d[_0x8e0b('0x13')][_0x8e0b('0x15')]);return _0x1b6493(_0x4d558d[_0x8e0b('0x13')][_0x8e0b('0x15')]);}else{logger[_0x8e0b('0xd')]('ZohoField,\x20%s,\x20%s',_0x598949,_0x8e0b('0xf'));_0x1b6493(_0x4d558d[_0x8e0b('0x16')]['message']);}})[_0x8e0b('0x17')](function(_0x46f97b){logger[_0x8e0b('0x13')](_0x8e0b('0xe'),_0x598949,_0x46f97b);_0x3768ba(_0x46f97b);});});} \ No newline at end of file +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 diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fbb4678..85f4e6c 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x13cc80,_0x107905){var _0x4a29f6=function(_0x464e9c){while(--_0x464e9c){_0x13cc80['push'](_0x13cc80['shift']());}};_0x4a29f6(++_0x107905);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _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 diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 25cee97..a238047 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 _0xc2da=['app.js','INTEGER','BOOLEAN','state','sequelize','STRING'];(function(_0x287575,_0x5a914b){var _0x5ed114=function(_0x4ed2cc){while(--_0x4ed2cc){_0x287575['push'](_0x287575['shift']());}};_0x5ed114(++_0x5a914b);}(_0xc2da,0x124));var _0xac2d=function(_0x3ccc28,_0x5036d5){_0x3ccc28=_0x3ccc28-0x0;var _0x47dd45=_0xc2da[_0x3ccc28];return _0x47dd45;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'name':{'type':Sequelize[_0xac2d('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xac2d('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xac2d('0x1')],'defaultValue':_0xac2d('0x2')},'filename':{'type':Sequelize[_0xac2d('0x1')]},'path':{'type':Sequelize[_0xac2d('0x1')]},'type':{'type':Sequelize[_0xac2d('0x1')]},'size':{'type':Sequelize[_0xac2d('0x3')]},'active':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xac2d('0x1')]},'logo':{'type':Sequelize[_0xac2d('0x1')]},'state':{'type':Sequelize[_0xac2d('0x1')],'unique':_0xac2d('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xac2d('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +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 diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ea21ca9..40a9c7d 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 _0xafc4=['reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Integration','includeAll','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x2b6f60,_0x27e3a8){var _0x47430f=function(_0x98ef75){while(--_0x98ef75){_0x2b6f60['push'](_0x2b6f60['shift']());}};_0x47430f(++_0x27e3a8);}(_0xafc4,0x69));var _0x4afc=function(_0x13cf64,_0x596644){_0x13cf64=_0x13cf64-0x0;var _0x14c102=_0xafc4[_0x13cf64];return _0x14c102;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['Integration'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['Integration']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));}; \ No newline at end of file +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 diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4596fd9..c5d8305 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 _0xdd33=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdd33,0x140));var _0x3dd3=function(_0x129f1b,_0x3af66e){_0x129f1b=_0x129f1b-0x0;var _0x55c273=_0xdd33[_0x129f1b];return _0x55c273;};'use strict';var _=require(_0x3dd3('0x0'));var util=require(_0x3dd3('0x1'));var logger=require(_0x3dd3('0x2'))(_0x3dd3('0x3'));var moment=require(_0x3dd3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3dd3('0x5'));var config=require(_0x3dd3('0x6'));var attributes=require(_0x3dd3('0x7'));module[_0x3dd3('0x8')]=function(_0xa041ba,_0x33f671){return _0xa041ba[_0x3dd3('0x9')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a40657d..05fde38 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xe4d35a,_0x4bd94d){var _0x249363=function(_0x3da3fe){while(--_0x3da3fe){_0xe4d35a['push'](_0xe4d35a['shift']());}};_0x249363(++_0x4bd94d);}(_0x896e,0x1e9));var _0xe896=function(_0x2373cf,_0x210243){_0x2373cf=_0x2373cf-0x0;var _0x3cb6e1=_0x896e[_0x2373cf];return _0x3cb6e1;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4e406db..7921ab8 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x583e98,_0x5534f5){var _0x84cc30=function(_0x4201ed){while(--_0x4201ed){_0x583e98['push'](_0x583e98['shift']());}};_0x84cc30(++_0x5534f5);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2b12fa,_0x194880){_0x2b12fa=_0x2b12fa-0x0;var _0x1225df=_0x9f0e[_0x2b12fa];return _0x1225df;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 30a5a48..ea3abbd 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 _0x7473=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x54b45c,_0xbfb39b){var _0x101941=function(_0x54eea5){while(--_0x54eea5){_0x54b45c['push'](_0x54b45c['shift']());}};_0x101941(++_0xbfb39b);}(_0x7473,0x88));var _0x3747=function(_0x5097af,_0x360829){_0x5097af=_0x5097af-0x0;var _0x2d5a07=_0x7473[_0x5097af];return _0x2d5a07;};'use strict';var Sequelize=require(_0x3747('0x0'));module[_0x3747('0x1')]={'integration':{'type':Sequelize[_0x3747('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3747('0x2')]},'integrationId':{'type':Sequelize[_0x3747('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3747('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3747('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3747('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3747('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3747('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3747('0x4')]},'talktime':{'type':Sequelize[_0x3747('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x3747('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3747('0x4')]},'lastevent':{'type':Sequelize[_0x3747('0x2')]},'channel':{'type':Sequelize[_0x3747('0x2')]},'channelstate':{'type':Sequelize[_0x3747('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3747('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3747('0x2')]},'accountcode':{'type':Sequelize[_0x3747('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3747('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3747('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x3747('0x2')]},'destcalleridname':{'type':Sequelize[_0x3747('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3747('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3747('0x2')]},'destlanguage':{'type':Sequelize[_0x3747('0x2')]},'destaccountcode':{'type':Sequelize[_0x3747('0x2')]},'destcontext':{'type':Sequelize[_0x3747('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3747('0x2')]},'messageId':{'type':Sequelize[_0x3747('0x2')]},'inReplyTo':{'type':Sequelize[_0x3747('0x2')]},'subject':{'type':Sequelize[_0x3747('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3747('0x2')]},'attachment':{'type':Sequelize[_0x3747('0x6')]},'html':{'type':Sequelize[_0x3747('0x6')]},'text':{'type':Sequelize[_0x3747('0x6')]},'status':{'type':Sequelize[_0x3747('0x7')](_0x3747('0x8'),_0x3747('0x9'),_0x3747('0xa'),_0x3747('0xb'))},'url':{'type':Sequelize[_0x3747('0x2')]},'app':{'type':Sequelize[_0x3747('0x2')]},'appdata':{'type':Sequelize[_0x3747('0x2')]},'projectId':{'type':Sequelize[_0x3747('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c1f09ad..86cc00c 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 _0x1638=['util','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','IntegrationReport','find','create','update','body','describe','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x6e2fc5,_0x17e1e9){var _0x2366f1=function(_0x7b7d87){while(--_0x7b7d87){_0x6e2fc5['push'](_0x6e2fc5['shift']());}};_0x2366f1(++_0x17e1e9);}(_0x1638,0x8d));var _0x8163=function(_0x4a6cb7,_0x48a3d5){_0x4a6cb7=_0x4a6cb7-0x0;var _0x3cc689=_0x1638[_0x4a6cb7];return _0x3cc689;};'use strict';var emlformat=require(_0x8163('0x0'));var rimraf=require(_0x8163('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8163('0x2'));var moment=require(_0x8163('0x3'));var BPromise=require(_0x8163('0x4'));var Mustache=require('mustache');var util=require(_0x8163('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8163('0x6'));var fs=require('fs');var fs_extra=require(_0x8163('0x7'));var _=require(_0x8163('0x8'));var squel=require('squel');var crypto=require(_0x8163('0x9'));var jsforce=require(_0x8163('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8163('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8163('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8163('0xd'));var as=require(_0x8163('0xe'));var hardwareService=require(_0x8163('0xf'));var logger=require(_0x8163('0x10'))(_0x8163('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8163('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x191d4,_0x387445){_0x387445=_0x387445||0xcc;return function(_0x3e5f4a){if(_0x3e5f4a){return _0x191d4[_0x8163('0x13')](_0x387445);}return _0x191d4[_0x8163('0x14')](_0x387445)[_0x8163('0x15')]();};}function respondWithResult(_0x16820b,_0x127fe9){_0x127fe9=_0x127fe9||0xc8;return function(_0x3bb08d){if(_0x3bb08d){return _0x16820b[_0x8163('0x14')](_0x127fe9)[_0x8163('0x16')](_0x3bb08d);}};}function respondWithFilteredResult(_0x462f17,_0xa1714d){return function(_0x584ff5){if(_0x584ff5){var _0x265f7a=typeof _0xa1714d[_0x8163('0x17')]===_0x8163('0x18')&&typeof _0xa1714d[_0x8163('0x19')]===_0x8163('0x18');var _0x456c67=_0x584ff5[_0x8163('0x1a')];var _0x5b9959=_0x265f7a?0x0:_0xa1714d[_0x8163('0x17')];var _0x25d256=_0x265f7a?_0x584ff5['count']:_0xa1714d[_0x8163('0x17')]+_0xa1714d[_0x8163('0x19')];var _0x2d16c3;if(_0x25d256>=_0x456c67){_0x25d256=_0x456c67;_0x2d16c3=0xc8;}else{_0x2d16c3=0xce;}_0x462f17[_0x8163('0x14')](_0x2d16c3);return _0x462f17[_0x8163('0x1b')](_0x8163('0x1c'),_0x5b9959+'-'+_0x25d256+'/'+_0x456c67)[_0x8163('0x16')](_0x584ff5);}return null;};}function patchUpdates(_0x444a6a){return function(_0x583b4a){try{jsonpatch[_0x8163('0x1d')](_0x583b4a,_0x444a6a,!![]);}catch(_0x3867a2){return BPromise[_0x8163('0x1e')](_0x3867a2);}return _0x583b4a[_0x8163('0x1f')]();};}function saveUpdates(_0x3937c9,_0x2d4cf2){return function(_0x8c9dce){if(_0x8c9dce){return _0x8c9dce['update'](_0x3937c9)[_0x8163('0x20')](function(_0x4420d2){return _0x4420d2;});}return null;};}function removeEntity(_0x34d6d4,_0x38f710){return function(_0x3b05ca){if(_0x3b05ca){return _0x3b05ca[_0x8163('0x21')]()[_0x8163('0x20')](function(){_0x34d6d4['status'](0xcc)[_0x8163('0x15')]();});}};}function handleEntityNotFound(_0x3841ab,_0x4aebbe){return function(_0x541776){if(!_0x541776){_0x3841ab[_0x8163('0x13')](0x194);}return _0x541776;};}function handleError(_0x236def,_0x27bd7b){_0x27bd7b=_0x27bd7b||0x1f4;return function(_0x580a4c){logger[_0x8163('0x22')](_0x580a4c[_0x8163('0x23')]);if(_0x580a4c[_0x8163('0x24')]){delete _0x580a4c[_0x8163('0x24')];}_0x236def[_0x8163('0x14')](_0x27bd7b)[_0x8163('0x25')](_0x580a4c);};}exports['index']=function(_0x4c500a,_0x46d660){var _0x35b86d={},_0x483236={},_0x405c08={'count':0x0,'rows':[]};var _0x41af6a=_[_0x8163('0x26')](db['IntegrationReport'][_0x8163('0x27')],function(_0x13baa8){return{'name':_0x13baa8[_0x8163('0x28')],'type':_0x13baa8[_0x8163('0x29')]['key']};});_0x483236[_0x8163('0x2a')]=_[_0x8163('0x26')](_0x41af6a,_0x8163('0x24'));_0x483236[_0x8163('0x2b')]=_[_0x8163('0x2c')](_0x4c500a[_0x8163('0x2b')]);_0x483236['filters']=_['intersection'](_0x483236[_0x8163('0x2a')],_0x483236[_0x8163('0x2b')]);_0x35b86d[_0x8163('0x2d')]=_[_0x8163('0x2e')](_0x483236[_0x8163('0x2a')],qs['fields'](_0x4c500a[_0x8163('0x2b')][_0x8163('0x2f')]));_0x35b86d['attributes']=_0x35b86d[_0x8163('0x2d')][_0x8163('0x30')]?_0x35b86d[_0x8163('0x2d')]:_0x483236[_0x8163('0x2a')];if(!_0x4c500a[_0x8163('0x2b')][_0x8163('0x31')](_0x8163('0x32'))){_0x35b86d['limit']=qs[_0x8163('0x19')](_0x4c500a[_0x8163('0x2b')][_0x8163('0x19')]);_0x35b86d[_0x8163('0x17')]=qs[_0x8163('0x17')](_0x4c500a[_0x8163('0x2b')][_0x8163('0x17')]);}_0x35b86d[_0x8163('0x33')]=qs[_0x8163('0x34')](_0x4c500a[_0x8163('0x2b')]['sort']);_0x35b86d[_0x8163('0x35')]=qs['filters'](_[_0x8163('0x36')](_0x4c500a[_0x8163('0x2b')],_0x483236[_0x8163('0x37')]),_0x41af6a);if(_0x4c500a[_0x8163('0x2b')][_0x8163('0x38')]){_0x35b86d[_0x8163('0x35')]=_[_0x8163('0x39')](_0x35b86d[_0x8163('0x35')],{'$or':_[_0x8163('0x26')](_0x41af6a,function(_0x53612e){if(_0x53612e['type']!==_0x8163('0x3a')){var _0x21dc52={};_0x21dc52[_0x53612e[_0x8163('0x24')]]={'$like':'%'+_0x4c500a['query']['filter']+'%'};return _0x21dc52;}})});}_0x35b86d=_['merge']({},_0x35b86d,_0x4c500a['options']);var _0x4d59f4={'where':_0x35b86d['where']};return db['IntegrationReport'][_0x8163('0x1a')](_0x4d59f4)[_0x8163('0x20')](function(_0x442463){_0x405c08['count']=_0x442463;if(_0x4c500a['query'][_0x8163('0x3b')]){_0x35b86d[_0x8163('0x3c')]=[{'all':!![]}];}return db['IntegrationReport'][_0x8163('0x3d')](_0x35b86d);})['then'](function(_0x2119c6){_0x405c08[_0x8163('0x3e')]=_0x2119c6;return _0x405c08;})['then'](respondWithFilteredResult(_0x46d660,_0x35b86d))[_0x8163('0x3f')](handleError(_0x46d660,null));};exports[_0x8163('0x40')]=function(_0x407219,_0x21112d){var _0x31ac12={'raw':![],'where':{'id':_0x407219[_0x8163('0x41')]['id']}},_0x48acb6={};_0x48acb6[_0x8163('0x2a')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x48acb6[_0x8163('0x2b')]=_[_0x8163('0x2c')](_0x407219[_0x8163('0x2b')]);_0x48acb6['filters']=_[_0x8163('0x2e')](_0x48acb6[_0x8163('0x2a')],_0x48acb6['query']);_0x31ac12[_0x8163('0x2d')]=_['intersection'](_0x48acb6[_0x8163('0x2a')],qs[_0x8163('0x2f')](_0x407219[_0x8163('0x2b')][_0x8163('0x2f')]));_0x31ac12[_0x8163('0x2d')]=_0x31ac12[_0x8163('0x2d')][_0x8163('0x30')]?_0x31ac12[_0x8163('0x2d')]:_0x48acb6[_0x8163('0x2a')];if(_0x407219[_0x8163('0x2b')]['includeAll']){_0x31ac12[_0x8163('0x3c')]=[{'all':!![]}];}_0x31ac12=_[_0x8163('0x39')]({},_0x31ac12,_0x407219[_0x8163('0x42')]);return db[_0x8163('0x43')][_0x8163('0x44')](_0x31ac12)[_0x8163('0x20')](handleEntityNotFound(_0x21112d,null))[_0x8163('0x20')](respondWithResult(_0x21112d,null))['catch'](handleError(_0x21112d,null));};exports[_0x8163('0x45')]=function(_0x5278b8,_0x451a7f){return db[_0x8163('0x43')][_0x8163('0x45')](_0x5278b8['body'],{})[_0x8163('0x20')](respondWithResult(_0x451a7f,0xc9))['catch'](handleError(_0x451a7f,null));};exports[_0x8163('0x46')]=function(_0x3900c5,_0x47de37){if(_0x3900c5[_0x8163('0x47')]['id']){delete _0x3900c5[_0x8163('0x47')]['id'];}return db['IntegrationReport'][_0x8163('0x44')]({'where':{'id':_0x3900c5[_0x8163('0x41')]['id']}})['then'](handleEntityNotFound(_0x47de37,null))[_0x8163('0x20')](saveUpdates(_0x3900c5['body'],null))[_0x8163('0x20')](respondWithResult(_0x47de37,null))[_0x8163('0x3f')](handleError(_0x47de37,null));};exports[_0x8163('0x21')]=function(_0x47c316,_0x317099){return db[_0x8163('0x43')][_0x8163('0x44')]({'where':{'id':_0x47c316[_0x8163('0x41')]['id']}})[_0x8163('0x20')](handleEntityNotFound(_0x317099,null))[_0x8163('0x20')](removeEntity(_0x317099,null))[_0x8163('0x3f')](handleError(_0x317099,null));};exports['describe']=function(_0x506a74,_0x292410){return db[_0x8163('0x43')][_0x8163('0x48')]()['then'](respondWithResult(_0x292410,null))[_0x8163('0x3f')](handleError(_0x292410,null));}; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 78401ba..3f7b8ac 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 _0xff4c=['IntegrationReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define'];(function(_0x32cfc0,_0x1ad0fa){var _0x19bc87=function(_0x59b8d4){while(--_0x59b8d4){_0x32cfc0['push'](_0x32cfc0['shift']());}};_0x19bc87(++_0x1ad0fa);}(_0xff4c,0x199));var _0xcff4=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0xff4c[_0x4bb2b9];return _0x40e2a2;};'use strict';var _=require(_0xcff4('0x0'));var util=require('util');var logger=require(_0xcff4('0x1'))(_0xcff4('0x2'));var moment=require(_0xcff4('0x3'));var BPromise=require(_0xcff4('0x4'));var rp=require(_0xcff4('0x5'));var fs=require('fs');var path=require(_0xcff4('0x6'));var rimraf=require(_0xcff4('0x7'));var config=require(_0xcff4('0x8'));var attributes=require(_0xcff4('0x9'));module['exports']=function(_0x4e8f32,_0x3e94f2){return _0x4e8f32[_0xcff4('0xa')](_0xcff4('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index fecd2f5..385ee88 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3a1746,_0x39bbf1){var _0x63c03a=function(_0x17b40c){while(--_0x17b40c){_0x3a1746['push'](_0x3a1746['shift']());}};_0x63c03a(++_0x39bbf1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 161dfd4..752af4b 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 _0x1059=['Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','get','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x1e6d4c,_0x436ba1){var _0x2ee166=function(_0xce3b9e){while(--_0xce3b9e){_0x1e6d4c['push'](_0x1e6d4c['shift']());}};_0x2ee166(++_0x436ba1);}(_0x1059,0x176));var _0x9105=function(_0x4e68da,_0x21cdcd){_0x4e68da=_0x4e68da-0x0;var _0x39b230=_0x1059[_0x4e68da];return _0x39b230;};'use strict';var multer=require(_0x9105('0x0'));var util=require(_0x9105('0x1'));var path=require('path');var timeout=require(_0x9105('0x2'));var express=require(_0x9105('0x3'));var router=express[_0x9105('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9105('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9105('0x6'));var controller=require(_0x9105('0x7'));router['get']('/',auth[_0x9105('0x8')](),controller['index']);router[_0x9105('0x9')](_0x9105('0xa'),auth[_0x9105('0x8')](),controller['show']);router[_0x9105('0x9')](_0x9105('0xb'),auth[_0x9105('0x8')](),controller[_0x9105('0xc')]);router['post']('/',auth[_0x9105('0x8')](),controller[_0x9105('0xd')]);router[_0x9105('0xe')](_0x9105('0xb'),auth['isAuthenticated'](),controller[_0x9105('0xf')]);router['post'](_0x9105('0x10'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x9105('0x11')](_0x9105('0xa'),auth[_0x9105('0x8')](),controller[_0x9105('0x12')]);router['delete'](_0x9105('0xa'),auth['isAuthenticated'](),controller[_0x9105('0x13')]);module[_0x9105('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 02577dc..447df7a 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 _0x4685=['STRING','sequelize','exports'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x4685,0xdf));var _0x5468=function(_0x3a4e62,_0xcccad0){_0x3a4e62=_0x3a4e62-0x0;var _0x4a60e7=_0x4685[_0x3a4e62];return _0x4a60e7;};'use strict';var Sequelize=require(_0x5468('0x0'));module[_0x5468('0x1')]={'name':{'type':Sequelize[_0x5468('0x2')]},'description':{'type':Sequelize[_0x5468('0x2')]},'interval':{'type':Sequelize[_0x5468('0x2')],'allowNull':!![]}}; \ No newline at end of file +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 diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 481d6c6..a0bbe48 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 _0xf7d1=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','addIntervals','findOne','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','count','set','Content-Range','reject','then','destroy','get','Intervals','UserProfileResource','error','name','index','map','Interval','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x7b6b6a,_0x46914f){var _0x13a4a3=function(_0x3514b1){while(--_0x3514b1){_0x7b6b6a['push'](_0x7b6b6a['shift']());}};_0x13a4a3(++_0x46914f);}(_0xf7d1,0x71));var _0x1f7d=function(_0x20cf79,_0x504c59){_0x20cf79=_0x20cf79-0x0;var _0x40ce4f=_0xf7d1[_0x20cf79];return _0x40ce4f;};'use strict';var emlformat=require(_0x1f7d('0x0'));var rimraf=require(_0x1f7d('0x1'));var zipdir=require(_0x1f7d('0x2'));var jsonpatch=require(_0x1f7d('0x3'));var rp=require('request-promise');var moment=require(_0x1f7d('0x4'));var BPromise=require(_0x1f7d('0x5'));var Mustache=require(_0x1f7d('0x6'));var util=require(_0x1f7d('0x7'));var path=require(_0x1f7d('0x8'));var sox=require('sox');var csv=require(_0x1f7d('0x9'));var ejs=require(_0x1f7d('0xa'));var fs=require('fs');var fs_extra=require(_0x1f7d('0xb'));var _=require(_0x1f7d('0xc'));var squel=require(_0x1f7d('0xd'));var crypto=require(_0x1f7d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f7d('0x9'));var querystring=require(_0x1f7d('0xf'));var Papa=require(_0x1f7d('0x10'));var Redis=require('ioredis');var authService=require(_0x1f7d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1f7d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f7d('0x13'))(_0x1f7d('0x14'));var utils=require(_0x1f7d('0x15'));var config=require(_0x1f7d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f7d('0x17'))['db'];var extensions=require(_0x1f7d('0x18'));function respondWithStatusCode(_0xbd530e,_0x1cb53c){_0x1cb53c=_0x1cb53c||0xcc;return function(_0x29d986){if(_0x29d986){return _0xbd530e[_0x1f7d('0x19')](_0x1cb53c);}return _0xbd530e[_0x1f7d('0x1a')](_0x1cb53c)[_0x1f7d('0x1b')]();};}function respondWithResult(_0x1df105,_0x2a7188){_0x2a7188=_0x2a7188||0xc8;return function(_0x5bacae){if(_0x5bacae){return _0x1df105[_0x1f7d('0x1a')](_0x2a7188)['json'](_0x5bacae);}};}function respondWithFilteredResult(_0x50f643,_0x121247){return function(_0x2d2ec2){if(_0x2d2ec2){var _0x3851a0=typeof _0x121247[_0x1f7d('0x1c')]==='undefined'&&typeof _0x121247['limit']==='undefined';var _0x43da10=_0x2d2ec2['count'];var _0x3923df=_0x3851a0?0x0:_0x121247[_0x1f7d('0x1c')];var _0x495f61=_0x3851a0?_0x2d2ec2[_0x1f7d('0x1d')]:_0x121247[_0x1f7d('0x1c')]+_0x121247['limit'];var _0x305a78;if(_0x495f61>=_0x43da10){_0x495f61=_0x43da10;_0x305a78=0xc8;}else{_0x305a78=0xce;}_0x50f643[_0x1f7d('0x1a')](_0x305a78);return _0x50f643[_0x1f7d('0x1e')](_0x1f7d('0x1f'),_0x3923df+'-'+_0x495f61+'/'+_0x43da10)['json'](_0x2d2ec2);}return null;};}function patchUpdates(_0x234d4d){return function(_0x39b5ff){try{jsonpatch['apply'](_0x39b5ff,_0x234d4d,!![]);}catch(_0x39b691){return BPromise[_0x1f7d('0x20')](_0x39b691);}return _0x39b5ff['save']();};}function saveUpdates(_0x1bfb87,_0x42d2ac){return function(_0x3e3cae){if(_0x3e3cae){return _0x3e3cae['update'](_0x1bfb87)[_0x1f7d('0x21')](function(_0x2b3d6c){return _0x2b3d6c;});}return null;};}function removeEntity(_0x57cf6e,_0x1234a8){return function(_0x1ea78a){if(_0x1ea78a){return _0x1ea78a[_0x1f7d('0x22')]()[_0x1f7d('0x21')](function(){var _0x35295c=_0x1ea78a[_0x1f7d('0x23')]({'plain':!![]});var _0xe5bc9a=_0x1f7d('0x24');return db[_0x1f7d('0x25')]['destroy']({'where':{'type':_0xe5bc9a,'resourceId':_0x35295c['id']}})[_0x1f7d('0x21')](function(){return _0x1ea78a;});})[_0x1f7d('0x21')](function(){_0x57cf6e[_0x1f7d('0x1a')](0xcc)[_0x1f7d('0x1b')]();});}};}function handleEntityNotFound(_0x48367e,_0x56b73c){return function(_0x21dacf){if(!_0x21dacf){_0x48367e[_0x1f7d('0x19')](0x194);}return _0x21dacf;};}function handleError(_0x454b2a,_0x462153){_0x462153=_0x462153||0x1f4;return function(_0x1f0cbd){logger[_0x1f7d('0x26')](_0x1f0cbd['stack']);if(_0x1f0cbd[_0x1f7d('0x27')]){delete _0x1f0cbd[_0x1f7d('0x27')];}_0x454b2a[_0x1f7d('0x1a')](_0x462153)['send'](_0x1f0cbd);};}exports[_0x1f7d('0x28')]=function(_0x5e1127,_0x456d8c){var _0x3cc642={},_0x50d692={},_0x47b065={'count':0x0,'rows':[]};var _0x3196bf=_[_0x1f7d('0x29')](db[_0x1f7d('0x2a')][_0x1f7d('0x2b')],function(_0x2f8794){return{'name':_0x2f8794['fieldName'],'type':_0x2f8794[_0x1f7d('0x2c')][_0x1f7d('0x2d')]};});_0x50d692[_0x1f7d('0x2e')]=_['map'](_0x3196bf,_0x1f7d('0x27'));_0x50d692['query']=_[_0x1f7d('0x2f')](_0x5e1127[_0x1f7d('0x30')]);_0x50d692[_0x1f7d('0x31')]=_[_0x1f7d('0x32')](_0x50d692[_0x1f7d('0x2e')],_0x50d692['query']);_0x3cc642[_0x1f7d('0x33')]=_[_0x1f7d('0x32')](_0x50d692[_0x1f7d('0x2e')],qs[_0x1f7d('0x34')](_0x5e1127['query']['fields']));_0x3cc642[_0x1f7d('0x33')]=_0x3cc642['attributes'][_0x1f7d('0x35')]?_0x3cc642[_0x1f7d('0x33')]:_0x50d692[_0x1f7d('0x2e')];if(!_0x5e1127[_0x1f7d('0x30')][_0x1f7d('0x36')](_0x1f7d('0x37'))){_0x3cc642[_0x1f7d('0x38')]=qs[_0x1f7d('0x38')](_0x5e1127[_0x1f7d('0x30')][_0x1f7d('0x38')]);_0x3cc642['offset']=qs[_0x1f7d('0x1c')](_0x5e1127[_0x1f7d('0x30')]['offset']);}_0x3cc642['order']=qs[_0x1f7d('0x39')](_0x5e1127[_0x1f7d('0x30')][_0x1f7d('0x39')]);_0x3cc642[_0x1f7d('0x3a')]=qs[_0x1f7d('0x31')](_[_0x1f7d('0x3b')](_0x5e1127['query'],_0x50d692[_0x1f7d('0x31')]),_0x3196bf);if(_0x5e1127[_0x1f7d('0x30')][_0x1f7d('0x3c')]){_0x3cc642[_0x1f7d('0x3a')]=_[_0x1f7d('0x3d')](_0x3cc642[_0x1f7d('0x3a')],{'$or':_['map'](_0x3196bf,function(_0x6f27af){if(_0x6f27af['type']!==_0x1f7d('0x3e')){var _0x464544={};_0x464544[_0x6f27af[_0x1f7d('0x27')]]={'$like':'%'+_0x5e1127[_0x1f7d('0x30')][_0x1f7d('0x3c')]+'%'};return _0x464544;}})});}_0x3cc642=_[_0x1f7d('0x3d')]({},_0x3cc642,_0x5e1127[_0x1f7d('0x3f')]);var _0x51206d={'where':_0x3cc642['where']};return db[_0x1f7d('0x2a')]['count'](_0x51206d)[_0x1f7d('0x21')](function(_0x38335a){_0x47b065['count']=_0x38335a;if(_0x5e1127['query'][_0x1f7d('0x40')]){_0x3cc642[_0x1f7d('0x41')]=[{'all':!![]}];}return db[_0x1f7d('0x2a')][_0x1f7d('0x42')](_0x3cc642);})['then'](function(_0x3876f1){_0x47b065[_0x1f7d('0x43')]=_0x3876f1;return _0x47b065;})[_0x1f7d('0x21')](respondWithFilteredResult(_0x456d8c,_0x3cc642))[_0x1f7d('0x44')](handleError(_0x456d8c,null));};exports['show']=function(_0x18246a,_0x289744){var _0x1cfd1f={'raw':!![],'where':{'id':_0x18246a[_0x1f7d('0x45')]['id']}},_0x52710a={};_0x52710a['model']=_['keys'](db['Interval'][_0x1f7d('0x2b')]);_0x52710a[_0x1f7d('0x30')]=_['keys'](_0x18246a[_0x1f7d('0x30')]);_0x52710a[_0x1f7d('0x31')]=_[_0x1f7d('0x32')](_0x52710a[_0x1f7d('0x2e')],_0x52710a[_0x1f7d('0x30')]);_0x1cfd1f['attributes']=_[_0x1f7d('0x32')](_0x52710a[_0x1f7d('0x2e')],qs[_0x1f7d('0x34')](_0x18246a[_0x1f7d('0x30')][_0x1f7d('0x34')]));_0x1cfd1f[_0x1f7d('0x33')]=_0x1cfd1f[_0x1f7d('0x33')]['length']?_0x1cfd1f[_0x1f7d('0x33')]:_0x52710a['model'];if(_0x18246a[_0x1f7d('0x30')]['includeAll']){_0x1cfd1f[_0x1f7d('0x41')]=[{'all':!![]}];}_0x1cfd1f=_['merge']({},_0x1cfd1f,_0x18246a[_0x1f7d('0x3f')]);return db[_0x1f7d('0x2a')]['find'](_0x1cfd1f)[_0x1f7d('0x21')](handleEntityNotFound(_0x289744,null))[_0x1f7d('0x21')](respondWithResult(_0x289744,null))[_0x1f7d('0x44')](handleError(_0x289744,null));};exports['create']=function(_0x37f8fe,_0x5060c9){return db[_0x1f7d('0x2a')][_0x1f7d('0x46')](_0x37f8fe[_0x1f7d('0x47')],{})[_0x1f7d('0x21')](function(_0xcedc0){var _0x25e079=_0x37f8fe[_0x1f7d('0x48')]['get']({'plain':!![]});if(!_0x25e079)throw new Error(_0x1f7d('0x49'));if(_0x25e079[_0x1f7d('0x4a')]==='user'){var _0x203dbf=_0xcedc0[_0x1f7d('0x23')]({'plain':!![]});var _0x182638=_0x1f7d('0x24');return db[_0x1f7d('0x4b')][_0x1f7d('0x4c')]({'where':{'name':_0x182638,'userProfileId':_0x25e079[_0x1f7d('0x4d')]},'raw':!![]})[_0x1f7d('0x21')](function(_0x26639b){if(_0x26639b&&_0x26639b['autoAssociation']===0x0){return db[_0x1f7d('0x25')][_0x1f7d('0x46')]({'name':_0x203dbf['name'],'resourceId':_0x203dbf['id'],'type':_0x26639b[_0x1f7d('0x27')],'sectionId':_0x26639b['id']},{})[_0x1f7d('0x21')](function(){return _0xcedc0;});}else{return _0xcedc0;}})[_0x1f7d('0x44')](function(_0x25f288){logger['error'](_0x1f7d('0x4e'),_0x25f288);throw _0x25f288;});}return _0xcedc0;})[_0x1f7d('0x21')](respondWithResult(_0x5060c9,0xc9))[_0x1f7d('0x44')](handleError(_0x5060c9,null));};exports[_0x1f7d('0x4f')]=function(_0x3aad6c,_0x5d7703){if(_0x3aad6c[_0x1f7d('0x47')]['id']){delete _0x3aad6c[_0x1f7d('0x47')]['id'];}return db[_0x1f7d('0x2a')][_0x1f7d('0x4c')]({'where':{'id':_0x3aad6c[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x21')](handleEntityNotFound(_0x5d7703,null))[_0x1f7d('0x21')](saveUpdates(_0x3aad6c['body'],null))['then'](respondWithResult(_0x5d7703,null))[_0x1f7d('0x44')](handleError(_0x5d7703,null));};exports['destroy']=function(_0x174cd3,_0x37532d){return db[_0x1f7d('0x2a')][_0x1f7d('0x4c')]({'where':{'id':_0x174cd3[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x21')](handleEntityNotFound(_0x37532d,null))[_0x1f7d('0x21')](removeEntity(_0x37532d,null))['catch'](handleError(_0x37532d,null));};exports['addInterval']=function(_0xdb796c,_0x1d8622,_0xa754ee){if(_0xdb796c['body']['id']){delete _0xdb796c[_0x1f7d('0x47')]['id'];}return db[_0x1f7d('0x2a')]['find']({'where':{'id':_0xdb796c[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x21')](handleEntityNotFound(_0x1d8622,null))['then'](function(_0x376cb5){if(_0x376cb5){_0xdb796c[_0x1f7d('0x47')][_0x1f7d('0x50')]=_0x376cb5['id'];return db[_0x1f7d('0x2a')]['create'](_0xdb796c['body']);}})[_0x1f7d('0x21')](respondWithResult(_0x1d8622,null))['catch'](handleError(_0x1d8622,null));};exports[_0x1f7d('0x51')]=function(_0x5338bf,_0xd77511,_0x3280dc){var _0x366ec5={};var _0x636301={};var _0x53c018;var _0x5325fb;return db[_0x1f7d('0x2a')]['findOne']({'where':{'id':_0x5338bf[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x21')](handleEntityNotFound(_0xd77511,null))[_0x1f7d('0x21')](function(_0x3819d4){if(_0x3819d4){_0x53c018=_0x3819d4;_0x636301[_0x1f7d('0x2e')]=_[_0x1f7d('0x2f')](db[_0x1f7d('0x2a')][_0x1f7d('0x2b')]);_0x636301[_0x1f7d('0x30')]=_[_0x1f7d('0x2f')](_0x5338bf[_0x1f7d('0x30')]);_0x636301[_0x1f7d('0x31')]=_['intersection'](_0x636301[_0x1f7d('0x2e')],_0x636301[_0x1f7d('0x30')]);_0x366ec5[_0x1f7d('0x33')]=_[_0x1f7d('0x32')](_0x636301[_0x1f7d('0x2e')],qs[_0x1f7d('0x34')](_0x5338bf['query'][_0x1f7d('0x34')]));_0x366ec5[_0x1f7d('0x33')]=_0x366ec5[_0x1f7d('0x33')][_0x1f7d('0x35')]?_0x366ec5['attributes']:_0x636301[_0x1f7d('0x2e')];_0x366ec5['order']=qs[_0x1f7d('0x39')](_0x5338bf[_0x1f7d('0x30')][_0x1f7d('0x39')]);_0x366ec5[_0x1f7d('0x3a')]=qs['filters'](_[_0x1f7d('0x3b')](_0x5338bf[_0x1f7d('0x30')],_0x636301[_0x1f7d('0x31')]));if(_0x5338bf[_0x1f7d('0x30')][_0x1f7d('0x3c')]){_0x366ec5[_0x1f7d('0x3a')]=_[_0x1f7d('0x3d')](_0x366ec5[_0x1f7d('0x3a')],{'$or':_['map'](_0x366ec5['attributes'],function(_0x44cd14){var _0x51dbf5={};_0x51dbf5[_0x44cd14]={'$like':'%'+_0x5338bf['query'][_0x1f7d('0x3c')]+'%'};return _0x51dbf5;})});}_0x366ec5=_[_0x1f7d('0x3d')]({},_0x366ec5,_0x5338bf[_0x1f7d('0x3f')]);return _0x53c018[_0x1f7d('0x51')](_0x366ec5);}})[_0x1f7d('0x21')](function(_0x461051){if(_0x461051){_0x5325fb=_0x461051[_0x1f7d('0x35')];if(!_0x5338bf[_0x1f7d('0x30')][_0x1f7d('0x36')](_0x1f7d('0x37'))){_0x366ec5[_0x1f7d('0x38')]=qs[_0x1f7d('0x38')](_0x5338bf[_0x1f7d('0x30')][_0x1f7d('0x38')]);_0x366ec5[_0x1f7d('0x1c')]=qs[_0x1f7d('0x1c')](_0x5338bf[_0x1f7d('0x30')][_0x1f7d('0x1c')]);}return _0x53c018[_0x1f7d('0x51')](_0x366ec5);}})[_0x1f7d('0x21')](function(_0x2c234d){if(_0x2c234d){return _0x2c234d?{'count':_0x5325fb,'rows':_0x2c234d}:null;}})['then'](respondWithResult(_0xd77511,null))['catch'](handleError(_0xd77511,null));};exports[_0x1f7d('0x52')]=function(_0xd7c18f,_0x3fe7e7,_0x5bd1be){return db[_0x1f7d('0x2a')][_0x1f7d('0x53')]({'where':{'id':_0xd7c18f[_0x1f7d('0x45')]['id']}})[_0x1f7d('0x21')](handleEntityNotFound(_0x3fe7e7,null))[_0x1f7d('0x21')](function(_0x55d3f5){if(_0x55d3f5){return db[_0x1f7d('0x54')]['transaction'](function(_0x2f5c58){return db['Interval']['destroy']({'where':{'IntervalId':_0xd7c18f['params']['id']},'transaction':_0x2f5c58})[_0x1f7d('0x21')](function(_0x3589c0){var _0x363ea6=_[_0x1f7d('0x29')](_0xd7c18f[_0x1f7d('0x47')],function(_0x306624){delete _0x306624['id'];_0x306624[_0x1f7d('0x50')]=_0xd7c18f[_0x1f7d('0x45')]['id'];return _0x306624;});return db[_0x1f7d('0x2a')]['bulkCreate'](_0x363ea6,{'transaction':_0x2f5c58});});})[_0x1f7d('0x21')](function(){return db[_0x1f7d('0x2a')][_0x1f7d('0x42')]({'where':{'IntervalId':_0xd7c18f[_0x1f7d('0x45')]['id']}});});}})[_0x1f7d('0x21')](respondWithResult(_0x3fe7e7,null))[_0x1f7d('0x44')](handleError(_0x3fe7e7,null));}; \ No newline at end of file +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 diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a18c991..f136247 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 _0xe382=['getIntervals','then','map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','rewrite','interval','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe382,0x13c));var _0x2e38=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xe382[_0x27d958];return _0x53e63e;};'use strict';var attributes=require(_0x2e38('0x0'));var extensions=require(_0x2e38('0x1'));var iftime=require(_0x2e38('0x2'))['iftime'];module[_0x2e38('0x3')]=function(_0x46627f){return _0x46627f[_0x2e38('0x4')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x55b23a){extensions[_0x2e38('0x5')](_0x46627f,_0x55b23a);},'afterBulkCreate':function(_0x58adad,_0x301877,_0x4c6bcc){_0x4c6bcc();extensions['rewrite'](_0x46627f,_0x58adad[0x0]);},'afterUpdate':function(_0x377fb3){extensions[_0x2e38('0x5')](_0x46627f,_0x377fb3);},'afterDestroy':function(_0xf8edf2){extensions[_0x2e38('0x5')](_0x46627f,_0xf8edf2);}},'instanceMethods':{'ifTime':function(_0x15595b=undefined,_0x1fe573=new Date()){if(typeof this[_0x2e38('0x6')]===_0x2e38('0x7')){return iftime(this['interval'],_0x15595b,_0x1fe573);}else{return this[_0x2e38('0x8')]()[_0x2e38('0x9')](function(_0xbe1f70){return Promise['all'](_0xbe1f70[_0x2e38('0xa')](function(_0x264700){return _0x264700[_0x2e38('0xb')](_0x15595b,_0x1fe573);}));})[_0x2e38('0x9')](function(_0x44bec8){return _0x44bec8['reduce'](function(_0x580a01,_0x2731ca){return _0x580a01||_0x2731ca;},![]);});}}}});}; \ No newline at end of file +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 diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 79ca97b..4875a9b 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 _0xb570=['find','raw','where','info','ShowInterval','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','attributes','map','include','model','then','debug','stringify','catch','error','message'];(function(_0x18b72b,_0x65d449){var _0x327495=function(_0x41579a){while(--_0x41579a){_0x18b72b['push'](_0x18b72b['shift']());}};_0x327495(++_0x65d449);}(_0xb570,0x186));var _0x0b57=function(_0x541f39,_0x1e1172){_0x541f39=_0x541f39-0x0;var _0x295cdf=_0xb570[_0x541f39];return _0x295cdf;};'use strict';var _=require(_0x0b57('0x0'));var util=require(_0x0b57('0x1'));var db=require(_0x0b57('0x2'))['db'];var iftime=require(_0x0b57('0x3'))[_0x0b57('0x4')];var logger=require(_0x0b57('0x5'))('rpc');exports[_0x0b57('0x6')]=function(_0x271ad7){var _0x29e9d9=this;return new Promise(function(_0x56c5ad,_0x29482d){return db[_0x0b57('0x7')][_0x0b57('0x8')]({'raw':_0x271ad7[_0x0b57('0x9')]?_0x271ad7[_0x0b57('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x271ad7[_0x0b57('0x9')]?_0x271ad7['options']['where']||null:null,'attributes':_0x271ad7['options']?_0x271ad7[_0x0b57('0x9')][_0x0b57('0xa')]||null:null,'limit':_0x271ad7[_0x0b57('0x9')]?_0x271ad7[_0x0b57('0x9')]['limit']||null:null,'include':_0x271ad7['options']?_0x271ad7[_0x0b57('0x9')]['include']?_[_0x0b57('0xb')](_0x271ad7[_0x0b57('0x9')][_0x0b57('0xc')],function(_0x10c0ea){return{'model':db[_0x10c0ea[_0x0b57('0xd')]],'as':_0x10c0ea['as'],'attributes':_0x10c0ea[_0x0b57('0xa')],'include':_0x10c0ea[_0x0b57('0xc')]?_[_0x0b57('0xb')](_0x10c0ea[_0x0b57('0xc')],function(_0x1e6893){return{'model':db[_0x1e6893[_0x0b57('0xd')]],'as':_0x1e6893['as'],'attributes':_0x1e6893['attributes'],'include':_0x1e6893[_0x0b57('0xc')]?_['map'](_0x1e6893[_0x0b57('0xc')],function(_0x17bd9a){return{'model':db[_0x17bd9a[_0x0b57('0xd')]],'as':_0x17bd9a['as'],'attributes':_0x17bd9a[_0x0b57('0xa')]};}):[]};}):[]};}):[]:[]})[_0x0b57('0xe')](function(_0xaddc50){logger['info'](_0x0b57('0x6'),_0x271ad7);logger[_0x0b57('0xf')](_0x0b57('0x6'),_0x271ad7,JSON[_0x0b57('0x10')](_0xaddc50));_0x56c5ad(_0xaddc50);})[_0x0b57('0x11')](function(_0x46ea8d){logger[_0x0b57('0x12')](_0x0b57('0x6'),_0x46ea8d[_0x0b57('0x13')],_0x271ad7);_0x29482d(_0x29e9d9[_0x0b57('0x12')](0x1f4,_0x46ea8d['message']));});});};exports['ShowInterval']=function(_0x2e3f2d){var _0x4656dd=this;return new Promise(function(_0x48e364,_0x2ee5cb){return db['Interval'][_0x0b57('0x14')]({'raw':_0x2e3f2d[_0x0b57('0x9')]?_0x2e3f2d['options'][_0x0b57('0x15')]===undefined?!![]:![]:!![],'where':_0x2e3f2d['options']?_0x2e3f2d[_0x0b57('0x9')][_0x0b57('0x16')]||null:null,'attributes':_0x2e3f2d[_0x0b57('0x9')]?_0x2e3f2d[_0x0b57('0x9')]['attributes']||null:null,'include':_0x2e3f2d['options']?_0x2e3f2d[_0x0b57('0x9')][_0x0b57('0xc')]?_[_0x0b57('0xb')](_0x2e3f2d[_0x0b57('0x9')][_0x0b57('0xc')],function(_0x15f872){return{'model':db[_0x15f872[_0x0b57('0xd')]],'as':_0x15f872['as'],'attributes':_0x15f872[_0x0b57('0xa')],'include':_0x15f872['include']?_[_0x0b57('0xb')](_0x15f872[_0x0b57('0xc')],function(_0x5078fb){return{'model':db[_0x5078fb[_0x0b57('0xd')]],'as':_0x5078fb['as'],'attributes':_0x5078fb[_0x0b57('0xa')],'include':_0x5078fb[_0x0b57('0xc')]?_[_0x0b57('0xb')](_0x5078fb[_0x0b57('0xc')],function(_0x10bfac){return{'model':db[_0x10bfac[_0x0b57('0xd')]],'as':_0x10bfac['as'],'attributes':_0x10bfac[_0x0b57('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b3d4d){logger[_0x0b57('0x17')](_0x0b57('0x18'),_0x2e3f2d);logger[_0x0b57('0xf')](_0x0b57('0x18'),_0x2e3f2d,JSON['stringify'](_0x2b3d4d));_0x48e364(_0x2b3d4d);})['catch'](function(_0x5b5e91){logger[_0x0b57('0x12')](_0x0b57('0x18'),_0x5b5e91['message'],_0x2e3f2d);_0x2ee5cb(_0x4656dd['error'](0x1f4,_0x5b5e91[_0x0b57('0x13')]));});});};function checkArrayOfIntervals(_0x280d20,_0x4e280e){var _0x5de7c5=[];return db['Interval'][_0x0b57('0x8')]({'where':{'id':_0x280d20}})['then'](function(_0x45c159){_0x5de7c5=_0x45c159;return Promise['all'](_0x5de7c5['map'](function(_0x5af822){return _0x5af822[_0x0b57('0x19')](_0x4e280e);}));})[_0x0b57('0xe')](function(_0xa1fd6){var _0x1def82=_0xa1fd6[_0x0b57('0x1a')](function(_0x1aca16,_0x57e352){return _0x1aca16||_0x57e352;},![]);logger[_0x0b57('0x17')](util[_0x0b57('0x1b')](_0x0b57('0x1c'),_0x5de7c5['map'](function(_0x3f943d){return _0x3f943d[_0x0b57('0x1d')];})[_0x0b57('0x1e')](',\x20'),_0x5de7c5['map'](function(_0x41a593){return _0x41a593['id'];})[_0x0b57('0x1e')](',\x20')));return _0x1def82;});}function checkSingleInterval(_0x1311b5,_0x5b19a1){return db[_0x0b57('0x7')]['findById'](_0x1311b5)[_0x0b57('0xe')](function(_0x2f6cc6){if(_0x2f6cc6){logger[_0x0b57('0x17')](util[_0x0b57('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x2f6cc6[_0x0b57('0x1d')],_0x2f6cc6['id']));return _0x2f6cc6['ifTime'](_0x5b19a1);}});}exports['IntervalIftime']=function(_0xe9a1af){var _0x5a54e4=_0xe9a1af[_0x0b57('0x1f')];var _0x2fa379=Array[_0x0b57('0x20')](_0xe9a1af['intervals'])?_0xe9a1af['intervals']:typeof _0xe9a1af['intervals']==='string'?[_0xe9a1af[_0x0b57('0x21')]]:[];var _0x100853=_0xe9a1af[_0x0b57('0x22')]||undefined;var _0x5b3342=![];if(_0x2fa379[_0x0b57('0x23')]){logger[_0x0b57('0x17')](util[_0x0b57('0x1b')](_0x0b57('0x24'),_0x2fa379[_0x0b57('0x1e')](';\x20')));}if(_0x100853){logger['info'](util[_0x0b57('0x1b')](_0x0b57('0x25'),_0x100853));}logger[_0x0b57('0xf')]('Iftime',_0x5b3342);logger[_0x0b57('0x26')](_0x0b57('0x27'),_0xe9a1af);return Promise[_0x0b57('0x28')]()[_0x0b57('0xe')](function(){if(Array[_0x0b57('0x20')](_0x5a54e4)){return checkArrayOfIntervals(_0x5a54e4,_0x100853);}else if(_0x5a54e4){return checkSingleInterval(_0x5a54e4,_0x100853);}})[_0x0b57('0xe')](function(_0x523ddb){var _0x5a52f7=_0x2fa379[_0x0b57('0x1a')](function(_0x3720ca,_0x3fce22){return _0x3720ca||iftime(_0x3fce22,_0x100853);},![]);_0x5b3342=_0x523ddb||_0x5a52f7;return _0x5b3342;})[_0x0b57('0x11')](function(_0x2d6d9b){logger[_0x0b57('0x12')]('IntervalIftime',_0xe9a1af,_0x2d6d9b);throw this[_0x0b57('0x12')](0x1f4,_0x2d6d9b[_0x0b57('0x13')]);});}; \ No newline at end of file +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 diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4f2e5d3..06b9fee 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0xf043a8,_0x478af2){var _0x4c719c=function(_0x416896){while(--_0x416896){_0xf043a8['push'](_0xf043a8['shift']());}};_0x4c719c(++_0x478af2);}(_0xadb5,0xad));var _0x5adb=function(_0x32d817,_0x53b933){_0x32d817=_0x32d817-0x0;var _0x34deeb=_0xadb5[_0x32d817];return _0x34deeb;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +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 diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 41e0914..173cae2 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 _0x1cb3=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','request','setEncoding','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','description','stringify','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb3,0x146));var _0x31cb=function(_0x17343d,_0x4575c0){_0x17343d=_0x17343d-0x0;var _0x15ec40=_0x1cb3[_0x17343d];return _0x15ec40;};'use strict';var BPromise=require(_0x31cb('0x0'));var https=require(_0x31cb('0x1'));var logger=require(_0x31cb('0x2'))(_0x31cb('0x3'));var USERNAME='support';var PASSWORD=_0x31cb('0x4');function openIssue(_0x2e0335,_0x4bd740){var _0x35d824={'fields':{'project':{'key':_0x2e0335[_0x31cb('0x5')]||_0x31cb('0x6')},'summary':(_0x2e0335[_0x31cb('0x7')]||'Report')+_0x31cb('0x8')+_0x2e0335['ip'],'description':_0x2e0335[_0x31cb('0x9')]||JSON[_0x31cb('0xa')](_0x2e0335),'issuetype':{'name':_0x2e0335['issuetype']||'Bug'}}};_0x35d824[_0x31cb('0xb')]['customfield_11500']=_0x2e0335['email'];_0x35d824[_0x31cb('0xb')]['customfield_11501']=_0x2e0335[_0x31cb('0xc')];_0x35d824[_0x31cb('0xb')][_0x31cb('0xd')]=_0x2e0335[_0x31cb('0xe')];_0x35d824[_0x31cb('0xb')][_0x31cb('0xf')]=_0x2e0335[_0x31cb('0x10')];_0x35d824[_0x31cb('0xb')][_0x31cb('0x11')]=_0x2e0335[_0x31cb('0x12')];_0x35d824[_0x31cb('0xb')][_0x31cb('0x13')]=_0x2e0335['ip'];var _0x75a12={'host':_0x31cb('0x14'),'port':0x1bb,'path':_0x31cb('0x15'),'method':_0x31cb('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x31cb('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x29a032=JSON[_0x31cb('0xa')](_0x35d824);var _0x10781a=https[_0x31cb('0x18')](_0x75a12,function(_0x377e48){_0x377e48[_0x31cb('0x19')](_0x31cb('0x1a'));var _0x4f36d0='';_0x377e48['on'](_0x31cb('0x1b'),function(_0x1f6595){_0x4f36d0+=_0x1f6595;});_0x377e48['on'](_0x31cb('0x1c'),function(){if(_0x4bd740){return _0x4bd740[_0x31cb('0x1d')](_0x377e48[_0x31cb('0x1e')])[_0x31cb('0x1f')](JSON[_0x31cb('0x20')](_0x4f36d0));}});});_0x10781a['on']('error',function(_0x3fef55){if(_0x4bd740){return _0x4bd740[_0x31cb('0x1d')](0x1f4)['json']({'errors':[{'message':_0x31cb('0x21'),'type':'api.jira'}]});}});_0x10781a[_0x31cb('0x22')](_0x29a032);_0x10781a['end']();}exports[_0x31cb('0x23')]=openIssue;exports[_0x31cb('0x24')]=function(_0x28580a,_0x4f7f7a){_0x28580a[_0x31cb('0x25')]['ip']=_0x28580a[_0x31cb('0x26')][_0x31cb('0x27')]||_0x28580a[_0x31cb('0x28')][_0x31cb('0x29')]||_0x28580a['socket'][_0x31cb('0x29')]||_0x28580a[_0x31cb('0x28')][_0x31cb('0x2a')]['remoteAddress'];return openIssue(_0x28580a[_0x31cb('0x25')],_0x4f7f7a);}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index ddc4e02..3e977b9 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x4918f8,_0x3c76cd){var _0x34540b=function(_0xa5239c){while(--_0xa5239c){_0x4918f8['push'](_0x4918f8['shift']());}};_0x34540b(++_0x3c76cd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xcb91[_0x272638];return _0x19d027;};'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')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index cb15330..ad36b00 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x44771c,_0x486051){_0x44771c=_0x44771c-0x0;var _0x27d530=_0x7a54[_0x44771c];return _0x27d530;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index f3a2f4d..d1f40e5 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 _0x4fd7=['VIRTUAL','includeAll','rows','show','params','include','options','find','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','map','JscriptyAnswerReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge'];(function(_0x47ec20,_0x8b2885){var _0x4abf8c=function(_0x564084){while(--_0x564084){_0x47ec20['push'](_0x47ec20['shift']());}};_0x4abf8c(++_0x8b2885);}(_0x4fd7,0xe6));var _0x74fd=function(_0x1e21db,_0x1cccee){_0x1e21db=_0x1e21db-0x0;var _0x185c7f=_0x4fd7[_0x1e21db];return _0x185c7f;};'use strict';var emlformat=require(_0x74fd('0x0'));var rimraf=require(_0x74fd('0x1'));var zipdir=require(_0x74fd('0x2'));var jsonpatch=require(_0x74fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x74fd('0x4'));var Mustache=require(_0x74fd('0x5'));var util=require('util');var path=require(_0x74fd('0x6'));var sox=require('sox');var csv=require(_0x74fd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74fd('0x8'));var _=require(_0x74fd('0x9'));var squel=require('squel');var crypto=require(_0x74fd('0xa'));var jsforce=require(_0x74fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x74fd('0x7'));var querystring=require(_0x74fd('0xc'));var Papa=require(_0x74fd('0xd'));var Redis=require(_0x74fd('0xe'));var authService=require(_0x74fd('0xf'));var qs=require(_0x74fd('0x10'));var as=require(_0x74fd('0x11'));var hardwareService=require(_0x74fd('0x12'));var logger=require(_0x74fd('0x13'))(_0x74fd('0x14'));var utils=require(_0x74fd('0x15'));var config=require(_0x74fd('0x16'));var licenseUtil=require(_0x74fd('0x17'));var db=require(_0x74fd('0x18'))['db'];function respondWithStatusCode(_0x3fd552,_0x8fafcb){_0x8fafcb=_0x8fafcb||0xcc;return function(_0x4d250d){if(_0x4d250d){return _0x3fd552[_0x74fd('0x19')](_0x8fafcb);}return _0x3fd552[_0x74fd('0x1a')](_0x8fafcb)['end']();};}function respondWithResult(_0x47e63c,_0x3e1d11){_0x3e1d11=_0x3e1d11||0xc8;return function(_0x2a4d2e){if(_0x2a4d2e){return _0x47e63c[_0x74fd('0x1a')](_0x3e1d11)[_0x74fd('0x1b')](_0x2a4d2e);}};}function respondWithFilteredResult(_0x24639c,_0x29bbc2){return function(_0x22e64a){if(_0x22e64a){var _0x127353=typeof _0x29bbc2[_0x74fd('0x1c')]===_0x74fd('0x1d')&&typeof _0x29bbc2[_0x74fd('0x1e')]==='undefined';var _0x2975f3=_0x22e64a[_0x74fd('0x1f')];var _0x4cd126=_0x127353?0x0:_0x29bbc2[_0x74fd('0x1c')];var _0x3904e3=_0x127353?_0x22e64a[_0x74fd('0x1f')]:_0x29bbc2[_0x74fd('0x1c')]+_0x29bbc2[_0x74fd('0x1e')];var _0x299f76;if(_0x3904e3>=_0x2975f3){_0x3904e3=_0x2975f3;_0x299f76=0xc8;}else{_0x299f76=0xce;}_0x24639c[_0x74fd('0x1a')](_0x299f76);return _0x24639c[_0x74fd('0x20')](_0x74fd('0x21'),_0x4cd126+'-'+_0x3904e3+'/'+_0x2975f3)[_0x74fd('0x1b')](_0x22e64a);}return null;};}function patchUpdates(_0x5fe487){return function(_0xb23e0){try{jsonpatch[_0x74fd('0x22')](_0xb23e0,_0x5fe487,!![]);}catch(_0x35a735){return BPromise[_0x74fd('0x23')](_0x35a735);}return _0xb23e0[_0x74fd('0x24')]();};}function saveUpdates(_0x1973a1,_0x204f5f){return function(_0x54fb4d){if(_0x54fb4d){return _0x54fb4d[_0x74fd('0x25')](_0x1973a1)[_0x74fd('0x26')](function(_0xf2c6ce){return _0xf2c6ce;});}return null;};}function removeEntity(_0x42cae0,_0x371d9c){return function(_0x4aae69){if(_0x4aae69){return _0x4aae69[_0x74fd('0x27')]()[_0x74fd('0x26')](function(){_0x42cae0['status'](0xcc)[_0x74fd('0x28')]();});}};}function handleEntityNotFound(_0x49debf,_0x2bc644){return function(_0x23d0ce){if(!_0x23d0ce){_0x49debf[_0x74fd('0x19')](0x194);}return _0x23d0ce;};}function handleError(_0x33d3d9,_0x214102){_0x214102=_0x214102||0x1f4;return function(_0x272d16){logger['error'](_0x272d16[_0x74fd('0x29')]);if(_0x272d16[_0x74fd('0x2a')]){delete _0x272d16[_0x74fd('0x2a')];}_0x33d3d9[_0x74fd('0x1a')](_0x214102)['send'](_0x272d16);};}exports['index']=function(_0x2de0eb,_0x476382){var _0x51e574={},_0x22a98c={},_0x57f0e6={'count':0x0,'rows':[]};var _0x4c0609=_[_0x74fd('0x2b')](db[_0x74fd('0x2c')][_0x74fd('0x2d')],function(_0x239839){return{'name':_0x239839[_0x74fd('0x2e')],'type':_0x239839['type'][_0x74fd('0x2f')]};});_0x22a98c['model']=_['map'](_0x4c0609,_0x74fd('0x2a'));_0x22a98c[_0x74fd('0x30')]=_[_0x74fd('0x31')](_0x2de0eb[_0x74fd('0x30')]);_0x22a98c['filters']=_[_0x74fd('0x32')](_0x22a98c[_0x74fd('0x33')],_0x22a98c[_0x74fd('0x30')]);_0x51e574[_0x74fd('0x34')]=_[_0x74fd('0x32')](_0x22a98c[_0x74fd('0x33')],qs[_0x74fd('0x35')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x35')]));_0x51e574[_0x74fd('0x34')]=_0x51e574[_0x74fd('0x34')][_0x74fd('0x36')]?_0x51e574[_0x74fd('0x34')]:_0x22a98c[_0x74fd('0x33')];if(!_0x2de0eb[_0x74fd('0x30')]['hasOwnProperty'](_0x74fd('0x37'))){_0x51e574[_0x74fd('0x1e')]=qs[_0x74fd('0x1e')](_0x2de0eb['query'][_0x74fd('0x1e')]);_0x51e574[_0x74fd('0x1c')]=qs[_0x74fd('0x1c')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x1c')]);}_0x51e574['order']=qs[_0x74fd('0x38')](_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x38')]);_0x51e574[_0x74fd('0x39')]=qs[_0x74fd('0x3a')](_[_0x74fd('0x3b')](_0x2de0eb[_0x74fd('0x30')],_0x22a98c[_0x74fd('0x3a')]),_0x4c0609);if(_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3c')]){_0x51e574[_0x74fd('0x39')]=_[_0x74fd('0x3d')](_0x51e574['where'],{'$or':_[_0x74fd('0x2b')](_0x4c0609,function(_0x48b640){if(_0x48b640['type']!==_0x74fd('0x3e')){var _0x242c33={};_0x242c33[_0x48b640[_0x74fd('0x2a')]]={'$like':'%'+_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3c')]+'%'};return _0x242c33;}})});}_0x51e574=_[_0x74fd('0x3d')]({},_0x51e574,_0x2de0eb['options']);var _0xfa3e6a={'where':_0x51e574[_0x74fd('0x39')]};return db['JscriptyAnswerReport'][_0x74fd('0x1f')](_0xfa3e6a)[_0x74fd('0x26')](function(_0x5a0de1){_0x57f0e6[_0x74fd('0x1f')]=_0x5a0de1;if(_0x2de0eb[_0x74fd('0x30')][_0x74fd('0x3f')]){_0x51e574['include']=[{'all':!![]}];}return db[_0x74fd('0x2c')]['findAll'](_0x51e574);})[_0x74fd('0x26')](function(_0x143aa6){_0x57f0e6[_0x74fd('0x40')]=_0x143aa6;return _0x57f0e6;})[_0x74fd('0x26')](respondWithFilteredResult(_0x476382,_0x51e574))['catch'](handleError(_0x476382,null));};exports[_0x74fd('0x41')]=function(_0x5779e1,_0x47be20){var _0x59d957={'raw':!![],'where':{'id':_0x5779e1[_0x74fd('0x42')]['id']}},_0x4fccd0={};_0x4fccd0[_0x74fd('0x33')]=_[_0x74fd('0x31')](db[_0x74fd('0x2c')]['rawAttributes']);_0x4fccd0[_0x74fd('0x30')]=_['keys'](_0x5779e1[_0x74fd('0x30')]);_0x4fccd0['filters']=_[_0x74fd('0x32')](_0x4fccd0[_0x74fd('0x33')],_0x4fccd0[_0x74fd('0x30')]);_0x59d957[_0x74fd('0x34')]=_[_0x74fd('0x32')](_0x4fccd0[_0x74fd('0x33')],qs[_0x74fd('0x35')](_0x5779e1[_0x74fd('0x30')][_0x74fd('0x35')]));_0x59d957[_0x74fd('0x34')]=_0x59d957[_0x74fd('0x34')][_0x74fd('0x36')]?_0x59d957[_0x74fd('0x34')]:_0x4fccd0[_0x74fd('0x33')];if(_0x5779e1[_0x74fd('0x30')][_0x74fd('0x3f')]){_0x59d957[_0x74fd('0x43')]=[{'all':!![]}];}_0x59d957=_[_0x74fd('0x3d')]({},_0x59d957,_0x5779e1[_0x74fd('0x44')]);return db[_0x74fd('0x2c')][_0x74fd('0x45')](_0x59d957)[_0x74fd('0x26')](handleEntityNotFound(_0x47be20,null))['then'](respondWithResult(_0x47be20,null))['catch'](handleError(_0x47be20,null));};exports['create']=function(_0x14846b,_0x2dea8f){return db[_0x74fd('0x2c')]['create'](_0x14846b['body'],{})[_0x74fd('0x26')](respondWithResult(_0x2dea8f,0xc9))['catch'](handleError(_0x2dea8f,null));};exports[_0x74fd('0x25')]=function(_0x439978,_0x649148){if(_0x439978[_0x74fd('0x46')]['id']){delete _0x439978[_0x74fd('0x46')]['id'];}return db[_0x74fd('0x2c')][_0x74fd('0x45')]({'where':{'id':_0x439978[_0x74fd('0x42')]['id']}})['then'](handleEntityNotFound(_0x649148,null))['then'](saveUpdates(_0x439978[_0x74fd('0x46')],null))[_0x74fd('0x26')](respondWithResult(_0x649148,null))['catch'](handleError(_0x649148,null));};exports['destroy']=function(_0x227d99,_0x39909e){return db[_0x74fd('0x2c')]['find']({'where':{'id':_0x227d99[_0x74fd('0x42')]['id']}})[_0x74fd('0x26')](handleEntityNotFound(_0x39909e,null))['then'](removeEntity(_0x39909e,null))[_0x74fd('0x47')](handleError(_0x39909e,null));};exports[_0x74fd('0x48')]=function(_0x593c6f,_0x470309){return db['JscriptyAnswerReport'][_0x74fd('0x48')]()[_0x74fd('0x26')](respondWithResult(_0x470309,null))[_0x74fd('0x47')](handleError(_0x470309,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c852301..933c064 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 _0x0b3b=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports'];(function(_0x22e413,_0x8e53ef){var _0x375515=function(_0x5e613e){while(--_0x5e613e){_0x22e413['push'](_0x22e413['shift']());}};_0x375515(++_0x8e53ef);}(_0x0b3b,0x92));var _0xb0b3=function(_0x68cb18,_0x4f528d){_0x68cb18=_0x68cb18-0x0;var _0x15bfae=_0x0b3b[_0x68cb18];return _0x15bfae;};'use strict';var _=require(_0xb0b3('0x0'));var util=require('util');var logger=require(_0xb0b3('0x1'))(_0xb0b3('0x2'));var moment=require(_0xb0b3('0x3'));var BPromise=require(_0xb0b3('0x4'));var rp=require(_0xb0b3('0x5'));var fs=require('fs');var path=require(_0xb0b3('0x6'));var rimraf=require(_0xb0b3('0x7'));var config=require('../../config/environment');var attributes=require(_0xb0b3('0x8'));module[_0xb0b3('0x9')]=function(_0x347ed3,_0x57698e){return _0x347ed3[_0xb0b3('0xa')](_0xb0b3('0xb'),attributes,{'tableName':_0xb0b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 6c8a492..d2954a0 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 _0x03f4=['jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x26a7b8,_0x3ff742){var _0x284699=function(_0x380e38){while(--_0x380e38){_0x26a7b8['push'](_0x26a7b8['shift']());}};_0x284699(++_0x3ff742);}(_0x03f4,0x158));var _0x403f=function(_0x46e598,_0xb16373){_0x46e598=_0x46e598-0x0;var _0x18b5ec=_0x03f4[_0x46e598];return _0x18b5ec;};'use strict';var _=require('lodash');var util=require(_0x403f('0x0'));var moment=require(_0x403f('0x1'));var BPromise=require('bluebird');var rs=require(_0x403f('0x2'));var fs=require('fs');var Redis=require(_0x403f('0x3'));var db=require(_0x403f('0x4'))['db'];var utils=require(_0x403f('0x5'));var logger=require(_0x403f('0x6'))('rpc');var config=require(_0x403f('0x7'));var jayson=require(_0x403f('0x8'));var client=jayson[_0x403f('0x9')][_0x403f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x289bfd,_0x158821,_0x142601){return new BPromise(function(_0x35cb5c,_0x5a4ea){return client[_0x403f('0xb')](_0x289bfd,_0x142601)[_0x403f('0xc')](function(_0x4aa7e4){logger['info'](_0x403f('0xd'),_0x158821,_0x403f('0xe'));logger[_0x403f('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x158821,_0x403f('0xe'),JSON[_0x403f('0x10')](_0x4aa7e4));if(_0x4aa7e4[_0x403f('0x11')]){if(_0x4aa7e4['error']['code']===0x1f4){logger[_0x403f('0x11')](_0x403f('0xd'),_0x158821,_0x4aa7e4[_0x403f('0x11')][_0x403f('0x12')]);return _0x5a4ea(_0x4aa7e4[_0x403f('0x11')][_0x403f('0x12')]);}logger[_0x403f('0x11')](_0x403f('0xd'),_0x158821,_0x4aa7e4[_0x403f('0x11')]['message']);return _0x35cb5c(_0x4aa7e4[_0x403f('0x11')]['message']);}else{logger[_0x403f('0x13')](_0x403f('0xd'),_0x158821,_0x403f('0xe'));_0x35cb5c(_0x4aa7e4[_0x403f('0x14')]['message']);}})[_0x403f('0x15')](function(_0x4d401b){logger[_0x403f('0x11')](_0x403f('0xd'),_0x158821,_0x4d401b);_0x5a4ea(_0x4d401b);});});} \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 96eceb3..a139783 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 _0xaf00=['index','/:id','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x113120,_0x5997ea){var _0x5800de=function(_0x33b987){while(--_0x33b987){_0x113120['push'](_0x113120['shift']());}};_0x5800de(++_0x5997ea);}(_0xaf00,0x133));var _0x0af0=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xaf00[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0x0af0('0x0'));var util=require(_0x0af0('0x1'));var path=require(_0x0af0('0x2'));var timeout=require(_0x0af0('0x3'));var express=require(_0x0af0('0x4'));var router=express[_0x0af0('0x5')]();var fs_extra=require(_0x0af0('0x6'));var auth=require(_0x0af0('0x7'));var interaction=require(_0x0af0('0x8'));var config=require(_0x0af0('0x9'));var controller=require(_0x0af0('0xa'));router[_0x0af0('0xb')]('/',auth['isAuthenticated'](),controller[_0x0af0('0xc')]);router['get'](_0x0af0('0xd'),auth[_0x0af0('0xe')](),controller[_0x0af0('0xf')]);router[_0x0af0('0xb')](_0x0af0('0x10'),auth['isAuthenticated'](),controller[_0x0af0('0x11')]);router['get']('/:id/answers',auth[_0x0af0('0xe')](),controller[_0x0af0('0x12')]);router[_0x0af0('0xb')](_0x0af0('0x13'),auth[_0x0af0('0xe')](),timeout(_0x0af0('0x14')),controller[_0x0af0('0x15')]);router[_0x0af0('0x16')]('/',auth[_0x0af0('0xe')](),controller['create']);router['post'](_0x0af0('0x17'),auth[_0x0af0('0xe')](),controller[_0x0af0('0x18')]);router[_0x0af0('0x19')](_0x0af0('0xd'),auth[_0x0af0('0xe')](),controller[_0x0af0('0x1a')]);router['delete'](_0x0af0('0xd'),auth[_0x0af0('0xe')](),controller[_0x0af0('0x1b')]);module[_0x0af0('0x1c')]=router; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a36e779..655ab83 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 _0xbaf5=['name','TEXT','long','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','STRING'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xbaf5,0x131));var _0x5baf=function(_0x370023,_0x1d4cd){_0x370023=_0x370023-0x0;var _0xf3d3fa=_0xbaf5[_0x370023];return _0xf3d3fa;};'use strict';var Sequelize=require(_0x5baf('0x0'));var _=require('lodash');var util=require(_0x5baf('0x1'));module['exports']={'name':{'type':Sequelize[_0x5baf('0x2')],'unique':_0x5baf('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x5baf('0x4')](_0x5baf('0x5')),'set':function(_0x4e3e14){if(_['isObjectLike'](_0x4e3e14)){this[_0x5baf('0x6')](_0x5baf('0x7'),JSON['stringify'](_0x4e3e14));}else if(_[_0x5baf('0x8')](_0x4e3e14)){this['setDataValue'](_0x5baf('0x7'),_0x4e3e14);}else{this[_0x5baf('0x6')](_0x5baf('0x7'),util[_0x5baf('0x9')](_0x5baf('0xa'),this['getDataValue']('name')||'',this[_0x5baf('0xb')](_0x5baf('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x5baf('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c9313a7..07b114f 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 _0x236c=['save','update','then','destroy','Projects','UserProfileResource','error','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','userProfileId','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','sendStatus','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject'];(function(_0x48ddc9,_0x5af4ac){var _0x2eccd6=function(_0x397713){while(--_0x397713){_0x48ddc9['push'](_0x48ddc9['shift']());}};_0x2eccd6(++_0x5af4ac);}(_0x236c,0x155));var _0xc236=function(_0x5cd2e4,_0x46f785){_0x5cd2e4=_0x5cd2e4-0x0;var _0x4ebf83=_0x236c[_0x5cd2e4];return _0x4ebf83;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){var _0x17cb3b=_0xf921e6['get']({'plain':!![]});var _0x308cd6=_0xc236('0x26');return db[_0xc236('0x27')][_0xc236('0x25')]({'where':{'type':_0x308cd6,'resourceId':_0x17cb3b['id']}})['then'](function(){return _0xf921e6;});})[_0xc236('0x24')](function(){_0x21fab8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ead8,_0x4eace8){return function(_0x36e578){if(!_0x36e578){_0x15ead8['sendStatus'](0x194);}return _0x36e578;};}function handleError(_0x54365,_0x5c79d6){_0x5c79d6=_0x5c79d6||0x1f4;return function(_0x423842){logger[_0xc236('0x28')](_0x423842['stack']);if(_0x423842['name']){delete _0x423842[_0xc236('0x29')];}_0x54365[_0xc236('0x18')](_0x5c79d6)[_0xc236('0x2a')](_0x423842);};}exports[_0xc236('0x2b')]=function(_0x5f3891,_0x4e3262){var _0x28ffa5={},_0x53b767={},_0x2c756f={'count':0x0,'rows':[]};var _0x4ddc87=_[_0xc236('0x2c')](db[_0xc236('0x2d')]['rawAttributes'],function(_0x5a5ec3){return{'name':_0x5a5ec3[_0xc236('0x2e')],'type':_0x5a5ec3[_0xc236('0x2f')][_0xc236('0x30')]};});_0x53b767[_0xc236('0x31')]=_[_0xc236('0x2c')](_0x4ddc87,_0xc236('0x29'));_0x53b767[_0xc236('0x32')]=_[_0xc236('0x33')](_0x5f3891[_0xc236('0x32')]);_0x53b767['filters']=_['intersection'](_0x53b767['model'],_0x53b767[_0xc236('0x32')]);_0x28ffa5[_0xc236('0x34')]=_[_0xc236('0x35')](_0x53b767[_0xc236('0x31')],qs[_0xc236('0x36')](_0x5f3891[_0xc236('0x32')][_0xc236('0x36')]));_0x28ffa5['attributes']=_0x28ffa5[_0xc236('0x34')][_0xc236('0x37')]?_0x28ffa5[_0xc236('0x34')]:_0x53b767['model'];if(!_0x5f3891[_0xc236('0x32')][_0xc236('0x38')](_0xc236('0x39'))){_0x28ffa5[_0xc236('0x3a')]=qs['limit'](_0x5f3891[_0xc236('0x32')][_0xc236('0x3a')]);_0x28ffa5[_0xc236('0x1a')]=qs[_0xc236('0x1a')](_0x5f3891[_0xc236('0x32')][_0xc236('0x1a')]);}_0x28ffa5[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x5f3891[_0xc236('0x32')][_0xc236('0x3c')]);_0x28ffa5[_0xc236('0x3d')]=qs[_0xc236('0x3e')](_[_0xc236('0x3f')](_0x5f3891[_0xc236('0x32')],_0x53b767[_0xc236('0x3e')]),_0x4ddc87);if(_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]){_0x28ffa5['where']=_['merge'](_0x28ffa5['where'],{'$or':_['map'](_0x4ddc87,function(_0x369a79){if(_0x369a79['type']!==_0xc236('0x41')){var _0x361526={};_0x361526[_0x369a79[_0xc236('0x29')]]={'$like':'%'+_0x5f3891[_0xc236('0x32')][_0xc236('0x40')]+'%'};return _0x361526;}})});}_0x28ffa5=_[_0xc236('0x42')]({},_0x28ffa5,_0x5f3891[_0xc236('0x43')]);var _0x201ba3={'where':_0x28ffa5[_0xc236('0x3d')]};return db[_0xc236('0x2d')][_0xc236('0x1c')](_0x201ba3)[_0xc236('0x24')](function(_0x3b2f2f){_0x2c756f[_0xc236('0x1c')]=_0x3b2f2f;if(_0x5f3891[_0xc236('0x32')]['includeAll']){_0x28ffa5[_0xc236('0x44')]=[{'all':!![]}];}return db[_0xc236('0x2d')]['findAll'](_0x28ffa5);})[_0xc236('0x24')](function(_0x5b0bc5){_0x2c756f[_0xc236('0x45')]=_0x5b0bc5;return _0x2c756f;})['then'](respondWithFilteredResult(_0x4e3262,_0x28ffa5))[_0xc236('0x46')](handleError(_0x4e3262,null));};exports[_0xc236('0x47')]=function(_0x8d04c9,_0x479e02){var _0x11e3dd={'raw':![],'where':{'id':_0x8d04c9[_0xc236('0x48')]['id']}},_0x429e08={};_0x429e08['model']=_[_0xc236('0x33')](db[_0xc236('0x2d')][_0xc236('0x49')]);_0x429e08[_0xc236('0x32')]=_[_0xc236('0x33')](_0x8d04c9[_0xc236('0x32')]);_0x429e08['filters']=_[_0xc236('0x35')](_0x429e08['model'],_0x429e08[_0xc236('0x32')]);_0x11e3dd[_0xc236('0x34')]=_[_0xc236('0x35')](_0x429e08[_0xc236('0x31')],qs[_0xc236('0x36')](_0x8d04c9[_0xc236('0x32')][_0xc236('0x36')]));_0x11e3dd['attributes']=_0x11e3dd[_0xc236('0x34')]['length']?_0x11e3dd[_0xc236('0x34')]:_0x429e08[_0xc236('0x31')];if(_0x8d04c9['query'][_0xc236('0x4a')]){_0x11e3dd[_0xc236('0x44')]=[{'all':!![]}];}_0x11e3dd=_[_0xc236('0x42')]({},_0x11e3dd,_0x8d04c9[_0xc236('0x43')]);return db[_0xc236('0x2d')][_0xc236('0x4b')](_0x11e3dd)[_0xc236('0x24')](handleEntityNotFound(_0x479e02,null))['then'](respondWithResult(_0x479e02,null))['catch'](handleError(_0x479e02,null));};exports[_0xc236('0x4c')]=function(_0x2afed2,_0x510f7f){return db[_0xc236('0x2d')][_0xc236('0x4c')](_0x2afed2[_0xc236('0x4d')],{})[_0xc236('0x24')](function(_0x45fa20){var _0x1683f4=_0x2afed2[_0xc236('0x4e')][_0xc236('0x4f')]({'plain':!![]});if(!_0x1683f4)throw new Error(_0xc236('0x50'));if(_0x1683f4['role']===_0xc236('0x4e')){var _0x307663=_0x45fa20[_0xc236('0x4f')]({'plain':!![]});var _0x447a83=_0xc236('0x26');return db[_0xc236('0x51')][_0xc236('0x4b')]({'where':{'name':_0x447a83,'userProfileId':_0x1683f4['userProfileId']},'raw':!![]})[_0xc236('0x24')](function(_0x3788ff){if(_0x3788ff&&_0x3788ff[_0xc236('0x52')]===0x0){return db[_0xc236('0x27')]['create']({'name':_0x307663[_0xc236('0x29')],'resourceId':_0x307663['id'],'type':_0x3788ff[_0xc236('0x29')],'sectionId':_0x3788ff['id']},{})[_0xc236('0x24')](function(){return _0x45fa20;});}else{return _0x45fa20;}})[_0xc236('0x46')](function(_0x9d81c8){logger['error'](_0xc236('0x53'),_0x9d81c8);throw _0x9d81c8;});}return _0x45fa20;})['then'](respondWithResult(_0x510f7f,0xc9))[_0xc236('0x46')](handleError(_0x510f7f,null));};exports[_0xc236('0x54')]=function(_0x3f9e85,_0x15defc){var _0x446b92={'where':{'id':_0x3f9e85['params']['id']}},_0x49ad63={};_0x49ad63[_0xc236('0x31')]=_[_0xc236('0x33')](db[_0xc236('0x2d')][_0xc236('0x49')]);_0x446b92[_0xc236('0x34')]=_[_0xc236('0x35')](_0x49ad63[_0xc236('0x31')],qs[_0xc236('0x36')](_0x3f9e85[_0xc236('0x32')][_0xc236('0x36')]));_0x446b92['attributes']=_0x446b92['attributes'][_0xc236('0x37')]?_0x446b92[_0xc236('0x34')]:_0x49ad63[_0xc236('0x31')];if(_0x3f9e85[_0xc236('0x32')]['includeAll']){_0x446b92[_0xc236('0x44')]=[{'all':!![]}];}_0x446b92=_[_0xc236('0x42')]({},_0x446b92,_0x3f9e85['options']);return db[_0xc236('0x2d')][_0xc236('0x4b')](_0x446b92)[_0xc236('0x24')](handleEntityNotFound(_0x15defc,null))[_0xc236('0x24')](function(_0x5801d6){if(_0x5801d6){var _0x1558dd=_0x5801d6[_0xc236('0x4f')]({'plain':!![]});_0x1558dd=qs[_0xc236('0x55')](_0x1558dd,['id',_0xc236('0x56'),_0xc236('0x57')]);_0x3f9e85[_0xc236('0x4d')]=_[_0xc236('0x55')](_0x3f9e85['body'],['id',_0xc236('0x56'),'updatedAt']);return db[_0xc236('0x2d')][_0xc236('0x4c')](_[_0xc236('0x42')](_0x1558dd,_0x3f9e85[_0xc236('0x4d')]),{'include':_0x3f9e85['query'][_0xc236('0x4a')]?[{'all':!![]}]:undefined})[_0xc236('0x24')](function(_0x379e99){var _0x4ed4fc=_0x3f9e85[_0xc236('0x4e')][_0xc236('0x4f')]({'plain':!![]});if(!_0x4ed4fc)throw new Error(_0xc236('0x50'));if(_0x4ed4fc[_0xc236('0x58')]===_0xc236('0x4e')){var _0x137c24=_0x379e99['get']({'plain':!![]});var _0x59a87c=_0xc236('0x26');return db[_0xc236('0x51')][_0xc236('0x4b')]({'where':{'name':_0x59a87c,'userProfileId':_0x4ed4fc[_0xc236('0x59')]},'raw':!![]})[_0xc236('0x24')](function(_0x4649a3){if(_0x4649a3&&_0x4649a3[_0xc236('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x137c24['name'],'resourceId':_0x137c24['id'],'type':_0x4649a3[_0xc236('0x29')],'sectionId':_0x4649a3['id']},{})[_0xc236('0x24')](function(){return _0x379e99;});}else{return _0x379e99;}})[_0xc236('0x46')](function(_0x2d6b00){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d6b00);throw _0x2d6b00;});}return _0x379e99;});}})['then'](respondWithResult(_0x15defc,0xc9))['catch'](handleError(_0x15defc,null));};exports[_0xc236('0x23')]=function(_0x5df2ba,_0x20a1eb){if(_0x5df2ba['body']['id']){delete _0x5df2ba[_0xc236('0x4d')]['id'];}return db[_0xc236('0x2d')][_0xc236('0x4b')]({'where':{'id':_0x5df2ba[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x20a1eb,null))[_0xc236('0x24')](saveUpdates(_0x5df2ba[_0xc236('0x4d')],null))['then'](respondWithResult(_0x20a1eb,null))[_0xc236('0x46')](handleError(_0x20a1eb,null));};exports['destroy']=function(_0x128e46,_0x24e47a){return db[_0xc236('0x2d')][_0xc236('0x4b')]({'where':{'id':_0x128e46[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x24e47a,null))['then'](removeEntity(_0x24e47a,null))[_0xc236('0x46')](handleError(_0x24e47a,null));};exports[_0xc236('0x5a')]=function(_0x4bb0c6,_0x2fb86f,_0x5f33ec){var _0x11d899={'raw':!![],'where':{}};var _0x4c7846={};var _0x226573={'count':0x0,'rows':[]};return db[_0xc236('0x2d')][_0xc236('0x5b')]({'where':{'id':_0x4bb0c6[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x2fb86f,null))[_0xc236('0x24')](function(_0x30fafb){if(_0x30fafb){_0x4c7846[_0xc236('0x31')]=_[_0xc236('0x33')](db[_0xc236('0x5c')][_0xc236('0x49')]);_0x4c7846[_0xc236('0x32')]=_['keys'](_0x4bb0c6[_0xc236('0x32')]);_0x4c7846[_0xc236('0x3e')]=_[_0xc236('0x35')](_0x4c7846['model'],_0x4c7846[_0xc236('0x32')]);_0x11d899[_0xc236('0x34')]=_[_0xc236('0x35')](_0x4c7846[_0xc236('0x31')],qs['fields'](_0x4bb0c6[_0xc236('0x32')]['fields']));_0x11d899[_0xc236('0x34')]=_0x11d899['attributes'][_0xc236('0x37')]?_0x11d899[_0xc236('0x34')]:_0x4c7846['model'];if(!_0x4bb0c6['query']['hasOwnProperty'](_0xc236('0x39'))){_0x11d899['limit']=qs[_0xc236('0x3a')](_0x4bb0c6[_0xc236('0x32')]['limit']);_0x11d899[_0xc236('0x1a')]=qs[_0xc236('0x1a')](_0x4bb0c6['query'][_0xc236('0x1a')]);}_0x11d899[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x4bb0c6[_0xc236('0x32')]['sort']);_0x11d899[_0xc236('0x3d')]=qs[_0xc236('0x3e')](_[_0xc236('0x3f')](_0x4bb0c6[_0xc236('0x32')],_0x4c7846[_0xc236('0x3e')]));_0x11d899[_0xc236('0x3d')][_0xc236('0x5d')]=_0x30fafb['id'];if(_0x4bb0c6['query']['filter']){_0x11d899[_0xc236('0x3d')]=_[_0xc236('0x42')](_0x11d899[_0xc236('0x3d')],{'$or':_[_0xc236('0x2c')](_0x11d899[_0xc236('0x34')],function(_0x49e417){var _0x8967c={};_0x8967c[_0x49e417]={'$like':'%'+_0x4bb0c6[_0xc236('0x32')]['filter']+'%'};return _0x8967c;})});}_0x11d899=_['merge']({},_0x11d899,_0x4bb0c6[_0xc236('0x43')]);return db['JscriptySessionReport'][_0xc236('0x1c')]({'where':_0x11d899[_0xc236('0x3d')]})[_0xc236('0x24')](function(_0x598397){_0x226573[_0xc236('0x1c')]=_0x598397;if(_0x4bb0c6['query'][_0xc236('0x4a')]){_0x11d899[_0xc236('0x44')]=[{'all':!![]}];}return db[_0xc236('0x5c')][_0xc236('0x5e')](_0x11d899);})['then'](function(_0x41c76d){_0x226573[_0xc236('0x45')]=_0x41c76d;return _0x226573;});}})['then'](respondWithFilteredResult(_0x2fb86f,_0x11d899))[_0xc236('0x46')](handleError(_0x2fb86f,null));};exports[_0xc236('0x5f')]=function(_0x140502,_0x14995f,_0x11684e){var _0x21b21a={'raw':!![],'where':{}};var _0x23a620={};var _0x4e74af={'count':0x0,'rows':[]};return db[_0xc236('0x2d')][_0xc236('0x5b')]({'where':{'id':_0x140502[_0xc236('0x48')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x14995f,null))['then'](function(_0x3646c6){if(_0x3646c6){_0x23a620[_0xc236('0x31')]=_['keys'](db[_0xc236('0x60')]['rawAttributes']);_0x23a620[_0xc236('0x32')]=_[_0xc236('0x33')](_0x140502['query']);_0x23a620[_0xc236('0x3e')]=_[_0xc236('0x35')](_0x23a620['model'],_0x23a620['query']);_0x21b21a[_0xc236('0x34')]=_[_0xc236('0x35')](_0x23a620[_0xc236('0x31')],qs[_0xc236('0x36')](_0x140502[_0xc236('0x32')][_0xc236('0x36')]));_0x21b21a['attributes']=_0x21b21a[_0xc236('0x34')][_0xc236('0x37')]?_0x21b21a[_0xc236('0x34')]:_0x23a620[_0xc236('0x31')];if(!_0x140502['query'][_0xc236('0x38')](_0xc236('0x39'))){_0x21b21a[_0xc236('0x3a')]=qs[_0xc236('0x3a')](_0x140502[_0xc236('0x32')]['limit']);_0x21b21a['offset']=qs[_0xc236('0x1a')](_0x140502['query'][_0xc236('0x1a')]);}_0x21b21a[_0xc236('0x3b')]=qs[_0xc236('0x3c')](_0x140502[_0xc236('0x32')]['sort']);_0x21b21a[_0xc236('0x3d')]=qs['filters'](_[_0xc236('0x3f')](_0x140502['query'],_0x23a620[_0xc236('0x3e')]));_0x21b21a[_0xc236('0x3d')][_0xc236('0x5d')]=_0x3646c6['id'];if(_0x140502[_0xc236('0x32')][_0xc236('0x40')]){_0x21b21a[_0xc236('0x3d')]=_[_0xc236('0x42')](_0x21b21a[_0xc236('0x3d')],{'$or':_[_0xc236('0x2c')](_0x21b21a['attributes'],function(_0x4849a6){var _0x192fdd={};_0x192fdd[_0x4849a6]={'$like':'%'+_0x140502[_0xc236('0x32')][_0xc236('0x40')]+'%'};return _0x192fdd;})});}_0x21b21a=_[_0xc236('0x42')]({},_0x21b21a,_0x140502[_0xc236('0x43')]);return db[_0xc236('0x60')]['count']({'where':_0x21b21a[_0xc236('0x3d')]})[_0xc236('0x24')](function(_0xd7e382){_0x4e74af[_0xc236('0x1c')]=_0xd7e382;if(_0x140502[_0xc236('0x32')][_0xc236('0x4a')]){_0x21b21a[_0xc236('0x44')]=[{'all':!![]}];}return db[_0xc236('0x60')][_0xc236('0x5e')](_0x21b21a);})[_0xc236('0x24')](function(_0x44652e){_0x4e74af[_0xc236('0x45')]=_0x44652e;return _0x4e74af;});}})[_0xc236('0x24')](respondWithFilteredResult(_0x14995f,_0x21b21a))[_0xc236('0x46')](handleError(_0x14995f,null));};function char(_0x475c8f){return'number'===typeof _0x475c8f?String[_0xc236('0x61')][_0xc236('0x20')](null,arguments):_0x475c8f;}function needsEncapsulation(_0x17080e){return!!_0x17080e&&(_0x17080e[_0xc236('0x62')]()[_0xc236('0x63')](char(0xd))>=0x0||_0x17080e['toString']()[_0xc236('0x63')](char(0xa))>=0x0||_0x17080e[_0xc236('0x62')]()[_0xc236('0x63')](char(0x2c))>=0x0||_0x17080e['toString']()[_0xc236('0x63')](char(0x22))>=0x0);}function encapsulate(_0x53576f){var _0x4fcdd7=char(0x22),_0x18f712='\x5c'+char(0x22),_0x436845=_0x53576f[_0xc236('0x62')]()[_0xc236('0x64')](new RegExp(_0x4fcdd7,'g'),_0x18f712);return _0x4fcdd7+_0x436845+_0x4fcdd7;}exports[_0xc236('0x65')]=function(_0x5d8a56,_0x3d413e,_0x2b2df7){var _0x129cdc,_0xb437ed;var _0x18a27d={'where':{'ProjectId':_0x5d8a56['params']['id']}};if(_0x5d8a56['query'][_0xc236('0x66')]){_0x18a27d[_0xc236('0x3d')][_0xc236('0x67')]=JSON[_0xc236('0x68')](_0x5d8a56['query'][_0xc236('0x66')]);}return db[_0xc236('0x5c')][_0xc236('0x5e')](_0x18a27d)[_0xc236('0x24')](handleEntityNotFound(_0x3d413e,null))[_0xc236('0x24')](function(_0x5caa3a){if(_0x5caa3a){_0x129cdc=_0x5caa3a;return db[_0xc236('0x69')][_0xc236('0x5e')]({'where':{'SessionId':{'$in':_[_0xc236('0x2c')](_0x129cdc,'id')},'ProjectId':_0x5d8a56[_0xc236('0x48')]['id']},'order':_0xc236('0x6a')});}})['then'](handleEntityNotFound(_0x3d413e,null))[_0xc236('0x24')](function(_0xd0e1db){if(_0xd0e1db){_0xb437ed=_0xd0e1db;var _0x490ca3={};for(var _0x292dce=0x0,_0x22e724=_0xb437ed[_0xc236('0x37')];_0x292dce<_0x22e724;_0x292dce++){if(!_0x490ca3[_0xc236('0x38')](_0xb437ed[_0x292dce][_0xc236('0x6b')])){_0x490ca3[_0xb437ed[_0x292dce]['questionId']]=needsEncapsulation(_0xb437ed[_0x292dce][_0xc236('0x6c')])?encapsulate(_0xb437ed[_0x292dce][_0xc236('0x6c')]):_0xb437ed[_0x292dce][_0xc236('0x6c')];}}var _0x325b26=[],_0x29c6cc={};for(var _0x3673b6=0x0,_0x5a3500=_0x129cdc[_0xc236('0x37')];_0x3673b6<_0x5a3500;_0x3673b6++){_0x29c6cc={'ProjectId':_0x5d8a56['params']['id'],'SessionId':_0x129cdc[_0x3673b6]['id'],'StartTime':moment(_0x129cdc[_0x3673b6][_0xc236('0x67')])['format'](_0xc236('0x6d'))};for(var _0x5f42aa=0x0,_0x3fda94=_0xb437ed['length'];_0x5f42aa<_0x3fda94;_0x5f42aa++){if(_0xb437ed[_0x5f42aa][_0xc236('0x6e')]==_0x129cdc[_0x3673b6]['id']&&_0x490ca3[_0xc236('0x38')](_0xb437ed[_0x5f42aa][_0xc236('0x6b')])){_0x29c6cc[_0x490ca3[_0xb437ed[_0x5f42aa][_0xc236('0x6b')]]]=_0xb437ed[_0x5f42aa][_0xc236('0x6f')];}}for(var _0x53be06 in _0x490ca3){if(!_0x29c6cc['hasOwnProperty'](_0x490ca3[_0x53be06])){_0x29c6cc[_0x490ca3[_0x53be06]]=null;}}_0x325b26[_0xc236('0x70')](_0x29c6cc);}return _0x325b26;}})[_0xc236('0x24')](function(_0x32d1cc){if(!_[_0xc236('0x71')](_0x32d1cc)){var _0x824919=toCsv(_0x32d1cc);var _0x46d7ef=Date[_0xc236('0x72')]();fs[_0xc236('0x73')](util[_0xc236('0x74')](_0xc236('0x75'),_0x5d8a56[_0xc236('0x48')]['id'],_0x46d7ef),_0x824919);_0x3d413e[_0xc236('0x76')](_0xc236('0x77'),_0xc236('0x78')+util[_0xc236('0x74')](_0xc236('0x79'),_0x5d8a56[_0xc236('0x48')]['id'],_0x46d7ef));_0x3d413e[_0xc236('0x76')](_0xc236('0x7a'),'text/csv');return _0x3d413e[_0xc236('0x7b')](util[_0xc236('0x74')](_0xc236('0x75'),_0x5d8a56['params']['id'],_0x46d7ef));}else{return _0x3d413e[_0xc236('0x7c')](0xcc);}})[_0xc236('0x46')](handleError(_0x3d413e,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ca133a4..e8074f0 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 _0xe5b3=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','util','../../config/logger','api','moment','bluebird'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xe5b3,0x133));var _0x3e5b=function(_0x35b4c6,_0x5e57a2){_0x35b4c6=_0x35b4c6-0x0;var _0xa45f4c=_0xe5b3[_0x35b4c6];return _0xa45f4c;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('JscriptyProject',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 73bc1ca..200acad 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3269a5,_0x531498){var _0x4ab372=function(_0x52e07e){while(--_0x52e07e){_0x3269a5['push'](_0x3269a5['shift']());}};_0x4ab372(++_0x531498);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e2c6491..b2b7bd5 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 _0xb974=['create','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x5d31a1,_0x50e914){var _0x5b9452=function(_0x21c67b){while(--_0x21c67b){_0x5d31a1['push'](_0x5d31a1['shift']());}};_0x5b9452(++_0x50e914);}(_0xb974,0x159));var _0x4b97=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb974[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x4b97('0x0'));var util=require('util');var path=require(_0x4b97('0x1'));var timeout=require(_0x4b97('0x2'));var express=require(_0x4b97('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4b97('0x4'));var interaction=require(_0x4b97('0x5'));var config=require('../../config/environment');var controller=require(_0x4b97('0x6'));router[_0x4b97('0x7')]('/',auth['isAuthenticated'](),controller[_0x4b97('0x8')]);router[_0x4b97('0x7')](_0x4b97('0x9'),auth[_0x4b97('0xa')](),controller[_0x4b97('0xb')]);router['get'](_0x4b97('0xc'),auth['isAuthenticated'](),controller[_0x4b97('0xd')]);router[_0x4b97('0xe')]('/',auth[_0x4b97('0xa')](),controller[_0x4b97('0xf')]);router['put']('/:id',auth[_0x4b97('0xa')](),controller[_0x4b97('0x10')]);router[_0x4b97('0x11')](_0x4b97('0xc'),auth[_0x4b97('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d5225c1..3f9d4d7 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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x7a54,0x106));var _0x47a5=function(_0x5911d0,_0x3a8fc4){_0x5911d0=_0x5911d0-0x0;var _0x18b67f=_0x7a54[_0x5911d0];return _0x18b67f;};'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(_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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 58061d6..6564f06 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 _0x7aef=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','options','JscriptyQuestionReport','includeAll','include','rows','catch','keys','merge','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x7aef,0x149));var _0xf7ae=function(_0x372d60,_0x3ef712){_0x372d60=_0x372d60-0x0;var _0x3405cf=_0x7aef[_0x372d60];return _0x3405cf;};'use strict';var emlformat=require(_0xf7ae('0x0'));var rimraf=require(_0xf7ae('0x1'));var zipdir=require(_0xf7ae('0x2'));var jsonpatch=require(_0xf7ae('0x3'));var rp=require('request-promise');var moment=require(_0xf7ae('0x4'));var BPromise=require(_0xf7ae('0x5'));var Mustache=require(_0xf7ae('0x6'));var util=require(_0xf7ae('0x7'));var path=require(_0xf7ae('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7ae('0x9'));var fs=require('fs');var fs_extra=require(_0xf7ae('0xa'));var _=require(_0xf7ae('0xb'));var squel=require(_0xf7ae('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7ae('0xd'));var deskjs=require(_0xf7ae('0xe'));var toCsv=require(_0xf7ae('0xf'));var querystring=require(_0xf7ae('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf7ae('0x11'));var qs=require(_0xf7ae('0x12'));var as=require(_0xf7ae('0x13'));var hardwareService=require(_0xf7ae('0x14'));var logger=require('../../config/logger')(_0xf7ae('0x15'));var utils=require(_0xf7ae('0x16'));var config=require(_0xf7ae('0x17'));var licenseUtil=require(_0xf7ae('0x18'));var db=require(_0xf7ae('0x19'))['db'];function respondWithStatusCode(_0x44bf86,_0xbcae1a){_0xbcae1a=_0xbcae1a||0xcc;return function(_0x2b777d){if(_0x2b777d){return _0x44bf86[_0xf7ae('0x1a')](_0xbcae1a);}return _0x44bf86[_0xf7ae('0x1b')](_0xbcae1a)[_0xf7ae('0x1c')]();};}function respondWithResult(_0x518535,_0x2184fa){_0x2184fa=_0x2184fa||0xc8;return function(_0x23c179){if(_0x23c179){return _0x518535['status'](_0x2184fa)[_0xf7ae('0x1d')](_0x23c179);}};}function respondWithFilteredResult(_0x568488,_0x28d74d){return function(_0x310e0f){if(_0x310e0f){var _0x4ab32d=typeof _0x28d74d[_0xf7ae('0x1e')]==='undefined'&&typeof _0x28d74d[_0xf7ae('0x1f')]===_0xf7ae('0x20');var _0x297d40=_0x310e0f[_0xf7ae('0x21')];var _0x205fc5=_0x4ab32d?0x0:_0x28d74d[_0xf7ae('0x1e')];var _0x3b4175=_0x4ab32d?_0x310e0f[_0xf7ae('0x21')]:_0x28d74d['offset']+_0x28d74d[_0xf7ae('0x1f')];var _0x35124c;if(_0x3b4175>=_0x297d40){_0x3b4175=_0x297d40;_0x35124c=0xc8;}else{_0x35124c=0xce;}_0x568488[_0xf7ae('0x1b')](_0x35124c);return _0x568488[_0xf7ae('0x22')]('Content-Range',_0x205fc5+'-'+_0x3b4175+'/'+_0x297d40)[_0xf7ae('0x1d')](_0x310e0f);}return null;};}function patchUpdates(_0x3acad3){return function(_0xf2b5c7){try{jsonpatch[_0xf7ae('0x23')](_0xf2b5c7,_0x3acad3,!![]);}catch(_0x2af5ac){return BPromise[_0xf7ae('0x24')](_0x2af5ac);}return _0xf2b5c7[_0xf7ae('0x25')]();};}function saveUpdates(_0x40d3f8,_0x34a47b){return function(_0x713620){if(_0x713620){return _0x713620[_0xf7ae('0x26')](_0x40d3f8)[_0xf7ae('0x27')](function(_0xc91d9d){return _0xc91d9d;});}return null;};}function removeEntity(_0x24bf71,_0x1c8a81){return function(_0x41ece1){if(_0x41ece1){return _0x41ece1[_0xf7ae('0x28')]()[_0xf7ae('0x27')](function(){_0x24bf71[_0xf7ae('0x1b')](0xcc)[_0xf7ae('0x1c')]();});}};}function handleEntityNotFound(_0x40a7f2,_0x173879){return function(_0x3b94d1){if(!_0x3b94d1){_0x40a7f2[_0xf7ae('0x1a')](0x194);}return _0x3b94d1;};}function handleError(_0x5ee79b,_0x1a06a0){_0x1a06a0=_0x1a06a0||0x1f4;return function(_0x17a2e3){logger[_0xf7ae('0x29')](_0x17a2e3[_0xf7ae('0x2a')]);if(_0x17a2e3[_0xf7ae('0x2b')]){delete _0x17a2e3['name'];}_0x5ee79b['status'](_0x1a06a0)[_0xf7ae('0x2c')](_0x17a2e3);};}exports[_0xf7ae('0x2d')]=function(_0x4c6491,_0x507ae3){var _0x3aa946={},_0x31a651={},_0x11f7f5={'count':0x0,'rows':[]};var _0x365f82=_[_0xf7ae('0x2e')](db['JscriptyQuestionReport'][_0xf7ae('0x2f')],function(_0x4d5342){return{'name':_0x4d5342[_0xf7ae('0x30')],'type':_0x4d5342[_0xf7ae('0x31')][_0xf7ae('0x32')]};});_0x31a651[_0xf7ae('0x33')]=_['map'](_0x365f82,'name');_0x31a651[_0xf7ae('0x34')]=_['keys'](_0x4c6491['query']);_0x31a651[_0xf7ae('0x35')]=_[_0xf7ae('0x36')](_0x31a651[_0xf7ae('0x33')],_0x31a651[_0xf7ae('0x34')]);_0x3aa946[_0xf7ae('0x37')]=_['intersection'](_0x31a651[_0xf7ae('0x33')],qs['fields'](_0x4c6491[_0xf7ae('0x34')][_0xf7ae('0x38')]));_0x3aa946[_0xf7ae('0x37')]=_0x3aa946['attributes'][_0xf7ae('0x39')]?_0x3aa946[_0xf7ae('0x37')]:_0x31a651[_0xf7ae('0x33')];if(!_0x4c6491[_0xf7ae('0x34')][_0xf7ae('0x3a')]('nolimit')){_0x3aa946[_0xf7ae('0x1f')]=qs[_0xf7ae('0x1f')](_0x4c6491['query']['limit']);_0x3aa946[_0xf7ae('0x1e')]=qs[_0xf7ae('0x1e')](_0x4c6491[_0xf7ae('0x34')][_0xf7ae('0x1e')]);}_0x3aa946[_0xf7ae('0x3b')]=qs[_0xf7ae('0x3c')](_0x4c6491[_0xf7ae('0x34')][_0xf7ae('0x3c')]);_0x3aa946[_0xf7ae('0x3d')]=qs['filters'](_['pick'](_0x4c6491[_0xf7ae('0x34')],_0x31a651['filters']),_0x365f82);if(_0x4c6491[_0xf7ae('0x34')][_0xf7ae('0x3e')]){_0x3aa946['where']=_['merge'](_0x3aa946['where'],{'$or':_[_0xf7ae('0x2e')](_0x365f82,function(_0x3ef0ad){if(_0x3ef0ad[_0xf7ae('0x31')]!=='VIRTUAL'){var _0x44cd03={};_0x44cd03[_0x3ef0ad[_0xf7ae('0x2b')]]={'$like':'%'+_0x4c6491[_0xf7ae('0x34')][_0xf7ae('0x3e')]+'%'};return _0x44cd03;}})});}_0x3aa946=_['merge']({},_0x3aa946,_0x4c6491[_0xf7ae('0x3f')]);var _0xf0c8f3={'where':_0x3aa946[_0xf7ae('0x3d')]};return db[_0xf7ae('0x40')][_0xf7ae('0x21')](_0xf0c8f3)[_0xf7ae('0x27')](function(_0x22b444){_0x11f7f5['count']=_0x22b444;if(_0x4c6491['query'][_0xf7ae('0x41')]){_0x3aa946[_0xf7ae('0x42')]=[{'all':!![]}];}return db[_0xf7ae('0x40')]['findAll'](_0x3aa946);})[_0xf7ae('0x27')](function(_0x3fd3c1){_0x11f7f5[_0xf7ae('0x43')]=_0x3fd3c1;return _0x11f7f5;})[_0xf7ae('0x27')](respondWithFilteredResult(_0x507ae3,_0x3aa946))[_0xf7ae('0x44')](handleError(_0x507ae3,null));};exports['show']=function(_0x3a73fd,_0x442997){var _0x2fd1a9={'raw':!![],'where':{'id':_0x3a73fd['params']['id']}},_0x221264={};_0x221264[_0xf7ae('0x33')]=_['keys'](db[_0xf7ae('0x40')]['rawAttributes']);_0x221264[_0xf7ae('0x34')]=_[_0xf7ae('0x45')](_0x3a73fd[_0xf7ae('0x34')]);_0x221264[_0xf7ae('0x35')]=_[_0xf7ae('0x36')](_0x221264[_0xf7ae('0x33')],_0x221264[_0xf7ae('0x34')]);_0x2fd1a9[_0xf7ae('0x37')]=_[_0xf7ae('0x36')](_0x221264[_0xf7ae('0x33')],qs[_0xf7ae('0x38')](_0x3a73fd['query'][_0xf7ae('0x38')]));_0x2fd1a9[_0xf7ae('0x37')]=_0x2fd1a9[_0xf7ae('0x37')][_0xf7ae('0x39')]?_0x2fd1a9['attributes']:_0x221264['model'];if(_0x3a73fd[_0xf7ae('0x34')]['includeAll']){_0x2fd1a9[_0xf7ae('0x42')]=[{'all':!![]}];}_0x2fd1a9=_[_0xf7ae('0x46')]({},_0x2fd1a9,_0x3a73fd[_0xf7ae('0x3f')]);return db[_0xf7ae('0x40')]['find'](_0x2fd1a9)[_0xf7ae('0x27')](handleEntityNotFound(_0x442997,null))[_0xf7ae('0x27')](respondWithResult(_0x442997,null))[_0xf7ae('0x44')](handleError(_0x442997,null));};exports[_0xf7ae('0x47')]=function(_0x20dd01,_0x449608){return db[_0xf7ae('0x40')][_0xf7ae('0x47')](_0x20dd01[_0xf7ae('0x48')],{})[_0xf7ae('0x27')](respondWithResult(_0x449608,0xc9))[_0xf7ae('0x44')](handleError(_0x449608,null));};exports[_0xf7ae('0x26')]=function(_0x25b32f,_0x1b6d79){if(_0x25b32f['body']['id']){delete _0x25b32f[_0xf7ae('0x48')]['id'];}return db[_0xf7ae('0x40')][_0xf7ae('0x49')]({'where':{'id':_0x25b32f[_0xf7ae('0x4a')]['id']}})[_0xf7ae('0x27')](handleEntityNotFound(_0x1b6d79,null))[_0xf7ae('0x27')](saveUpdates(_0x25b32f[_0xf7ae('0x48')],null))[_0xf7ae('0x27')](respondWithResult(_0x1b6d79,null))[_0xf7ae('0x44')](handleError(_0x1b6d79,null));};exports['destroy']=function(_0x4620d6,_0x8f473c){return db[_0xf7ae('0x40')]['find']({'where':{'id':_0x4620d6[_0xf7ae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8f473c,null))[_0xf7ae('0x27')](removeEntity(_0x8f473c,null))['catch'](handleError(_0x8f473c,null));};exports[_0xf7ae('0x4b')]=function(_0x26e346,_0x377a13){return db['JscriptyQuestionReport'][_0xf7ae('0x4b')]()[_0xf7ae('0x27')](respondWithResult(_0x377a13,null))[_0xf7ae('0x44')](handleError(_0x377a13,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4bc9360..1df58ea 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 _0xbcab=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x158224,_0x212d92){var _0x365c87=function(_0x218832){while(--_0x218832){_0x158224['push'](_0x158224['shift']());}};_0x365c87(++_0x212d92);}(_0xbcab,0xfc));var _0xbbca=function(_0x21e061,_0x17a04d){_0x21e061=_0x21e061-0x0;var _0xb41b60=_0xbcab[_0x21e061];return _0xb41b60;};'use strict';var _=require(_0xbbca('0x0'));var util=require(_0xbbca('0x1'));var logger=require(_0xbbca('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbbca('0x3'));var rp=require(_0xbbca('0x4'));var fs=require('fs');var path=require(_0xbbca('0x5'));var rimraf=require(_0xbbca('0x6'));var config=require(_0xbbca('0x7'));var attributes=require(_0xbbca('0x8'));module['exports']=function(_0x9205cf,_0x498566){return _0x9205cf[_0xbbca('0x9')](_0xbbca('0xa'),attributes,{'tableName':_0xbbca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 47f4b0c..a7abd30 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 _0x3fc7=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x3fc7,0x1a1));var _0x73fc=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x3fc7[_0x49c057];return _0xd8f0e6;};'use strict';var _=require(_0x73fc('0x0'));var util=require(_0x73fc('0x1'));var moment=require(_0x73fc('0x2'));var BPromise=require('bluebird');var rs=require(_0x73fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73fc('0x4'))['db'];var utils=require(_0x73fc('0x5'));var logger=require(_0x73fc('0x6'))(_0x73fc('0x7'));var config=require(_0x73fc('0x8'));var jayson=require(_0x73fc('0x9'));var client=jayson[_0x73fc('0xa')][_0x73fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f3eef,_0x1dc75c,_0x1fbc0a){return new BPromise(function(_0x330f06,_0x4b55a2){return client[_0x73fc('0xc')](_0x3f3eef,_0x1fbc0a)['then'](function(_0x394936){logger['info'](_0x73fc('0xd'),_0x1dc75c,_0x73fc('0xe'));logger[_0x73fc('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x1dc75c,_0x73fc('0xe'),JSON[_0x73fc('0x10')](_0x394936));if(_0x394936[_0x73fc('0x11')]){if(_0x394936['error']['code']===0x1f4){logger[_0x73fc('0x11')](_0x73fc('0xd'),_0x1dc75c,_0x394936[_0x73fc('0x11')][_0x73fc('0x12')]);return _0x4b55a2(_0x394936[_0x73fc('0x11')]['message']);}logger[_0x73fc('0x11')](_0x73fc('0xd'),_0x1dc75c,_0x394936[_0x73fc('0x11')]['message']);return _0x330f06(_0x394936[_0x73fc('0x11')]['message']);}else{logger[_0x73fc('0x13')](_0x73fc('0xd'),_0x1dc75c,_0x73fc('0xe'));_0x330f06(_0x394936[_0x73fc('0x14')]['message']);}})[_0x73fc('0x15')](function(_0x52fe39){logger[_0x73fc('0x11')](_0x73fc('0xd'),_0x1dc75c,_0x52fe39);_0x4b55a2(_0x52fe39);});});} \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 3f9ed5b..e6e307f 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 _0x39a6=['/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x35d8d7,_0xf8b832){var _0x40d66b=function(_0x5f3bed){while(--_0x5f3bed){_0x35d8d7['push'](_0x35d8d7['shift']());}};_0x40d66b(++_0xf8b832);}(_0x39a6,0x94));var _0x639a=function(_0x2d08a3,_0x172797){_0x2d08a3=_0x2d08a3-0x0;var _0x1a594d=_0x39a6[_0x2d08a3];return _0x1a594d;};'use strict';var multer=require('multer');var util=require(_0x639a('0x0'));var path=require(_0x639a('0x1'));var timeout=require(_0x639a('0x2'));var express=require(_0x639a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x639a('0x4'));var interaction=require(_0x639a('0x5'));var config=require(_0x639a('0x6'));var controller=require(_0x639a('0x7'));router[_0x639a('0x8')]('/',auth[_0x639a('0x9')](),controller[_0x639a('0xa')]);router['get'](_0x639a('0xb'),auth[_0x639a('0x9')](),controller[_0x639a('0xc')]);router[_0x639a('0x8')](_0x639a('0xd'),auth['isAuthenticated'](),controller[_0x639a('0xe')]);router['get'](_0x639a('0xf'),auth['isAuthenticated'](),controller[_0x639a('0x10')]);router[_0x639a('0x11')]('/',auth[_0x639a('0x9')](),controller[_0x639a('0x12')]);router[_0x639a('0x13')](_0x639a('0xd'),auth[_0x639a('0x9')](),controller[_0x639a('0x14')]);router[_0x639a('0x15')](_0x639a('0xd'),auth[_0x639a('0x9')](),controller[_0x639a('0x16')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ad718fa..fa13d47 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 _0x9a2e=['moment','sequelize','exports','setDataValue','endtime','format','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a2e,0xc0));var _0xe9a2=function(_0x1bbab0,_0x24e3f4){_0x1bbab0=_0x1bbab0-0x0;var _0x4b535a=_0x9a2e[_0x1bbab0];return _0x4b535a;};'use strict';var moment=require(_0xe9a2('0x0'));var Sequelize=require(_0xe9a2('0x1'));module[_0xe9a2('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x51fbc7){this['setDataValue']('starttime',_0x51fbc7);this[_0xe9a2('0x3')](_0xe9a2('0x4'),moment()[_0xe9a2('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xe9a2('0x6')]},'projectname':{'type':Sequelize[_0xe9a2('0x6')]},'queue':{'type':Sequelize[_0xe9a2('0x6')]},'uniqueid':{'type':Sequelize[_0xe9a2('0x6')]},'calleridname':{'type':Sequelize[_0xe9a2('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xe9a2('0x7')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9d722bd..58f8add 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 _0x0c64=['query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','options','JscriptySessionReport','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','update','body','describe','getQuestions','findOne','nolimit','pick','JscriptyQuestionReport','includeAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','then','error','stack','send','index','map','fieldName','type','key','name'];(function(_0x1923db,_0xbb8ffe){var _0x2cc013=function(_0x559093){while(--_0x559093){_0x1923db['push'](_0x1923db['shift']());}};_0x2cc013(++_0xbb8ffe);}(_0x0c64,0x1a3));var _0x40c6=function(_0x22644e,_0x1d5168){_0x22644e=_0x22644e-0x0;var _0x27e184=_0x0c64[_0x22644e];return _0x27e184;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40c6('0x0'));var zipdir=require(_0x40c6('0x1'));var jsonpatch=require(_0x40c6('0x2'));var rp=require(_0x40c6('0x3'));var moment=require(_0x40c6('0x4'));var BPromise=require(_0x40c6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x40c6('0x6'));var sox=require('sox');var csv=require(_0x40c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40c6('0x8'));var _=require(_0x40c6('0x9'));var squel=require(_0x40c6('0xa'));var crypto=require(_0x40c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x40c6('0xc'));var toCsv=require(_0x40c6('0x7'));var querystring=require(_0x40c6('0xd'));var Papa=require(_0x40c6('0xe'));var Redis=require(_0x40c6('0xf'));var authService=require(_0x40c6('0x10'));var qs=require(_0x40c6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x40c6('0x12'));var config=require(_0x40c6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x40c6('0x14'))['db'];function respondWithStatusCode(_0x51b1f9,_0xa0452){_0xa0452=_0xa0452||0xcc;return function(_0x37d403){if(_0x37d403){return _0x51b1f9[_0x40c6('0x15')](_0xa0452);}return _0x51b1f9[_0x40c6('0x16')](_0xa0452)[_0x40c6('0x17')]();};}function respondWithResult(_0x4b94d0,_0x51a457){_0x51a457=_0x51a457||0xc8;return function(_0x34199a){if(_0x34199a){return _0x4b94d0[_0x40c6('0x16')](_0x51a457)[_0x40c6('0x18')](_0x34199a);}};}function respondWithFilteredResult(_0x3c4832,_0x2a636c){return function(_0x37a828){if(_0x37a828){var _0x455314=typeof _0x2a636c[_0x40c6('0x19')]===_0x40c6('0x1a')&&typeof _0x2a636c[_0x40c6('0x1b')]===_0x40c6('0x1a');var _0x28a0ef=_0x37a828[_0x40c6('0x1c')];var _0x2dbf56=_0x455314?0x0:_0x2a636c[_0x40c6('0x19')];var _0x30f831=_0x455314?_0x37a828[_0x40c6('0x1c')]:_0x2a636c[_0x40c6('0x19')]+_0x2a636c[_0x40c6('0x1b')];var _0x178527;if(_0x30f831>=_0x28a0ef){_0x30f831=_0x28a0ef;_0x178527=0xc8;}else{_0x178527=0xce;}_0x3c4832[_0x40c6('0x16')](_0x178527);return _0x3c4832[_0x40c6('0x1d')]('Content-Range',_0x2dbf56+'-'+_0x30f831+'/'+_0x28a0ef)['json'](_0x37a828);}return null;};}function patchUpdates(_0x24d17e){return function(_0x15d36c){try{jsonpatch[_0x40c6('0x1e')](_0x15d36c,_0x24d17e,!![]);}catch(_0x57a22b){return BPromise['reject'](_0x57a22b);}return _0x15d36c[_0x40c6('0x1f')]();};}function saveUpdates(_0x2e8fe2,_0x47d895){return function(_0x3e8238){if(_0x3e8238){return _0x3e8238['update'](_0x2e8fe2)['then'](function(_0x41b88d){return _0x41b88d;});}return null;};}function removeEntity(_0x1193be,_0x583bf8){return function(_0x44aa84){if(_0x44aa84){return _0x44aa84[_0x40c6('0x20')]()[_0x40c6('0x21')](function(){_0x1193be[_0x40c6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57cf80,_0xf2a1ce){return function(_0x4c02f8){if(!_0x4c02f8){_0x57cf80[_0x40c6('0x15')](0x194);}return _0x4c02f8;};}function handleError(_0xdb0113,_0x4ad111){_0x4ad111=_0x4ad111||0x1f4;return function(_0x405fd5){logger[_0x40c6('0x22')](_0x405fd5[_0x40c6('0x23')]);if(_0x405fd5['name']){delete _0x405fd5['name'];}_0xdb0113[_0x40c6('0x16')](_0x4ad111)[_0x40c6('0x24')](_0x405fd5);};}exports[_0x40c6('0x25')]=function(_0x3b3243,_0x3bb03d){var _0x4836af={},_0x1c294e={},_0x3a8aa7={'count':0x0,'rows':[]};var _0x1f6de4=_[_0x40c6('0x26')](db['JscriptySessionReport']['rawAttributes'],function(_0x48bb04){return{'name':_0x48bb04[_0x40c6('0x27')],'type':_0x48bb04[_0x40c6('0x28')][_0x40c6('0x29')]};});_0x1c294e['model']=_[_0x40c6('0x26')](_0x1f6de4,_0x40c6('0x2a'));_0x1c294e[_0x40c6('0x2b')]=_['keys'](_0x3b3243['query']);_0x1c294e['filters']=_[_0x40c6('0x2c')](_0x1c294e[_0x40c6('0x2d')],_0x1c294e[_0x40c6('0x2b')]);_0x4836af[_0x40c6('0x2e')]=_[_0x40c6('0x2c')](_0x1c294e[_0x40c6('0x2d')],qs['fields'](_0x3b3243[_0x40c6('0x2b')][_0x40c6('0x2f')]));_0x4836af['attributes']=_0x4836af['attributes'][_0x40c6('0x30')]?_0x4836af[_0x40c6('0x2e')]:_0x1c294e[_0x40c6('0x2d')];if(!_0x3b3243[_0x40c6('0x2b')][_0x40c6('0x31')]('nolimit')){_0x4836af[_0x40c6('0x1b')]=qs[_0x40c6('0x1b')](_0x3b3243[_0x40c6('0x2b')]['limit']);_0x4836af['offset']=qs[_0x40c6('0x19')](_0x3b3243[_0x40c6('0x2b')]['offset']);}_0x4836af[_0x40c6('0x32')]=qs[_0x40c6('0x33')](_0x3b3243[_0x40c6('0x2b')]['sort']);_0x4836af['where']=qs['filters'](_['pick'](_0x3b3243['query'],_0x1c294e[_0x40c6('0x34')]),_0x1f6de4);if(_0x3b3243['query'][_0x40c6('0x35')]){_0x4836af[_0x40c6('0x36')]=_[_0x40c6('0x37')](_0x4836af[_0x40c6('0x36')],{'$or':_['map'](_0x1f6de4,function(_0x2065cc){if(_0x2065cc[_0x40c6('0x28')]!=='VIRTUAL'){var _0x1df21c={};_0x1df21c[_0x2065cc['name']]={'$like':'%'+_0x3b3243[_0x40c6('0x2b')][_0x40c6('0x35')]+'%'};return _0x1df21c;}})});}_0x4836af=_[_0x40c6('0x37')]({},_0x4836af,_0x3b3243[_0x40c6('0x38')]);var _0x30f32c={'where':_0x4836af[_0x40c6('0x36')]};return db[_0x40c6('0x39')][_0x40c6('0x1c')](_0x30f32c)['then'](function(_0x39ce28){_0x3a8aa7[_0x40c6('0x1c')]=_0x39ce28;if(_0x3b3243[_0x40c6('0x2b')]['includeAll']){_0x4836af[_0x40c6('0x3a')]=[{'all':!![]}];}return db[_0x40c6('0x39')][_0x40c6('0x3b')](_0x4836af);})['then'](function(_0x4b3631){_0x3a8aa7[_0x40c6('0x3c')]=_0x4b3631;return _0x3a8aa7;})[_0x40c6('0x21')](respondWithFilteredResult(_0x3bb03d,_0x4836af))['catch'](handleError(_0x3bb03d,null));};exports[_0x40c6('0x3d')]=function(_0x158825,_0x13ee84){var _0x25f562={'raw':!![],'where':{'id':_0x158825[_0x40c6('0x3e')]['id']}},_0x54f749={};_0x54f749[_0x40c6('0x2d')]=_[_0x40c6('0x3f')](db[_0x40c6('0x39')][_0x40c6('0x40')]);_0x54f749['query']=_[_0x40c6('0x3f')](_0x158825[_0x40c6('0x2b')]);_0x54f749['filters']=_['intersection'](_0x54f749[_0x40c6('0x2d')],_0x54f749[_0x40c6('0x2b')]);_0x25f562['attributes']=_['intersection'](_0x54f749[_0x40c6('0x2d')],qs[_0x40c6('0x2f')](_0x158825[_0x40c6('0x2b')]['fields']));_0x25f562[_0x40c6('0x2e')]=_0x25f562[_0x40c6('0x2e')][_0x40c6('0x30')]?_0x25f562[_0x40c6('0x2e')]:_0x54f749[_0x40c6('0x2d')];if(_0x158825[_0x40c6('0x2b')]['includeAll']){_0x25f562[_0x40c6('0x3a')]=[{'all':!![]}];}_0x25f562=_[_0x40c6('0x37')]({},_0x25f562,_0x158825['options']);return db[_0x40c6('0x39')][_0x40c6('0x41')](_0x25f562)[_0x40c6('0x21')](handleEntityNotFound(_0x13ee84,null))[_0x40c6('0x21')](respondWithResult(_0x13ee84,null))[_0x40c6('0x42')](handleError(_0x13ee84,null));};exports[_0x40c6('0x43')]=function(_0x5490e3,_0x4b81cf){return db[_0x40c6('0x39')][_0x40c6('0x43')](_0x5490e3['body'],{})['then'](respondWithResult(_0x4b81cf,0xc9))['catch'](handleError(_0x4b81cf,null));};exports[_0x40c6('0x44')]=function(_0x15cb5c,_0x258b4f){if(_0x15cb5c[_0x40c6('0x45')]['id']){delete _0x15cb5c[_0x40c6('0x45')]['id'];}return db[_0x40c6('0x39')][_0x40c6('0x41')]({'where':{'id':_0x15cb5c['params']['id']}})[_0x40c6('0x21')](handleEntityNotFound(_0x258b4f,null))[_0x40c6('0x21')](saveUpdates(_0x15cb5c[_0x40c6('0x45')],null))[_0x40c6('0x21')](respondWithResult(_0x258b4f,null))[_0x40c6('0x42')](handleError(_0x258b4f,null));};exports['destroy']=function(_0x490145,_0x76c1fb){return db[_0x40c6('0x39')][_0x40c6('0x41')]({'where':{'id':_0x490145[_0x40c6('0x3e')]['id']}})[_0x40c6('0x21')](handleEntityNotFound(_0x76c1fb,null))[_0x40c6('0x21')](removeEntity(_0x76c1fb,null))[_0x40c6('0x42')](handleError(_0x76c1fb,null));};exports[_0x40c6('0x46')]=function(_0x2dbe63,_0x5d3a1c){return db[_0x40c6('0x39')][_0x40c6('0x46')]()[_0x40c6('0x21')](respondWithResult(_0x5d3a1c,null))[_0x40c6('0x42')](handleError(_0x5d3a1c,null));};exports[_0x40c6('0x47')]=function(_0xfdea29,_0x982ef2,_0x2ffd05){var _0x46e973={'raw':!![],'where':{}};var _0x4bcf4c={};var _0x534472={'count':0x0,'rows':[]};return db[_0x40c6('0x39')][_0x40c6('0x48')]({'where':{'id':_0xfdea29[_0x40c6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x982ef2,null))[_0x40c6('0x21')](function(_0x1cee21){if(_0x1cee21){_0x4bcf4c[_0x40c6('0x2d')]=_[_0x40c6('0x3f')](db['JscriptyQuestionReport']['rawAttributes']);_0x4bcf4c[_0x40c6('0x2b')]=_[_0x40c6('0x3f')](_0xfdea29[_0x40c6('0x2b')]);_0x4bcf4c[_0x40c6('0x34')]=_[_0x40c6('0x2c')](_0x4bcf4c[_0x40c6('0x2d')],_0x4bcf4c[_0x40c6('0x2b')]);_0x46e973[_0x40c6('0x2e')]=_['intersection'](_0x4bcf4c[_0x40c6('0x2d')],qs[_0x40c6('0x2f')](_0xfdea29['query'][_0x40c6('0x2f')]));_0x46e973[_0x40c6('0x2e')]=_0x46e973[_0x40c6('0x2e')][_0x40c6('0x30')]?_0x46e973[_0x40c6('0x2e')]:_0x4bcf4c[_0x40c6('0x2d')];if(!_0xfdea29['query'][_0x40c6('0x31')](_0x40c6('0x49'))){_0x46e973['limit']=qs[_0x40c6('0x1b')](_0xfdea29[_0x40c6('0x2b')][_0x40c6('0x1b')]);_0x46e973[_0x40c6('0x19')]=qs['offset'](_0xfdea29[_0x40c6('0x2b')][_0x40c6('0x19')]);}_0x46e973[_0x40c6('0x32')]=qs['sort'](_0xfdea29[_0x40c6('0x2b')]['sort']);_0x46e973[_0x40c6('0x36')]=qs['filters'](_[_0x40c6('0x4a')](_0xfdea29['query'],_0x4bcf4c[_0x40c6('0x34')]));_0x46e973[_0x40c6('0x36')]['SessionId']=_0x1cee21['id'];if(_0xfdea29[_0x40c6('0x2b')]['filter']){_0x46e973[_0x40c6('0x36')]=_[_0x40c6('0x37')](_0x46e973[_0x40c6('0x36')],{'$or':_['map'](_0x46e973[_0x40c6('0x2e')],function(_0x39a503){var _0x4a86de={};_0x4a86de[_0x39a503]={'$like':'%'+_0xfdea29['query']['filter']+'%'};return _0x4a86de;})});}_0x46e973=_[_0x40c6('0x37')]({},_0x46e973,_0xfdea29['options']);return db[_0x40c6('0x4b')][_0x40c6('0x1c')]({'where':_0x46e973[_0x40c6('0x36')]})[_0x40c6('0x21')](function(_0x2f130d){_0x534472[_0x40c6('0x1c')]=_0x2f130d;if(_0xfdea29['query'][_0x40c6('0x4c')]){_0x46e973[_0x40c6('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x40c6('0x3b')](_0x46e973);})[_0x40c6('0x21')](function(_0x440d2e){_0x534472[_0x40c6('0x3c')]=_0x440d2e;return _0x534472;});}})[_0x40c6('0x21')](respondWithFilteredResult(_0x982ef2,_0x46e973))['catch'](handleError(_0x982ef2,null));}; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 75b6fe9..e0c00f3 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 _0x6c7b=['path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','request-promise'];(function(_0x3bce26,_0x3aa048){var _0x22aa30=function(_0x5806d7){while(--_0x5806d7){_0x3bce26['push'](_0x3bce26['shift']());}};_0x22aa30(++_0x3aa048);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x109568,_0x5d5318){_0x109568=_0x109568-0x0;var _0x37c8e3=_0x6c7b[_0x109568];return _0x37c8e3;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('JscriptySessionReport',attributes,{'tableName':_0xb6c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 00b410f..5938870 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2f5dad,_0x4313ad){var _0x38e02d=function(_0x44833a){while(--_0x44833a){_0x2f5dad['push'](_0x2f5dad['shift']());}};_0x38e02d(++_0x4313ad);}(_0xadb5,0xad));var _0x5adb=function(_0x3cf2fe,_0x4585c4){_0x3cf2fe=_0x3cf2fe-0x0;var _0x58836d=_0xadb5[_0x3cf2fe];return _0x58836d;};'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']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _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 diff --git a/server/api/license/index.js b/server/api/license/index.js index a9c5bca..d8d2d56 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 _0xe835=['isAuthenticated','update','downloadLogFile','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id'];(function(_0x4ce0d2,_0x3cc836){var _0x5c3ead=function(_0x548d92){while(--_0x548d92){_0x4ce0d2['push'](_0x4ce0d2['shift']());}};_0x5c3ead(++_0x3cc836);}(_0xe835,0xe1));var _0x5e83=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0xe835[_0x334599];return _0x4cdff2;};'use strict';var multer=require(_0x5e83('0x0'));var util=require(_0x5e83('0x1'));var path=require(_0x5e83('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e83('0x3'));var router=express[_0x5e83('0x4')]();var fs_extra=require(_0x5e83('0x5'));var auth=require(_0x5e83('0x6'));var interaction=require(_0x5e83('0x7'));var config=require('../../config/environment');var controller=require(_0x5e83('0x8'));router[_0x5e83('0x9')]('/',controller[_0x5e83('0xa')]);router[_0x5e83('0xb')](_0x5e83('0xc'),auth[_0x5e83('0xd')](),controller[_0x5e83('0xe')]);router[_0x5e83('0x9')]('/download_log_file',auth[_0x5e83('0xd')](),controller[_0x5e83('0xf')]);module[_0x5e83('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6ea0d84..31b8b6e 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 _0x9101=['exports','TEXT','INTEGER','sequelize'];(function(_0x1884c4,_0x5b9ec5){var _0x5bbb16=function(_0x76e935){while(--_0x76e935){_0x1884c4['push'](_0x1884c4['shift']());}};_0x5bbb16(++_0x5b9ec5);}(_0x9101,0x16b));var _0x1910=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9101[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x1910('0x0'));module[_0x1910('0x1')]={'license':{'type':Sequelize[_0x1910('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1910('0x3')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index c150d65..b9f4188 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 _0xc549=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','name','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','params','get','key','demo','downloadLogFile','join','log','xcally','setHeader','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5c3056,_0x4b5bca){var _0x2d3393=function(_0x28612d){while(--_0x28612d){_0x5c3056['push'](_0x5c3056['shift']());}};_0x2d3393(++_0x4b5bca);}(_0xc549,0x1a5));var _0x9c54=function(_0x30ca49,_0x4fcc34){_0x30ca49=_0x30ca49-0x0;var _0x5d4195=_0xc549[_0x30ca49];return _0x5d4195;};'use strict';var emlformat=require(_0x9c54('0x0'));var rimraf=require(_0x9c54('0x1'));var zipdir=require(_0x9c54('0x2'));var jsonpatch=require(_0x9c54('0x3'));var rp=require(_0x9c54('0x4'));var moment=require(_0x9c54('0x5'));var BPromise=require(_0x9c54('0x6'));var Mustache=require(_0x9c54('0x7'));var util=require(_0x9c54('0x8'));var path=require(_0x9c54('0x9'));var sox=require(_0x9c54('0xa'));var csv=require(_0x9c54('0xb'));var ejs=require(_0x9c54('0xc'));var fs=require('fs');var fs_extra=require(_0x9c54('0xd'));var _=require(_0x9c54('0xe'));var squel=require(_0x9c54('0xf'));var crypto=require(_0x9c54('0x10'));var jsforce=require(_0x9c54('0x11'));var deskjs=require(_0x9c54('0x12'));var toCsv=require(_0x9c54('0xb'));var querystring=require(_0x9c54('0x13'));var Papa=require(_0x9c54('0x14'));var Redis=require(_0x9c54('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c54('0x16'));var logger=require(_0x9c54('0x17'))(_0x9c54('0x18'));var utils=require(_0x9c54('0x19'));var config=require(_0x9c54('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c54('0x1b'))['db'];function respondWithStatusCode(_0x5f8f28,_0x2c7236){_0x2c7236=_0x2c7236||0xcc;return function(_0x26879f){if(_0x26879f){return _0x5f8f28[_0x9c54('0x1c')](_0x2c7236);}return _0x5f8f28[_0x9c54('0x1d')](_0x2c7236)[_0x9c54('0x1e')]();};}function respondWithResult(_0x5db4ad,_0x49f52e){_0x49f52e=_0x49f52e||0xc8;return function(_0x23124f){if(_0x23124f){return _0x5db4ad['status'](_0x49f52e)[_0x9c54('0x1f')](_0x23124f);}};}function respondWithFilteredResult(_0x102f5e,_0x5bfa6f){return function(_0x26e2b6){if(_0x26e2b6){var _0xcd3188=typeof _0x5bfa6f[_0x9c54('0x20')]===_0x9c54('0x21')&&typeof _0x5bfa6f['limit']==='undefined';var _0xeed017=_0x26e2b6[_0x9c54('0x22')];var _0x1bc06a=_0xcd3188?0x0:_0x5bfa6f['offset'];var _0x32ecd4=_0xcd3188?_0x26e2b6[_0x9c54('0x22')]:_0x5bfa6f['offset']+_0x5bfa6f['limit'];var _0x18e162;if(_0x32ecd4>=_0xeed017){_0x32ecd4=_0xeed017;_0x18e162=0xc8;}else{_0x18e162=0xce;}_0x102f5e[_0x9c54('0x1d')](_0x18e162);return _0x102f5e[_0x9c54('0x23')]('Content-Range',_0x1bc06a+'-'+_0x32ecd4+'/'+_0xeed017)['json'](_0x26e2b6);}return null;};}function patchUpdates(_0x1ff42d){return function(_0x3cc254){try{jsonpatch[_0x9c54('0x24')](_0x3cc254,_0x1ff42d,!![]);}catch(_0x536a24){return BPromise[_0x9c54('0x25')](_0x536a24);}return _0x3cc254[_0x9c54('0x26')]();};}function saveUpdates(_0x34f94c,_0x20a6dc){return function(_0xb1005d){if(_0xb1005d){return _0xb1005d['update'](_0x34f94c)[_0x9c54('0x27')](function(_0x1b3636){return _0x1b3636;});}return null;};}function removeEntity(_0x20fd95,_0x2e7482){return function(_0x4fb4c2){if(_0x4fb4c2){return _0x4fb4c2[_0x9c54('0x28')]()[_0x9c54('0x27')](function(){_0x20fd95[_0x9c54('0x1d')](0xcc)[_0x9c54('0x1e')]();});}};}function handleEntityNotFound(_0x85e260,_0x221a20){return function(_0x25e62d){if(!_0x25e62d){_0x85e260['sendStatus'](0x194);}return _0x25e62d;};}function handleError(_0x1fe1fc,_0x3d18f2){_0x3d18f2=_0x3d18f2||0x1f4;return function(_0x559771){logger['error'](_0x559771['stack']);if(_0x559771[_0x9c54('0x29')]){delete _0x559771[_0x9c54('0x29')];}_0x1fe1fc[_0x9c54('0x1d')](_0x3d18f2)[_0x9c54('0x2a')](_0x559771);};}var utilLicense=require(_0x9c54('0x2b'));exports[_0x9c54('0x2c')]=function(_0x4897f6,_0x426560){var _0x29e322={'raw':!![],'where':{'id':0x1}},_0x5691eb={};_0x5691eb['model']=_[_0x9c54('0x2d')](db[_0x9c54('0x2e')][_0x9c54('0x2f')]);_0x5691eb[_0x9c54('0x30')]=_[_0x9c54('0x2d')](_0x4897f6[_0x9c54('0x30')]);_0x5691eb[_0x9c54('0x31')]=_[_0x9c54('0x32')](_0x5691eb[_0x9c54('0x33')],_0x5691eb[_0x9c54('0x30')]);_0x29e322[_0x9c54('0x34')]=_[_0x9c54('0x32')](_0x5691eb[_0x9c54('0x33')],qs[_0x9c54('0x35')](_0x4897f6[_0x9c54('0x30')][_0x9c54('0x35')]));_0x29e322[_0x9c54('0x34')]=_0x29e322[_0x9c54('0x34')][_0x9c54('0x36')]?_0x29e322[_0x9c54('0x34')]:_0x5691eb['model'];_0x29e322=_[_0x9c54('0x37')]({},_0x29e322,_0x4897f6[_0x9c54('0x38')]);return utilLicense[_0x9c54('0x39')](_0x29e322)[_0x9c54('0x27')](respondWithResult(_0x426560,null))[_0x9c54('0x3a')](handleError(_0x426560,null));};exports['update']=function(_0x122713,_0x3171bc){if(_0x122713['body']['id']){delete _0x122713[_0x9c54('0x3b')]['id'];}return db[_0x9c54('0x2e')]['find']({'where':{'id':_0x122713[_0x9c54('0x3c')]['id']}})[_0x9c54('0x27')](handleEntityNotFound(_0x3171bc,null))[_0x9c54('0x27')](function(_0xcc4951){var _0xd6258d=_0xcc4951[_0x9c54('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0xd6258d,_0x122713[_0x9c54('0x3b')][_0x9c54('0x3e')]);})[_0x9c54('0x27')](function(_0x5644f8){if(!_0x5644f8[_0x9c54('0x3f')]){return saveUpdates(_0x122713['body'],null);}return _0x5644f8;})[_0x9c54('0x27')](respondWithResult(_0x3171bc,null))[_0x9c54('0x3a')](handleError(_0x3171bc,null));};exports[_0x9c54('0x40')]=function(_0x59f8d8,_0x5338dc){var _0x2c3c4d='license-info.log';var _0xa0fa29=path[_0x9c54('0x41')]('/var',_0x9c54('0x42'),_0x9c54('0x43'),_0x2c3c4d);_0x5338dc[_0x9c54('0x44')]('Content-disposition',_0x9c54('0x45')+_0x2c3c4d);_0x5338dc[_0x9c54('0x23')]('Content-Type',_0x9c54('0x46'));_0x5338dc[_0x9c54('0x47')](_0xa0fa29);}; \ No newline at end of file +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 diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index cd7da65..1c0fb17 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 _0xff39=['path','rimraf','../../config/environment','./license.attributes','define','License','license','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x15f3c0,_0x165a64){var _0x1adfe0=function(_0x212cfc){while(--_0x212cfc){_0x15f3c0['push'](_0x15f3c0['shift']());}};_0x1adfe0(++_0x165a64);}(_0xff39,0x173));var _0x9ff3=function(_0x36b2c5,_0x5eaf9a){_0x36b2c5=_0x36b2c5-0x0;var _0x919462=_0xff39[_0x36b2c5];return _0x919462;};'use strict';var _=require(_0x9ff3('0x0'));var util=require(_0x9ff3('0x1'));var logger=require(_0x9ff3('0x2'))('api');var moment=require(_0x9ff3('0x3'));var BPromise=require(_0x9ff3('0x4'));var rp=require(_0x9ff3('0x5'));var fs=require('fs');var path=require(_0x9ff3('0x6'));var rimraf=require(_0x9ff3('0x7'));var config=require(_0x9ff3('0x8'));var attributes=require(_0x9ff3('0x9'));module['exports']=function(_0x25a816,_0x493ff0){return _0x25a816[_0x9ff3('0xa')](_0x9ff3('0xb'),attributes,{'tableName':_0x9ff3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 16d8380..1f89efc 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 _0x1784=['stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d9acd,_0x4c4c24){var _0x406239=function(_0x2957c5){while(--_0x2957c5){_0x3d9acd['push'](_0x3d9acd['shift']());}};_0x406239(++_0x4c4c24);}(_0x1784,0x10f));var _0x4178=function(_0x571dbc,_0x400df9){_0x571dbc=_0x571dbc-0x0;var _0x55043c=_0x1784[_0x571dbc];return _0x55043c;};'use strict';var _=require(_0x4178('0x0'));var util=require(_0x4178('0x1'));var moment=require(_0x4178('0x2'));var BPromise=require('bluebird');var rs=require(_0x4178('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4178('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4178('0x5'));var jayson=require(_0x4178('0x6'));var client=jayson[_0x4178('0x7')][_0x4178('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ddfea,_0x2f319a,_0x593d6d){return new BPromise(function(_0x2ba74e,_0x517978){return client['request'](_0x1ddfea,_0x593d6d)[_0x4178('0x9')](function(_0x14207f){logger[_0x4178('0xa')](_0x4178('0xb'),_0x2f319a,_0x4178('0xc'));logger[_0x4178('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x2f319a,'request\x20sent',JSON[_0x4178('0xe')](_0x14207f));if(_0x14207f[_0x4178('0xf')]){if(_0x14207f[_0x4178('0xf')][_0x4178('0x10')]===0x1f4){logger['error'](_0x4178('0xb'),_0x2f319a,_0x14207f[_0x4178('0xf')][_0x4178('0x11')]);return _0x517978(_0x14207f['error']['message']);}logger['error'](_0x4178('0xb'),_0x2f319a,_0x14207f[_0x4178('0xf')][_0x4178('0x11')]);return _0x2ba74e(_0x14207f['error']['message']);}else{logger['info'](_0x4178('0xb'),_0x2f319a,_0x4178('0xc'));_0x2ba74e(_0x14207f['result'][_0x4178('0x11')]);}})[_0x4178('0x12')](function(_0x252487){logger[_0x4178('0xf')](_0x4178('0xb'),_0x2f319a,_0x252487);_0x517978(_0x252487);});});} \ No newline at end of file +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 diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 766d35d..bcbcecf 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 _0x8efe=['/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getMessages','/:id/verify','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','/:id/applications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailAccount.controller','get'];(function(_0x15296a,_0x5aa7d4){var _0x492793=function(_0x424b22){while(--_0x424b22){_0x15296a['push'](_0x15296a['shift']());}};_0x492793(++_0x5aa7d4);}(_0x8efe,0x14f));var _0xe8ef=function(_0x210a6b,_0x29bb5b){_0x210a6b=_0x210a6b-0x0;var _0x309ef6=_0x8efe[_0x210a6b];return _0x309ef6;};'use strict';var multer=require(_0xe8ef('0x0'));var util=require(_0xe8ef('0x1'));var path=require(_0xe8ef('0x2'));var timeout=require(_0xe8ef('0x3'));var express=require(_0xe8ef('0x4'));var router=express[_0xe8ef('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8ef('0x6'));var controller=require(_0xe8ef('0x7'));router[_0xe8ef('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe8ef('0x8')](_0xe8ef('0x9'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0xb')]);router[_0xe8ef('0x8')](_0xe8ef('0xc'),auth[_0xe8ef('0xa')](),controller['show']);router[_0xe8ef('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe8ef('0xd')]);router[_0xe8ef('0x8')](_0xe8ef('0xe'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0xf')]);router[_0xe8ef('0x8')](_0xe8ef('0x10'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x11')]);router[_0xe8ef('0x8')]('/:id/out_servers',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x12')]);router[_0xe8ef('0x8')](_0xe8ef('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe8ef('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xe8ef('0x8')]('/:id/messages',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x14')]);router[_0xe8ef('0x8')](_0xe8ef('0x15'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x16')]);router[_0xe8ef('0x8')](_0xe8ef('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe8ef('0x18')](_0xe8ef('0x19'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x1a')]);router[_0xe8ef('0x18')]('/:id/canned_answers',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x1b')]);router[_0xe8ef('0x18')]('/',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x1c')]);router[_0xe8ef('0x18')]('/:id/in_servers',auth[_0xe8ef('0xa')](),controller['addImap']);router[_0xe8ef('0x18')](_0xe8ef('0x1d'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x1e')]);router[_0xe8ef('0x18')]('/:id/interactions',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x1f')]);router[_0xe8ef('0x18')](_0xe8ef('0x20'),auth[_0xe8ef('0xa')](),controller['addApplications']);router[_0xe8ef('0x18')]('/:id/send',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x21')]);router[_0xe8ef('0x18')]('/:id/users',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x22')]);router[_0xe8ef('0x23')](_0xe8ef('0xc'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x24')]);router[_0xe8ef('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe8ef('0x26')]);router[_0xe8ef('0x25')](_0xe8ef('0xe'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x27')]);router[_0xe8ef('0x25')](_0xe8ef('0x10'),auth['isAuthenticated'](),controller[_0xe8ef('0x28')]);router[_0xe8ef('0x25')](_0xe8ef('0x1d'),auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x29')]);router[_0xe8ef('0x25')](_0xe8ef('0xc'),auth[_0xe8ef('0xa')](),controller['destroy']);router[_0xe8ef('0x25')]('/:id/users',auth[_0xe8ef('0xa')](),controller[_0xe8ef('0x2a')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 03e026e..f8a4d8b 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 _0xb09d=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xb09d,0x149));var _0xdb09=function(_0x5394b8,_0x2f2942){_0x5394b8=_0x5394b8-0x0;var _0x31e29d=_0xb09d[_0x5394b8];return _0x31e29d;};'use strict';var Sequelize=require(_0xdb09('0x0'));module[_0xdb09('0x1')]={'description':{'type':Sequelize[_0xdb09('0x2')]},'name':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdb09('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xdb09('0x4')]},'markAsUnread':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xdb09('0x5')](0x2)[_0xdb09('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdb09('0x4')],'defaultValue':function(){return _0xdb09('0x7');}},'notificationSound':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdb09('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdb09('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdb09('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdb09('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xdb09('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xdb09('0x3')],'defaultValue':![],'comment':_0xdb09('0x9'),'set':function(_0x4dd9cb){if(!_0x4dd9cb)this[_0xdb09('0xa')](_0xdb09('0xb'),null);this[_0xdb09('0xa')](_0xdb09('0xc'),_0x4dd9cb);}},'provider':{'type':Sequelize[_0xdb09('0xd')](_0xdb09('0xe'),_0xdb09('0xf'),_0xdb09('0x10'),_0xdb09('0x11')),'defaultValue':null,'get':function(){if(!this[_0xdb09('0x12')](_0xdb09('0x13')))return _0xdb09('0x14');return this['getDataValue'](_0xdb09('0x13'));},'set':function(_0x27906d){if(_0x27906d==='custom')_0x27906d=null;return this['setDataValue']('provider',_0x27906d);}}}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 593b443..bc445b9 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 _0xa304=['email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','MailAccounts','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','attachments','join','root','server/files/attachments','getSmtpOptions','sendMail','List\x20not\x20found','defaults','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','update','destroy','UserProfileResource','stack','name','status','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','modernAuthentication','CloudProviderId','password','pass','host','port','secure','service','authentication','username','Imap','Smtp','index','MailServerOut','Pause','MailAccount','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','body','provider','params','MailServerIn','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xa304,0x113));var _0x4a30=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xa304[_0x3cb152];return _0x4f54c3;};'use strict';var moment=require(_0x4a30('0x0'));var BPromise=require(_0x4a30('0x1'));var util=require(_0x4a30('0x2'));var path=require(_0x4a30('0x3'));var _=require(_0x4a30('0x4'));var juice=require(_0x4a30('0x5'));var Redis=require(_0x4a30('0x6'));var qs=require(_0x4a30('0x7'));var logger=require('../../config/logger')(_0x4a30('0x8'));var config=require(_0x4a30('0x9'));var db=require(_0x4a30('0xa'))['db'];config['redis']=_['defaults'](config[_0x4a30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a30('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x4a30('0xd'));var client=jayson[_0x4a30('0xe')][_0x4a30('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x434859,_0x4de6f9,_0x1098d4,_0x4b03a9){return new BPromise(function(_0x40a9cb,_0x7c19a3){var _0x535c25=_0x4b03a9||client;return _0x535c25[_0x4a30('0x10')](_0x434859,_0x1098d4)[_0x4a30('0x11')](function(_0x125c69){logger[_0x4a30('0x12')](_0x4a30('0x13'),_0x4de6f9,_0x4a30('0x14'));logger['debug'](_0x4a30('0x15'),_0x4de6f9,_0x4a30('0x14'),JSON[_0x4a30('0x16')](_0x125c69));if(_0x125c69[_0x4a30('0x17')]){if(_0x125c69['error']['code']===0x1f4){logger[_0x4a30('0x17')](_0x4a30('0x13'),_0x4de6f9,_0x125c69[_0x4a30('0x17')][_0x4a30('0x18')]);return _0x7c19a3(_0x125c69[_0x4a30('0x17')]['message']);}logger[_0x4a30('0x17')]('MailAccount,\x20%s,\x20%s',_0x4de6f9,_0x125c69['error'][_0x4a30('0x18')]);return _0x40a9cb(_0x125c69[_0x4a30('0x17')][_0x4a30('0x18')]);}else{logger[_0x4a30('0x12')]('MailAccount,\x20%s,\x20%s',_0x4de6f9,_0x4a30('0x14'));_0x40a9cb(_0x125c69[_0x4a30('0x19')]['message']);}})[_0x4a30('0x1a')](function(_0xc256f8){logger[_0x4a30('0x17')](_0x4a30('0x13'),_0x4de6f9,_0xc256f8);_0x7c19a3(_0xc256f8);});});}function respondWithStatusCode(_0x18942d,_0x4ef0b9){_0x4ef0b9=_0x4ef0b9||0xcc;return function(_0x5828c0){if(_0x5828c0){return _0x18942d[_0x4a30('0x1b')](_0x4ef0b9);}return _0x18942d['status'](_0x4ef0b9)[_0x4a30('0x1c')]();};}function respondWithResult(_0x36ed6e,_0x1dc5d1){_0x1dc5d1=_0x1dc5d1||0xc8;return function(_0xb33dbb){if(_0xb33dbb){return _0x36ed6e['status'](_0x1dc5d1)[_0x4a30('0x1d')](_0xb33dbb);}};}function respondWithFilteredResult(_0x26c21f,_0x45fab7){return function(_0xc22008){if(_0xc22008){var _0x456698=typeof _0x45fab7[_0x4a30('0x1e')]===_0x4a30('0x1f')&&typeof _0x45fab7[_0x4a30('0x20')]==='undefined';var _0x3b2848=_0xc22008[_0x4a30('0x21')];var _0x163a3a=_0x456698?0x0:_0x45fab7['offset'];var _0x4d83de=_0x456698?_0xc22008[_0x4a30('0x21')]:_0x45fab7[_0x4a30('0x1e')]+_0x45fab7[_0x4a30('0x20')];var _0x5c8c59;if(_0x4d83de>=_0x3b2848){_0x4d83de=_0x3b2848;_0x5c8c59=0xc8;}else{_0x5c8c59=0xce;}_0x26c21f['status'](_0x5c8c59);return _0x26c21f[_0x4a30('0x22')]('Content-Range',_0x163a3a+'-'+_0x4d83de+'/'+_0x3b2848)[_0x4a30('0x1d')](_0xc22008);}return null;};}function saveUpdates(_0x4a12c1){return function(_0x4c4094){if(_0x4c4094){return _0x4c4094[_0x4a30('0x23')](_0x4a12c1)[_0x4a30('0x11')](function(_0x55739e){return _0x55739e;});}return null;};}function removeEntity(_0x327021){return function(_0x422ce4){if(_0x422ce4){return _0x422ce4[_0x4a30('0x24')]()['then'](function(){var _0x5938a3=_0x422ce4['get']({'plain':!![]});var _0xe63e76='MailAccounts';return db[_0x4a30('0x25')][_0x4a30('0x24')]({'where':{'type':_0xe63e76,'resourceId':_0x5938a3['id']}})[_0x4a30('0x11')](function(){return _0x422ce4;});})[_0x4a30('0x11')](function(){_0x327021['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x155541){return function(_0x37ee0a){if(!_0x37ee0a){_0x155541[_0x4a30('0x1b')](0x194);}return _0x37ee0a;};}function handleError(_0x58df40,_0x60c8f3){_0x60c8f3=_0x60c8f3||0x1f4;return function(_0x1bfd33){logger[_0x4a30('0x17')](_0x1bfd33[_0x4a30('0x26')]);if(_0x1bfd33['name']){delete _0x1bfd33[_0x4a30('0x27')];}_0x58df40[_0x4a30('0x28')](_0x60c8f3)[_0x4a30('0x29')](_0x1bfd33);};}function getImapHost(_0x21043c){switch(_0x21043c){case _0x4a30('0x2a'):return _0x4a30('0x2b');case _0x4a30('0x2c'):return _0x4a30('0x2d');case'hotmail':return _0x4a30('0x2e');case'outlook365':return _0x4a30('0x2f');}throw new Error(_0x4a30('0x30'),_0x21043c);}function getSmtpHost(_0x43443a){switch(_0x43443a){case'gmail':return'smtp.gmail.com';case _0x4a30('0x2c'):return _0x4a30('0x31');case'hotmail':return'smtp-mail.outlook.com';case _0x4a30('0x32'):return _0x4a30('0x33');}throw new Error(_0x4a30('0x30'),_0x43443a);}function getAuthenticationOptions(_0xcbe39a,_0x1487d7){var _0x55b153={};var _0x2dd371={};if(_0xcbe39a){_0x55b153[_0x4a30('0x34')]=_0x2dd371[_0x4a30('0x34')]=_0x1487d7['username'];_0x55b153['password']=_0x2dd371['pass']=_0x1487d7['password'];if(_0x1487d7[_0x4a30('0x35')]){_0x55b153[_0x4a30('0x35')]=_0x2dd371[_0x4a30('0x35')]=!![];_0x55b153[_0x4a30('0x36')]=_0x2dd371[_0x4a30('0x36')]=_0x1487d7[_0x4a30('0x36')];_0x55b153[_0x4a30('0x37')]=_0x2dd371[_0x4a30('0x38')]=null;}else{_0x55b153[_0x4a30('0x36')]=_0x2dd371[_0x4a30('0x36')]=null;}_0x55b153[_0x4a30('0x39')]=getImapHost(_0xcbe39a);_0x55b153['port']=0x3e1;_0x2dd371[_0x4a30('0x39')]=getSmtpHost(_0xcbe39a);_0x2dd371[_0x4a30('0x3a')]=0x24b;_0x2dd371[_0x4a30('0x3b')]=![];_0x55b153['service']=_0x2dd371[_0x4a30('0x3c')]=null;}else{if(_0x1487d7[_0x4a30('0x3d')]){_0x55b153[_0x4a30('0x34')]=_0x2dd371[_0x4a30('0x34')]=_0x1487d7[_0x4a30('0x3e')];_0x55b153['password']=_0x2dd371[_0x4a30('0x38')]=_0x1487d7['password'];}else{_0x55b153['authentication']=_0x2dd371['authentication']=![];_0x55b153[_0x4a30('0x34')]=_0x2dd371['user']=null;_0x55b153['password']=_0x2dd371[_0x4a30('0x38')]=null;}_0x55b153[_0x4a30('0x39')]=_0x1487d7[_0x4a30('0x3f')][_0x4a30('0x39')];_0x55b153[_0x4a30('0x3a')]=_0x1487d7[_0x4a30('0x3f')][_0x4a30('0x3a')];_0x2dd371[_0x4a30('0x39')]=_0x1487d7[_0x4a30('0x40')][_0x4a30('0x39')];_0x2dd371[_0x4a30('0x3a')]=_0x1487d7[_0x4a30('0x40')][_0x4a30('0x3a')];}return{'Imap':_0x55b153,'Smtp':_0x2dd371};}exports[_0x4a30('0x41')]=function(_0x2bbeba,_0x41e281){var _0x1be847={'include':[{'model':db['MailServerIn'],'as':_0x4a30('0x3f')},{'model':db[_0x4a30('0x42')],'as':_0x4a30('0x40')},{'model':db[_0x4a30('0x43')],'as':'mandatoryDispositionPause'}]},_0x2d7f89={},_0x55f173={'count':0x0,'rows':[]};var _0x57ebf0=_['map'](db[_0x4a30('0x44')]['rawAttributes'],function(_0x4f1d72){return{'name':_0x4f1d72[_0x4a30('0x45')],'type':_0x4f1d72[_0x4a30('0x46')][_0x4a30('0x47')]};});_0x2d7f89[_0x4a30('0x48')]=_[_0x4a30('0x49')](_0x57ebf0,'name');_0x2d7f89[_0x4a30('0x4a')]=_['keys'](_0x2bbeba[_0x4a30('0x4a')]);_0x2d7f89[_0x4a30('0x4b')]=_[_0x4a30('0x4c')](_0x2d7f89[_0x4a30('0x48')],_0x2d7f89['query']);_0x1be847[_0x4a30('0x4d')]=_['intersection'](_0x2d7f89[_0x4a30('0x48')],qs[_0x4a30('0x4e')](_0x2bbeba[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0x1be847[_0x4a30('0x4d')]=_0x1be847[_0x4a30('0x4d')]['length']?_0x1be847['attributes']:_0x2d7f89[_0x4a30('0x48')];if(!_0x2bbeba[_0x4a30('0x4a')]['hasOwnProperty'](_0x4a30('0x4f'))){_0x1be847['limit']=qs[_0x4a30('0x20')](_0x2bbeba[_0x4a30('0x4a')][_0x4a30('0x20')]);_0x1be847[_0x4a30('0x1e')]=qs[_0x4a30('0x1e')](_0x2bbeba[_0x4a30('0x4a')][_0x4a30('0x1e')]);}_0x1be847[_0x4a30('0x50')]=qs[_0x4a30('0x51')](_0x2bbeba[_0x4a30('0x4a')]['sort']);_0x1be847[_0x4a30('0x52')]=qs['filters'](_[_0x4a30('0x53')](_0x2bbeba[_0x4a30('0x4a')],_0x2d7f89['filters']),_0x57ebf0);if(_0x2bbeba[_0x4a30('0x4a')][_0x4a30('0x54')]){_0x1be847[_0x4a30('0x52')]=_[_0x4a30('0x55')](_0x1be847[_0x4a30('0x52')],{'$or':_[_0x4a30('0x49')](_0x57ebf0,function(_0x59f600){if(_0x59f600[_0x4a30('0x46')]!==_0x4a30('0x56')){var _0x4e6d5c={};_0x4e6d5c[_0x59f600[_0x4a30('0x27')]]={'$like':'%'+_0x2bbeba[_0x4a30('0x4a')][_0x4a30('0x54')]+'%'};return _0x4e6d5c;}})});}_0x1be847=_[_0x4a30('0x55')]({},_0x1be847,_0x2bbeba[_0x4a30('0x57')]);var _0x567835={'where':_0x1be847[_0x4a30('0x52')]};return db[_0x4a30('0x44')]['count'](_0x567835)[_0x4a30('0x11')](function(_0x4bb74c){_0x55f173[_0x4a30('0x21')]=_0x4bb74c;if(_0x2bbeba['query']['includeAll']){_0x1be847[_0x4a30('0x58')]=[{'all':!![]}];}return db['MailAccount'][_0x4a30('0x59')](_0x1be847);})[_0x4a30('0x11')](function(_0x41c928){_0x55f173[_0x4a30('0x5a')]=_0x41c928;return _0x55f173;})['then'](respondWithFilteredResult(_0x41e281,_0x1be847))['catch'](handleError(_0x41e281,null));};exports[_0x4a30('0x5b')]=function(_0x1c0526,_0x51c2dd){var _0x2cc27d={'raw':![],'where':{'id':_0x1c0526['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x4a30('0x3f')},{'model':db['MailServerOut'],'as':_0x4a30('0x40')},{'model':db[_0x4a30('0x43')],'as':'mandatoryDispositionPause'}]},_0x502abf={};_0x502abf[_0x4a30('0x48')]=_['keys'](db['MailAccount']['rawAttributes']);_0x502abf[_0x4a30('0x4a')]=_[_0x4a30('0x5c')](_0x1c0526[_0x4a30('0x4a')]);_0x502abf[_0x4a30('0x4b')]=_[_0x4a30('0x4c')](_0x502abf[_0x4a30('0x48')],_0x502abf[_0x4a30('0x4a')]);_0x2cc27d[_0x4a30('0x4d')]=_[_0x4a30('0x4c')](_0x502abf['model'],qs['fields'](_0x1c0526['query'][_0x4a30('0x4e')]));_0x2cc27d[_0x4a30('0x4d')]=_0x2cc27d[_0x4a30('0x4d')][_0x4a30('0x5d')]?_0x2cc27d['attributes']:_0x502abf[_0x4a30('0x48')];if(_0x1c0526[_0x4a30('0x4a')][_0x4a30('0x5e')]){_0x2cc27d[_0x4a30('0x58')]=[{'all':!![]}];}_0x2cc27d=_[_0x4a30('0x55')]({},_0x2cc27d,_0x1c0526[_0x4a30('0x57')]);return db[_0x4a30('0x44')][_0x4a30('0x5f')](_0x2cc27d)[_0x4a30('0x11')](handleEntityNotFound(_0x51c2dd,null))[_0x4a30('0x11')](respondWithResult(_0x51c2dd,null))['catch'](handleError(_0x51c2dd,null));};exports[_0x4a30('0x23')]=function(_0x4b4c49,_0x31bb6e){if(_0x4b4c49['body']['id']){delete _0x4b4c49[_0x4a30('0x60')]['id'];}var _0x4fe8a0=_0x4b4c49[_0x4a30('0x60')][_0x4a30('0x61')]==='custom'?null:_0x4b4c49[_0x4a30('0x60')]['provider'];var _0x2df494=_0x4b4c49['body'][_0x4a30('0x3f')]||{};var _0x3fe30d=_0x4b4c49['body'][_0x4a30('0x40')]||{};if(_0x4fe8a0){_0x2df494['host']=getImapHost(_0x4fe8a0);_0x2df494[_0x4a30('0x3a')]=0x3e1;_0x3fe30d[_0x4a30('0x39')]=getSmtpHost(_0x4fe8a0);_0x3fe30d[_0x4a30('0x3a')]=0x24b;_0x3fe30d['secure']=![];}if(_0x3fe30d[_0x4a30('0x35')]){_0x3fe30d[_0x4a30('0x3b')]=![];}else{_0x3fe30d[_0x4a30('0x36')]=null;}if(!_0x2df494[_0x4a30('0x35')])_0x2df494[_0x4a30('0x36')]=null;_0x4b4c49['body'][_0x4a30('0x3f')]=_0x2df494;_0x4b4c49[_0x4a30('0x60')][_0x4a30('0x40')]=_0x3fe30d;return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x4b4c49[_0x4a30('0x62')]['id']},'include':[{'model':db[_0x4a30('0x63')],'as':_0x4a30('0x3f')},{'model':db['MailServerOut'],'as':_0x4a30('0x40')},{'model':db[_0x4a30('0x43')],'as':_0x4a30('0x64')}]})[_0x4a30('0x11')](handleEntityNotFound(_0x31bb6e,null))[_0x4a30('0x11')](function(_0x5154a6){if(!_0x5154a6)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5154a6[_0x4a30('0x3c')])delete _0x4b4c49[_0x4a30('0x60')]['Imap'];return _0x5154a6;})[_0x4a30('0x11')](saveUpdates(_0x4b4c49[_0x4a30('0x60')],null))[_0x4a30('0x11')](function(_0x147cb8){if(!_0x4b4c49[_0x4a30('0x60')][_0x4a30('0x3f')])return _0x147cb8;return db[_0x4a30('0x63')][_0x4a30('0x23')](_0x4b4c49[_0x4a30('0x60')][_0x4a30('0x3f')],{'where':{'MailAccountId':_0x147cb8['id']}})[_0x4a30('0x11')](function(){return _0x147cb8;});})[_0x4a30('0x11')](function(_0x638d86){if(!_0x4b4c49[_0x4a30('0x60')][_0x4a30('0x40')])return _0x638d86;return db[_0x4a30('0x42')][_0x4a30('0x23')](_0x4b4c49[_0x4a30('0x60')][_0x4a30('0x40')],{'where':{'MailAccountId':_0x638d86['id']}})['then'](function(){return _0x638d86;});})[_0x4a30('0x11')](respondWithResult(_0x31bb6e,null))[_0x4a30('0x1a')](handleError(_0x31bb6e,null));};exports[_0x4a30('0x65')]=function(_0x1eee89,_0x39c2d3){return db[_0x4a30('0x44')][_0x4a30('0x65')]()['then'](respondWithResult(_0x39c2d3,null))[_0x4a30('0x1a')](handleError(_0x39c2d3,null));};exports[_0x4a30('0x66')]=function(_0x59606b,_0x4afebd){if(_0x59606b[_0x4a30('0x60')]['id']){delete _0x59606b[_0x4a30('0x60')]['id'];}return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x59606b[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x4afebd,null))['then'](function(_0x2658df){if(_0x2658df){_0x59606b['body'][_0x4a30('0x67')]=_0x2658df['id'];return db[_0x4a30('0x68')][_0x4a30('0x69')](_0x59606b[_0x4a30('0x60')]);}})[_0x4a30('0x11')](respondWithResult(_0x4afebd,null))['catch'](handleError(_0x4afebd,null));};exports[_0x4a30('0x6a')]=function(_0x23267a,_0x2bdc15){var _0x56e628={'raw':![],'where':{}};var _0x36b717={};var _0x40fc67={'count':0x0,'rows':[]};return db[_0x4a30('0x44')][_0x4a30('0x6b')]({'where':{'id':_0x23267a['params']['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x2bdc15,null))[_0x4a30('0x11')](function(_0x358e1e){if(_0x358e1e){_0x36b717['model']=_[_0x4a30('0x5c')](db[_0x4a30('0x68')][_0x4a30('0x6c')]);_0x36b717['query']=_[_0x4a30('0x5c')](_0x23267a[_0x4a30('0x4a')]);_0x36b717[_0x4a30('0x4b')]=_[_0x4a30('0x4c')](_0x36b717[_0x4a30('0x48')],_0x36b717[_0x4a30('0x4a')]);_0x56e628[_0x4a30('0x4d')]=_['intersection'](_0x36b717['model'],qs[_0x4a30('0x4e')](_0x23267a[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0x56e628[_0x4a30('0x4d')]=_0x56e628['attributes'][_0x4a30('0x5d')]?_0x56e628['attributes']:_0x36b717[_0x4a30('0x48')];if(!_0x23267a[_0x4a30('0x4a')][_0x4a30('0x6d')](_0x4a30('0x4f'))){_0x56e628['limit']=qs['limit'](_0x23267a[_0x4a30('0x4a')]['limit']);_0x56e628['offset']=qs[_0x4a30('0x1e')](_0x23267a['query'][_0x4a30('0x1e')]);}_0x56e628[_0x4a30('0x50')]=qs[_0x4a30('0x51')](_0x23267a[_0x4a30('0x4a')]['sort']);_0x56e628[_0x4a30('0x52')]=qs[_0x4a30('0x4b')](_[_0x4a30('0x53')](_0x23267a[_0x4a30('0x4a')],_0x36b717[_0x4a30('0x4b')]));_0x56e628[_0x4a30('0x52')]['MailAccountId']=_0x358e1e['id'];if(_0x23267a[_0x4a30('0x4a')]['filter']){_0x56e628[_0x4a30('0x52')]=_[_0x4a30('0x55')](_0x56e628[_0x4a30('0x52')],{'$or':_[_0x4a30('0x49')](_0x56e628[_0x4a30('0x4d')],function(_0x47c21a){var _0x1ee5a1={};_0x1ee5a1[_0x47c21a]={'$like':'%'+_0x23267a['query'][_0x4a30('0x54')]+'%'};return _0x1ee5a1;})});}_0x56e628=_[_0x4a30('0x55')]({},_0x56e628,_0x23267a[_0x4a30('0x57')]);return db[_0x4a30('0x68')][_0x4a30('0x21')]({'where':_0x56e628[_0x4a30('0x52')]})[_0x4a30('0x11')](function(_0x14a8fe){_0x40fc67[_0x4a30('0x21')]=_0x14a8fe;if(_0x23267a[_0x4a30('0x4a')]['includeAll']){_0x56e628[_0x4a30('0x58')]=[{'all':!![]}];}return db[_0x4a30('0x68')][_0x4a30('0x59')](_0x56e628);})[_0x4a30('0x11')](function(_0x448327){_0x40fc67[_0x4a30('0x5a')]=_0x448327;return _0x40fc67;});}})[_0x4a30('0x11')](respondWithFilteredResult(_0x2bdc15,_0x56e628))[_0x4a30('0x1a')](handleError(_0x2bdc15,null));};exports[_0x4a30('0x6e')]=function(_0x475ee3,_0x1655b7){return db[_0x4a30('0x44')]['find']({'where':{'id':_0x475ee3[_0x4a30('0x62')]['id']}})['then'](handleEntityNotFound(_0x1655b7,null))['then'](function(_0xb1dae2){if(_0xb1dae2){return _0xb1dae2[_0x4a30('0x6e')](_0x475ee3[_0x4a30('0x4a')][_0x4a30('0x6f')]);}})[_0x4a30('0x11')](respondWithStatusCode(_0x1655b7,null))[_0x4a30('0x1a')](handleError(_0x1655b7,null));};exports['addAnswer']=function(_0x5f3dca,_0x26ea17){if(_0x5f3dca[_0x4a30('0x60')]['id']){delete _0x5f3dca[_0x4a30('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x5f3dca[_0x4a30('0x62')]['id']}})['then'](handleEntityNotFound(_0x26ea17,null))[_0x4a30('0x11')](function(_0x5885fe){if(_0x5885fe){_0x5f3dca['body'][_0x4a30('0x67')]=_0x5885fe['id'];return db[_0x4a30('0x70')][_0x4a30('0x69')](_0x5f3dca[_0x4a30('0x60')]);}})['then'](respondWithResult(_0x26ea17,null))[_0x4a30('0x1a')](handleError(_0x26ea17,null));};exports[_0x4a30('0x71')]=function(_0x983871,_0x5086ac){var _0x20e161={'raw':![],'where':{}};var _0x860dd0={};var _0xe67c4b={'count':0x0,'rows':[]};return db[_0x4a30('0x44')]['findOne']({'where':{'id':_0x983871[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x5086ac,null))['then'](function(_0x27b801){if(_0x27b801){_0x860dd0['model']=_[_0x4a30('0x5c')](db['CannedAnswer'][_0x4a30('0x6c')]);_0x860dd0[_0x4a30('0x4a')]=_[_0x4a30('0x5c')](_0x983871[_0x4a30('0x4a')]);_0x860dd0[_0x4a30('0x4b')]=_[_0x4a30('0x4c')](_0x860dd0[_0x4a30('0x48')],_0x860dd0[_0x4a30('0x4a')]);_0x20e161[_0x4a30('0x4d')]=_[_0x4a30('0x4c')](_0x860dd0[_0x4a30('0x48')],qs[_0x4a30('0x4e')](_0x983871[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0x20e161[_0x4a30('0x4d')]=_0x20e161[_0x4a30('0x4d')][_0x4a30('0x5d')]?_0x20e161['attributes']:_0x860dd0[_0x4a30('0x48')];if(!_0x983871[_0x4a30('0x4a')][_0x4a30('0x6d')](_0x4a30('0x4f'))){_0x20e161[_0x4a30('0x20')]=qs['limit'](_0x983871['query']['limit']);_0x20e161['offset']=qs[_0x4a30('0x1e')](_0x983871['query'][_0x4a30('0x1e')]);}_0x20e161[_0x4a30('0x50')]=qs[_0x4a30('0x51')](_0x983871[_0x4a30('0x4a')][_0x4a30('0x51')]);_0x20e161[_0x4a30('0x52')]=qs[_0x4a30('0x4b')](_[_0x4a30('0x53')](_0x983871[_0x4a30('0x4a')],_0x860dd0[_0x4a30('0x4b')]));_0x20e161[_0x4a30('0x52')][_0x4a30('0x67')]=_0x27b801['id'];if(_0x983871[_0x4a30('0x4a')]['filter']){_0x20e161[_0x4a30('0x52')]=_[_0x4a30('0x55')](_0x20e161[_0x4a30('0x52')],{'$or':_['map'](_0x20e161[_0x4a30('0x4d')],function(_0x13e67d){var _0x31a0d8={};_0x31a0d8[_0x13e67d]={'$like':'%'+_0x983871[_0x4a30('0x4a')][_0x4a30('0x54')]+'%'};return _0x31a0d8;})});}_0x20e161=_[_0x4a30('0x55')]({},_0x20e161,_0x983871['options']);return db[_0x4a30('0x70')][_0x4a30('0x21')]({'where':_0x20e161['where']})[_0x4a30('0x11')](function(_0x2fa082){_0xe67c4b[_0x4a30('0x21')]=_0x2fa082;if(_0x983871[_0x4a30('0x4a')][_0x4a30('0x5e')]){_0x20e161[_0x4a30('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4a30('0x59')](_0x20e161);})[_0x4a30('0x11')](function(_0x3e0f7e){_0xe67c4b[_0x4a30('0x5a')]=_0x3e0f7e;return _0xe67c4b;});}})['then'](respondWithFilteredResult(_0x5086ac,_0x20e161))['catch'](handleError(_0x5086ac,null));};exports[_0x4a30('0x72')]=function(_0x1efdfc,_0xb157b){return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x1efdfc['params']['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0xb157b,null))[_0x4a30('0x11')](function(_0x42bdad){if(_0x42bdad){return _0x42bdad[_0x4a30('0x72')](_0x1efdfc[_0x4a30('0x4a')][_0x4a30('0x6f')]);}})['then'](respondWithStatusCode(_0xb157b,null))[_0x4a30('0x1a')](handleError(_0xb157b,null));};exports[_0x4a30('0x69')]=function(_0x263f41,_0x408157){var _0x46c264={'name':_0x263f41[_0x4a30('0x60')][_0x4a30('0x27')],'key':_0x263f41[_0x4a30('0x60')][_0x4a30('0x47')],'provider':_0x263f41[_0x4a30('0x60')]['provider']==='custom'?null:_0x263f41[_0x4a30('0x60')][_0x4a30('0x61')],'email':_0x263f41[_0x4a30('0x60')][_0x4a30('0x73')],'ListId':_0x263f41['body'][_0x4a30('0x74')],'active':!_['isNil'](_0x263f41['body'][_0x4a30('0x75')])?_0x263f41[_0x4a30('0x60')][_0x4a30('0x75')]:!![],'description':_0x263f41[_0x4a30('0x60')][_0x4a30('0x76')]||null};var _0x4362d7=getAuthenticationOptions(_0x46c264[_0x4a30('0x61')],_0x263f41[_0x4a30('0x60')]);_0x46c264[_0x4a30('0x3f')]=_0x4362d7[_0x4a30('0x3f')];_0x46c264[_0x4a30('0x40')]=_0x4362d7['Smtp'];return db[_0x4a30('0x44')][_0x4a30('0x69')](_0x46c264,{'include':[{'model':db[_0x4a30('0x42')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})['then'](function(_0x731d3c){var _0x555c53=_0x263f41[_0x4a30('0x34')]['get']({'plain':!![]});if(!_0x555c53)throw new Error(_0x4a30('0x77'));if(_0x555c53['role']===_0x4a30('0x34')){var _0x5d090c=_0x731d3c[_0x4a30('0x78')]({'plain':!![]});return db[_0x4a30('0x79')]['find']({'where':{'name':_0x4a30('0x7a'),'userProfileId':_0x555c53[_0x4a30('0x7b')]},'raw':!![]})[_0x4a30('0x11')](function(_0x2b6a94){if(_0x2b6a94&&_0x2b6a94['autoAssociation']===0x0){return db['UserProfileResource'][_0x4a30('0x69')]({'name':_0x5d090c[_0x4a30('0x27')],'resourceId':_0x5d090c['id'],'type':_0x2b6a94[_0x4a30('0x27')],'sectionId':_0x2b6a94['id']},{})['then'](function(){return _0x731d3c;});}else{return _0x731d3c;}})['catch'](function(_0xd976df){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd976df);throw _0xd976df;});}return _0x731d3c;})[_0x4a30('0x11')](respondWithResult(_0x408157,0xc9))[_0x4a30('0x1a')](handleError(_0x408157,null));};exports[_0x4a30('0x7c')]=function(_0x45e8c8,_0x32fc25){return db[_0x4a30('0x44')]['findOne']({'where':{'id':_0x45e8c8[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x32fc25,null))[_0x4a30('0x11')](function(_0x5ca91c){if(_0x5ca91c){return _0x5ca91c[_0x4a30('0x7c')]();}return null;})[_0x4a30('0x11')](respondWithResult(_0x32fc25,null))['catch'](handleError(_0x32fc25,null));};exports[_0x4a30('0x7d')]=function(_0x5138df,_0x5763da){if(_0x5138df[_0x4a30('0x60')]['id']){delete _0x5138df[_0x4a30('0x60')]['id'];}return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x5138df[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x5763da,null))[_0x4a30('0x11')](function(_0x36fc1d){if(_0x36fc1d){_0x5138df[_0x4a30('0x60')][_0x4a30('0x67')]=_0x36fc1d['id'];return db[_0x4a30('0x63')][_0x4a30('0x69')](_0x5138df['body']);}})[_0x4a30('0x11')](respondWithResult(_0x5763da,null))['catch'](handleError(_0x5763da,null));};exports[_0x4a30('0x7e')]=function(_0xa4fe1e,_0x254133){return db['MailAccount'][_0x4a30('0x6b')]({'where':{'id':_0xa4fe1e[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x254133,null))['then'](function(_0x2b7939){if(_0x2b7939){return _0x2b7939[_0x4a30('0x7f')](null);}return null;})[_0x4a30('0x11')](respondWithStatusCode(_0x254133,null))[_0x4a30('0x1a')](handleError(_0x254133,null));};exports[_0x4a30('0x80')]=function(_0x1e8b07,_0xa32efd){return db[_0x4a30('0x44')][_0x4a30('0x6b')]({'where':{'id':_0x1e8b07[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0xa32efd,null))[_0x4a30('0x11')](function(_0x24178f){if(_0x24178f){return _0x24178f[_0x4a30('0x80')]();}return null;})[_0x4a30('0x11')](respondWithResult(_0xa32efd,null))[_0x4a30('0x1a')](handleError(_0xa32efd,null));};exports['addSmtp']=function(_0x568331,_0x1d3dac){if(_0x568331['body']['id']){delete _0x568331[_0x4a30('0x60')]['id'];}return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x568331[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x1d3dac,null))[_0x4a30('0x11')](function(_0x174e4e){if(_0x174e4e){_0x568331[_0x4a30('0x60')][_0x4a30('0x67')]=_0x174e4e['id'];return db[_0x4a30('0x42')][_0x4a30('0x69')](_0x568331[_0x4a30('0x60')]);}})[_0x4a30('0x11')](respondWithResult(_0x1d3dac,null))[_0x4a30('0x1a')](handleError(_0x1d3dac,null));};exports[_0x4a30('0x81')]=function(_0x44fdda,_0x4ec22f){return db[_0x4a30('0x44')][_0x4a30('0x6b')]({'where':{'id':_0x44fdda[_0x4a30('0x62')]['id']}})['then'](handleEntityNotFound(_0x4ec22f,null))['then'](function(_0x696918){if(_0x696918){return _0x696918[_0x4a30('0x82')](null);}return null;})[_0x4a30('0x11')](respondWithStatusCode(_0x4ec22f,null))['catch'](handleError(_0x4ec22f,null));};exports['addInteraction']=function(_0x5f4b8f,_0x457864){return db[_0x4a30('0x83')][_0x4a30('0x5f')]({'where':{'id':_0x5f4b8f[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x457864,null))[_0x4a30('0x11')](function(_0x45e215){if(_0x45e215){return _0x45e215[_0x4a30('0x84')](_0x5f4b8f[_0x4a30('0x60')][_0x4a30('0x6f')],_['omit'](_0x5f4b8f[_0x4a30('0x60')],['ids','id'])||{});}})[_0x4a30('0x11')](respondWithResult(_0x457864,null))['catch'](handleError(_0x457864,null));};exports[_0x4a30('0x85')]=function(_0x292aab,_0x5f4f42){var _0x509889={'raw':![],'where':{}};var _0x4425b3={};var _0xc2aa56={'count':0x0,'rows':[]};return db[_0x4a30('0x44')][_0x4a30('0x6b')]({'where':{'id':_0x292aab[_0x4a30('0x62')]['id']}})['then'](handleEntityNotFound(_0x5f4f42,null))['then'](function(_0x3398cd){if(_0x3398cd){_0x4425b3[_0x4a30('0x48')]=_[_0x4a30('0x5c')](db[_0x4a30('0x83')][_0x4a30('0x6c')]);_0x4425b3[_0x4a30('0x4a')]=_[_0x4a30('0x5c')](_0x292aab[_0x4a30('0x4a')]);_0x4425b3[_0x4a30('0x4b')]=_[_0x4a30('0x4c')](_0x4425b3[_0x4a30('0x48')],_0x4425b3['query']);_0x509889[_0x4a30('0x4d')]=_[_0x4a30('0x4c')](_0x4425b3['model'],qs[_0x4a30('0x4e')](_0x292aab[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0x509889[_0x4a30('0x4d')]=_0x509889['attributes'][_0x4a30('0x5d')]?_0x509889[_0x4a30('0x4d')]:_0x4425b3[_0x4a30('0x48')];if(!_0x292aab[_0x4a30('0x4a')][_0x4a30('0x6d')](_0x4a30('0x4f'))){_0x509889[_0x4a30('0x20')]=qs[_0x4a30('0x20')](_0x292aab[_0x4a30('0x4a')][_0x4a30('0x20')]);_0x509889[_0x4a30('0x1e')]=qs[_0x4a30('0x1e')](_0x292aab[_0x4a30('0x4a')][_0x4a30('0x1e')]);}_0x509889[_0x4a30('0x50')]=qs['sort'](_0x292aab[_0x4a30('0x4a')][_0x4a30('0x51')]);_0x509889[_0x4a30('0x52')]=qs[_0x4a30('0x4b')](_[_0x4a30('0x53')](_0x292aab['query'],_0x4425b3[_0x4a30('0x4b')]));_0x509889[_0x4a30('0x52')][_0x4a30('0x67')]=_0x3398cd['id'];if(_0x292aab[_0x4a30('0x4a')]['filter']){_0x509889[_0x4a30('0x52')]=_[_0x4a30('0x55')](_0x509889[_0x4a30('0x52')],{'$or':_[_0x4a30('0x49')](_0x509889['attributes'],function(_0x45229e){var _0x160b71={};_0x160b71[_0x45229e]={'$like':'%'+_0x292aab[_0x4a30('0x4a')][_0x4a30('0x54')]+'%'};return _0x160b71;})});}_0x509889=_[_0x4a30('0x55')]({},_0x509889,_0x292aab[_0x4a30('0x57')]);return db[_0x4a30('0x83')]['count']({'where':_0x509889[_0x4a30('0x52')]})['then'](function(_0x2257ca){_0xc2aa56[_0x4a30('0x21')]=_0x2257ca;if(_0x292aab['query'][_0x4a30('0x5e')]){_0x509889[_0x4a30('0x58')]=[{'model':db[_0x4a30('0x86')],'as':'Contact','required':![]},{'model':db[_0x4a30('0x87')],'as':_0x4a30('0x88'),'attributes':['name',_0x4a30('0x89'),'internal'],'required':![]},{'model':db[_0x4a30('0x8a')],'as':_0x4a30('0x8b'),'attributes':['id',_0x4a30('0x27'),_0x4a30('0x8c')],'where':_0x292aab[_0x4a30('0x4a')][_0x4a30('0x8d')]?{'id':_0x292aab[_0x4a30('0x4a')][_0x4a30('0x8d')]}:undefined,'required':_0x292aab[_0x4a30('0x4a')]['tag']?!![]:![]}];}return db[_0x4a30('0x83')][_0x4a30('0x59')](_0x509889);})[_0x4a30('0x11')](function(_0x1dbc0f){_0xc2aa56[_0x4a30('0x5a')]=_0x1dbc0f;return _0xc2aa56;});}})['then'](respondWithFilteredResult(_0x5f4f42,_0x509889))[_0x4a30('0x1a')](handleError(_0x5f4f42,null));};exports['addApplications']=function addApplications(_0x4419b0,_0x530020){var _0x2dbaff=_0x4419b0[_0x4a30('0x62')]['id'];var _0x37d117=_0x4419b0[_0x4a30('0x60')];var _0x32b60a=0xc8;var _0x4e18f5=null;return db[_0x4a30('0x8e')][_0x4a30('0x8f')]({'isolationLevel':db[_0x4a30('0x8e')][_0x4a30('0x90')]['ISOLATION_LEVELS'][_0x4a30('0x91')]},function(_0x35adea){return db[_0x4a30('0x44')][_0x4a30('0x6b')]({'where':{'id':_0x2dbaff},'transaction':_0x35adea})[_0x4a30('0x11')](function(_0x5c5047){if(_0x5c5047){return db['MailApplication'][_0x4a30('0x24')]({'where':{'MailAccountId':_0x2dbaff},'transaction':_0x35adea})[_0x4a30('0x11')](function(){var _0x5710ae=_[_0x4a30('0x49')](_0x37d117,function(_0x26bb99){_0x26bb99[_0x4a30('0x67')]=_0x2dbaff;return _0x26bb99;});return db[_0x4a30('0x92')][_0x4a30('0x93')](_0x5710ae,{'transaction':_0x35adea});});}else{_0x32b60a=0x194;_0x4e18f5=[];}});})[_0x4a30('0x11')](function(){if(_0x32b60a!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x2dbaff},'order':_0x4a30('0x94')})['then'](function(_0x4332b0){_0x4e18f5=_0x4332b0;});}})[_0x4a30('0x1a')](function(_0x56bb9f){_0x32b60a=0x1f4;logger['error'](_0x56bb9f[_0x4a30('0x26')]);if(_0x56bb9f[_0x4a30('0x27')]){delete _0x56bb9f[_0x4a30('0x27')];}_0x4e18f5=_0x56bb9f;})[_0x4a30('0x95')](function(){if(_0x4e18f5===null){_0x530020[_0x4a30('0x1b')](_0x32b60a);}else{if(_0x32b60a===0x1f4){_0x530020[_0x4a30('0x28')](_0x32b60a)[_0x4a30('0x29')](_0x4e18f5);}else{_0x530020[_0x4a30('0x28')](_0x32b60a)[_0x4a30('0x1d')](_0x4e18f5);}}});};exports[_0x4a30('0x96')]=function(_0xf9d2c7,_0x3442ba){var _0x19620d={};var _0x47389a={};var _0x27c728;var _0x472091;return db['MailAccount'][_0x4a30('0x6b')]({'where':{'id':_0xf9d2c7['params']['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x3442ba,null))['then'](function(_0x59cd40){if(_0x59cd40){_0x27c728=_0x59cd40;_0x47389a[_0x4a30('0x48')]=_[_0x4a30('0x5c')](db['MailApplication']['rawAttributes']);_0x47389a[_0x4a30('0x4a')]=_[_0x4a30('0x5c')](_0xf9d2c7[_0x4a30('0x4a')]);_0x47389a[_0x4a30('0x4b')]=_['intersection'](_0x47389a[_0x4a30('0x48')],_0x47389a[_0x4a30('0x4a')]);_0x19620d[_0x4a30('0x4d')]=_[_0x4a30('0x4c')](_0x47389a[_0x4a30('0x48')],qs[_0x4a30('0x4e')](_0xf9d2c7[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0x19620d['attributes']=_0x19620d[_0x4a30('0x4d')][_0x4a30('0x5d')]?_0x19620d['attributes']:_0x47389a[_0x4a30('0x48')];_0x19620d['order']=qs[_0x4a30('0x51')](_0xf9d2c7['query'][_0x4a30('0x51')]);_0x19620d[_0x4a30('0x52')]=qs[_0x4a30('0x4b')](_['pick'](_0xf9d2c7['query'],_0x47389a[_0x4a30('0x4b')]));if(_0xf9d2c7[_0x4a30('0x4a')][_0x4a30('0x54')]){_0x19620d['where']=_[_0x4a30('0x55')](_0x19620d[_0x4a30('0x52')],{'$or':_[_0x4a30('0x49')](_0x19620d[_0x4a30('0x4d')],function(_0x3044b5){var _0x2605c8={};_0x2605c8[_0x3044b5]={'$like':'%'+_0xf9d2c7[_0x4a30('0x4a')][_0x4a30('0x54')]+'%'};return _0x2605c8;})});}_0x19620d=_[_0x4a30('0x55')]({},_0x19620d,_0xf9d2c7[_0x4a30('0x57')]);return _0x27c728[_0x4a30('0x96')](_0x19620d);}})['then'](function(_0xb36e05){if(_0xb36e05){_0x472091=_0xb36e05[_0x4a30('0x5d')];if(!_0xf9d2c7[_0x4a30('0x4a')][_0x4a30('0x6d')]('nolimit')){_0x19620d[_0x4a30('0x20')]=qs['limit'](_0xf9d2c7[_0x4a30('0x4a')][_0x4a30('0x20')]);_0x19620d[_0x4a30('0x1e')]=qs[_0x4a30('0x1e')](_0xf9d2c7[_0x4a30('0x4a')]['offset']);}return _0x27c728['getApplications'](_0x19620d);}})[_0x4a30('0x11')](function(_0xc954b4){if(_0xc954b4){return _0xc954b4?{'count':_0x472091,'rows':_0xc954b4}:null;}})['then'](respondWithResult(_0x3442ba,null))[_0x4a30('0x1a')](handleError(_0x3442ba,null));};exports[_0x4a30('0x97')]=function(_0x3c9721,_0x5a95dc){var _0xfb5aa0={'raw':!![],'where':{}};var _0x3ed2aa={};var _0x3fb5f7={'count':0x0,'rows':[]};return db['MailAccount'][_0x4a30('0x6b')]({'where':{'id':_0x3c9721['params']['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x5a95dc,null))[_0x4a30('0x11')](function(_0x8fe79a){if(_0x8fe79a){_0x3ed2aa[_0x4a30('0x48')]=_[_0x4a30('0x5c')](db[_0x4a30('0x98')][_0x4a30('0x6c')]);_0x3ed2aa[_0x4a30('0x4a')]=_[_0x4a30('0x5c')](_0x3c9721[_0x4a30('0x4a')]);_0x3ed2aa[_0x4a30('0x4b')]=_['intersection'](_0x3ed2aa['model'],_0x3ed2aa[_0x4a30('0x4a')]);_0xfb5aa0[_0x4a30('0x4d')]=_[_0x4a30('0x4c')](_0x3ed2aa[_0x4a30('0x48')],qs[_0x4a30('0x4e')](_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0xfb5aa0[_0x4a30('0x4d')]=_0xfb5aa0['attributes'][_0x4a30('0x5d')]?_0xfb5aa0[_0x4a30('0x4d')]:_0x3ed2aa[_0x4a30('0x48')];if(!_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x6d')]('nolimit')){_0xfb5aa0['limit']=qs['limit'](_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x20')]);_0xfb5aa0[_0x4a30('0x1e')]=qs[_0x4a30('0x1e')](_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x1e')]);}_0xfb5aa0[_0x4a30('0x50')]=qs[_0x4a30('0x51')](_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x51')]);_0xfb5aa0[_0x4a30('0x52')]=qs[_0x4a30('0x4b')](_['pick'](_0x3c9721['query'],_0x3ed2aa[_0x4a30('0x4b')]));_0xfb5aa0['where']['MailAccountId']=_0x8fe79a['id'];if(_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x54')]){_0xfb5aa0[_0x4a30('0x52')]=_['merge'](_0xfb5aa0['where'],{'$or':_[_0x4a30('0x49')](_0xfb5aa0['attributes'],function(_0x7364db){var _0x5377a6={};_0x5377a6[_0x7364db]={'$like':'%'+_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x54')]+'%'};return _0x5377a6;})});}if(_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x99')]){var _0x15d478=_0x3c9721['query'][_0x4a30('0x99')][_0x4a30('0x9a')](',');var _0x1f6a2d={};_0x1f6a2d[_0x15d478[0x0]]={'$gte':moment(_0x15d478[0x1])[_0x4a30('0x9b')](_0x4a30('0x9c'))};_0xfb5aa0[_0x4a30('0x52')]=_[_0x4a30('0x55')](_0xfb5aa0[_0x4a30('0x52')],_0x1f6a2d);}_0xfb5aa0=_[_0x4a30('0x55')]({},_0xfb5aa0,_0x3c9721['options']);return db[_0x4a30('0x98')][_0x4a30('0x21')]({'where':_0xfb5aa0[_0x4a30('0x52')]})[_0x4a30('0x11')](function(_0x313fbc){_0x3fb5f7['count']=_0x313fbc;if(_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x5e')]){_0xfb5aa0[_0x4a30('0x58')]=[{'all':!![]}];}return db[_0x4a30('0x98')][_0x4a30('0x59')](_0xfb5aa0);})['then'](function(_0x1539c3){if(_0x3c9721[_0x4a30('0x4a')][_0x4a30('0x9d')]==='true'){for(var _0x295903=0x0;_0x295903<_0x1539c3[_0x4a30('0x5d')];_0x295903++){_0x1539c3[_0x295903][_0x4a30('0x60')]=juice(_0x1539c3[_0x295903]['body']);}}_0x3fb5f7[_0x4a30('0x5a')]=_0x1539c3;return _0x3fb5f7;});}})[_0x4a30('0x11')](respondWithFilteredResult(_0x5a95dc,_0xfb5aa0))[_0x4a30('0x1a')](handleError(_0x5a95dc,null));};exports[_0x4a30('0x29')]=function(_0x3e3b9d,_0x430cfb){var _0x4b64f2,_0x4e32c5={},_0x22e044;if(_0x3e3b9d[_0x4a30('0x60')]['to']){_0x22e044=_0x3e3b9d[_0x4a30('0x60')]['to'][_0x4a30('0x9a')](',')[0x0];}return db[_0x4a30('0x44')]['find']({'where':{'id':_0x3e3b9d['params']['id']},'include':[{'model':db[_0x4a30('0x9e')],'as':_0x4a30('0x9f'),'include':[{'model':db[_0x4a30('0x86')],'as':_0x4a30('0xa0'),'where':{'email':_0x22e044},'limit':0x1,'order':[[_0x4a30('0xa1'),_0x4a30('0xa2')]]}]},{'model':db[_0x4a30('0x42')],'as':_0x4a30('0x40'),'raw':!![],'include':[{'model':db[_0x4a30('0xa3')],'as':_0x4a30('0xa3'),'raw':!![]}]}]})[_0x4a30('0x11')](handleEntityNotFound(_0x430cfb,null))[_0x4a30('0x11')](function(_0x22818d){if(!_0x22818d)return;_0x4b64f2=_0x22818d;if(!_0x22818d[_0x4a30('0x40')])throw new Error(_0x4a30('0xa4'));if(_[_0x4a30('0xa5')](_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xa6')])){_0x3e3b9d['body'][_0x4a30('0xa6')]=util[_0x4a30('0x9b')]('%s\x20<%s>',_0x22818d[_0x4a30('0x27')],_0x22818d[_0x4a30('0x73')]||_0x22818d[_0x4a30('0x40')][_0x4a30('0x34')]);}if(_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xa7')]&&_0x3e3b9d['body']['attachments'][_0x4a30('0x5d')]){for(var _0xa7dd60=0x0;_0xa7dd60<_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xa7')][_0x4a30('0x5d')];_0xa7dd60+=0x1){_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xa7')][_0xa7dd60]={'filename':_0x3e3b9d['body']['attachments'][_0xa7dd60][_0x4a30('0x27')],'path':path[_0x4a30('0xa8')](config[_0x4a30('0xa9')],_0x4a30('0xaa'),_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xa7')][_0xa7dd60]['basename'])};}}var _0x29d756=_0x22818d[_0x4a30('0xab')]();return respondWithRpcPromise('SendMail',_0x4a30('0xac'),{'account':_0x29d756,'message':_0x3e3b9d[_0x4a30('0x60')]});})[_0x4a30('0x11')](function(_0x1cd5ba){if(!_0x1cd5ba)return;_0x4e32c5=_0x1cd5ba;if(!_0x4b64f2['List'])throw new Error(_0x4a30('0xad'));if(_0x4b64f2['List'][_0x4a30('0xa0')][_0x4a30('0x5d')])return _0x4b64f2[_0x4a30('0x9f')]['Contacts'][0x0];return db[_0x4a30('0x86')][_0x4a30('0x69')](_[_0x4a30('0xae')](_0x3e3b9d[_0x4a30('0x60')],{'firstName':_0x3e3b9d[_0x4a30('0x60')]['to'],'email':_0x3e3b9d['body']['to'],'phone':_0x3e3b9d[_0x4a30('0x60')]['to'],'ListId':_0x4b64f2['ListId']}));})[_0x4a30('0x11')](function(_0xc5ba6d){if(!_0xc5ba6d)return;var _0x1e2c1a={'UserId':_0x3e3b9d[_0x4a30('0x34')]['id'],'ContactId':_0xc5ba6d['id'],'MailAccountId':_0x4b64f2['id'],'inReplyTo':_0x4e32c5['messageId'],'to':_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xa6')],'cc':_0x3e3b9d[_0x4a30('0x60')]['cc'],'subject':_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xaf')],'attach':_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xb0')],'firstMsgDirection':_0x4a30('0xb1'),'lastMsgAt':moment()[_0x4a30('0x9b')](_0x4a30('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x4a30('0x55')](_0x3e3b9d['body'],{'messageId':_0x4e32c5[_0x4a30('0xb2')],'sentAt':moment()['format'](_0x4a30('0x9c')),'read':!![],'MailAccountId':_0x4b64f2['id'],'UserId':_0x3e3b9d['user']['id'],'ContactId':_0xc5ba6d['id']})]};if(_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xb3')]){_0x1e2c1a=_[_0x4a30('0x55')](_0x1e2c1a,_0x3e3b9d[_0x4a30('0x60')][_0x4a30('0xb3')]);}return db[_0x4a30('0x83')][_0x4a30('0x69')](_0x1e2c1a,{'include':[{'model':db[_0x4a30('0x98')],'as':_0x4a30('0xb4')}]});})[_0x4a30('0x11')](respondWithResult(_0x430cfb,null))[_0x4a30('0x1a')](handleError(_0x430cfb,null));};exports[_0x4a30('0xb5')]=function(_0x3ac3cb,_0x40c086){return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x3ac3cb[_0x4a30('0x62')]['id']},'include':[{'model':db[_0x4a30('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4a30('0xa3'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x40c086,null))['then'](function(_0x3c6c25){if(!_0x3c6c25[_0x4a30('0x40')])return;var _0x14cd81=_0x3c6c25[_0x4a30('0xab')]();return respondWithRpcPromise(_0x4a30('0xb6'),_0x4a30('0xb5'),{'account':_0x14cd81});})[_0x4a30('0x11')](respondWithResult(_0x40c086,null))[_0x4a30('0x1a')](handleError(_0x40c086,null));};exports[_0x4a30('0x24')]=function(_0x537041,_0x53a109){return db['MailAccount'][_0x4a30('0x5f')]({'where':{'id':_0x537041['params']['id']}})['then'](handleEntityNotFound(_0x53a109,null))[_0x4a30('0x11')](function(_0x1482b3){if(_0x1482b3&&_0x1482b3[_0x4a30('0x3c')]){throw new db[(_0x4a30('0xb7'))][(_0x4a30('0xb8'))](_0x4a30('0xb9'));}return _0x1482b3;})[_0x4a30('0x11')](removeEntity(_0x53a109,null))['catch'](handleError(_0x53a109,null));};exports[_0x4a30('0xba')]=function(_0x4cc4fd,_0x34c502){return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0x4cc4fd['params']['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x34c502,null))[_0x4a30('0x11')](function(_0x8bb1c5){if(_0x8bb1c5){return _0x8bb1c5[_0x4a30('0xba')](_0x4cc4fd[_0x4a30('0x60')][_0x4a30('0x6f')],_[_0x4a30('0xbb')](_0x4cc4fd[_0x4a30('0x60')],[_0x4a30('0x6f'),'id'])||{})[_0x4a30('0xbc')](function(_0x48bdab){for(var _0x675c19=0x0;_0x675c19<_0x4cc4fd[_0x4a30('0x60')][_0x4a30('0x6f')][_0x4a30('0x5d')];_0x675c19+=0x1){socket[_0x4a30('0xbd')](_0x4a30('0xbe'),{'UserId':Number(_0x4cc4fd[_0x4a30('0x60')][_0x4a30('0x6f')][_0x675c19]),'MailAccountId':Number(_0x4cc4fd[_0x4a30('0x62')]['id'])});}return _0x48bdab;});}})[_0x4a30('0x11')](respondWithResult(_0x34c502,null))[_0x4a30('0x1a')](handleError(_0x34c502,null));};exports[_0x4a30('0xbf')]=function(_0xe3d01f,_0x178515){return db[_0x4a30('0x44')][_0x4a30('0x5f')]({'where':{'id':_0xe3d01f['params']['id']}})['then'](handleEntityNotFound(_0x178515,null))[_0x4a30('0x11')](function(_0xbb2cdd){if(_0xbb2cdd){return _0xbb2cdd['removeAgents'](_0xe3d01f['query'][_0x4a30('0x6f')])[_0x4a30('0x11')](function(){if(_[_0x4a30('0xc0')](_0xe3d01f[_0x4a30('0x4a')][_0x4a30('0x6f')])){for(var _0x51aa7a=0x0;_0x51aa7a<_0xe3d01f['query'][_0x4a30('0x6f')][_0x4a30('0x5d')];_0x51aa7a+=0x1){socket[_0x4a30('0xbd')]('userMailAccount:remove',{'UserId':Number(_0xe3d01f[_0x4a30('0x4a')][_0x4a30('0x6f')][_0x51aa7a]),'MailAccountId':Number(_0xe3d01f['params']['id'])});}}else{socket[_0x4a30('0xbd')](_0x4a30('0xc1'),{'UserId':Number(_0xe3d01f[_0x4a30('0x4a')]['ids']),'MailAccountId':Number(_0xe3d01f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x178515,null))[_0x4a30('0x1a')](handleError(_0x178515,null));};exports[_0x4a30('0xc2')]=function(_0x287f50,_0x4e47dd){var _0x439082={};var _0xfbe539={};var _0x108b5d;var _0x18f6f6;return db['MailAccount'][_0x4a30('0x6b')]({'where':{'id':_0x287f50[_0x4a30('0x62')]['id']}})[_0x4a30('0x11')](handleEntityNotFound(_0x4e47dd,null))[_0x4a30('0x11')](function(_0x4ba203){if(_0x4ba203){_0x108b5d=_0x4ba203;_0xfbe539['model']=_[_0x4a30('0x5c')](db['User']['rawAttributes']);_0xfbe539[_0x4a30('0x4a')]=_[_0x4a30('0x5c')](_0x287f50[_0x4a30('0x4a')]);_0xfbe539[_0x4a30('0x4b')]=_['intersection'](_0xfbe539[_0x4a30('0x48')],_0xfbe539[_0x4a30('0x4a')]);_0x439082[_0x4a30('0x4d')]=_['intersection'](_0xfbe539['model'],qs['fields'](_0x287f50[_0x4a30('0x4a')][_0x4a30('0x4e')]));_0x439082[_0x4a30('0x4d')]=_0x439082[_0x4a30('0x4d')]['length']?_0x439082[_0x4a30('0x4d')]:_0xfbe539[_0x4a30('0x48')];_0x439082[_0x4a30('0x50')]=qs['sort'](_0x287f50[_0x4a30('0x4a')]['sort']);_0x439082[_0x4a30('0x52')]=qs[_0x4a30('0x4b')](_[_0x4a30('0x53')](_0x287f50['query'],_0xfbe539[_0x4a30('0x4b')]));if(_0x287f50[_0x4a30('0x4a')][_0x4a30('0x54')]){_0x439082[_0x4a30('0x52')]=_[_0x4a30('0x55')](_0x439082['where'],{'$or':_[_0x4a30('0x49')](_0x439082[_0x4a30('0x4d')],function(_0x5916d3){var _0x19cd2c={};_0x19cd2c[_0x5916d3]={'$like':'%'+_0x287f50['query'][_0x4a30('0x54')]+'%'};return _0x19cd2c;})});}_0x439082=_['merge']({},_0x439082,_0x287f50[_0x4a30('0x57')]);return _0x108b5d[_0x4a30('0xc2')](_0x439082);}})[_0x4a30('0x11')](function(_0x44e317){if(_0x44e317){_0x18f6f6=_0x44e317[_0x4a30('0x5d')];if(!_0x287f50[_0x4a30('0x4a')][_0x4a30('0x6d')]('nolimit')){_0x439082['limit']=qs[_0x4a30('0x20')](_0x287f50['query']['limit']);_0x439082[_0x4a30('0x1e')]=qs['offset'](_0x287f50[_0x4a30('0x4a')][_0x4a30('0x1e')]);}return _0x108b5d[_0x4a30('0xc2')](_0x439082);}})[_0x4a30('0x11')](function(_0x4fb127){if(_0x4fb127){return _0x4fb127?{'count':_0x18f6f6,'rows':_0x4fb127}:null;}})[_0x4a30('0x11')](respondWithResult(_0x4e47dd,null))[_0x4a30('0x1a')](handleError(_0x4e47dd,null));}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 09e616d..e22c0e8 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 _0x8604=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x34351c,_0x5093e1){var _0xea3fb=function(_0x2fc89f){while(--_0x2fc89f){_0x34351c['push'](_0x34351c['shift']());}};_0xea3fb(++_0x5093e1);}(_0x8604,0x100));var _0x4860=function(_0x184c8a,_0x1d57dc){_0x184c8a=_0x184c8a-0x0;var _0x5a48f5=_0x8604[_0x184c8a];return _0x5a48f5;};'use strict';var EventEmitter=require(_0x4860('0x0'));var MailAccount=require(_0x4860('0x1'))['db'][_0x4860('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4860('0x3')](0x0);var events={'afterCreate':_0x4860('0x4'),'afterUpdate':_0x4860('0x5'),'afterDestroy':_0x4860('0x6')};function emitEvent(_0x53474a){return function(_0x13b1ad,_0x6c95b0,_0xb90d93){MailAccountEvents[_0x4860('0x7')](_0x53474a+':'+_0x13b1ad['id'],_0x13b1ad);MailAccountEvents['emit'](_0x53474a,_0x13b1ad);_0xb90d93(null);};}for(var e in events){if(events[_0x4860('0x8')](e)){var event=events[e];MailAccount[_0x4860('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 8f7667c..29e685d 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 _0x90b3=['provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','service'];(function(_0x8336b9,_0xc315a2){var _0x3dccb5=function(_0x38102f){while(--_0x38102f){_0x8336b9['push'](_0x8336b9['shift']());}};_0x3dccb5(++_0xc315a2);}(_0x90b3,0xb8));var _0x390b=function(_0x28014d,_0x383e2f){_0x28014d=_0x28014d-0x0;var _0x2572cc=_0x90b3[_0x28014d];return _0x2572cc;};'use strict';var attributes=require(_0x390b('0x0'));module[_0x390b('0x1')]=function(_0x1da64a){return _0x1da64a[_0x390b('0x2')](_0x390b('0x3'),attributes,{'tableName':_0x390b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2ca821=this;var _0xa22f60={'id':_0x2ca821['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2ca821['provider']!=='custom'){_0xa22f60[_0x390b('0x5')]=_0x2ca821[_0x390b('0x6')];}else{_0xa22f60[_0x390b('0x7')]=_0x2ca821[_0x390b('0x8')][_0x390b('0x7')];_0xa22f60[_0x390b('0x9')]=_0x2ca821[_0x390b('0x8')][_0x390b('0x9')];_0xa22f60[_0x390b('0xa')]=_0x2ca821[_0x390b('0x8')][_0x390b('0xa')];}if(_0x2ca821[_0x390b('0x8')][_0x390b('0xb')]){if(_0x2ca821['Smtp'][_0x390b('0xc')]){if(!_0x2ca821[_0x390b('0x8')][_0x390b('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xa22f60[_0x390b('0xe')]={'type':_0x390b('0xf'),'user':_0x2ca821[_0x390b('0x8')][_0x390b('0x10')],'accessToken':_0x2ca821['Smtp'][_0x390b('0xd')][_0x390b('0x11')]};}else{_0xa22f60[_0x390b('0xe')]={'user':_0x2ca821[_0x390b('0x8')]['user'],'pass':_0x2ca821['Smtp'][_0x390b('0x12')]};}}return _0xa22f60;}}});}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 611031e..7ff2912 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 _0x5fd1=['spread','update','interaction','contact','attachments','originTo','originCc','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','startRouting','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailAccount','find','smtp','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','smtpOptions','applications','list','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found'];(function(_0x363239,_0x269287){var _0x5b5c95=function(_0x38c3bc){while(--_0x38c3bc){_0x363239['push'](_0x363239['shift']());}};_0x5b5c95(++_0x269287);}(_0x5fd1,0x155));var _0x15fd=function(_0x3a3153,_0x3e6466){_0x3a3153=_0x3a3153-0x0;var _0x1460d6=_0x5fd1[_0x3a3153];return _0x1460d6;};'use strict';var _=require(_0x15fd('0x0'));var moment=require('moment');var BPromise=require(_0x15fd('0x1'));var rs=require(_0x15fd('0x2'));var Redis=require(_0x15fd('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var jayson=require(_0x15fd('0x6'));var client=jayson['client'][_0x15fd('0x7')]({'port':0x232c});config[_0x15fd('0x8')]=_[_0x15fd('0x9')](config[_0x15fd('0x8')],{'host':_0x15fd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15fd('0x8')]));require(_0x15fd('0xb'))[_0x15fd('0xc')](socket);function respondWithRpcPromise(_0x4c861f,_0x2d2fbb,_0x5c9c63){return new BPromise(function(_0x3dfdbb,_0x250457){return client['request'](_0x4c861f,_0x5c9c63)['then'](function(_0x4ebde5){logger[_0x15fd('0xd')](_0x15fd('0xe'),_0x2d2fbb,_0x15fd('0xf'));logger[_0x15fd('0x10')](_0x15fd('0x11'),_0x2d2fbb,_0x15fd('0xf'),JSON[_0x15fd('0x12')](_0x4ebde5));if(_0x4ebde5[_0x15fd('0x13')]){if(_0x4ebde5[_0x15fd('0x13')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x2d2fbb,_0x4ebde5[_0x15fd('0x13')][_0x15fd('0x14')]);return _0x250457(_0x4ebde5[_0x15fd('0x13')][_0x15fd('0x14')]);}logger[_0x15fd('0x13')](_0x15fd('0xe'),_0x2d2fbb,_0x4ebde5[_0x15fd('0x13')][_0x15fd('0x14')]);return _0x3dfdbb(_0x4ebde5['error']['message']);}else{logger[_0x15fd('0xd')]('MailAccount,\x20%s,\x20%s',_0x2d2fbb,_0x15fd('0xf'));_0x3dfdbb(_0x4ebde5['result'][_0x15fd('0x14')]);}})[_0x15fd('0x15')](function(_0x855bae){logger['error'](_0x15fd('0xe'),_0x2d2fbb,_0x855bae);_0x250457(_0x855bae);});});}exports[_0x15fd('0x16')]=function(_0x8b7b9e){var _0x229f8a=this;return new Promise(function(_0x2fb919,_0x36a90e){return db[_0x15fd('0x17')][_0x15fd('0x18')]({'raw':_0x8b7b9e[_0x15fd('0x19')]?_0x8b7b9e[_0x15fd('0x19')][_0x15fd('0x1a')]===undefined?!![]:![]:!![],'where':_0x8b7b9e['options']?_0x8b7b9e['options'][_0x15fd('0x1b')]||null:null,'attributes':_0x8b7b9e[_0x15fd('0x19')]?_0x8b7b9e[_0x15fd('0x19')][_0x15fd('0x1c')]||null:null,'limit':_0x8b7b9e[_0x15fd('0x19')]?_0x8b7b9e[_0x15fd('0x19')][_0x15fd('0x1d')]||null:null,'include':_0x8b7b9e['options']?_0x8b7b9e[_0x15fd('0x19')][_0x15fd('0x1e')]?_[_0x15fd('0x1f')](_0x8b7b9e['options'][_0x15fd('0x1e')],function(_0x49062f){return{'model':db[_0x49062f[_0x15fd('0x20')]],'as':_0x49062f['as'],'attributes':_0x49062f[_0x15fd('0x1c')],'include':_0x49062f[_0x15fd('0x1e')]?_['map'](_0x49062f[_0x15fd('0x1e')],function(_0x1cbf2c){return{'model':db[_0x1cbf2c[_0x15fd('0x20')]],'as':_0x1cbf2c['as'],'attributes':_0x1cbf2c['attributes'],'include':_0x1cbf2c[_0x15fd('0x1e')]?_['map'](_0x1cbf2c[_0x15fd('0x1e')],function(_0x7e70d6){return{'model':db[_0x7e70d6[_0x15fd('0x20')]],'as':_0x7e70d6['as'],'attributes':_0x7e70d6[_0x15fd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x15fd('0x21')](function(_0x6c213b){logger[_0x15fd('0xd')](_0x15fd('0x16'),_0x8b7b9e);logger[_0x15fd('0x10')](_0x15fd('0x16'),_0x8b7b9e,JSON[_0x15fd('0x12')](_0x6c213b));_0x2fb919(_0x6c213b);})['catch'](function(_0x47c22c){logger[_0x15fd('0x13')]('GetMailAccount',_0x47c22c[_0x15fd('0x14')],_0x8b7b9e);_0x36a90e(_0x229f8a[_0x15fd('0x13')](0x1f4,_0x47c22c['message']));});});};exports[_0x15fd('0x22')]=function(_0x197d15){var _0x5dc5fe=this;return new Promise(function(_0x104fbd,_0x199647){return db[_0x15fd('0x17')][_0x15fd('0x23')]({'raw':_0x197d15[_0x15fd('0x19')]?_0x197d15[_0x15fd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x197d15[_0x15fd('0x19')]?_0x197d15[_0x15fd('0x19')][_0x15fd('0x1b')]||null:null,'attributes':_0x197d15[_0x15fd('0x19')]?_0x197d15['options'][_0x15fd('0x1c')]||null:null,'include':_0x197d15[_0x15fd('0x19')]?_0x197d15[_0x15fd('0x19')][_0x15fd('0x1e')]?_[_0x15fd('0x1f')](_0x197d15[_0x15fd('0x19')]['include'],function(_0x3b80a6){return{'model':db[_0x3b80a6[_0x15fd('0x20')]],'as':_0x3b80a6['as'],'attributes':_0x3b80a6['attributes'],'include':_0x3b80a6[_0x15fd('0x1e')]?_[_0x15fd('0x1f')](_0x3b80a6[_0x15fd('0x1e')],function(_0x5cb227){return{'model':db[_0x5cb227[_0x15fd('0x20')]],'as':_0x5cb227['as'],'attributes':_0x5cb227[_0x15fd('0x1c')],'include':_0x5cb227[_0x15fd('0x1e')]?_[_0x15fd('0x1f')](_0x5cb227[_0x15fd('0x1e')],function(_0x6b2ac8){return{'model':db[_0x6b2ac8['model']],'as':_0x6b2ac8['as'],'attributes':_0x6b2ac8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x340d17){if(_0x197d15[_0x15fd('0x19')][_0x15fd('0x24')]===!![])_0x340d17['setDataValue']('smtpOptions',_0x340d17[_0x15fd('0x25')]());logger['info']('ShowMailAccount',_0x197d15);logger['debug'](_0x15fd('0x22'),_0x197d15,JSON[_0x15fd('0x12')](_0x340d17));_0x104fbd(_0x340d17);})[_0x15fd('0x15')](function(_0x59d0d7){logger[_0x15fd('0x13')](_0x15fd('0x22'),_0x59d0d7[_0x15fd('0x14')],_0x197d15);_0x199647(_0x5dc5fe['error'](0x1f4,_0x59d0d7[_0x15fd('0x14')]));});});};exports[_0x15fd('0x26')]=function(_0x2e81cb){var _0xe18038=this;return new Promise(function(_0x2e8b0a,_0x46b8f4){var _0x19a29f={'body':_0x2e81cb[_0x15fd('0x27')],'channel':_0x15fd('0x28')};var _0x5dd3c4=_[_0x15fd('0x29')](_[_0x15fd('0x2a')](db[_0x15fd('0x2b')][_0x15fd('0x2c')]),[_0x15fd('0x2d'),_0x15fd('0x2e'),_0x15fd('0x2f'),_0x15fd('0x30')]);var _0x343ce6=![];if(_0x2e81cb[_0x15fd('0x27')]['id']){delete _0x2e81cb[_0x15fd('0x27')]['id'];}if(_[_0x15fd('0x31')](_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x32')])){return _0x46b8f4(_0xe18038[_0x15fd('0x13')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x15fd('0x31')](_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x27')])||_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x27')]===''){return _0x46b8f4(_0xe18038[_0x15fd('0x13')](0x1f4,_0x15fd('0x33')));}if(_[_0x15fd('0x31')](_0x2e81cb['body']['mapKey'])){return _0x46b8f4(_0xe18038[_0x15fd('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dd3c4));}if(!_[_0x15fd('0x34')](_0x5dd3c4,_0x2e81cb[_0x15fd('0x27')]['mapKey'])){return _0x46b8f4(_0xe18038[_0x15fd('0x13')](0x1f4,_0x15fd('0x35')+_0x5dd3c4));}var _0x131eb4={};_0x131eb4[_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x36')]]=_0x2e81cb[_0x15fd('0x27')]['from'];return db[_0x15fd('0x17')][_0x15fd('0x23')]({'where':{'id':_0x2e81cb[_0x15fd('0x37')]['id']},'include':[{'model':db[_0x15fd('0x38')],'as':_0x15fd('0x39'),'include':[{'model':db[_0x15fd('0x2b')],'as':_0x15fd('0x3a'),'where':_0x131eb4,'limit':0x1,'order':[[_0x15fd('0x2e'),_0x15fd('0x3b')]]}]},{'model':db[_0x15fd('0x3c')],'as':_0x15fd('0x3d')},{'model':db[_0x15fd('0x3e')],'as':'Smtp','include':[{'model':db[_0x15fd('0x3f')],'as':'CloudProvider'}]}]})[_0x15fd('0x21')](function(_0x34c250){if(_0x34c250&&_0x34c250[_0x15fd('0x39')]){var _0x5a1f32=_0x34c250[_0x15fd('0x40')]({'plain':!![]});_0x19a29f[_0x15fd('0x37')]=_[_0x15fd('0x41')](_0x5a1f32,[_0x15fd('0x3d'),'List']);_0x19a29f[_0x15fd('0x37')][_0x15fd('0x42')]=_0x34c250[_0x15fd('0x25')]();_0x19a29f[_0x15fd('0x43')]=_0x5a1f32['Applications'];_0x19a29f[_0x15fd('0x44')]=_0x5a1f32[_0x15fd('0x39')];_0x19a29f['applications']=_['orderBy'](_0x19a29f['applications'],[_0x15fd('0x45')],[_0x15fd('0x46')]);if(_0x19a29f[_0x15fd('0x37')]&&_0x19a29f[_0x15fd('0x37')][_0x15fd('0x47')]){_0x19a29f[_0x15fd('0x43')]['push']({'id':0x0,'priority':_0x19a29f[_0x15fd('0x43')][_0x15fd('0x48')]+0x1,'app':_0x15fd('0x49'),'appdata':'autoclose','interval':_0x15fd('0x4a')});}if(_0x19a29f['account'][_0x15fd('0x3d')]){delete _0x19a29f[_0x15fd('0x37')][_0x15fd('0x3d')];}if(_0x19a29f[_0x15fd('0x37')][_0x15fd('0x39')]){delete _0x19a29f[_0x15fd('0x37')][_0x15fd('0x39')];}if(_0x5a1f32[_0x15fd('0x39')][_0x15fd('0x3a')][_0x15fd('0x48')]){return _0x5a1f32[_0x15fd('0x39')][_0x15fd('0x3a')][0x0];}var _0x2db992=_['defaults'](_0x2e81cb[_0x15fd('0x27')],{'firstName':_0x2e81cb['body'][_0x15fd('0x32')],'ListId':_0x5a1f32['ListId']});_0x2db992[_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x36')]]=_0x2e81cb[_0x15fd('0x27')]['from'];return db['CmContact'][_0x15fd('0x4b')](_0x2db992);}else{throw new Error(_0x15fd('0x4c'));}})[_0x15fd('0x21')](function(_0x30ab06){_0x19a29f['contact']=_0x30ab06;if(_0x30ab06){if(!_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x4d')]){_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x4d')]=rs['generate']()+'\x20'+_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x32')];}var _0x40e7c8={'ContactId':_0x30ab06['id'],'MailAccountId':_0x2e81cb[_0x15fd('0x37')]['id'],'inReplyTo':_0x2e81cb[_0x15fd('0x27')]['message']['messageId'],'to':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['from'],'cc':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['cc'],'subject':_0x2e81cb['body'][_0x15fd('0x14')][_0x15fd('0x4e')],'attach':_0x2e81cb[_0x15fd('0x27')]['message'][_0x15fd('0x4f')],'lastMsgAt':moment()[_0x15fd('0x50')](_0x15fd('0x51')),'lastMsgDirection':'in'};return db[_0x15fd('0x52')][_0x15fd('0x23')]({'where':{'closed':![],'MailAccountId':_0x2e81cb[_0x15fd('0x37')]['id']},'include':[{'model':db[_0x15fd('0x53')],'as':_0x15fd('0x54'),'attributes':[_0x15fd('0x4d')],'where':{'messageId':_0x2e81cb[_0x15fd('0x27')]['message'][_0x15fd('0x55')]}}]})[_0x15fd('0x21')](function(_0x5b720b){if(_0x5b720b){return[_0x5b720b,![]];}return db['MailInteraction'][_0x15fd('0x4b')](_0x40e7c8)[_0x15fd('0x21')](function(_0x2bd6ef){return[_0x2bd6ef,!![]];});});}else{throw new Error(_0x15fd('0x56'));}})[_0x15fd('0x57')](function(_0x1b6f59,_0x4f2ff6){if(_0x1b6f59){_0x343ce6=_0x4f2ff6;if(!_0x4f2ff6){return _0x1b6f59[_0x15fd('0x58')]({'inReplyTo':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x4d')],'to':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x32')],'cc':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['cc'],'subject':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['subject'],'attach':_0x1b6f59['attach']?_0x1b6f59[_0x15fd('0x4f')]:_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x4f')],'substatus':null,'substatusAt':moment()[_0x15fd('0x50')](_0x15fd('0x51')),'lastMsgAt':moment()[_0x15fd('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x1b6f59;}}})[_0x15fd('0x21')](function(_0x5de222){_0x19a29f[_0x15fd('0x59')]=_0x5de222['get']({'plain':!![]});_0x19a29f[_0x15fd('0x59')]['created']=_0x343ce6;return db[_0x15fd('0x53')][_0x15fd('0x4b')]({'body':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x27')],'MailAccountId':_0x2e81cb[_0x15fd('0x37')]['id'],'MailInteractionId':_0x5de222['id'],'direction':'in','ContactId':_0x19a29f[_0x15fd('0x5a')]['id'],'messageId':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x4d')],'from':_0x2e81cb['body']['message'][_0x15fd('0x32')],'to':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['to'],'cc':_0x2e81cb['body'][_0x15fd('0x14')]['cc'],'subject':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['subject'],'attach':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['attach'],'Attachments':_0x2e81cb[_0x15fd('0x27')]['message'][_0x15fd('0x5b')],'originTo':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')][_0x15fd('0x5c')],'originCc':_0x2e81cb[_0x15fd('0x27')]['message'][_0x15fd('0x5d')],'bcc':_0x2e81cb['body'][_0x15fd('0x14')]['bcc'],'ChatWebsiteId':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['ChatWebsiteId']||null,'originChannel':_0x2e81cb[_0x15fd('0x27')][_0x15fd('0x14')]['originChannel']||'Email','ChatOfflineMessageId':_0x2e81cb[_0x15fd('0x27')]['message'][_0x15fd('0x5e')]||null},{'include':[{'model':db[_0x15fd('0x5f')],'as':_0x15fd('0x60')}]});})[_0x15fd('0x21')](function(_0x2d1c93){_0x19a29f['message']=_0x2d1c93;if(!_0x19a29f[_0x15fd('0x59')][_0x15fd('0x61')]){return;}return db['User'][_0x15fd('0x23')]({'attributes':['id',_0x15fd('0x62')],'where':{'id':_0x19a29f[_0x15fd('0x59')][_0x15fd('0x61')]}});})[_0x15fd('0x21')](function(_0x1d529d){if(_0x1d529d){_0x19a29f[_0x15fd('0x43')][_0x15fd('0x63')]({'id':0x0,'priority':0x0,'app':_0x15fd('0x64'),'appdata':_0x1d529d[_0x15fd('0x62')]+','+(_0x19a29f[_0x15fd('0x37')][_0x15fd('0x65')]||0xa),'interval':_0x15fd('0x4a')});}if(!_0x19a29f[_0x15fd('0x59')]['queueId']){return;}return db[_0x15fd('0x66')]['find']({'attributes':['id',_0x15fd('0x62')],'where':{'id':_0x19a29f[_0x15fd('0x59')][_0x15fd('0x67')]}});})[_0x15fd('0x21')](function(_0x58f942){if(_0x58f942){_0x19a29f[_0x15fd('0x43')][_0x15fd('0x63')]({'id':0x0,'priority':0x1,'app':_0x15fd('0x68'),'appdata':_0x58f942[_0x15fd('0x62')]+','+(_0x19a29f['account'][_0x15fd('0x69')]||0x12c),'interval':_0x15fd('0x4a')});}return respondWithRpcPromise('Start',_0x15fd('0x6a'),_0x19a29f);})[_0x15fd('0x21')](function(_0x128ee3){_0x2e8b0a(_0x128ee3);})['catch'](function(_0x112122){_0x46b8f4(_0xe18038[_0x15fd('0x13')](0x1f4,_0x112122[_0x15fd('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 685a5a1..08bc65f 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 _0x3a6e=['removeListener','register','mailAccount:','save'];(function(_0x3c9f35,_0x42e217){var _0x3b6c6c=function(_0x374abe){while(--_0x374abe){_0x3c9f35['push'](_0x3c9f35['shift']());}};_0x3b6c6c(++_0x42e217);}(_0x3a6e,0x143));var _0xe3a6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3a6e[_0x2641f9];return _0x585741;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe3a6('0x0'),'remove','update'];function createListener(_0x247ea8,_0x34b5bd){return function(_0x2ed5a7){_0x34b5bd['emit'](_0x247ea8,_0x2ed5a7);};}function removeListener(_0x150eaa,_0x2607a3){return function(){MailAccountEvents[_0xe3a6('0x1')](_0x150eaa,_0x2607a3);};}exports[_0xe3a6('0x2')]=function(_0x2f0174){for(var _0x5bfce5=0x0,_0x4d4fc2=events['length'];_0x5bfce5<_0x4d4fc2;_0x5bfce5++){var _0x5ad041=events[_0x5bfce5];var _0x297523=createListener(_0xe3a6('0x3')+_0x5ad041,_0x2f0174);MailAccountEvents['on'](_0x5ad041,_0x297523);}}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 23a1906..6f7e667 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 _0xa72c=['util','path','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','delete','destroy'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xa72c,0x9c));var _0xca72=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xa72c[_0x259d17];return _0x407535;};'use strict';var multer=require('multer');var util=require(_0xca72('0x0'));var path=require(_0xca72('0x1'));var timeout=require('connect-timeout');var express=require(_0xca72('0x2'));var router=express[_0xca72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xca72('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xca72('0x5'));var controller=require(_0xca72('0x6'));router[_0xca72('0x7')](_0xca72('0x8'),auth[_0xca72('0x9')](),controller[_0xca72('0xa')]);router['put'](_0xca72('0x8'),auth[_0xca72('0x9')](),controller['update']);router[_0xca72('0xb')](_0xca72('0x8'),auth['isAuthenticated'](),controller[_0xca72('0xc')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 645287a..f301aa7 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 _0x5fda=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x4260fe,_0x504539){var _0x17677b=function(_0x5b61f0){while(--_0x5b61f0){_0x4260fe['push'](_0x4260fe['shift']());}};_0x17677b(++_0x504539);}(_0x5fda,0x1a2));var _0xa5fd=function(_0x2e8775,_0x310049){_0x2e8775=_0x2e8775-0x0;var _0x4cbf35=_0x5fda[_0x2e8775];return _0x4cbf35;};'use strict';var Sequelize=require('sequelize');module[_0xa5fd('0x0')]={'priority':{'type':Sequelize[_0xa5fd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa5fd('0x2')],'allowNull':![],'defaultValue':_0xa5fd('0x3')},'appdata':{'type':Sequelize[_0xa5fd('0x4')]()},'description':{'type':Sequelize[_0xa5fd('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa5fd('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0942dc9..763d7e1 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 _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5a13a9,_0x4e37db){var _0x19be9c=function(_0x4b7835){while(--_0x4b7835){_0x5a13a9['push'](_0x5a13a9['shift']());}};_0x19be9c(++_0x4e37db);}(_0x9bde,0xe1));var _0xe9bd=function(_0xb973ba,_0x404ad5){_0xb973ba=_0xb973ba-0x0;var _0x1f4112=_0x9bde[_0xb973ba];return _0x1f4112;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3f6c7ca..a05c52c 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 _0xfb78=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xfb78,0x82));var _0x8fb7=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0xfb78[_0x5a2299];return _0xedff0f;};'use strict';var _=require('lodash');var util=require(_0x8fb7('0x0'));var logger=require(_0x8fb7('0x1'))(_0x8fb7('0x2'));var moment=require('moment');var BPromise=require(_0x8fb7('0x3'));var rp=require(_0x8fb7('0x4'));var fs=require('fs');var path=require(_0x8fb7('0x5'));var rimraf=require('rimraf');var config=require(_0x8fb7('0x6'));var attributes=require(_0x8fb7('0x7'));module[_0x8fb7('0x8')]=function(_0x2507f9,_0x1d96a8){return _0x2507f9['define'](_0x8fb7('0x9'),attributes,{'tableName':_0x8fb7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fb7('0xb'),'collate':_0x8fb7('0xc')});}; \ No newline at end of file +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 diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index a120b25..c279359 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 _0x55a4=['then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','update','body','options','raw','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x21f124,_0x366fe0){var _0x2e929f=function(_0xc52826){while(--_0xc52826){_0x21f124['push'](_0x21f124['shift']());}};_0x2e929f(++_0x366fe0);}(_0x55a4,0x198));var _0x455a=function(_0x10c407,_0xc782fc){_0x10c407=_0x10c407-0x0;var _0x25ff29=_0x55a4[_0x10c407];return _0x25ff29;};'use strict';var _=require(_0x455a('0x0'));var util=require(_0x455a('0x1'));var moment=require(_0x455a('0x2'));var BPromise=require(_0x455a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x455a('0x4'));var db=require(_0x455a('0x5'))['db'];var utils=require(_0x455a('0x6'));var logger=require(_0x455a('0x7'))('rpc');var config=require(_0x455a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x455a('0x9')][_0x455a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eece0,_0x1752ea,_0x3b2319){return new BPromise(function(_0xeb2367,_0x44c328){return client[_0x455a('0xb')](_0x3eece0,_0x3b2319)[_0x455a('0xc')](function(_0x1a3a76){logger[_0x455a('0xd')](_0x455a('0xe'),_0x1752ea,_0x455a('0xf'));logger[_0x455a('0x10')](_0x455a('0x11'),_0x1752ea,_0x455a('0xf'),JSON[_0x455a('0x12')](_0x1a3a76));if(_0x1a3a76[_0x455a('0x13')]){if(_0x1a3a76['error'][_0x455a('0x14')]===0x1f4){logger[_0x455a('0x13')](_0x455a('0xe'),_0x1752ea,_0x1a3a76[_0x455a('0x13')][_0x455a('0x15')]);return _0x44c328(_0x1a3a76['error']['message']);}logger[_0x455a('0x13')](_0x455a('0xe'),_0x1752ea,_0x1a3a76[_0x455a('0x13')][_0x455a('0x15')]);return _0xeb2367(_0x1a3a76[_0x455a('0x13')]['message']);}else{logger['info'](_0x455a('0xe'),_0x1752ea,_0x455a('0xf'));_0xeb2367(_0x1a3a76['result'][_0x455a('0x15')]);}})[_0x455a('0x16')](function(_0x44a6b0){logger[_0x455a('0x13')](_0x455a('0xe'),_0x1752ea,_0x44a6b0);_0x44c328(_0x44a6b0);});});}exports[_0x455a('0x17')]=function(_0x5339bd){var _0x51b2b9=this;return new Promise(function(_0x307d2f,_0x3ba999){return db['MailApplication'][_0x455a('0x18')](_0x5339bd[_0x455a('0x19')],{'raw':_0x5339bd[_0x455a('0x1a')]?_0x5339bd[_0x455a('0x1a')][_0x455a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5339bd[_0x455a('0x1a')]?_0x5339bd[_0x455a('0x1a')]['where']||null:null,'attributes':_0x5339bd['options']?_0x5339bd['options'][_0x455a('0x1c')]||null:null,'limit':_0x5339bd['options']?_0x5339bd[_0x455a('0x1a')][_0x455a('0x1d')]||null:null})[_0x455a('0xc')](function(_0x2bac97){logger[_0x455a('0xd')]('UpdateMailApplication',_0x5339bd);logger[_0x455a('0x10')](_0x455a('0x17'),_0x5339bd,JSON[_0x455a('0x12')](_0x2bac97));_0x307d2f(_0x2bac97);})[_0x455a('0x16')](function(_0x14ba8d){logger[_0x455a('0x13')](_0x455a('0x17'),_0x14ba8d['message'],_0x5339bd);_0x3ba999(_0x51b2b9[_0x455a('0x13')](0x1f4,_0x14ba8d['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bc66e24..f3280a5 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 _0x6971=['removeTags','exports','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy'];(function(_0x5ee4a4,_0x7e8f24){var _0x492f9a=function(_0x1d297d){while(--_0x1d297d){_0x5ee4a4['push'](_0x5ee4a4['shift']());}};_0x492f9a(++_0x7e8f24);}(_0x6971,0x1e8));var _0x1697=function(_0x893149,_0x5d1513){_0x893149=_0x893149-0x0;var _0x12ac2d=_0x6971[_0x893149];return _0x12ac2d;};'use strict';var express=require('express');var router=express[_0x1697('0x0')]();var auth=require(_0x1697('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x1697('0x2'));router[_0x1697('0x3')]('/',auth[_0x1697('0x4')](),controller[_0x1697('0x5')]);router[_0x1697('0x3')](_0x1697('0x6'),auth[_0x1697('0x4')](),controller[_0x1697('0x7')]);router['get'](_0x1697('0x8'),auth[_0x1697('0x4')](),controller[_0x1697('0x9')]);router[_0x1697('0x3')](_0x1697('0xa'),auth[_0x1697('0x4')](),controller[_0x1697('0xb')]);router[_0x1697('0x3')](_0x1697('0xc'),auth[_0x1697('0x4')](),controller['download']);router[_0x1697('0xd')]('/',auth[_0x1697('0x4')](),controller[_0x1697('0xe')]);router[_0x1697('0xd')](_0x1697('0xa'),auth['isAuthenticated'](),controller[_0x1697('0xf')]);router[_0x1697('0xd')](_0x1697('0x10'),auth[_0x1697('0x4')](),interaction[_0x1697('0x11')](_0x1697('0x12'),_0x1697('0x13')),controller['addTags']);router[_0x1697('0x14')](_0x1697('0x8'),auth[_0x1697('0x4')](),interaction[_0x1697('0x11')]('mail',_0x1697('0x15')),controller[_0x1697('0x16')]);router[_0x1697('0x17')](_0x1697('0x8'),auth[_0x1697('0x4')](),interaction[_0x1697('0x11')](_0x1697('0x12'),_0x1697('0x18')),controller['destroy']);router[_0x1697('0x17')](_0x1697('0x10'),auth[_0x1697('0x4')](),controller[_0x1697('0x19')]);module[_0x1697('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8d900b8..5f10866 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 _0xabb5=['INTEGER','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xabb5,0x105));var _0x5abb=function(_0x11f12f,_0x5b576a){_0x11f12f=_0x11f12f-0x0;var _0x71376a=_0xabb5[_0x11f12f];return _0x71376a;};'use strict';var Sequelize=require(_0x5abb('0x0'));var iconv=require(_0x5abb('0x1'));module[_0x5abb('0x2')]={'closed':{'type':Sequelize[_0x5abb('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5abb('0x4')]},'disposition':{'type':Sequelize[_0x5abb('0x5')]},'secondDisposition':{'type':Sequelize[_0x5abb('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5abb('0x5')](0x1fe)},'to':{'type':Sequelize[_0x5abb('0x5')]},'cc':{'type':Sequelize[_0x5abb('0x6')]('long')},'subject':{'type':Sequelize[_0x5abb('0x6')]()},'attach':{'type':Sequelize[_0x5abb('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5abb('0x7')]('in',_0x5abb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5abb('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5abb('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5abb('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5abb('0x9')]}}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index be947bf..0b51350 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 _0xcf7d=['server','attachments','join','push','Attachments','Messages','from','bcc','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','build','writeFileSync','message%d.eml','sendStatus','eml-format','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','socket.io-emitter','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','send','index','MailInteraction','rawAttributes','fieldName','type','key','query','catch','show','params','model','keys','intersection','fields','attributes','length','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','nolimit','order','sort','pick','MailInteractionId','filter','where','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','inlineCss','rows','addTags','setTags','spread','Tag','findAll','name','color','emit','mailInteractionTags:save','removeTags','download','unix','root','files'];(function(_0x298cc5,_0x3b1261){var _0x28f7e5=function(_0x20632d){while(--_0x20632d){_0x298cc5['push'](_0x298cc5['shift']());}};_0x28f7e5(++_0x3b1261);}(_0xcf7d,0x1d6));var _0xdcf7=function(_0x167388,_0x4121dc){_0x167388=_0x167388-0x0;var _0x54101b=_0xcf7d[_0x167388];return _0x54101b;};'use strict';var emlformat=require(_0xdcf7('0x0'));var rimraf=require(_0xdcf7('0x1'));var zipdir=require('zip-dir');var moment=require(_0xdcf7('0x2'));var BPromise=require(_0xdcf7('0x3'));var util=require(_0xdcf7('0x4'));var path=require(_0xdcf7('0x5'));var fs=require('fs');var _=require(_0xdcf7('0x6'));var juice=require('juice');var Redis=require(_0xdcf7('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xdcf7('0x8'));var logger=require(_0xdcf7('0x9'))(_0xdcf7('0xa'));var config=require(_0xdcf7('0xb'));var db=require(_0xdcf7('0xc'))['db'];var htmlEntities=require(_0xdcf7('0xd'));config[_0xdcf7('0xe')]=_['defaults'](config[_0xdcf7('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xdcf7('0xf'))(new Redis(config[_0xdcf7('0xe')]));require(_0xdcf7('0x10'))[_0xdcf7('0x11')](socket);function respondWithStatusCode(_0x2ca47a,_0x23f80d){_0x23f80d=_0x23f80d||0xcc;return function(_0x2d8bca){if(_0x2d8bca){return _0x2ca47a['sendStatus'](_0x23f80d);}return _0x2ca47a[_0xdcf7('0x12')](_0x23f80d)[_0xdcf7('0x13')]();};}function respondWithResult(_0x3e108a,_0x45dd4d){_0x45dd4d=_0x45dd4d||0xc8;return function(_0x21a810){if(_0x21a810){return _0x3e108a[_0xdcf7('0x12')](_0x45dd4d)[_0xdcf7('0x14')](_0x21a810);}};}function respondWithFilteredResult(_0x413a3e,_0x2c5611){return function(_0x44f59d){if(_0x44f59d){var _0x23a8ae=typeof _0x2c5611[_0xdcf7('0x15')]===_0xdcf7('0x16')&&typeof _0x2c5611[_0xdcf7('0x17')]===_0xdcf7('0x16');var _0x5e2eb2=_0x44f59d[_0xdcf7('0x18')];var _0x645c74=_0x23a8ae?0x0:_0x2c5611['offset'];var _0x170bd5=_0x23a8ae?_0x44f59d['count']:_0x2c5611[_0xdcf7('0x15')]+_0x2c5611[_0xdcf7('0x17')];var _0x509901;if(_0x170bd5>=_0x5e2eb2){_0x170bd5=_0x5e2eb2;_0x509901=0xc8;}else{_0x509901=0xce;}_0x413a3e['status'](_0x509901);return _0x413a3e[_0xdcf7('0x19')](_0xdcf7('0x1a'),_0x645c74+'-'+_0x170bd5+'/'+_0x5e2eb2)[_0xdcf7('0x14')](_0x44f59d);}return null;};}function saveUpdates(_0x2c917c){return function(_0x214240){if(_0x214240){return _0x214240[_0xdcf7('0x1b')](_0x2c917c)[_0xdcf7('0x1c')](function(_0x3cbdd9){return _0x3cbdd9;});}return null;};}function removeEntity(_0x3a6a10){return function(_0x545d34){if(_0x545d34){return _0x545d34['destroy']()[_0xdcf7('0x1c')](function(){_0x3a6a10[_0xdcf7('0x12')](0xcc)[_0xdcf7('0x13')]();});}};}function handleEntityNotFound(_0x1db5d8){return function(_0x5c43c5){if(!_0x5c43c5){_0x1db5d8['sendStatus'](0x194);}return _0x5c43c5;};}function handleError(_0x2d491e,_0x2b6711){_0x2b6711=_0x2b6711||0x1f4;return function(_0x3b288f){logger[_0xdcf7('0x1d')](_0x3b288f[_0xdcf7('0x1e')]);if(_0x3b288f['name']){delete _0x3b288f['name'];}_0x2d491e[_0xdcf7('0x12')](_0x2b6711)[_0xdcf7('0x1f')](_0x3b288f);};}exports[_0xdcf7('0x20')]=function(_0x1984d0,_0x453c90){var _0x50c1a7={};var _0x2975a4=_['map'](db[_0xdcf7('0x21')][_0xdcf7('0x22')],function(_0x3751ed){return{'name':_0x3751ed[_0xdcf7('0x23')],'type':_0x3751ed[_0xdcf7('0x24')][_0xdcf7('0x25')]};});_0x50c1a7=qs['getOptions'](_0x2975a4,_0x1984d0);return interaction['findAll']('mail',_0x1984d0[_0xdcf7('0x26')],_0x1984d0['user'],_0x50c1a7,_0x2975a4)[_0xdcf7('0x1c')](respondWithFilteredResult(_0x453c90,_0x50c1a7))[_0xdcf7('0x27')](handleError(_0x453c90,null));};exports[_0xdcf7('0x28')]=function(_0x5a8ba7,_0x4e4604){var _0x5708af={'raw':![],'where':{'id':_0x5a8ba7[_0xdcf7('0x29')]['id']}},_0x34b57c={};_0x34b57c[_0xdcf7('0x2a')]=_[_0xdcf7('0x2b')](db[_0xdcf7('0x21')]['rawAttributes']);_0x34b57c[_0xdcf7('0x26')]=_[_0xdcf7('0x2b')](_0x5a8ba7[_0xdcf7('0x26')]);_0x34b57c['filters']=_[_0xdcf7('0x2c')](_0x34b57c[_0xdcf7('0x2a')],_0x34b57c[_0xdcf7('0x26')]);_0x5708af['attributes']=_['intersection'](_0x34b57c['model'],qs[_0xdcf7('0x2d')](_0x5a8ba7[_0xdcf7('0x26')]['fields']));_0x5708af[_0xdcf7('0x2e')]=_0x5708af[_0xdcf7('0x2e')][_0xdcf7('0x2f')]?_0x5708af[_0xdcf7('0x2e')]:_0x34b57c[_0xdcf7('0x2a')];if(_0x5a8ba7[_0xdcf7('0x26')]['includeAll']){_0x5708af['include']=[{'all':!![]}];}_0x5708af=_[_0xdcf7('0x30')]({},_0x5708af,_0x5a8ba7[_0xdcf7('0x31')]);return db[_0xdcf7('0x21')][_0xdcf7('0x32')](_0x5708af)[_0xdcf7('0x1c')](handleEntityNotFound(_0x4e4604,null))[_0xdcf7('0x1c')](respondWithResult(_0x4e4604,null))[_0xdcf7('0x27')](handleError(_0x4e4604,null));};exports[_0xdcf7('0x33')]=function(_0x4bf34a,_0x2b52bc){return db['MailInteraction'][_0xdcf7('0x33')](_0x4bf34a[_0xdcf7('0x34')],{})[_0xdcf7('0x1c')](respondWithResult(_0x2b52bc,0xc9))['catch'](handleError(_0x2b52bc,null));};exports['update']=function(_0x21926e,_0x43db49){if(_0x21926e['body']['id']){delete _0x21926e[_0xdcf7('0x34')]['id'];}return db[_0xdcf7('0x21')][_0xdcf7('0x32')]({'where':{'id':_0x21926e['params']['id']}})['then'](handleEntityNotFound(_0x43db49,null))['then'](saveUpdates(_0x21926e[_0xdcf7('0x34')],null))['then'](respondWithResult(_0x43db49,null))[_0xdcf7('0x27')](handleError(_0x43db49,null));};exports['destroy']=function(_0x544141,_0x557ab8){return db[_0xdcf7('0x21')]['find']({'where':{'id':_0x544141['params']['id']}})['then'](handleEntityNotFound(_0x557ab8,null))[_0xdcf7('0x1c')](removeEntity(_0x557ab8,null))['catch'](handleError(_0x557ab8,null));};exports[_0xdcf7('0x35')]=function(_0x2a476d,_0x27848a){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x27848a,null))[_0xdcf7('0x27')](handleError(_0x27848a,null));};exports[_0xdcf7('0x36')]=function(_0x6688cb,_0x16216f){return db[_0xdcf7('0x37')]['find']({'where':{'id':_0x6688cb[_0xdcf7('0x29')]['id']}})['then'](handleEntityNotFound(_0x16216f,null))[_0xdcf7('0x1c')](function(_0xf4271){if(_0xf4271){return _0xf4271[_0xdcf7('0x36')](_0x6688cb[_0xdcf7('0x34')][_0xdcf7('0x38')],_[_0xdcf7('0x39')](_0x6688cb[_0xdcf7('0x34')],[_0xdcf7('0x38'),'id'])||{});}})[_0xdcf7('0x1c')](respondWithResult(_0x16216f,null))[_0xdcf7('0x27')](handleError(_0x16216f,null));};exports[_0xdcf7('0x3a')]=function(_0x5e909e,_0x454822){var _0x4bd44d={'raw':![],'where':{}};var _0x22b858={};var _0x31ce69={'count':0x0,'rows':[]};return db['MailInteraction'][_0xdcf7('0x3b')]({'where':{'id':_0x5e909e['params']['id']}})[_0xdcf7('0x1c')](handleEntityNotFound(_0x454822,null))['then'](function(_0x1c100f){if(_0x1c100f){_0x22b858[_0xdcf7('0x2a')]=_[_0xdcf7('0x2b')](db[_0xdcf7('0x37')][_0xdcf7('0x22')]);_0x22b858['query']=_[_0xdcf7('0x2b')](_0x5e909e[_0xdcf7('0x26')]);_0x22b858[_0xdcf7('0x3c')]=_[_0xdcf7('0x2c')](_0x22b858['model'],_0x22b858[_0xdcf7('0x26')]);_0x4bd44d[_0xdcf7('0x2e')]=_['intersection'](_0x22b858[_0xdcf7('0x2a')],qs[_0xdcf7('0x2d')](_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x2d')]));_0x4bd44d[_0xdcf7('0x2e')]=_0x4bd44d[_0xdcf7('0x2e')][_0xdcf7('0x2f')]?_0x4bd44d['attributes']:_0x22b858[_0xdcf7('0x2a')];if(!_0x5e909e['query']['hasOwnProperty'](_0xdcf7('0x3d'))){_0x4bd44d[_0xdcf7('0x17')]=qs['limit'](_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x17')]);_0x4bd44d[_0xdcf7('0x15')]=qs[_0xdcf7('0x15')](_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x15')]);}_0x4bd44d[_0xdcf7('0x3e')]=qs[_0xdcf7('0x3f')](_0x5e909e[_0xdcf7('0x26')]['sort']);_0x4bd44d['where']=qs[_0xdcf7('0x3c')](_[_0xdcf7('0x40')](_0x5e909e[_0xdcf7('0x26')],_0x22b858[_0xdcf7('0x3c')]));_0x4bd44d['where'][_0xdcf7('0x41')]=_0x1c100f['id'];if(_0x5e909e['query'][_0xdcf7('0x42')]){_0x4bd44d[_0xdcf7('0x43')]=_[_0xdcf7('0x30')](_0x4bd44d[_0xdcf7('0x43')],{'$or':_[_0xdcf7('0x44')](_0x4bd44d[_0xdcf7('0x2e')],function(_0x1895e0){var _0x5022ec={};_0x5022ec[_0x1895e0]={'$like':'%'+_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x42')]+'%'};return _0x5022ec;})});}if(_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x45')]){var _0x420312=_0x5e909e['query'][_0xdcf7('0x45')]['split'](',');var _0x2a61c6={};_0x2a61c6[_0x420312[0x0]]={'$gte':moment(_0x420312[0x1])[_0xdcf7('0x46')](_0xdcf7('0x47'))};_0x4bd44d[_0xdcf7('0x43')]=_['merge'](_0x4bd44d['where'],_0x2a61c6);}_0x4bd44d=_[_0xdcf7('0x30')]({},_0x4bd44d,_0x5e909e[_0xdcf7('0x31')]);return db['MailMessage'][_0xdcf7('0x18')]({'where':_0x4bd44d[_0xdcf7('0x43')]})[_0xdcf7('0x1c')](function(_0x5a5cc1){_0x31ce69['count']=_0x5a5cc1;if(_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x48')]){_0x4bd44d[_0xdcf7('0x49')]=[{'all':!![]}];}return db[_0xdcf7('0x37')]['findAll'](_0x4bd44d);})['then'](function(_0x478c22){if(_0x5e909e[_0xdcf7('0x26')][_0xdcf7('0x4a')]==='true'){for(var _0x356275=0x0;_0x356275<_0x478c22[_0xdcf7('0x2f')];_0x356275++){_0x478c22[_0x356275][_0xdcf7('0x34')]=juice(_0x478c22[_0x356275]['body']);}}_0x31ce69[_0xdcf7('0x4b')]=_0x478c22;return _0x31ce69;});}})[_0xdcf7('0x1c')](respondWithFilteredResult(_0x454822,_0x4bd44d))[_0xdcf7('0x27')](handleError(_0x454822,null));};exports[_0xdcf7('0x4c')]=function(_0x60b4ff,_0x59d14f){return db[_0xdcf7('0x21')]['find']({'where':{'id':_0x60b4ff['params']['id']}})[_0xdcf7('0x1c')](handleEntityNotFound(_0x59d14f,null))[_0xdcf7('0x1c')](function(_0x2ccd11){if(_0x2ccd11){return _0x2ccd11[_0xdcf7('0x4d')](_0x60b4ff[_0xdcf7('0x34')]['ids'],_[_0xdcf7('0x39')](_0x60b4ff[_0xdcf7('0x34')],[_0xdcf7('0x38'),'id'])||{})[_0xdcf7('0x4e')](function(){return db[_0xdcf7('0x4f')][_0xdcf7('0x50')]({'attributes':['id',_0xdcf7('0x51'),_0xdcf7('0x52')],'where':{'id':_0x60b4ff[_0xdcf7('0x34')][_0xdcf7('0x38')]}});})['then'](function(_0x4299f9){socket[_0xdcf7('0x53')](_0xdcf7('0x54'),{'id':Number(_0x60b4ff[_0xdcf7('0x29')]['id']),'tags':_0x4299f9||[]});return{'id':Number(_0x60b4ff[_0xdcf7('0x29')]['id']),'tags':_0x4299f9||[]};});}})[_0xdcf7('0x1c')](respondWithResult(_0x59d14f,null))[_0xdcf7('0x27')](handleError(_0x59d14f,null));};exports[_0xdcf7('0x55')]=function(_0x506a59,_0x37babc){return db['MailInteraction'][_0xdcf7('0x32')]({'where':{'id':_0x506a59[_0xdcf7('0x29')]['id']}})[_0xdcf7('0x1c')](handleEntityNotFound(_0x37babc,null))[_0xdcf7('0x1c')](function(_0x1a8867){if(_0x1a8867){return _0x1a8867['removeTags'](_0x506a59[_0xdcf7('0x26')][_0xdcf7('0x38')]);}})[_0xdcf7('0x1c')](respondWithStatusCode(_0x37babc,null))[_0xdcf7('0x27')](handleError(_0x37babc,null));};exports[_0xdcf7('0x56')]=function(_0x4f07a0,_0x261d41){var _0x1bf565=moment()[_0xdcf7('0x57')]()['toString']();var _0x5352cf=path['join'](config[_0xdcf7('0x58')],'server',_0xdcf7('0x59'),'tmp');var _0xec2a3b=path['join'](config['root'],_0xdcf7('0x5a'),'files',_0xdcf7('0x5b'));var _0x9c9e00=path[_0xdcf7('0x5c')](_0x5352cf,_0x1bf565);var _0x115937=util[_0xdcf7('0x46')]('transcript-%d-%s.zip',_0x4f07a0[_0xdcf7('0x29')]['id'],_0x1bf565);var _0x1ca3be=path[_0xdcf7('0x5c')](_0x5352cf,_0x115937);var _0x28cd47=[];if(_0x4f07a0[_0xdcf7('0x26')][_0xdcf7('0x5b')]){_0x28cd47[_0xdcf7('0x5d')]({'model':db['Attachment'],'as':_0xdcf7('0x5e'),'raw':!![]});}var _0xb11aa1=[{'model':db[_0xdcf7('0x37')],'as':_0xdcf7('0x5f'),'attributes':['id',_0xdcf7('0x34'),_0xdcf7('0x60'),'to','cc',_0xdcf7('0x61'),'subject',_0xdcf7('0x62')],'where':{'secret':![]},'order':qs[_0xdcf7('0x3f')]('id'),'include':_0x28cd47}];return db[_0xdcf7('0x21')][_0xdcf7('0x32')]({'where':{'id':_0x4f07a0[_0xdcf7('0x29')]['id']},'include':_0xb11aa1})[_0xdcf7('0x1c')](handleEntityNotFound(_0x261d41,null))[_0xdcf7('0x1c')](function(_0xb7f4b9){if(_0xb7f4b9&&_0xb7f4b9[_0xdcf7('0x5f')]){var _0x3fa09a=_0xb7f4b9[_0xdcf7('0x63')]({'plain':!![]});fs[_0xdcf7('0x64')](_0x9c9e00);return BPromise[_0xdcf7('0x65')](_0x3fa09a[_0xdcf7('0x5f')],function(_0x1211a5,_0x5ab56d){var _0x2794d7={'from':_0x1211a5[_0xdcf7('0x60')],'to':_0x1211a5['to']||_0xdcf7('0x66'),'subject':_0x1211a5[_0xdcf7('0x67')],'html':htmlEntities[_0xdcf7('0x68')](_0x1211a5[_0xdcf7('0x34')]),'headers':{'Date':moment(_0x1211a5[_0xdcf7('0x62')])[_0xdcf7('0x46')](_0xdcf7('0x69'))},'attachments':[]};if(_0x1211a5['cc']){_0x2794d7[_0xdcf7('0x6a')]['Cc']=_0x1211a5['cc'];}if(_0x1211a5[_0xdcf7('0x61')]){_0x2794d7[_0xdcf7('0x6a')]['Bcc']=_0x1211a5['bcc'];}return new BPromise(function(_0x3ecdb0,_0x3c1a38){if(_0x1211a5[_0xdcf7('0x5e')]){for(var _0x38ce60=0x0;_0x38ce60<_0x1211a5['Attachments'][_0xdcf7('0x2f')];_0x38ce60++){var _0x216fa6=_0x1211a5[_0xdcf7('0x5e')][_0x38ce60];var _0x13b62f=path[_0xdcf7('0x5c')](_0xec2a3b,_0x216fa6[_0xdcf7('0x6b')]);if(fs['existsSync'](_0x13b62f)){_0x2794d7[_0xdcf7('0x5b')][_0xdcf7('0x5d')]({'name':_0x216fa6[_0xdcf7('0x51')],'contentType':_0x216fa6[_0xdcf7('0x24')],'data':fs['readFileSync'](_0x13b62f)});}}}emlformat[_0xdcf7('0x6c')](_0x2794d7,function(_0x12b988,_0x3bfc2e){if(_0x12b988)return _0x3c1a38(_0x12b988);fs[_0xdcf7('0x6d')](path['join'](_0x9c9e00,util[_0xdcf7('0x46')](_0xdcf7('0x6e'),_0x5ab56d)),_0x3bfc2e);return _0x3ecdb0(_0x3bfc2e);});});})[_0xdcf7('0x1c')](function(){return new BPromise(function(_0x58dd84,_0x34a564){zipdir(_0x9c9e00,{'saveTo':_0x1ca3be},function(_0x377092,_0x2a764c){if(_0x377092)return _0x34a564(_0x377092);return _0x58dd84(_0x2a764c);});})[_0xdcf7('0x1c')](function(){return new BPromise(function(_0x35b0c5,_0x45c961){rimraf(_0x9c9e00,function(_0xab7164){if(_0xab7164)_0x45c961(_0xab7164);return _0x35b0c5();});});})[_0xdcf7('0x1c')](function(){return _0x261d41['download'](_0x1ca3be,_0x115937,function(_0x21966a){if(!_0x21966a)fs['unlinkSync'](_0x1ca3be);});});});}else{return _0x261d41[_0xdcf7('0x6f')](0xc8);}})[_0xdcf7('0x27')](handleError(_0x261d41,null));}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c6b3afe..c75b289 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 _0x2f08=['hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x592a06,_0x258291){var _0x1f0746=function(_0x5300d5){while(--_0x5300d5){_0x592a06['push'](_0x592a06['shift']());}};_0x1f0746(++_0x258291);}(_0x2f08,0x192));var _0x82f0=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x2f08[_0x10004e];return _0x5af990;};'use strict';var EventEmitter=require(_0x82f0('0x0'));var MailInteraction=require(_0x82f0('0x1'))['db'][_0x82f0('0x2')];var MailMessage=require(_0x82f0('0x1'))['db'][_0x82f0('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x82f0('0x4')](0x0);var events={'afterCreate':_0x82f0('0x5'),'afterUpdate':_0x82f0('0x6'),'afterDestroy':_0x82f0('0x7')};function emitEvent(_0x4ab1ea){return function(_0x41e287,_0x48d678,_0x54d2ac){_0x41e287[_0x82f0('0x8')]({'attributes':['id'],'raw':!![]})[_0x82f0('0x9')](function(_0x3afc15){_0x41e287['setDataValue']('Users',_0x3afc15['map'](function(_0x8ec67c){return{'id':_0x8ec67c['id']};}));return MailMessage[_0x82f0('0xa')]({'where':{'MailInteractionId':_0x41e287['id'],'direction':'in','read':![]},'raw':!![]});})[_0x82f0('0x9')](function(_0x5f1b8e){_0x41e287[_0x82f0('0xb')](_0x82f0('0xc'),_0x5f1b8e[_0x82f0('0xd')]);MailInteractionEvents[_0x82f0('0xe')](_0x4ab1ea+':'+_0x41e287['id'],_0x41e287);MailInteractionEvents[_0x82f0('0xe')](_0x4ab1ea,_0x41e287);_0x54d2ac(null);})[_0x82f0('0xf')](_0x54d2ac(null));};}for(var e in events){if(events[_0x82f0('0x10')](e)){var event=events[e];MailInteraction[_0x82f0('0x11')](e,emitEvent(event));}}module[_0x82f0('0x12')]=MailInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 15f5a1a..99a3ed1 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 _0xc980=['lodash','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci'];(function(_0x253b5a,_0xc8f20){var _0x3983b3=function(_0x35d5de){while(--_0x35d5de){_0x253b5a['push'](_0x253b5a['shift']());}};_0x3983b3(++_0xc8f20);}(_0xc980,0x10e));var _0x0c98=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xc980[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0x0c98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c98('0x1'));var moment=require(_0x0c98('0x2'));var BPromise=require(_0x0c98('0x3'));var rp=require(_0x0c98('0x4'));var fs=require('fs');var path=require(_0x0c98('0x5'));var rimraf=require(_0x0c98('0x6'));var config=require('../../config/environment');var attributes=require(_0x0c98('0x7'));module[_0x0c98('0x8')]=function(_0x1d4536,_0xd4889){return _0x1d4536[_0x0c98('0x9')](_0x0c98('0xa'),attributes,{'tableName':_0x0c98('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0c98('0xc'),'to'],'type':_0x0c98('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x242108,_0x5e1755,_0x4f07fa){if(_0x242108[_0x0c98('0xe')]){_0x242108[_0x0c98('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x242108[_0x0c98('0x10')]){_0x242108[_0x0c98('0x11')]=moment()[_0x0c98('0x12')](_0x0c98('0x13'));}_0x4f07fa(null,_0x5e1755);},'beforeUpdate':function(_0x3ba30d,_0x485d06,_0x343cb7){if(_0x3ba30d[_0x0c98('0x14')](_0x0c98('0xe'))){_0x3ba30d['substatusAt']=_0x3ba30d[_0x0c98('0xe')]?moment()[_0x0c98('0x12')](_0x0c98('0x13')):null;}if(_0x3ba30d[_0x0c98('0x14')](_0x0c98('0x10'))){_0x3ba30d['closedAt']=moment()[_0x0c98('0x12')](_0x0c98('0x13'));_0x3ba30d[_0x0c98('0xe')]=null;_0x3ba30d['substatusAt']=null;}_0x343cb7(null,_0x3ba30d);},'afterUpdate':function(_0x58b002,_0x269070,_0x383699){var _0x1ccba2=_0x1d4536[_0x0c98('0x15')];var _0x1937ef=_0x58b002[_0x0c98('0x16')]({'plain':!![]});if(_0x1937ef[_0x0c98('0x10')]){return _0x1ccba2[_0x0c98('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x1937ef['id']}})[_0x0c98('0x18')](function(){_0x383699();})['catch'](function(_0x40a9e6){_0x383699(_0x40a9e6);});}else{_0x383699();}}},'charset':_0x0c98('0x19'),'collate':_0x0c98('0x1a')});}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index e0af2d5..2a3fe04 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 _0xc949=['defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','omit','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x37e010,_0x24c761){var _0x170320=function(_0x1a2b4f){while(--_0x1a2b4f){_0x37e010['push'](_0x37e010['shift']());}};_0x170320(++_0x24c761);}(_0xc949,0x181));var _0x9c94=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc949[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x9c94('0x0'));var util=require('util');var moment=require(_0x9c94('0x1'));var BPromise=require(_0x9c94('0x2'));var rs=require(_0x9c94('0x3'));var fs=require('fs');var Redis=require(_0x9c94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c94('0x5'));var logger=require(_0x9c94('0x6'))('rpc');var config=require(_0x9c94('0x7'));var jayson=require(_0x9c94('0x8'));var client=jayson[_0x9c94('0x9')][_0x9c94('0xa')]({'port':0x232a});config['redis']=_[_0x9c94('0xb')](config[_0x9c94('0xc')],{'host':_0x9c94('0xd'),'port':0x18eb});var socket=require(_0x9c94('0xe'))(new Redis(config[_0x9c94('0xc')]));require(_0x9c94('0xf'))[_0x9c94('0x10')](socket);function respondWithRpcPromise(_0x454b16,_0x417063,_0x3287f8){return new BPromise(function(_0x5775c9,_0x3dc850){return client[_0x9c94('0x11')](_0x454b16,_0x3287f8)[_0x9c94('0x12')](function(_0x20fc5a){logger[_0x9c94('0x13')](_0x9c94('0x14'),_0x417063,_0x9c94('0x15'));logger[_0x9c94('0x16')](_0x9c94('0x17'),_0x417063,_0x9c94('0x15'),JSON[_0x9c94('0x18')](_0x20fc5a));if(_0x20fc5a[_0x9c94('0x19')]){if(_0x20fc5a[_0x9c94('0x19')][_0x9c94('0x1a')]===0x1f4){logger['error'](_0x9c94('0x14'),_0x417063,_0x20fc5a['error'][_0x9c94('0x1b')]);return _0x3dc850(_0x20fc5a[_0x9c94('0x19')]['message']);}logger[_0x9c94('0x19')]('MailInteraction,\x20%s,\x20%s',_0x417063,_0x20fc5a['error'][_0x9c94('0x1b')]);return _0x5775c9(_0x20fc5a['error'][_0x9c94('0x1b')]);}else{logger[_0x9c94('0x13')]('MailInteraction,\x20%s,\x20%s',_0x417063,_0x9c94('0x15'));_0x5775c9(_0x20fc5a[_0x9c94('0x1c')][_0x9c94('0x1b')]);}})[_0x9c94('0x1d')](function(_0x16ef2c){logger[_0x9c94('0x19')](_0x9c94('0x14'),_0x417063,_0x16ef2c);_0x3dc850(_0x16ef2c);});});}exports['UpdateMailInteraction']=function(_0x2c9736){var _0x39e336=this;return new Promise(function(_0x4e2569,_0x141801){return db[_0x9c94('0x1e')][_0x9c94('0x1f')](_0x2c9736[_0x9c94('0x20')],{'raw':_0x2c9736[_0x9c94('0x21')]?_0x2c9736[_0x9c94('0x21')][_0x9c94('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c9736[_0x9c94('0x21')]?_0x2c9736[_0x9c94('0x21')][_0x9c94('0x23')]||null:null,'attributes':_0x2c9736[_0x9c94('0x21')]?_0x2c9736[_0x9c94('0x21')][_0x9c94('0x24')]||null:null,'limit':_0x2c9736[_0x9c94('0x21')]?_0x2c9736['options'][_0x9c94('0x25')]||null:null})[_0x9c94('0x12')](function(_0x5c2647){logger[_0x9c94('0x13')](_0x9c94('0x26'),_0x2c9736);logger[_0x9c94('0x16')](_0x9c94('0x26'),_0x2c9736,JSON[_0x9c94('0x18')](_0x5c2647));_0x4e2569(_0x5c2647);})['catch'](function(_0xc18230){logger[_0x9c94('0x19')]('UpdateMailInteraction',_0xc18230[_0x9c94('0x1b')],_0x2c9736);_0x141801(_0x39e336['error'](0x1f4,_0xc18230[_0x9c94('0x1b')]));});});};exports[_0x9c94('0x27')]=function(_0x330bd4){return new Promise(function(_0x4008e8,_0x1581c0){return db[_0x9c94('0x1e')][_0x9c94('0x28')]({'where':_0x330bd4['options']?_0x330bd4['options'][_0x9c94('0x23')]||null:null})[_0x9c94('0x12')](function(_0x1f732b){if(_0x1f732b){return _0x1f732b['addTags'](_0x330bd4[_0x9c94('0x20')]['ids'],_[_0x9c94('0x29')](_0x330bd4[_0x9c94('0x20')],[_0x9c94('0x2a'),'id'])||{});}})['spread'](function(_0x514b78){logger[_0x9c94('0x13')](_0x9c94('0x2b'),_0x330bd4);logger[_0x9c94('0x16')]('AddTags',_0x330bd4,JSON['stringify'](_0x514b78));_0x4008e8(_0x514b78);})['catch'](function(_0x4aa5a9){logger[_0x9c94('0x19')]('AddTags',_0x4aa5a9[_0x9c94('0x1b')],_0x330bd4);_0x1581c0(_this[_0x9c94('0x19')](0x1f4,_0x4aa5a9['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 4906a96..370a725 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 _0xb470=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x56c9e5,_0x54e8b5){var _0x564062=function(_0xc325df){while(--_0xc325df){_0x56c9e5['push'](_0x56c9e5['shift']());}};_0x564062(++_0x54e8b5);}(_0xb470,0x8e));var _0x0b47=function(_0x4c326a,_0x193751){_0x4c326a=_0x4c326a-0x0;var _0x31a36a=_0xb470[_0x4c326a];return _0x31a36a;};'use strict';var MailInteractionEvents=require(_0x0b47('0x0'));var events=[_0x0b47('0x1'),'remove',_0x0b47('0x2')];function createListener(_0x2e42c8,_0x204055){return function(_0x5726bd){_0x204055[_0x0b47('0x3')](_0x2e42c8,_0x5726bd);};}function removeListener(_0x18bac1,_0x11f8b1){return function(){MailInteractionEvents[_0x0b47('0x4')](_0x18bac1,_0x11f8b1);};}exports[_0x0b47('0x5')]=function(_0x5de30e){for(var _0x4f285d=0x0,_0x3b7185=events[_0x0b47('0x6')];_0x4f285d<_0x3b7185;_0x4f285d++){var _0x173143=events[_0x4f285d];var _0x41de42=createListener(_0x0b47('0x7')+_0x173143,_0x5de30e);MailInteractionEvents['on'](_0x173143,_0x41de42);}}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ba96d42..536d91e 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 _0x8b29=['delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','mailmessage:create','create','update','put'];(function(_0x52eb36,_0x126bb0){var _0x5c8dce=function(_0x4b2e04){while(--_0x4b2e04){_0x52eb36['push'](_0x52eb36['shift']());}};_0x5c8dce(++_0x126bb0);}(_0x8b29,0xbe));var _0x98b2=function(_0x43a930,_0x2161e4){_0x43a930=_0x43a930-0x0;var _0x5d2c93=_0x8b29[_0x43a930];return _0x5d2c93;};'use strict';var multer=require(_0x98b2('0x0'));var util=require('util');var path=require(_0x98b2('0x1'));var timeout=require(_0x98b2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x98b2('0x3'));var auth=require(_0x98b2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x98b2('0x5'));var controller=require('./mailMessage.controller');router[_0x98b2('0x6')]('/',auth[_0x98b2('0x7')](),controller[_0x98b2('0x8')]);router[_0x98b2('0x6')](_0x98b2('0x9'),auth[_0x98b2('0x7')](),controller[_0x98b2('0xa')]);router[_0x98b2('0x6')](_0x98b2('0xb'),auth[_0x98b2('0x7')](),controller['show']);router['get'](_0x98b2('0xc'),auth[_0x98b2('0x7')](),controller[_0x98b2('0xd')]);router[_0x98b2('0xe')]('/',auth[_0x98b2('0x7')](),interaction[_0x98b2('0xf')]('mail',_0x98b2('0x10')),controller[_0x98b2('0x11')]);router['put'](_0x98b2('0xb'),auth[_0x98b2('0x7')](),controller[_0x98b2('0x12')]);router['put']('/:id/accept',auth[_0x98b2('0x7')](),controller['accept']);router[_0x98b2('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x98b2('0x14')](_0x98b2('0xb'),auth[_0x98b2('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7b23d4e..63d28ad 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 _0x79ef=['DATE','Email','Chat','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79ef,0x13b));var _0xf79e=function(_0x4c1a26,_0x295f28){_0x4c1a26=_0x4c1a26-0x0;var _0x50c14b=_0x79ef[_0x4c1a26];return _0x50c14b;};'use strict';var Sequelize=require(_0xf79e('0x0'));var _=require(_0xf79e('0x1'));module['exports']={'body':{'type':Sequelize[_0xf79e('0x2')](_0xf79e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf79e('0x2')](_0xf79e('0x4'))},'read':{'type':Sequelize[_0xf79e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf79e('0x6')]('in',_0xf79e('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf79e('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf79e('0x2')](_0xf79e('0x3'))},'cc':{'type':Sequelize[_0xf79e('0x2')](_0xf79e('0x3'))},'bcc':{'type':Sequelize[_0xf79e('0x2')]('long')},'subject':{'type':Sequelize[_0xf79e('0x2')]},'sentAt':{'type':Sequelize[_0xf79e('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf79e('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf79e('0x9')]},'originTo':{'type':Sequelize[_0xf79e('0x2')]('long')},'originCc':{'type':Sequelize[_0xf79e('0x2')](_0xf79e('0x3'))},'originChannel':{'type':Sequelize[_0xf79e('0x6')](_0xf79e('0xa'),_0xf79e('0xb')),'defaultValue':_0xf79e('0xa'),'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e62fa45..eb6ac46 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 _0xf712=['interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','User','rejectmessage','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachments','headers','bcc','existsSync','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','count','includeAll','include','findAll','rows','show','keys','length','find','body','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','ListId','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0xf712,0xcf));var _0x2f71=function(_0x48da50,_0x4d6a54){_0x48da50=_0x48da50-0x0;var _0xedbee=_0xf712[_0x48da50];return _0xedbee;};'use strict';var emlformat=require(_0x2f71('0x0'));var moment=require(_0x2f71('0x1'));var BPromise=require('bluebird');var util=require(_0x2f71('0x2'));var path=require(_0x2f71('0x3'));var fs=require('fs');var _=require(_0x2f71('0x4'));var Redis=require(_0x2f71('0x5'));var htmlToText=require(_0x2f71('0x6'));var qs=require(_0x2f71('0x7'));var logger=require(_0x2f71('0x8'))('api');var interaction_log=require(_0x2f71('0x8'))(_0x2f71('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2f71('0xa')]=_[_0x2f71('0xb')](config[_0x2f71('0xa')],{'host':_0x2f71('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f71('0xa')]));var htmlEntities=require('html-entities');require(_0x2f71('0xd'))[_0x2f71('0xe')](socket);var jayson=require(_0x2f71('0xf'));var client=jayson[_0x2f71('0x10')][_0x2f71('0x11')]({'port':0x232c});var client9003=jayson[_0x2f71('0x10')][_0x2f71('0x11')]({'port':0x232b});var client9002=jayson[_0x2f71('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b7e2e,_0x4ac406,_0x1a0d6a,_0x59a3b5){return new BPromise(function(_0x3cb546,_0x50fc05){var _0xca7203=_0x59a3b5||client;return _0xca7203[_0x2f71('0x12')](_0x4b7e2e,_0x1a0d6a)['then'](function(_0x5b0494){logger[_0x2f71('0x13')]('MailMessage,\x20%s,\x20%s',_0x4ac406,_0x2f71('0x14'));logger[_0x2f71('0x15')](_0x2f71('0x16'),_0x4ac406,_0x2f71('0x14'),JSON[_0x2f71('0x17')](_0x5b0494));if(_0x5b0494['error']){if(_0x5b0494[_0x2f71('0x18')][_0x2f71('0x19')]===0x1f4){logger['error'](_0x2f71('0x1a'),_0x4ac406,_0x5b0494[_0x2f71('0x18')]['message']);return _0x50fc05(_0x5b0494[_0x2f71('0x18')][_0x2f71('0x1b')]);}logger[_0x2f71('0x18')]('MailMessage,\x20%s,\x20%s',_0x4ac406,_0x5b0494[_0x2f71('0x18')]['message']);return _0x3cb546(_0x5b0494['error'][_0x2f71('0x1b')]);}else{logger[_0x2f71('0x13')](_0x2f71('0x1a'),_0x4ac406,'request\x20sent');_0x3cb546(_0x5b0494[_0x2f71('0x1c')][_0x2f71('0x1b')]);}})[_0x2f71('0x1d')](function(_0x672856){logger[_0x2f71('0x18')](_0x2f71('0x1a'),_0x4ac406,_0x672856);_0x50fc05(_0x672856);});});}function respondWithResult(_0xfaf46d,_0x3d3c8f){_0x3d3c8f=_0x3d3c8f||0xc8;return function(_0x3a6e42){if(_0x3a6e42){return _0xfaf46d[_0x2f71('0x1e')](_0x3d3c8f)[_0x2f71('0x1f')](_0x3a6e42);}};}function respondWithFilteredResult(_0x1a4f58,_0x368c45){return function(_0x392798){if(_0x392798){var _0x22c43b=typeof _0x368c45[_0x2f71('0x20')]===_0x2f71('0x21')&&typeof _0x368c45[_0x2f71('0x22')]==='undefined';var _0x2e7cda=_0x392798['count'];var _0x5f18f9=_0x22c43b?0x0:_0x368c45[_0x2f71('0x20')];var _0x34168c=_0x22c43b?_0x392798['count']:_0x368c45[_0x2f71('0x20')]+_0x368c45[_0x2f71('0x22')];var _0x3de9d2;if(_0x34168c>=_0x2e7cda){_0x34168c=_0x2e7cda;_0x3de9d2=0xc8;}else{_0x3de9d2=0xce;}_0x1a4f58[_0x2f71('0x1e')](_0x3de9d2);return _0x1a4f58[_0x2f71('0x23')](_0x2f71('0x24'),_0x5f18f9+'-'+_0x34168c+'/'+_0x2e7cda)['json'](_0x392798);}return null;};}function saveUpdates(_0x5a61f4){return function(_0x5e51d0){if(_0x5e51d0){return _0x5e51d0[_0x2f71('0x25')](_0x5a61f4)[_0x2f71('0x26')](function(_0x253cd0){return _0x253cd0;});}return null;};}function removeEntity(_0x1cfe4c){return function(_0xb3181e){if(_0xb3181e){return _0xb3181e[_0x2f71('0x27')]()[_0x2f71('0x26')](function(){_0x1cfe4c[_0x2f71('0x1e')](0xcc)[_0x2f71('0x28')]();});}};}function handleEntityNotFound(_0x4ab3f3){return function(_0x4dc93d){if(!_0x4dc93d){_0x4ab3f3[_0x2f71('0x29')](0x194);}return _0x4dc93d;};}function handleError(_0x2281c4,_0x219a76){_0x219a76=_0x219a76||0x1f4;return function(_0x51dd34){logger[_0x2f71('0x18')](_0x51dd34[_0x2f71('0x2a')]);if(_0x51dd34[_0x2f71('0x2b')]){delete _0x51dd34[_0x2f71('0x2b')];}_0x2281c4[_0x2f71('0x1e')](_0x219a76)[_0x2f71('0x2c')](_0x51dd34);};}exports['index']=function(_0x407555,_0x4f8b02){var _0x26e698={},_0x584f3b={},_0x550ec6={'count':0x0,'rows':[]};var _0x3b263f=_[_0x2f71('0x2d')](db['MailMessage'][_0x2f71('0x2e')],function(_0x16c378){return{'name':_0x16c378[_0x2f71('0x2f')],'type':_0x16c378[_0x2f71('0x30')][_0x2f71('0x31')]};});_0x584f3b[_0x2f71('0x32')]=_[_0x2f71('0x2d')](_0x3b263f,_0x2f71('0x2b'));_0x584f3b[_0x2f71('0x33')]=_['keys'](_0x407555[_0x2f71('0x33')]);_0x584f3b[_0x2f71('0x34')]=_[_0x2f71('0x35')](_0x584f3b[_0x2f71('0x32')],_0x584f3b['query']);_0x26e698[_0x2f71('0x36')]=_[_0x2f71('0x35')](_0x584f3b[_0x2f71('0x32')],qs[_0x2f71('0x37')](_0x407555[_0x2f71('0x33')][_0x2f71('0x37')]));_0x26e698[_0x2f71('0x36')]=_0x26e698['attributes']['length']?_0x26e698[_0x2f71('0x36')]:_0x584f3b[_0x2f71('0x32')];if(!_0x407555['query'][_0x2f71('0x38')](_0x2f71('0x39'))){_0x26e698['limit']=qs['limit'](_0x407555[_0x2f71('0x33')][_0x2f71('0x22')]);_0x26e698['offset']=qs[_0x2f71('0x20')](_0x407555[_0x2f71('0x33')][_0x2f71('0x20')]);}_0x26e698[_0x2f71('0x3a')]=qs[_0x2f71('0x3b')](_0x407555[_0x2f71('0x33')][_0x2f71('0x3b')]);_0x26e698[_0x2f71('0x3c')]=qs['filters'](_[_0x2f71('0x3d')](_0x407555['query'],_0x584f3b['filters']),_0x3b263f);if(_0x407555[_0x2f71('0x33')][_0x2f71('0x3e')]){_0x26e698[_0x2f71('0x3c')]=_[_0x2f71('0x3f')](_0x26e698[_0x2f71('0x3c')],{'$or':_[_0x2f71('0x2d')](_0x3b263f,function(_0x3d3548){if(_0x3d3548[_0x2f71('0x30')]!==_0x2f71('0x40')){var _0x19ca81={};_0x19ca81[_0x3d3548[_0x2f71('0x2b')]]={'$like':'%'+_0x407555[_0x2f71('0x33')][_0x2f71('0x3e')]+'%'};return _0x19ca81;}})});}_0x26e698=_[_0x2f71('0x3f')]({},_0x26e698,_0x407555[_0x2f71('0x41')]);var _0xa5ee0a={'where':_0x26e698[_0x2f71('0x3c')]};return db[_0x2f71('0x42')]['count'](_0xa5ee0a)['then'](function(_0x987acb){_0x550ec6[_0x2f71('0x43')]=_0x987acb;if(_0x407555[_0x2f71('0x33')][_0x2f71('0x44')]){_0x26e698[_0x2f71('0x45')]=[{'all':!![]}];}return db['MailMessage'][_0x2f71('0x46')](_0x26e698);})[_0x2f71('0x26')](function(_0x53d5c5){_0x550ec6[_0x2f71('0x47')]=_0x53d5c5;return _0x550ec6;})[_0x2f71('0x26')](respondWithFilteredResult(_0x4f8b02,_0x26e698))[_0x2f71('0x1d')](handleError(_0x4f8b02,null));};exports[_0x2f71('0x48')]=function(_0x58fde9,_0x44ef0e){var _0x429e55={'raw':!![],'where':{'id':_0x58fde9['params']['id']}},_0x4d8bd0={};_0x4d8bd0['model']=_[_0x2f71('0x49')](db['MailMessage'][_0x2f71('0x2e')]);_0x4d8bd0['query']=_[_0x2f71('0x49')](_0x58fde9[_0x2f71('0x33')]);_0x4d8bd0[_0x2f71('0x34')]=_['intersection'](_0x4d8bd0['model'],_0x4d8bd0['query']);_0x429e55['attributes']=_[_0x2f71('0x35')](_0x4d8bd0['model'],qs['fields'](_0x58fde9[_0x2f71('0x33')][_0x2f71('0x37')]));_0x429e55[_0x2f71('0x36')]=_0x429e55[_0x2f71('0x36')][_0x2f71('0x4a')]?_0x429e55[_0x2f71('0x36')]:_0x4d8bd0['model'];if(_0x58fde9['query']['includeAll']){_0x429e55['include']=[{'all':!![]}];}_0x429e55=_[_0x2f71('0x3f')]({},_0x429e55,_0x58fde9[_0x2f71('0x41')]);return db['MailMessage'][_0x2f71('0x4b')](_0x429e55)[_0x2f71('0x26')](handleEntityNotFound(_0x44ef0e,null))[_0x2f71('0x26')](respondWithResult(_0x44ef0e,null))[_0x2f71('0x1d')](handleError(_0x44ef0e,null));};exports[_0x2f71('0x25')]=function(_0x189496,_0x308e2a){if(_0x189496[_0x2f71('0x4c')]['id']){delete _0x189496[_0x2f71('0x4c')]['id'];}return db[_0x2f71('0x42')]['find']({'where':{'id':_0x189496[_0x2f71('0x4d')]['id']}})[_0x2f71('0x26')](handleEntityNotFound(_0x308e2a,null))[_0x2f71('0x26')](saveUpdates(_0x189496[_0x2f71('0x4c')],null))['then'](respondWithResult(_0x308e2a,null))['catch'](handleError(_0x308e2a,null));};exports[_0x2f71('0x27')]=function(_0x9b24aa,_0x4ab18a){return db['MailMessage'][_0x2f71('0x4b')]({'where':{'id':_0x9b24aa[_0x2f71('0x4d')]['id']}})[_0x2f71('0x26')](handleEntityNotFound(_0x4ab18a,null))['then'](removeEntity(_0x4ab18a,null))[_0x2f71('0x1d')](handleError(_0x4ab18a,null));};exports[_0x2f71('0x4e')]=function(_0x3303b5,_0x5839db){return db[_0x2f71('0x42')]['describe']()[_0x2f71('0x26')](respondWithResult(_0x5839db,null))[_0x2f71('0x1d')](handleError(_0x5839db,null));};exports[_0x2f71('0x4f')]=function(_0x1b685e,_0xecaa7f){return db[_0x2f71('0x42')][_0x2f71('0x4f')](_0x1b685e[_0x2f71('0x4c')])[_0x2f71('0x26')](function(_0x4a387e){if(_0x4a387e){if(_0x4a387e[_0x2f71('0x50')]===_0x2f71('0x51')&&!_0x4a387e[_0x2f71('0x52')]){var _0x2f7042,_0x25cb2b,_0x55ec1a;if(_0x1b685e['body']['to']){_0x25cb2b=_0x1b685e[_0x2f71('0x4c')]['to'][_0x2f71('0x53')](',')[0x0];}return db[_0x2f71('0x54')][_0x2f71('0x55')]({'where':{'id':_0x4a387e[_0x2f71('0x56')]},'include':[{'model':db[_0x2f71('0x57')],'as':_0x2f71('0x58'),'include':[{'model':db[_0x2f71('0x59')],'as':_0x2f71('0x5a'),'where':{'email':_0x25cb2b},'limit':0x1,'order':[[_0x2f71('0x5b'),'DESC']]}]},{'model':db[_0x2f71('0x5c')],'as':_0x2f71('0x5d'),'raw':!![],'include':[{'model':db[_0x2f71('0x5e')],'as':_0x2f71('0x5e'),'raw':!![]}]}]})[_0x2f71('0x26')](function(_0x1794a9){_0x2f7042=_0x1794a9;if(!_0x2f7042||!_0x2f7042['Smtp'])return;var _0x5b30c5=_0x2f7042['getSmtpOptions']();if(_0x1b685e[_0x2f71('0x4c')]['attachments']&&_0x1b685e[_0x2f71('0x4c')]['attachments'][_0x2f71('0x4a')]){for(var _0x397257=0x0;_0x397257<_0x1b685e[_0x2f71('0x4c')][_0x2f71('0x5f')]['length'];_0x397257+=0x1){_0x1b685e[_0x2f71('0x4c')]['attachments'][_0x397257]={'filename':_0x1b685e['body'][_0x2f71('0x5f')][_0x397257][_0x2f71('0x2b')],'path':path[_0x2f71('0x60')](config[_0x2f71('0x61')],_0x2f71('0x62'),_0x1b685e[_0x2f71('0x4c')][_0x2f71('0x5f')][_0x397257][_0x2f71('0x63')])};}}_0x55ec1a={'account':_0x5b30c5,'message':_0x1b685e['body']};return;})[_0x2f71('0x26')](function(){if(_0x2f7042['List']){if(_0x2f7042['List'][_0x2f71('0x5a')][_0x2f71('0x4a')]){return _0x2f7042[_0x2f71('0x58')][_0x2f71('0x5a')][0x0];}else{return db[_0x2f71('0x59')]['create'](_[_0x2f71('0xb')](_0x1b685e[_0x2f71('0x4c')],{'firstName':_0x1b685e[_0x2f71('0x4c')]['to'],'email':_0x1b685e[_0x2f71('0x4c')]['to'],'phone':_0x1b685e[_0x2f71('0x4c')]['to'],'ListId':_0x2f7042[_0x2f71('0x64')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x2f71('0x26')](function(){if(_0x55ec1a){return respondWithRpcPromise('SendMail',_0x2f71('0x65'),_0x55ec1a,client9003)[_0x2f71('0x26')](function(_0x830c92){return _0x4a387e['update']({'read':!![],'messageId':_0x830c92[_0x2f71('0x66')],'sentAt':moment()[_0x2f71('0x67')](_0x2f71('0x68'))});})[_0x2f71('0x1d')](function(_0x3d0f38){logger[_0x2f71('0x18')]('%s',JSON[_0x2f71('0x17')](_0x3d0f38));return _0x4a387e;});}return _0x4a387e;});}return _0x4a387e;}})[_0x2f71('0x26')](respondWithResult(_0xecaa7f,0xc9))[_0x2f71('0x1d')](handleError(_0xecaa7f,null));};exports[_0x2f71('0x69')]=function(_0xf20868,_0x1d9ff2){var _0xbc5503={'agent':{},'channel':_0x2f71('0x6a')};if(_0xf20868[_0x2f71('0x4c')]['id']){delete _0xf20868[_0x2f71('0x4c')]['id'];}_0xf20868[_0x2f71('0x4c')]['read']=!![];_0xf20868[_0x2f71('0x4c')][_0x2f71('0x6b')]=moment()['format'](_0x2f71('0x68'));_0xf20868[_0x2f71('0x4c')][_0x2f71('0x6c')]=_0xf20868['body'][_0x2f71('0x6c')]||_0xf20868[_0x2f71('0x6d')]['id'];_0xbc5503[_0x2f71('0x6e')]['id']=_0xf20868[_0x2f71('0x4c')][_0x2f71('0x6c')];return db[_0x2f71('0x42')][_0x2f71('0x4b')]({'where':{'id':_0xf20868[_0x2f71('0x4d')]['id'],'UserId':null}})[_0x2f71('0x26')](handleEntityNotFound(_0x1d9ff2,null))[_0x2f71('0x26')](saveUpdates(_0xf20868[_0x2f71('0x4c')],null))[_0x2f71('0x26')](function(_0x450354){if(_0x450354){_0xbc5503[_0x2f71('0x1b')]=_0x450354[_0x2f71('0x6f')]({'plain':!![]});return db[_0x2f71('0x70')]['find']({'where':{'id':_0x450354['MailInteractionId']}});}return null;})[_0x2f71('0x26')](handleEntityNotFound(_0x1d9ff2,null))[_0x2f71('0x26')](function(_0xe45e4e){if(_0xe45e4e){return _0xe45e4e[_0x2f71('0x25')]({'UserId':_0xf20868['body']['UserId'],'read1stAt':_[_0x2f71('0x71')](_0xe45e4e[_0x2f71('0x72')])?moment()['format'](_0x2f71('0x68')):undefined});}return null;})['then'](function(_0x27499a){if(_0x27499a){_0xbc5503[_0x2f71('0x73')]=_0x27499a[_0x2f71('0x6f')]({'plain':!![]});interaction_log[_0x2f71('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf20868[_0x2f71('0x6d')]['id'],_0xf20868[_0x2f71('0x6d')]['name'],_0xf20868[_0x2f71('0x6d')]['role'],_0xbc5503[_0x2f71('0x73')]['id'],_0xf20868[_0x2f71('0x4c')]?JSON[_0x2f71('0x17')](_0xf20868['body']):_0x2f71('0x74'));return respondWithRpcPromise(_0x2f71('0x75'),_0x2f71('0x76'),_0xbc5503);}return null;})[_0x2f71('0x26')](function(_0x83604c){var _0x7af428=_0x2f71('0x77')+_0x83604c[_0x2f71('0x1b')][_0x2f71('0x78')];return db['sequelize'][_0x2f71('0x33')](_0x7af428,{'type':db[_0x2f71('0x79')][_0x2f71('0x7a')][_0x2f71('0x7b')],'raw':!![]})[_0x2f71('0x26')](function(_0xa80c67){return _0xa80c67;});})[_0x2f71('0x26')](function(_0x4dda48){if(_0x4dda48){_0xbc5503[_0x2f71('0x1b')]['contact']=_0x4dda48[0x0];if(!_0xf20868[_0x2f71('0x4c')]['UserId'])return;return db['User'][_0x2f71('0x4b')]({'where':{'id':_0xf20868['body'][_0x2f71('0x6c')],'role':_0x2f71('0x6e')},'attributes':['id',_0x2f71('0x2b'),_0x2f71('0x7c'),_0x2f71('0x7d'),_0x2f71('0x7e')],'raw':!![]});}return null;})['then'](function(_0x5180fc){if(!_0x5180fc)return null;_0xbc5503['message'][_0x2f71('0x6e')]=_0x5180fc;return _0xbc5503;})[_0x2f71('0x26')](function(_0x34188c){if(_0x34188c){if(_0xf20868['body'][_0x2f71('0x7f')]){_0xbc5503[_0x2f71('0x1b')][_0x2f71('0x80')]=util['format'](_0x2f71('0x81'),_0xf20868[_0x2f71('0x6d')]['name']);_0xbc5503[_0x2f71('0x1b')][_0x2f71('0x82')]=_0xbc5503['channel'];_0xbc5503[_0x2f71('0x1b')][_0x2f71('0x83')]=_0xbc5503['channel'];_0xbc5503[_0x2f71('0x1b')][_0x2f71('0x84')]=_0x2f71('0x69');_0xbc5503[_0x2f71('0x1b')][_0x2f71('0x4c')]=htmlToText[_0x2f71('0x85')](_0xbc5503[_0x2f71('0x1b')][_0x2f71('0x4c')]);return respondWithRpcPromise(_0x2f71('0x86'),_0x2f71('0x86'),{'event':_0x2f71('0x87'),'message':_0xbc5503['message']},client9002)[_0x2f71('0x26')](function(){return _0xbc5503;});}return _0xbc5503;}return null;})[_0x2f71('0x26')](respondWithResult(_0x1d9ff2,null))[_0x2f71('0x1d')](handleError(_0x1d9ff2,null));};exports[_0x2f71('0x88')]=function(_0x1251ac,_0x4ee90a){var _0x535ee6={'agent':{},'channel':_0x2f71('0x6a')};if(_0x1251ac[_0x2f71('0x4c')]['id']){delete _0x1251ac[_0x2f71('0x4c')]['id'];}_0x1251ac[_0x2f71('0x4c')][_0x2f71('0x6c')]=_0x1251ac['body'][_0x2f71('0x6c')]||_0x1251ac[_0x2f71('0x6d')]['id'];_0x535ee6[_0x2f71('0x6e')]['id']=_0x1251ac[_0x2f71('0x4c')][_0x2f71('0x6c')];return db['MailMessage'][_0x2f71('0x4b')]({'where':{'id':_0x1251ac[_0x2f71('0x4d')]['id'],'UserId':null}})[_0x2f71('0x26')](handleEntityNotFound(_0x4ee90a,null))[_0x2f71('0x26')](function(_0x1fa37f){if(_0x1fa37f){_0x535ee6[_0x2f71('0x1b')]=_0x1fa37f[_0x2f71('0x6f')]({'plain':!![]});return db['MailInteraction'][_0x2f71('0x4b')]({'where':{'id':_0x1fa37f['MailInteractionId']}});}return null;})[_0x2f71('0x26')](handleEntityNotFound(_0x4ee90a,null))[_0x2f71('0x26')](function(_0x5e02f6){if(_0x5e02f6){_0x535ee6['interaction']=_0x5e02f6[_0x2f71('0x6f')]({'plain':!![]});interaction_log[_0x2f71('0x13')](_0x2f71('0x89'),_0x1251ac['user']['id'],_0x1251ac['user'][_0x2f71('0x2b')],_0x1251ac[_0x2f71('0x6d')]['role'],_0x535ee6[_0x2f71('0x73')]['id'],_0x1251ac[_0x2f71('0x4c')]?JSON['stringify'](_0x1251ac[_0x2f71('0x4c')]):_0x2f71('0x74'));return respondWithRpcPromise(_0x2f71('0x8a'),_0x2f71('0x8b'),_0x535ee6);}return null;})[_0x2f71('0x26')](function(_0x3da24e){var _0x343adb=_0x2f71('0x77')+_0x3da24e['message'][_0x2f71('0x78')];return db['sequelize'][_0x2f71('0x33')](_0x343adb,{'type':db[_0x2f71('0x79')][_0x2f71('0x7a')][_0x2f71('0x7b')],'raw':!![]})[_0x2f71('0x26')](function(_0xc59214){return _0xc59214;});})['then'](function(_0x577c22){if(_0x577c22){_0x535ee6[_0x2f71('0x1b')][_0x2f71('0x8c')]=_0x577c22[0x0];if(!_0x1251ac[_0x2f71('0x4c')][_0x2f71('0x6c')])return;return db[_0x2f71('0x8d')][_0x2f71('0x4b')]({'where':{'id':_0x1251ac[_0x2f71('0x4c')][_0x2f71('0x6c')],'role':_0x2f71('0x6e')},'attributes':['id','name','fullname','email',_0x2f71('0x7e')],'raw':!![]});}return null;})[_0x2f71('0x26')](function(_0x43d72b){if(!_0x43d72b)return null;_0x535ee6[_0x2f71('0x1b')][_0x2f71('0x6e')]=_0x43d72b;return _0x535ee6;})[_0x2f71('0x26')](function(_0x17a8af){if(_0x17a8af){_0x17a8af[_0x2f71('0x1b')]['interface']=util['format'](_0x2f71('0x81'),_0x1251ac['user']['name']);_0x17a8af[_0x2f71('0x1b')][_0x2f71('0x82')]=_0x535ee6[_0x2f71('0x82')];_0x17a8af[_0x2f71('0x1b')]['motionChannel']=_0x535ee6[_0x2f71('0x82')];_0x17a8af[_0x2f71('0x1b')]['event']=_0x2f71('0x88');_0x17a8af[_0x2f71('0x1b')][_0x2f71('0x4c')]=htmlToText[_0x2f71('0x85')](_0x535ee6[_0x2f71('0x1b')]['body']);respondWithRpcPromise(_0x2f71('0x86'),'EventManager',{'event':_0x2f71('0x8e'),'message':_0x17a8af[_0x2f71('0x1b')]},client9002);return _0x535ee6;}return null;})['then'](respondWithResult(_0x4ee90a,null))[_0x2f71('0x1d')](handleError(_0x4ee90a,null));};exports['download']=function(_0x5e1c25,_0x499849){var _0x5da949=moment()[_0x2f71('0x8f')]()[_0x2f71('0x90')]();var _0x38693c=path['join'](config['root'],_0x2f71('0x91'),_0x2f71('0x92'),_0x2f71('0x93'));var _0x453629=path[_0x2f71('0x60')](config[_0x2f71('0x61')],_0x2f71('0x91'),_0x2f71('0x92'),_0x2f71('0x5f'));var _0x3b692d=util['format'](_0x2f71('0x94'),_0x5da949);return db['MailMessage'][_0x2f71('0x4b')]({'where':{'id':_0x5e1c25[_0x2f71('0x4d')]['id']},'attributes':['id',_0x2f71('0x4c'),_0x2f71('0x95'),'to','cc','bcc',_0x2f71('0x96'),_0x2f71('0x97')],'include':_0x5e1c25[_0x2f71('0x33')][_0x2f71('0x5f')]?[{'model':db['Attachment'],'as':_0x2f71('0x98')}]:undefined})[_0x2f71('0x26')](handleEntityNotFound(_0x499849,null))[_0x2f71('0x26')](function(_0x1bfd43){if(_0x1bfd43){var _0x3aa957=_0x1bfd43;var _0x3f45ca={'from':_0x3aa957[_0x2f71('0x95')],'to':_0x3aa957['to'],'subject':_0x3aa957[_0x2f71('0x96')],'html':htmlEntities['decode'](_0x3aa957[_0x2f71('0x4c')]),'headers':{'Date':moment(_0x3aa957[_0x2f71('0x97')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1bfd43['cc']){_0x3f45ca[_0x2f71('0x99')]['Cc']=_0x1bfd43['cc'];}if(_0x1bfd43[_0x2f71('0x9a')]){_0x3f45ca['headers']['Bcc']=_0x1bfd43['bcc'];}return new BPromise(function(_0x2e8cad,_0x443c7e){if(_0x1bfd43[_0x2f71('0x98')]){for(var _0x5f040b=0x0;_0x5f040b<_0x1bfd43[_0x2f71('0x98')][_0x2f71('0x4a')];_0x5f040b++){var _0x1cea0f=_0x1bfd43['Attachments'][_0x5f040b];var _0x2b1cea=path['join'](_0x453629,_0x1cea0f[_0x2f71('0x63')]);if(fs[_0x2f71('0x9b')](_0x2b1cea)){_0x3f45ca[_0x2f71('0x5f')]['push']({'name':_0x1cea0f['name'],'contentType':_0x1cea0f[_0x2f71('0x30')],'data':fs[_0x2f71('0x9c')](_0x2b1cea)});}}}emlformat[_0x2f71('0x9d')](_0x3f45ca,function(_0x2ef862,_0x15e605){if(_0x2ef862)return _0x443c7e(_0x2ef862);fs[_0x2f71('0x9e')](path[_0x2f71('0x60')](_0x38693c,_0x3b692d),_0x15e605);return _0x2e8cad(_0x15e605);});});}})[_0x2f71('0x26')](function(_0x5744a2){if(_0x5744a2){return _0x499849[_0x2f71('0x9f')](path[_0x2f71('0x60')](_0x38693c,_0x3b692d),_0x3b692d,function(_0x521b5c){if(!_0x521b5c)fs[_0x2f71('0xa0')](path[_0x2f71('0x60')](_0x38693c,_0x3b692d));});}})[_0x2f71('0x1d')](handleError(_0x499849,null));}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f358763..b41250b 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 _0x91a6=['hook','exports','events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x2c1c86,_0xb5268b){var _0x127659=function(_0x598cbe){while(--_0x598cbe){_0x2c1c86['push'](_0x2c1c86['shift']());}};_0x127659(++_0xb5268b);}(_0x91a6,0x192));var _0x691a=function(_0x4fe112,_0x316e42){_0x4fe112=_0x4fe112-0x0;var _0x43a718=_0x91a6[_0x4fe112];return _0x43a718;};'use strict';var EventEmitter=require(_0x691a('0x0'));var MailMessage=require(_0x691a('0x1'))['db'][_0x691a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x691a('0x3'),'afterUpdate':_0x691a('0x4'),'afterDestroy':_0x691a('0x5')};function emitEvent(_0x234aee){return function(_0xde07d9,_0x5d10f6,_0x372202){MailMessageEvents['emit'](_0x234aee+':'+_0xde07d9['id'],_0xde07d9);MailMessageEvents[_0x691a('0x6')](_0x234aee,_0xde07d9);_0x372202(null);};}for(var e in events){if(events[_0x691a('0x7')](e)){var event=events[e];MailMessage[_0x691a('0x8')](e,emitEvent(event));}}module[_0x691a('0x9')]=MailMessageEvents; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 809105b..ac45b36 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 _0x3f08=['rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','update','catch','lodash','util','../../config/logger','moment','request-promise','html-to-text','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f08,0x138));var _0x83f0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x3f08[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x83f0('0x0'));var util=require(_0x83f0('0x1'));var logger=require(_0x83f0('0x2'))('api');var moment=require(_0x83f0('0x3'));var BPromise=require('bluebird');var rp=require(_0x83f0('0x4'));var htmlToText=require(_0x83f0('0x5'));var fs=require('fs');var path=require(_0x83f0('0x6'));var rimraf=require(_0x83f0('0x7'));var config=require(_0x83f0('0x8'));var attributes=require(_0x83f0('0x9'));module['exports']=function(_0x5a8ad1,_0x4a27f4){return _0x5a8ad1[_0x83f0('0xa')](_0x83f0('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x83f0('0xc'),'fields':[_0x83f0('0xc')]},{'name':_0x83f0('0xd'),'fields':[_0x83f0('0xe'),_0x83f0('0xf')],'type':_0x83f0('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4daae9,_0x1a576e,_0x5c39dd){if(_0x4daae9[_0x83f0('0x11')]){_0x4daae9[_0x83f0('0xe')]=htmlToText[_0x83f0('0x12')](_0x4daae9[_0x83f0('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5c39dd(null,_0x1a576e);},'afterCreate':function(_0x515860,_0x50bd9b,_0x116f42){var _0x3b98c=_0x5a8ad1['models'];var _0x4054a0=_0x515860[_0x83f0('0x13')]({'plain':!![]});if(_0x4054a0['direction'][_0x83f0('0x14')]()==='in'||_0x4054a0[_0x83f0('0x15')][_0x83f0('0x14')]()===_0x83f0('0x16')&&!_0x4054a0['secret']&&!_[_0x83f0('0x17')](_0x4054a0[_0x83f0('0x18')])){_0x3b98c[_0x83f0('0x19')][_0x83f0('0x1a')]({'where':{'id':_0x4054a0['MailInteractionId']}})['then'](function(_0x4d16a3){if(_0x4d16a3){_0x4d16a3[_0x83f0('0x1b')]({'lastMsgAt':_0x4054a0['createdAt'],'lastMsgDirection':_0x4054a0[_0x83f0('0x15')][_0x83f0('0x14')]()});}})[_0x83f0('0x1c')](function(_0x23579b){console['error'](_0x23579b);});}_0x116f42();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 609ad57..a2c7891 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 _0xb62e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','lodash','util'];(function(_0x3440ac,_0xdf234d){var _0x1ef3fa=function(_0x4a4b2f){while(--_0x4a4b2f){_0x3440ac['push'](_0x3440ac['shift']());}};_0x1ef3fa(++_0xdf234d);}(_0xb62e,0x1de));var _0xeb62=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb62e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});config[_0xeb62('0xc')]=_['defaults'](config[_0xeb62('0xc')],{'host':_0xeb62('0xd'),'port':0x18eb});var socket=require(_0xeb62('0xe'))(new Redis(config[_0xeb62('0xc')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4693c9,_0x40584b,_0x6d5e94){return new BPromise(function(_0xf93c21,_0x2fe923){return client[_0xeb62('0xf')](_0x4693c9,_0x6d5e94)[_0xeb62('0x10')](function(_0x3a826a){logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,'request\x20sent');logger[_0xeb62('0x13')](_0xeb62('0x14'),_0x40584b,_0xeb62('0x15'),JSON[_0xeb62('0x16')](_0x3a826a));if(_0x3a826a['error']){if(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x18')]===0x1f4){logger[_0xeb62('0x17')]('MailMessage,\x20%s,\x20%s',_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0x2fe923(_0x3a826a[_0xeb62('0x17')]['message']);}logger[_0xeb62('0x17')](_0xeb62('0x12'),_0x40584b,_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);return _0xf93c21(_0x3a826a[_0xeb62('0x17')][_0xeb62('0x19')]);}else{logger[_0xeb62('0x11')](_0xeb62('0x12'),_0x40584b,_0xeb62('0x15'));_0xf93c21(_0x3a826a[_0xeb62('0x1a')][_0xeb62('0x19')]);}})[_0xeb62('0x1b')](function(_0x3cdf76){logger['error'](_0xeb62('0x12'),_0x40584b,_0x3cdf76);_0x2fe923(_0x3cdf76);});});}exports[_0xeb62('0x1c')]=function(_0x332396){var _0xb44905=this;return new Promise(function(_0x425817,_0x24cbf3){return db[_0xeb62('0x1d')]['create'](_0x332396['body'],{'raw':_0x332396[_0xeb62('0x1e')]?_0x332396[_0xeb62('0x1e')][_0xeb62('0x1f')]===undefined?!![]:![]:!![]})[_0xeb62('0x10')](function(_0x122b15){logger['info']('CreateMailMessage',_0x332396);logger[_0xeb62('0x13')](_0xeb62('0x1c'),_0x332396,JSON[_0xeb62('0x16')](_0x122b15));_0x425817(_0x122b15);})[_0xeb62('0x1b')](function(_0x55a169){logger['error'](_0xeb62('0x1c'),_0x55a169['message'],_0x332396);_0x24cbf3(_0xb44905[_0xeb62('0x17')](0x1f4,_0x55a169['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 817ba5b..36e7ef7 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 _0x207d=['save','remove','update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x4a975a,_0x54004d){var _0x248d01=function(_0x33d0d9){while(--_0x33d0d9){_0x4a975a['push'](_0x4a975a['shift']());}};_0x248d01(++_0x54004d);}(_0x207d,0x10d));var _0xd207=function(_0x2069d7,_0x5cc32d){_0x2069d7=_0x2069d7-0x0;var _0x5a323a=_0x207d[_0x2069d7];return _0x5a323a;};'use strict';var MailMessageEvents=require(_0xd207('0x0'));var events=[_0xd207('0x1'),_0xd207('0x2'),_0xd207('0x3')];function createListener(_0x562f74,_0xbc74a3){return function(_0x5f1be4){_0xbc74a3[_0xd207('0x4')](_0x562f74,_0x5f1be4);};}function removeListener(_0x422501,_0x5351ed){return function(){MailMessageEvents[_0xd207('0x5')](_0x422501,_0x5351ed);};}exports[_0xd207('0x6')]=function(_0x18102b){for(var _0x2a8138=0x0,_0x2e0cfe=events[_0xd207('0x7')];_0x2a8138<_0x2e0cfe;_0x2a8138++){var _0x3e09c7=events[_0x2a8138];var _0x7def24=createListener(_0xd207('0x8')+_0x3e09c7,_0x18102b);MailMessageEvents['on'](_0x3e09c7,_0x7def24);}}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index da62f23..054acde 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 _0x36fd=['/:id','update','delete','removeTeams','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents'];(function(_0x3ca6e4,_0x438db3){var _0x3893cd=function(_0x1179c1){while(--_0x1179c1){_0x3ca6e4['push'](_0x3ca6e4['shift']());}};_0x3893cd(++_0x438db3);}(_0x36fd,0x12e));var _0xd36f=function(_0x322415,_0x186d0e){_0x322415=_0x322415-0x0;var _0x425127=_0x36fd[_0x322415];return _0x425127;};'use strict';var multer=require(_0xd36f('0x0'));var util=require(_0xd36f('0x1'));var path=require(_0xd36f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd36f('0x3'));var router=express[_0xd36f('0x4')]();var fs_extra=require(_0xd36f('0x5'));var auth=require(_0xd36f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd36f('0x7'));router['get']('/',auth[_0xd36f('0x8')](),controller[_0xd36f('0x9')]);router[_0xd36f('0xa')](_0xd36f('0xb'),auth[_0xd36f('0x8')](),controller[_0xd36f('0xc')]);router[_0xd36f('0xa')]('/:id',auth[_0xd36f('0x8')](),controller[_0xd36f('0xd')]);router[_0xd36f('0xa')]('/:id/members',auth[_0xd36f('0x8')](),controller[_0xd36f('0xe')]);router[_0xd36f('0xa')](_0xd36f('0xf'),auth[_0xd36f('0x8')](),controller[_0xd36f('0x10')]);router[_0xd36f('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xd36f('0x11')]);router[_0xd36f('0x12')]('/',auth[_0xd36f('0x8')](),controller[_0xd36f('0x13')]);router[_0xd36f('0x12')]('/:id/teams',auth[_0xd36f('0x8')](),controller['addTeams']);router[_0xd36f('0x12')](_0xd36f('0x14'),auth[_0xd36f('0x8')](),controller[_0xd36f('0x15')]);router['put'](_0xd36f('0x16'),auth['isAuthenticated'](),controller[_0xd36f('0x17')]);router[_0xd36f('0x18')](_0xd36f('0x16'),auth[_0xd36f('0x8')](),controller['destroy']);router[_0xd36f('0x18')]('/:id/teams',auth[_0xd36f('0x8')](),controller[_0xd36f('0x19')]);router[_0xd36f('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xd36f('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1744178..55447d5 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 _0xbe86=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xbe86,0x185));var _0x6be8=function(_0xe8e91,_0x401ca3){_0xe8e91=_0xe8e91-0x0;var _0x1258fe=_0xbe86[_0xe8e91];return _0x1258fe;};'use strict';var Sequelize=require(_0x6be8('0x0'));module[_0x6be8('0x1')]={'name':{'type':Sequelize[_0x6be8('0x2')],'unique':_0x6be8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6be8('0x2')]},'timeout':{'type':Sequelize[_0x6be8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6be8('0x5')]('rrmemory',_0x6be8('0x6'),_0x6be8('0x7'))}}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6bdd9d3..e3cbd17 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 _0x4007=['field','tq.TeamId','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','includes','all','union','value','ids','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','status','end','json','offset','limit','undefined','count','set','update','then','get','MailQueues','sendStatus','error','stack','name','send','index','MailQueue','key','getOptions','where','include','query','findAll','catch','params','keys','filters','intersection','model','fields','attributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','destroy','describe','getMembers','findOne','UserMailQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','merge','map','User','findAndCountAll','UserId','mailPause','rows','format','createdAt','getTeams','Team','length','addTeams','online','voicePause','flatMap','Agents','transaction','findOrCreate','forEach','userMailQueue:save','removeTeams','select'];(function(_0x3acd82,_0x238f31){var _0x5e87bd=function(_0x40826b){while(--_0x40826b){_0x3acd82['push'](_0x3acd82['shift']());}};_0x5e87bd(++_0x238f31);}(_0x4007,0xfc));var _0x7400=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4007[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x7400('0x0'));var _=require(_0x7400('0x1'));var squel=require(_0x7400('0x2'));var Redis=require(_0x7400('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x7400('0x4'))('api');var config=require(_0x7400('0x5'));var db=require(_0x7400('0x6'))['db'];config['redis']=_[_0x7400('0x7')](config['redis'],{'host':_0x7400('0x8'),'port':0x18eb});var socket=require(_0x7400('0x9'))(new Redis(config[_0x7400('0xa')]));require(_0x7400('0xb'))[_0x7400('0xc')](socket);function respondWithStatusCode(_0x469761,_0x495f0d){_0x495f0d=_0x495f0d||0xcc;return function(_0x4e2294){if(_0x4e2294){return _0x469761['sendStatus'](_0x495f0d);}return _0x469761[_0x7400('0xd')](_0x495f0d)[_0x7400('0xe')]();};}function respondWithResult(_0x5007d1,_0x65e7bb){_0x65e7bb=_0x65e7bb||0xc8;return function(_0x37de87){if(_0x37de87){return _0x5007d1[_0x7400('0xd')](_0x65e7bb)[_0x7400('0xf')](_0x37de87);}};}function respondWithFilteredResult(_0x4b0125,_0x1cb6f0){return function(_0x34ad57){if(_0x34ad57){var _0x4b9fd8=typeof _0x1cb6f0[_0x7400('0x10')]==='undefined'&&typeof _0x1cb6f0[_0x7400('0x11')]===_0x7400('0x12');var _0x39aaf9=_0x34ad57[_0x7400('0x13')];var _0x1435bd=_0x4b9fd8?0x0:_0x1cb6f0[_0x7400('0x10')];var _0x1278c0=_0x4b9fd8?_0x34ad57['count']:_0x1cb6f0[_0x7400('0x10')]+_0x1cb6f0[_0x7400('0x11')];var _0x109188;if(_0x1278c0>=_0x39aaf9){_0x1278c0=_0x39aaf9;_0x109188=0xc8;}else{_0x109188=0xce;}_0x4b0125['status'](_0x109188);return _0x4b0125[_0x7400('0x14')]('Content-Range',_0x1435bd+'-'+_0x1278c0+'/'+_0x39aaf9)['json'](_0x34ad57);}return null;};}function saveUpdates(_0x18a940){return function(_0x25588c){if(_0x25588c){return _0x25588c[_0x7400('0x15')](_0x18a940)['then'](function(_0xdf8728){return _0xdf8728;});}return null;};}function removeEntity(_0xdcb207){return function(_0x1a4820){if(_0x1a4820){return _0x1a4820['destroy']()[_0x7400('0x16')](function(){var _0x9a69d1=_0x1a4820[_0x7400('0x17')]({'plain':!![]});var _0xd747dc=_0x7400('0x18');return db['UserProfileResource']['destroy']({'where':{'type':_0xd747dc,'resourceId':_0x9a69d1['id']}})[_0x7400('0x16')](function(){return _0x1a4820;});})[_0x7400('0x16')](function(){_0xdcb207[_0x7400('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e94f){return function(_0x4c2e04){if(!_0x4c2e04){_0x34e94f[_0x7400('0x19')](0x194);}return _0x4c2e04;};}function handleError(_0x422155,_0x3d8295){_0x3d8295=_0x3d8295||0x1f4;return function(_0x290c63){logger[_0x7400('0x1a')](_0x290c63[_0x7400('0x1b')]);if(_0x290c63[_0x7400('0x1c')]){delete _0x290c63[_0x7400('0x1c')];}_0x422155[_0x7400('0xd')](_0x3d8295)[_0x7400('0x1d')](_0x290c63);};}exports[_0x7400('0x1e')]=function(_0x3c1093,_0x1dde91){var _0x1d4909={};var _0x3300a3={'count':0x0,'rows':[]};var _0x5d2e24=_['map'](db[_0x7400('0x1f')]['rawAttributes'],function(_0x37f819){return{'name':_0x37f819['fieldName'],'type':_0x37f819['type'][_0x7400('0x20')]};});_0x1d4909=qs[_0x7400('0x21')](_0x5d2e24,_0x3c1093);var _0x4e7ca8={'where':_0x1d4909[_0x7400('0x22')]};return db[_0x7400('0x1f')][_0x7400('0x13')](_0x4e7ca8)[_0x7400('0x16')](function(_0x1c2e24){_0x3300a3[_0x7400('0x13')]=_0x1c2e24;_0x1d4909['include']=qs[_0x7400('0x23')](_0x3c1093[_0x7400('0x24')]);return db['MailQueue'][_0x7400('0x25')](_0x1d4909);})['then'](function(_0x3d2fc0){_0x3300a3['rows']=_0x3d2fc0;return _0x3300a3;})['then'](respondWithFilteredResult(_0x1dde91,_0x1d4909))[_0x7400('0x26')](handleError(_0x1dde91,null));};exports['show']=function(_0x203b83,_0x482e49){var _0x9cb62e={'raw':!![],'where':{'id':_0x203b83[_0x7400('0x27')]['id']}},_0x3487e0={};_0x3487e0['model']=_['keys'](db[_0x7400('0x1f')]['rawAttributes']);_0x3487e0[_0x7400('0x24')]=_[_0x7400('0x28')](_0x203b83[_0x7400('0x24')]);_0x3487e0[_0x7400('0x29')]=_[_0x7400('0x2a')](_0x3487e0[_0x7400('0x2b')],_0x3487e0['query']);_0x9cb62e['attributes']=_[_0x7400('0x2a')](_0x3487e0[_0x7400('0x2b')],qs['fields'](_0x203b83[_0x7400('0x24')][_0x7400('0x2c')]));_0x9cb62e['attributes']=_0x9cb62e[_0x7400('0x2d')]['length']?_0x9cb62e[_0x7400('0x2d')]:_0x3487e0[_0x7400('0x2b')];if(_0x203b83[_0x7400('0x24')]['includeAll']){_0x9cb62e[_0x7400('0x23')]=[{'all':!![]}];}_0x9cb62e=_['merge']({},_0x9cb62e,_0x203b83[_0x7400('0x2e')]);return db[_0x7400('0x1f')]['find'](_0x9cb62e)[_0x7400('0x16')](handleEntityNotFound(_0x482e49,null))[_0x7400('0x16')](respondWithResult(_0x482e49,null))[_0x7400('0x26')](handleError(_0x482e49,null));};exports[_0x7400('0x2f')]=function(_0x35c3d1,_0x5dda42){return db[_0x7400('0x1f')][_0x7400('0x2f')](_0x35c3d1[_0x7400('0x30')],{})[_0x7400('0x16')](function(_0x4a53f4){var _0x37f97f=_0x35c3d1[_0x7400('0x31')][_0x7400('0x17')]({'plain':!![]});if(!_0x37f97f)throw new Error(_0x7400('0x32'));if(_0x37f97f[_0x7400('0x33')]==='user'){var _0x3f4c2f=_0x4a53f4[_0x7400('0x17')]({'plain':!![]});var _0x50ac0d='MailQueues';return db[_0x7400('0x34')][_0x7400('0x35')]({'where':{'name':_0x50ac0d,'userProfileId':_0x37f97f['userProfileId']},'raw':!![]})[_0x7400('0x16')](function(_0x48d744){if(_0x48d744&&_0x48d744['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3f4c2f[_0x7400('0x1c')],'resourceId':_0x3f4c2f['id'],'type':_0x48d744['name'],'sectionId':_0x48d744['id']},{})[_0x7400('0x16')](function(){return _0x4a53f4;});}else{return _0x4a53f4;}})['catch'](function(_0x4ed3c7){logger[_0x7400('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed3c7);throw _0x4ed3c7;});}return _0x4a53f4;})[_0x7400('0x16')](respondWithResult(_0x5dda42,0xc9))[_0x7400('0x26')](handleError(_0x5dda42,null));};exports[_0x7400('0x15')]=function(_0x56b233,_0x2b809e){if(_0x56b233[_0x7400('0x30')]['id']){delete _0x56b233['body']['id'];}return db[_0x7400('0x1f')][_0x7400('0x35')]({'where':{'id':_0x56b233[_0x7400('0x27')]['id']}})['then'](handleEntityNotFound(_0x2b809e,null))[_0x7400('0x16')](saveUpdates(_0x56b233[_0x7400('0x30')],null))[_0x7400('0x16')](respondWithResult(_0x2b809e,null))[_0x7400('0x26')](handleError(_0x2b809e,null));};exports[_0x7400('0x36')]=function(_0x2be51e,_0x8bf113){return db[_0x7400('0x1f')]['find']({'where':{'id':_0x2be51e[_0x7400('0x27')]['id']}})[_0x7400('0x16')](handleEntityNotFound(_0x8bf113,null))[_0x7400('0x16')](removeEntity(_0x8bf113,null))[_0x7400('0x26')](handleError(_0x8bf113,null));};exports[_0x7400('0x37')]=function(_0x438903,_0x7611b7){return db['MailQueue'][_0x7400('0x37')]()[_0x7400('0x16')](respondWithResult(_0x7611b7,null))[_0x7400('0x26')](handleError(_0x7611b7,null));};exports[_0x7400('0x38')]=function(_0x41dee3,_0x16baa7){var _0x90ae50={'raw':!![],'where':{}},_0x351cd2={},_0x3e38a6;return db[_0x7400('0x1f')][_0x7400('0x39')]({'where':{'id':_0x41dee3[_0x7400('0x27')]['id']}})[_0x7400('0x16')](handleEntityNotFound(_0x16baa7,null))[_0x7400('0x16')](function(_0x5453ab){if(_0x5453ab){_0x3e38a6=_0x5453ab['get']({'plain':!![]});_0x351cd2[_0x7400('0x2b')]=_[_0x7400('0x28')](db[_0x7400('0x3a')][_0x7400('0x3b')]);_0x351cd2[_0x7400('0x24')]=_['keys'](_0x41dee3['query']);_0x351cd2[_0x7400('0x29')]=_[_0x7400('0x2a')](_0x351cd2['model'],_0x351cd2[_0x7400('0x24')]);_0x90ae50[_0x7400('0x2d')]=_['intersection'](_0x351cd2['model'],qs[_0x7400('0x2c')](_0x41dee3[_0x7400('0x24')][_0x7400('0x2c')]));_0x90ae50[_0x7400('0x2d')]=_0x90ae50[_0x7400('0x2d')]['length']?_0x90ae50[_0x7400('0x2d')]:_0x351cd2[_0x7400('0x2b')];if(!_0x41dee3[_0x7400('0x24')][_0x7400('0x3c')](_0x7400('0x3d'))){_0x90ae50[_0x7400('0x11')]=qs[_0x7400('0x11')](_0x41dee3[_0x7400('0x24')][_0x7400('0x11')]);_0x90ae50[_0x7400('0x10')]=qs[_0x7400('0x10')](_0x41dee3[_0x7400('0x24')]['offset']);}_0x90ae50[_0x7400('0x3e')]=qs['sort'](_0x41dee3[_0x7400('0x24')][_0x7400('0x3f')]);_0x90ae50[_0x7400('0x22')]=qs[_0x7400('0x29')](_[_0x7400('0x40')](_0x41dee3['query'],_0x351cd2['filters']));_0x90ae50[_0x7400('0x22')][_0x7400('0x41')]=_0x5453ab['id'];if(_0x41dee3[_0x7400('0x24')][_0x7400('0x42')]){_0x90ae50['where']=_[_0x7400('0x43')](_0x90ae50['where'],{'$or':_[_0x7400('0x44')](_0x90ae50[_0x7400('0x2d')],function(_0x17baf9){var _0x187d58={};_0x187d58[_0x17baf9]={'$like':'%'+_0x41dee3[_0x7400('0x24')][_0x7400('0x42')]+'%'};return _0x187d58;})});}_0x90ae50=_[_0x7400('0x43')]({},_0x90ae50,_0x41dee3[_0x7400('0x2e')]);return db[_0x7400('0x3a')][_0x7400('0x25')](_0x90ae50);}})['then'](function(_0x4b76bc){if(_0x4b76bc){return db[_0x7400('0x45')][_0x7400('0x46')]({'where':{'id':_['map'](_0x4b76bc,_0x7400('0x47')),'role':'agent'},'attributes':['id','name',_0x7400('0x48'),'updatedAt','createdAt']});}})[_0x7400('0x16')](function(_0x159fc6){if(_0x159fc6){return{'count':_0x159fc6[_0x7400('0x13')],'rows':_[_0x7400('0x44')](_0x159fc6[_0x7400('0x49')],function(_0x740cf6){return{'membername':_0x740cf6['name'],'UserId':_0x740cf6['id'],'queue_name':_0x3e38a6[_0x7400('0x1c')],'MailQueueId':_0x3e38a6['id'],'interface':util[_0x7400('0x4a')]('%s/%s','SIP',_0x740cf6['name']),'penalty':0x0,'paused':_0x740cf6[_0x7400('0x48')],'createdAt':_0x740cf6[_0x7400('0x4b')],'updatedAt':_0x740cf6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x16baa7,_0x90ae50))[_0x7400('0x26')](handleError(_0x16baa7,null));};exports[_0x7400('0x4c')]=function(_0x396100,_0x55908b){var _0x8ced1={};var _0xb3cb9d={};var _0x5a5f70;var _0x26515f;return db[_0x7400('0x1f')][_0x7400('0x39')]({'where':{'id':_0x396100[_0x7400('0x27')]['id']}})['then'](handleEntityNotFound(_0x55908b,null))[_0x7400('0x16')](function(_0x37737c){if(_0x37737c){_0x5a5f70=_0x37737c;_0xb3cb9d[_0x7400('0x2b')]=_['keys'](db[_0x7400('0x4d')][_0x7400('0x3b')]);_0xb3cb9d[_0x7400('0x24')]=_[_0x7400('0x28')](_0x396100[_0x7400('0x24')]);_0xb3cb9d[_0x7400('0x29')]=_[_0x7400('0x2a')](_0xb3cb9d['model'],_0xb3cb9d[_0x7400('0x24')]);_0x8ced1[_0x7400('0x2d')]=_[_0x7400('0x2a')](_0xb3cb9d[_0x7400('0x2b')],qs[_0x7400('0x2c')](_0x396100[_0x7400('0x24')][_0x7400('0x2c')]));_0x8ced1[_0x7400('0x2d')]=_0x8ced1[_0x7400('0x2d')]['length']?_0x8ced1[_0x7400('0x2d')]:_0xb3cb9d[_0x7400('0x2b')];_0x8ced1[_0x7400('0x3e')]=qs[_0x7400('0x3f')](_0x396100['query'][_0x7400('0x3f')]);_0x8ced1[_0x7400('0x22')]=qs[_0x7400('0x29')](_['pick'](_0x396100[_0x7400('0x24')],_0xb3cb9d[_0x7400('0x29')]));if(_0x396100[_0x7400('0x24')][_0x7400('0x42')]){_0x8ced1[_0x7400('0x22')]=_[_0x7400('0x43')](_0x8ced1['where'],{'$or':_[_0x7400('0x44')](_0x8ced1['attributes'],function(_0x4d115e){var _0x1c637b={};_0x1c637b[_0x4d115e]={'$like':'%'+_0x396100[_0x7400('0x24')][_0x7400('0x42')]+'%'};return _0x1c637b;})});}_0x8ced1=_[_0x7400('0x43')]({},_0x8ced1,_0x396100[_0x7400('0x2e')]);return _0x5a5f70[_0x7400('0x4c')](_0x8ced1);}})[_0x7400('0x16')](function(_0x4d8a8d){if(_0x4d8a8d){_0x26515f=_0x4d8a8d[_0x7400('0x4e')];if(!_0x396100[_0x7400('0x24')][_0x7400('0x3c')](_0x7400('0x3d'))){_0x8ced1['limit']=qs['limit'](_0x396100[_0x7400('0x24')][_0x7400('0x11')]);_0x8ced1[_0x7400('0x10')]=qs[_0x7400('0x10')](_0x396100[_0x7400('0x24')][_0x7400('0x10')]);}return _0x5a5f70[_0x7400('0x4c')](_0x8ced1);}})['then'](function(_0x3bdca5){if(_0x3bdca5){return _0x3bdca5?{'count':_0x26515f,'rows':_0x3bdca5}:null;}})[_0x7400('0x16')](respondWithResult(_0x55908b,null))[_0x7400('0x26')](handleError(_0x55908b,null));};exports[_0x7400('0x4f')]=function(_0x421e3f,_0xf7c048){var _0x255326=_0x421e3f[_0x7400('0x30')]['ids'];return db[_0x7400('0x4d')][_0x7400('0x25')]({'where':{'id':_0x255326},'attributes':['id'],'include':[{'model':db[_0x7400('0x45')],'as':'Agents','attributes':['id','name',_0x7400('0x50'),_0x7400('0x51'),'interface'],'raw':!![]}]})[_0x7400('0x16')](function(_0x151d92){if(_0x151d92){var _0x37ee6d=_[_0x7400('0x52')](_0x151d92,function(_0x2960f1){var _0x5c1e5c=_0x2960f1[_0x7400('0x17')]({'plain':!![]});return _0x5c1e5c[_0x7400('0x53')];});return db[_0x7400('0x1f')]['find']({'where':{'id':_0x421e3f[_0x7400('0x27')]['id']}})[_0x7400('0x16')](function(_0x2008e7){return db['sequelize'][_0x7400('0x54')](function(_0x5178d8){return _0x2008e7[_0x7400('0x4f')](_0x255326,{'transaction':_0x5178d8})[_0x7400('0x16')](function(){return BPromise['each'](_0x37ee6d,function(_0x49c98c){return db[_0x7400('0x3a')][_0x7400('0x55')]({'where':{'UserId':_0x49c98c['id'],'MailQueueId':_0x421e3f[_0x7400('0x27')]['id']},'transaction':_0x5178d8});});})[_0x7400('0x16')](function(){_0x37ee6d[_0x7400('0x56')](function(_0x176788){socket['emit'](_0x7400('0x57'),{'UserId':_0x176788['id'],'MailQueueId':_0x2008e7['id']});});});});});}})['then'](respondWithStatusCode(_0xf7c048,null))[_0x7400('0x26')](handleError(_0xf7c048,null));};exports[_0x7400('0x58')]=function(_0x405a5a,_0x44ade2){return db[_0x7400('0x4d')][_0x7400('0x25')]({'where':{'id':_0x405a5a[_0x7400('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7400('0x53'),'attributes':['id'],'raw':!![]}]})[_0x7400('0x16')](handleEntityNotFound(_0x44ade2,null))[_0x7400('0x16')](function(_0x279e38){var _0x95c712=_[_0x7400('0x44')](_0x279e38,'id');var _0x22da34=[];var _0x1c08df=[];var _0x2933a9=squel[_0x7400('0x59')]();_0x2933a9[_0x7400('0x5a')](_0x7400('0x5b'))['from'](_0x7400('0x5c'),'tq')['join']('user_has_teams','ut',_0x7400('0x5d'))[_0x7400('0x22')](_0x7400('0x5e'),_0x405a5a[_0x7400('0x27')]['id']);for(var _0x40965c=0x0;_0x40965c<_0x279e38[_0x7400('0x4e')];_0x40965c+=0x1){let _0x568c42=_0x279e38[_0x40965c];for(var _0x31d1af=0x0;_0x31d1af<_0x568c42['Agents'][_0x7400('0x4e')];_0x31d1af+=0x1){let _0x2322f6=_0x568c42[_0x7400('0x53')][_0x31d1af];var _0x32e10e=_0x2933a9['clone']();_0x32e10e[_0x7400('0x22')](_0x7400('0x5f'),_0x2322f6['id']);_0x1c08df[_0x7400('0x60')](db[_0x7400('0x61')]['query'](_0x32e10e[_0x7400('0x62')](),{'type':db['sequelize'][_0x7400('0x63')]['SELECT']})['then'](function(_0x352f81){if(_0x352f81[_0x7400('0x4e')]===0x1){return _0x2322f6['id'];}else{var _0x3ac7dc=_[_0x7400('0x64')](_[_0x7400('0x44')](_0x352f81,'TeamId'),function(_0x45128a){return _[_0x7400('0x65')](_0x95c712,_0x45128a);});if(_0x3ac7dc){return _0x2322f6['id'];}}}));}}return BPromise[_0x7400('0x66')](_0x1c08df)[_0x7400('0x16')](function(_0x40cc2b){_0x22da34=_(_0x22da34)[_0x7400('0x67')](_0x40cc2b)['compact']()[_0x7400('0x68')]();return db[_0x7400('0x1f')][_0x7400('0x35')]({'where':{'id':_0x405a5a[_0x7400('0x27')]['id']}})[_0x7400('0x16')](function(_0x7c95dd){return db[_0x7400('0x61')]['transaction'](function(_0x1e5434){return _0x7c95dd[_0x7400('0x58')](_0x405a5a['query'][_0x7400('0x69')],{'transaction':_0x1e5434})[_0x7400('0x16')](function(){if(!_['isEmpty'](_0x22da34)){return _0x7c95dd[_0x7400('0x6a')](_0x22da34,{'transaction':_0x1e5434});}})[_0x7400('0x16')](function(){_0x22da34['forEach'](function(_0x495924){socket[_0x7400('0x6b')](_0x7400('0x6c'),{'UserId':_0x495924,'MailQueueId':_0x7c95dd['id']});});});});});});})[_0x7400('0x16')](respondWithStatusCode(_0x44ade2,null))['catch'](handleError(_0x44ade2,null));};exports[_0x7400('0x6d')]=function(_0x2301d7,_0xe5d811){return db['MailQueue'][_0x7400('0x35')]({'where':{'id':_0x2301d7[_0x7400('0x27')]['id']}})[_0x7400('0x16')](handleEntityNotFound(_0xe5d811,null))['then'](function(_0x2dcd48){if(_0x2dcd48){return _0x2dcd48[_0x7400('0x6d')](_0x2301d7[_0x7400('0x30')][_0x7400('0x69')],_[_0x7400('0x6e')](_0x2301d7[_0x7400('0x30')],[_0x7400('0x69'),'id'])||{})[_0x7400('0x6f')](function(_0x5cca8c){for(var _0x30c0c1=0x0;_0x30c0c1<_0x2301d7[_0x7400('0x30')][_0x7400('0x69')][_0x7400('0x4e')];_0x30c0c1+=0x1){socket[_0x7400('0x6b')](_0x7400('0x57'),{'UserId':Number(_0x2301d7[_0x7400('0x30')][_0x7400('0x69')][_0x30c0c1]),'MailQueueId':Number(_0x2301d7[_0x7400('0x27')]['id'])});}return _0x5cca8c;});}})[_0x7400('0x16')](respondWithResult(_0xe5d811,null))[_0x7400('0x26')](handleError(_0xe5d811,null));};exports[_0x7400('0x6a')]=function(_0x16d9b1,_0x462b37){return db[_0x7400('0x1f')][_0x7400('0x35')]({'where':{'id':_0x16d9b1[_0x7400('0x27')]['id']}})['then'](handleEntityNotFound(_0x462b37,null))[_0x7400('0x16')](function(_0x3227a3){if(_0x3227a3){return _0x3227a3[_0x7400('0x6a')](_0x16d9b1[_0x7400('0x24')]['ids'])[_0x7400('0x16')](function(){if(_[_0x7400('0x70')](_0x16d9b1[_0x7400('0x24')][_0x7400('0x69')])){for(var _0x300920=0x0;_0x300920<_0x16d9b1['query'][_0x7400('0x69')]['length'];_0x300920+=0x1){socket[_0x7400('0x6b')](_0x7400('0x6c'),{'UserId':Number(_0x16d9b1[_0x7400('0x24')]['ids'][_0x300920]),'MailQueueId':Number(_0x16d9b1[_0x7400('0x27')]['id'])});}}else{socket['emit'](_0x7400('0x6c'),{'UserId':Number(_0x16d9b1[_0x7400('0x24')]['ids']),'MailQueueId':Number(_0x16d9b1['params']['id'])});}});}})[_0x7400('0x16')](respondWithStatusCode(_0x462b37,null))[_0x7400('0x26')](handleError(_0x462b37,null));};exports[_0x7400('0x71')]=function(_0x2ccd0a,_0x8bc6ce){var _0xaeaae6={};var _0x3e4bbf={};var _0x4d6217;var _0xdde6fb;return db[_0x7400('0x1f')]['findOne']({'where':{'id':_0x2ccd0a[_0x7400('0x27')]['id']}})['then'](handleEntityNotFound(_0x8bc6ce,null))['then'](function(_0x2868d8){if(_0x2868d8){_0x4d6217=_0x2868d8;_0x3e4bbf[_0x7400('0x2b')]=_[_0x7400('0x28')](db[_0x7400('0x45')][_0x7400('0x3b')]);_0x3e4bbf['query']=_[_0x7400('0x28')](_0x2ccd0a['query']);_0x3e4bbf['filters']=_['intersection'](_0x3e4bbf[_0x7400('0x2b')],_0x3e4bbf['query']);_0xaeaae6['attributes']=_[_0x7400('0x2a')](_0x3e4bbf[_0x7400('0x2b')],qs[_0x7400('0x2c')](_0x2ccd0a[_0x7400('0x24')][_0x7400('0x2c')]));_0xaeaae6[_0x7400('0x2d')]=_0xaeaae6[_0x7400('0x2d')][_0x7400('0x4e')]?_0xaeaae6[_0x7400('0x2d')]:_0x3e4bbf[_0x7400('0x2b')];_0xaeaae6[_0x7400('0x3e')]=qs[_0x7400('0x3f')](_0x2ccd0a['query'][_0x7400('0x3f')]);_0xaeaae6['where']=qs[_0x7400('0x29')](_[_0x7400('0x40')](_0x2ccd0a[_0x7400('0x24')],_0x3e4bbf[_0x7400('0x29')]));if(_0x2ccd0a[_0x7400('0x24')][_0x7400('0x42')]){_0xaeaae6['where']=_[_0x7400('0x43')](_0xaeaae6[_0x7400('0x22')],{'$or':_[_0x7400('0x44')](_0xaeaae6[_0x7400('0x2d')],function(_0x1d2d2d){var _0x14dae0={};_0x14dae0[_0x1d2d2d]={'$like':'%'+_0x2ccd0a[_0x7400('0x24')][_0x7400('0x42')]+'%'};return _0x14dae0;})});}_0xaeaae6=_[_0x7400('0x43')]({},_0xaeaae6,_0x2ccd0a[_0x7400('0x2e')]);return _0x4d6217[_0x7400('0x71')](_0xaeaae6);}})[_0x7400('0x16')](function(_0x2be496){if(_0x2be496){_0xdde6fb=_0x2be496[_0x7400('0x4e')];if(!_0x2ccd0a['query']['hasOwnProperty'](_0x7400('0x3d'))){_0xaeaae6['limit']=qs[_0x7400('0x11')](_0x2ccd0a[_0x7400('0x24')][_0x7400('0x11')]);_0xaeaae6[_0x7400('0x10')]=qs[_0x7400('0x10')](_0x2ccd0a['query'][_0x7400('0x10')]);}return _0x4d6217[_0x7400('0x71')](_0xaeaae6);}})['then'](function(_0x3b5eaf){if(_0x3b5eaf){return _0x3b5eaf?{'count':_0xdde6fb,'rows':_0x3b5eaf}:null;}})[_0x7400('0x16')](respondWithResult(_0x8bc6ce,null))[_0x7400('0x26')](handleError(_0x8bc6ce,null));}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 9ec6da8..5825fcb 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 _0x0e75=['save','remove','emit','hasOwnProperty','events','../../mysqldb','MailQueue'];(function(_0x4e7a5e,_0x20f441){var _0x4d21ea=function(_0x6a0400){while(--_0x6a0400){_0x4e7a5e['push'](_0x4e7a5e['shift']());}};_0x4d21ea(++_0x20f441);}(_0x0e75,0x1a8));var _0x50e7=function(_0x2cfa08,_0x23a555){_0x2cfa08=_0x2cfa08-0x0;var _0x528029=_0x0e75[_0x2cfa08];return _0x528029;};'use strict';var EventEmitter=require(_0x50e7('0x0'));var MailQueue=require(_0x50e7('0x1'))['db'][_0x50e7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50e7('0x3'),'afterUpdate':'update','afterDestroy':_0x50e7('0x4')};function emitEvent(_0x2f55a4){return function(_0x5db6ad,_0x2d8c49,_0x3bdf51){MailQueueEvents['emit'](_0x2f55a4+':'+_0x5db6ad['id'],_0x5db6ad);MailQueueEvents[_0x50e7('0x5')](_0x2f55a4,_0x5db6ad);_0x3bdf51(null);};}for(var e in events){if(events[_0x50e7('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index a171f7c..9a78480 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 _0x2bdf=['exports','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','rimraf','./mailQueue.attributes'];(function(_0x54ea37,_0x2522a8){var _0x5f0212=function(_0x331752){while(--_0x331752){_0x54ea37['push'](_0x54ea37['shift']());}};_0x5f0212(++_0x2522a8);}(_0x2bdf,0x1cf));var _0xf2bd=function(_0x5084d5,_0x2d94f1){_0x5084d5=_0x5084d5-0x0;var _0x1e7d6a=_0x2bdf[_0x5084d5];return _0x1e7d6a;};'use strict';var _=require(_0xf2bd('0x0'));var util=require(_0xf2bd('0x1'));var logger=require(_0xf2bd('0x2'))('api');var moment=require(_0xf2bd('0x3'));var BPromise=require(_0xf2bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf2bd('0x5'));var config=require('../../config/environment');var attributes=require(_0xf2bd('0x6'));module[_0xf2bd('0x7')]=function(_0x57def9,_0x5cd974){return _0x57def9['define'](_0xf2bd('0x8'),attributes,{'tableName':_0xf2bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2d028d7..d353f97 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 _0x4cdd=['catch','GetMailQueue','findAll','options','raw','map','include','model','attributes','then','debug','ShowMailQueue','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x3eac03,_0x56ad31){_0x3eac03=_0x3eac03-0x0;var _0x326e77=_0x4cdd[_0x3eac03];return _0x326e77;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4cd('0x2'));var fs=require('fs');var Redis=require(_0xd4cd('0x3'));var db=require(_0xd4cd('0x4'))['db'];var utils=require(_0xd4cd('0x5'));var logger=require(_0xd4cd('0x6'))(_0xd4cd('0x7'));var config=require(_0xd4cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd4cd('0x9')]=_['defaults'](config[_0xd4cd('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4cd('0xa'))(new Redis(config[_0xd4cd('0x9')]));require(_0xd4cd('0xb'))[_0xd4cd('0xc')](socket);function respondWithRpcPromise(_0x3094dc,_0x2e6012,_0x4e5491){return new BPromise(function(_0x1c699d,_0xefaffd){return client[_0xd4cd('0xd')](_0x3094dc,_0x4e5491)['then'](function(_0x49672a){logger['info'](_0xd4cd('0xe'),_0x2e6012,_0xd4cd('0xf'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x2e6012,_0xd4cd('0xf'),JSON[_0xd4cd('0x10')](_0x49672a));if(_0x49672a['error']){if(_0x49672a['error']['code']===0x1f4){logger[_0xd4cd('0x11')](_0xd4cd('0xe'),_0x2e6012,_0x49672a['error']['message']);return _0xefaffd(_0x49672a['error'][_0xd4cd('0x12')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x2e6012,_0x49672a[_0xd4cd('0x11')][_0xd4cd('0x12')]);return _0x1c699d(_0x49672a[_0xd4cd('0x11')][_0xd4cd('0x12')]);}else{logger[_0xd4cd('0x13')]('MailQueue,\x20%s,\x20%s',_0x2e6012,_0xd4cd('0xf'));_0x1c699d(_0x49672a[_0xd4cd('0x14')]['message']);}})[_0xd4cd('0x15')](function(_0x29720a){logger['error'](_0xd4cd('0xe'),_0x2e6012,_0x29720a);_0xefaffd(_0x29720a);});});}exports[_0xd4cd('0x16')]=function(_0x43594a){var _0x244094=this;return new Promise(function(_0x44746f,_0x4fcb2e){return db['MailQueue'][_0xd4cd('0x17')]({'raw':_0x43594a[_0xd4cd('0x18')]?_0x43594a[_0xd4cd('0x18')][_0xd4cd('0x19')]===undefined?!![]:![]:!![],'where':_0x43594a[_0xd4cd('0x18')]?_0x43594a[_0xd4cd('0x18')]['where']||null:null,'attributes':_0x43594a[_0xd4cd('0x18')]?_0x43594a[_0xd4cd('0x18')]['attributes']||null:null,'limit':_0x43594a[_0xd4cd('0x18')]?_0x43594a[_0xd4cd('0x18')]['limit']||null:null,'include':_0x43594a[_0xd4cd('0x18')]?_0x43594a['options']['include']?_[_0xd4cd('0x1a')](_0x43594a[_0xd4cd('0x18')][_0xd4cd('0x1b')],function(_0x138e1a){return{'model':db[_0x138e1a[_0xd4cd('0x1c')]],'as':_0x138e1a['as'],'attributes':_0x138e1a[_0xd4cd('0x1d')],'include':_0x138e1a[_0xd4cd('0x1b')]?_[_0xd4cd('0x1a')](_0x138e1a[_0xd4cd('0x1b')],function(_0x29d9be){return{'model':db[_0x29d9be[_0xd4cd('0x1c')]],'as':_0x29d9be['as'],'attributes':_0x29d9be[_0xd4cd('0x1d')],'include':_0x29d9be[_0xd4cd('0x1b')]?_[_0xd4cd('0x1a')](_0x29d9be['include'],function(_0xae194c){return{'model':db[_0xae194c[_0xd4cd('0x1c')]],'as':_0xae194c['as'],'attributes':_0xae194c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4cd('0x1e')](function(_0x3489c3){logger['info'](_0xd4cd('0x16'),_0x43594a);logger[_0xd4cd('0x1f')](_0xd4cd('0x16'),_0x43594a,JSON[_0xd4cd('0x10')](_0x3489c3));_0x44746f(_0x3489c3);})[_0xd4cd('0x15')](function(_0x40ab61){logger['error']('GetMailQueue',_0x40ab61[_0xd4cd('0x12')],_0x43594a);_0x4fcb2e(_0x244094[_0xd4cd('0x11')](0x1f4,_0x40ab61[_0xd4cd('0x12')]));});});};exports[_0xd4cd('0x20')]=function(_0x4e860f){var _0x1c788f=this;return new Promise(function(_0x30fb5e,_0x1dde66){return db['MailQueue'][_0xd4cd('0x21')]({'raw':_0x4e860f['options']?_0x4e860f[_0xd4cd('0x18')][_0xd4cd('0x19')]===undefined?!![]:![]:!![],'where':_0x4e860f[_0xd4cd('0x18')]?_0x4e860f[_0xd4cd('0x18')]['where']||null:null,'attributes':_0x4e860f[_0xd4cd('0x18')]?_0x4e860f[_0xd4cd('0x18')][_0xd4cd('0x1d')]||null:null,'include':_0x4e860f[_0xd4cd('0x18')]?_0x4e860f['options'][_0xd4cd('0x1b')]?_[_0xd4cd('0x1a')](_0x4e860f[_0xd4cd('0x18')][_0xd4cd('0x1b')],function(_0x289b27){return{'model':db[_0x289b27['model']],'as':_0x289b27['as'],'attributes':_0x289b27[_0xd4cd('0x1d')],'include':_0x289b27[_0xd4cd('0x1b')]?_[_0xd4cd('0x1a')](_0x289b27[_0xd4cd('0x1b')],function(_0x3fd569){return{'model':db[_0x3fd569[_0xd4cd('0x1c')]],'as':_0x3fd569['as'],'attributes':_0x3fd569[_0xd4cd('0x1d')],'include':_0x3fd569[_0xd4cd('0x1b')]?_['map'](_0x3fd569[_0xd4cd('0x1b')],function(_0x26a4c9){return{'model':db[_0x26a4c9[_0xd4cd('0x1c')]],'as':_0x26a4c9['as'],'attributes':_0x26a4c9[_0xd4cd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd4cd('0x1e')](function(_0x35a712){logger[_0xd4cd('0x13')](_0xd4cd('0x20'),_0x4e860f);logger['debug'](_0xd4cd('0x20'),_0x4e860f,JSON[_0xd4cd('0x10')](_0x35a712));_0x30fb5e(_0x35a712);})[_0xd4cd('0x15')](function(_0x3ea00f){logger[_0xd4cd('0x11')](_0xd4cd('0x20'),_0x3ea00f['message'],_0x4e860f);_0x1dde66(_0x1c788f[_0xd4cd('0x11')](0x1f4,_0x3ea00f[_0xd4cd('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 03ff41b..e3278c0 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 _0x268c=['removeListener','register','length','mailQueue:','./mailQueue.events','remove','emit'];(function(_0x4337da,_0x5e4b7f){var _0x1c841e=function(_0x3660ea){while(--_0x3660ea){_0x4337da['push'](_0x4337da['shift']());}};_0x1c841e(++_0x5e4b7f);}(_0x268c,0xb3));var _0xc268=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x268c[_0xbec8e6];return _0x4aa6f2;};'use strict';var MailQueueEvents=require(_0xc268('0x0'));var events=['save',_0xc268('0x1'),'update'];function createListener(_0x12d634,_0x498234){return function(_0x4f78a7){_0x498234[_0xc268('0x2')](_0x12d634,_0x4f78a7);};}function removeListener(_0x55edc9,_0x19f84f){return function(){MailQueueEvents[_0xc268('0x3')](_0x55edc9,_0x19f84f);};}exports[_0xc268('0x4')]=function(_0x3d0ecf){for(var _0x4e2a03=0x0,_0x4b843c=events[_0xc268('0x5')];_0x4e2a03<_0x4b843c;_0x4e2a03++){var _0x2f7f1b=events[_0x4e2a03];var _0x596f88=createListener(_0xc268('0x6')+_0x2f7f1b,_0x3d0ecf);MailQueueEvents['on'](_0x2f7f1b,_0x596f88);}}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4029b04..be4ee7b 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 _0xb1e6=['index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0xdc7170,_0x571276){var _0x9e8216=function(_0x4ebfbc){while(--_0x4ebfbc){_0xdc7170['push'](_0xdc7170['shift']());}};_0x9e8216(++_0x571276);}(_0xb1e6,0x7d));var _0x6b1e=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0xb1e6[_0x1857c6];return _0x51011c;};'use strict';var multer=require(_0x6b1e('0x0'));var util=require(_0x6b1e('0x1'));var path=require(_0x6b1e('0x2'));var timeout=require(_0x6b1e('0x3'));var express=require(_0x6b1e('0x4'));var router=express[_0x6b1e('0x5')]();var fs_extra=require(_0x6b1e('0x6'));var auth=require(_0x6b1e('0x7'));var interaction=require(_0x6b1e('0x8'));var config=require(_0x6b1e('0x9'));var controller=require(_0x6b1e('0xa'));router[_0x6b1e('0xb')]('/',auth[_0x6b1e('0xc')](),controller[_0x6b1e('0xd')]);router[_0x6b1e('0xb')](_0x6b1e('0xe'),auth[_0x6b1e('0xc')](),controller['describe']);router['get'](_0x6b1e('0xf'),auth['isAuthenticated'](),controller[_0x6b1e('0x10')]);router[_0x6b1e('0x11')]('/',auth['isAuthenticated'](),controller[_0x6b1e('0x12')]);router[_0x6b1e('0x13')](_0x6b1e('0xf'),auth[_0x6b1e('0xc')](),controller['update']);router[_0x6b1e('0x14')](_0x6b1e('0xf'),auth['isAuthenticated'](),controller[_0x6b1e('0x15')]);module[_0x6b1e('0x16')]=router; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c6e3a04..f0cc53b 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 _0xa9a7=['DATE','moment','exports','STRING'];(function(_0x593a25,_0x4fd699){var _0xb256a1=function(_0xcc802f){while(--_0xcc802f){_0x593a25['push'](_0x593a25['shift']());}};_0xb256a1(++_0x4fd699);}(_0xa9a7,0xbd));var _0x7a9a=function(_0x262f7d,_0xc206ad){_0x262f7d=_0x262f7d-0x0;var _0x25a1d6=_0xa9a7[_0x262f7d];return _0x25a1d6;};'use strict';var moment=require(_0x7a9a('0x0'));var Sequelize=require('sequelize');module[_0x7a9a('0x1')]={'uniqueid':{'type':Sequelize[_0x7a9a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7a9a('0x2')]},'joinAt':{'type':Sequelize[_0x7a9a('0x3')]},'leaveAt':{'type':Sequelize[_0x7a9a('0x3')]},'acceptAt':{'type':Sequelize[_0x7a9a('0x3')]},'exitAt':{'type':Sequelize[_0x7a9a('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1955dfd..bae978e 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 _0x6a55=['eml-format','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','update','then','destroy','end','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','fields','create','body','find','describe'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6a55,0xdb));var _0x56a5=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x6a55[_0x58ae8a];return _0x2f0b6b;};'use strict';var emlformat=require(_0x56a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x56a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x56a5('0x2'));var util=require('util');var path=require(_0x56a5('0x3'));var sox=require('sox');var csv=require(_0x56a5('0x4'));var ejs=require(_0x56a5('0x5'));var fs=require('fs');var fs_extra=require(_0x56a5('0x6'));var _=require(_0x56a5('0x7'));var squel=require(_0x56a5('0x8'));var crypto=require(_0x56a5('0x9'));var jsforce=require(_0x56a5('0xa'));var deskjs=require(_0x56a5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x56a5('0xc'));var Papa=require(_0x56a5('0xd'));var Redis=require(_0x56a5('0xe'));var authService=require(_0x56a5('0xf'));var qs=require(_0x56a5('0x10'));var as=require(_0x56a5('0x11'));var hardwareService=require(_0x56a5('0x12'));var logger=require(_0x56a5('0x13'))(_0x56a5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x56a5('0x15'));var db=require(_0x56a5('0x16'))['db'];function respondWithStatusCode(_0x2b9d7d,_0x1a9bf0){_0x1a9bf0=_0x1a9bf0||0xcc;return function(_0x2de420){if(_0x2de420){return _0x2b9d7d[_0x56a5('0x17')](_0x1a9bf0);}return _0x2b9d7d['status'](_0x1a9bf0)['end']();};}function respondWithResult(_0x3e3ff6,_0x1e416f){_0x1e416f=_0x1e416f||0xc8;return function(_0x176c7b){if(_0x176c7b){return _0x3e3ff6[_0x56a5('0x18')](_0x1e416f)[_0x56a5('0x19')](_0x176c7b);}};}function respondWithFilteredResult(_0x2db112,_0xe3091f){return function(_0x5c4028){if(_0x5c4028){var _0x360297=typeof _0xe3091f['offset']===_0x56a5('0x1a')&&typeof _0xe3091f['limit']===_0x56a5('0x1a');var _0x3f3e5b=_0x5c4028[_0x56a5('0x1b')];var _0x28fe74=_0x360297?0x0:_0xe3091f[_0x56a5('0x1c')];var _0x143f3d=_0x360297?_0x5c4028[_0x56a5('0x1b')]:_0xe3091f['offset']+_0xe3091f[_0x56a5('0x1d')];var _0x3db687;if(_0x143f3d>=_0x3f3e5b){_0x143f3d=_0x3f3e5b;_0x3db687=0xc8;}else{_0x3db687=0xce;}_0x2db112[_0x56a5('0x18')](_0x3db687);return _0x2db112[_0x56a5('0x1e')]('Content-Range',_0x28fe74+'-'+_0x143f3d+'/'+_0x3f3e5b)[_0x56a5('0x19')](_0x5c4028);}return null;};}function patchUpdates(_0x1fdb7a){return function(_0xa274f4){try{jsonpatch[_0x56a5('0x1f')](_0xa274f4,_0x1fdb7a,!![]);}catch(_0x155d3b){return BPromise['reject'](_0x155d3b);}return _0xa274f4['save']();};}function saveUpdates(_0x29f181,_0x1c4ab8){return function(_0x487505){if(_0x487505){return _0x487505[_0x56a5('0x20')](_0x29f181)[_0x56a5('0x21')](function(_0x615d49){return _0x615d49;});}return null;};}function removeEntity(_0x15d9f8,_0xe1ded0){return function(_0x616922){if(_0x616922){return _0x616922[_0x56a5('0x22')]()[_0x56a5('0x21')](function(){_0x15d9f8[_0x56a5('0x18')](0xcc)[_0x56a5('0x23')]();});}};}function handleEntityNotFound(_0xcf212,_0x2f203f){return function(_0x460bc2){if(!_0x460bc2){_0xcf212['sendStatus'](0x194);}return _0x460bc2;};}function handleError(_0x5c76a7,_0x2d8e68){_0x2d8e68=_0x2d8e68||0x1f4;return function(_0x42cd45){logger[_0x56a5('0x24')](_0x42cd45[_0x56a5('0x25')]);if(_0x42cd45['name']){delete _0x42cd45[_0x56a5('0x26')];}_0x5c76a7['status'](_0x2d8e68)[_0x56a5('0x27')](_0x42cd45);};}exports[_0x56a5('0x28')]=function(_0x1b27b5,_0x284ee5){var _0x4e7afd={},_0x3b55e6={},_0x1f7aeb={'count':0x0,'rows':[]};var _0x178f11=_['map'](db[_0x56a5('0x29')][_0x56a5('0x2a')],function(_0xeb4378){return{'name':_0xeb4378[_0x56a5('0x2b')],'type':_0xeb4378[_0x56a5('0x2c')]['key']};});_0x3b55e6[_0x56a5('0x2d')]=_[_0x56a5('0x2e')](_0x178f11,_0x56a5('0x26'));_0x3b55e6[_0x56a5('0x2f')]=_[_0x56a5('0x30')](_0x1b27b5['query']);_0x3b55e6['filters']=_[_0x56a5('0x31')](_0x3b55e6[_0x56a5('0x2d')],_0x3b55e6[_0x56a5('0x2f')]);_0x4e7afd['attributes']=_[_0x56a5('0x31')](_0x3b55e6[_0x56a5('0x2d')],qs['fields'](_0x1b27b5['query']['fields']));_0x4e7afd['attributes']=_0x4e7afd[_0x56a5('0x32')][_0x56a5('0x33')]?_0x4e7afd[_0x56a5('0x32')]:_0x3b55e6['model'];if(!_0x1b27b5[_0x56a5('0x2f')]['hasOwnProperty'](_0x56a5('0x34'))){_0x4e7afd[_0x56a5('0x1d')]=qs['limit'](_0x1b27b5[_0x56a5('0x2f')]['limit']);_0x4e7afd[_0x56a5('0x1c')]=qs[_0x56a5('0x1c')](_0x1b27b5[_0x56a5('0x2f')]['offset']);}_0x4e7afd[_0x56a5('0x35')]=qs[_0x56a5('0x36')](_0x1b27b5[_0x56a5('0x2f')]['sort']);_0x4e7afd[_0x56a5('0x37')]=qs[_0x56a5('0x38')](_[_0x56a5('0x39')](_0x1b27b5[_0x56a5('0x2f')],_0x3b55e6[_0x56a5('0x38')]),_0x178f11);if(_0x1b27b5['query']['filter']){_0x4e7afd[_0x56a5('0x37')]=_[_0x56a5('0x3a')](_0x4e7afd[_0x56a5('0x37')],{'$or':_[_0x56a5('0x2e')](_0x178f11,function(_0xbf2db6){if(_0xbf2db6[_0x56a5('0x2c')]!==_0x56a5('0x3b')){var _0x652028={};_0x652028[_0xbf2db6[_0x56a5('0x26')]]={'$like':'%'+_0x1b27b5[_0x56a5('0x2f')][_0x56a5('0x3c')]+'%'};return _0x652028;}})});}_0x4e7afd=_[_0x56a5('0x3a')]({},_0x4e7afd,_0x1b27b5[_0x56a5('0x3d')]);var _0x389c01={'where':_0x4e7afd[_0x56a5('0x37')]};return db[_0x56a5('0x29')][_0x56a5('0x1b')](_0x389c01)[_0x56a5('0x21')](function(_0xf0f6c8){_0x1f7aeb[_0x56a5('0x1b')]=_0xf0f6c8;if(_0x1b27b5[_0x56a5('0x2f')][_0x56a5('0x3e')]){_0x4e7afd['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x56a5('0x3f')](_0x4e7afd);})['then'](function(_0x7c3c3e){_0x1f7aeb[_0x56a5('0x40')]=_0x7c3c3e;return _0x1f7aeb;})[_0x56a5('0x21')](respondWithFilteredResult(_0x284ee5,_0x4e7afd))[_0x56a5('0x41')](handleError(_0x284ee5,null));};exports[_0x56a5('0x42')]=function(_0x1160da,_0x5618f9){var _0x5c565a={'raw':!![],'where':{'id':_0x1160da[_0x56a5('0x43')]['id']}},_0x29ab9b={};_0x29ab9b[_0x56a5('0x2d')]=_[_0x56a5('0x30')](db[_0x56a5('0x29')][_0x56a5('0x2a')]);_0x29ab9b['query']=_[_0x56a5('0x30')](_0x1160da[_0x56a5('0x2f')]);_0x29ab9b['filters']=_[_0x56a5('0x31')](_0x29ab9b[_0x56a5('0x2d')],_0x29ab9b[_0x56a5('0x2f')]);_0x5c565a[_0x56a5('0x32')]=_['intersection'](_0x29ab9b[_0x56a5('0x2d')],qs['fields'](_0x1160da[_0x56a5('0x2f')][_0x56a5('0x44')]));_0x5c565a['attributes']=_0x5c565a[_0x56a5('0x32')]['length']?_0x5c565a[_0x56a5('0x32')]:_0x29ab9b[_0x56a5('0x2d')];if(_0x1160da['query'][_0x56a5('0x3e')]){_0x5c565a['include']=[{'all':!![]}];}_0x5c565a=_[_0x56a5('0x3a')]({},_0x5c565a,_0x1160da['options']);return db[_0x56a5('0x29')]['find'](_0x5c565a)[_0x56a5('0x21')](handleEntityNotFound(_0x5618f9,null))[_0x56a5('0x21')](respondWithResult(_0x5618f9,null))[_0x56a5('0x41')](handleError(_0x5618f9,null));};exports[_0x56a5('0x45')]=function(_0x30d377,_0x43196d){return db[_0x56a5('0x29')]['create'](_0x30d377['body'],{})['then'](respondWithResult(_0x43196d,0xc9))[_0x56a5('0x41')](handleError(_0x43196d,null));};exports[_0x56a5('0x20')]=function(_0x1e510a,_0x55d2e2){if(_0x1e510a[_0x56a5('0x46')]['id']){delete _0x1e510a[_0x56a5('0x46')]['id'];}return db[_0x56a5('0x29')]['find']({'where':{'id':_0x1e510a[_0x56a5('0x43')]['id']}})[_0x56a5('0x21')](handleEntityNotFound(_0x55d2e2,null))['then'](saveUpdates(_0x1e510a[_0x56a5('0x46')],null))[_0x56a5('0x21')](respondWithResult(_0x55d2e2,null))[_0x56a5('0x41')](handleError(_0x55d2e2,null));};exports[_0x56a5('0x22')]=function(_0xcb3cb9,_0x58d308){return db[_0x56a5('0x29')][_0x56a5('0x47')]({'where':{'id':_0xcb3cb9[_0x56a5('0x43')]['id']}})[_0x56a5('0x21')](handleEntityNotFound(_0x58d308,null))[_0x56a5('0x21')](removeEntity(_0x58d308,null))['catch'](handleError(_0x58d308,null));};exports[_0x56a5('0x48')]=function(_0x3bda32,_0x597e52){return db[_0x56a5('0x29')][_0x56a5('0x48')]()[_0x56a5('0x21')](respondWithResult(_0x597e52,null))['catch'](handleError(_0x597e52,null));}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a96d47a..cd16788 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 _0xd90f=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes'];(function(_0x35507d,_0x3e24aa){var _0x5db9bf=function(_0x518489){while(--_0x518489){_0x35507d['push'](_0x35507d['shift']());}};_0x5db9bf(++_0x3e24aa);}(_0xd90f,0xf5));var _0xfd90=function(_0x596978,_0x12f9ea){_0x596978=_0x596978-0x0;var _0x30c7a9=_0xd90f[_0x596978];return _0x30c7a9;};'use strict';var _=require(_0xfd90('0x0'));var util=require('util');var logger=require(_0xfd90('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfd90('0x2'));var rp=require(_0xfd90('0x3'));var fs=require('fs');var path=require(_0xfd90('0x4'));var rimraf=require('rimraf');var config=require(_0xfd90('0x5'));var attributes=require(_0xfd90('0x6'));module[_0xfd90('0x7')]=function(_0x2ff796,_0x501d10){return _0x2ff796[_0xfd90('0x8')](_0xfd90('0x9'),attributes,{'tableName':_0xfd90('0xa'),'paranoid':![],'indexes':[{'name':_0xfd90('0xb'),'fields':[_0xfd90('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8f8b875..f89b7b0 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c0542,_0x502921){_0x4c0542=_0x4c0542-0x0;var _0x57d8a6=_0x2ef3[_0x4c0542];return _0x57d8a6;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a37f778..8aba71a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xb3c996,_0x56fd0d){var _0x22241f=function(_0x4fc153){while(--_0x4fc153){_0xb3c996['push'](_0xb3c996['shift']());}};_0x22241f(++_0x56fd0d);}(_0x70e0,0x17b));var _0x070e=function(_0x44c0fc,_0x1b3fa9){_0x44c0fc=_0x44c0fc-0x0;var _0x43f075=_0x70e0[_0x44c0fc];return _0x43f075;};'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 _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 diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ed7a880..5ac49bc 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 _0x26d2=['INTEGER','STRING','BOOLEAN'];(function(_0x13c474,_0x387b7b){var _0x3a18dc=function(_0x4cd04e){while(--_0x4cd04e){_0x13c474['push'](_0x13c474['shift']());}};_0x3a18dc(++_0x387b7b);}(_0x26d2,0xeb));var _0x226d=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x26d2[_0x49beea];return _0x27693a;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x226d('0x0')]},'authentication':{'type':Sequelize[_0x226d('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x226d('0x0')]},'password':{'type':Sequelize[_0x226d('0x0')]},'port':{'type':Sequelize[_0x226d('0x2')]},'tls':{'type':Sequelize[_0x226d('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x226d('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x226d('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1c095b5..8cbef1b 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 _0x02b6=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x13c372,_0x188c05){var _0x4bdaa8=function(_0x544487){while(--_0x544487){_0x13c372['push'](_0x13c372['shift']());}};_0x4bdaa8(++_0x188c05);}(_0x02b6,0xe7));var _0x602b=function(_0x92c08e,_0x168019){_0x92c08e=_0x92c08e-0x0;var _0x3cb7ea=_0x02b6[_0x92c08e];return _0x3cb7ea;};'use strict';var _=require(_0x602b('0x0'));var util=require(_0x602b('0x1'));var logger=require(_0x602b('0x2'))(_0x602b('0x3'));var moment=require(_0x602b('0x4'));var BPromise=require(_0x602b('0x5'));var rp=require(_0x602b('0x6'));var fs=require('fs');var path=require(_0x602b('0x7'));var rimraf=require(_0x602b('0x8'));var config=require(_0x602b('0x9'));var attributes=require(_0x602b('0xa'));module[_0x602b('0xb')]=function(_0x4fffd9,_0x3af632){return _0x4fffd9[_0x602b('0xc')](_0x602b('0xd'),attributes,{'tableName':_0x602b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index e647c7e..48460ab 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 _0x44e6=['include','map','model','GetMailServerIn','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailServerIn','options','where','attributes'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x44e6,0xa9));var _0x644e=function(_0x54056a,_0x3e7bcb){_0x54056a=_0x54056a-0x0;var _0x13a82e=_0x44e6[_0x54056a];return _0x13a82e;};'use strict';var _=require(_0x644e('0x0'));var util=require(_0x644e('0x1'));var moment=require(_0x644e('0x2'));var BPromise=require(_0x644e('0x3'));var rs=require(_0x644e('0x4'));var fs=require('fs');var Redis=require(_0x644e('0x5'));var db=require(_0x644e('0x6'))['db'];var utils=require(_0x644e('0x7'));var logger=require(_0x644e('0x8'))(_0x644e('0x9'));var config=require(_0x644e('0xa'));var jayson=require(_0x644e('0xb'));var client=jayson[_0x644e('0xc')][_0x644e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3b0f97,_0x3fc733,_0x373693){return new BPromise(function(_0x3d8a93,_0x2f8d1a){return client['request'](_0x3b0f97,_0x373693)[_0x644e('0xe')](function(_0x4dc515){logger[_0x644e('0xf')](_0x644e('0x10'),_0x3fc733,_0x644e('0x11'));logger[_0x644e('0x12')](_0x644e('0x13'),_0x3fc733,_0x644e('0x11'),JSON[_0x644e('0x14')](_0x4dc515));if(_0x4dc515[_0x644e('0x15')]){if(_0x4dc515[_0x644e('0x15')][_0x644e('0x16')]===0x1f4){logger[_0x644e('0x15')](_0x644e('0x10'),_0x3fc733,_0x4dc515[_0x644e('0x15')]['message']);return _0x2f8d1a(_0x4dc515['error'][_0x644e('0x17')]);}logger[_0x644e('0x15')](_0x644e('0x10'),_0x3fc733,_0x4dc515['error'][_0x644e('0x17')]);return _0x3d8a93(_0x4dc515[_0x644e('0x15')][_0x644e('0x17')]);}else{logger['info'](_0x644e('0x10'),_0x3fc733,_0x644e('0x11'));_0x3d8a93(_0x4dc515['result'][_0x644e('0x17')]);}})[_0x644e('0x18')](function(_0x472797){logger[_0x644e('0x15')](_0x644e('0x10'),_0x3fc733,_0x472797);_0x2f8d1a(_0x472797);});});}exports['GetMailServerIn']=function(_0x52d133){var _0x44233e=this;return new Promise(function(_0x562ac7,_0x52c86c){return db[_0x644e('0x19')]['findAll']({'raw':_0x52d133[_0x644e('0x1a')]?_0x52d133['options']['raw']===undefined?!![]:![]:!![],'where':_0x52d133['options']?_0x52d133[_0x644e('0x1a')][_0x644e('0x1b')]||null:null,'attributes':_0x52d133['options']?_0x52d133['options'][_0x644e('0x1c')]||null:null,'limit':_0x52d133[_0x644e('0x1a')]?_0x52d133['options']['limit']||null:null,'include':_0x52d133[_0x644e('0x1a')]?_0x52d133[_0x644e('0x1a')][_0x644e('0x1d')]?_[_0x644e('0x1e')](_0x52d133[_0x644e('0x1a')]['include'],function(_0x30968f){return{'model':db[_0x30968f[_0x644e('0x1f')]],'as':_0x30968f['as'],'attributes':_0x30968f['attributes'],'include':_0x30968f[_0x644e('0x1d')]?_['map'](_0x30968f[_0x644e('0x1d')],function(_0x2ab0d9){return{'model':db[_0x2ab0d9[_0x644e('0x1f')]],'as':_0x2ab0d9['as'],'attributes':_0x2ab0d9[_0x644e('0x1c')],'include':_0x2ab0d9[_0x644e('0x1d')]?_[_0x644e('0x1e')](_0x2ab0d9[_0x644e('0x1d')],function(_0x347c23){return{'model':db[_0x347c23['model']],'as':_0x347c23['as'],'attributes':_0x347c23['attributes']};}):[]};}):[]};}):[]:[]})[_0x644e('0xe')](function(_0xe696db){logger[_0x644e('0xf')](_0x644e('0x20'),_0x52d133);logger[_0x644e('0x12')]('GetMailServerIn',_0x52d133,JSON['stringify'](_0xe696db));_0x562ac7(_0xe696db);})[_0x644e('0x18')](function(_0xe11cdd){logger['error'](_0x644e('0x20'),_0xe11cdd[_0x644e('0x17')],_0x52d133);_0x52c86c(_0x44233e[_0x644e('0x15')](0x1f4,_0xe11cdd[_0x644e('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7f4fad3..b0120ff 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(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x554098,_0x1916f6){_0x554098=_0x554098-0x0;var _0x34fccf=_0x7a54[_0x554098];return _0x34fccf;};'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(_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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 69c450e..79e1bfc 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 _0x1775=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x528341,_0x32e4eb){var _0x1a3930=function(_0x3a59ff){while(--_0x3a59ff){_0x528341['push'](_0x528341['shift']());}};_0x1a3930(++_0x32e4eb);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'description':{'type':Sequelize[_0x5177('0x1')]},'host':{'type':Sequelize[_0x5177('0x1')]},'user':{'type':Sequelize[_0x5177('0x1')]},'pass':{'type':Sequelize[_0x5177('0x1')]},'port':{'type':Sequelize[_0x5177('0x2')]},'secure':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5177('0x1')]},'authentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 599dbda..272b1f4 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 _0x2737=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x14bd71,_0x389274){var _0x115ad7=function(_0x28a0e3){while(--_0x28a0e3){_0x14bd71['push'](_0x14bd71['shift']());}};_0x115ad7(++_0x389274);}(_0x2737,0x78));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(_0x7273('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7273('0x3'));var moment=require('moment');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('to-csv');var ejs=require(_0x7273('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7273('0xa'));var squel=require(_0x7273('0xb'));var crypto=require(_0x7273('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7273('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7273('0xe'));var Papa=require(_0x7273('0xf'));var Redis=require(_0x7273('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7273('0x11'));var hardwareService=require(_0x7273('0x12'));var logger=require(_0x7273('0x13'))('api');var utils=require(_0x7273('0x14'));var config=require(_0x7273('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7273('0x16'))['db'];function respondWithStatusCode(_0x4b907b,_0x4d9005){_0x4d9005=_0x4d9005||0xcc;return function(_0x5950f0){if(_0x5950f0){return _0x4b907b[_0x7273('0x17')](_0x4d9005);}return _0x4b907b[_0x7273('0x18')](_0x4d9005)[_0x7273('0x19')]();};}function respondWithResult(_0x4959a3,_0x1625c4){_0x1625c4=_0x1625c4||0xc8;return function(_0x13904c){if(_0x13904c){return _0x4959a3[_0x7273('0x18')](_0x1625c4)['json'](_0x13904c);}};}function respondWithFilteredResult(_0x510d15,_0xb2c540){return function(_0x2e8808){if(_0x2e8808){var _0x31398c=typeof _0xb2c540[_0x7273('0x1a')]==='undefined'&&typeof _0xb2c540[_0x7273('0x1b')]===_0x7273('0x1c');var _0x2e5927=_0x2e8808[_0x7273('0x1d')];var _0x33680a=_0x31398c?0x0:_0xb2c540['offset'];var _0x4601b4=_0x31398c?_0x2e8808[_0x7273('0x1d')]:_0xb2c540[_0x7273('0x1a')]+_0xb2c540[_0x7273('0x1b')];var _0x16439d;if(_0x4601b4>=_0x2e5927){_0x4601b4=_0x2e5927;_0x16439d=0xc8;}else{_0x16439d=0xce;}_0x510d15[_0x7273('0x18')](_0x16439d);return _0x510d15[_0x7273('0x1e')](_0x7273('0x1f'),_0x33680a+'-'+_0x4601b4+'/'+_0x2e5927)[_0x7273('0x20')](_0x2e8808);}return null;};}function patchUpdates(_0x589fa5){return function(_0x3cb3a9){try{jsonpatch[_0x7273('0x21')](_0x3cb3a9,_0x589fa5,!![]);}catch(_0x522842){return BPromise[_0x7273('0x22')](_0x522842);}return _0x3cb3a9[_0x7273('0x23')]();};}function saveUpdates(_0x5fb321,_0x34b901){return function(_0x5a42c3){if(_0x5a42c3){return _0x5a42c3[_0x7273('0x24')](_0x5fb321)[_0x7273('0x25')](function(_0x1462e8){return _0x1462e8;});}return null;};}function removeEntity(_0x148a21,_0x32bd25){return function(_0x5d2e9d){if(_0x5d2e9d){return _0x5d2e9d[_0x7273('0x26')]()[_0x7273('0x25')](function(){_0x148a21[_0x7273('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcea7,_0x3069b3){return function(_0x4166c2){if(!_0x4166c2){_0x1bcea7[_0x7273('0x17')](0x194);}return _0x4166c2;};}function handleError(_0x374f4c,_0x3ea5cd){_0x3ea5cd=_0x3ea5cd||0x1f4;return function(_0x26a528){logger[_0x7273('0x27')](_0x26a528[_0x7273('0x28')]);if(_0x26a528[_0x7273('0x29')]){delete _0x26a528[_0x7273('0x29')];}_0x374f4c[_0x7273('0x18')](_0x3ea5cd)[_0x7273('0x2a')](_0x26a528);};}exports[_0x7273('0x2b')]=function(_0x57409c,_0x5b8522){var _0x2f294b={},_0x3373df={},_0x308914={'count':0x0,'rows':[]};var _0x322e2b=_[_0x7273('0x2c')](db[_0x7273('0x2d')][_0x7273('0x2e')],function(_0x270dd3){return{'name':_0x270dd3[_0x7273('0x2f')],'type':_0x270dd3[_0x7273('0x30')]['key']};});_0x3373df[_0x7273('0x31')]=_[_0x7273('0x2c')](_0x322e2b,_0x7273('0x29'));_0x3373df[_0x7273('0x32')]=_[_0x7273('0x33')](_0x57409c['query']);_0x3373df[_0x7273('0x34')]=_['intersection'](_0x3373df[_0x7273('0x31')],_0x3373df[_0x7273('0x32')]);_0x2f294b[_0x7273('0x35')]=_['intersection'](_0x3373df[_0x7273('0x31')],qs[_0x7273('0x36')](_0x57409c['query'][_0x7273('0x36')]));_0x2f294b[_0x7273('0x35')]=_0x2f294b[_0x7273('0x35')][_0x7273('0x37')]?_0x2f294b[_0x7273('0x35')]:_0x3373df[_0x7273('0x31')];if(!_0x57409c['query'][_0x7273('0x38')](_0x7273('0x39'))){_0x2f294b[_0x7273('0x1b')]=qs[_0x7273('0x1b')](_0x57409c[_0x7273('0x32')]['limit']);_0x2f294b[_0x7273('0x1a')]=qs[_0x7273('0x1a')](_0x57409c[_0x7273('0x32')][_0x7273('0x1a')]);}_0x2f294b['order']=qs['sort'](_0x57409c[_0x7273('0x32')][_0x7273('0x3a')]);_0x2f294b[_0x7273('0x3b')]=qs[_0x7273('0x34')](_[_0x7273('0x3c')](_0x57409c['query'],_0x3373df['filters']),_0x322e2b);if(_0x57409c[_0x7273('0x32')][_0x7273('0x3d')]){_0x2f294b[_0x7273('0x3b')]=_[_0x7273('0x3e')](_0x2f294b[_0x7273('0x3b')],{'$or':_['map'](_0x322e2b,function(_0x433ac7){if(_0x433ac7[_0x7273('0x30')]!==_0x7273('0x3f')){var _0x181723={};_0x181723[_0x433ac7[_0x7273('0x29')]]={'$like':'%'+_0x57409c[_0x7273('0x32')][_0x7273('0x3d')]+'%'};return _0x181723;}})});}_0x2f294b=_[_0x7273('0x3e')]({},_0x2f294b,_0x57409c[_0x7273('0x40')]);var _0x3b5b38={'where':_0x2f294b[_0x7273('0x3b')]};return db['MailServerOut'][_0x7273('0x1d')](_0x3b5b38)[_0x7273('0x25')](function(_0x482174){_0x308914[_0x7273('0x1d')]=_0x482174;if(_0x57409c[_0x7273('0x32')]['includeAll']){_0x2f294b[_0x7273('0x41')]=[{'all':!![]}];}return db[_0x7273('0x2d')][_0x7273('0x42')](_0x2f294b);})[_0x7273('0x25')](function(_0x2b505c){_0x308914['rows']=_0x2b505c;return _0x308914;})[_0x7273('0x25')](respondWithFilteredResult(_0x5b8522,_0x2f294b))[_0x7273('0x43')](handleError(_0x5b8522,null));};exports[_0x7273('0x44')]=function(_0x318a2e,_0xf9cb11){var _0x326b6e={'raw':!![],'where':{'id':_0x318a2e[_0x7273('0x45')]['id']}},_0x176a2c={};_0x176a2c[_0x7273('0x31')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x176a2c[_0x7273('0x32')]=_[_0x7273('0x33')](_0x318a2e[_0x7273('0x32')]);_0x176a2c[_0x7273('0x34')]=_['intersection'](_0x176a2c[_0x7273('0x31')],_0x176a2c[_0x7273('0x32')]);_0x326b6e[_0x7273('0x35')]=_[_0x7273('0x46')](_0x176a2c[_0x7273('0x31')],qs['fields'](_0x318a2e[_0x7273('0x32')]['fields']));_0x326b6e['attributes']=_0x326b6e['attributes'][_0x7273('0x37')]?_0x326b6e[_0x7273('0x35')]:_0x176a2c[_0x7273('0x31')];if(_0x318a2e['query'][_0x7273('0x47')]){_0x326b6e[_0x7273('0x41')]=[{'all':!![]}];}_0x326b6e=_['merge']({},_0x326b6e,_0x318a2e[_0x7273('0x40')]);return db[_0x7273('0x2d')][_0x7273('0x48')](_0x326b6e)['then'](handleEntityNotFound(_0xf9cb11,null))[_0x7273('0x25')](respondWithResult(_0xf9cb11,null))[_0x7273('0x43')](handleError(_0xf9cb11,null));};exports[_0x7273('0x49')]=function(_0x140be9,_0x2434b8){return db[_0x7273('0x2d')]['create'](_0x140be9['body'],{})[_0x7273('0x25')](respondWithResult(_0x2434b8,0xc9))['catch'](handleError(_0x2434b8,null));};exports['update']=function(_0x53f9eb,_0x496268){if(_0x53f9eb['body']['id']){delete _0x53f9eb[_0x7273('0x4a')]['id'];}return db['MailServerOut'][_0x7273('0x48')]({'where':{'id':_0x53f9eb[_0x7273('0x45')]['id']}})[_0x7273('0x25')](handleEntityNotFound(_0x496268,null))[_0x7273('0x25')](saveUpdates(_0x53f9eb[_0x7273('0x4a')],null))[_0x7273('0x25')](respondWithResult(_0x496268,null))[_0x7273('0x43')](handleError(_0x496268,null));};exports[_0x7273('0x26')]=function(_0x1322d2,_0x40197e){return db[_0x7273('0x2d')][_0x7273('0x48')]({'where':{'id':_0x1322d2['params']['id']}})[_0x7273('0x25')](handleEntityNotFound(_0x40197e,null))[_0x7273('0x25')](removeEntity(_0x40197e,null))['catch'](handleError(_0x40197e,null));}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 076b3f8..299ca34 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 _0xcfba=['./mailServerOut.attributes','exports','MailServerOut','lodash','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x50b66d,_0x11c61c){var _0x41aa8e=function(_0x418a48){while(--_0x418a48){_0x50b66d['push'](_0x50b66d['shift']());}};_0x41aa8e(++_0x11c61c);}(_0xcfba,0x66));var _0xacfb=function(_0x358776,_0x7acfa5){_0x358776=_0x358776-0x0;var _0x1859fb=_0xcfba[_0x358776];return _0x1859fb;};'use strict';var _=require(_0xacfb('0x0'));var util=require(_0xacfb('0x1'));var logger=require(_0xacfb('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xacfb('0x3'));var rimraf=require(_0xacfb('0x4'));var config=require(_0xacfb('0x5'));var attributes=require(_0xacfb('0x6'));module[_0xacfb('0x7')]=function(_0x498e22,_0x4b4eeb){return _0x498e22['define'](_0xacfb('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 2dfaeef..16d0a20 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0xe595a2,_0x5df466){_0xe595a2=_0xe595a2-0x0;var _0x31c4c6=_0x7a54[_0xe595a2];return _0x31c4c6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index e7d95e8..61a6224 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 _0x5d34=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0xbfff63,_0x27a381){var _0x33ad45=function(_0x159704){while(--_0x159704){_0xbfff63['push'](_0xbfff63['shift']());}};_0x33ad45(++_0x27a381);}(_0x5d34,0x146));var _0x45d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d34[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x45d3('0x0'));var util=require(_0x45d3('0x1'));var path=require(_0x45d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x45d3('0x3'));var router=express[_0x45d3('0x4')]();var fs_extra=require(_0x45d3('0x5'));var auth=require(_0x45d3('0x6'));var interaction=require(_0x45d3('0x7'));var config=require(_0x45d3('0x8'));var controller=require(_0x45d3('0x9'));router['get']('/',auth[_0x45d3('0xa')](),controller[_0x45d3('0xb')]);router['get'](_0x45d3('0xc'),auth[_0x45d3('0xa')](),controller[_0x45d3('0xd')]);router['get']('/:id',auth[_0x45d3('0xa')](),controller[_0x45d3('0xe')]);router[_0x45d3('0xf')]('/',auth[_0x45d3('0xa')](),controller['create']);router[_0x45d3('0x10')](_0x45d3('0x11'),auth[_0x45d3('0xa')](),controller[_0x45d3('0x12')]);router[_0x45d3('0x13')]('/:id',auth[_0x45d3('0xa')](),controller[_0x45d3('0x14')]);module[_0x45d3('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 35a91e8..fee0117 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 _0x9505=['STRING','sequelize','exports','name'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x9505,0x1e5));var _0x5950=function(_0x450829,_0x5bcaf4){_0x450829=_0x450829-0x0;var _0x6bc1cf=_0x9505[_0x450829];return _0x6bc1cf;};'use strict';var Sequelize=require(_0x5950('0x0'));module[_0x5950('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5950('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5950('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7c335e7..5cee285 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 _0xa64a=['fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes'];(function(_0x4040fe,_0x241792){var _0x14b9f1=function(_0x4adc66){while(--_0x4adc66){_0x4040fe['push'](_0x4040fe['shift']());}};_0x14b9f1(++_0x241792);}(_0xa64a,0x1d0));var _0xaa64=function(_0x21b3b8,_0x58a28a){_0x21b3b8=_0x21b3b8-0x0;var _0x2e94a5=_0xa64a[_0x21b3b8];return _0x2e94a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa64('0x0'));var zipdir=require(_0xaa64('0x1'));var jsonpatch=require(_0xaa64('0x2'));var rp=require(_0xaa64('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaa64('0x4'));var util=require('util');var path=require('path');var sox=require(_0xaa64('0x5'));var csv=require(_0xaa64('0x6'));var ejs=require(_0xaa64('0x7'));var fs=require('fs');var fs_extra=require(_0xaa64('0x8'));var _=require('lodash');var squel=require(_0xaa64('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa64('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa64('0xb'));var Redis=require('ioredis');var authService=require(_0xaa64('0xc'));var qs=require(_0xaa64('0xd'));var as=require(_0xaa64('0xe'));var hardwareService=require(_0xaa64('0xf'));var logger=require(_0xaa64('0x10'))('api');var utils=require(_0xaa64('0x11'));var config=require(_0xaa64('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa64('0x13'))['db'];function respondWithStatusCode(_0x352504,_0x422a3a){_0x422a3a=_0x422a3a||0xcc;return function(_0x541162){if(_0x541162){return _0x352504[_0xaa64('0x14')](_0x422a3a);}return _0x352504[_0xaa64('0x15')](_0x422a3a)[_0xaa64('0x16')]();};}function respondWithResult(_0x208b9e,_0xc71836){_0xc71836=_0xc71836||0xc8;return function(_0x525f39){if(_0x525f39){return _0x208b9e[_0xaa64('0x15')](_0xc71836)[_0xaa64('0x17')](_0x525f39);}};}function respondWithFilteredResult(_0x284924,_0x294ec8){return function(_0x2faf3a){if(_0x2faf3a){var _0x1df541=typeof _0x294ec8[_0xaa64('0x18')]===_0xaa64('0x19')&&typeof _0x294ec8['limit']==='undefined';var _0x37c62c=_0x2faf3a[_0xaa64('0x1a')];var _0x4ee4cc=_0x1df541?0x0:_0x294ec8[_0xaa64('0x18')];var _0xbe27a7=_0x1df541?_0x2faf3a[_0xaa64('0x1a')]:_0x294ec8[_0xaa64('0x18')]+_0x294ec8[_0xaa64('0x1b')];var _0x3db60d;if(_0xbe27a7>=_0x37c62c){_0xbe27a7=_0x37c62c;_0x3db60d=0xc8;}else{_0x3db60d=0xce;}_0x284924[_0xaa64('0x15')](_0x3db60d);return _0x284924['set'](_0xaa64('0x1c'),_0x4ee4cc+'-'+_0xbe27a7+'/'+_0x37c62c)[_0xaa64('0x17')](_0x2faf3a);}return null;};}function patchUpdates(_0xeae6){return function(_0x5bc472){try{jsonpatch['apply'](_0x5bc472,_0xeae6,!![]);}catch(_0x52818e){return BPromise['reject'](_0x52818e);}return _0x5bc472[_0xaa64('0x1d')]();};}function saveUpdates(_0x7928d8,_0x474a7a){return function(_0x231ff5){if(_0x231ff5){return _0x231ff5['update'](_0x7928d8)[_0xaa64('0x1e')](function(_0x45c9d8){return _0x45c9d8;});}return null;};}function removeEntity(_0x31bf9e,_0xf60c3b){return function(_0x30a214){if(_0x30a214){return _0x30a214[_0xaa64('0x1f')]()[_0xaa64('0x1e')](function(){_0x31bf9e[_0xaa64('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6375,_0x391ec6){return function(_0xb54d20){if(!_0xb54d20){_0x5b6375['sendStatus'](0x194);}return _0xb54d20;};}function handleError(_0x12c9a9,_0x20d5e4){_0x20d5e4=_0x20d5e4||0x1f4;return function(_0x1d0f81){logger[_0xaa64('0x20')](_0x1d0f81[_0xaa64('0x21')]);if(_0x1d0f81['name']){delete _0x1d0f81[_0xaa64('0x22')];}_0x12c9a9[_0xaa64('0x15')](_0x20d5e4)[_0xaa64('0x23')](_0x1d0f81);};}exports[_0xaa64('0x24')]=function(_0x3f4b97,_0x4a0bc2){var _0x5975b9={},_0x5a0329={},_0x401d0b={'count':0x0,'rows':[]};var _0x291567=_[_0xaa64('0x25')](db[_0xaa64('0x26')][_0xaa64('0x27')],function(_0x268bc6){return{'name':_0x268bc6[_0xaa64('0x28')],'type':_0x268bc6[_0xaa64('0x29')][_0xaa64('0x2a')]};});_0x5a0329['model']=_[_0xaa64('0x25')](_0x291567,_0xaa64('0x22'));_0x5a0329['query']=_[_0xaa64('0x2b')](_0x3f4b97[_0xaa64('0x2c')]);_0x5a0329[_0xaa64('0x2d')]=_[_0xaa64('0x2e')](_0x5a0329[_0xaa64('0x2f')],_0x5a0329[_0xaa64('0x2c')]);_0x5975b9['attributes']=_[_0xaa64('0x2e')](_0x5a0329['model'],qs['fields'](_0x3f4b97[_0xaa64('0x2c')][_0xaa64('0x30')]));_0x5975b9[_0xaa64('0x31')]=_0x5975b9[_0xaa64('0x31')][_0xaa64('0x32')]?_0x5975b9[_0xaa64('0x31')]:_0x5a0329['model'];if(!_0x3f4b97[_0xaa64('0x2c')][_0xaa64('0x33')](_0xaa64('0x34'))){_0x5975b9['limit']=qs[_0xaa64('0x1b')](_0x3f4b97[_0xaa64('0x2c')]['limit']);_0x5975b9['offset']=qs[_0xaa64('0x18')](_0x3f4b97[_0xaa64('0x2c')]['offset']);}_0x5975b9[_0xaa64('0x35')]=qs[_0xaa64('0x36')](_0x3f4b97[_0xaa64('0x2c')][_0xaa64('0x36')]);_0x5975b9['where']=qs[_0xaa64('0x2d')](_[_0xaa64('0x37')](_0x3f4b97['query'],_0x5a0329[_0xaa64('0x2d')]),_0x291567);if(_0x3f4b97[_0xaa64('0x2c')][_0xaa64('0x38')]){_0x5975b9['where']=_['merge'](_0x5975b9['where'],{'$or':_[_0xaa64('0x25')](_0x291567,function(_0x2a4e2f){if(_0x2a4e2f['type']!==_0xaa64('0x39')){var _0x52e9dc={};_0x52e9dc[_0x2a4e2f['name']]={'$like':'%'+_0x3f4b97[_0xaa64('0x2c')][_0xaa64('0x38')]+'%'};return _0x52e9dc;}})});}_0x5975b9=_['merge']({},_0x5975b9,_0x3f4b97[_0xaa64('0x3a')]);var _0x198c62={'where':_0x5975b9[_0xaa64('0x3b')]};return db[_0xaa64('0x26')][_0xaa64('0x1a')](_0x198c62)[_0xaa64('0x1e')](function(_0x260c9a){_0x401d0b[_0xaa64('0x1a')]=_0x260c9a;if(_0x3f4b97[_0xaa64('0x2c')][_0xaa64('0x3c')]){_0x5975b9[_0xaa64('0x3d')]=[{'all':!![]}];}return db[_0xaa64('0x26')][_0xaa64('0x3e')](_0x5975b9);})[_0xaa64('0x1e')](function(_0x2e7bfd){_0x401d0b[_0xaa64('0x3f')]=_0x2e7bfd;return _0x401d0b;})[_0xaa64('0x1e')](respondWithFilteredResult(_0x4a0bc2,_0x5975b9))[_0xaa64('0x40')](handleError(_0x4a0bc2,null));};exports[_0xaa64('0x41')]=function(_0x375b23,_0x37f017){var _0x31851c={'raw':!![],'where':{'id':_0x375b23[_0xaa64('0x42')]['id']}},_0x58cb37={};_0x58cb37['model']=_[_0xaa64('0x2b')](db['MailSubstatus'][_0xaa64('0x27')]);_0x58cb37[_0xaa64('0x2c')]=_[_0xaa64('0x2b')](_0x375b23[_0xaa64('0x2c')]);_0x58cb37['filters']=_[_0xaa64('0x2e')](_0x58cb37[_0xaa64('0x2f')],_0x58cb37[_0xaa64('0x2c')]);_0x31851c[_0xaa64('0x31')]=_[_0xaa64('0x2e')](_0x58cb37[_0xaa64('0x2f')],qs['fields'](_0x375b23['query']['fields']));_0x31851c[_0xaa64('0x31')]=_0x31851c[_0xaa64('0x31')][_0xaa64('0x32')]?_0x31851c[_0xaa64('0x31')]:_0x58cb37[_0xaa64('0x2f')];if(_0x375b23[_0xaa64('0x2c')][_0xaa64('0x3c')]){_0x31851c['include']=[{'all':!![]}];}_0x31851c=_[_0xaa64('0x43')]({},_0x31851c,_0x375b23['options']);return db[_0xaa64('0x26')][_0xaa64('0x44')](_0x31851c)[_0xaa64('0x1e')](handleEntityNotFound(_0x37f017,null))['then'](respondWithResult(_0x37f017,null))[_0xaa64('0x40')](handleError(_0x37f017,null));};exports[_0xaa64('0x45')]=function(_0x34ad6a,_0x2d1722){return db[_0xaa64('0x26')][_0xaa64('0x45')](_0x34ad6a[_0xaa64('0x46')],{})[_0xaa64('0x1e')](respondWithResult(_0x2d1722,0xc9))[_0xaa64('0x40')](handleError(_0x2d1722,null));};exports['update']=function(_0x4c9712,_0x3a637a){if(_0x4c9712[_0xaa64('0x46')]['id']){delete _0x4c9712[_0xaa64('0x46')]['id'];}return db[_0xaa64('0x26')][_0xaa64('0x44')]({'where':{'id':_0x4c9712['params']['id']}})[_0xaa64('0x1e')](handleEntityNotFound(_0x3a637a,null))[_0xaa64('0x1e')](saveUpdates(_0x4c9712[_0xaa64('0x46')],null))[_0xaa64('0x1e')](respondWithResult(_0x3a637a,null))[_0xaa64('0x40')](handleError(_0x3a637a,null));};exports['destroy']=function(_0x14b278,_0x185f37){return db[_0xaa64('0x26')][_0xaa64('0x44')]({'where':{'id':_0x14b278[_0xaa64('0x42')]['id']}})['then'](handleEntityNotFound(_0x185f37,null))['then'](removeEntity(_0x185f37,null))[_0xaa64('0x40')](handleError(_0x185f37,null));};exports[_0xaa64('0x47')]=function(_0x46abe,_0x5c6897){return db[_0xaa64('0x26')][_0xaa64('0x47')]()['then'](respondWithResult(_0x5c6897,null))[_0xaa64('0x40')](handleError(_0x5c6897,null));}; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 7d31dd6..d132504 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 _0x645c=['exports','setMaxListeners','update','emit','hook'];(function(_0x56c4f4,_0x4cf9c3){var _0x598a30=function(_0x56bf40){while(--_0x56bf40){_0x56c4f4['push'](_0x56c4f4['shift']());}};_0x598a30(++_0x4cf9c3);}(_0x645c,0x1f0));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xc645('0x0')](0x0);var events={'afterUpdate':_0xc645('0x1')};function emitEvent(_0x3c322d){return function(_0x2afa8c,_0x3088cd,_0x191688){MailSubstatusEvents[_0xc645('0x2')](_0x3c322d+':'+_0x2afa8c['id'],_0x2afa8c);MailSubstatusEvents[_0xc645('0x2')](_0x3c322d,_0x2afa8c);_0x191688(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xc645('0x3')](e,emitEvent(event));}}module[_0xc645('0x4')]=MailSubstatusEvents; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 7e3d19c..a971e9d 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 _0x6985=['_previousDataValues','catch','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus'];(function(_0x2d64ab,_0x393b9e){var _0x2d2624=function(_0x479a13){while(--_0x479a13){_0x2d64ab['push'](_0x2d64ab['shift']());}};_0x2d2624(++_0x393b9e);}(_0x6985,0x11a));var _0x5698=function(_0x2095f2,_0x682694){_0x2095f2=_0x2095f2-0x0;var _0x3d65ba=_0x6985[_0x2095f2];return _0x3d65ba;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x5698('0x0')]=function(_0x4d971b){var _0x16dcd8=_0x4d971b[_0x5698('0x1')];return _0x4d971b[_0x5698('0x2')](_0x5698('0x3'),attributes,{'tableName':_0x5698('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x50a771,_0x5cfbec,_0x2609e9){return _0x16dcd8[_0x5698('0x5')][_0x5698('0x6')]({'value':_0x50a771['name']},{'where':{'field':_0x5698('0x7'),'value':_0x50a771[_0x5698('0x8')]['name']}})['then'](function(){_0x2609e9();})[_0x5698('0x9')](function(_0xc9d96d){_0x2609e9(_0xc9d96d);});}}});}; \ No newline at end of file +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 diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a7076c4..0ee3e3b 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 _0x9655=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x4938b0,_0x5c16d5){var _0x10f9b8=function(_0x595842){while(--_0x595842){_0x4938b0['push'](_0x4938b0['shift']());}};_0x10f9b8(++_0x5c16d5);}(_0x9655,0x10f));var _0x5965=function(_0x18002f,_0x297366){_0x18002f=_0x18002f-0x0;var _0x2af346=_0x9655[_0x18002f];return _0x2af346;};'use strict';var _=require(_0x5965('0x0'));var util=require(_0x5965('0x1'));var moment=require(_0x5965('0x2'));var BPromise=require('bluebird');var rs=require(_0x5965('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5965('0x4'))['db'];var utils=require(_0x5965('0x5'));var logger=require(_0x5965('0x6'))(_0x5965('0x7'));var config=require(_0x5965('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5965('0x9')][_0x5965('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d42a4,_0x22583c,_0x1fee99){return new BPromise(function(_0x2824f7,_0x44dfb3){return client[_0x5965('0xb')](_0x5d42a4,_0x1fee99)[_0x5965('0xc')](function(_0x3ec18a){logger[_0x5965('0xd')](_0x5965('0xe'),_0x22583c,'request\x20sent');logger['debug'](_0x5965('0xf'),_0x22583c,'request\x20sent',JSON[_0x5965('0x10')](_0x3ec18a));if(_0x3ec18a[_0x5965('0x11')]){if(_0x3ec18a[_0x5965('0x11')][_0x5965('0x12')]===0x1f4){logger[_0x5965('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x22583c,_0x3ec18a['error'][_0x5965('0x13')]);return _0x44dfb3(_0x3ec18a[_0x5965('0x11')][_0x5965('0x13')]);}logger['error'](_0x5965('0xe'),_0x22583c,_0x3ec18a[_0x5965('0x11')][_0x5965('0x13')]);return _0x2824f7(_0x3ec18a[_0x5965('0x11')][_0x5965('0x13')]);}else{logger['info'](_0x5965('0xe'),_0x22583c,_0x5965('0x14'));_0x2824f7(_0x3ec18a[_0x5965('0x15')][_0x5965('0x13')]);}})[_0x5965('0x16')](function(_0x183e38){logger[_0x5965('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x22583c,_0x183e38);_0x44dfb3(_0x183e38);});});} \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0735783..2d175fd 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 _0xd06e=['/describe','describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xd06e,0x119));var _0xed06=function(_0x4afb20,_0xa4db33){_0x4afb20=_0x4afb20-0x0;var _0x41310f=_0xd06e[_0x4afb20];return _0x41310f;};'use strict';var multer=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var path=require(_0xed06('0x2'));var timeout=require(_0xed06('0x3'));var express=require(_0xed06('0x4'));var router=express[_0xed06('0x5')]();var fs_extra=require(_0xed06('0x6'));var auth=require(_0xed06('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xed06('0x8'));var controller=require(_0xed06('0x9'));router[_0xed06('0xa')]('/',auth[_0xed06('0xb')](),controller[_0xed06('0xc')]);router[_0xed06('0xa')](_0xed06('0xd'),auth[_0xed06('0xb')](),controller[_0xed06('0xe')]);router[_0xed06('0xa')](_0xed06('0xf'),auth[_0xed06('0xb')](),controller[_0xed06('0x10')]);router['post']('/',auth[_0xed06('0xb')](),controller['create']);router['put']('/:id',auth[_0xed06('0xb')](),controller[_0xed06('0x11')]);router[_0xed06('0x12')](_0xed06('0xf'),auth[_0xed06('0xb')](),controller[_0xed06('0x13')]);module[_0xed06('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index dd66649..f84c721 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x4d45fd,_0x16b74c){var _0x2b5aa5=function(_0x1b9d4d){while(--_0x1b9d4d){_0x4d45fd['push'](_0x4d45fd['shift']());}};_0x2b5aa5(++_0x16b74c);}(_0x34e8,0x12c));var _0x834e=function(_0x562f18,_0x4f1a09){_0x562f18=_0x562f18-0x0;var _0x1fbfe9=_0x34e8[_0x562f18];return _0x1fbfe9;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 04b8cdf..93ca5dc 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 _0x15d3=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','create','body','find','describe','eml-format','rimraf'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x15d3,0x1ba));var _0x315d=function(_0x55dd0d,_0x199bd8){_0x55dd0d=_0x55dd0d-0x0;var _0xc8aa22=_0x15d3[_0x55dd0d];return _0xc8aa22;};'use strict';var emlformat=require(_0x315d('0x0'));var rimraf=require(_0x315d('0x1'));var zipdir=require(_0x315d('0x2'));var jsonpatch=require(_0x315d('0x3'));var rp=require(_0x315d('0x4'));var moment=require(_0x315d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x315d('0x6'));var sox=require(_0x315d('0x7'));var csv=require(_0x315d('0x8'));var ejs=require(_0x315d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x315d('0xa'));var squel=require(_0x315d('0xb'));var crypto=require(_0x315d('0xc'));var jsforce=require(_0x315d('0xd'));var deskjs=require(_0x315d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x315d('0xf'));var Papa=require(_0x315d('0x10'));var Redis=require('ioredis');var authService=require(_0x315d('0x11'));var qs=require(_0x315d('0x12'));var as=require(_0x315d('0x13'));var hardwareService=require(_0x315d('0x14'));var logger=require(_0x315d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x315d('0x16'));var licenseUtil=require(_0x315d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12979e,_0x156fa5){_0x156fa5=_0x156fa5||0xcc;return function(_0x3cc8b4){if(_0x3cc8b4){return _0x12979e[_0x315d('0x18')](_0x156fa5);}return _0x12979e[_0x315d('0x19')](_0x156fa5)[_0x315d('0x1a')]();};}function respondWithResult(_0x1cf769,_0x2e0ad8){_0x2e0ad8=_0x2e0ad8||0xc8;return function(_0x27d539){if(_0x27d539){return _0x1cf769[_0x315d('0x19')](_0x2e0ad8)['json'](_0x27d539);}};}function respondWithFilteredResult(_0x1c67ee,_0x5cb6d8){return function(_0x125e6b){if(_0x125e6b){var _0x21179f=typeof _0x5cb6d8[_0x315d('0x1b')]===_0x315d('0x1c')&&typeof _0x5cb6d8['limit']===_0x315d('0x1c');var _0x4c3739=_0x125e6b['count'];var _0x57edc7=_0x21179f?0x0:_0x5cb6d8[_0x315d('0x1b')];var _0x482d54=_0x21179f?_0x125e6b[_0x315d('0x1d')]:_0x5cb6d8['offset']+_0x5cb6d8[_0x315d('0x1e')];var _0x80fa9c;if(_0x482d54>=_0x4c3739){_0x482d54=_0x4c3739;_0x80fa9c=0xc8;}else{_0x80fa9c=0xce;}_0x1c67ee['status'](_0x80fa9c);return _0x1c67ee[_0x315d('0x1f')](_0x315d('0x20'),_0x57edc7+'-'+_0x482d54+'/'+_0x4c3739)['json'](_0x125e6b);}return null;};}function patchUpdates(_0x2bbf02){return function(_0x2c16f3){try{jsonpatch[_0x315d('0x21')](_0x2c16f3,_0x2bbf02,!![]);}catch(_0x3418b6){return BPromise[_0x315d('0x22')](_0x3418b6);}return _0x2c16f3[_0x315d('0x23')]();};}function saveUpdates(_0x2f0a28,_0x5dae4e){return function(_0x420114){if(_0x420114){return _0x420114[_0x315d('0x24')](_0x2f0a28)[_0x315d('0x25')](function(_0x1da17b){return _0x1da17b;});}return null;};}function removeEntity(_0x346275,_0x714f3b){return function(_0x939dd5){if(_0x939dd5){return _0x939dd5[_0x315d('0x26')]()['then'](function(){_0x346275[_0x315d('0x19')](0xcc)[_0x315d('0x1a')]();});}};}function handleEntityNotFound(_0xda88f5,_0x44617a){return function(_0x1399d0){if(!_0x1399d0){_0xda88f5[_0x315d('0x18')](0x194);}return _0x1399d0;};}function handleError(_0x276416,_0x48ddee){_0x48ddee=_0x48ddee||0x1f4;return function(_0x243afc){logger[_0x315d('0x27')](_0x243afc[_0x315d('0x28')]);if(_0x243afc[_0x315d('0x29')]){delete _0x243afc[_0x315d('0x29')];}_0x276416[_0x315d('0x19')](_0x48ddee)[_0x315d('0x2a')](_0x243afc);};}exports[_0x315d('0x2b')]=function(_0x2ae59a,_0x2b9b2e){var _0x2c3f9c={},_0x2f5a64={},_0xd41f8e={'count':0x0,'rows':[]};var _0x4fdb40=_['map'](db[_0x315d('0x2c')]['rawAttributes'],function(_0x504e57){return{'name':_0x504e57['fieldName'],'type':_0x504e57[_0x315d('0x2d')]['key']};});_0x2f5a64[_0x315d('0x2e')]=_['map'](_0x4fdb40,_0x315d('0x29'));_0x2f5a64[_0x315d('0x2f')]=_['keys'](_0x2ae59a[_0x315d('0x2f')]);_0x2f5a64[_0x315d('0x30')]=_[_0x315d('0x31')](_0x2f5a64[_0x315d('0x2e')],_0x2f5a64['query']);_0x2c3f9c[_0x315d('0x32')]=_['intersection'](_0x2f5a64[_0x315d('0x2e')],qs[_0x315d('0x33')](_0x2ae59a[_0x315d('0x2f')][_0x315d('0x33')]));_0x2c3f9c[_0x315d('0x32')]=_0x2c3f9c[_0x315d('0x32')][_0x315d('0x34')]?_0x2c3f9c['attributes']:_0x2f5a64['model'];if(!_0x2ae59a[_0x315d('0x2f')]['hasOwnProperty'](_0x315d('0x35'))){_0x2c3f9c[_0x315d('0x1e')]=qs[_0x315d('0x1e')](_0x2ae59a[_0x315d('0x2f')][_0x315d('0x1e')]);_0x2c3f9c[_0x315d('0x1b')]=qs[_0x315d('0x1b')](_0x2ae59a['query']['offset']);}_0x2c3f9c[_0x315d('0x36')]=qs[_0x315d('0x37')](_0x2ae59a[_0x315d('0x2f')]['sort']);_0x2c3f9c[_0x315d('0x38')]=qs[_0x315d('0x30')](_[_0x315d('0x39')](_0x2ae59a[_0x315d('0x2f')],_0x2f5a64[_0x315d('0x30')]),_0x4fdb40);if(_0x2ae59a['query'][_0x315d('0x3a')]){_0x2c3f9c['where']=_[_0x315d('0x3b')](_0x2c3f9c[_0x315d('0x38')],{'$or':_[_0x315d('0x3c')](_0x4fdb40,function(_0x229cf3){if(_0x229cf3[_0x315d('0x2d')]!==_0x315d('0x3d')){var _0x5628b8={};_0x5628b8[_0x229cf3[_0x315d('0x29')]]={'$like':'%'+_0x2ae59a[_0x315d('0x2f')][_0x315d('0x3a')]+'%'};return _0x5628b8;}})});}_0x2c3f9c=_['merge']({},_0x2c3f9c,_0x2ae59a[_0x315d('0x3e')]);var _0x4cfecb={'where':_0x2c3f9c[_0x315d('0x38')]};return db['MailTransferReport'][_0x315d('0x1d')](_0x4cfecb)[_0x315d('0x25')](function(_0x34f35){_0xd41f8e[_0x315d('0x1d')]=_0x34f35;if(_0x2ae59a[_0x315d('0x2f')][_0x315d('0x3f')]){_0x2c3f9c[_0x315d('0x40')]=[{'all':!![]}];}return db[_0x315d('0x2c')][_0x315d('0x41')](_0x2c3f9c);})[_0x315d('0x25')](function(_0x50c868){_0xd41f8e[_0x315d('0x42')]=_0x50c868;return _0xd41f8e;})[_0x315d('0x25')](respondWithFilteredResult(_0x2b9b2e,_0x2c3f9c))[_0x315d('0x43')](handleError(_0x2b9b2e,null));};exports['show']=function(_0xce6569,_0x3337ce){var _0x46ef45={'raw':!![],'where':{'id':_0xce6569['params']['id']}},_0x55c9d6={};_0x55c9d6[_0x315d('0x2e')]=_[_0x315d('0x44')](db['MailTransferReport'][_0x315d('0x45')]);_0x55c9d6[_0x315d('0x2f')]=_[_0x315d('0x44')](_0xce6569[_0x315d('0x2f')]);_0x55c9d6['filters']=_[_0x315d('0x31')](_0x55c9d6[_0x315d('0x2e')],_0x55c9d6['query']);_0x46ef45[_0x315d('0x32')]=_[_0x315d('0x31')](_0x55c9d6[_0x315d('0x2e')],qs['fields'](_0xce6569[_0x315d('0x2f')][_0x315d('0x33')]));_0x46ef45['attributes']=_0x46ef45[_0x315d('0x32')][_0x315d('0x34')]?_0x46ef45[_0x315d('0x32')]:_0x55c9d6[_0x315d('0x2e')];if(_0xce6569[_0x315d('0x2f')][_0x315d('0x3f')]){_0x46ef45[_0x315d('0x40')]=[{'all':!![]}];}_0x46ef45=_[_0x315d('0x3b')]({},_0x46ef45,_0xce6569['options']);return db[_0x315d('0x2c')]['find'](_0x46ef45)[_0x315d('0x25')](handleEntityNotFound(_0x3337ce,null))[_0x315d('0x25')](respondWithResult(_0x3337ce,null))[_0x315d('0x43')](handleError(_0x3337ce,null));};exports['create']=function(_0x5513fa,_0x183be1){return db[_0x315d('0x2c')][_0x315d('0x46')](_0x5513fa[_0x315d('0x47')],{})[_0x315d('0x25')](respondWithResult(_0x183be1,0xc9))['catch'](handleError(_0x183be1,null));};exports[_0x315d('0x24')]=function(_0x581740,_0x566c40){if(_0x581740['body']['id']){delete _0x581740[_0x315d('0x47')]['id'];}return db[_0x315d('0x2c')][_0x315d('0x48')]({'where':{'id':_0x581740['params']['id']}})[_0x315d('0x25')](handleEntityNotFound(_0x566c40,null))[_0x315d('0x25')](saveUpdates(_0x581740[_0x315d('0x47')],null))[_0x315d('0x25')](respondWithResult(_0x566c40,null))[_0x315d('0x43')](handleError(_0x566c40,null));};exports[_0x315d('0x26')]=function(_0x5c3723,_0x460e83){return db['MailTransferReport'][_0x315d('0x48')]({'where':{'id':_0x5c3723['params']['id']}})['then'](handleEntityNotFound(_0x460e83,null))[_0x315d('0x25')](removeEntity(_0x460e83,null))['catch'](handleError(_0x460e83,null));};exports[_0x315d('0x49')]=function(_0x27d69b,_0x18d72f){return db[_0x315d('0x2c')][_0x315d('0x49')]()[_0x315d('0x25')](respondWithResult(_0x18d72f,null))[_0x315d('0x43')](handleError(_0x18d72f,null));}; \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5900d23..bbc5712 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 _0x693d=['request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x693d,0x153));var _0xd693=function(_0x5e20a1,_0x2f8505){_0x5e20a1=_0x5e20a1-0x0;var _0x393fba=_0x693d[_0x5e20a1];return _0x393fba;};'use strict';var _=require(_0xd693('0x0'));var util=require(_0xd693('0x1'));var logger=require(_0xd693('0x2'))(_0xd693('0x3'));var moment=require(_0xd693('0x4'));var BPromise=require(_0xd693('0x5'));var rp=require(_0xd693('0x6'));var fs=require('fs');var path=require(_0xd693('0x7'));var rimraf=require(_0xd693('0x8'));var config=require('../../config/environment');var attributes=require(_0xd693('0x9'));module[_0xd693('0xa')]=function(_0x49e710,_0x4cf777){return _0x49e710[_0xd693('0xb')](_0xd693('0xc'),attributes,{'tableName':_0xd693('0xd'),'paranoid':![],'indexes':[{'name':_0xd693('0xe'),'fields':[_0xd693('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7b81216..06fa119 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 _0x428e=['request','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4fef45,_0x193438){var _0x485dfd=function(_0x4571a0){while(--_0x4571a0){_0x4fef45['push'](_0x4fef45['shift']());}};_0x485dfd(++_0x193438);}(_0x428e,0x1eb));var _0xe428=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x428e[_0x528575];return _0x3063b7;};'use strict';var _=require(_0xe428('0x0'));var util=require(_0xe428('0x1'));var moment=require(_0xe428('0x2'));var BPromise=require(_0xe428('0x3'));var rs=require(_0xe428('0x4'));var fs=require('fs');var Redis=require(_0xe428('0x5'));var db=require(_0xe428('0x6'))['db'];var utils=require(_0xe428('0x7'));var logger=require(_0xe428('0x8'))(_0xe428('0x9'));var config=require(_0xe428('0xa'));var jayson=require(_0xe428('0xb'));var client=jayson['client'][_0xe428('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30545e,_0x3bb2f1,_0x23ffd5){return new BPromise(function(_0x504c4f,_0xa6e772){return client[_0xe428('0xd')](_0x30545e,_0x23ffd5)[_0xe428('0xe')](function(_0x2c64d1){logger[_0xe428('0xf')](_0xe428('0x10'),_0x3bb2f1,'request\x20sent');logger['debug'](_0xe428('0x11'),_0x3bb2f1,_0xe428('0x12'),JSON[_0xe428('0x13')](_0x2c64d1));if(_0x2c64d1[_0xe428('0x14')]){if(_0x2c64d1[_0xe428('0x14')][_0xe428('0x15')]===0x1f4){logger[_0xe428('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x3bb2f1,_0x2c64d1[_0xe428('0x14')][_0xe428('0x16')]);return _0xa6e772(_0x2c64d1[_0xe428('0x14')][_0xe428('0x16')]);}logger[_0xe428('0x14')](_0xe428('0x10'),_0x3bb2f1,_0x2c64d1['error'][_0xe428('0x16')]);return _0x504c4f(_0x2c64d1[_0xe428('0x14')]['message']);}else{logger[_0xe428('0xf')](_0xe428('0x10'),_0x3bb2f1,_0xe428('0x12'));_0x504c4f(_0x2c64d1[_0xe428('0x17')][_0xe428('0x16')]);}})['catch'](function(_0x1b6ff5){logger['error'](_0xe428('0x10'),_0x3bb2f1,_0x1b6ff5);_0xa6e772(_0x1b6ff5);});});} \ No newline at end of file +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 diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0bf8fc2..c7df2bd 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 _0x396b=['describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x396b,0x171));var _0xb396=function(_0x3565f7,_0x216844){_0x3565f7=_0x3565f7-0x0;var _0x3b9e0f=_0x396b[_0x3565f7];return _0x3b9e0f;};'use strict';var multer=require('multer');var util=require(_0xb396('0x0'));var path=require(_0xb396('0x1'));var timeout=require(_0xb396('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb396('0x3'));var interaction=require(_0xb396('0x4'));var config=require(_0xb396('0x5'));var controller=require(_0xb396('0x6'));router[_0xb396('0x7')]('/',auth['isAuthenticated'](),controller[_0xb396('0x8')]);router[_0xb396('0x7')](_0xb396('0x9'),auth[_0xb396('0xa')](),controller[_0xb396('0xb')]);router[_0xb396('0x7')](_0xb396('0xc'),auth[_0xb396('0xa')](),controller['show']);router[_0xb396('0xd')]('/',auth[_0xb396('0xa')](),controller[_0xb396('0xe')]);router['put'](_0xb396('0xc'),auth['isAuthenticated'](),controller[_0xb396('0xf')]);router[_0xb396('0x10')]('/:id',auth[_0xb396('0xa')](),controller[_0xb396('0x11')]);module[_0xb396('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ce22088..9d10d6d 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 _0x7c87=['getDataValue','enterAt','diff','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE'];(function(_0x453ef9,_0x2f5a9a){var _0x2f40a3=function(_0x4f8c08){while(--_0x4f8c08){_0x453ef9['push'](_0x453ef9['shift']());}};_0x2f40a3(++_0x2f5a9a);}(_0x7c87,0xd2));var _0x77c8=function(_0x5d8875,_0x1812a6){_0x5d8875=_0x5d8875-0x0;var _0x2a3143=_0x7c87[_0x5d8875];return _0x2a3143;};'use strict';var Sequelize=require(_0x77c8('0x0'));var moment=require('moment');module[_0x77c8('0x1')]={'channel':{'type':Sequelize[_0x77c8('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x77c8('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x77c8('0x3'),'comment':_0x77c8('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x77c8('0x5')],'set':function(_0x1acfbe){var _0x2d2180=moment(_0x1acfbe);var _0x55cea3=moment(this[_0x77c8('0x6')](_0x77c8('0x7')));var _0x1d97d0=_0x2d2180[_0x77c8('0x8')](_0x55cea3,_0x77c8('0x9'));this['setDataValue'](_0x77c8('0xa'),_0x1acfbe);this[_0x77c8('0xb')]('duration',_0x1d97d0>=0x0?_0x1d97d0:null);}},'data1':{'type':Sequelize[_0x77c8('0x2')],'comment':_0x77c8('0xc')},'data2':{'type':Sequelize[_0x77c8('0x2')],'comment':_0x77c8('0xd')},'data3':{'type':Sequelize[_0x77c8('0x2')],'comment':_0x77c8('0xe')},'data4':{'type':Sequelize[_0x77c8('0x2')],'comment':_0x77c8('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x77c8('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x77c8('0x11')]},'uniqueid':{'type':Sequelize[_0x77c8('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 5204af3..3688381 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(_0x37ead6,_0x124a85){var _0x130b68=function(_0x3a14bb){while(--_0x3a14bb){_0x37ead6['push'](_0x37ead6['shift']());}};_0x130b68(++_0x124a85);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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 _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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7f40d3f..f9cecd1 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 _0xabec=['bluebird','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','util','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xabec,0x15a));var _0xcabe=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xabec[_0x58547b];return _0x1d3fd2;};'use strict';var _=require('lodash');var util=require(_0xcabe('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcabe('0x1'));var BPromise=require(_0xcabe('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcabe('0x3'));var rimraf=require(_0xcabe('0x4'));var config=require('../../config/environment');var attributes=require(_0xcabe('0x5'));module[_0xcabe('0x6')]=function(_0x52718d,_0x5075db){return _0x52718d[_0xcabe('0x7')](_0xcabe('0x8'),attributes,{'tableName':_0xcabe('0x9'),'paranoid':![],'indexes':[{'name':_0xcabe('0xa'),'fields':[_0xcabe('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e0e6439..4f191bd 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 _0xea31=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','findAll','options','where','attributes','limit','map','include','model','CreateMemberReport','create','body','raw','UpdateMemberReport','MemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0xa848c7,_0x22e884){var _0x270bda=function(_0x232837){while(--_0x232837){_0xa848c7['push'](_0xa848c7['shift']());}};_0x270bda(++_0x22e884);}(_0xea31,0x6b));var _0x1ea3=function(_0x72df5c,_0x1e1867){_0x72df5c=_0x72df5c-0x0;var _0x352dcc=_0xea31[_0x72df5c];return _0x352dcc;};'use strict';var _=require(_0x1ea3('0x0'));var util=require('util');var moment=require(_0x1ea3('0x1'));var BPromise=require(_0x1ea3('0x2'));var rs=require(_0x1ea3('0x3'));var fs=require('fs');var Redis=require(_0x1ea3('0x4'));var db=require(_0x1ea3('0x5'))['db'];var utils=require(_0x1ea3('0x6'));var logger=require(_0x1ea3('0x7'))('rpc');var config=require(_0x1ea3('0x8'));var jayson=require(_0x1ea3('0x9'));var client=jayson[_0x1ea3('0xa')][_0x1ea3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13e6fb,_0x4c8f83,_0x1fa3a8){return new BPromise(function(_0x1b578e,_0x30a6db){return client[_0x1ea3('0xc')](_0x13e6fb,_0x1fa3a8)[_0x1ea3('0xd')](function(_0x2ff19a){logger['info'](_0x1ea3('0xe'),_0x4c8f83,_0x1ea3('0xf'));logger[_0x1ea3('0x10')](_0x1ea3('0x11'),_0x4c8f83,_0x1ea3('0xf'),JSON[_0x1ea3('0x12')](_0x2ff19a));if(_0x2ff19a[_0x1ea3('0x13')]){if(_0x2ff19a['error'][_0x1ea3('0x14')]===0x1f4){logger['error'](_0x1ea3('0xe'),_0x4c8f83,_0x2ff19a[_0x1ea3('0x13')][_0x1ea3('0x15')]);return _0x30a6db(_0x2ff19a['error'][_0x1ea3('0x15')]);}logger[_0x1ea3('0x13')](_0x1ea3('0xe'),_0x4c8f83,_0x2ff19a['error'][_0x1ea3('0x15')]);return _0x1b578e(_0x2ff19a[_0x1ea3('0x13')][_0x1ea3('0x15')]);}else{logger[_0x1ea3('0x16')](_0x1ea3('0xe'),_0x4c8f83,_0x1ea3('0xf'));_0x1b578e(_0x2ff19a[_0x1ea3('0x17')]['message']);}})[_0x1ea3('0x18')](function(_0x199728){logger[_0x1ea3('0x13')](_0x1ea3('0xe'),_0x4c8f83,_0x199728);_0x30a6db(_0x199728);});});}exports[_0x1ea3('0x19')]=function(_0x541e18){var _0x1c7530=this;return new Promise(function(_0x2a8b47,_0x990a86){return db['MemberReport'][_0x1ea3('0x1a')]({'raw':_0x541e18[_0x1ea3('0x1b')]?_0x541e18[_0x1ea3('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x541e18[_0x1ea3('0x1b')]?_0x541e18['options'][_0x1ea3('0x1c')]||null:null,'attributes':_0x541e18[_0x1ea3('0x1b')]?_0x541e18[_0x1ea3('0x1b')][_0x1ea3('0x1d')]||null:null,'limit':_0x541e18[_0x1ea3('0x1b')]?_0x541e18['options'][_0x1ea3('0x1e')]||null:null,'include':_0x541e18['options']?_0x541e18[_0x1ea3('0x1b')]['include']?_[_0x1ea3('0x1f')](_0x541e18[_0x1ea3('0x1b')][_0x1ea3('0x20')],function(_0x5ad8ff){return{'model':db[_0x5ad8ff['model']],'as':_0x5ad8ff['as'],'attributes':_0x5ad8ff[_0x1ea3('0x1d')],'include':_0x5ad8ff['include']?_[_0x1ea3('0x1f')](_0x5ad8ff[_0x1ea3('0x20')],function(_0x3c42f3){return{'model':db[_0x3c42f3[_0x1ea3('0x21')]],'as':_0x3c42f3['as'],'attributes':_0x3c42f3[_0x1ea3('0x1d')],'include':_0x3c42f3['include']?_['map'](_0x3c42f3[_0x1ea3('0x20')],function(_0x2edfb4){return{'model':db[_0x2edfb4[_0x1ea3('0x21')]],'as':_0x2edfb4['as'],'attributes':_0x2edfb4[_0x1ea3('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1ea3('0xd')](function(_0x12283d){logger[_0x1ea3('0x16')](_0x1ea3('0x19'),_0x541e18);logger[_0x1ea3('0x10')](_0x1ea3('0x19'),_0x541e18,JSON[_0x1ea3('0x12')](_0x12283d));_0x2a8b47(_0x12283d);})[_0x1ea3('0x18')](function(_0x2c29d7){logger[_0x1ea3('0x13')](_0x1ea3('0x19'),_0x2c29d7[_0x1ea3('0x15')],_0x541e18);_0x990a86(_0x1c7530['error'](0x1f4,_0x2c29d7[_0x1ea3('0x15')]));});});};exports[_0x1ea3('0x22')]=function(_0x473fda){var _0x1744b8=this;return new Promise(function(_0x2448fd,_0x59c5af){return db['MemberReport'][_0x1ea3('0x23')](_0x473fda[_0x1ea3('0x24')],{'raw':_0x473fda['options']?_0x473fda[_0x1ea3('0x1b')][_0x1ea3('0x25')]===undefined?!![]:![]:!![]})['then'](function(_0x4c16ef){logger[_0x1ea3('0x16')](_0x1ea3('0x22'),_0x473fda);logger[_0x1ea3('0x10')](_0x1ea3('0x22'),_0x473fda,JSON[_0x1ea3('0x12')](_0x4c16ef));_0x2448fd(_0x4c16ef);})[_0x1ea3('0x18')](function(_0x3b78bb){logger[_0x1ea3('0x13')](_0x1ea3('0x22'),_0x3b78bb['message'],_0x473fda);_0x59c5af(_0x1744b8[_0x1ea3('0x13')](0x1f4,_0x3b78bb[_0x1ea3('0x15')]));});});};exports[_0x1ea3('0x26')]=function(_0x24793d){var _0x2139a6=this;return new Promise(function(_0x3b9266,_0x36d563){return db[_0x1ea3('0x27')][_0x1ea3('0x28')](_0x24793d[_0x1ea3('0x24')],{'raw':_0x24793d['options']?_0x24793d[_0x1ea3('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24793d[_0x1ea3('0x1b')]?_0x24793d['options']['where']||null:null,'attributes':_0x24793d[_0x1ea3('0x1b')]?_0x24793d['options']['attributes']||null:null,'limit':_0x24793d['options']?_0x24793d[_0x1ea3('0x1b')][_0x1ea3('0x1e')]||null:null})[_0x1ea3('0xd')](function(_0x3c2289){logger[_0x1ea3('0x16')]('UpdateMemberReport',_0x24793d);logger[_0x1ea3('0x10')]('UpdateMemberReport',_0x24793d,JSON[_0x1ea3('0x12')](_0x3c2289));_0x3b9266(_0x3c2289);})[_0x1ea3('0x18')](function(_0x5c7206){logger[_0x1ea3('0x13')](_0x1ea3('0x26'),_0x5c7206[_0x1ea3('0x15')],_0x24793d);_0x36d563(_0x2139a6[_0x1ea3('0x13')](0x1f4,_0x5c7206[_0x1ea3('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e17e406..84d76a9 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 _0x39bb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','express'];(function(_0x302fa3,_0xd99f79){var _0x18849a=function(_0x2ba7e3){while(--_0x2ba7e3){_0x302fa3['push'](_0x302fa3['shift']());}};_0x18849a(++_0xd99f79);}(_0x39bb,0x1f4));var _0xb39b=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x39bb[_0x4991d6];return _0x50faf7;};'use strict';var multer=require(_0xb39b('0x0'));var util=require(_0xb39b('0x1'));var path=require(_0xb39b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb39b('0x3'));var router=express['Router']();var fs_extra=require(_0xb39b('0x4'));var auth=require(_0xb39b('0x5'));var interaction=require(_0xb39b('0x6'));var config=require(_0xb39b('0x7'));var controller=require(_0xb39b('0x8'));router[_0xb39b('0x9')]('/',controller[_0xb39b('0xa')]);module[_0xb39b('0xb')]=router; \ No newline at end of file +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 diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index bf4bdc1..24085cf 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 _0xfa2b=['exports','STRING','sequelize'];(function(_0x47db7e,_0x1b0869){var _0x4325c3=function(_0x5dd324){while(--_0x5dd324){_0x47db7e['push'](_0x47db7e['shift']());}};_0x4325c3(++_0x1b0869);}(_0xfa2b,0x10d));var _0xbfa2=function(_0x47fee9,_0x2a5606){_0x47fee9=_0x47fee9-0x0;var _0x255dd2=_0xfa2b[_0x47fee9];return _0x255dd2;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'version':{'type':Sequelize[_0xbfa2('0x2')],'unique':'version'}}; \ No newline at end of file +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 diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a79d27c..c8dd4ce 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 _0x2416=['pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','Migration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','sort'];(function(_0x4429fa,_0x1426bd){var _0x18891f=function(_0x4f70e9){while(--_0x4f70e9){_0x4429fa['push'](_0x4429fa['shift']());}};_0x18891f(++_0x1426bd);}(_0x2416,0x94));var _0x6241=function(_0x5773aa,_0x4f050a){_0x5773aa=_0x5773aa-0x0;var _0x3b3427=_0x2416[_0x5773aa];return _0x3b3427;};'use strict';var emlformat=require(_0x6241('0x0'));var rimraf=require(_0x6241('0x1'));var zipdir=require(_0x6241('0x2'));var jsonpatch=require(_0x6241('0x3'));var rp=require('request-promise');var moment=require(_0x6241('0x4'));var BPromise=require(_0x6241('0x5'));var Mustache=require(_0x6241('0x6'));var util=require(_0x6241('0x7'));var path=require(_0x6241('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6241('0x9'));var fs=require('fs');var fs_extra=require(_0x6241('0xa'));var _=require(_0x6241('0xb'));var squel=require(_0x6241('0xc'));var crypto=require(_0x6241('0xd'));var jsforce=require(_0x6241('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6241('0xf'));var Papa=require(_0x6241('0x10'));var Redis=require(_0x6241('0x11'));var authService=require(_0x6241('0x12'));var qs=require(_0x6241('0x13'));var as=require(_0x6241('0x14'));var hardwareService=require(_0x6241('0x15'));var logger=require(_0x6241('0x16'))('api');var utils=require(_0x6241('0x17'));var config=require(_0x6241('0x18'));var licenseUtil=require(_0x6241('0x19'));var db=require(_0x6241('0x1a'))['db'];function respondWithStatusCode(_0x4afbb7,_0x37d05c){_0x37d05c=_0x37d05c||0xcc;return function(_0x312cb8){if(_0x312cb8){return _0x4afbb7[_0x6241('0x1b')](_0x37d05c);}return _0x4afbb7[_0x6241('0x1c')](_0x37d05c)[_0x6241('0x1d')]();};}function respondWithResult(_0xff70ad,_0x236ad7){_0x236ad7=_0x236ad7||0xc8;return function(_0xec352c){if(_0xec352c){return _0xff70ad[_0x6241('0x1c')](_0x236ad7)[_0x6241('0x1e')](_0xec352c);}};}function respondWithFilteredResult(_0x3ac9cc,_0xde3a5f){return function(_0x37a3a5){if(_0x37a3a5){var _0x3e6e37=typeof _0xde3a5f['offset']===_0x6241('0x1f')&&typeof _0xde3a5f[_0x6241('0x20')]===_0x6241('0x1f');var _0x41ebac=_0x37a3a5['count'];var _0xcf7ffa=_0x3e6e37?0x0:_0xde3a5f[_0x6241('0x21')];var _0x55bda2=_0x3e6e37?_0x37a3a5[_0x6241('0x22')]:_0xde3a5f['offset']+_0xde3a5f[_0x6241('0x20')];var _0x41638d;if(_0x55bda2>=_0x41ebac){_0x55bda2=_0x41ebac;_0x41638d=0xc8;}else{_0x41638d=0xce;}_0x3ac9cc['status'](_0x41638d);return _0x3ac9cc[_0x6241('0x23')](_0x6241('0x24'),_0xcf7ffa+'-'+_0x55bda2+'/'+_0x41ebac)[_0x6241('0x1e')](_0x37a3a5);}return null;};}function patchUpdates(_0x4e824e){return function(_0x587c4d){try{jsonpatch[_0x6241('0x25')](_0x587c4d,_0x4e824e,!![]);}catch(_0x291ed0){return BPromise['reject'](_0x291ed0);}return _0x587c4d[_0x6241('0x26')]();};}function saveUpdates(_0x130565,_0x36bfbd){return function(_0x3e5885){if(_0x3e5885){return _0x3e5885[_0x6241('0x27')](_0x130565)[_0x6241('0x28')](function(_0x2b229b){return _0x2b229b;});}return null;};}function removeEntity(_0x5bde2c,_0x7ee2cb){return function(_0x374428){if(_0x374428){return _0x374428[_0x6241('0x29')]()[_0x6241('0x28')](function(){_0x5bde2c['status'](0xcc)[_0x6241('0x1d')]();});}};}function handleEntityNotFound(_0x18ac1a,_0x54b2fc){return function(_0x12b503){if(!_0x12b503){_0x18ac1a[_0x6241('0x1b')](0x194);}return _0x12b503;};}function handleError(_0x4229a9,_0x1115a5){_0x1115a5=_0x1115a5||0x1f4;return function(_0x4a17cd){logger[_0x6241('0x2a')](_0x4a17cd[_0x6241('0x2b')]);if(_0x4a17cd[_0x6241('0x2c')]){delete _0x4a17cd['name'];}_0x4229a9[_0x6241('0x1c')](_0x1115a5)['send'](_0x4a17cd);};}exports['index']=function(_0x4ac448,_0x44e276){var _0xa8c3c3={},_0x127be0={},_0x4be28e={'count':0x0,'rows':[]};var _0x3332ae=_['map'](db[_0x6241('0x2d')][_0x6241('0x2e')],function(_0x52cec7){return{'name':_0x52cec7[_0x6241('0x2f')],'type':_0x52cec7[_0x6241('0x30')][_0x6241('0x31')]};});_0x127be0[_0x6241('0x32')]=_[_0x6241('0x33')](_0x3332ae,_0x6241('0x2c'));_0x127be0[_0x6241('0x34')]=_['keys'](_0x4ac448['query']);_0x127be0[_0x6241('0x35')]=_[_0x6241('0x36')](_0x127be0[_0x6241('0x32')],_0x127be0[_0x6241('0x34')]);_0xa8c3c3[_0x6241('0x37')]=_[_0x6241('0x36')](_0x127be0[_0x6241('0x32')],qs['fields'](_0x4ac448['query'][_0x6241('0x38')]));_0xa8c3c3[_0x6241('0x37')]=_0xa8c3c3['attributes'][_0x6241('0x39')]?_0xa8c3c3['attributes']:_0x127be0[_0x6241('0x32')];if(!_0x4ac448[_0x6241('0x34')]['hasOwnProperty']('nolimit')){_0xa8c3c3[_0x6241('0x20')]=qs[_0x6241('0x20')](_0x4ac448[_0x6241('0x34')]['limit']);_0xa8c3c3[_0x6241('0x21')]=qs[_0x6241('0x21')](_0x4ac448[_0x6241('0x34')]['offset']);}_0xa8c3c3['order']=qs['sort'](_0x4ac448[_0x6241('0x34')][_0x6241('0x3a')]);_0xa8c3c3['where']=qs[_0x6241('0x35')](_[_0x6241('0x3b')](_0x4ac448[_0x6241('0x34')],_0x127be0[_0x6241('0x35')]),_0x3332ae);if(_0x4ac448[_0x6241('0x34')]['filter']){_0xa8c3c3[_0x6241('0x3c')]=_[_0x6241('0x3d')](_0xa8c3c3[_0x6241('0x3c')],{'$or':_[_0x6241('0x33')](_0x3332ae,function(_0x3a8ee4){if(_0x3a8ee4['type']!=='VIRTUAL'){var _0x419133={};_0x419133[_0x3a8ee4[_0x6241('0x2c')]]={'$like':'%'+_0x4ac448['query'][_0x6241('0x3e')]+'%'};return _0x419133;}})});}_0xa8c3c3=_['merge']({},_0xa8c3c3,_0x4ac448[_0x6241('0x3f')]);var _0x15a98c={'where':_0xa8c3c3['where']};return db['Migration'][_0x6241('0x22')](_0x15a98c)[_0x6241('0x28')](function(_0x9387e1){_0x4be28e['count']=_0x9387e1;if(_0x4ac448[_0x6241('0x34')][_0x6241('0x40')]){_0xa8c3c3[_0x6241('0x41')]=[{'all':!![]}];}return db[_0x6241('0x2d')][_0x6241('0x42')](_0xa8c3c3);})['then'](function(_0x555988){_0x4be28e[_0x6241('0x43')]=_0x555988;return _0x4be28e;})[_0x6241('0x28')](respondWithFilteredResult(_0x44e276,_0xa8c3c3))[_0x6241('0x44')](handleError(_0x44e276,null));}; \ No newline at end of file +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 diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 42b17c5..cb6bf32 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 _0xe6c5=['api','path','rimraf','exports','migrations','util','../../config/logger'];(function(_0x220863,_0x5479f7){var _0x653962=function(_0x1b338f){while(--_0x1b338f){_0x220863['push'](_0x220863['shift']());}};_0x653962(++_0x5479f7);}(_0xe6c5,0x17f));var _0x5e6c=function(_0x574b74,_0x424052){_0x574b74=_0x574b74-0x0;var _0x343504=_0xe6c5[_0x574b74];return _0x343504;};'use strict';var _=require('lodash');var util=require(_0x5e6c('0x0'));var logger=require(_0x5e6c('0x1'))(_0x5e6c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e6c('0x3'));var rimraf=require(_0x5e6c('0x4'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x5e6c('0x5')]=function(_0x2ba3a0,_0x4e8a12){return _0x2ba3a0['define']('Migration',attributes,{'tableName':_0x5e6c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 39f4392..0d9ca57 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 _0xeffd=['stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x4fda53,_0x2ad5a8){var _0xdb108d=function(_0x4b93d5){while(--_0x4b93d5){_0x4fda53['push'](_0x4fda53['shift']());}};_0xdb108d(++_0x2ad5a8);}(_0xeffd,0x6b));var _0xdeff=function(_0x30c650,_0x5ca0b0){_0x30c650=_0x30c650-0x0;var _0x11303b=_0xeffd[_0x30c650];return _0x11303b;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('Migration,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});} \ No newline at end of file +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 diff --git a/server/api/network/index.js b/server/api/network/index.js index a4c0706..84edae1 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 _0x90b1=['destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x23ed5d,_0x25c460){var _0x12fbdd=function(_0x8dc30){while(--_0x8dc30){_0x23ed5d['push'](_0x23ed5d['shift']());}};_0x12fbdd(++_0x25c460);}(_0x90b1,0x1bb));var _0x190b=function(_0x5b8f75,_0x30ee13){_0x5b8f75=_0x5b8f75-0x0;var _0x3643b7=_0x90b1[_0x5b8f75];return _0x3643b7;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0xc')]('/',auth[_0x190b('0xa')](),controller['create']);router[_0x190b('0xd')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xe')]);router[_0x190b('0xf')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 543cea1..8b1a558 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 _0x9d4e=['turn','STRING','sequelize','exports','localnet','stun'];(function(_0x5dce9b,_0x337511){var _0x1ef03d=function(_0x2a426a){while(--_0x2a426a){_0x5dce9b['push'](_0x5dce9b['shift']());}};_0x1ef03d(++_0x337511);}(_0x9d4e,0xe0));var _0xe9d4=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x9d4e[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xe9d4('0x0'));module[_0xe9d4('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe9d4('0x2'),'externip',_0xe9d4('0x3'),_0xe9d4('0x4'))},'value':{'type':Sequelize[_0xe9d4('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe9d4('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index be9b491..4db7312 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 _0xb2a4=['fields','length','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','params','find','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','writeFileSync','Reload','root','server/files/templates/turn_multiple.ejs','render','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','utf8','res_stun_monitor.so','format','toLowerCase','/etc/asterisk/stun_xcally.conf','TURN','/etc/asterisk/turn_xcally.conf','util','ejs','../../components/parsers/qs','../../config/logger','api','jayson/promise','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','name','send','map','Network','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb2a4,0x72));var _0x4b2a=function(_0x31c17c,_0x493d73){_0x31c17c=_0x31c17c-0x0;var _0x41b6d6=_0xb2a4[_0x31c17c];return _0x41b6d6;};'use strict';var util=require(_0x4b2a('0x0'));var path=require('path');var ejs=require(_0x4b2a('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0x4b2a('0x2'));var logger=require(_0x4b2a('0x3'))(_0x4b2a('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x4b2a('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2498f3,_0x5a57da,_0x3ecd14,_0x16857d){return new Promise(function(_0x1a2b6d,_0x10e7a9){var _0x310a33=_0x16857d||client;return _0x310a33[_0x4b2a('0x6')](_0x2498f3,_0x3ecd14)[_0x4b2a('0x7')](function(_0x1c3bd1){logger[_0x4b2a('0x8')](_0x4b2a('0x9'),_0x5a57da,_0x4b2a('0xa'));logger[_0x4b2a('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0x5a57da,'request\x20sent',JSON['stringify'](_0x1c3bd1));if(_0x1c3bd1[_0x4b2a('0xc')]){if(_0x1c3bd1[_0x4b2a('0xc')][_0x4b2a('0xd')]===0x1f4){logger[_0x4b2a('0xc')](_0x4b2a('0x9'),_0x5a57da,_0x1c3bd1['error'][_0x4b2a('0xe')]);return _0x10e7a9(_0x1c3bd1[_0x4b2a('0xc')][_0x4b2a('0xe')]);}logger[_0x4b2a('0xc')]('Network,\x20%s,\x20%s',_0x5a57da,_0x1c3bd1['error'][_0x4b2a('0xe')]);return _0x1a2b6d(_0x1c3bd1[_0x4b2a('0xc')][_0x4b2a('0xe')]);}else{logger['info'](_0x4b2a('0x9'),_0x5a57da,'request\x20sent');_0x1a2b6d(_0x1c3bd1['result'][_0x4b2a('0xe')]);}})[_0x4b2a('0xf')](function(_0x2311c8){logger['error'](_0x4b2a('0x9'),_0x5a57da,_0x2311c8);_0x10e7a9(_0x2311c8);});});}function respondWithResult(_0x15abde,_0x2a16f4){_0x2a16f4=_0x2a16f4||0xc8;return function(_0xc115e){if(_0xc115e){return _0x15abde[_0x4b2a('0x10')](_0x2a16f4)[_0x4b2a('0x11')](_0xc115e);}};}function respondWithFilteredResult(_0x5b8530,_0x2d162a){return function(_0x43eaef){if(_0x43eaef){var _0x2c2da9=typeof _0x2d162a[_0x4b2a('0x12')]===_0x4b2a('0x13')&&typeof _0x2d162a[_0x4b2a('0x14')]===_0x4b2a('0x13');var _0x3f6582=_0x43eaef[_0x4b2a('0x15')];var _0x349652=_0x2c2da9?0x0:_0x2d162a[_0x4b2a('0x12')];var _0x405335=_0x2c2da9?_0x43eaef[_0x4b2a('0x15')]:_0x2d162a[_0x4b2a('0x12')]+_0x2d162a['limit'];var _0x49c0ec;if(_0x405335>=_0x3f6582){_0x405335=_0x3f6582;_0x49c0ec=0xc8;}else{_0x49c0ec=0xce;}_0x5b8530[_0x4b2a('0x10')](_0x49c0ec);return _0x5b8530['set'](_0x4b2a('0x16'),_0x349652+'-'+_0x405335+'/'+_0x3f6582)[_0x4b2a('0x11')](_0x43eaef);}return null;};}function saveUpdates(_0xbd547d){return function(_0xd3ff36){if(_0xd3ff36){return _0xd3ff36[_0x4b2a('0x17')](_0xbd547d)[_0x4b2a('0x7')](function(_0x221a78){return _0x221a78;});}return null;};}function removeEntity(_0x167e7c){return function(_0x276dfd){if(_0x276dfd){return _0x276dfd[_0x4b2a('0x18')]()[_0x4b2a('0x7')](function(){_0x167e7c[_0x4b2a('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4efde5){return function(_0x22c0aa){if(!_0x22c0aa){_0x4efde5['sendStatus'](0x194);}return _0x22c0aa;};}function handleError(_0x2f1e46,_0x157af4){_0x157af4=_0x157af4||0x1f4;return function(_0x280616){logger[_0x4b2a('0xc')](_0x280616[_0x4b2a('0x19')]);if(_0x280616[_0x4b2a('0x1a')]){delete _0x280616['name'];}_0x2f1e46['status'](_0x157af4)[_0x4b2a('0x1b')](_0x280616);};}exports['index']=function(_0x326ce4,_0x2129ae){var _0x17efb8={},_0x500af9={},_0x4fcb48={'count':0x0,'rows':[]};var _0x26c520=_[_0x4b2a('0x1c')](db[_0x4b2a('0x1d')][_0x4b2a('0x1e')],function(_0xe2cd99){return{'name':_0xe2cd99[_0x4b2a('0x1f')],'type':_0xe2cd99[_0x4b2a('0x20')][_0x4b2a('0x21')]};});_0x500af9[_0x4b2a('0x22')]=_[_0x4b2a('0x1c')](_0x26c520,_0x4b2a('0x1a'));_0x500af9['query']=_[_0x4b2a('0x23')](_0x326ce4['query']);_0x500af9[_0x4b2a('0x24')]=_[_0x4b2a('0x25')](_0x500af9[_0x4b2a('0x22')],_0x500af9[_0x4b2a('0x26')]);_0x17efb8[_0x4b2a('0x27')]=_[_0x4b2a('0x25')](_0x500af9['model'],qs[_0x4b2a('0x28')](_0x326ce4[_0x4b2a('0x26')][_0x4b2a('0x28')]));_0x17efb8[_0x4b2a('0x27')]=_0x17efb8['attributes'][_0x4b2a('0x29')]?_0x17efb8[_0x4b2a('0x27')]:_0x500af9[_0x4b2a('0x22')];if(!_0x326ce4[_0x4b2a('0x26')]['hasOwnProperty'](_0x4b2a('0x2a'))){_0x17efb8[_0x4b2a('0x14')]=qs[_0x4b2a('0x14')](_0x326ce4['query'][_0x4b2a('0x14')]);_0x17efb8[_0x4b2a('0x12')]=qs['offset'](_0x326ce4['query'][_0x4b2a('0x12')]);}_0x17efb8['order']=qs[_0x4b2a('0x2b')](_0x326ce4['query'][_0x4b2a('0x2b')]);_0x17efb8[_0x4b2a('0x2c')]=qs[_0x4b2a('0x24')](_[_0x4b2a('0x2d')](_0x326ce4['query'],_0x500af9['filters']),_0x26c520);if(_0x326ce4[_0x4b2a('0x26')]['filter']){_0x17efb8['where']=_[_0x4b2a('0x2e')](_0x17efb8[_0x4b2a('0x2c')],{'$or':_[_0x4b2a('0x1c')](_0x26c520,function(_0x39cee0){if(_0x39cee0[_0x4b2a('0x20')]!=='VIRTUAL'){var _0x52c6c6={};_0x52c6c6[_0x39cee0[_0x4b2a('0x1a')]]={'$like':'%'+_0x326ce4[_0x4b2a('0x26')][_0x4b2a('0x2f')]+'%'};return _0x52c6c6;}})});}_0x17efb8=_[_0x4b2a('0x2e')]({},_0x17efb8,_0x326ce4[_0x4b2a('0x30')]);var _0x2cb086={'where':_0x17efb8[_0x4b2a('0x2c')]};return db[_0x4b2a('0x1d')][_0x4b2a('0x15')](_0x2cb086)[_0x4b2a('0x7')](function(_0x1134dc){_0x4fcb48['count']=_0x1134dc;if(_0x326ce4[_0x4b2a('0x26')][_0x4b2a('0x31')]){_0x17efb8[_0x4b2a('0x32')]=[{'all':!![]}];}return db[_0x4b2a('0x1d')][_0x4b2a('0x33')](_0x17efb8);})['then'](function(_0x46e6c1){_0x4fcb48[_0x4b2a('0x34')]=_0x46e6c1;return _0x4fcb48;})['then'](respondWithFilteredResult(_0x2129ae,_0x17efb8))[_0x4b2a('0xf')](handleError(_0x2129ae,null));};exports['show']=function(_0x58700b,_0x3d3752){var _0x4cd7ff={'raw':!![],'where':{'id':_0x58700b[_0x4b2a('0x35')]['id']}},_0x3a0e3e={};_0x3a0e3e[_0x4b2a('0x22')]=_['keys'](db[_0x4b2a('0x1d')]['rawAttributes']);_0x3a0e3e[_0x4b2a('0x26')]=_[_0x4b2a('0x23')](_0x58700b[_0x4b2a('0x26')]);_0x3a0e3e[_0x4b2a('0x24')]=_['intersection'](_0x3a0e3e['model'],_0x3a0e3e[_0x4b2a('0x26')]);_0x4cd7ff[_0x4b2a('0x27')]=_['intersection'](_0x3a0e3e[_0x4b2a('0x22')],qs[_0x4b2a('0x28')](_0x58700b[_0x4b2a('0x26')][_0x4b2a('0x28')]));_0x4cd7ff[_0x4b2a('0x27')]=_0x4cd7ff[_0x4b2a('0x27')][_0x4b2a('0x29')]?_0x4cd7ff[_0x4b2a('0x27')]:_0x3a0e3e[_0x4b2a('0x22')];if(_0x58700b['query']['includeAll']){_0x4cd7ff['include']=[{'all':!![]}];}_0x4cd7ff=_[_0x4b2a('0x2e')]({},_0x4cd7ff,_0x58700b[_0x4b2a('0x30')]);return db[_0x4b2a('0x1d')][_0x4b2a('0x36')](_0x4cd7ff)[_0x4b2a('0x7')](handleEntityNotFound(_0x3d3752,null))['then'](respondWithResult(_0x3d3752,null))['catch'](handleError(_0x3d3752,null));};exports['create']=function(_0x3e5335,_0x4d04d1){var _0x5862a3;return db['Network'][_0x4b2a('0x37')](_0x3e5335[_0x4b2a('0x38')],{'raw':!![]})[_0x4b2a('0x7')](function(_0x4db51){_0x5862a3=_0x4db51;return db['Network']['findAll']({'where':{'type':_0x3e5335[_0x4b2a('0x38')][_0x4b2a('0x20')]},'raw':!![]});})[_0x4b2a('0x7')](function(_0x3670a7){if(_0x5862a3['type'][_0x4b2a('0x39')]()=='STUN'){var _0x393830=fs[_0x4b2a('0x3a')](path[_0x4b2a('0x3b')](config['root'],_0x4b2a('0x3c')),'utf8');var _0xab5243=ejs['render'](_0x393830,{'networks':_0x3670a7||[]});fs[_0x4b2a('0x3d')]('/etc/asterisk/stun_xcally.conf',_0xab5243);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x37'),{'module':'res_stun_monitor.so'});}else if(_0x5862a3[_0x4b2a('0x20')][_0x4b2a('0x39')]()=='TURN'){var _0x1a7683=fs[_0x4b2a('0x3a')](path['join'](config[_0x4b2a('0x3f')],_0x4b2a('0x40')),'utf8');var _0x49ab7b=ejs[_0x4b2a('0x41')](_0x1a7683,{'networks':_0x3670a7||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x49ab7b);return respondWithRpcPromise('Reload',_0x4b2a('0x37'),{'module':'res_stun_monitor.so'});}else{var _0x499da1=fs[_0x4b2a('0x3a')](path[_0x4b2a('0x3b')](config[_0x4b2a('0x3f')],_0x4b2a('0x42')),'utf8');var _0x44f154=ejs['render'](_0x499da1,{'networks':_0x3670a7||[]});fs['writeFileSync'](util['format'](_0x4b2a('0x43'),_0x3e5335[_0x4b2a('0x38')][_0x4b2a('0x20')]['toLowerCase']()),_0x44f154);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x37'),{'module':_0x4b2a('0x44')});}})[_0x4b2a('0x7')](function(){return _0x5862a3;})['then'](respondWithResult(_0x4d04d1,0xc9))[_0x4b2a('0xf')](handleError(_0x4d04d1,null));};exports[_0x4b2a('0x17')]=function(_0x554196,_0xb67c18){var _0x1a32aa;return db[_0x4b2a('0x1d')][_0x4b2a('0x36')]({'where':{'id':_0x554196[_0x4b2a('0x35')]['id']}})['then'](handleEntityNotFound(_0xb67c18,null))[_0x4b2a('0x7')](saveUpdates(_0x554196[_0x4b2a('0x38')],null))[_0x4b2a('0x7')](function(_0x381aeb){if(_0x381aeb){_0x1a32aa=_0x381aeb;return db[_0x4b2a('0x1d')][_0x4b2a('0x33')]({'where':{'type':_0x1a32aa[_0x4b2a('0x20')]},'raw':!![]});}return null;})[_0x4b2a('0x7')](function(_0x29d0a1){if(_0x1a32aa[_0x4b2a('0x20')][_0x4b2a('0x39')]()==_0x4b2a('0x45')){var _0xf7c443=fs[_0x4b2a('0x3a')](path[_0x4b2a('0x3b')](config['root'],_0x4b2a('0x3c')),_0x4b2a('0x46'));var _0x93c498=ejs['render'](_0xf7c443,{'networks':_0x29d0a1||[]});fs[_0x4b2a('0x3d')]('/etc/asterisk/stun_xcally.conf',_0x93c498);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x17'),{'module':_0x4b2a('0x47')});}else if(_0x1a32aa['type'][_0x4b2a('0x39')]()=='TURN'){var _0x2fb0d0=fs['readFileSync'](path[_0x4b2a('0x3b')](config[_0x4b2a('0x3f')],_0x4b2a('0x40')),_0x4b2a('0x46'));var _0x485c77=ejs[_0x4b2a('0x41')](_0x2fb0d0,{'networks':_0x29d0a1||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x485c77);return respondWithRpcPromise('Reload',_0x4b2a('0x17'),{'module':_0x4b2a('0x47')});}else{var _0x505afe=fs['readFileSync'](path[_0x4b2a('0x3b')](config['root'],_0x4b2a('0x42')),_0x4b2a('0x46'));var _0x2273e6=ejs[_0x4b2a('0x41')](_0x505afe,{'networks':_0x29d0a1||[]});fs[_0x4b2a('0x3d')](util[_0x4b2a('0x48')]('/etc/asterisk/sip_xcally_%s.conf',_0x554196['body'][_0x4b2a('0x20')][_0x4b2a('0x49')]()),_0x2273e6);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x17'),{'module':_0x4b2a('0x44')});}})[_0x4b2a('0x7')](function(_0x49dbc1){if(_0x49dbc1){return _0x1a32aa;}return null;})[_0x4b2a('0x7')](respondWithResult(_0xb67c18,null))[_0x4b2a('0xf')](handleError(_0xb67c18,null));};exports['destroy']=function(_0x1afd03,_0x559fbb){var _0x1b52bc;return db[_0x4b2a('0x1d')]['find']({'where':{'id':_0x1afd03[_0x4b2a('0x35')]['id']}})['then'](function(_0x1f1d74){_0x1b52bc=_0x1f1d74;return _0x1f1d74;})['then'](handleEntityNotFound(_0x559fbb,null))[_0x4b2a('0x7')](removeEntity(_0x559fbb,null))['then'](function(){if(_0x1b52bc){return db[_0x4b2a('0x1d')][_0x4b2a('0x33')]({'where':{'type':_0x1b52bc[_0x4b2a('0x20')]},'raw':!![]});}})[_0x4b2a('0x7')](function(_0x3104a6){if(_0x1b52bc[_0x4b2a('0x20')][_0x4b2a('0x39')]()==_0x4b2a('0x45')){var _0x14105b=fs['readFileSync'](path[_0x4b2a('0x3b')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x467986=ejs['render'](_0x14105b,{'networks':_0x3104a6||[]});fs[_0x4b2a('0x3d')](_0x4b2a('0x4a'),_0x467986);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x18'),{'module':_0x4b2a('0x47')});}else if(_0x1b52bc[_0x4b2a('0x20')]['toUpperCase']()==_0x4b2a('0x4b')){var _0xd4c730=fs['readFileSync'](path[_0x4b2a('0x3b')](config['root'],_0x4b2a('0x40')),_0x4b2a('0x46'));var _0x176292=ejs[_0x4b2a('0x41')](_0xd4c730,{'networks':_0x3104a6||[]});fs[_0x4b2a('0x3d')](_0x4b2a('0x4c'),_0x176292);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x18'),{'module':_0x4b2a('0x47')});}else{var _0x412346=fs[_0x4b2a('0x3a')](path[_0x4b2a('0x3b')](config[_0x4b2a('0x3f')],_0x4b2a('0x42')),_0x4b2a('0x46'));var _0x1d87fa=ejs['render'](_0x412346,{'networks':_0x3104a6||[]});fs[_0x4b2a('0x3d')](util[_0x4b2a('0x48')](_0x4b2a('0x43'),_0x1b52bc[_0x4b2a('0x20')][_0x4b2a('0x49')]()),_0x1d87fa);return respondWithRpcPromise(_0x4b2a('0x3e'),_0x4b2a('0x18'),{'module':'chan_sip.so'});}})[_0x4b2a('0xf')](handleError(_0x559fbb,null));}; \ No newline at end of file +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 diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e4d54b4..6edf2b9 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 _0x9aea=['Network','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x9aea,0xdd));var _0xa9ae=function(_0x34eca0,_0x1031c9){_0x34eca0=_0x34eca0-0x0;var _0x3d2386=_0x9aea[_0x34eca0];return _0x3d2386;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var logger=require(_0xa9ae('0x1'))('api');var moment=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ae('0x4'));var rimraf=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var attributes=require(_0xa9ae('0x7'));module[_0xa9ae('0x8')]=function(_0x56f942,_0x1aa3b9){return _0x56f942[_0xa9ae('0x9')](_0xa9ae('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index f9d7db2..be2d4d6 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x528a37,_0x4b3231){_0x528a37=_0x528a37-0x0;var _0x4c48a0=_0x7a54[_0x528a37];return _0x4c48a0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index fc4e7e0..c976484 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 _0xa52b=['/describe','isAuthenticated','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x302266,_0x24f2ab){var _0x44da47=function(_0x397077){while(--_0x397077){_0x302266['push'](_0x302266['shift']());}};_0x44da47(++_0x24f2ab);}(_0xa52b,0x179));var _0xba52=function(_0x487807,_0x270fe9){_0x487807=_0x487807-0x0;var _0x50701f=_0xa52b[_0x487807];return _0x50701f;};'use strict';var multer=require('multer');var util=require(_0xba52('0x0'));var path=require(_0xba52('0x1'));var timeout=require(_0xba52('0x2'));var express=require(_0xba52('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba52('0x4'));var interaction=require(_0xba52('0x5'));var config=require(_0xba52('0x6'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xba52('0x7')]);router['get'](_0xba52('0x8'),auth[_0xba52('0x9')](),controller[_0xba52('0xa')]);router[_0xba52('0xb')](_0xba52('0xc'),auth['isAuthenticated'](),controller[_0xba52('0xd')]);router['get'](_0xba52('0xe'),auth[_0xba52('0x9')](),controller[_0xba52('0xf')]);router['get'](_0xba52('0x10'),auth[_0xba52('0x9')](),controller[_0xba52('0x11')]);router['get'](_0xba52('0x12'),auth[_0xba52('0x9')](),controller['getApplications']);router[_0xba52('0xb')]('/:id/interactions',auth[_0xba52('0x9')](),controller[_0xba52('0x13')]);router[_0xba52('0xb')](_0xba52('0x14'),auth[_0xba52('0x9')](),controller[_0xba52('0x15')]);router[_0xba52('0x16')]('/',auth['isAuthenticated'](),controller[_0xba52('0x17')]);router[_0xba52('0x16')](_0xba52('0xe'),auth['isAuthenticated'](),controller[_0xba52('0x18')]);router[_0xba52('0x16')]('/:id/canned_answers',auth[_0xba52('0x9')](),controller[_0xba52('0x19')]);router['post']('/:id/notify',controller[_0xba52('0x1a')]);router[_0xba52('0x16')](_0xba52('0x12'),auth['isAuthenticated'](),controller[_0xba52('0x1b')]);router[_0xba52('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xba52('0x1c')]);router['post'](_0xba52('0x1d'),auth['isAuthenticated'](),controller['send']);router['put'](_0xba52('0xc'),auth[_0xba52('0x9')](),controller['update']);router[_0xba52('0x1e')](_0xba52('0xc'),auth[_0xba52('0x9')](),controller[_0xba52('0x1f')]);router[_0xba52('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xba52('0x20')]);router[_0xba52('0x1e')](_0xba52('0x10'),auth[_0xba52('0x9')](),controller[_0xba52('0x21')]);router['delete']('/:id/users',auth[_0xba52('0x9')](),controller[_0xba52('0x22')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 9092e7b..09fbe5f 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 _0xebe0=['randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x247e28,_0x4e1eb7){var _0x5579b0=function(_0x543655){while(--_0x543655){_0x247e28['push'](_0x247e28['shift']());}};_0x5579b0(++_0x4e1eb7);}(_0xebe0,0x152));var _0x0ebe=function(_0x2a3e77,_0x4c0d58){_0x2a3e77=_0x2a3e77-0x0;var _0x40ddac=_0xebe0[_0x2a3e77];return _0x40ddac;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0ebe('0x0'));module[_0x0ebe('0x1')]={'name':{'type':Sequelize[_0x0ebe('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0ebe('0x2')],'defaultValue':function(){return rs[_0x0ebe('0x3')]();}},'replyUri':{'type':Sequelize[_0x0ebe('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0ebe('0x4')],'defaultValue':function(){return _0x0ebe('0x5');}},'notificationSound':{'type':Sequelize[_0x0ebe('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0ebe('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0ebe('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0ebe('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x0ebe('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0ebe('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0ebe('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0ebe('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ebe('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x0ebe('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0ebe('0x6')],'defaultValue':![],'comment':_0x0ebe('0x9'),'set':function(_0x48d174){if(!_0x48d174)this[_0x0ebe('0xa')](_0x0ebe('0xb'),null);this[_0x0ebe('0xa')](_0x0ebe('0xc'),_0x48d174);}}}; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 62b9f13..87baa7a 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 _0x99a0=['nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','CmList','List','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit','getAgents','ListId','out','Messages','dataValues','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','params','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','addDisposition','OpenchannelAccountId','Disposition'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x99a0,0x121));var _0x099a=function(_0x1a895c,_0x49be85){_0x1a895c=_0x1a895c-0x0;var _0x561647=_0x99a0[_0x1a895c];return _0x561647;};'use strict';var emlformat=require(_0x099a('0x0'));var rimraf=require(_0x099a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x099a('0x2'));var Mustache=require(_0x099a('0x3'));var util=require('util');var path=require(_0x099a('0x4'));var sox=require(_0x099a('0x5'));var csv=require(_0x099a('0x6'));var ejs=require(_0x099a('0x7'));var fs=require('fs');var fs_extra=require(_0x099a('0x8'));var _=require(_0x099a('0x9'));var squel=require('squel');var crypto=require(_0x099a('0xa'));var jsforce=require(_0x099a('0xb'));var deskjs=require(_0x099a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x099a('0xd'));var Papa=require(_0x099a('0xe'));var Redis=require(_0x099a('0xf'));var authService=require(_0x099a('0x10'));var qs=require(_0x099a('0x11'));var as=require(_0x099a('0x12'));var hardwareService=require(_0x099a('0x13'));var logger=require(_0x099a('0x14'))(_0x099a('0x15'));var utils=require(_0x099a('0x16'));var config=require(_0x099a('0x17'));var licenseUtil=require(_0x099a('0x18'));var db=require(_0x099a('0x19'))['db'];config[_0x099a('0x1a')]=_[_0x099a('0x1b')](config['redis'],{'host':_0x099a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x099a('0x1a')]));require('./openchannelAccount.socket')[_0x099a('0x1d')](socket);var jayson=require(_0x099a('0x1e'));var client=jayson[_0x099a('0x1f')][_0x099a('0x20')]({'port':0x232c});var client9002=jayson[_0x099a('0x1f')][_0x099a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5086d8,_0x443eea,_0x88c471,_0x452a34){return new BPromise(function(_0x371af7,_0x5d7b21){var _0x2831a2=_0x452a34||client;return _0x2831a2['request'](_0x5086d8,_0x88c471)[_0x099a('0x21')](function(_0x26bf41){logger[_0x099a('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x443eea,_0x099a('0x23'));logger[_0x099a('0x24')](_0x099a('0x25'),_0x443eea,_0x099a('0x23'),JSON[_0x099a('0x26')](_0x26bf41));if(_0x26bf41['error']){if(_0x26bf41['error'][_0x099a('0x27')]===0x1f4){logger[_0x099a('0x28')](_0x099a('0x29'),_0x443eea,_0x26bf41[_0x099a('0x28')][_0x099a('0x2a')]);return _0x5d7b21(_0x26bf41[_0x099a('0x28')][_0x099a('0x2a')]);}logger[_0x099a('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x443eea,_0x26bf41['error'][_0x099a('0x2a')]);return _0x371af7(_0x26bf41[_0x099a('0x28')][_0x099a('0x2a')]);}else{logger[_0x099a('0x22')](_0x099a('0x29'),_0x443eea,_0x099a('0x23'));_0x371af7(_0x26bf41[_0x099a('0x2b')][_0x099a('0x2a')]);}})[_0x099a('0x2c')](function(_0x42ee18){logger[_0x099a('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x443eea,_0x42ee18);_0x5d7b21(_0x42ee18);});});}function respondWithStatusCode(_0x422c3c,_0x5e316b){_0x5e316b=_0x5e316b||0xcc;return function(_0x2a5417){if(_0x2a5417){return _0x422c3c[_0x099a('0x2d')](_0x5e316b);}return _0x422c3c[_0x099a('0x2e')](_0x5e316b)['end']();};}function respondWithResult(_0x320d29,_0x1101aa){_0x1101aa=_0x1101aa||0xc8;return function(_0x1a51ec){if(_0x1a51ec){return _0x320d29['status'](_0x1101aa)['json'](_0x1a51ec);}};}function respondWithFilteredResult(_0x560fdb,_0x2b1597){return function(_0x1938d0){if(_0x1938d0){var _0x4a1663=typeof _0x2b1597[_0x099a('0x2f')]===_0x099a('0x30')&&typeof _0x2b1597[_0x099a('0x31')]===_0x099a('0x30');var _0x462c0d=_0x1938d0[_0x099a('0x32')];var _0x57d1f3=_0x4a1663?0x0:_0x2b1597[_0x099a('0x2f')];var _0x406232=_0x4a1663?_0x1938d0[_0x099a('0x32')]:_0x2b1597[_0x099a('0x2f')]+_0x2b1597[_0x099a('0x31')];var _0x160b38;if(_0x406232>=_0x462c0d){_0x406232=_0x462c0d;_0x160b38=0xc8;}else{_0x160b38=0xce;}_0x560fdb[_0x099a('0x2e')](_0x160b38);return _0x560fdb[_0x099a('0x33')]('Content-Range',_0x57d1f3+'-'+_0x406232+'/'+_0x462c0d)[_0x099a('0x34')](_0x1938d0);}return null;};}function patchUpdates(_0x33f8a5){return function(_0x151548){try{jsonpatch[_0x099a('0x35')](_0x151548,_0x33f8a5,!![]);}catch(_0x23564a){return BPromise[_0x099a('0x36')](_0x23564a);}return _0x151548['save']();};}function saveUpdates(_0x448a72,_0x47ce62){return function(_0x1751da){if(_0x1751da){return _0x1751da[_0x099a('0x37')](_0x448a72)['then'](function(_0x7a5837){return _0x7a5837;});}return null;};}function removeEntity(_0x122e96,_0x447181){return function(_0x2668de){if(_0x2668de){return _0x2668de[_0x099a('0x38')]()['then'](function(){var _0x399b52=_0x2668de[_0x099a('0x39')]({'plain':!![]});var _0x4a2fae=_0x099a('0x3a');return db[_0x099a('0x3b')][_0x099a('0x38')]({'where':{'type':_0x4a2fae,'resourceId':_0x399b52['id']}})['then'](function(){return _0x2668de;});})[_0x099a('0x21')](function(){_0x122e96[_0x099a('0x2e')](0xcc)[_0x099a('0x3c')]();});}};}function handleEntityNotFound(_0x391144,_0x34eff2){return function(_0xb9c7c){if(!_0xb9c7c){_0x391144['sendStatus'](0x194);}return _0xb9c7c;};}function handleError(_0x45421c,_0x4a9cc0){_0x4a9cc0=_0x4a9cc0||0x1f4;return function(_0x2dd733){logger[_0x099a('0x28')](_0x2dd733['stack']);if(_0x2dd733[_0x099a('0x3d')]){delete _0x2dd733[_0x099a('0x3d')];}_0x45421c[_0x099a('0x2e')](_0x4a9cc0)[_0x099a('0x3e')](_0x2dd733);};}exports[_0x099a('0x3f')]=function(_0x2911cf,_0x1386cb){var _0x218108={'include':[{'model':db[_0x099a('0x40')],'as':_0x099a('0x41')}]},_0x20f83d={},_0x492f2b={'count':0x0,'rows':[]};var _0x2efb31=_[_0x099a('0x42')](db[_0x099a('0x43')][_0x099a('0x44')],function(_0x51fa9d){return{'name':_0x51fa9d['fieldName'],'type':_0x51fa9d[_0x099a('0x45')][_0x099a('0x46')]};});_0x20f83d['model']=_[_0x099a('0x42')](_0x2efb31,'name');_0x20f83d[_0x099a('0x47')]=_[_0x099a('0x48')](_0x2911cf[_0x099a('0x47')]);_0x20f83d[_0x099a('0x49')]=_[_0x099a('0x4a')](_0x20f83d[_0x099a('0x4b')],_0x20f83d[_0x099a('0x47')]);_0x218108[_0x099a('0x4c')]=_['intersection'](_0x20f83d[_0x099a('0x4b')],qs['fields'](_0x2911cf[_0x099a('0x47')]['fields']));_0x218108[_0x099a('0x4c')]=_0x218108[_0x099a('0x4c')][_0x099a('0x4d')]?_0x218108[_0x099a('0x4c')]:_0x20f83d['model'];if(!_0x2911cf[_0x099a('0x47')][_0x099a('0x4e')]('nolimit')){_0x218108[_0x099a('0x31')]=qs['limit'](_0x2911cf[_0x099a('0x47')][_0x099a('0x31')]);_0x218108[_0x099a('0x2f')]=qs[_0x099a('0x2f')](_0x2911cf[_0x099a('0x47')][_0x099a('0x2f')]);}_0x218108[_0x099a('0x4f')]=qs[_0x099a('0x50')](_0x2911cf['query'][_0x099a('0x50')]);_0x218108['where']=qs[_0x099a('0x49')](_[_0x099a('0x51')](_0x2911cf[_0x099a('0x47')],_0x20f83d[_0x099a('0x49')]),_0x2efb31);if(_0x2911cf[_0x099a('0x47')][_0x099a('0x52')]){_0x218108[_0x099a('0x53')]=_['merge'](_0x218108[_0x099a('0x53')],{'$or':_[_0x099a('0x42')](_0x2efb31,function(_0x5d6fd8){if(_0x5d6fd8[_0x099a('0x45')]!==_0x099a('0x54')){var _0x2b5aae={};_0x2b5aae[_0x5d6fd8['name']]={'$like':'%'+_0x2911cf[_0x099a('0x47')][_0x099a('0x52')]+'%'};return _0x2b5aae;}})});}_0x218108=_[_0x099a('0x55')]({},_0x218108,_0x2911cf[_0x099a('0x56')]);var _0x503d44={'where':_0x218108[_0x099a('0x53')]};return db['OpenchannelAccount'][_0x099a('0x32')](_0x503d44)[_0x099a('0x21')](function(_0x4c379b){_0x492f2b['count']=_0x4c379b;if(_0x2911cf[_0x099a('0x47')][_0x099a('0x57')]){_0x218108[_0x099a('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x099a('0x59')](_0x218108);})[_0x099a('0x21')](function(_0x2b956d){_0x492f2b['rows']=_0x2b956d;return _0x492f2b;})[_0x099a('0x21')](respondWithFilteredResult(_0x1386cb,_0x218108))['catch'](handleError(_0x1386cb,null));};exports['show']=function(_0x44c701,_0x52c19b){var _0x4e90ab={'raw':![],'where':{'id':_0x44c701[_0x099a('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x099a('0x41')}]},_0x16ad33={};_0x16ad33[_0x099a('0x4b')]=_[_0x099a('0x48')](db['OpenchannelAccount'][_0x099a('0x44')]);_0x16ad33[_0x099a('0x47')]=_[_0x099a('0x48')](_0x44c701['query']);_0x16ad33[_0x099a('0x49')]=_[_0x099a('0x4a')](_0x16ad33[_0x099a('0x4b')],_0x16ad33[_0x099a('0x47')]);_0x4e90ab[_0x099a('0x4c')]=_[_0x099a('0x4a')](_0x16ad33[_0x099a('0x4b')],qs[_0x099a('0x5b')](_0x44c701[_0x099a('0x47')]['fields']));_0x4e90ab[_0x099a('0x4c')]=_0x4e90ab[_0x099a('0x4c')][_0x099a('0x4d')]?_0x4e90ab['attributes']:_0x16ad33[_0x099a('0x4b')];if(_0x44c701['query'][_0x099a('0x57')]){_0x4e90ab['include']=[{'all':!![]}];}_0x4e90ab=_[_0x099a('0x55')]({},_0x4e90ab,_0x44c701['options']);return db[_0x099a('0x43')]['find'](_0x4e90ab)[_0x099a('0x21')](handleEntityNotFound(_0x52c19b,null))[_0x099a('0x21')](respondWithResult(_0x52c19b,null))[_0x099a('0x2c')](handleError(_0x52c19b,null));};exports[_0x099a('0x5c')]=function(_0x14c602,_0xb0cb6e){return db[_0x099a('0x43')][_0x099a('0x5c')](_0x14c602['body'],{})[_0x099a('0x21')](function(_0x1f3c3b){var _0x262ee0=_0x14c602[_0x099a('0x5d')][_0x099a('0x39')]({'plain':!![]});if(!_0x262ee0)throw new Error(_0x099a('0x5e'));if(_0x262ee0[_0x099a('0x5f')]===_0x099a('0x5d')){var _0x1a21d4=_0x1f3c3b['get']({'plain':!![]});var _0x1c8589=_0x099a('0x3a');return db[_0x099a('0x60')]['find']({'where':{'name':_0x1c8589,'userProfileId':_0x262ee0['userProfileId']},'raw':!![]})['then'](function(_0x1fbe33){if(_0x1fbe33&&_0x1fbe33[_0x099a('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a21d4[_0x099a('0x3d')],'resourceId':_0x1a21d4['id'],'type':_0x1fbe33['name'],'sectionId':_0x1fbe33['id']},{})[_0x099a('0x21')](function(){return _0x1f3c3b;});}else{return _0x1f3c3b;}})['catch'](function(_0x1caa4f){logger[_0x099a('0x28')](_0x099a('0x62'),_0x1caa4f);throw _0x1caa4f;});}return _0x1f3c3b;})[_0x099a('0x21')](respondWithResult(_0xb0cb6e,0xc9))['catch'](handleError(_0xb0cb6e,null));};exports[_0x099a('0x37')]=function(_0x2fd006,_0x223b9d){if(_0x2fd006[_0x099a('0x63')]['id']){delete _0x2fd006[_0x099a('0x63')]['id'];}return db[_0x099a('0x43')]['find']({'where':{'id':_0x2fd006['params']['id']},'include':[{'model':db[_0x099a('0x40')],'as':_0x099a('0x41')}]})[_0x099a('0x21')](handleEntityNotFound(_0x223b9d,null))[_0x099a('0x21')](saveUpdates(_0x2fd006['body'],null))[_0x099a('0x21')](respondWithResult(_0x223b9d,null))[_0x099a('0x2c')](handleError(_0x223b9d,null));};exports['destroy']=function(_0x420a02,_0x24129d){return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x420a02[_0x099a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x24129d,null))[_0x099a('0x21')](removeEntity(_0x24129d,null))[_0x099a('0x2c')](handleError(_0x24129d,null));};exports['describe']=function(_0x2deae8,_0x128916){return db[_0x099a('0x43')][_0x099a('0x65')]()[_0x099a('0x21')](respondWithResult(_0x128916,null))[_0x099a('0x2c')](handleError(_0x128916,null));};exports[_0x099a('0x66')]=function(_0x4ae914,_0x35412f,_0x2f97e5){if(_0x4ae914[_0x099a('0x63')]['id']){delete _0x4ae914[_0x099a('0x63')]['id'];}return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x4ae914[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x35412f,null))[_0x099a('0x21')](function(_0x327d30){if(_0x327d30){_0x4ae914[_0x099a('0x63')][_0x099a('0x67')]=_0x327d30['id'];return db[_0x099a('0x68')]['create'](_0x4ae914[_0x099a('0x63')]);}})[_0x099a('0x21')](respondWithResult(_0x35412f,null))['catch'](handleError(_0x35412f,null));};exports['getDispositions']=function(_0x272a64,_0x14b4c7,_0x2d4eb1){var _0x8c98fa={'raw':![],'where':{}};var _0x2bcf8e={};var _0xd91e49={'count':0x0,'rows':[]};return db[_0x099a('0x43')]['findOne']({'where':{'id':_0x272a64[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x14b4c7,null))[_0x099a('0x21')](function(_0x1fdc4e){if(_0x1fdc4e){_0x2bcf8e[_0x099a('0x4b')]=_['keys'](db[_0x099a('0x68')][_0x099a('0x44')]);_0x2bcf8e[_0x099a('0x47')]=_[_0x099a('0x48')](_0x272a64[_0x099a('0x47')]);_0x2bcf8e[_0x099a('0x49')]=_['intersection'](_0x2bcf8e[_0x099a('0x4b')],_0x2bcf8e[_0x099a('0x47')]);_0x8c98fa['attributes']=_[_0x099a('0x4a')](_0x2bcf8e['model'],qs['fields'](_0x272a64[_0x099a('0x47')][_0x099a('0x5b')]));_0x8c98fa[_0x099a('0x4c')]=_0x8c98fa[_0x099a('0x4c')][_0x099a('0x4d')]?_0x8c98fa[_0x099a('0x4c')]:_0x2bcf8e[_0x099a('0x4b')];if(!_0x272a64['query'][_0x099a('0x4e')](_0x099a('0x69'))){_0x8c98fa[_0x099a('0x31')]=qs[_0x099a('0x31')](_0x272a64['query'][_0x099a('0x31')]);_0x8c98fa[_0x099a('0x2f')]=qs[_0x099a('0x2f')](_0x272a64[_0x099a('0x47')]['offset']);}_0x8c98fa[_0x099a('0x4f')]=qs[_0x099a('0x50')](_0x272a64[_0x099a('0x47')]['sort']);_0x8c98fa[_0x099a('0x53')]=qs['filters'](_[_0x099a('0x51')](_0x272a64['query'],_0x2bcf8e[_0x099a('0x49')]));_0x8c98fa[_0x099a('0x53')][_0x099a('0x67')]=_0x1fdc4e['id'];if(_0x272a64[_0x099a('0x47')][_0x099a('0x52')]){_0x8c98fa[_0x099a('0x53')]=_[_0x099a('0x55')](_0x8c98fa[_0x099a('0x53')],{'$or':_[_0x099a('0x42')](_0x8c98fa[_0x099a('0x4c')],function(_0x4c5d1c){var _0x3b1e57={};_0x3b1e57[_0x4c5d1c]={'$like':'%'+_0x272a64[_0x099a('0x47')][_0x099a('0x52')]+'%'};return _0x3b1e57;})});}_0x8c98fa=_[_0x099a('0x55')]({},_0x8c98fa,_0x272a64['options']);return db['Disposition'][_0x099a('0x32')]({'where':_0x8c98fa[_0x099a('0x53')]})['then'](function(_0x52bef4){_0xd91e49[_0x099a('0x32')]=_0x52bef4;if(_0x272a64['query'][_0x099a('0x57')]){_0x8c98fa[_0x099a('0x58')]=[{'all':!![]}];}return db[_0x099a('0x68')]['findAll'](_0x8c98fa);})['then'](function(_0x4a35fa){_0xd91e49[_0x099a('0x6a')]=_0x4a35fa;return _0xd91e49;});}})[_0x099a('0x21')](respondWithFilteredResult(_0x14b4c7,_0x8c98fa))['catch'](handleError(_0x14b4c7,null));};exports[_0x099a('0x6b')]=function(_0x31950d,_0x5b450f,_0x3b0021){return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x31950d[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x5b450f,null))[_0x099a('0x21')](function(_0xb92168){if(_0xb92168){return _0xb92168[_0x099a('0x6b')](_0x31950d['query'][_0x099a('0x6c')]);}})['then'](respondWithStatusCode(_0x5b450f,null))['catch'](handleError(_0x5b450f,null));};exports[_0x099a('0x6d')]=function(_0x5eb5b5,_0x37c2b2,_0x4aa774){if(_0x5eb5b5[_0x099a('0x63')]['id']){delete _0x5eb5b5[_0x099a('0x63')]['id'];}return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x5eb5b5[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x37c2b2,null))[_0x099a('0x21')](function(_0x579bb3){if(_0x579bb3){_0x5eb5b5[_0x099a('0x63')]['OpenchannelAccountId']=_0x579bb3['id'];return db[_0x099a('0x6e')][_0x099a('0x5c')](_0x5eb5b5[_0x099a('0x63')]);}})['then'](respondWithResult(_0x37c2b2,null))[_0x099a('0x2c')](handleError(_0x37c2b2,null));};exports[_0x099a('0x6f')]=function(_0x3d0fa7,_0x349b8a,_0x46e7ce){var _0xe56414={'raw':![],'where':{}};var _0x3a832f={};var _0x3d2298={'count':0x0,'rows':[]};return db[_0x099a('0x43')][_0x099a('0x70')]({'where':{'id':_0x3d0fa7[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x349b8a,null))[_0x099a('0x21')](function(_0xb937f6){if(_0xb937f6){_0x3a832f['model']=_['keys'](db[_0x099a('0x6e')][_0x099a('0x44')]);_0x3a832f[_0x099a('0x47')]=_[_0x099a('0x48')](_0x3d0fa7['query']);_0x3a832f['filters']=_[_0x099a('0x4a')](_0x3a832f[_0x099a('0x4b')],_0x3a832f[_0x099a('0x47')]);_0xe56414['attributes']=_[_0x099a('0x4a')](_0x3a832f[_0x099a('0x4b')],qs[_0x099a('0x5b')](_0x3d0fa7[_0x099a('0x47')][_0x099a('0x5b')]));_0xe56414[_0x099a('0x4c')]=_0xe56414[_0x099a('0x4c')][_0x099a('0x4d')]?_0xe56414[_0x099a('0x4c')]:_0x3a832f[_0x099a('0x4b')];if(!_0x3d0fa7['query']['hasOwnProperty'](_0x099a('0x69'))){_0xe56414[_0x099a('0x31')]=qs[_0x099a('0x31')](_0x3d0fa7['query']['limit']);_0xe56414[_0x099a('0x2f')]=qs[_0x099a('0x2f')](_0x3d0fa7[_0x099a('0x47')][_0x099a('0x2f')]);}_0xe56414['order']=qs[_0x099a('0x50')](_0x3d0fa7[_0x099a('0x47')][_0x099a('0x50')]);_0xe56414[_0x099a('0x53')]=qs[_0x099a('0x49')](_[_0x099a('0x51')](_0x3d0fa7[_0x099a('0x47')],_0x3a832f[_0x099a('0x49')]));_0xe56414[_0x099a('0x53')][_0x099a('0x67')]=_0xb937f6['id'];if(_0x3d0fa7[_0x099a('0x47')][_0x099a('0x52')]){_0xe56414['where']=_['merge'](_0xe56414[_0x099a('0x53')],{'$or':_[_0x099a('0x42')](_0xe56414[_0x099a('0x4c')],function(_0x48564b){var _0x1d8fce={};_0x1d8fce[_0x48564b]={'$like':'%'+_0x3d0fa7[_0x099a('0x47')][_0x099a('0x52')]+'%'};return _0x1d8fce;})});}_0xe56414=_[_0x099a('0x55')]({},_0xe56414,_0x3d0fa7[_0x099a('0x56')]);return db[_0x099a('0x6e')]['count']({'where':_0xe56414[_0x099a('0x53')]})['then'](function(_0x163d3e){_0x3d2298[_0x099a('0x32')]=_0x163d3e;if(_0x3d0fa7[_0x099a('0x47')][_0x099a('0x57')]){_0xe56414['include']=[{'all':!![]}];}return db[_0x099a('0x6e')][_0x099a('0x59')](_0xe56414);})[_0x099a('0x21')](function(_0x53f919){_0x3d2298[_0x099a('0x6a')]=_0x53f919;return _0x3d2298;});}})[_0x099a('0x21')](respondWithFilteredResult(_0x349b8a,_0xe56414))[_0x099a('0x2c')](handleError(_0x349b8a,null));};exports[_0x099a('0x71')]=function(_0x2508eb,_0x15411b,_0x456f80){return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x2508eb[_0x099a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x15411b,null))[_0x099a('0x21')](function(_0x1a91bc){if(_0x1a91bc){return _0x1a91bc[_0x099a('0x71')](_0x2508eb[_0x099a('0x47')][_0x099a('0x6c')]);}})[_0x099a('0x21')](respondWithStatusCode(_0x15411b,null))[_0x099a('0x2c')](handleError(_0x15411b,null));};exports[_0x099a('0x72')]=function(_0x48bc7c,_0x12a89a,_0xf0e6b7){var _0x53856f={'body':_0x48bc7c[_0x099a('0x63')],'channel':_0x099a('0x73')};var _0x94d5af=[];var _0x17f0dd=[];var _0x4e02e1={};var _0x2fb081=![];return db[_0x099a('0x74')][_0x099a('0x65')]()[_0x099a('0x21')](function(_0x27b156){if(!_0x27b156){throw new db[(_0x099a('0x75'))][(_0x099a('0x76'))](_0x099a('0x77'));}_0x94d5af=_[_0x099a('0x78')](_[_0x099a('0x48')](_0x27b156),[_0x099a('0x79'),_0x099a('0x7a')]);_0x17f0dd=_[_0x099a('0x78')](_[_0x099a('0x48')](_0x27b156),['createdAt','updatedAt',_0x099a('0x7b'),'ListId']);if(_0x48bc7c[_0x099a('0x63')]['id']){delete _0x48bc7c[_0x099a('0x63')]['id'];}if(_[_0x099a('0x7c')](_0x48bc7c[_0x099a('0x63')]['from'])){throw new db[(_0x099a('0x75'))]['ValidationError'](_0x099a('0x7d'));}if(_['isNil'](_0x48bc7c[_0x099a('0x63')]['body'])||_0x48bc7c[_0x099a('0x63')][_0x099a('0x63')]===''){throw new db[(_0x099a('0x75'))]['ValidationError'](_0x099a('0x7e'));}if(_[_0x099a('0x7c')](_0x48bc7c[_0x099a('0x63')][_0x099a('0x7f')])){throw new db[(_0x099a('0x75'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17f0dd);}if(!_[_0x099a('0x80')](_0x17f0dd,_0x48bc7c[_0x099a('0x63')][_0x099a('0x7f')])){throw new db[(_0x099a('0x75'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17f0dd);}_0x4e02e1[_0x48bc7c['body'][_0x099a('0x7f')]]=_0x48bc7c[_0x099a('0x63')][_0x099a('0x81')];})[_0x099a('0x21')](function(){return db['OpenchannelAccount'][_0x099a('0x64')]({'where':{'id':_0x48bc7c[_0x099a('0x5a')]['id']},'include':[{'model':db[_0x099a('0x82')],'as':_0x099a('0x83'),'include':[{'model':db[_0x099a('0x74')],'as':'Contacts','where':_0x4e02e1,'limit':0x1,'order':[[_0x099a('0x7a'),_0x099a('0x84')]]}]},{'model':db[_0x099a('0x85')],'as':_0x099a('0x86')}]});})[_0x099a('0x21')](handleEntityNotFound(_0x12a89a,null))[_0x099a('0x21')](function(_0x57c88a){if(_0x57c88a&&_0x57c88a[_0x099a('0x83')]){_0x53856f[_0x099a('0x87')]=_0x57c88a;_0x53856f[_0x099a('0x88')]=_0x57c88a['Applications'];_0x53856f[_0x099a('0x89')]=_0x57c88a[_0x099a('0x83')];_0x53856f[_0x099a('0x88')]=_['orderBy'](_0x53856f[_0x099a('0x88')],[_0x099a('0x8a')],[_0x099a('0x8b')]);if(_0x53856f[_0x099a('0x87')][_0x099a('0x86')]){delete _0x53856f[_0x099a('0x87')][_0x099a('0x86')];}if(_0x53856f[_0x099a('0x87')][_0x099a('0x83')]&&_0x53856f[_0x099a('0x87')][_0x099a('0x83')][_0x099a('0x8c')]['length']){return _0x53856f[_0x099a('0x87')][_0x099a('0x83')][_0x099a('0x8c')][0x0];}var _0x4545ee=_[_0x099a('0x1b')](_0x48bc7c['body'],{'firstName':_0x48bc7c[_0x099a('0x63')]['from'],'ListId':_0x57c88a['ListId']});_0x4545ee[_0x48bc7c[_0x099a('0x63')][_0x099a('0x7f')]]=_0x48bc7c[_0x099a('0x63')][_0x099a('0x81')];return db[_0x099a('0x74')][_0x099a('0x5c')](_0x4545ee,{'fields':_0x94d5af,'raw':!![]});}})[_0x099a('0x21')](handleEntityNotFound(_0x12a89a,null))[_0x099a('0x21')](function(_0x97ba3){_0x53856f[_0x099a('0x8d')]=_0x97ba3;if(_0x97ba3){var _0x474163={'ContactId':_0x97ba3['id'],'OpenchannelAccountId':_0x48bc7c['params']['id'],'from':(_0x97ba3[_0x099a('0x8e')]||'')+'\x20'+(_0x97ba3[_0x099a('0x8f')]||'')};var _0x3ab6ea={'OpenchannelAccountId':_0x48bc7c[_0x099a('0x5a')]['id'],'closed':![]};if(_0x48bc7c[_0x099a('0x63')][_0x099a('0x90')]){_0x3ab6ea[_0x099a('0x90')]=_0x48bc7c['body'][_0x099a('0x90')];return db[_0x099a('0x91')][_0x099a('0x64')]({'where':_0x3ab6ea})[_0x099a('0x21')](function(_0x512877){if(_0x512877){return[_0x512877,![]];}_0x474163[_0x099a('0x90')]=_0x48bc7c[_0x099a('0x63')][_0x099a('0x90')];_0x474163['externalUrl']=_0x48bc7c[_0x099a('0x63')][_0x099a('0x92')];return db[_0x099a('0x91')]['create'](_0x474163)[_0x099a('0x21')](function(_0x572cdc){return[_0x572cdc,!![]];});});}else{_0x3ab6ea[_0x099a('0x90')]=null;}_0x3ab6ea['ContactId']=_0x97ba3['id'];return db[_0x099a('0x91')][_0x099a('0x64')]({'where':_0x3ab6ea})['then'](function(_0x321b1d){if(_0x321b1d){return[_0x321b1d,![]];}return db[_0x099a('0x91')][_0x099a('0x5c')](_0x474163)[_0x099a('0x21')](function(_0x198480){return[_0x198480,!![]];});});}})[_0x099a('0x93')](function(_0x1b5c2b,_0x2eaf92){if(_0x1b5c2b){_0x2fb081=_0x2eaf92;if(!_0x2eaf92){var _0x14f8df={'from':(_0x53856f['contact']['firstName']||'')+'\x20'+(_0x53856f[_0x099a('0x8d')]['lastName']||'')};if(_0x48bc7c[_0x099a('0x63')][_0x099a('0x90')]&&_0x48bc7c[_0x099a('0x63')][_0x099a('0x94')]&&_0x48bc7c[_0x099a('0x63')][_0x099a('0x90')]!=_0x48bc7c[_0x099a('0x63')]['messageId']){_0x14f8df[_0x099a('0x90')]=_0x48bc7c['body']['messageId'];}return _0x1b5c2b[_0x099a('0x37')](_0x14f8df);}else{return _0x1b5c2b;}}})[_0x099a('0x21')](function(_0x49e6ce){_0x53856f['interaction']=_0x49e6ce[_0x099a('0x39')]({'plain':!![]});_0x53856f[_0x099a('0x95')][_0x099a('0x96')]=_0x2fb081;if(_0x53856f['interaction'][_0x099a('0x96')]){if(_0x53856f[_0x099a('0x87')][_0x099a('0x97')]){_0x53856f[_0x099a('0x88')][_0x099a('0x98')]({'id':0x0,'priority':_0x53856f['applications'][_0x099a('0x4d')]+0x1,'app':_0x099a('0x99'),'appdata':_0x099a('0x9a'),'interval':_0x099a('0x9b')});}}return db[_0x099a('0x9c')][_0x099a('0x5c')]({'body':_0x48bc7c['body'][_0x099a('0x63')],'OpenchannelAccountId':_0x48bc7c[_0x099a('0x5a')]['id'],'OpenchannelInteractionId':_0x49e6ce['id'],'direction':'in','ContactId':_0x53856f[_0x099a('0x8d')]['id'],'AttachmentId':_0x48bc7c[_0x099a('0x63')][_0x099a('0x9d')]});})['then'](function(_0x5c073d){_0x53856f[_0x099a('0x2a')]=_0x5c073d;if(!_0x53856f['interaction'][_0x099a('0x9e')])return;return db[_0x099a('0x9f')][_0x099a('0x64')]({'attributes':['id','name'],'where':{'id':_0x53856f['interaction'][_0x099a('0x9e')]}});})[_0x099a('0x21')](function(_0x4d6477){if(_0x4d6477){_0x53856f['applications'][_0x099a('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4d6477[_0x099a('0x3d')]+','+(_0x53856f[_0x099a('0x87')][_0x099a('0xa1')]||0xa),'interval':_0x099a('0x9b')});}if(!_0x53856f[_0x099a('0x95')][_0x099a('0xa2')])return;return db[_0x099a('0xa3')][_0x099a('0x64')]({'attributes':['id',_0x099a('0x3d')],'where':{'id':_0x53856f['interaction']['queueId']}});})[_0x099a('0x21')](function(_0x571547){if(_0x571547){_0x53856f[_0x099a('0x88')][_0x099a('0xa0')]({'id':0x0,'priority':0x1,'app':_0x099a('0xa4'),'appdata':_0x571547[_0x099a('0x3d')]+','+(_0x53856f['account'][_0x099a('0xa5')]||0x12c),'interval':_0x099a('0x9b')});}return respondWithRpcPromise(_0x099a('0xa6'),_0x099a('0xa7'),_0x53856f);})[_0x099a('0x21')](function(_0x16c7e3){respondWithRpcPromise(_0x099a('0xa8'),'EventManager',{'event':'notify','message':_0x16c7e3},client9002);return _0x16c7e3;})[_0x099a('0x21')](respondWithResult(_0x12a89a,null))[_0x099a('0x2c')](handleError(_0x12a89a,null));};exports[_0x099a('0xa9')]=function(_0x1b97d8,_0x1134a7){var _0x2af64c=_0x1b97d8['params']['id'];var _0x1382c6=_0x1b97d8[_0x099a('0x63')];var _0x20d96c=0xc8;var _0x4afa7f=null;return db[_0x099a('0xaa')][_0x099a('0xab')]({'isolationLevel':db[_0x099a('0xaa')][_0x099a('0xac')][_0x099a('0xad')]['READ_COMMITTED']},function(_0x42fbd5){return db[_0x099a('0x43')][_0x099a('0x70')]({'where':{'id':_0x2af64c},'transaction':_0x42fbd5})[_0x099a('0x21')](function(_0x2903c3){if(_0x2903c3){return db[_0x099a('0x85')][_0x099a('0x38')]({'where':{'OpenchannelAccountId':_0x2af64c},'transaction':_0x42fbd5})[_0x099a('0x21')](function(){var _0x3ea435=_['map'](_0x1382c6,function(_0x51d3bb){_0x51d3bb[_0x099a('0x67')]=_0x2af64c;return _0x51d3bb;});return db[_0x099a('0x85')][_0x099a('0xae')](_0x3ea435,{'transaction':_0x42fbd5});});}else{_0x20d96c=0x194;_0x4afa7f=[];}});})[_0x099a('0x21')](function(){if(_0x20d96c!==0x194){return db[_0x099a('0x85')][_0x099a('0xaf')]({'where':{'OpenchannelAccountId':_0x2af64c},'order':'priority'})[_0x099a('0x21')](function(_0x41f411){_0x4afa7f=_0x41f411;});}})[_0x099a('0x2c')](function(_0x2164d9){_0x20d96c=0x1f4;logger[_0x099a('0x28')](_0x2164d9[_0x099a('0xb0')]);if(_0x2164d9[_0x099a('0x3d')]){delete _0x2164d9['name'];}_0x4afa7f=_0x2164d9;})[_0x099a('0xb1')](function(){if(_0x4afa7f===null){_0x1134a7[_0x099a('0x2d')](_0x20d96c);}else{if(_0x20d96c===0x1f4){_0x1134a7[_0x099a('0x2e')](_0x20d96c)[_0x099a('0x3e')](_0x4afa7f);}else{_0x1134a7[_0x099a('0x2e')](_0x20d96c)[_0x099a('0x34')](_0x4afa7f);}}});};exports[_0x099a('0xb2')]=function(_0x224334,_0x12a63f,_0x449ea5){var _0x5a3005={};var _0x5489e9={};var _0x34e985;var _0x4e4f80;return db[_0x099a('0x43')][_0x099a('0x70')]({'where':{'id':_0x224334[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x12a63f,null))[_0x099a('0x21')](function(_0x435680){if(_0x435680){_0x34e985=_0x435680;_0x5489e9[_0x099a('0x4b')]=_[_0x099a('0x48')](db[_0x099a('0x85')][_0x099a('0x44')]);_0x5489e9['query']=_[_0x099a('0x48')](_0x224334[_0x099a('0x47')]);_0x5489e9[_0x099a('0x49')]=_['intersection'](_0x5489e9[_0x099a('0x4b')],_0x5489e9[_0x099a('0x47')]);_0x5a3005['attributes']=_['intersection'](_0x5489e9[_0x099a('0x4b')],qs['fields'](_0x224334[_0x099a('0x47')][_0x099a('0x5b')]));_0x5a3005[_0x099a('0x4c')]=_0x5a3005[_0x099a('0x4c')][_0x099a('0x4d')]?_0x5a3005[_0x099a('0x4c')]:_0x5489e9['model'];_0x5a3005[_0x099a('0x4f')]=qs[_0x099a('0x50')](_0x224334['query'][_0x099a('0x50')]);_0x5a3005['where']=qs[_0x099a('0x49')](_[_0x099a('0x51')](_0x224334[_0x099a('0x47')],_0x5489e9[_0x099a('0x49')]));if(_0x224334[_0x099a('0x47')][_0x099a('0x52')]){_0x5a3005[_0x099a('0x53')]=_[_0x099a('0x55')](_0x5a3005['where'],{'$or':_[_0x099a('0x42')](_0x5a3005[_0x099a('0x4c')],function(_0x2aac26){var _0x5d21f6={};_0x5d21f6[_0x2aac26]={'$like':'%'+_0x224334[_0x099a('0x47')][_0x099a('0x52')]+'%'};return _0x5d21f6;})});}_0x5a3005=_[_0x099a('0x55')]({},_0x5a3005,_0x224334[_0x099a('0x56')]);return _0x34e985[_0x099a('0xb2')](_0x5a3005);}})[_0x099a('0x21')](function(_0x21018c){if(_0x21018c){_0x4e4f80=_0x21018c[_0x099a('0x4d')];if(!_0x224334['query'][_0x099a('0x4e')]('nolimit')){_0x5a3005[_0x099a('0x31')]=qs[_0x099a('0x31')](_0x224334[_0x099a('0x47')][_0x099a('0x31')]);_0x5a3005['offset']=qs['offset'](_0x224334['query'][_0x099a('0x2f')]);}return _0x34e985['getApplications'](_0x5a3005);}})[_0x099a('0x21')](function(_0x51735b){if(_0x51735b){return _0x51735b?{'count':_0x4e4f80,'rows':_0x51735b}:null;}})[_0x099a('0x21')](respondWithResult(_0x12a63f,null))[_0x099a('0x2c')](handleError(_0x12a63f,null));};exports['getInteractions']=function(_0x354365,_0x25d8f3,_0x4ad6bd){var _0x1d1f28={'raw':![],'where':{}};var _0x42b9b6={};var _0x51542f={'count':0x0,'rows':[]};return db[_0x099a('0x43')]['findOne']({'where':{'id':_0x354365[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x25d8f3,null))[_0x099a('0x21')](function(_0x397165){if(_0x397165){_0x42b9b6[_0x099a('0x4b')]=_[_0x099a('0x48')](db[_0x099a('0x91')][_0x099a('0x44')]);_0x42b9b6[_0x099a('0x47')]=_[_0x099a('0x48')](_0x354365['query']);_0x42b9b6[_0x099a('0x49')]=_['intersection'](_0x42b9b6['model'],_0x42b9b6['query']);_0x1d1f28[_0x099a('0x4c')]=_[_0x099a('0x4a')](_0x42b9b6[_0x099a('0x4b')],qs[_0x099a('0x5b')](_0x354365[_0x099a('0x47')][_0x099a('0x5b')]));_0x1d1f28[_0x099a('0x4c')]=_0x1d1f28[_0x099a('0x4c')][_0x099a('0x4d')]?_0x1d1f28['attributes']:_0x42b9b6['model'];if(!_0x354365[_0x099a('0x47')][_0x099a('0x4e')](_0x099a('0x69'))){_0x1d1f28[_0x099a('0x31')]=qs[_0x099a('0x31')](_0x354365[_0x099a('0x47')][_0x099a('0x31')]);_0x1d1f28[_0x099a('0x2f')]=qs[_0x099a('0x2f')](_0x354365[_0x099a('0x47')][_0x099a('0x2f')]);}_0x1d1f28['order']=qs['sort'](_0x354365['query'][_0x099a('0x50')]);_0x1d1f28[_0x099a('0x53')]=qs['filters'](_[_0x099a('0x51')](_0x354365[_0x099a('0x47')],_0x42b9b6[_0x099a('0x49')]));_0x1d1f28[_0x099a('0x53')]['OpenchannelAccountId']=_0x397165['id'];if(_0x354365[_0x099a('0x47')]['filter']){_0x1d1f28[_0x099a('0x53')]=_['merge'](_0x1d1f28[_0x099a('0x53')],{'$or':_['map'](_0x1d1f28[_0x099a('0x4c')],function(_0x75caea){var _0xa53a36={};_0xa53a36[_0x75caea]={'$like':'%'+_0x354365[_0x099a('0x47')][_0x099a('0x52')]+'%'};return _0xa53a36;})});}_0x1d1f28=_[_0x099a('0x55')]({},_0x1d1f28,_0x354365['options']);return db[_0x099a('0x91')][_0x099a('0x32')]({'where':_0x1d1f28[_0x099a('0x53')]})[_0x099a('0x21')](function(_0x1c2167){_0x51542f[_0x099a('0x32')]=_0x1c2167;if(_0x354365[_0x099a('0x47')][_0x099a('0x57')]){_0x1d1f28[_0x099a('0x58')]=[{'model':db[_0x099a('0x74')],'as':_0x099a('0xb3'),'required':![]},{'model':db[_0x099a('0x9f')],'as':_0x099a('0xb4'),'attributes':[_0x099a('0x3d'),_0x099a('0xb5'),_0x099a('0xb6')],'required':![]},{'model':db[_0x099a('0xb7')],'as':_0x099a('0xb8'),'attributes':['id',_0x099a('0x3d'),_0x099a('0xb9')],'where':_0x354365[_0x099a('0x47')][_0x099a('0xba')]?{'id':_0x354365[_0x099a('0x47')][_0x099a('0xba')]}:undefined,'required':_0x354365[_0x099a('0x47')][_0x099a('0xba')]?!![]:![]}];}return db[_0x099a('0x91')][_0x099a('0x59')](_0x1d1f28);})[_0x099a('0x21')](function(_0x46ae15){_0x51542f[_0x099a('0x6a')]=_0x46ae15;return _0x51542f;});}})['then'](respondWithFilteredResult(_0x25d8f3,_0x1d1f28))[_0x099a('0x2c')](handleError(_0x25d8f3,null));};exports[_0x099a('0xbb')]=function(_0x4a2794,_0x4a4601,_0x40f91c){return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x4a2794['params']['id']}})['then'](handleEntityNotFound(_0x4a4601,null))[_0x099a('0x21')](function(_0x2d23f5){if(_0x2d23f5){return _0x2d23f5[_0x099a('0xbb')](_0x4a2794[_0x099a('0x63')][_0x099a('0x6c')],_['omit'](_0x4a2794[_0x099a('0x63')],[_0x099a('0x6c'),'id'])||{})[_0x099a('0x93')](function(_0xf41f3b){for(var _0x5b8544=0x0;_0x5b8544<_0x4a2794[_0x099a('0x63')][_0x099a('0x6c')][_0x099a('0x4d')];_0x5b8544+=0x1){socket['emit'](_0x099a('0xbc'),{'UserId':Number(_0x4a2794[_0x099a('0x63')]['ids'][_0x5b8544]),'OpenchannelAccountId':Number(_0x4a2794[_0x099a('0x5a')]['id'])});}return _0xf41f3b;});}})[_0x099a('0x21')](respondWithResult(_0x4a4601,null))[_0x099a('0x2c')](handleError(_0x4a4601,null));};exports['removeAgents']=function(_0x10588e,_0x380f2c,_0x1e686d){return db[_0x099a('0x43')][_0x099a('0x64')]({'where':{'id':_0x10588e[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x380f2c,null))[_0x099a('0x21')](function(_0x50ba11){if(_0x50ba11){return _0x50ba11[_0x099a('0xbd')](_0x10588e['query'][_0x099a('0x6c')])[_0x099a('0x21')](function(){if(_['isArray'](_0x10588e[_0x099a('0x47')]['ids'])){for(var _0x100c98=0x0;_0x100c98<_0x10588e['query'][_0x099a('0x6c')][_0x099a('0x4d')];_0x100c98+=0x1){socket['emit'](_0x099a('0xbe'),{'UserId':Number(_0x10588e[_0x099a('0x47')][_0x099a('0x6c')][_0x100c98]),'OpenchannelAccountId':Number(_0x10588e[_0x099a('0x5a')]['id'])});}}else{socket[_0x099a('0xbf')](_0x099a('0xbe'),{'UserId':Number(_0x10588e[_0x099a('0x47')]['ids']),'OpenchannelAccountId':Number(_0x10588e[_0x099a('0x5a')]['id'])});}});}})[_0x099a('0x21')](respondWithStatusCode(_0x380f2c,null))[_0x099a('0x2c')](handleError(_0x380f2c,null));};exports[_0x099a('0xc0')]=function(_0x5681e3,_0x18202e,_0x33fce6){var _0x2c0eae={};var _0x4fda60={};var _0x4fd118;var _0x45312f;return db[_0x099a('0x43')]['findOne']({'where':{'id':_0x5681e3[_0x099a('0x5a')]['id']}})[_0x099a('0x21')](handleEntityNotFound(_0x18202e,null))[_0x099a('0x21')](function(_0x4f0cdc){if(_0x4f0cdc){_0x4fd118=_0x4f0cdc;_0x4fda60[_0x099a('0x4b')]=_[_0x099a('0x48')](db[_0x099a('0x9f')][_0x099a('0x44')]);_0x4fda60[_0x099a('0x47')]=_[_0x099a('0x48')](_0x5681e3[_0x099a('0x47')]);_0x4fda60[_0x099a('0x49')]=_[_0x099a('0x4a')](_0x4fda60[_0x099a('0x4b')],_0x4fda60[_0x099a('0x47')]);_0x2c0eae[_0x099a('0x4c')]=_[_0x099a('0x4a')](_0x4fda60['model'],qs[_0x099a('0x5b')](_0x5681e3[_0x099a('0x47')][_0x099a('0x5b')]));_0x2c0eae['attributes']=_0x2c0eae[_0x099a('0x4c')][_0x099a('0x4d')]?_0x2c0eae['attributes']:_0x4fda60[_0x099a('0x4b')];_0x2c0eae[_0x099a('0x4f')]=qs[_0x099a('0x50')](_0x5681e3['query'][_0x099a('0x50')]);_0x2c0eae[_0x099a('0x53')]=qs[_0x099a('0x49')](_[_0x099a('0x51')](_0x5681e3['query'],_0x4fda60[_0x099a('0x49')]));if(_0x5681e3[_0x099a('0x47')]['filter']){_0x2c0eae['where']=_['merge'](_0x2c0eae[_0x099a('0x53')],{'$or':_[_0x099a('0x42')](_0x2c0eae[_0x099a('0x4c')],function(_0x284d10){var _0x5cd32a={};_0x5cd32a[_0x284d10]={'$like':'%'+_0x5681e3[_0x099a('0x47')][_0x099a('0x52')]+'%'};return _0x5cd32a;})});}_0x2c0eae=_['merge']({},_0x2c0eae,_0x5681e3['options']);return _0x4fd118[_0x099a('0xc0')](_0x2c0eae);}})[_0x099a('0x21')](function(_0x271bb6){if(_0x271bb6){_0x45312f=_0x271bb6[_0x099a('0x4d')];if(!_0x5681e3[_0x099a('0x47')][_0x099a('0x4e')](_0x099a('0x69'))){_0x2c0eae[_0x099a('0x31')]=qs[_0x099a('0x31')](_0x5681e3[_0x099a('0x47')]['limit']);_0x2c0eae[_0x099a('0x2f')]=qs['offset'](_0x5681e3[_0x099a('0x47')][_0x099a('0x2f')]);}return _0x4fd118['getAgents'](_0x2c0eae);}})[_0x099a('0x21')](function(_0x240ef7){if(_0x240ef7){return _0x240ef7?{'count':_0x45312f,'rows':_0x240ef7}:null;}})[_0x099a('0x21')](respondWithResult(_0x18202e,null))['catch'](handleError(_0x18202e,null));};exports['send']=function(_0x52bb0a,_0x10843c,_0x1a77df){var _0x172b23,_0x100fbb,_0x49ffa0;if(_[_0x099a('0x7c')](_0x52bb0a[_0x099a('0x63')][_0x099a('0x63')])||_0x52bb0a[_0x099a('0x63')][_0x099a('0x63')]===''){throw new db['Sequelize']['ValidationError'](_0x099a('0x7e'));}if(_[_0x099a('0x7c')](_0x52bb0a['body']['to'])){}_0x172b23=_0x52bb0a[_0x099a('0x63')]['to'];return db[_0x099a('0x43')][_0x099a('0x70')]({'where':{'id':_0x52bb0a[_0x099a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x10843c,null))[_0x099a('0x21')](function(_0x2ae838){if(_0x2ae838){return db[_0x099a('0x43')]['find']({'where':{'id':_0x2ae838['id']},'include':[{'model':db[_0x099a('0x82')],'as':_0x099a('0x83'),'include':[{'model':db[_0x099a('0x74')],'as':_0x099a('0x8c'),'where':{[_0x2ae838[_0x099a('0x7f')]]:_0x172b23},'limit':0x1,'order':[[_0x099a('0x7a'),_0x099a('0x84')]]}]}]})[_0x099a('0x21')](handleEntityNotFound(_0x10843c,null))[_0x099a('0x21')](function(_0x2ee731){if(_0x2ee731&&_0x2ee731[_0x099a('0x83')]){_0x100fbb=_0x2ee731[_0x099a('0x39')]({'plain':!![]});if(_0x100fbb[_0x099a('0x83')]&&_0x100fbb[_0x099a('0x83')][_0x099a('0x8c')][_0x099a('0x4d')]){return _0x100fbb[_0x099a('0x83')]['Contacts'][0x0];}return db[_0x099a('0x74')][_0x099a('0x5c')](_['defaults'](_0x52bb0a[_0x099a('0x63')],{'firstName':_0x172b23,[_0x2ee731[_0x099a('0x7f')]]:_0x172b23,'phone':_0x172b23,'ListId':_0x100fbb[_0x099a('0xc1')]}));}})['then'](handleEntityNotFound(_0x10843c,null))[_0x099a('0x21')](function(_0x34293a){if(_0x34293a){_0x49ffa0=_0x34293a;return db[_0x099a('0x91')][_0x099a('0x64')]({'where':{'ContactId':_0x49ffa0['id'],'closed':![],'OpenchannelAccountId':_0x100fbb['id']}})['then'](function(_0x53a02b){if(_0x53a02b){return[_0x53a02b,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x52bb0a[_0x099a('0x5d')]['id'],'ContactId':_0x49ffa0['id'],'OpenchannelAccountId':_0x100fbb['id'],'lastMsgDirection':_0x099a('0xc2'),'firstMsgDirection':_0x099a('0xc2'),'Messages':[_[_0x099a('0x55')](_0x52bb0a[_0x099a('0x63')],{'read':![],'body':_0x52bb0a[_0x099a('0x63')][_0x099a('0x63')],'OpenchannelAccountId':_0x100fbb['id'],'UserId':_0x52bb0a[_0x099a('0x5d')]['id'],'ContactId':_0x49ffa0['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x099a('0xc3')}]})[_0x099a('0x21')](function(_0x22fd3d){return[_0x22fd3d,!![]];});});}})['spread'](function(_0x212a4a,_0x1e126c){if(_0x1e126c){return _0x212a4a;}return db[_0x099a('0x9c')][_0x099a('0x5c')](_[_0x099a('0x55')](_0x52bb0a[_0x099a('0x63')],{'read':![],'body':_0x52bb0a[_0x099a('0x63')][_0x099a('0x63')],'OpenchannelAccountId':_0x100fbb['id'],'OpenchannelInteractionId':_0x212a4a['id'],'UserId':_0x52bb0a[_0x099a('0x5d')]['id'],'ContactId':_0x49ffa0['id']}))['then'](function(_0x192bd9){_0x212a4a['dataValues'][_0x099a('0xc3')]=[];_0x212a4a[_0x099a('0xc4')][_0x099a('0xc3')][_0x099a('0x98')](_0x192bd9['dataValues']);return _0x212a4a;});});}})[_0x099a('0x21')](respondWithResult(_0x10843c,null))['catch'](handleError(_0x10843c,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 5b16146..1be7b98 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb903=['setMaxListeners','update','remove','emit','hasOwnProperty','events','../../mysqldb','OpenchannelAccount'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb903,0x185));var _0x3b90=function(_0x267602,_0x228bdb){_0x267602=_0x267602-0x0;var _0x1d6ab5=_0xb903[_0x267602];return _0x1d6ab5;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var OpenchannelAccount=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3b90('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x4'),'afterDestroy':_0x3b90('0x5')};function emitEvent(_0x3b024a){return function(_0x1cd5d8,_0x30d8db,_0x40f726){OpenchannelAccountEvents[_0x3b90('0x6')](_0x3b024a+':'+_0x1cd5d8['id'],_0x1cd5d8);OpenchannelAccountEvents['emit'](_0x3b024a,_0x1cd5d8);_0x40f726(null);};}for(var e in events){if(events[_0x3b90('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _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 diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e9da840..8d39352 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(_0x503b78,_0x432ee8){var _0x250a98=function(_0x226b60){while(--_0x226b60){_0x503b78['push'](_0x503b78['shift']());}};_0x250a98(++_0x432ee8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_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 diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 8af12ad..2be5124 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 _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x19bf46,_0x19bc72){var _0x9b820d=function(_0x21b649){while(--_0x21b649){_0x19bf46['push'](_0x19bf46['shift']());}};_0x9b820d(++_0x19bc72);}(_0x0fd9,0xa3));var _0x90fd=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x0fd9[_0x59616b];return _0x5c4523;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});config['redis']=_[_0x90fd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90fd('0xb'))(new Redis(config[_0x90fd('0xc')]));require('./openchannelAccount.socket')[_0x90fd('0xd')](socket);function respondWithRpcPromise(_0x464236,_0x3c0592,_0x3262f6){return new BPromise(function(_0x289693,_0x3be346){return client[_0x90fd('0xe')](_0x464236,_0x3262f6)[_0x90fd('0xf')](function(_0x3c541e){logger['info'](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));logger['debug'](_0x90fd('0x12'),_0x3c0592,_0x90fd('0x11'),JSON[_0x90fd('0x13')](_0x3c541e));if(_0x3c541e['error']){if(_0x3c541e[_0x90fd('0x14')]['code']===0x1f4){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);return _0x3be346(_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);}logger[_0x90fd('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c0592,_0x3c541e['error'][_0x90fd('0x15')]);return _0x289693(_0x3c541e[_0x90fd('0x14')]['message']);}else{logger[_0x90fd('0x16')](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));_0x289693(_0x3c541e['result'][_0x90fd('0x15')]);}})[_0x90fd('0x17')](function(_0x16d8a7){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x16d8a7);_0x3be346(_0x16d8a7);});});} \ No newline at end of file +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 diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 39c1b73..27686d3 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 _0x3f59=['./openchannelAccount.events','save','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0xe67ff7,_0x570b9e){var _0x5f1a95=function(_0x1a1a6f){while(--_0x1a1a6f){_0xe67ff7['push'](_0xe67ff7['shift']());}};_0x5f1a95(++_0x570b9e);}(_0x3f59,0x1b0));var _0x93f5=function(_0xbe5025,_0x40217b){_0xbe5025=_0xbe5025-0x0;var _0x3fb35e=_0x3f59[_0xbe5025];return _0x3fb35e;};'use strict';var OpenchannelAccountEvents=require(_0x93f5('0x0'));var events=[_0x93f5('0x1'),'remove',_0x93f5('0x2')];function createListener(_0x3d04a8,_0x17f9c2){return function(_0xcea971){_0x17f9c2[_0x93f5('0x3')](_0x3d04a8,_0xcea971);};}function removeListener(_0x21ac17,_0x374022){return function(){OpenchannelAccountEvents[_0x93f5('0x4')](_0x21ac17,_0x374022);};}exports[_0x93f5('0x5')]=function(_0x4dd06b){for(var _0x565ad3=0x0,_0xb86c2d=events[_0x93f5('0x6')];_0x565ad3<_0xb86c2d;_0x565ad3++){var _0x1e7b4d=events[_0x565ad3];var _0x24b75b=createListener(_0x93f5('0x7')+_0x1e7b4d,_0x4dd06b);OpenchannelAccountEvents['on'](_0x1e7b4d,_0x24b75b);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2234456..6aea95e 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 _0x36a6=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','exports'];(function(_0x23ee7a,_0x5c414f){var _0x30c1ac=function(_0x5d0c1e){while(--_0x5d0c1e){_0x23ee7a['push'](_0x23ee7a['shift']());}};_0x30c1ac(++_0x5c414f);}(_0x36a6,0x17c));var _0x636a=function(_0x43e415,_0x22a990){_0x43e415=_0x43e415-0x0;var _0x24925f=_0x36a6[_0x43e415];return _0x24925f;};'use strict';var multer=require(_0x636a('0x0'));var util=require(_0x636a('0x1'));var path=require(_0x636a('0x2'));var timeout=require(_0x636a('0x3'));var express=require(_0x636a('0x4'));var router=express['Router']();var fs_extra=require(_0x636a('0x5'));var auth=require(_0x636a('0x6'));var interaction=require(_0x636a('0x7'));var config=require('../../config/environment');var controller=require(_0x636a('0x8'));router[_0x636a('0x9')]('/',auth[_0x636a('0xa')](),controller[_0x636a('0xb')]);router[_0x636a('0x9')]('/:id',auth[_0x636a('0xa')](),controller['show']);router[_0x636a('0xc')]('/',auth[_0x636a('0xa')](),controller[_0x636a('0xd')]);router[_0x636a('0xe')](_0x636a('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x636a('0x10')](_0x636a('0xf'),auth[_0x636a('0xa')](),controller[_0x636a('0x11')]);module[_0x636a('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 78d7bfe..2f16023 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 _0xd099=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xa223ad,_0x5a574b){var _0x306d47=function(_0x4b19ab){while(--_0x4b19ab){_0xa223ad['push'](_0xa223ad['shift']());}};_0x306d47(++_0x5a574b);}(_0xd099,0xe7));var _0x9d09=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xd099[_0x143a91];return _0x1906f5;};'use strict';var Sequelize=require(_0x9d09('0x0'));module[_0x9d09('0x1')]={'priority':{'type':Sequelize[_0x9d09('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9d09('0x3')],'allowNull':![],'defaultValue':_0x9d09('0x4')},'appdata':{'type':Sequelize[_0x9d09('0x5')]()},'description':{'type':Sequelize[_0x9d09('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9d09('0x6')}}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b4e235e..7b95004 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 _0x74f4=['find','create','body','params','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','catch','show'];(function(_0xdeb9d8,_0x574801){var _0x40b1c9=function(_0x4977d0){while(--_0x4977d0){_0xdeb9d8['push'](_0xdeb9d8['shift']());}};_0x40b1c9(++_0x574801);}(_0x74f4,0xe5));var _0x474f=function(_0x4cd69c,_0x1bd26f){_0x4cd69c=_0x4cd69c-0x0;var _0x4b50fe=_0x74f4[_0x4cd69c];return _0x4b50fe;};'use strict';var emlformat=require(_0x474f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x474f('0x1'));var moment=require(_0x474f('0x2'));var BPromise=require(_0x474f('0x3'));var Mustache=require(_0x474f('0x4'));var util=require(_0x474f('0x5'));var path=require(_0x474f('0x6'));var sox=require('sox');var csv=require(_0x474f('0x7'));var ejs=require(_0x474f('0x8'));var fs=require('fs');var fs_extra=require(_0x474f('0x9'));var _=require(_0x474f('0xa'));var squel=require(_0x474f('0xb'));var crypto=require(_0x474f('0xc'));var jsforce=require(_0x474f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x474f('0xe'));var Papa=require('papaparse');var Redis=require(_0x474f('0xf'));var authService=require(_0x474f('0x10'));var qs=require(_0x474f('0x11'));var as=require(_0x474f('0x12'));var hardwareService=require(_0x474f('0x13'));var logger=require(_0x474f('0x14'))(_0x474f('0x15'));var utils=require('../../config/utils');var config=require(_0x474f('0x16'));var licenseUtil=require(_0x474f('0x17'));var db=require(_0x474f('0x18'))['db'];function respondWithStatusCode(_0x27379f,_0x2ea1d8){_0x2ea1d8=_0x2ea1d8||0xcc;return function(_0x5b8642){if(_0x5b8642){return _0x27379f[_0x474f('0x19')](_0x2ea1d8);}return _0x27379f[_0x474f('0x1a')](_0x2ea1d8)[_0x474f('0x1b')]();};}function respondWithResult(_0x4a0802,_0x407c88){_0x407c88=_0x407c88||0xc8;return function(_0x213b5){if(_0x213b5){return _0x4a0802['status'](_0x407c88)['json'](_0x213b5);}};}function respondWithFilteredResult(_0x296ded,_0x235187){return function(_0x422822){if(_0x422822){var _0x2601bc=typeof _0x235187[_0x474f('0x1c')]===_0x474f('0x1d')&&typeof _0x235187[_0x474f('0x1e')]===_0x474f('0x1d');var _0x4f39cf=_0x422822[_0x474f('0x1f')];var _0x24eda0=_0x2601bc?0x0:_0x235187['offset'];var _0x38f9cb=_0x2601bc?_0x422822['count']:_0x235187[_0x474f('0x1c')]+_0x235187[_0x474f('0x1e')];var _0x4b2864;if(_0x38f9cb>=_0x4f39cf){_0x38f9cb=_0x4f39cf;_0x4b2864=0xc8;}else{_0x4b2864=0xce;}_0x296ded[_0x474f('0x1a')](_0x4b2864);return _0x296ded[_0x474f('0x20')]('Content-Range',_0x24eda0+'-'+_0x38f9cb+'/'+_0x4f39cf)[_0x474f('0x21')](_0x422822);}return null;};}function patchUpdates(_0x3f18a6){return function(_0x2434ac){try{jsonpatch[_0x474f('0x22')](_0x2434ac,_0x3f18a6,!![]);}catch(_0x29b4a9){return BPromise[_0x474f('0x23')](_0x29b4a9);}return _0x2434ac[_0x474f('0x24')]();};}function saveUpdates(_0x2ca1ad,_0x108536){return function(_0x5e5346){if(_0x5e5346){return _0x5e5346[_0x474f('0x25')](_0x2ca1ad)[_0x474f('0x26')](function(_0x2e1e96){return _0x2e1e96;});}return null;};}function removeEntity(_0x32e11c,_0x41dc92){return function(_0xf5ead7){if(_0xf5ead7){return _0xf5ead7[_0x474f('0x27')]()[_0x474f('0x26')](function(){_0x32e11c[_0x474f('0x1a')](0xcc)[_0x474f('0x1b')]();});}};}function handleEntityNotFound(_0x3ac946,_0x4e7142){return function(_0x4b171c){if(!_0x4b171c){_0x3ac946['sendStatus'](0x194);}return _0x4b171c;};}function handleError(_0x720423,_0x3f131b){_0x3f131b=_0x3f131b||0x1f4;return function(_0x12665c){logger['error'](_0x12665c[_0x474f('0x28')]);if(_0x12665c[_0x474f('0x29')]){delete _0x12665c[_0x474f('0x29')];}_0x720423[_0x474f('0x1a')](_0x3f131b)[_0x474f('0x2a')](_0x12665c);};}exports[_0x474f('0x2b')]=function(_0x27dc9a,_0x38051c){var _0x369a06={},_0x136917={},_0x352a21={'count':0x0,'rows':[]};var _0x5d7a65=_['map'](db[_0x474f('0x2c')][_0x474f('0x2d')],function(_0x279b75){return{'name':_0x279b75[_0x474f('0x2e')],'type':_0x279b75[_0x474f('0x2f')]['key']};});_0x136917[_0x474f('0x30')]=_['map'](_0x5d7a65,_0x474f('0x29'));_0x136917[_0x474f('0x31')]=_[_0x474f('0x32')](_0x27dc9a[_0x474f('0x31')]);_0x136917[_0x474f('0x33')]=_[_0x474f('0x34')](_0x136917['model'],_0x136917[_0x474f('0x31')]);_0x369a06[_0x474f('0x35')]=_[_0x474f('0x34')](_0x136917[_0x474f('0x30')],qs[_0x474f('0x36')](_0x27dc9a[_0x474f('0x31')][_0x474f('0x36')]));_0x369a06['attributes']=_0x369a06['attributes'][_0x474f('0x37')]?_0x369a06[_0x474f('0x35')]:_0x136917[_0x474f('0x30')];if(!_0x27dc9a[_0x474f('0x31')][_0x474f('0x38')](_0x474f('0x39'))){_0x369a06[_0x474f('0x1e')]=qs[_0x474f('0x1e')](_0x27dc9a['query'][_0x474f('0x1e')]);_0x369a06[_0x474f('0x1c')]=qs[_0x474f('0x1c')](_0x27dc9a['query'][_0x474f('0x1c')]);}_0x369a06[_0x474f('0x3a')]=qs[_0x474f('0x3b')](_0x27dc9a[_0x474f('0x31')][_0x474f('0x3b')]);_0x369a06['where']=qs[_0x474f('0x33')](_[_0x474f('0x3c')](_0x27dc9a[_0x474f('0x31')],_0x136917[_0x474f('0x33')]),_0x5d7a65);if(_0x27dc9a[_0x474f('0x31')][_0x474f('0x3d')]){_0x369a06[_0x474f('0x3e')]=_[_0x474f('0x3f')](_0x369a06['where'],{'$or':_[_0x474f('0x40')](_0x5d7a65,function(_0x1581f6){if(_0x1581f6[_0x474f('0x2f')]!=='VIRTUAL'){var _0x234884={};_0x234884[_0x1581f6[_0x474f('0x29')]]={'$like':'%'+_0x27dc9a[_0x474f('0x31')][_0x474f('0x3d')]+'%'};return _0x234884;}})});}_0x369a06=_[_0x474f('0x3f')]({},_0x369a06,_0x27dc9a[_0x474f('0x41')]);var _0xbb27b={'where':_0x369a06[_0x474f('0x3e')]};return db['OpenchannelApplication'][_0x474f('0x1f')](_0xbb27b)['then'](function(_0x396109){_0x352a21[_0x474f('0x1f')]=_0x396109;if(_0x27dc9a['query'][_0x474f('0x42')]){_0x369a06[_0x474f('0x43')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x474f('0x44')](_0x369a06);})['then'](function(_0x2af342){_0x352a21['rows']=_0x2af342;return _0x352a21;})['then'](respondWithFilteredResult(_0x38051c,_0x369a06))[_0x474f('0x45')](handleError(_0x38051c,null));};exports[_0x474f('0x46')]=function(_0x15c6f2,_0xba9fef){var _0x3254b3={'raw':!![],'where':{'id':_0x15c6f2['params']['id']}},_0x1801bf={};_0x1801bf[_0x474f('0x30')]=_['keys'](db[_0x474f('0x2c')]['rawAttributes']);_0x1801bf[_0x474f('0x31')]=_[_0x474f('0x32')](_0x15c6f2[_0x474f('0x31')]);_0x1801bf['filters']=_[_0x474f('0x34')](_0x1801bf[_0x474f('0x30')],_0x1801bf[_0x474f('0x31')]);_0x3254b3[_0x474f('0x35')]=_['intersection'](_0x1801bf[_0x474f('0x30')],qs[_0x474f('0x36')](_0x15c6f2[_0x474f('0x31')]['fields']));_0x3254b3['attributes']=_0x3254b3[_0x474f('0x35')][_0x474f('0x37')]?_0x3254b3[_0x474f('0x35')]:_0x1801bf['model'];if(_0x15c6f2[_0x474f('0x31')][_0x474f('0x42')]){_0x3254b3[_0x474f('0x43')]=[{'all':!![]}];}_0x3254b3=_[_0x474f('0x3f')]({},_0x3254b3,_0x15c6f2[_0x474f('0x41')]);return db[_0x474f('0x2c')][_0x474f('0x47')](_0x3254b3)[_0x474f('0x26')](handleEntityNotFound(_0xba9fef,null))[_0x474f('0x26')](respondWithResult(_0xba9fef,null))[_0x474f('0x45')](handleError(_0xba9fef,null));};exports[_0x474f('0x48')]=function(_0xe64b6,_0x3b0b78){return db[_0x474f('0x2c')][_0x474f('0x48')](_0xe64b6['body'],{})[_0x474f('0x26')](respondWithResult(_0x3b0b78,0xc9))[_0x474f('0x45')](handleError(_0x3b0b78,null));};exports[_0x474f('0x25')]=function(_0xaedc01,_0x10eced){if(_0xaedc01[_0x474f('0x49')]['id']){delete _0xaedc01[_0x474f('0x49')]['id'];}return db[_0x474f('0x2c')][_0x474f('0x47')]({'where':{'id':_0xaedc01[_0x474f('0x4a')]['id']}})[_0x474f('0x26')](handleEntityNotFound(_0x10eced,null))[_0x474f('0x26')](saveUpdates(_0xaedc01['body'],null))[_0x474f('0x26')](respondWithResult(_0x10eced,null))['catch'](handleError(_0x10eced,null));};exports[_0x474f('0x27')]=function(_0x4d3720,_0x353d7d){return db[_0x474f('0x2c')][_0x474f('0x47')]({'where':{'id':_0x4d3720[_0x474f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x353d7d,null))['then'](removeEntity(_0x353d7d,null))[_0x474f('0x45')](handleError(_0x353d7d,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 75e75cf..74bda45 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 _0xaede=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes'];(function(_0x19ed74,_0x5a4f4a){var _0x161212=function(_0x2f81f5){while(--_0x2f81f5){_0x19ed74['push'](_0x19ed74['shift']());}};_0x161212(++_0x5a4f4a);}(_0xaede,0x18b));var _0xeaed=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xaede[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xeaed('0x0'));var util=require(_0xeaed('0x1'));var logger=require(_0xeaed('0x2'))(_0xeaed('0x3'));var moment=require(_0xeaed('0x4'));var BPromise=require(_0xeaed('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeaed('0x6'));var rimraf=require(_0xeaed('0x7'));var config=require(_0xeaed('0x8'));var attributes=require(_0xeaed('0x9'));module[_0xeaed('0xa')]=function(_0x52ee60,_0x2cc9ec){return _0x52ee60[_0xeaed('0xb')](_0xeaed('0xc'),attributes,{'tableName':_0xeaed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xeaed('0xe')});}; \ No newline at end of file +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 diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index fab7e88..891fbdd 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 _0xe69f=['options','raw','where','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body'];(function(_0x2f76f4,_0x330395){var _0x346ccf=function(_0x25aea4){while(--_0x25aea4){_0x2f76f4['push'](_0x2f76f4['shift']());}};_0x346ccf(++_0x330395);}(_0xe69f,0xf5));var _0xfe69=function(_0x2104b9,_0x59b259){_0x2104b9=_0x2104b9-0x0;var _0x271843=_0xe69f[_0x2104b9];return _0x271843;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe69('0x0'));var fs=require('fs');var Redis=require(_0xfe69('0x1'));var db=require(_0xfe69('0x2'))['db'];var utils=require(_0xfe69('0x3'));var logger=require(_0xfe69('0x4'))(_0xfe69('0x5'));var config=require(_0xfe69('0x6'));var jayson=require(_0xfe69('0x7'));var client=jayson['client'][_0xfe69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x639842,_0x832e8c,_0x44cdad){return new BPromise(function(_0x3be565,_0xcbb297){return client[_0xfe69('0x9')](_0x639842,_0x44cdad)[_0xfe69('0xa')](function(_0x3d5540){logger[_0xfe69('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x832e8c,'request\x20sent');logger[_0xfe69('0xc')](_0xfe69('0xd'),_0x832e8c,_0xfe69('0xe'),JSON[_0xfe69('0xf')](_0x3d5540));if(_0x3d5540['error']){if(_0x3d5540[_0xfe69('0x10')]['code']===0x1f4){logger[_0xfe69('0x10')](_0xfe69('0x11'),_0x832e8c,_0x3d5540['error']['message']);return _0xcbb297(_0x3d5540[_0xfe69('0x10')][_0xfe69('0x12')]);}logger[_0xfe69('0x10')](_0xfe69('0x11'),_0x832e8c,_0x3d5540[_0xfe69('0x10')][_0xfe69('0x12')]);return _0x3be565(_0x3d5540[_0xfe69('0x10')][_0xfe69('0x12')]);}else{logger[_0xfe69('0xb')](_0xfe69('0x11'),_0x832e8c,_0xfe69('0xe'));_0x3be565(_0x3d5540[_0xfe69('0x13')][_0xfe69('0x12')]);}})[_0xfe69('0x14')](function(_0x1b8591){logger[_0xfe69('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x832e8c,_0x1b8591);_0xcbb297(_0x1b8591);});});}exports[_0xfe69('0x15')]=function(_0x35b706){var _0x2bb4f1=this;return new Promise(function(_0x19a8fa,_0x2aa221){return db[_0xfe69('0x16')][_0xfe69('0x17')](_0x35b706[_0xfe69('0x18')],{'raw':_0x35b706[_0xfe69('0x19')]?_0x35b706['options'][_0xfe69('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35b706[_0xfe69('0x19')]?_0x35b706[_0xfe69('0x19')][_0xfe69('0x1b')]||null:null,'attributes':_0x35b706[_0xfe69('0x19')]?_0x35b706['options'][_0xfe69('0x1c')]||null:null,'limit':_0x35b706['options']?_0x35b706[_0xfe69('0x19')][_0xfe69('0x1d')]||null:null})[_0xfe69('0xa')](function(_0xeaaa20){logger[_0xfe69('0xb')]('UpdateOpenchannelApplication',_0x35b706);logger['debug'](_0xfe69('0x15'),_0x35b706,JSON[_0xfe69('0xf')](_0xeaaa20));_0x19a8fa(_0xeaaa20);})[_0xfe69('0x14')](function(_0x532038){logger[_0xfe69('0x10')](_0xfe69('0x15'),_0x532038[_0xfe69('0x12')],_0x35b706);_0x2aa221(_0x2bb4f1[_0xfe69('0x10')](0x1f4,_0x532038[_0xfe69('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 86a0007..a380c90 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 _0x3075=['addMessage','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','update','openchannel','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create'];(function(_0x1a8f6d,_0x383548){var _0x1d1c3a=function(_0x49d2d8){while(--_0x49d2d8){_0x1a8f6d['push'](_0x1a8f6d['shift']());}};_0x1d1c3a(++_0x383548);}(_0x3075,0xe5));var _0x5307=function(_0x1f3e4d,_0x41697e){_0x1f3e4d=_0x1f3e4d-0x0;var _0x2b79dc=_0x3075[_0x1f3e4d];return _0x2b79dc;};'use strict';var multer=require(_0x5307('0x0'));var util=require('util');var path=require(_0x5307('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5307('0x2')]();var fs_extra=require(_0x5307('0x3'));var auth=require(_0x5307('0x4'));var interaction=require(_0x5307('0x5'));var config=require(_0x5307('0x6'));var controller=require(_0x5307('0x7'));router[_0x5307('0x8')]('/',auth[_0x5307('0x9')](),controller['index']);router[_0x5307('0x8')](_0x5307('0xa'),auth[_0x5307('0x9')](),controller[_0x5307('0xb')]);router[_0x5307('0x8')](_0x5307('0xc'),auth['isAuthenticated'](),controller[_0x5307('0xd')]);router[_0x5307('0x8')]('/:id/messages',auth[_0x5307('0x9')](),controller[_0x5307('0xe')]);router[_0x5307('0x8')](_0x5307('0xf'),auth[_0x5307('0x9')](),controller[_0x5307('0x10')]);router[_0x5307('0x11')]('/',auth[_0x5307('0x9')](),controller[_0x5307('0x12')]);router[_0x5307('0x11')]('/:id/messages',auth[_0x5307('0x9')](),controller[_0x5307('0x13')]);router[_0x5307('0x11')]('/:id/tags',auth[_0x5307('0x9')](),interaction[_0x5307('0x14')]('openchannel',_0x5307('0x15')),controller['addTags']);router[_0x5307('0x16')](_0x5307('0xc'),auth[_0x5307('0x9')](),interaction['tracked']('openchannel',_0x5307('0x17')),controller[_0x5307('0x18')]);router['delete'](_0x5307('0xc'),auth['isAuthenticated'](),interaction[_0x5307('0x14')](_0x5307('0x19'),_0x5307('0x1a')),controller[_0x5307('0x1b')]);router[_0x5307('0x1c')](_0x5307('0x1d'),auth[_0x5307('0x9')](),controller[_0x5307('0x1e')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9219e9a..444c23a 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 _0x81a5=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x43c706,_0x43204f){var _0x410dca=function(_0x41c20e){while(--_0x41c20e){_0x43c706['push'](_0x43c706['shift']());}};_0x410dca(++_0x43204f);}(_0x81a5,0x1c8));var _0x581a=function(_0x270bc8,_0x1fcb97){_0x270bc8=_0x270bc8-0x0;var _0xc9eed=_0x81a5[_0x270bc8];return _0xc9eed;};'use strict';var Sequelize=require(_0x581a('0x0'));module[_0x581a('0x1')]={'closed':{'type':Sequelize[_0x581a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x581a('0x3')]},'disposition':{'type':Sequelize[_0x581a('0x4')]},'secondDisposition':{'type':Sequelize[_0x581a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x581a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x581a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x581a('0x5')]('in',_0x581a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x581a('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x581a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x581a('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3656460..71473f8 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 _0x698b=['./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','update','then','destroy','error','stack','name','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','show','from','params','model','keys','filters','intersection','attributes','includeAll','include','merge','options','find','create','body','catch','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','fields','length','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','addTags','omit','spread','color','emit','removeTags','toString','join','root','server','files','tmp','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','Owner','get','mkdirSync','Openchannel','Account','N.A.','closed','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','System','out','views','transcript-','.pdf','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter'];(function(_0x51500b,_0x48aba5){var _0x3f2648=function(_0x1a4c89){while(--_0x1a4c89){_0x51500b['push'](_0x51500b['shift']());}};_0x3f2648(++_0x48aba5);}(_0x698b,0xf3));var _0xb698=function(_0x29cedd,_0x2ed956){_0x29cedd=_0x29cedd-0x0;var _0x5d5a86=_0x698b[_0x29cedd];return _0x5d5a86;};'use strict';var rimraf=require(_0xb698('0x0'));var zipdir=require(_0xb698('0x1'));var moment=require(_0xb698('0x2'));var util=require(_0xb698('0x3'));var path=require(_0xb698('0x4'));var ejs=require(_0xb698('0x5'));var fs=require('fs');var _=require(_0xb698('0x6'));var Redis=require('ioredis');var interaction=require(_0xb698('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb698('0x8'));var logger=require(_0xb698('0x9'))('api');var config=require(_0xb698('0xa'));var db=require(_0xb698('0xb'))['db'];config['redis']=_[_0xb698('0xc')](config[_0xb698('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb698('0xe'))(new Redis(config[_0xb698('0xd')]));require(_0xb698('0xf'))[_0xb698('0x10')](socket);function respondWithStatusCode(_0x37e49f,_0xd2b0e6){_0xd2b0e6=_0xd2b0e6||0xcc;return function(_0x4fb692){if(_0x4fb692){return _0x37e49f[_0xb698('0x11')](_0xd2b0e6);}return _0x37e49f[_0xb698('0x12')](_0xd2b0e6)[_0xb698('0x13')]();};}function respondWithResult(_0x262946,_0x4d091f){_0x4d091f=_0x4d091f||0xc8;return function(_0x3c98fa){if(_0x3c98fa){return _0x262946['status'](_0x4d091f)['json'](_0x3c98fa);}};}function respondWithFilteredResult(_0x330ceb,_0x1d825d){return function(_0x564969){if(_0x564969){var _0x542328=typeof _0x1d825d[_0xb698('0x14')]===_0xb698('0x15')&&typeof _0x1d825d[_0xb698('0x16')]===_0xb698('0x15');var _0x242ca7=_0x564969['count'];var _0x1e0d88=_0x542328?0x0:_0x1d825d['offset'];var _0x1956bc=_0x542328?_0x564969['count']:_0x1d825d['offset']+_0x1d825d[_0xb698('0x16')];var _0x2f8235;if(_0x1956bc>=_0x242ca7){_0x1956bc=_0x242ca7;_0x2f8235=0xc8;}else{_0x2f8235=0xce;}_0x330ceb[_0xb698('0x12')](_0x2f8235);return _0x330ceb[_0xb698('0x17')](_0xb698('0x18'),_0x1e0d88+'-'+_0x1956bc+'/'+_0x242ca7)[_0xb698('0x19')](_0x564969);}return null;};}function saveUpdates(_0x23a1f7){return function(_0x1634f2){if(_0x1634f2){return _0x1634f2[_0xb698('0x1a')](_0x23a1f7)[_0xb698('0x1b')](function(_0x38ac54){return _0x38ac54;});}return null;};}function removeEntity(_0x24c452){return function(_0x13046e){if(_0x13046e){return _0x13046e[_0xb698('0x1c')]()[_0xb698('0x1b')](function(){_0x24c452['status'](0xcc)[_0xb698('0x13')]();});}};}function handleEntityNotFound(_0x1cf979){return function(_0x39e70f){if(!_0x39e70f){_0x1cf979[_0xb698('0x11')](0x194);}return _0x39e70f;};}function handleError(_0x3b267b,_0xe21ea){_0xe21ea=_0xe21ea||0x1f4;return function(_0x4aa4a8){logger[_0xb698('0x1d')](_0x4aa4a8[_0xb698('0x1e')]);if(_0x4aa4a8[_0xb698('0x1f')]){delete _0x4aa4a8[_0xb698('0x1f')];}_0x3b267b[_0xb698('0x12')](_0xe21ea)['send'](_0x4aa4a8);};}exports[_0xb698('0x20')]=function(_0x2d0d09,_0x1d7764){var _0xad6cec={};var _0x467366=_['map'](db[_0xb698('0x21')][_0xb698('0x22')],function(_0x3b6001){return{'name':_0x3b6001[_0xb698('0x23')],'type':_0x3b6001[_0xb698('0x24')][_0xb698('0x25')]};});_0xad6cec=qs[_0xb698('0x26')](_0x467366,_0x2d0d09);return interaction[_0xb698('0x27')](_0xb698('0x28'),_0x2d0d09[_0xb698('0x29')],_0x2d0d09[_0xb698('0x2a')],_0xad6cec,_0x467366)[_0xb698('0x1b')](respondWithFilteredResult(_0x1d7764,_0xad6cec))['catch'](handleError(_0x1d7764,null));};exports[_0xb698('0x2b')]=function(_0xef2352,_0x212493){var _0xe840c9={};if(_0xef2352[_0xb698('0x29')][_0xb698('0x24')]&&_0xef2352[_0xb698('0x29')][_0xb698('0x24')]==='from'){_0xe840c9[_0xb698('0x2c')]=_0xef2352[_0xb698('0x2d')]['id'];}else{_0xe840c9['id']=_0xef2352[_0xb698('0x2d')]['id'];}var _0x263c6b={'raw':![],'where':_0xe840c9},_0x31f495={};_0x31f495[_0xb698('0x2e')]=_[_0xb698('0x2f')](db['OpenchannelInteraction'][_0xb698('0x22')]);_0x31f495[_0xb698('0x29')]=_[_0xb698('0x2f')](_0xef2352[_0xb698('0x29')]);_0x31f495[_0xb698('0x30')]=_[_0xb698('0x31')](_0x31f495[_0xb698('0x2e')],_0x31f495[_0xb698('0x29')]);_0x263c6b[_0xb698('0x32')]=_[_0xb698('0x31')](_0x31f495[_0xb698('0x2e')],qs['fields'](_0xef2352[_0xb698('0x29')]['fields']));_0x263c6b[_0xb698('0x32')]=_0x263c6b[_0xb698('0x32')]['length']?_0x263c6b[_0xb698('0x32')]:_0x31f495['model'];if(_0xef2352[_0xb698('0x29')][_0xb698('0x33')]){_0x263c6b[_0xb698('0x34')]=[{'all':!![]}];}_0x263c6b=_[_0xb698('0x35')]({},_0x263c6b,_0xef2352[_0xb698('0x36')]);return db['OpenchannelInteraction'][_0xb698('0x37')](_0x263c6b)[_0xb698('0x1b')](handleEntityNotFound(_0x212493,null))['then'](respondWithResult(_0x212493,null))['catch'](handleError(_0x212493,null));};exports['create']=function(_0x1b515c,_0x536531){return db[_0xb698('0x21')][_0xb698('0x38')](_0x1b515c[_0xb698('0x39')],{})[_0xb698('0x1b')](respondWithResult(_0x536531,0xc9))['catch'](handleError(_0x536531,null));};exports[_0xb698('0x1a')]=function(_0x2d41fc,_0x32e7a1){if(_0x2d41fc['body']['id']){delete _0x2d41fc[_0xb698('0x39')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x2d41fc['params']['id']}})[_0xb698('0x1b')](handleEntityNotFound(_0x32e7a1,null))['then'](saveUpdates(_0x2d41fc[_0xb698('0x39')],null))[_0xb698('0x1b')](respondWithResult(_0x32e7a1,null))[_0xb698('0x3a')](handleError(_0x32e7a1,null));};exports['destroy']=function(_0xdd5075,_0x15dd1d){return db[_0xb698('0x21')][_0xb698('0x37')]({'where':{'id':_0xdd5075[_0xb698('0x2d')]['id']}})[_0xb698('0x1b')](handleEntityNotFound(_0x15dd1d,null))['then'](removeEntity(_0x15dd1d,null))[_0xb698('0x3a')](handleError(_0x15dd1d,null));};exports[_0xb698('0x3b')]=function(_0x3658ba,_0x14b8a7){return db[_0xb698('0x21')][_0xb698('0x3b')]()[_0xb698('0x1b')](respondWithResult(_0x14b8a7,null))['catch'](handleError(_0x14b8a7,null));};exports[_0xb698('0x3c')]=function(_0x2014e2,_0x137cde){return db[_0xb698('0x3d')][_0xb698('0x37')]({'where':{'id':_0x2014e2['params']['id']}})[_0xb698('0x1b')](handleEntityNotFound(_0x137cde,null))[_0xb698('0x1b')](function(_0x117d6a){if(_0x117d6a){return _0x117d6a['addMessage'](_0x2014e2['body'][_0xb698('0x3e')],_['omit'](_0x2014e2[_0xb698('0x39')],[_0xb698('0x3e'),'id'])||{});}})[_0xb698('0x1b')](respondWithResult(_0x137cde,null))['catch'](handleError(_0x137cde,null));};exports[_0xb698('0x3f')]=function(_0x46496e,_0x19997d){var _0x4e87c4={'raw':![],'where':{}};var _0x587d6d={};var _0x29d8ec={'count':0x0,'rows':[]};return db[_0xb698('0x21')][_0xb698('0x40')]({'where':{'id':_0x46496e[_0xb698('0x2d')]['id']}})[_0xb698('0x1b')](handleEntityNotFound(_0x19997d,null))[_0xb698('0x1b')](function(_0x3d947e){if(_0x3d947e){_0x587d6d[_0xb698('0x2e')]=_[_0xb698('0x2f')](db['OpenchannelMessage'][_0xb698('0x22')]);_0x587d6d[_0xb698('0x29')]=_[_0xb698('0x2f')](_0x46496e[_0xb698('0x29')]);_0x587d6d[_0xb698('0x30')]=_['intersection'](_0x587d6d[_0xb698('0x2e')],_0x587d6d[_0xb698('0x29')]);_0x4e87c4[_0xb698('0x32')]=_[_0xb698('0x31')](_0x587d6d[_0xb698('0x2e')],qs[_0xb698('0x41')](_0x46496e[_0xb698('0x29')]['fields']));_0x4e87c4[_0xb698('0x32')]=_0x4e87c4[_0xb698('0x32')][_0xb698('0x42')]?_0x4e87c4[_0xb698('0x32')]:_0x587d6d['model'];if(!_0x46496e['query'][_0xb698('0x43')](_0xb698('0x44'))){_0x4e87c4[_0xb698('0x16')]=qs['limit'](_0x46496e['query'][_0xb698('0x16')]);_0x4e87c4[_0xb698('0x14')]=qs['offset'](_0x46496e[_0xb698('0x29')]['offset']);}_0x4e87c4[_0xb698('0x45')]=qs[_0xb698('0x46')](_0x46496e['query']['sort']);_0x4e87c4['where']=qs['filters'](_['pick'](_0x46496e[_0xb698('0x29')],_0x587d6d[_0xb698('0x30')]));_0x4e87c4[_0xb698('0x47')][_0xb698('0x48')]=_0x3d947e['id'];if(_0x46496e[_0xb698('0x29')][_0xb698('0x49')]){_0x4e87c4['where']=_[_0xb698('0x35')](_0x4e87c4['where'],{'$or':_[_0xb698('0x4a')](_0x4e87c4[_0xb698('0x32')],function(_0x598fcc){var _0x4a9572={};_0x4a9572[_0x598fcc]={'$like':'%'+_0x46496e[_0xb698('0x29')][_0xb698('0x49')]+'%'};return _0x4a9572;})});}if(_0x46496e['query'][_0xb698('0x4b')]){var _0x25c996=_0x46496e[_0xb698('0x29')][_0xb698('0x4b')][_0xb698('0x4c')](',');var _0x5c1103={};_0x5c1103[_0x25c996[0x0]]={'$gte':moment(_0x25c996[0x1])[_0xb698('0x4d')](_0xb698('0x4e'))};_0x4e87c4[_0xb698('0x47')]=_[_0xb698('0x35')](_0x4e87c4[_0xb698('0x47')],_0x5c1103);}_0x4e87c4=_[_0xb698('0x35')]({},_0x4e87c4,_0x46496e[_0xb698('0x36')]);return db[_0xb698('0x3d')][_0xb698('0x4f')]({'where':_0x4e87c4[_0xb698('0x47')]})[_0xb698('0x1b')](function(_0x7fe4a8){_0x29d8ec[_0xb698('0x4f')]=_0x7fe4a8;if(_0x46496e[_0xb698('0x29')][_0xb698('0x33')]){_0x4e87c4['include']=[{'all':!![]}];}return db[_0xb698('0x3d')]['findAll'](_0x4e87c4);})[_0xb698('0x1b')](function(_0x295d80){_0x29d8ec[_0xb698('0x50')]=_0x295d80;return _0x29d8ec;});}})[_0xb698('0x1b')](respondWithFilteredResult(_0x19997d,_0x4e87c4))[_0xb698('0x3a')](handleError(_0x19997d,null));};exports[_0xb698('0x51')]=function(_0xce7111,_0x1631f2){return db[_0xb698('0x21')]['find']({'where':{'id':_0xce7111[_0xb698('0x2d')]['id']}})[_0xb698('0x1b')](handleEntityNotFound(_0x1631f2,null))['then'](function(_0x303e93){if(_0x303e93){return _0x303e93['setTags'](_0xce7111['body'][_0xb698('0x3e')],_[_0xb698('0x52')](_0xce7111['body'],['ids','id'])||{})[_0xb698('0x53')](function(){return db['Tag'][_0xb698('0x27')]({'attributes':['id',_0xb698('0x1f'),_0xb698('0x54')],'where':{'id':_0xce7111[_0xb698('0x39')][_0xb698('0x3e')]}});})[_0xb698('0x1b')](function(_0x5c443e){socket[_0xb698('0x55')]('openchannelInteractionTags:save',{'id':Number(_0xce7111[_0xb698('0x2d')]['id']),'tags':_0x5c443e||[]});return{'id':Number(_0xce7111[_0xb698('0x2d')]['id']),'tags':_0x5c443e||[]};});}})[_0xb698('0x1b')](respondWithResult(_0x1631f2,null))[_0xb698('0x3a')](handleError(_0x1631f2,null));};exports[_0xb698('0x56')]=function(_0x1a9fc2,_0x39733d){return db[_0xb698('0x21')][_0xb698('0x37')]({'where':{'id':_0x1a9fc2[_0xb698('0x2d')]['id']}})[_0xb698('0x1b')](handleEntityNotFound(_0x39733d,null))[_0xb698('0x1b')](function(_0x1cda04){if(_0x1cda04){return _0x1cda04['removeTags'](_0x1a9fc2[_0xb698('0x29')][_0xb698('0x3e')]);}})['then'](respondWithStatusCode(_0x39733d,null))['catch'](handleError(_0x39733d,null));};exports['download']=function(_0x44be28,_0x4327ca){var _0x4a061a=moment()['unix']()[_0xb698('0x57')]();var _0x3944b4=path[_0xb698('0x58')](config[_0xb698('0x59')],_0xb698('0x5a'),_0xb698('0x5b'),_0xb698('0x5c'));var _0x426afe=path[_0xb698('0x58')](config['root'],_0xb698('0x5a'),_0xb698('0x5b'),'attachments');var _0x457481=path[_0xb698('0x58')](_0x3944b4,_0x4a061a);var _0x266d73=util[_0xb698('0x4d')]('transcript-%d-%s.zip',_0x44be28['params']['id'],_0x4a061a);var _0x38d520=path[_0xb698('0x58')](_0x3944b4,_0x266d73);var _0x37ca1c=[];_0x37ca1c[_0xb698('0x5d')]({'model':db[_0xb698('0x5e')],'as':_0xb698('0x5e'),'attributes':['id',_0xb698('0x5f')],'raw':!![]});_0x37ca1c[_0xb698('0x5d')]({'model':db[_0xb698('0x60')],'as':_0xb698('0x61'),'attributes':['id',_0xb698('0x62'),_0xb698('0x63')],'raw':!![]});if(_0x44be28[_0xb698('0x29')][_0xb698('0x64')]){_0x37ca1c[_0xb698('0x5d')]({'model':db[_0xb698('0x65')],'as':_0xb698('0x65'),'raw':!![]});}var _0x2ecd0d=[{'model':db[_0xb698('0x3d')],'as':_0xb698('0x66'),'attributes':['id',_0xb698('0x39'),_0xb698('0x67'),_0xb698('0x68'),_0xb698('0x69'),_0xb698('0x6a')],'include':_0x37ca1c}];_0x2ecd0d[_0xb698('0x5d')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xb698('0x1f')]});_0x2ecd0d[_0xb698('0x5d')]({'model':db[_0xb698('0x5e')],'as':_0xb698('0x6b'),'attributes':['id',_0xb698('0x5f')]});return db[_0xb698('0x21')][_0xb698('0x37')]({'where':{'id':_0x44be28[_0xb698('0x2d')]['id']},'include':_0x2ecd0d})[_0xb698('0x1b')](handleEntityNotFound(_0x4327ca,null))[_0xb698('0x1b')](function(_0x2e0d6b){if(_0x2e0d6b){var _0x4ce356=_0x2e0d6b[_0xb698('0x6c')]({'plain':!![]});fs[_0xb698('0x6d')](_0x457481);var _0x208483={'channel':_0xb698('0x6e'),'account':_0x4ce356[_0xb698('0x6f')]['name'],'agent':_0x4ce356['Owner']?_0x4ce356[_0xb698('0x6b')][_0xb698('0x5f')]:_0xb698('0x70'),'createdAt':moment(_0x4ce356[_0xb698('0x67')])[_0xb698('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb698('0x57')](),'closedAt':_0x4ce356[_0xb698('0x71')]?moment(_0x4ce356['closedAt'])[_0xb698('0x4d')](_0xb698('0x4e'))[_0xb698('0x57')]():'','disposition':_0x4ce356[_0xb698('0x72')],'visibility':_0x4ce356[_0xb698('0x73')]?_0xb698('0x74'):_0xb698('0x75'),'messages':_(_0x4ce356[_0xb698('0x66')])['filter']({'secret':![]})['map'](function(_0x2382df){if(_0x2382df[_0xb698('0x65')]){var _0x4dc790=path[_0xb698('0x58')](_0x426afe,_0x2382df['Attachment'][_0xb698('0x76')]);if(fs[_0xb698('0x77')](_0x4dc790)){fs[_0xb698('0x78')](_0x4dc790)[_0xb698('0x79')](fs['createWriteStream'](path[_0xb698('0x58')](_0x457481,_0x2382df[_0xb698('0x65')][_0xb698('0x76')])));}}return{'date':moment(_0x2382df[_0xb698('0x67')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x2382df[_0xb698('0x68')]==='out'?_0x2382df[_0xb698('0x5e')]?_0x2382df['User'][_0xb698('0x5f')]:_0xb698('0x7a'):_0x2382df[_0xb698('0x61')][_0xb698('0x62')]+(_0x2382df[_0xb698('0x61')]['lastName']?'\x20'+_0x2382df['Contact'][_0xb698('0x63')]:''),'body':_0x2382df[_0xb698('0x65')]?_0x2382df['Attachment']['basename']:_0x2382df[_0xb698('0x39')],'direction':_0x2382df[_0xb698('0x68')]===_0xb698('0x7b')?'A':'C','secret':_0x2382df[_0xb698('0x69')],'read':_0x2382df[_0xb698('0x6a')],'attachment':_0x2382df[_0xb698('0x65')]};})['value']()};return ejs['renderFile'](path['join'](config[_0xb698('0x59')],_0xb698('0x5a'),_0xb698('0x7c'),'downloadInteraction.ejs'),{'interaction':_0x208483})[_0xb698('0x1b')](function(_0x2f2f05){var _0x3794c2=path[_0xb698('0x58')](_0x457481,_0xb698('0x7d')+_0x4ce356['id']+'-'+_0x4a061a+_0xb698('0x7e'));var _0x157744={'path':_0x3794c2,'channel':_0xb698('0x6e'),'interactionId':_0x4ce356['id']};return pdf['createPdfFromHTML'](_0x2f2f05,_0x157744);})[_0xb698('0x1b')](function(){return new Promise(function(_0x487b86,_0xfc42a2){zipdir(_0x457481,{'saveTo':_0x38d520},function(_0x3ae841,_0x1201a6){if(_0x3ae841)return _0xfc42a2(_0x3ae841);return _0x487b86(_0x1201a6);});})['then'](function(){return new Promise(function(_0x58ca6c,_0x1a31fe){rimraf(_0x457481,function(_0x27b0cc){if(_0x27b0cc)_0x1a31fe(_0x27b0cc);return _0x58ca6c();});});})[_0xb698('0x1b')](function(){return _0x4327ca['download'](_0x38d520,_0x266d73,function(_0x337df8){if(_0x337df8){logger[_0xb698('0x1d')](_0xb698('0x7f'),_0x337df8);}else{fs[_0xb698('0x80')](_0x38d520);}});});});}else{return _0x4327ca[_0xb698('0x11')](0xc8);}})[_0xb698('0x3a')](handleError(_0x4327ca,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 32164d3..9b469b7 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 _0x5214=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','then'];(function(_0x464d16,_0x24db2e){var _0x9699b6=function(_0x483f42){while(--_0x483f42){_0x464d16['push'](_0x464d16['shift']());}};_0x9699b6(++_0x24db2e);}(_0x5214,0xf8));var _0x4521=function(_0x431698,_0x50ab3c){_0x431698=_0x431698-0x0;var _0x41c2da=_0x5214[_0x431698];return _0x41c2da;};'use strict';var EventEmitter=require(_0x4521('0x0'));var OpenchannelInteraction=require(_0x4521('0x1'))['db'][_0x4521('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x4521('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4521('0x4')](0x0);var events={'afterCreate':_0x4521('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e00bc){return function(_0x18eb82,_0x1e3897,_0x3ba3eb){_0x18eb82['getUsers']({'attributes':['id'],'raw':!![]})[_0x4521('0x6')](function(_0x2fd6b8){_0x18eb82[_0x4521('0x7')](_0x4521('0x8'),_0x2fd6b8[_0x4521('0x9')](function(_0xebcbc9){return{'id':_0xebcbc9['id']};}));return OpenchannelMessage[_0x4521('0xa')]({'where':{'OpenchannelInteractionId':_0x18eb82['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4521('0x6')](function(_0x1186fa){_0x18eb82[_0x4521('0x7')](_0x4521('0xb'),_0x1186fa[_0x4521('0xc')]);OpenchannelInteractionEvents['emit'](_0x2e00bc+':'+_0x18eb82['id'],_0x18eb82);OpenchannelInteractionEvents[_0x4521('0xd')](_0x2e00bc,_0x18eb82);_0x3ba3eb(null);})[_0x4521('0xe')](_0x3ba3eb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x4521('0xf')](e,emitEvent(event));}}module[_0x4521('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b7a3c59..21c38c6 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 _0xb8bb=['utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0xb80beb,_0x56f5db){var _0x5c92b2=function(_0xc0c343){while(--_0xc0c343){_0xb80beb['push'](_0xb80beb['shift']());}};_0x5c92b2(++_0x56f5db);}(_0xb8bb,0x1a5));var _0xbb8b=function(_0x2e3ea8,_0x546d67){_0x2e3ea8=_0x2e3ea8-0x0;var _0x1ed23f=_0xb8bb[_0x2e3ea8];return _0x1ed23f;};'use strict';var _=require(_0xbb8b('0x0'));var util=require('util');var logger=require(_0xbb8b('0x1'))(_0xbb8b('0x2'));var moment=require('moment');var BPromise=require(_0xbb8b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb8b('0x4'));var rimraf=require(_0xbb8b('0x5'));var config=require(_0xbb8b('0x6'));var attributes=require(_0xbb8b('0x7'));module[_0xbb8b('0x8')]=function(_0x18027f,_0x1416aa){return _0x18027f[_0xbb8b('0x9')](_0xbb8b('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb8b('0xb'),'collate':_0xbb8b('0xc'),'hooks':{'beforeUpdate':function(_0x5e84a9,_0x250a69,_0x37c653){if(_0x5e84a9[_0xbb8b('0xd')](_0xbb8b('0xe'))){_0x5e84a9[_0xbb8b('0xf')]=moment()[_0xbb8b('0x10')](_0xbb8b('0x11'));}_0x37c653(null,_0x5e84a9);}}});}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 9f58ec3..44ce3bb 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 _0x705c=['update','body','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction'];(function(_0x41dd83,_0x4fce8f){var _0x5a837a=function(_0x3727a0){while(--_0x3727a0){_0x41dd83['push'](_0x41dd83['shift']());}};_0x5a837a(++_0x4fce8f);}(_0x705c,0x133));var _0xc705=function(_0x2426db,_0x3604dc){_0x2426db=_0x2426db-0x0;var _0x22e35a=_0x705c[_0x2426db];return _0x22e35a;};'use strict';var _=require(_0xc705('0x0'));var util=require(_0xc705('0x1'));var moment=require(_0xc705('0x2'));var BPromise=require('bluebird');var rs=require(_0xc705('0x3'));var fs=require('fs');var Redis=require(_0xc705('0x4'));var db=require(_0xc705('0x5'))['db'];var utils=require(_0xc705('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc705('0x7'));var jayson=require(_0xc705('0x8'));var client=jayson[_0xc705('0x9')][_0xc705('0xa')]({'port':0x232a});config[_0xc705('0xb')]=_[_0xc705('0xc')](config[_0xc705('0xb')],{'host':_0xc705('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc705('0xb')]));require(_0xc705('0xe'))[_0xc705('0xf')](socket);function respondWithRpcPromise(_0x110a91,_0x286fd3,_0x301a9b){return new BPromise(function(_0x3f295c,_0x3878d7){return client['request'](_0x110a91,_0x301a9b)[_0xc705('0x10')](function(_0x325ba0){logger[_0xc705('0x11')](_0xc705('0x12'),_0x286fd3,_0xc705('0x13'));logger[_0xc705('0x14')](_0xc705('0x15'),_0x286fd3,'request\x20sent',JSON[_0xc705('0x16')](_0x325ba0));if(_0x325ba0[_0xc705('0x17')]){if(_0x325ba0[_0xc705('0x17')][_0xc705('0x18')]===0x1f4){logger[_0xc705('0x17')](_0xc705('0x12'),_0x286fd3,_0x325ba0[_0xc705('0x17')][_0xc705('0x19')]);return _0x3878d7(_0x325ba0[_0xc705('0x17')][_0xc705('0x19')]);}logger[_0xc705('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x286fd3,_0x325ba0[_0xc705('0x17')][_0xc705('0x19')]);return _0x3f295c(_0x325ba0['error'][_0xc705('0x19')]);}else{logger[_0xc705('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x286fd3,_0xc705('0x13'));_0x3f295c(_0x325ba0[_0xc705('0x1a')][_0xc705('0x19')]);}})['catch'](function(_0x10de24){logger[_0xc705('0x17')](_0xc705('0x12'),_0x286fd3,_0x10de24);_0x3878d7(_0x10de24);});});}exports[_0xc705('0x1b')]=function(_0x3b1761){var _0xebb719=this;return new Promise(function(_0x46f1d3,_0x117682){return db[_0xc705('0x1c')][_0xc705('0x1d')](_0x3b1761[_0xc705('0x1e')],{'raw':_0x3b1761[_0xc705('0x1f')]?_0x3b1761[_0xc705('0x1f')][_0xc705('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b1761[_0xc705('0x1f')]?_0x3b1761[_0xc705('0x1f')][_0xc705('0x21')]||null:null,'attributes':_0x3b1761[_0xc705('0x1f')]?_0x3b1761[_0xc705('0x1f')][_0xc705('0x22')]||null:null,'limit':_0x3b1761[_0xc705('0x1f')]?_0x3b1761[_0xc705('0x1f')][_0xc705('0x23')]||null:null})['then'](function(_0x18fa6b){logger[_0xc705('0x11')](_0xc705('0x1b'),_0x3b1761);logger[_0xc705('0x14')](_0xc705('0x1b'),_0x3b1761,JSON[_0xc705('0x16')](_0x18fa6b));_0x46f1d3(_0x18fa6b);})[_0xc705('0x24')](function(_0x2779cd){logger[_0xc705('0x17')](_0xc705('0x1b'),_0x2779cd['message'],_0x3b1761);_0x117682(_0xebb719[_0xc705('0x17')](0x1f4,_0x2779cd[_0xc705('0x19')]));});});};exports[_0xc705('0x25')]=function(_0x2107f8){return new Promise(function(_0x591e69,_0x5d8545){return db[_0xc705('0x1c')][_0xc705('0x26')]({'where':_0x2107f8[_0xc705('0x1f')]?_0x2107f8[_0xc705('0x1f')][_0xc705('0x21')]||null:null})['then'](function(_0x162772){if(_0x162772){return _0x162772[_0xc705('0x27')](_0x2107f8[_0xc705('0x1e')][_0xc705('0x28')],_['omit'](_0x2107f8['body'],[_0xc705('0x28'),'id'])||{});}})['spread'](function(_0x2a8b40){logger[_0xc705('0x11')]('AddTags',_0x2107f8);logger['debug'](_0xc705('0x29'),_0x2107f8,JSON[_0xc705('0x16')](_0x2a8b40));_0x591e69(_0x2a8b40);})[_0xc705('0x24')](function(_0xe79cd2){logger['error']('AddTags',_0xe79cd2['message'],_0x2107f8);_0x5d8545(_this[_0xc705('0x17')](0x1f4,_0xe79cd2[_0xc705('0x19')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 295adb0..98cb40d 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 _0x4399=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener'];(function(_0x180a9c,_0x51b525){var _0x45b75b=function(_0x38cc53){while(--_0x38cc53){_0x180a9c['push'](_0x180a9c['shift']());}};_0x45b75b(++_0x51b525);}(_0x4399,0x1cb));var _0x9439=function(_0x16c33d,_0x2ac487){_0x16c33d=_0x16c33d-0x0;var _0x1a255c=_0x4399[_0x16c33d];return _0x1a255c;};'use strict';var OpenchannelInteractionEvents=require(_0x9439('0x0'));var events=[_0x9439('0x1'),_0x9439('0x2'),_0x9439('0x3')];function createListener(_0x53953c,_0xedaee1){return function(_0x1ca260){_0xedaee1['emit'](_0x53953c,_0x1ca260);};}function removeListener(_0xfcbba9,_0x3c768f){return function(){OpenchannelInteractionEvents[_0x9439('0x4')](_0xfcbba9,_0x3c768f);};}exports[_0x9439('0x5')]=function(_0x36055f){for(var _0x3824b7=0x0,_0x11f8b2=events[_0x9439('0x6')];_0x3824b7<_0x11f8b2;_0x3824b7++){var _0x955ee8=events[_0x3824b7];var _0x2aaec9=createListener(_0x9439('0x7')+_0x955ee8,_0x36055f);OpenchannelInteractionEvents['on'](_0x955ee8,_0x2aaec9);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 07e26b0..d335033 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x1556c7,_0x204ce5){var _0x825624=function(_0x425949){while(--_0x425949){_0x1556c7['push'](_0x1556c7['shift']());}};_0x825624(++_0x204ce5);}(_0xe706,0xa3));var _0x6e70=function(_0x39d9ec,_0x4ed6e5){_0x39d9ec=_0x39d9ec-0x0;var _0x499ff0=_0xe706[_0x39d9ec];return _0x499ff0;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2b391c3..9fc62c4 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 _0xd523=['medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x274598,_0x1e5206){var _0x4c0878=function(_0x1f2f12){while(--_0x1f2f12){_0x274598['push'](_0x274598['shift']());}};_0x4c0878(++_0x1e5206);}(_0xd523,0x153));var _0x3d52=function(_0x42e120,_0x1fd47d){_0x42e120=_0x42e120-0x0;var _0x554939=_0xd523[_0x42e120];return _0x554939;};'use strict';var Sequelize=require(_0x3d52('0x0'));module[_0x3d52('0x1')]={'body':{'type':Sequelize[_0x3d52('0x2')](_0x3d52('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3d52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3d52('0x5')]('in',_0x3d52('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3d52('0x7')]},'providerName':{'type':Sequelize[_0x3d52('0x8')]},'providerResponse':{'type':Sequelize[_0x3d52('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c625e56..103978d 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 _0x7f9c=['null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','openchannel-interactions','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','interaction','role'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7f9c,0x9c));var _0xc7f9=function(_0x2fd82b,_0x26d7e0){_0x2fd82b=_0x2fd82b-0x0;var _0x5bbaa7=_0x7f9c[_0x2fd82b];return _0x5bbaa7;};'use strict';var emlformat=require(_0xc7f9('0x0'));var rimraf=require(_0xc7f9('0x1'));var zipdir=require(_0xc7f9('0x2'));var jsonpatch=require(_0xc7f9('0x3'));var rp=require(_0xc7f9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc7f9('0x5'));var sox=require(_0xc7f9('0x6'));var csv=require('to-csv');var ejs=require(_0xc7f9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc7f9('0x8'));var squel=require(_0xc7f9('0x9'));var crypto=require(_0xc7f9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc7f9('0xb'));var toCsv=require(_0xc7f9('0xc'));var querystring=require(_0xc7f9('0xd'));var Papa=require(_0xc7f9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc7f9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7f9('0x10'))(_0xc7f9('0x11'));var utils=require(_0xc7f9('0x12'));var config=require(_0xc7f9('0x13'));var licenseUtil=require(_0xc7f9('0x14'));var db=require(_0xc7f9('0x15'))['db'];config[_0xc7f9('0x16')]=_['defaults'](config[_0xc7f9('0x16')],{'host':_0xc7f9('0x17'),'port':0x18eb});var socket=require(_0xc7f9('0x18'))(new Redis(config[_0xc7f9('0x16')]));require(_0xc7f9('0x19'))[_0xc7f9('0x1a')](socket);var jayson=require(_0xc7f9('0x1b'));var client=jayson[_0xc7f9('0x1c')][_0xc7f9('0x1d')]({'port':0x232c});var client9002=jayson[_0xc7f9('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5136,_0x43b57e,_0x4896ad,_0x21d6f6){return new BPromise(function(_0xc2be79,_0x108f0d){var _0x173015=_0x21d6f6||client;return _0x173015[_0xc7f9('0x1e')](_0x5d5136,_0x4896ad)['then'](function(_0x42ffc9){logger[_0xc7f9('0x1f')](_0xc7f9('0x20'),_0x43b57e,_0xc7f9('0x21'));logger[_0xc7f9('0x22')](_0xc7f9('0x23'),_0x43b57e,_0xc7f9('0x21'),JSON[_0xc7f9('0x24')](_0x42ffc9));if(_0x42ffc9[_0xc7f9('0x25')]){if(_0x42ffc9[_0xc7f9('0x25')][_0xc7f9('0x26')]===0x1f4){logger[_0xc7f9('0x25')](_0xc7f9('0x20'),_0x43b57e,_0x42ffc9[_0xc7f9('0x25')][_0xc7f9('0x27')]);return _0x108f0d(_0x42ffc9[_0xc7f9('0x25')][_0xc7f9('0x27')]);}logger[_0xc7f9('0x25')](_0xc7f9('0x20'),_0x43b57e,_0x42ffc9[_0xc7f9('0x25')][_0xc7f9('0x27')]);return _0xc2be79(_0x42ffc9[_0xc7f9('0x25')][_0xc7f9('0x27')]);}else{logger[_0xc7f9('0x1f')](_0xc7f9('0x20'),_0x43b57e,_0xc7f9('0x21'));_0xc2be79(_0x42ffc9['result'][_0xc7f9('0x27')]);}})['catch'](function(_0x3b1f0c){logger['error'](_0xc7f9('0x20'),_0x43b57e,_0x3b1f0c);_0x108f0d(_0x3b1f0c);});});}function respondWithStatusCode(_0x3bfbab,_0x453310){_0x453310=_0x453310||0xcc;return function(_0x1f8e1d){if(_0x1f8e1d){return _0x3bfbab[_0xc7f9('0x28')](_0x453310);}return _0x3bfbab[_0xc7f9('0x29')](_0x453310)[_0xc7f9('0x2a')]();};}function respondWithResult(_0x51e425,_0x36eb11){_0x36eb11=_0x36eb11||0xc8;return function(_0x9ee487){if(_0x9ee487){return _0x51e425[_0xc7f9('0x29')](_0x36eb11)[_0xc7f9('0x2b')](_0x9ee487);}};}function respondWithFilteredResult(_0x44bdc7,_0x4b5804){return function(_0x305db4){if(_0x305db4){var _0xf3699b=typeof _0x4b5804[_0xc7f9('0x2c')]===_0xc7f9('0x2d')&&typeof _0x4b5804[_0xc7f9('0x2e')]==='undefined';var _0xe95904=_0x305db4['count'];var _0xb06996=_0xf3699b?0x0:_0x4b5804[_0xc7f9('0x2c')];var _0x157456=_0xf3699b?_0x305db4[_0xc7f9('0x2f')]:_0x4b5804[_0xc7f9('0x2c')]+_0x4b5804[_0xc7f9('0x2e')];var _0x14f909;if(_0x157456>=_0xe95904){_0x157456=_0xe95904;_0x14f909=0xc8;}else{_0x14f909=0xce;}_0x44bdc7[_0xc7f9('0x29')](_0x14f909);return _0x44bdc7[_0xc7f9('0x30')](_0xc7f9('0x31'),_0xb06996+'-'+_0x157456+'/'+_0xe95904)['json'](_0x305db4);}return null;};}function patchUpdates(_0x4f1992){return function(_0x1d209c){try{jsonpatch[_0xc7f9('0x32')](_0x1d209c,_0x4f1992,!![]);}catch(_0x1127b8){return BPromise[_0xc7f9('0x33')](_0x1127b8);}return _0x1d209c[_0xc7f9('0x34')]();};}function saveUpdates(_0x2ca9ee,_0x5b1e23){return function(_0x489232){if(_0x489232){return _0x489232['update'](_0x2ca9ee)[_0xc7f9('0x35')](function(_0x268419){return _0x268419;});}return null;};}function removeEntity(_0xe80a31,_0x209604){return function(_0x8588a3){if(_0x8588a3){return _0x8588a3[_0xc7f9('0x36')]()[_0xc7f9('0x35')](function(){_0xe80a31[_0xc7f9('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d5b9,_0x193ca4){return function(_0x3ed660){if(!_0x3ed660){_0x28d5b9[_0xc7f9('0x28')](0x194);}return _0x3ed660;};}function handleError(_0x1baa51,_0x314858){_0x314858=_0x314858||0x1f4;return function(_0x5a4aae){logger[_0xc7f9('0x25')](_0x5a4aae[_0xc7f9('0x37')]);if(_0x5a4aae['name']){delete _0x5a4aae[_0xc7f9('0x38')];}_0x1baa51[_0xc7f9('0x29')](_0x314858)[_0xc7f9('0x39')](_0x5a4aae);};}exports[_0xc7f9('0x3a')]=function(_0x4792ea,_0x46cc53){var _0x7ea601={},_0xcd64c={},_0x1b890b={'count':0x0,'rows':[]};var _0x32aa17=_[_0xc7f9('0x3b')](db['OpenchannelMessage'][_0xc7f9('0x3c')],function(_0x2fd9a1){return{'name':_0x2fd9a1['fieldName'],'type':_0x2fd9a1[_0xc7f9('0x3d')][_0xc7f9('0x3e')]};});_0xcd64c[_0xc7f9('0x3f')]=_[_0xc7f9('0x3b')](_0x32aa17,'name');_0xcd64c[_0xc7f9('0x40')]=_['keys'](_0x4792ea[_0xc7f9('0x40')]);_0xcd64c[_0xc7f9('0x41')]=_[_0xc7f9('0x42')](_0xcd64c[_0xc7f9('0x3f')],_0xcd64c['query']);_0x7ea601[_0xc7f9('0x43')]=_['intersection'](_0xcd64c[_0xc7f9('0x3f')],qs[_0xc7f9('0x44')](_0x4792ea['query'][_0xc7f9('0x44')]));_0x7ea601[_0xc7f9('0x43')]=_0x7ea601[_0xc7f9('0x43')][_0xc7f9('0x45')]?_0x7ea601[_0xc7f9('0x43')]:_0xcd64c[_0xc7f9('0x3f')];if(!_0x4792ea[_0xc7f9('0x40')][_0xc7f9('0x46')](_0xc7f9('0x47'))){_0x7ea601['limit']=qs[_0xc7f9('0x2e')](_0x4792ea['query']['limit']);_0x7ea601[_0xc7f9('0x2c')]=qs['offset'](_0x4792ea[_0xc7f9('0x40')][_0xc7f9('0x2c')]);}_0x7ea601[_0xc7f9('0x48')]=qs[_0xc7f9('0x49')](_0x4792ea[_0xc7f9('0x40')][_0xc7f9('0x49')]);_0x7ea601[_0xc7f9('0x4a')]=qs[_0xc7f9('0x41')](_['pick'](_0x4792ea[_0xc7f9('0x40')],_0xcd64c[_0xc7f9('0x41')]),_0x32aa17);if(_0x4792ea[_0xc7f9('0x40')][_0xc7f9('0x4b')]){_0x7ea601['where']=_[_0xc7f9('0x4c')](_0x7ea601[_0xc7f9('0x4a')],{'$or':_['map'](_0x32aa17,function(_0x1fe0c2){if(_0x1fe0c2[_0xc7f9('0x3d')]!==_0xc7f9('0x4d')){var _0x9992ee={};_0x9992ee[_0x1fe0c2[_0xc7f9('0x38')]]={'$like':'%'+_0x4792ea[_0xc7f9('0x40')][_0xc7f9('0x4b')]+'%'};return _0x9992ee;}})});}_0x7ea601=_[_0xc7f9('0x4c')]({},_0x7ea601,_0x4792ea[_0xc7f9('0x4e')]);var _0x3e59b5={'where':_0x7ea601['where']};return db[_0xc7f9('0x4f')][_0xc7f9('0x2f')](_0x3e59b5)['then'](function(_0x3970ee){_0x1b890b[_0xc7f9('0x2f')]=_0x3970ee;if(_0x4792ea[_0xc7f9('0x40')][_0xc7f9('0x50')]){_0x7ea601[_0xc7f9('0x51')]=[{'all':!![]}];}return db[_0xc7f9('0x4f')][_0xc7f9('0x52')](_0x7ea601);})[_0xc7f9('0x35')](function(_0x1ef198){_0x1b890b['rows']=_0x1ef198;return _0x1b890b;})['then'](respondWithFilteredResult(_0x46cc53,_0x7ea601))[_0xc7f9('0x53')](handleError(_0x46cc53,null));};exports[_0xc7f9('0x54')]=function(_0x1a46ee,_0x2e246c){var _0x326702={'raw':!![],'where':{'id':_0x1a46ee['params']['id']}},_0x10d4e6={};_0x10d4e6[_0xc7f9('0x3f')]=_['keys'](db[_0xc7f9('0x4f')]['rawAttributes']);_0x10d4e6[_0xc7f9('0x40')]=_[_0xc7f9('0x55')](_0x1a46ee['query']);_0x10d4e6[_0xc7f9('0x41')]=_['intersection'](_0x10d4e6[_0xc7f9('0x3f')],_0x10d4e6['query']);_0x326702[_0xc7f9('0x43')]=_[_0xc7f9('0x42')](_0x10d4e6['model'],qs[_0xc7f9('0x44')](_0x1a46ee[_0xc7f9('0x40')][_0xc7f9('0x44')]));_0x326702['attributes']=_0x326702[_0xc7f9('0x43')]['length']?_0x326702[_0xc7f9('0x43')]:_0x10d4e6[_0xc7f9('0x3f')];if(_0x1a46ee[_0xc7f9('0x40')][_0xc7f9('0x50')]){_0x326702[_0xc7f9('0x51')]=[{'all':!![]}];}_0x326702=_[_0xc7f9('0x4c')]({},_0x326702,_0x1a46ee[_0xc7f9('0x4e')]);return db[_0xc7f9('0x4f')][_0xc7f9('0x56')](_0x326702)[_0xc7f9('0x35')](handleEntityNotFound(_0x2e246c,null))[_0xc7f9('0x35')](respondWithResult(_0x2e246c,null))[_0xc7f9('0x53')](handleError(_0x2e246c,null));};exports[_0xc7f9('0x57')]=function(_0x3d6fb8,_0x25f692){return db[_0xc7f9('0x4f')][_0xc7f9('0x57')](_0x3d6fb8[_0xc7f9('0x58')],{})[_0xc7f9('0x35')](respondWithResult(_0x25f692,0xc9))[_0xc7f9('0x53')](handleError(_0x25f692,null));};exports['update']=function(_0x24103e,_0x3a1763){if(_0x24103e[_0xc7f9('0x58')]['id']){delete _0x24103e['body']['id'];}return db[_0xc7f9('0x4f')][_0xc7f9('0x56')]({'where':{'id':_0x24103e[_0xc7f9('0x59')]['id']}})[_0xc7f9('0x35')](handleEntityNotFound(_0x3a1763,null))[_0xc7f9('0x35')](saveUpdates(_0x24103e['body'],null))[_0xc7f9('0x35')](respondWithResult(_0x3a1763,null))[_0xc7f9('0x53')](handleError(_0x3a1763,null));};exports[_0xc7f9('0x36')]=function(_0x3fd64b,_0x1ee1a4){return db[_0xc7f9('0x4f')][_0xc7f9('0x56')]({'where':{'id':_0x3fd64b[_0xc7f9('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ee1a4,null))[_0xc7f9('0x35')](removeEntity(_0x1ee1a4,null))[_0xc7f9('0x53')](handleError(_0x1ee1a4,null));};exports[_0xc7f9('0x5a')]=function(_0x4ca3cb,_0x5d2cdb){return db[_0xc7f9('0x4f')][_0xc7f9('0x5a')]()['then'](respondWithResult(_0x5d2cdb,null))[_0xc7f9('0x53')](handleError(_0x5d2cdb,null));};var interaction_log=require(_0xc7f9('0x10'))('openchannel-interactions');exports['accept']=function(_0x36d07f,_0x4bf650,_0x2116d3){var _0xe3124f={'agent':{},'channel':_0xc7f9('0x5b')};if(_0x36d07f[_0xc7f9('0x58')]['id']){delete _0x36d07f[_0xc7f9('0x58')]['id'];}_0x36d07f[_0xc7f9('0x58')][_0xc7f9('0x5c')]=!![];_0x36d07f[_0xc7f9('0x58')]['readAt']=moment()[_0xc7f9('0x5d')](_0xc7f9('0x5e'));_0x36d07f['body'][_0xc7f9('0x5f')]=_0x36d07f['body'][_0xc7f9('0x5f')]||_0x36d07f[_0xc7f9('0x60')]['id'];_0xe3124f[_0xc7f9('0x61')]['id']=_0x36d07f['body'][_0xc7f9('0x5f')];return db[_0xc7f9('0x4f')][_0xc7f9('0x56')]({'where':{'id':_0x36d07f[_0xc7f9('0x59')]['id'],'UserId':null}})[_0xc7f9('0x35')](handleEntityNotFound(_0x4bf650,null))[_0xc7f9('0x35')](saveUpdates(_0x36d07f[_0xc7f9('0x58')],null))[_0xc7f9('0x35')](function(_0xcf4431){if(_0xcf4431){_0xe3124f[_0xc7f9('0x27')]=_0xcf4431[_0xc7f9('0x62')]({'plain':!![]});return db[_0xc7f9('0x63')][_0xc7f9('0x56')]({'where':{'id':_0xcf4431[_0xc7f9('0x64')]}});}return null;})[_0xc7f9('0x35')](handleEntityNotFound(_0x4bf650,null))[_0xc7f9('0x35')](function(_0x34726c){if(_0x34726c){return _0x34726c[_0xc7f9('0x65')]({'UserId':_0x36d07f[_0xc7f9('0x58')][_0xc7f9('0x5f')],'read1stAt':_[_0xc7f9('0x66')](_0x34726c[_0xc7f9('0x67')])?moment()[_0xc7f9('0x5d')](_0xc7f9('0x5e')):undefined});}return null;})[_0xc7f9('0x35')](function(_0x3f88a7){if(_0x3f88a7){_0xe3124f[_0xc7f9('0x68')]=_0x3f88a7[_0xc7f9('0x62')]({'plain':!![]});interaction_log[_0xc7f9('0x1f')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x36d07f['user']['id'],_0x36d07f[_0xc7f9('0x60')][_0xc7f9('0x38')],_0x36d07f[_0xc7f9('0x60')][_0xc7f9('0x69')],_0xe3124f['interaction']['id'],_0x36d07f['body']?JSON[_0xc7f9('0x24')](_0x36d07f[_0xc7f9('0x58')]):_0xc7f9('0x6a'));return respondWithRpcPromise(_0xc7f9('0x6b'),'acceptMessage',_0xe3124f);}return null;})[_0xc7f9('0x35')](function(_0x2abdad){var _0x1fcdca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2abdad[_0xc7f9('0x27')][_0xc7f9('0x6c')];return db[_0xc7f9('0x6d')][_0xc7f9('0x40')](_0x1fcdca,{'type':db[_0xc7f9('0x6e')][_0xc7f9('0x6f')][_0xc7f9('0x70')],'raw':!![]})[_0xc7f9('0x35')](function(_0x333ef9){return _0x333ef9;});})[_0xc7f9('0x35')](function(_0x5502b9){if(_0x5502b9){_0xe3124f['message'][_0xc7f9('0x71')]=_0x5502b9[0x0];if(!_0x36d07f[_0xc7f9('0x58')][_0xc7f9('0x5f')])return;return db['User']['find']({'where':{'id':_0x36d07f[_0xc7f9('0x58')]['UserId'],'role':_0xc7f9('0x61')},'attributes':['id',_0xc7f9('0x38'),_0xc7f9('0x72'),_0xc7f9('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1ec4fd){if(!_0x1ec4fd)return null;_0xe3124f[_0xc7f9('0x27')][_0xc7f9('0x61')]=_0x1ec4fd;return _0xe3124f;})[_0xc7f9('0x35')](function(_0x2e9e09){if(_0x2e9e09){if(_0x36d07f[_0xc7f9('0x58')][_0xc7f9('0x74')]){_0xe3124f[_0xc7f9('0x27')][_0xc7f9('0x75')]=util['format'](_0xc7f9('0x76'),_0x36d07f['user'][_0xc7f9('0x38')]);_0xe3124f['message'][_0xc7f9('0x77')]=_0xe3124f[_0xc7f9('0x77')];_0xe3124f[_0xc7f9('0x27')][_0xc7f9('0x78')]=_0xe3124f[_0xc7f9('0x77')];_0xe3124f[_0xc7f9('0x27')][_0xc7f9('0x79')]=_0xc7f9('0x7a');return respondWithRpcPromise('EventManager',_0xc7f9('0x7b'),{'event':_0xc7f9('0x7c'),'message':_0xe3124f[_0xc7f9('0x27')]},client9002)[_0xc7f9('0x35')](function(){return _0xe3124f;});}return _0xe3124f;}return null;})[_0xc7f9('0x35')](respondWithResult(_0x4bf650,null))['catch'](handleError(_0x4bf650,null));};var interaction_log=require(_0xc7f9('0x10'))(_0xc7f9('0x7d'));exports[_0xc7f9('0x33')]=function(_0x29a3d7,_0xdbbd48,_0x41ecf6){var _0x1a000d={'agent':{},'channel':_0xc7f9('0x5b')};if(_0x29a3d7[_0xc7f9('0x58')]['id']){delete _0x29a3d7[_0xc7f9('0x58')]['id'];}_0x29a3d7['body']['UserId']=_0x29a3d7[_0xc7f9('0x58')][_0xc7f9('0x5f')]||_0x29a3d7[_0xc7f9('0x60')]['id'];_0x1a000d[_0xc7f9('0x61')]['id']=_0x29a3d7['body'][_0xc7f9('0x5f')];return db[_0xc7f9('0x4f')]['find']({'where':{'id':_0x29a3d7[_0xc7f9('0x59')]['id'],'UserId':null}})[_0xc7f9('0x35')](handleEntityNotFound(_0xdbbd48,null))['then'](function(_0x1d370b){if(_0x1d370b){_0x1a000d['message']=_0x1d370b[_0xc7f9('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc7f9('0x56')]({'where':{'id':_0x1d370b[_0xc7f9('0x64')]}});}return null;})[_0xc7f9('0x35')](handleEntityNotFound(_0xdbbd48,null))[_0xc7f9('0x35')](function(_0xf2e263){if(_0xf2e263){_0x1a000d[_0xc7f9('0x68')]=_0xf2e263['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29a3d7[_0xc7f9('0x60')]['id'],_0x29a3d7['user']['name'],_0x29a3d7[_0xc7f9('0x60')][_0xc7f9('0x69')],_0x1a000d['interaction']['id'],_0x29a3d7[_0xc7f9('0x58')]?JSON[_0xc7f9('0x24')](_0x29a3d7['body']):_0xc7f9('0x6a'));return respondWithRpcPromise(_0xc7f9('0x7e'),'rejectMessage',_0x1a000d);}return null;})[_0xc7f9('0x35')](function(_0x3b0ba8){var _0x1ce18b=_0xc7f9('0x7f')+_0x3b0ba8[_0xc7f9('0x27')][_0xc7f9('0x6c')];return db[_0xc7f9('0x6d')]['query'](_0x1ce18b,{'type':db[_0xc7f9('0x6e')][_0xc7f9('0x6f')][_0xc7f9('0x70')],'raw':!![]})['then'](function(_0x350174){return _0x350174;});})[_0xc7f9('0x35')](function(_0x15bfbd){if(_0x15bfbd){_0x1a000d[_0xc7f9('0x27')]['contact']=_0x15bfbd[0x0];if(!_0x29a3d7[_0xc7f9('0x58')][_0xc7f9('0x5f')])return;return db[_0xc7f9('0x80')][_0xc7f9('0x56')]({'where':{'id':_0x29a3d7[_0xc7f9('0x58')][_0xc7f9('0x5f')],'role':_0xc7f9('0x61')},'attributes':['id',_0xc7f9('0x38'),'fullname',_0xc7f9('0x73'),_0xc7f9('0x81')],'raw':!![]});}return null;})[_0xc7f9('0x35')](function(_0x5175b6){if(!_0x5175b6)return null;_0x1a000d[_0xc7f9('0x27')][_0xc7f9('0x61')]=_0x5175b6;return _0x1a000d;})['then'](function(_0x3d4c2e){if(_0x3d4c2e){_0x3d4c2e[_0xc7f9('0x27')][_0xc7f9('0x75')]=util[_0xc7f9('0x5d')](_0xc7f9('0x76'),_0x29a3d7[_0xc7f9('0x60')][_0xc7f9('0x38')]);_0x3d4c2e['message']['channel']=_0x1a000d[_0xc7f9('0x77')];_0x3d4c2e[_0xc7f9('0x27')][_0xc7f9('0x78')]=_0x1a000d[_0xc7f9('0x77')];_0x3d4c2e[_0xc7f9('0x27')]['event']=_0xc7f9('0x33');respondWithRpcPromise(_0xc7f9('0x7b'),_0xc7f9('0x7b'),{'event':_0xc7f9('0x82'),'message':_0x3d4c2e[_0xc7f9('0x27')]},client9002);return _0x1a000d;}return null;})[_0xc7f9('0x35')](respondWithResult(_0xdbbd48,null))[_0xc7f9('0x53')](handleError(_0xdbbd48,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 748ecaa..d9812f0 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 _0x371b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x291aaf,_0x4c6d8d){var _0x5571e6=function(_0x1b4fec){while(--_0x1b4fec){_0x291aaf['push'](_0x291aaf['shift']());}};_0x5571e6(++_0x4c6d8d);}(_0x371b,0x1a8));var _0xb371=function(_0x4be6f4,_0x385b23){_0x4be6f4=_0x4be6f4-0x0;var _0x3e9098=_0x371b[_0x4be6f4];return _0x3e9098;};'use strict';var EventEmitter=require(_0xb371('0x0'));var OpenchannelMessage=require(_0xb371('0x1'))['db'][_0xb371('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb371('0x3')](0x0);var events={'afterCreate':_0xb371('0x4'),'afterUpdate':_0xb371('0x5'),'afterDestroy':_0xb371('0x6')};function emitEvent(_0x268b7b){return function(_0x39c1b6,_0x4db587,_0xec2229){OpenchannelMessageEvents[_0xb371('0x7')](_0x268b7b+':'+_0x39c1b6['id'],_0x39c1b6);OpenchannelMessageEvents[_0xb371('0x7')](_0x268b7b,_0x39c1b6);_0xec2229(null);};}for(var e in events){if(events[_0xb371('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xb371('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 013adf3..c3cdb98 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 _0x01b2=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','update','createdAt','catch','error','secret','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0x01b2,0x104));var _0x201b=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x01b2[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0x201b('0x0'));var util=require(_0x201b('0x1'));var logger=require(_0x201b('0x2'))('api');var moment=require(_0x201b('0x3'));var BPromise=require(_0x201b('0x4'));var rp=require(_0x201b('0x5'));var fs=require('fs');var path=require(_0x201b('0x6'));var rimraf=require(_0x201b('0x7'));var config=require(_0x201b('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0x201b('0x9')]=function(_0x4a50ad,_0x54f4fb){return _0x4a50ad[_0x201b('0xa')](_0x201b('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x201b('0xc')],'type':_0x201b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10ec1f,_0x4bb378,_0x28031e){var _0x494311=_0x4a50ad['models'];var _0x57b0fb=_0x10ec1f[_0x201b('0xe')]({'plain':!![]});if(_0x57b0fb[_0x201b('0xf')][_0x201b('0x10')]()==='in'||_0x57b0fb[_0x201b('0xf')]['toLowerCase']()===_0x201b('0x11')&&!_0x57b0fb['secret']&&!_[_0x201b('0x12')](_0x57b0fb[_0x201b('0x13')])){_0x494311['OpenchannelInteraction']['findOne']({'where':{'id':_0x57b0fb['OpenchannelInteractionId']}})['then'](function(_0x48f705){if(_0x48f705){_0x48f705[_0x201b('0x14')]({'lastMsgAt':_0x57b0fb[_0x201b('0x15')],'lastMsgDirection':_0x57b0fb[_0x201b('0xf')][_0x201b('0x10')]()});}})[_0x201b('0x16')](function(_0x562379){console[_0x201b('0x17')](_0x562379);});}if(_0x57b0fb[_0x201b('0xf')]===_0x201b('0x11')&&!_0x57b0fb[_0x201b('0x18')]){var _0x3424c6;_0x494311[_0x201b('0x19')][_0x201b('0x1a')]()[_0x201b('0x1b')](function(_0x3123c1){return _0x494311[_0x201b('0x1c')][_0x201b('0x1d')]({'where':{'id':_0x57b0fb[_0x201b('0x1e')]},'include':[{'model':_0x494311[_0x201b('0x1f')],'as':_0x201b('0x20'),'where':{'id':_0x57b0fb[_0x201b('0x21')]},'limit':0x1,'include':[{'model':_0x494311[_0x201b('0x19')],'as':_0x201b('0x22'),'attributes':_[_0x201b('0x23')](_0x3123c1)}]}]});})[_0x201b('0x1b')](function(_0x4dde1f){_0x3424c6=_0x4dde1f[_0x201b('0xe')]({'plain':!![]});if(_0x3424c6&&_0x3424c6[_0x201b('0x24')]){logger[_0x201b('0x25')](_0x201b('0x26'),_0x201b('0x27'),util[_0x201b('0x28')](_0x201b('0x29'),_0x57b0fb['id'],_0x3424c6[_0x201b('0x24')]));if(_0x3424c6[_0x201b('0x20')]&&_0x3424c6[_0x201b('0x20')][_0x201b('0x2a')]){_0x57b0fb[_0x201b('0x2b')]=_['omit'](_0x3424c6[_0x201b('0x20')][0x0],_0x201b('0x22'));_0x57b0fb[_0x201b('0x22')]=_0x3424c6[_0x201b('0x20')][0x0][_0x201b('0x22')];}var _0x4bb378={'method':_0x201b('0x2c'),'uri':encodeURI(_0x3424c6['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4bb378[_0x201b('0x2d')]){case _0x201b('0x2e'):_0x4bb378['qs']=_0x57b0fb;break;case _0x201b('0x2c'):_0x4bb378[_0x201b('0xc')]=_0x57b0fb;break;}return rp(_0x4bb378)[_0x201b('0x1b')](function(_0x47c931){logger[_0x201b('0x25')](_0x201b('0x26'),_0x201b('0x27'),util[_0x201b('0x28')](_0x201b('0x2f'),_0x57b0fb['id'],_0x3424c6[_0x201b('0x24')]));if(_0x47c931[_0x201b('0xc')][_0x201b('0x30')]&&_0x47c931[_0x201b('0xc')][_0x201b('0x30')]!=_0x57b0fb[_0x201b('0x2b')]['threadId']){return _0x494311[_0x201b('0x1f')][_0x201b('0x14')]({'threadId':_0x47c931[_0x201b('0xc')][_0x201b('0x30')]},{'where':{'id':_0x57b0fb[_0x201b('0x2b')]['id']}});}else{return;}})[_0x201b('0x1b')](function(){return _0x10ec1f[_0x201b('0x14')]({'read':!![]});})[_0x201b('0x16')](function(_0xe4ad2c){logger[_0x201b('0x17')](_0x201b('0x26'),_0x201b('0x27'),util[_0x201b('0x31')](_0xe4ad2c,{'showHidden':![],'depth':null}));_0x28031e();});}else{_0x28031e();}})[_0x201b('0x32')](function(){_0x28031e();});}else{_0x28031e();}}},'charset':_0x201b('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 3270909..ee45423 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0xdd57d2,_0x437799){var _0x426d85=function(_0x172b9c){while(--_0x172b9c){_0xdd57d2['push'](_0xdd57d2['shift']());}};_0x426d85(++_0x437799);}(_0xdb28,0x106));var _0x8db2=function(_0xf0fadd,_0x42ff38){_0xf0fadd=_0xf0fadd-0x0;var _0x640aa7=_0xdb28[_0xf0fadd];return _0x640aa7;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index f1a34e4..7e3b457 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 _0x7dee=['length','openchannelMessage:','./openchannelMessage.events','remove','emit','register'];(function(_0x15f455,_0x1ec373){var _0x45f542=function(_0x2b29f7){while(--_0x2b29f7){_0x15f455['push'](_0x15f455['shift']());}};_0x45f542(++_0x1ec373);}(_0x7dee,0xb0));var _0xe7de=function(_0x12cdd0,_0x4a0a95){_0x12cdd0=_0x12cdd0-0x0;var _0x425cc5=_0x7dee[_0x12cdd0];return _0x425cc5;};'use strict';var OpenchannelMessageEvents=require(_0xe7de('0x0'));var events=['save',_0xe7de('0x1'),'update'];function createListener(_0x3aade6,_0x1ab333){return function(_0x168f3b){_0x1ab333[_0xe7de('0x2')](_0x3aade6,_0x168f3b);};}function removeListener(_0x4b846b,_0x12be83){return function(){OpenchannelMessageEvents['removeListener'](_0x4b846b,_0x12be83);};}exports[_0xe7de('0x3')]=function(_0x19f79d){for(var _0x26a524=0x0,_0x17515b=events[_0xe7de('0x4')];_0x26a524<_0x17515b;_0x26a524++){var _0x392168=events[_0x26a524];var _0x52753f=createListener(_0xe7de('0x5')+_0x392168,_0x19f79d);OpenchannelMessageEvents['on'](_0x392168,_0x52753f);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e60dd77..e043cf0 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 _0xf2f9=['removeTeams','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','destroy'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xf2f9,0x153));var _0x9f2f=function(_0x5c2310,_0x2cacbf){_0x5c2310=_0x5c2310-0x0;var _0x3d6433=_0xf2f9[_0x5c2310];return _0x3d6433;};'use strict';var multer=require(_0x9f2f('0x0'));var util=require(_0x9f2f('0x1'));var path=require('path');var timeout=require(_0x9f2f('0x2'));var express=require('express');var router=express[_0x9f2f('0x3')]();var fs_extra=require(_0x9f2f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f2f('0x5'));var config=require(_0x9f2f('0x6'));var controller=require(_0x9f2f('0x7'));router[_0x9f2f('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f2f('0x9')]);router[_0x9f2f('0x8')](_0x9f2f('0xa'),auth[_0x9f2f('0xb')](),controller[_0x9f2f('0xc')]);router[_0x9f2f('0x8')](_0x9f2f('0xd'),auth['isAuthenticated'](),controller[_0x9f2f('0xe')]);router[_0x9f2f('0x8')]('/:id/members',auth[_0x9f2f('0xb')](),controller[_0x9f2f('0xf')]);router[_0x9f2f('0x8')]('/:id/teams',auth[_0x9f2f('0xb')](),controller['getTeams']);router[_0x9f2f('0x8')](_0x9f2f('0x10'),auth[_0x9f2f('0xb')](),controller[_0x9f2f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9f2f('0x12')]);router[_0x9f2f('0x13')](_0x9f2f('0x14'),auth[_0x9f2f('0xb')](),controller[_0x9f2f('0x15')]);router[_0x9f2f('0x13')](_0x9f2f('0x10'),auth['isAuthenticated'](),controller[_0x9f2f('0x16')]);router[_0x9f2f('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9f2f('0xd'),auth[_0x9f2f('0xb')](),controller[_0x9f2f('0x18')]);router['delete']('/:id/teams',auth[_0x9f2f('0xb')](),controller[_0x9f2f('0x19')]);router[_0x9f2f('0x1a')](_0x9f2f('0x10'),auth[_0x9f2f('0xb')](),controller['removeAgents']);module[_0x9f2f('0x1b')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 065f92c..56e485b 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 _0xc78b=['name','sequelize','exports','STRING'];(function(_0xc1e658,_0x494271){var _0x48d15d=function(_0x2974b6){while(--_0x2974b6){_0xc1e658['push'](_0xc1e658['shift']());}};_0x48d15d(++_0x494271);}(_0xc78b,0x81));var _0xbc78=function(_0x175256,_0x56913e){_0x175256=_0x175256-0x0;var _0x4148b2=_0xc78b[_0x175256];return _0x4148b2;};'use strict';var Sequelize=require(_0xbc78('0x0'));module[_0xbc78('0x1')]={'name':{'type':Sequelize[_0xbc78('0x2')],'unique':_0xbc78('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbc78('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d7306f1..520e94f 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 _0x9d96=['status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','hasOwnProperty','nolimit','order','sort','pick','filter','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','Team','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','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','SELECT','TeamId','includes','all','compact','value','ids','isEmpty','emit','addAgents','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','bluebird','util','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus'];(function(_0x851b02,_0x43c5c2){var _0x2d607f=function(_0xd80353){while(--_0xd80353){_0x851b02['push'](_0x851b02['shift']());}};_0x2d607f(++_0x43c5c2);}(_0x9d96,0xef));var _0x69d9=function(_0x56e4bd,_0x4d3979){_0x56e4bd=_0x56e4bd-0x0;var _0x4f1aed=_0x9d96[_0x56e4bd];return _0x4f1aed;};'use strict';var BPromise=require(_0x69d9('0x0'));var util=require(_0x69d9('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x69d9('0x2'));var logger=require(_0x69d9('0x3'))(_0x69d9('0x4'));var config=require(_0x69d9('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x69d9('0x6')](config[_0x69d9('0x7')],{'host':_0x69d9('0x8'),'port':0x18eb});var socket=require(_0x69d9('0x9'))(new Redis(config['redis']));require(_0x69d9('0xa'))[_0x69d9('0xb')](socket);function respondWithStatusCode(_0x544ae5,_0x1d50df){_0x1d50df=_0x1d50df||0xcc;return function(_0x783aee){if(_0x783aee){return _0x544ae5[_0x69d9('0xc')](_0x1d50df);}return _0x544ae5[_0x69d9('0xd')](_0x1d50df)[_0x69d9('0xe')]();};}function respondWithResult(_0x395d9b,_0x34ba71){_0x34ba71=_0x34ba71||0xc8;return function(_0x563b5c){if(_0x563b5c){return _0x395d9b['status'](_0x34ba71)[_0x69d9('0xf')](_0x563b5c);}};}function respondWithFilteredResult(_0x39318f,_0x3bb26f){return function(_0x508291){if(_0x508291){var _0x104c46=typeof _0x3bb26f[_0x69d9('0x10')]===_0x69d9('0x11')&&typeof _0x3bb26f[_0x69d9('0x12')]===_0x69d9('0x11');var _0x4e006f=_0x508291['count'];var _0x4d1e16=_0x104c46?0x0:_0x3bb26f[_0x69d9('0x10')];var _0x30ab78=_0x104c46?_0x508291[_0x69d9('0x13')]:_0x3bb26f['offset']+_0x3bb26f[_0x69d9('0x12')];var _0x3cd8cf;if(_0x30ab78>=_0x4e006f){_0x30ab78=_0x4e006f;_0x3cd8cf=0xc8;}else{_0x3cd8cf=0xce;}_0x39318f[_0x69d9('0xd')](_0x3cd8cf);return _0x39318f[_0x69d9('0x14')](_0x69d9('0x15'),_0x4d1e16+'-'+_0x30ab78+'/'+_0x4e006f)[_0x69d9('0xf')](_0x508291);}return null;};}function saveUpdates(_0x5e04c5){return function(_0x183634){if(_0x183634){return _0x183634[_0x69d9('0x16')](_0x5e04c5)[_0x69d9('0x17')](function(_0x260cde){return _0x260cde;});}return null;};}function removeEntity(_0x39f66f){return function(_0x477644){if(_0x477644){return _0x477644[_0x69d9('0x18')]()[_0x69d9('0x17')](function(){var _0x2845e6=_0x477644[_0x69d9('0x19')]({'plain':!![]});var _0x2d3b36=_0x69d9('0x1a');return db[_0x69d9('0x1b')]['destroy']({'where':{'type':_0x2d3b36,'resourceId':_0x2845e6['id']}})[_0x69d9('0x17')](function(){return _0x477644;});})[_0x69d9('0x17')](function(){_0x39f66f[_0x69d9('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x532930){return function(_0x5d0234){if(!_0x5d0234){_0x532930[_0x69d9('0xc')](0x194);}return _0x5d0234;};}function handleError(_0x56ba50,_0x53063a){_0x53063a=_0x53063a||0x1f4;return function(_0x878314){logger[_0x69d9('0x1c')](_0x878314[_0x69d9('0x1d')]);if(_0x878314[_0x69d9('0x1e')]){delete _0x878314[_0x69d9('0x1e')];}_0x56ba50[_0x69d9('0xd')](_0x53063a)[_0x69d9('0x1f')](_0x878314);};}exports[_0x69d9('0x20')]=function(_0x51086d,_0x58b4d5){var _0x5c6aa3={};var _0x4b838f={'count':0x0,'rows':[]};var _0x13c4bf=_[_0x69d9('0x21')](db[_0x69d9('0x22')][_0x69d9('0x23')],function(_0x46ce4b){return{'name':_0x46ce4b[_0x69d9('0x24')],'type':_0x46ce4b[_0x69d9('0x25')][_0x69d9('0x26')]};});_0x5c6aa3=qs[_0x69d9('0x27')](_0x13c4bf,_0x51086d);var _0x2ecf10={'where':_0x5c6aa3[_0x69d9('0x28')]};return db[_0x69d9('0x22')][_0x69d9('0x13')](_0x2ecf10)[_0x69d9('0x17')](function(_0xb2f8e3){_0x4b838f[_0x69d9('0x13')]=_0xb2f8e3;_0x5c6aa3[_0x69d9('0x29')]=qs['include'](_0x51086d['query']);return db[_0x69d9('0x22')][_0x69d9('0x2a')](_0x5c6aa3);})[_0x69d9('0x17')](function(_0x59889f){_0x4b838f[_0x69d9('0x2b')]=_0x59889f;return _0x4b838f;})['then'](respondWithFilteredResult(_0x58b4d5,_0x5c6aa3))['catch'](handleError(_0x58b4d5,null));};exports[_0x69d9('0x2c')]=function(_0x4e280a,_0x3a99c4){var _0x3fad67={'raw':!![],'where':{'id':_0x4e280a[_0x69d9('0x2d')]['id']}},_0x4b4c15={};_0x4b4c15[_0x69d9('0x2e')]=_[_0x69d9('0x2f')](db[_0x69d9('0x22')][_0x69d9('0x23')]);_0x4b4c15[_0x69d9('0x30')]=_['keys'](_0x4e280a[_0x69d9('0x30')]);_0x4b4c15[_0x69d9('0x31')]=_[_0x69d9('0x32')](_0x4b4c15[_0x69d9('0x2e')],_0x4b4c15[_0x69d9('0x30')]);_0x3fad67[_0x69d9('0x33')]=_[_0x69d9('0x32')](_0x4b4c15[_0x69d9('0x2e')],qs[_0x69d9('0x34')](_0x4e280a[_0x69d9('0x30')]['fields']));_0x3fad67[_0x69d9('0x33')]=_0x3fad67[_0x69d9('0x33')][_0x69d9('0x35')]?_0x3fad67[_0x69d9('0x33')]:_0x4b4c15['model'];if(_0x4e280a[_0x69d9('0x30')][_0x69d9('0x36')]){_0x3fad67[_0x69d9('0x29')]=[{'all':!![]}];}_0x3fad67=_[_0x69d9('0x37')]({},_0x3fad67,_0x4e280a[_0x69d9('0x38')]);return db['OpenchannelQueue'][_0x69d9('0x39')](_0x3fad67)['then'](handleEntityNotFound(_0x3a99c4,null))[_0x69d9('0x17')](respondWithResult(_0x3a99c4,null))['catch'](handleError(_0x3a99c4,null));};exports[_0x69d9('0x3a')]=function(_0x12edfa,_0x432f2e){return db[_0x69d9('0x22')][_0x69d9('0x3a')](_0x12edfa[_0x69d9('0x3b')],{})[_0x69d9('0x17')](function(_0x444b20){var _0x4e7dab=_0x12edfa[_0x69d9('0x3c')][_0x69d9('0x19')]({'plain':!![]});if(!_0x4e7dab)throw new Error(_0x69d9('0x3d'));if(_0x4e7dab[_0x69d9('0x3e')]===_0x69d9('0x3c')){var _0x52129c=_0x444b20[_0x69d9('0x19')]({'plain':!![]});var _0x347888=_0x69d9('0x1a');return db[_0x69d9('0x3f')][_0x69d9('0x39')]({'where':{'name':_0x347888,'userProfileId':_0x4e7dab[_0x69d9('0x40')]},'raw':!![]})[_0x69d9('0x17')](function(_0x32608a){if(_0x32608a&&_0x32608a[_0x69d9('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x52129c['name'],'resourceId':_0x52129c['id'],'type':_0x32608a['name'],'sectionId':_0x32608a['id']},{})[_0x69d9('0x17')](function(){return _0x444b20;});}else{return _0x444b20;}})[_0x69d9('0x42')](function(_0x5c9720){logger[_0x69d9('0x1c')](_0x69d9('0x43'),_0x5c9720);throw _0x5c9720;});}return _0x444b20;})[_0x69d9('0x17')](respondWithResult(_0x432f2e,0xc9))[_0x69d9('0x42')](handleError(_0x432f2e,null));};exports['update']=function(_0x25df46,_0x379112){if(_0x25df46[_0x69d9('0x3b')]['id']){delete _0x25df46[_0x69d9('0x3b')]['id'];}return db[_0x69d9('0x22')][_0x69d9('0x39')]({'where':{'id':_0x25df46[_0x69d9('0x2d')]['id']}})[_0x69d9('0x17')](handleEntityNotFound(_0x379112,null))[_0x69d9('0x17')](saveUpdates(_0x25df46['body'],null))[_0x69d9('0x17')](respondWithResult(_0x379112,null))[_0x69d9('0x42')](handleError(_0x379112,null));};exports[_0x69d9('0x18')]=function(_0x4bc1e8,_0x4677ae){return db[_0x69d9('0x22')][_0x69d9('0x39')]({'where':{'id':_0x4bc1e8[_0x69d9('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4677ae,null))[_0x69d9('0x17')](removeEntity(_0x4677ae,null))['catch'](handleError(_0x4677ae,null));};exports[_0x69d9('0x44')]=function(_0x168a4f,_0x546fd6){return db[_0x69d9('0x22')][_0x69d9('0x44')]()[_0x69d9('0x17')](respondWithResult(_0x546fd6,null))[_0x69d9('0x42')](handleError(_0x546fd6,null));};exports['getMembers']=function(_0x2b7c42,_0x5530a8){var _0xdadbeb={'raw':!![],'where':{}},_0x2b7da6={},_0x336af8;return db[_0x69d9('0x22')][_0x69d9('0x45')]({'where':{'id':_0x2b7c42[_0x69d9('0x2d')]['id']}})[_0x69d9('0x17')](handleEntityNotFound(_0x5530a8,null))[_0x69d9('0x17')](function(_0x1ffff0){if(_0x1ffff0){_0x336af8=_0x1ffff0[_0x69d9('0x19')]({'plain':!![]});_0x2b7da6['model']=_['keys'](db['UserOpenchannelQueue'][_0x69d9('0x23')]);_0x2b7da6[_0x69d9('0x30')]=_[_0x69d9('0x2f')](_0x2b7c42['query']);_0x2b7da6[_0x69d9('0x31')]=_[_0x69d9('0x32')](_0x2b7da6[_0x69d9('0x2e')],_0x2b7da6[_0x69d9('0x30')]);_0xdadbeb[_0x69d9('0x33')]=_[_0x69d9('0x32')](_0x2b7da6[_0x69d9('0x2e')],qs[_0x69d9('0x34')](_0x2b7c42[_0x69d9('0x30')][_0x69d9('0x34')]));_0xdadbeb[_0x69d9('0x33')]=_0xdadbeb[_0x69d9('0x33')][_0x69d9('0x35')]?_0xdadbeb[_0x69d9('0x33')]:_0x2b7da6['model'];if(!_0x2b7c42[_0x69d9('0x30')][_0x69d9('0x46')](_0x69d9('0x47'))){_0xdadbeb[_0x69d9('0x12')]=qs[_0x69d9('0x12')](_0x2b7c42[_0x69d9('0x30')][_0x69d9('0x12')]);_0xdadbeb['offset']=qs[_0x69d9('0x10')](_0x2b7c42[_0x69d9('0x30')][_0x69d9('0x10')]);}_0xdadbeb[_0x69d9('0x48')]=qs[_0x69d9('0x49')](_0x2b7c42[_0x69d9('0x30')][_0x69d9('0x49')]);_0xdadbeb[_0x69d9('0x28')]=qs[_0x69d9('0x31')](_[_0x69d9('0x4a')](_0x2b7c42['query'],_0x2b7da6[_0x69d9('0x31')]));_0xdadbeb[_0x69d9('0x28')]['OpenchannelQueueId']=_0x1ffff0['id'];if(_0x2b7c42[_0x69d9('0x30')][_0x69d9('0x4b')]){_0xdadbeb[_0x69d9('0x28')]=_[_0x69d9('0x37')](_0xdadbeb['where'],{'$or':_[_0x69d9('0x21')](_0xdadbeb[_0x69d9('0x33')],function(_0x5c03dd){var _0x4954fb={};_0x4954fb[_0x5c03dd]={'$like':'%'+_0x2b7c42[_0x69d9('0x30')]['filter']+'%'};return _0x4954fb;})});}_0xdadbeb=_[_0x69d9('0x37')]({},_0xdadbeb,_0x2b7c42[_0x69d9('0x38')]);return db[_0x69d9('0x4c')][_0x69d9('0x2a')](_0xdadbeb);}})[_0x69d9('0x17')](function(_0x227c21){if(_0x227c21){return db[_0x69d9('0x4d')]['findAndCountAll']({'where':{'id':_['map'](_0x227c21,_0x69d9('0x4e')),'role':_0x69d9('0x4f')},'attributes':['id',_0x69d9('0x1e'),_0x69d9('0x50'),_0x69d9('0x51'),_0x69d9('0x52')]});}})['then'](function(_0x115bef){if(_0x115bef){return{'count':_0x115bef[_0x69d9('0x13')],'rows':_['map'](_0x115bef['rows'],function(_0x2beaba){return{'membername':_0x2beaba[_0x69d9('0x1e')],'UserId':_0x2beaba['id'],'queue_name':_0x336af8['name'],'OpenchannelQueueId':_0x336af8['id'],'interface':util[_0x69d9('0x53')]('%s/%s',_0x69d9('0x54'),_0x2beaba[_0x69d9('0x1e')]),'penalty':0x0,'paused':_0x2beaba['openchannelPause'],'createdAt':_0x2beaba[_0x69d9('0x52')],'updatedAt':_0x2beaba[_0x69d9('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x69d9('0x17')](respondWithFilteredResult(_0x5530a8,_0xdadbeb))[_0x69d9('0x42')](handleError(_0x5530a8,null));};exports[_0x69d9('0x55')]=function(_0x4720c7,_0x4f16f9){var _0x236609={};var _0x49c9e3={};var _0x2ab00e;var _0x2751fc;return db['OpenchannelQueue'][_0x69d9('0x45')]({'where':{'id':_0x4720c7[_0x69d9('0x2d')]['id']}})[_0x69d9('0x17')](handleEntityNotFound(_0x4f16f9,null))[_0x69d9('0x17')](function(_0x4c1e17){if(_0x4c1e17){_0x2ab00e=_0x4c1e17;_0x49c9e3[_0x69d9('0x2e')]=_[_0x69d9('0x2f')](db['Team'][_0x69d9('0x23')]);_0x49c9e3[_0x69d9('0x30')]=_[_0x69d9('0x2f')](_0x4720c7[_0x69d9('0x30')]);_0x49c9e3[_0x69d9('0x31')]=_[_0x69d9('0x32')](_0x49c9e3[_0x69d9('0x2e')],_0x49c9e3[_0x69d9('0x30')]);_0x236609[_0x69d9('0x33')]=_[_0x69d9('0x32')](_0x49c9e3[_0x69d9('0x2e')],qs[_0x69d9('0x34')](_0x4720c7['query'][_0x69d9('0x34')]));_0x236609['attributes']=_0x236609[_0x69d9('0x33')][_0x69d9('0x35')]?_0x236609[_0x69d9('0x33')]:_0x49c9e3['model'];_0x236609[_0x69d9('0x48')]=qs[_0x69d9('0x49')](_0x4720c7[_0x69d9('0x30')][_0x69d9('0x49')]);_0x236609[_0x69d9('0x28')]=qs[_0x69d9('0x31')](_[_0x69d9('0x4a')](_0x4720c7[_0x69d9('0x30')],_0x49c9e3[_0x69d9('0x31')]));if(_0x4720c7[_0x69d9('0x30')]['filter']){_0x236609[_0x69d9('0x28')]=_['merge'](_0x236609['where'],{'$or':_[_0x69d9('0x21')](_0x236609[_0x69d9('0x33')],function(_0x83c397){var _0x398671={};_0x398671[_0x83c397]={'$like':'%'+_0x4720c7[_0x69d9('0x30')][_0x69d9('0x4b')]+'%'};return _0x398671;})});}_0x236609=_['merge']({},_0x236609,_0x4720c7[_0x69d9('0x38')]);return _0x2ab00e[_0x69d9('0x55')](_0x236609);}})[_0x69d9('0x17')](function(_0x1ad8f9){if(_0x1ad8f9){_0x2751fc=_0x1ad8f9[_0x69d9('0x35')];if(!_0x4720c7[_0x69d9('0x30')][_0x69d9('0x46')](_0x69d9('0x47'))){_0x236609[_0x69d9('0x12')]=qs[_0x69d9('0x12')](_0x4720c7[_0x69d9('0x30')][_0x69d9('0x12')]);_0x236609[_0x69d9('0x10')]=qs['offset'](_0x4720c7['query'][_0x69d9('0x10')]);}return _0x2ab00e['getTeams'](_0x236609);}})['then'](function(_0x5e47bf){if(_0x5e47bf){return _0x5e47bf?{'count':_0x2751fc,'rows':_0x5e47bf}:null;}})[_0x69d9('0x17')](respondWithResult(_0x4f16f9,null))['catch'](handleError(_0x4f16f9,null));};exports[_0x69d9('0x56')]=function(_0x1822d9,_0x562e98){var _0x21c1f4=_0x1822d9[_0x69d9('0x3b')]['ids'];return db[_0x69d9('0x57')][_0x69d9('0x2a')]({'where':{'id':_0x21c1f4},'attributes':['id'],'include':[{'model':db[_0x69d9('0x4d')],'as':'Agents','attributes':['id',_0x69d9('0x1e'),_0x69d9('0x58'),'voicePause',_0x69d9('0x59')],'raw':!![]}]})[_0x69d9('0x17')](function(_0x2264be){if(_0x2264be){var _0x406187=_[_0x69d9('0x5a')](_0x2264be,function(_0xce246c){var _0x5d3e34=_0xce246c[_0x69d9('0x19')]({'plain':!![]});return _0x5d3e34[_0x69d9('0x5b')];});return db[_0x69d9('0x22')][_0x69d9('0x39')]({'where':{'id':_0x1822d9['params']['id']}})[_0x69d9('0x17')](function(_0x10ec51){return db[_0x69d9('0x5c')][_0x69d9('0x5d')](function(_0x32d35f){return _0x10ec51[_0x69d9('0x56')](_0x21c1f4,{'transaction':_0x32d35f})[_0x69d9('0x17')](function(){return BPromise['each'](_0x406187,function(_0x146dfd){return db[_0x69d9('0x4c')][_0x69d9('0x5e')]({'where':{'UserId':_0x146dfd['id'],'OpenchannelQueueId':_0x1822d9[_0x69d9('0x2d')]['id']},'transaction':_0x32d35f});});})['then'](function(){_0x406187[_0x69d9('0x5f')](function(_0x324328){socket['emit'](_0x69d9('0x60'),{'UserId':_0x324328['id'],'OpenchannelQueueId':_0x10ec51['id']});});});});});}})['then'](respondWithStatusCode(_0x562e98,null))[_0x69d9('0x42')](handleError(_0x562e98,null));};exports[_0x69d9('0x61')]=function(_0x57e9cb,_0x293cd3){return db[_0x69d9('0x57')][_0x69d9('0x2a')]({'where':{'id':_0x57e9cb[_0x69d9('0x30')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x69d9('0x5b'),'attributes':['id'],'raw':!![]}]})[_0x69d9('0x17')](handleEntityNotFound(_0x293cd3,null))[_0x69d9('0x17')](function(_0x1b5482){var _0x39ef87=_[_0x69d9('0x21')](_0x1b5482,'id');var _0x2ee7cc=[];var _0x2d7fd9=[];var _0x10b8b4=squel[_0x69d9('0x62')]();_0x10b8b4[_0x69d9('0x63')](_0x69d9('0x64'))[_0x69d9('0x65')](_0x69d9('0x66'),'tq')[_0x69d9('0x67')](_0x69d9('0x68'),'ut',_0x69d9('0x69'))[_0x69d9('0x28')]('OpenchannelQueueId\x20=\x20?',_0x57e9cb[_0x69d9('0x2d')]['id']);for(var _0x2ac557=0x0;_0x2ac557<_0x1b5482[_0x69d9('0x35')];_0x2ac557+=0x1){let _0x4f2938=_0x1b5482[_0x2ac557];for(var _0xbfd65e=0x0;_0xbfd65e<_0x4f2938['Agents'][_0x69d9('0x35')];_0xbfd65e+=0x1){let _0x4b8f93=_0x4f2938[_0x69d9('0x5b')][_0xbfd65e];var _0x4b3844=_0x10b8b4[_0x69d9('0x6a')]();_0x4b3844['where'](_0x69d9('0x6b'),_0x4b8f93['id']);_0x2d7fd9[_0x69d9('0x6c')](db[_0x69d9('0x5c')][_0x69d9('0x30')](_0x4b3844[_0x69d9('0x6d')](),{'type':db[_0x69d9('0x5c')][_0x69d9('0x6e')][_0x69d9('0x6f')]})[_0x69d9('0x17')](function(_0x4b33ea){if(_0x4b33ea[_0x69d9('0x35')]===0x1){return _0x4b8f93['id'];}else{var _0xc84bb=_['every'](_['map'](_0x4b33ea,_0x69d9('0x70')),function(_0x28c669){return _[_0x69d9('0x71')](_0x39ef87,_0x28c669);});if(_0xc84bb){return _0x4b8f93['id'];}}}));}}return BPromise[_0x69d9('0x72')](_0x2d7fd9)[_0x69d9('0x17')](function(_0x3fe378){_0x2ee7cc=_(_0x2ee7cc)['union'](_0x3fe378)[_0x69d9('0x73')]()[_0x69d9('0x74')]();return db[_0x69d9('0x22')][_0x69d9('0x39')]({'where':{'id':_0x57e9cb[_0x69d9('0x2d')]['id']}})[_0x69d9('0x17')](function(_0x158f06){return db['sequelize']['transaction'](function(_0x21923e){return _0x158f06[_0x69d9('0x61')](_0x57e9cb['query'][_0x69d9('0x75')],{'transaction':_0x21923e})[_0x69d9('0x17')](function(){if(!_[_0x69d9('0x76')](_0x2ee7cc)){return _0x158f06['removeAgents'](_0x2ee7cc,{'transaction':_0x21923e});}})['then'](function(){_0x2ee7cc['forEach'](function(_0x50c5f2){socket[_0x69d9('0x77')]('userOpenchannelQueue:remove',{'UserId':_0x50c5f2,'OpenchannelQueueId':_0x158f06['id']});});});});});});})[_0x69d9('0x17')](respondWithStatusCode(_0x293cd3,null))['catch'](handleError(_0x293cd3,null));};exports[_0x69d9('0x78')]=function(_0x4c1d24,_0x50efa7){return db['OpenchannelQueue'][_0x69d9('0x39')]({'where':{'id':_0x4c1d24[_0x69d9('0x2d')]['id']}})[_0x69d9('0x17')](handleEntityNotFound(_0x50efa7,null))[_0x69d9('0x17')](function(_0x23aa8d){if(_0x23aa8d){return _0x23aa8d[_0x69d9('0x78')](_0x4c1d24['body']['ids'],_['omit'](_0x4c1d24[_0x69d9('0x3b')],[_0x69d9('0x75'),'id'])||{})[_0x69d9('0x79')](function(_0x4177e8){for(var _0x32a966=0x0;_0x32a966<_0x4c1d24[_0x69d9('0x3b')][_0x69d9('0x75')][_0x69d9('0x35')];_0x32a966+=0x1){socket['emit'](_0x69d9('0x60'),{'UserId':Number(_0x4c1d24[_0x69d9('0x3b')][_0x69d9('0x75')][_0x32a966]),'OpenchannelQueueId':Number(_0x4c1d24[_0x69d9('0x2d')]['id'])});}return _0x4177e8;});}})[_0x69d9('0x17')](respondWithResult(_0x50efa7,null))['catch'](handleError(_0x50efa7,null));};exports['removeAgents']=function(_0x259c25,_0x22e78e){return db[_0x69d9('0x22')]['find']({'where':{'id':_0x259c25['params']['id']}})['then'](handleEntityNotFound(_0x22e78e,null))[_0x69d9('0x17')](function(_0x376caf){if(_0x376caf){return _0x376caf[_0x69d9('0x7a')](_0x259c25[_0x69d9('0x30')][_0x69d9('0x75')])[_0x69d9('0x17')](function(){if(_[_0x69d9('0x7b')](_0x259c25['query'][_0x69d9('0x75')])){for(var _0x1004c1=0x0;_0x1004c1<_0x259c25[_0x69d9('0x30')]['ids'][_0x69d9('0x35')];_0x1004c1+=0x1){socket[_0x69d9('0x77')](_0x69d9('0x7c'),{'UserId':Number(_0x259c25[_0x69d9('0x30')][_0x69d9('0x75')][_0x1004c1]),'OpenchannelQueueId':Number(_0x259c25[_0x69d9('0x2d')]['id'])});}}else{socket[_0x69d9('0x77')](_0x69d9('0x7c'),{'UserId':Number(_0x259c25[_0x69d9('0x30')][_0x69d9('0x75')]),'OpenchannelQueueId':Number(_0x259c25['params']['id'])});}});}})[_0x69d9('0x17')](respondWithStatusCode(_0x22e78e,null))[_0x69d9('0x42')](handleError(_0x22e78e,null));};exports[_0x69d9('0x7d')]=function(_0xda3181,_0x5df0be){var _0x121718={};var _0x3a4a7c={};var _0x20669b;var _0x12f523;return db[_0x69d9('0x22')][_0x69d9('0x45')]({'where':{'id':_0xda3181[_0x69d9('0x2d')]['id']}})[_0x69d9('0x17')](handleEntityNotFound(_0x5df0be,null))[_0x69d9('0x17')](function(_0x368b76){if(_0x368b76){_0x20669b=_0x368b76;_0x3a4a7c['model']=_[_0x69d9('0x2f')](db[_0x69d9('0x4d')][_0x69d9('0x23')]);_0x3a4a7c[_0x69d9('0x30')]=_[_0x69d9('0x2f')](_0xda3181['query']);_0x3a4a7c[_0x69d9('0x31')]=_[_0x69d9('0x32')](_0x3a4a7c[_0x69d9('0x2e')],_0x3a4a7c['query']);_0x121718[_0x69d9('0x33')]=_[_0x69d9('0x32')](_0x3a4a7c[_0x69d9('0x2e')],qs[_0x69d9('0x34')](_0xda3181['query'][_0x69d9('0x34')]));_0x121718[_0x69d9('0x33')]=_0x121718[_0x69d9('0x33')]['length']?_0x121718['attributes']:_0x3a4a7c[_0x69d9('0x2e')];_0x121718['order']=qs['sort'](_0xda3181[_0x69d9('0x30')][_0x69d9('0x49')]);_0x121718[_0x69d9('0x28')]=qs[_0x69d9('0x31')](_[_0x69d9('0x4a')](_0xda3181['query'],_0x3a4a7c[_0x69d9('0x31')]));if(_0xda3181[_0x69d9('0x30')][_0x69d9('0x4b')]){_0x121718[_0x69d9('0x28')]=_['merge'](_0x121718[_0x69d9('0x28')],{'$or':_[_0x69d9('0x21')](_0x121718[_0x69d9('0x33')],function(_0x22d3b9){var _0x264f19={};_0x264f19[_0x22d3b9]={'$like':'%'+_0xda3181[_0x69d9('0x30')][_0x69d9('0x4b')]+'%'};return _0x264f19;})});}_0x121718=_[_0x69d9('0x37')]({},_0x121718,_0xda3181[_0x69d9('0x38')]);return _0x20669b[_0x69d9('0x7d')](_0x121718);}})[_0x69d9('0x17')](function(_0x2c49da){if(_0x2c49da){_0x12f523=_0x2c49da[_0x69d9('0x35')];if(!_0xda3181[_0x69d9('0x30')]['hasOwnProperty'](_0x69d9('0x47'))){_0x121718[_0x69d9('0x12')]=qs[_0x69d9('0x12')](_0xda3181[_0x69d9('0x30')][_0x69d9('0x12')]);_0x121718[_0x69d9('0x10')]=qs[_0x69d9('0x10')](_0xda3181[_0x69d9('0x30')]['offset']);}return _0x20669b[_0x69d9('0x7d')](_0x121718);}})[_0x69d9('0x17')](function(_0x477b0a){if(_0x477b0a){return _0x477b0a?{'count':_0x12f523,'rows':_0x477b0a}:null;}})[_0x69d9('0x17')](respondWithResult(_0x5df0be,null))['catch'](handleError(_0x5df0be,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 5d3d2de..527adcd 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 _0x4153=['OpenchannelQueue','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x4153,0xa6));var _0x3415=function(_0x5baeb8,_0x6b0538){_0x5baeb8=_0x5baeb8-0x0;var _0x105850=_0x4153[_0x5baeb8];return _0x105850;};'use strict';var EventEmitter=require(_0x3415('0x0'));var OpenchannelQueue=require(_0x3415('0x1'))['db'][_0x3415('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3415('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3415('0x4'),'afterDestroy':_0x3415('0x5')};function emitEvent(_0x4866e2){return function(_0x101f49,_0x501ecc,_0x54f99a){OpenchannelQueueEvents[_0x3415('0x6')](_0x4866e2+':'+_0x101f49['id'],_0x101f49);OpenchannelQueueEvents[_0x3415('0x6')](_0x4866e2,_0x101f49);_0x54f99a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x3415('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 364b52e..bd8ee08 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 _0xf9d7=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf9d7,0x140));var _0x7f9d=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0xf9d7[_0x18baf4];return _0x278ed1;};'use strict';var _=require(_0x7f9d('0x0'));var util=require(_0x7f9d('0x1'));var logger=require(_0x7f9d('0x2'))(_0x7f9d('0x3'));var moment=require(_0x7f9d('0x4'));var BPromise=require(_0x7f9d('0x5'));var rp=require(_0x7f9d('0x6'));var fs=require('fs');var path=require(_0x7f9d('0x7'));var rimraf=require(_0x7f9d('0x8'));var config=require(_0x7f9d('0x9'));var attributes=require(_0x7f9d('0xa'));module[_0x7f9d('0xb')]=function(_0x3d792a,_0x1e430b){return _0x3d792a[_0x7f9d('0xc')](_0x7f9d('0xd'),attributes,{'tableName':_0x7f9d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 5cc41fa..27d6572 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 _0x1595=['stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','include','model','attributes','map','debug','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0x1595,0x81));var _0x5159=function(_0x9c50fe,_0x57421c){_0x9c50fe=_0x9c50fe-0x0;var _0x14f7ff=_0x1595[_0x9c50fe];return _0x14f7ff;};'use strict';var _=require(_0x5159('0x0'));var util=require(_0x5159('0x1'));var moment=require(_0x5159('0x2'));var BPromise=require(_0x5159('0x3'));var rs=require(_0x5159('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5159('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5159('0x6'))(_0x5159('0x7'));var config=require(_0x5159('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x5159('0x9')]=_[_0x5159('0xa')](config[_0x5159('0x9')],{'host':_0x5159('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5159('0x9')]));require(_0x5159('0xc'))[_0x5159('0xd')](socket);function respondWithRpcPromise(_0x5533e7,_0x5e6b51,_0x3f5a98){return new BPromise(function(_0x31874d,_0x2c05c9){return client['request'](_0x5533e7,_0x3f5a98)[_0x5159('0xe')](function(_0xa006e2){logger[_0x5159('0xf')](_0x5159('0x10'),_0x5e6b51,_0x5159('0x11'));logger['debug'](_0x5159('0x12'),_0x5e6b51,_0x5159('0x11'),JSON[_0x5159('0x13')](_0xa006e2));if(_0xa006e2[_0x5159('0x14')]){if(_0xa006e2[_0x5159('0x14')][_0x5159('0x15')]===0x1f4){logger[_0x5159('0x14')](_0x5159('0x10'),_0x5e6b51,_0xa006e2[_0x5159('0x14')][_0x5159('0x16')]);return _0x2c05c9(_0xa006e2['error'][_0x5159('0x16')]);}logger[_0x5159('0x14')](_0x5159('0x10'),_0x5e6b51,_0xa006e2['error'][_0x5159('0x16')]);return _0x31874d(_0xa006e2['error'][_0x5159('0x16')]);}else{logger['info'](_0x5159('0x10'),_0x5e6b51,_0x5159('0x11'));_0x31874d(_0xa006e2[_0x5159('0x17')][_0x5159('0x16')]);}})[_0x5159('0x18')](function(_0x1ada70){logger[_0x5159('0x14')](_0x5159('0x10'),_0x5e6b51,_0x1ada70);_0x2c05c9(_0x1ada70);});});}exports[_0x5159('0x19')]=function(_0xc5af7e){var _0x464b91=this;return new Promise(function(_0xed7f75,_0x2cdf50){return db[_0x5159('0x1a')]['findAll']({'raw':_0xc5af7e[_0x5159('0x1b')]?_0xc5af7e[_0x5159('0x1b')][_0x5159('0x1c')]===undefined?!![]:![]:!![],'where':_0xc5af7e['options']?_0xc5af7e['options'][_0x5159('0x1d')]||null:null,'attributes':_0xc5af7e['options']?_0xc5af7e[_0x5159('0x1b')]['attributes']||null:null,'limit':_0xc5af7e[_0x5159('0x1b')]?_0xc5af7e[_0x5159('0x1b')]['limit']||null:null,'include':_0xc5af7e['options']?_0xc5af7e[_0x5159('0x1b')]['include']?_['map'](_0xc5af7e[_0x5159('0x1b')][_0x5159('0x1e')],function(_0x2e2208){return{'model':db[_0x2e2208[_0x5159('0x1f')]],'as':_0x2e2208['as'],'attributes':_0x2e2208[_0x5159('0x20')],'include':_0x2e2208['include']?_[_0x5159('0x21')](_0x2e2208[_0x5159('0x1e')],function(_0x38505d){return{'model':db[_0x38505d['model']],'as':_0x38505d['as'],'attributes':_0x38505d[_0x5159('0x20')],'include':_0x38505d[_0x5159('0x1e')]?_[_0x5159('0x21')](_0x38505d[_0x5159('0x1e')],function(_0x3db862){return{'model':db[_0x3db862['model']],'as':_0x3db862['as'],'attributes':_0x3db862['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b909){logger[_0x5159('0xf')](_0x5159('0x19'),_0xc5af7e);logger[_0x5159('0x22')](_0x5159('0x19'),_0xc5af7e,JSON['stringify'](_0x14b909));_0xed7f75(_0x14b909);})['catch'](function(_0x20c698){logger[_0x5159('0x14')](_0x5159('0x19'),_0x20c698[_0x5159('0x16')],_0xc5af7e);_0x2cdf50(_0x464b91[_0x5159('0x14')](0x1f4,_0x20c698[_0x5159('0x16')]));});});};exports[_0x5159('0x23')]=function(_0x3d75ea){var _0x11ab79=this;return new Promise(function(_0x46213b,_0x2c4b0c){return db['OpenchannelQueue'][_0x5159('0x24')]({'raw':_0x3d75ea[_0x5159('0x1b')]?_0x3d75ea[_0x5159('0x1b')][_0x5159('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d75ea['options']?_0x3d75ea[_0x5159('0x1b')][_0x5159('0x1d')]||null:null,'attributes':_0x3d75ea[_0x5159('0x1b')]?_0x3d75ea[_0x5159('0x1b')][_0x5159('0x20')]||null:null,'include':_0x3d75ea['options']?_0x3d75ea[_0x5159('0x1b')][_0x5159('0x1e')]?_[_0x5159('0x21')](_0x3d75ea[_0x5159('0x1b')][_0x5159('0x1e')],function(_0x277f6b){return{'model':db[_0x277f6b[_0x5159('0x1f')]],'as':_0x277f6b['as'],'attributes':_0x277f6b[_0x5159('0x20')],'include':_0x277f6b[_0x5159('0x1e')]?_[_0x5159('0x21')](_0x277f6b['include'],function(_0x55cbaa){return{'model':db[_0x55cbaa[_0x5159('0x1f')]],'as':_0x55cbaa['as'],'attributes':_0x55cbaa['attributes'],'include':_0x55cbaa[_0x5159('0x1e')]?_['map'](_0x55cbaa['include'],function(_0x499b0b){return{'model':db[_0x499b0b['model']],'as':_0x499b0b['as'],'attributes':_0x499b0b[_0x5159('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5159('0xe')](function(_0x2b38d3){logger['info'](_0x5159('0x23'),_0x3d75ea);logger[_0x5159('0x22')]('ShowOpenchannelQueue',_0x3d75ea,JSON['stringify'](_0x2b38d3));_0x46213b(_0x2b38d3);})[_0x5159('0x18')](function(_0x377445){logger[_0x5159('0x14')](_0x5159('0x23'),_0x377445[_0x5159('0x16')],_0x3d75ea);_0x2c4b0c(_0x11ab79[_0x5159('0x14')](0x1f4,_0x377445[_0x5159('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index fa6e1be..f8382dc 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 _0x2e5b=['emit','removeListener','register','length','./openchannelQueue.events','save','remove','update'];(function(_0x260780,_0x5c2755){var _0x2b4ca6=function(_0xaaebd1){while(--_0xaaebd1){_0x260780['push'](_0x260780['shift']());}};_0x2b4ca6(++_0x5c2755);}(_0x2e5b,0xc4));var _0xb2e5=function(_0x44d0aa,_0x130519){_0x44d0aa=_0x44d0aa-0x0;var _0x56b405=_0x2e5b[_0x44d0aa];return _0x56b405;};'use strict';var OpenchannelQueueEvents=require(_0xb2e5('0x0'));var events=[_0xb2e5('0x1'),_0xb2e5('0x2'),_0xb2e5('0x3')];function createListener(_0x247ac0,_0x579cb9){return function(_0x3c0da8){_0x579cb9[_0xb2e5('0x4')](_0x247ac0,_0x3c0da8);};}function removeListener(_0x11f9cf,_0x24c6c7){return function(){OpenchannelQueueEvents[_0xb2e5('0x5')](_0x11f9cf,_0x24c6c7);};}exports[_0xb2e5('0x6')]=function(_0x26cbb0){for(var _0x5c94cb=0x0,_0x8c1b7=events[_0xb2e5('0x7')];_0x5c94cb<_0x8c1b7;_0x5c94cb++){var _0x50b3d9=events[_0x5c94cb];var _0x421bea=createListener('openchannelQueue:'+_0x50b3d9,_0x26cbb0);OpenchannelQueueEvents['on'](_0x50b3d9,_0x421bea);}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e5fc445..f9e5d27 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 _0x7e4f=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','create','update','delete','/:id','destroy','util','path','Router'];(function(_0xb5ddaa,_0x500d00){var _0x5203b5=function(_0x33c82f){while(--_0x33c82f){_0xb5ddaa['push'](_0xb5ddaa['shift']());}};_0x5203b5(++_0x500d00);}(_0x7e4f,0xfd));var _0xf7e4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7e4f[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0xf7e4('0x0'));var path=require(_0xf7e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf7e4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf7e4('0x3'));var interaction=require(_0xf7e4('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0xf7e4('0x5')]('/',auth[_0xf7e4('0x6')](),controller[_0xf7e4('0x7')]);router[_0xf7e4('0x5')]('/describe',auth[_0xf7e4('0x6')](),controller[_0xf7e4('0x8')]);router[_0xf7e4('0x5')]('/:id',auth[_0xf7e4('0x6')](),controller[_0xf7e4('0x9')]);router[_0xf7e4('0xa')]('/',auth[_0xf7e4('0x6')](),controller[_0xf7e4('0xb')]);router['put']('/:id',auth[_0xf7e4('0x6')](),controller[_0xf7e4('0xc')]);router[_0xf7e4('0xd')](_0xf7e4('0xe'),auth[_0xf7e4('0x6')](),controller[_0xf7e4('0xf')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index dae650d..c470263 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 _0x5bd5=['STRING','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5bd5,0xb8));var _0x55bd=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x5bd5[_0x435044];return _0x33d4c6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x55bd('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x55bd('0x0')]},'joinAt':{'type':Sequelize[_0x55bd('0x1')]},'leaveAt':{'type':Sequelize[_0x55bd('0x1')]},'acceptAt':{'type':Sequelize[_0x55bd('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ec33349..6b3fb7a 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 _0x145d=['../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','includeAll','find','create','catch','body','params','describe','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x56b0d8,_0x5770e5){var _0x33f423=function(_0x392b28){while(--_0x392b28){_0x56b0d8['push'](_0x56b0d8['shift']());}};_0x33f423(++_0x5770e5);}(_0x145d,0x1ed));var _0xd145=function(_0x481ddc,_0x35f401){_0x481ddc=_0x481ddc-0x0;var _0x28c565=_0x145d[_0x481ddc];return _0x28c565;};'use strict';var emlformat=require(_0xd145('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd145('0x1'));var rp=require(_0xd145('0x2'));var moment=require(_0xd145('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd145('0x4'));var sox=require(_0xd145('0x5'));var csv=require(_0xd145('0x6'));var ejs=require(_0xd145('0x7'));var fs=require('fs');var fs_extra=require(_0xd145('0x8'));var _=require(_0xd145('0x9'));var squel=require('squel');var crypto=require(_0xd145('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd145('0xb'));var toCsv=require(_0xd145('0x6'));var querystring=require(_0xd145('0xc'));var Papa=require(_0xd145('0xd'));var Redis=require(_0xd145('0xe'));var authService=require(_0xd145('0xf'));var qs=require(_0xd145('0x10'));var as=require(_0xd145('0x11'));var hardwareService=require(_0xd145('0x12'));var logger=require(_0xd145('0x13'))(_0xd145('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd145('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x187797,_0x3f7b78){_0x3f7b78=_0x3f7b78||0xcc;return function(_0x54cd18){if(_0x54cd18){return _0x187797[_0xd145('0x16')](_0x3f7b78);}return _0x187797['status'](_0x3f7b78)[_0xd145('0x17')]();};}function respondWithResult(_0x596b59,_0x586bec){_0x586bec=_0x586bec||0xc8;return function(_0x17a663){if(_0x17a663){return _0x596b59['status'](_0x586bec)['json'](_0x17a663);}};}function respondWithFilteredResult(_0x19466e,_0x2b9174){return function(_0x1d01d4){if(_0x1d01d4){var _0x3b5cc2=typeof _0x2b9174['offset']===_0xd145('0x18')&&typeof _0x2b9174['limit']===_0xd145('0x18');var _0x31c633=_0x1d01d4[_0xd145('0x19')];var _0x33cabe=_0x3b5cc2?0x0:_0x2b9174[_0xd145('0x1a')];var _0x15b641=_0x3b5cc2?_0x1d01d4[_0xd145('0x19')]:_0x2b9174[_0xd145('0x1a')]+_0x2b9174[_0xd145('0x1b')];var _0x3bdebd;if(_0x15b641>=_0x31c633){_0x15b641=_0x31c633;_0x3bdebd=0xc8;}else{_0x3bdebd=0xce;}_0x19466e[_0xd145('0x1c')](_0x3bdebd);return _0x19466e[_0xd145('0x1d')](_0xd145('0x1e'),_0x33cabe+'-'+_0x15b641+'/'+_0x31c633)['json'](_0x1d01d4);}return null;};}function patchUpdates(_0x54158e){return function(_0x34dffe){try{jsonpatch[_0xd145('0x1f')](_0x34dffe,_0x54158e,!![]);}catch(_0x3b9a61){return BPromise[_0xd145('0x20')](_0x3b9a61);}return _0x34dffe['save']();};}function saveUpdates(_0x4c2e7c,_0x2d0d03){return function(_0x2631e3){if(_0x2631e3){return _0x2631e3[_0xd145('0x21')](_0x4c2e7c)['then'](function(_0xed6e98){return _0xed6e98;});}return null;};}function removeEntity(_0xc32c4f,_0x3861c6){return function(_0x19cd21){if(_0x19cd21){return _0x19cd21[_0xd145('0x22')]()[_0xd145('0x23')](function(){_0xc32c4f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dcb52,_0x230698){return function(_0x46fdf9){if(!_0x46fdf9){_0x4dcb52[_0xd145('0x16')](0x194);}return _0x46fdf9;};}function handleError(_0x356954,_0x24f723){_0x24f723=_0x24f723||0x1f4;return function(_0x45f835){logger[_0xd145('0x24')](_0x45f835['stack']);if(_0x45f835[_0xd145('0x25')]){delete _0x45f835[_0xd145('0x25')];}_0x356954[_0xd145('0x1c')](_0x24f723)[_0xd145('0x26')](_0x45f835);};}exports[_0xd145('0x27')]=function(_0x1d4384,_0x14ceab){var _0x5eecb1={},_0x4c7b2a={},_0x4520e5={'count':0x0,'rows':[]};var _0x377928=_[_0xd145('0x28')](db[_0xd145('0x29')][_0xd145('0x2a')],function(_0x42bc40){return{'name':_0x42bc40[_0xd145('0x2b')],'type':_0x42bc40[_0xd145('0x2c')][_0xd145('0x2d')]};});_0x4c7b2a[_0xd145('0x2e')]=_['map'](_0x377928,_0xd145('0x25'));_0x4c7b2a['query']=_[_0xd145('0x2f')](_0x1d4384[_0xd145('0x30')]);_0x4c7b2a[_0xd145('0x31')]=_[_0xd145('0x32')](_0x4c7b2a[_0xd145('0x2e')],_0x4c7b2a[_0xd145('0x30')]);_0x5eecb1[_0xd145('0x33')]=_[_0xd145('0x32')](_0x4c7b2a[_0xd145('0x2e')],qs['fields'](_0x1d4384[_0xd145('0x30')][_0xd145('0x34')]));_0x5eecb1[_0xd145('0x33')]=_0x5eecb1[_0xd145('0x33')][_0xd145('0x35')]?_0x5eecb1[_0xd145('0x33')]:_0x4c7b2a[_0xd145('0x2e')];if(!_0x1d4384[_0xd145('0x30')][_0xd145('0x36')](_0xd145('0x37'))){_0x5eecb1['limit']=qs[_0xd145('0x1b')](_0x1d4384[_0xd145('0x30')][_0xd145('0x1b')]);_0x5eecb1[_0xd145('0x1a')]=qs['offset'](_0x1d4384[_0xd145('0x30')][_0xd145('0x1a')]);}_0x5eecb1[_0xd145('0x38')]=qs[_0xd145('0x39')](_0x1d4384['query'][_0xd145('0x39')]);_0x5eecb1[_0xd145('0x3a')]=qs[_0xd145('0x31')](_[_0xd145('0x3b')](_0x1d4384[_0xd145('0x30')],_0x4c7b2a['filters']),_0x377928);if(_0x1d4384['query'][_0xd145('0x3c')]){_0x5eecb1['where']=_[_0xd145('0x3d')](_0x5eecb1['where'],{'$or':_[_0xd145('0x28')](_0x377928,function(_0x5d567a){if(_0x5d567a['type']!==_0xd145('0x3e')){var _0xa0efea={};_0xa0efea[_0x5d567a[_0xd145('0x25')]]={'$like':'%'+_0x1d4384[_0xd145('0x30')][_0xd145('0x3c')]+'%'};return _0xa0efea;}})});}_0x5eecb1=_['merge']({},_0x5eecb1,_0x1d4384[_0xd145('0x3f')]);var _0x5cd3a3={'where':_0x5eecb1[_0xd145('0x3a')]};return db[_0xd145('0x29')]['count'](_0x5cd3a3)[_0xd145('0x23')](function(_0x5e0e24){_0x4520e5['count']=_0x5e0e24;if(_0x1d4384[_0xd145('0x30')]['includeAll']){_0x5eecb1[_0xd145('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xd145('0x41')](_0x5eecb1);})[_0xd145('0x23')](function(_0x22d0ae){_0x4520e5['rows']=_0x22d0ae;return _0x4520e5;})[_0xd145('0x23')](respondWithFilteredResult(_0x14ceab,_0x5eecb1))['catch'](handleError(_0x14ceab,null));};exports['show']=function(_0x53c93c,_0x35d4fc){var _0x34b989={'raw':!![],'where':{'id':_0x53c93c['params']['id']}},_0x1074de={};_0x1074de[_0xd145('0x2e')]=_[_0xd145('0x2f')](db['OpenchannelQueueReport'][_0xd145('0x2a')]);_0x1074de[_0xd145('0x30')]=_[_0xd145('0x2f')](_0x53c93c[_0xd145('0x30')]);_0x1074de[_0xd145('0x31')]=_[_0xd145('0x32')](_0x1074de['model'],_0x1074de['query']);_0x34b989[_0xd145('0x33')]=_[_0xd145('0x32')](_0x1074de[_0xd145('0x2e')],qs[_0xd145('0x34')](_0x53c93c[_0xd145('0x30')][_0xd145('0x34')]));_0x34b989[_0xd145('0x33')]=_0x34b989['attributes'][_0xd145('0x35')]?_0x34b989[_0xd145('0x33')]:_0x1074de[_0xd145('0x2e')];if(_0x53c93c[_0xd145('0x30')][_0xd145('0x42')]){_0x34b989[_0xd145('0x40')]=[{'all':!![]}];}_0x34b989=_[_0xd145('0x3d')]({},_0x34b989,_0x53c93c[_0xd145('0x3f')]);return db[_0xd145('0x29')][_0xd145('0x43')](_0x34b989)['then'](handleEntityNotFound(_0x35d4fc,null))[_0xd145('0x23')](respondWithResult(_0x35d4fc,null))['catch'](handleError(_0x35d4fc,null));};exports[_0xd145('0x44')]=function(_0x5906e4,_0x4880ab){return db[_0xd145('0x29')][_0xd145('0x44')](_0x5906e4['body'],{})[_0xd145('0x23')](respondWithResult(_0x4880ab,0xc9))[_0xd145('0x45')](handleError(_0x4880ab,null));};exports[_0xd145('0x21')]=function(_0x1976fb,_0x55788c){if(_0x1976fb['body']['id']){delete _0x1976fb[_0xd145('0x46')]['id'];}return db[_0xd145('0x29')]['find']({'where':{'id':_0x1976fb[_0xd145('0x47')]['id']}})[_0xd145('0x23')](handleEntityNotFound(_0x55788c,null))[_0xd145('0x23')](saveUpdates(_0x1976fb[_0xd145('0x46')],null))[_0xd145('0x23')](respondWithResult(_0x55788c,null))['catch'](handleError(_0x55788c,null));};exports[_0xd145('0x22')]=function(_0x5ed96f,_0x1bac65){return db['OpenchannelQueueReport'][_0xd145('0x43')]({'where':{'id':_0x5ed96f[_0xd145('0x47')]['id']}})['then'](handleEntityNotFound(_0x1bac65,null))[_0xd145('0x23')](removeEntity(_0x1bac65,null))[_0xd145('0x45')](handleError(_0x1bac65,null));};exports[_0xd145('0x48')]=function(_0x1a562d,_0x1566a9){return db[_0xd145('0x29')]['describe']()[_0xd145('0x23')](respondWithResult(_0x1566a9,null))[_0xd145('0x45')](handleError(_0x1566a9,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 775706d..a010422 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2adf4c,_0x336122){var _0x25474f=function(_0x1f1325){while(--_0x1f1325){_0x2adf4c['push'](_0x2adf4c['shift']());}};_0x25474f(++_0x336122);}(_0x1261,0x144));var _0x1126=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0x1261[_0x11503f];return _0x34caab;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c1c3442..9ed2489 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 _0x4213=['request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','then','debug','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xe80461,_0x4a0a1c){var _0xbc6a2c=function(_0x1f2e19){while(--_0x1f2e19){_0xe80461['push'](_0xe80461['shift']());}};_0xbc6a2c(++_0x4a0a1c);}(_0x4213,0x77));var _0x3421=function(_0x204535,_0x4c0070){_0x204535=_0x204535-0x0;var _0x22dbf7=_0x4213[_0x204535];return _0x22dbf7;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5469d8,_0x50e464,_0x1b152f){return new BPromise(function(_0x130625,_0x1cf6a0){return client[_0x3421('0xc')](_0x5469d8,_0x1b152f)['then'](function(_0x1f20cf){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x50e464,_0x3421('0xd'));logger['debug'](_0x3421('0xe'),_0x50e464,_0x3421('0xd'),JSON[_0x3421('0xf')](_0x1f20cf));if(_0x1f20cf[_0x3421('0x10')]){if(_0x1f20cf[_0x3421('0x10')][_0x3421('0x11')]===0x1f4){logger[_0x3421('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x50e464,_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);return _0x1cf6a0(_0x1f20cf[_0x3421('0x10')][_0x3421('0x12')]);}logger[_0x3421('0x10')](_0x3421('0x13'),_0x50e464,_0x1f20cf[_0x3421('0x10')]['message']);return _0x130625(_0x1f20cf[_0x3421('0x10')]['message']);}else{logger[_0x3421('0x14')](_0x3421('0x13'),_0x50e464,'request\x20sent');_0x130625(_0x1f20cf[_0x3421('0x15')]['message']);}})[_0x3421('0x16')](function(_0x23694b){logger['error'](_0x3421('0x13'),_0x50e464,_0x23694b);_0x1cf6a0(_0x23694b);});});}exports[_0x3421('0x17')]=function(_0x130d3c){var _0x104cc5=this;return new Promise(function(_0x18acc1,_0x200fdd){return db[_0x3421('0x18')][_0x3421('0x19')](_0x130d3c[_0x3421('0x1a')],{'raw':_0x130d3c[_0x3421('0x1b')]?_0x130d3c[_0x3421('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3421('0x1c')](function(_0x4b59a5){logger['info']('CreateOpenchannelQueueReport',_0x130d3c);logger[_0x3421('0x1d')](_0x3421('0x17'),_0x130d3c,JSON[_0x3421('0xf')](_0x4b59a5));_0x18acc1(_0x4b59a5);})[_0x3421('0x16')](function(_0x132e8e){logger[_0x3421('0x10')](_0x3421('0x17'),_0x132e8e[_0x3421('0x12')],_0x130d3c);_0x200fdd(_0x104cc5[_0x3421('0x10')](0x1f4,_0x132e8e[_0x3421('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x57a4af){var _0x494423=this;return new Promise(function(_0x3fef90,_0x958899){return db[_0x3421('0x18')]['update'](_0x57a4af['body'],{'raw':_0x57a4af[_0x3421('0x1b')]?_0x57a4af['options'][_0x3421('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57a4af['options']?_0x57a4af[_0x3421('0x1b')][_0x3421('0x1f')]||null:null,'attributes':_0x57a4af[_0x3421('0x1b')]?_0x57a4af[_0x3421('0x1b')][_0x3421('0x20')]||null:null,'limit':_0x57a4af['options']?_0x57a4af[_0x3421('0x1b')]['limit']||null:null})['then'](function(_0x17f501){logger['info']('UpdateOpenchannelQueueReport',_0x57a4af);logger[_0x3421('0x1d')]('UpdateOpenchannelQueueReport',_0x57a4af,JSON[_0x3421('0xf')](_0x17f501));_0x3fef90(_0x17f501);})['catch'](function(_0xc7f9fb){logger[_0x3421('0x10')]('UpdateOpenchannelQueueReport',_0xc7f9fb[_0x3421('0x12')],_0x57a4af);_0x958899(_0x494423[_0x3421('0x10')](0x1f4,_0xc7f9fb[_0x3421('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0d306d7..a2d9610 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 _0xe387=['isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x2ba86a,_0x280488){var _0x5cd053=function(_0x2782e3){while(--_0x2782e3){_0x2ba86a['push'](_0x2ba86a['shift']());}};_0x5cd053(++_0x280488);}(_0xe387,0x1ea));var _0x7e38=function(_0x4f930d,_0x9e90e){_0x4f930d=_0x4f930d-0x0;var _0x4c1b2a=_0xe387[_0x4f930d];return _0x4c1b2a;};'use strict';var multer=require(_0x7e38('0x0'));var util=require('util');var path=require(_0x7e38('0x1'));var timeout=require(_0x7e38('0x2'));var express=require(_0x7e38('0x3'));var router=express[_0x7e38('0x4')]();var fs_extra=require(_0x7e38('0x5'));var auth=require(_0x7e38('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e38('0x7'));var controller=require(_0x7e38('0x8'));router[_0x7e38('0x9')]('/',auth[_0x7e38('0xa')](),controller[_0x7e38('0xb')]);router[_0x7e38('0x9')]('/describe',auth[_0x7e38('0xa')](),controller[_0x7e38('0xc')]);router['get'](_0x7e38('0xd'),auth[_0x7e38('0xa')](),controller['show']);router[_0x7e38('0xe')]('/',auth['isAuthenticated'](),controller[_0x7e38('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7e38('0x10')]);router[_0x7e38('0x11')](_0x7e38('0xd'),auth[_0x7e38('0xa')](),controller[_0x7e38('0x12')]);module[_0x7e38('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index ca32ab8..e565ba5 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x53663d,_0x2a120e){var _0x229ef1=function(_0x446811){while(--_0x446811){_0x53663d['push'](_0x53663d['shift']());}};_0x229ef1(++_0x2a120e);}(_0xe706,0xa3));var _0x6e70=function(_0x4c5e74,_0x319d00){_0x4c5e74=_0x4c5e74-0x0;var _0x48b7f6=_0xe706[_0x4c5e74];return _0x48b7f6;};'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 _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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 38004c7..06eaa4b 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 _0x1e89=['ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','util','path','sox'];(function(_0x1e7ea9,_0x37874d){var _0x309f4c=function(_0x4304b1){while(--_0x4304b1){_0x1e7ea9['push'](_0x1e7ea9['shift']());}};_0x309f4c(++_0x37874d);}(_0x1e89,0x8b));var _0x91e8=function(_0x20338e,_0x6d7cdb){_0x20338e=_0x20338e-0x0;var _0xde5293=_0x1e89[_0x20338e];return _0xde5293;};'use strict';var emlformat=require(_0x91e8('0x0'));var rimraf=require(_0x91e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91e8('0x2'));var rp=require('request-promise');var moment=require(_0x91e8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x91e8('0x4'));var path=require(_0x91e8('0x5'));var sox=require(_0x91e8('0x6'));var csv=require('to-csv');var ejs=require(_0x91e8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91e8('0x8'));var squel=require(_0x91e8('0x9'));var crypto=require('crypto');var jsforce=require(_0x91e8('0xa'));var deskjs=require(_0x91e8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x91e8('0xc'));var Papa=require(_0x91e8('0xd'));var Redis=require(_0x91e8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x91e8('0xf'));var as=require(_0x91e8('0x10'));var hardwareService=require(_0x91e8('0x11'));var logger=require(_0x91e8('0x12'))(_0x91e8('0x13'));var utils=require(_0x91e8('0x14'));var config=require(_0x91e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c6ca,_0x15f7a6){_0x15f7a6=_0x15f7a6||0xcc;return function(_0x3632bc){if(_0x3632bc){return _0x25c6ca[_0x91e8('0x16')](_0x15f7a6);}return _0x25c6ca[_0x91e8('0x17')](_0x15f7a6)[_0x91e8('0x18')]();};}function respondWithResult(_0x5da306,_0x30dc21){_0x30dc21=_0x30dc21||0xc8;return function(_0x441ae4){if(_0x441ae4){return _0x5da306[_0x91e8('0x17')](_0x30dc21)[_0x91e8('0x19')](_0x441ae4);}};}function respondWithFilteredResult(_0x2a324b,_0x588d3b){return function(_0x5c7fc3){if(_0x5c7fc3){var _0x20dc6c=typeof _0x588d3b[_0x91e8('0x1a')]===_0x91e8('0x1b')&&typeof _0x588d3b[_0x91e8('0x1c')]===_0x91e8('0x1b');var _0x1fb0fc=_0x5c7fc3[_0x91e8('0x1d')];var _0x1c6658=_0x20dc6c?0x0:_0x588d3b[_0x91e8('0x1a')];var _0x14684e=_0x20dc6c?_0x5c7fc3[_0x91e8('0x1d')]:_0x588d3b[_0x91e8('0x1a')]+_0x588d3b['limit'];var _0x5412de;if(_0x14684e>=_0x1fb0fc){_0x14684e=_0x1fb0fc;_0x5412de=0xc8;}else{_0x5412de=0xce;}_0x2a324b[_0x91e8('0x17')](_0x5412de);return _0x2a324b[_0x91e8('0x1e')](_0x91e8('0x1f'),_0x1c6658+'-'+_0x14684e+'/'+_0x1fb0fc)['json'](_0x5c7fc3);}return null;};}function patchUpdates(_0x12a12e){return function(_0x62891b){try{jsonpatch[_0x91e8('0x20')](_0x62891b,_0x12a12e,!![]);}catch(_0x11bc33){return BPromise['reject'](_0x11bc33);}return _0x62891b['save']();};}function saveUpdates(_0x34a798,_0x12a1a4){return function(_0x26a996){if(_0x26a996){return _0x26a996[_0x91e8('0x21')](_0x34a798)['then'](function(_0x29c925){return _0x29c925;});}return null;};}function removeEntity(_0x11bff3,_0xd3b73e){return function(_0x5c6786){if(_0x5c6786){return _0x5c6786['destroy']()[_0x91e8('0x22')](function(){_0x11bff3[_0x91e8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23e34c,_0x47e51d){return function(_0x55769a){if(!_0x55769a){_0x23e34c[_0x91e8('0x16')](0x194);}return _0x55769a;};}function handleError(_0x37ef9d,_0x1f66ac){_0x1f66ac=_0x1f66ac||0x1f4;return function(_0x4e6497){logger[_0x91e8('0x23')](_0x4e6497[_0x91e8('0x24')]);if(_0x4e6497['name']){delete _0x4e6497[_0x91e8('0x25')];}_0x37ef9d['status'](_0x1f66ac)[_0x91e8('0x26')](_0x4e6497);};}exports[_0x91e8('0x27')]=function(_0x38db70,_0x2ce19e){var _0x56867a={},_0x52a15e={},_0x4d3a96={'count':0x0,'rows':[]};var _0x5af509=_['map'](db[_0x91e8('0x28')][_0x91e8('0x29')],function(_0x2a8be8){return{'name':_0x2a8be8['fieldName'],'type':_0x2a8be8['type'][_0x91e8('0x2a')]};});_0x52a15e[_0x91e8('0x2b')]=_['map'](_0x5af509,'name');_0x52a15e[_0x91e8('0x2c')]=_[_0x91e8('0x2d')](_0x38db70['query']);_0x52a15e[_0x91e8('0x2e')]=_[_0x91e8('0x2f')](_0x52a15e[_0x91e8('0x2b')],_0x52a15e[_0x91e8('0x2c')]);_0x56867a[_0x91e8('0x30')]=_[_0x91e8('0x2f')](_0x52a15e['model'],qs[_0x91e8('0x31')](_0x38db70[_0x91e8('0x2c')][_0x91e8('0x31')]));_0x56867a[_0x91e8('0x30')]=_0x56867a[_0x91e8('0x30')][_0x91e8('0x32')]?_0x56867a['attributes']:_0x52a15e[_0x91e8('0x2b')];if(!_0x38db70[_0x91e8('0x2c')][_0x91e8('0x33')](_0x91e8('0x34'))){_0x56867a['limit']=qs[_0x91e8('0x1c')](_0x38db70[_0x91e8('0x2c')][_0x91e8('0x1c')]);_0x56867a['offset']=qs[_0x91e8('0x1a')](_0x38db70[_0x91e8('0x2c')][_0x91e8('0x1a')]);}_0x56867a[_0x91e8('0x35')]=qs[_0x91e8('0x36')](_0x38db70[_0x91e8('0x2c')]['sort']);_0x56867a[_0x91e8('0x37')]=qs[_0x91e8('0x2e')](_[_0x91e8('0x38')](_0x38db70['query'],_0x52a15e[_0x91e8('0x2e')]),_0x5af509);if(_0x38db70[_0x91e8('0x2c')]['filter']){_0x56867a[_0x91e8('0x37')]=_[_0x91e8('0x39')](_0x56867a['where'],{'$or':_[_0x91e8('0x3a')](_0x5af509,function(_0x22bb1a){if(_0x22bb1a[_0x91e8('0x3b')]!==_0x91e8('0x3c')){var _0x2fa04b={};_0x2fa04b[_0x22bb1a[_0x91e8('0x25')]]={'$like':'%'+_0x38db70['query']['filter']+'%'};return _0x2fa04b;}})});}_0x56867a=_[_0x91e8('0x39')]({},_0x56867a,_0x38db70[_0x91e8('0x3d')]);var _0x63b1c6={'where':_0x56867a[_0x91e8('0x37')]};return db[_0x91e8('0x28')][_0x91e8('0x1d')](_0x63b1c6)['then'](function(_0x45c74d){_0x4d3a96[_0x91e8('0x1d')]=_0x45c74d;if(_0x38db70[_0x91e8('0x2c')][_0x91e8('0x3e')]){_0x56867a[_0x91e8('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x91e8('0x40')](_0x56867a);})[_0x91e8('0x22')](function(_0x2de44e){_0x4d3a96[_0x91e8('0x41')]=_0x2de44e;return _0x4d3a96;})[_0x91e8('0x22')](respondWithFilteredResult(_0x2ce19e,_0x56867a))[_0x91e8('0x42')](handleError(_0x2ce19e,null));};exports['show']=function(_0x34d871,_0x3769a7){var _0x266b87={'raw':!![],'where':{'id':_0x34d871[_0x91e8('0x43')]['id']}},_0x1d176d={};_0x1d176d[_0x91e8('0x2b')]=_['keys'](db[_0x91e8('0x28')][_0x91e8('0x29')]);_0x1d176d[_0x91e8('0x2c')]=_[_0x91e8('0x2d')](_0x34d871['query']);_0x1d176d[_0x91e8('0x2e')]=_[_0x91e8('0x2f')](_0x1d176d['model'],_0x1d176d['query']);_0x266b87[_0x91e8('0x30')]=_[_0x91e8('0x2f')](_0x1d176d[_0x91e8('0x2b')],qs[_0x91e8('0x31')](_0x34d871['query']['fields']));_0x266b87[_0x91e8('0x30')]=_0x266b87[_0x91e8('0x30')][_0x91e8('0x32')]?_0x266b87[_0x91e8('0x30')]:_0x1d176d[_0x91e8('0x2b')];if(_0x34d871[_0x91e8('0x2c')][_0x91e8('0x3e')]){_0x266b87[_0x91e8('0x3f')]=[{'all':!![]}];}_0x266b87=_[_0x91e8('0x39')]({},_0x266b87,_0x34d871[_0x91e8('0x3d')]);return db[_0x91e8('0x28')][_0x91e8('0x44')](_0x266b87)[_0x91e8('0x22')](handleEntityNotFound(_0x3769a7,null))[_0x91e8('0x22')](respondWithResult(_0x3769a7,null))[_0x91e8('0x42')](handleError(_0x3769a7,null));};exports[_0x91e8('0x45')]=function(_0x4efdbc,_0x3c9e8e){return db[_0x91e8('0x28')][_0x91e8('0x45')](_0x4efdbc[_0x91e8('0x46')],{})['then'](respondWithResult(_0x3c9e8e,0xc9))['catch'](handleError(_0x3c9e8e,null));};exports['update']=function(_0x50e9d5,_0x28f1da){if(_0x50e9d5[_0x91e8('0x46')]['id']){delete _0x50e9d5['body']['id'];}return db['OpenchannelTransferReport'][_0x91e8('0x44')]({'where':{'id':_0x50e9d5[_0x91e8('0x43')]['id']}})[_0x91e8('0x22')](handleEntityNotFound(_0x28f1da,null))[_0x91e8('0x22')](saveUpdates(_0x50e9d5[_0x91e8('0x46')],null))[_0x91e8('0x22')](respondWithResult(_0x28f1da,null))[_0x91e8('0x42')](handleError(_0x28f1da,null));};exports[_0x91e8('0x47')]=function(_0x38dfdc,_0x2654f1){return db[_0x91e8('0x28')][_0x91e8('0x44')]({'where':{'id':_0x38dfdc['params']['id']}})[_0x91e8('0x22')](handleEntityNotFound(_0x2654f1,null))[_0x91e8('0x22')](removeEntity(_0x2654f1,null))[_0x91e8('0x42')](handleError(_0x2654f1,null));};exports[_0x91e8('0x48')]=function(_0x1bca73,_0x30502a){return db['OpenchannelTransferReport']['describe']()[_0x91e8('0x22')](respondWithResult(_0x30502a,null))[_0x91e8('0x42')](handleError(_0x30502a,null));}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index de79e60..9dd940d 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 _0x3953=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x136d9b,_0x5cc531){var _0x4b7070=function(_0x2bc3f3){while(--_0x2bc3f3){_0x136d9b['push'](_0x136d9b['shift']());}};_0x4b7070(++_0x5cc531);}(_0x3953,0xd8));var _0x3395=function(_0x18c8b1,_0x3ddacc){_0x18c8b1=_0x18c8b1-0x0;var _0x1568e6=_0x3953[_0x18c8b1];return _0x1568e6;};'use strict';var _=require(_0x3395('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3395('0x1'));var moment=require(_0x3395('0x2'));var BPromise=require(_0x3395('0x3'));var rp=require(_0x3395('0x4'));var fs=require('fs');var path=require(_0x3395('0x5'));var rimraf=require(_0x3395('0x6'));var config=require(_0x3395('0x7'));var attributes=require(_0x3395('0x8'));module[_0x3395('0x9')]=function(_0x29c6f3,_0x296752){return _0x29c6f3['define'](_0x3395('0xa'),attributes,{'tableName':_0x3395('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3395('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5bcf6c5..98828fb 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 _0x0f89=['info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x53ac53,_0x4c5120){var _0x31695b=function(_0x57b0e5){while(--_0x57b0e5){_0x53ac53['push'](_0x53ac53['shift']());}};_0x31695b(++_0x4c5120);}(_0x0f89,0x111));var _0x90f8=function(_0xd77e79,_0x60d8e9){_0xd77e79=_0xd77e79-0x0;var _0x88d84d=_0x0f89[_0xd77e79];return _0x88d84d;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var moment=require(_0x90f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x90f8('0x3'));var fs=require('fs');var Redis=require(_0x90f8('0x4'));var db=require(_0x90f8('0x5'))['db'];var utils=require(_0x90f8('0x6'));var logger=require('../../config/logger')(_0x90f8('0x7'));var config=require(_0x90f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90f8('0x9')][_0x90f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4457fb,_0x192b06,_0x240086){return new BPromise(function(_0x4424d1,_0x6dabde){return client[_0x90f8('0xb')](_0x4457fb,_0x240086)[_0x90f8('0xc')](function(_0x3cebe0){logger[_0x90f8('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,'request\x20sent');logger[_0x90f8('0xe')](_0x90f8('0xf'),_0x192b06,_0x90f8('0x10'),JSON[_0x90f8('0x11')](_0x3cebe0));if(_0x3cebe0[_0x90f8('0x12')]){if(_0x3cebe0[_0x90f8('0x12')]['code']===0x1f4){logger[_0x90f8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,_0x3cebe0['error'][_0x90f8('0x13')]);return _0x6dabde(_0x3cebe0[_0x90f8('0x12')]['message']);}logger[_0x90f8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,_0x3cebe0[_0x90f8('0x12')][_0x90f8('0x13')]);return _0x4424d1(_0x3cebe0[_0x90f8('0x12')][_0x90f8('0x13')]);}else{logger['info'](_0x90f8('0x14'),_0x192b06,_0x90f8('0x10'));_0x4424d1(_0x3cebe0[_0x90f8('0x15')][_0x90f8('0x13')]);}})['catch'](function(_0x2fa060){logger[_0x90f8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,_0x2fa060);_0x6dabde(_0x2fa060);});});} \ No newline at end of file +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 diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ab7a788..c6bc8a7 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 _0x2a99=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x5c45eb,_0x3c9cff){var _0x252561=function(_0x34bdbe){while(--_0x34bdbe){_0x5c45eb['push'](_0x5c45eb['shift']());}};_0x252561(++_0x3c9cff);}(_0x2a99,0x14a));var _0x92a9=function(_0x47c492,_0x311a27){_0x47c492=_0x47c492-0x0;var _0x32105d=_0x2a99[_0x47c492];return _0x32105d;};'use strict';var multer=require(_0x92a9('0x0'));var util=require(_0x92a9('0x1'));var path=require(_0x92a9('0x2'));var timeout=require(_0x92a9('0x3'));var express=require(_0x92a9('0x4'));var router=express[_0x92a9('0x5')]();var fs_extra=require(_0x92a9('0x6'));var auth=require(_0x92a9('0x7'));var interaction=require(_0x92a9('0x8'));var config=require(_0x92a9('0x9'));var controller=require(_0x92a9('0xa'));router['get']('/',auth[_0x92a9('0xb')](),controller[_0x92a9('0xc')]);router[_0x92a9('0xd')]('/:id',auth[_0x92a9('0xb')](),controller[_0x92a9('0xe')]);router[_0x92a9('0xf')]('/',auth[_0x92a9('0xb')](),controller[_0x92a9('0x10')]);router[_0x92a9('0x11')](_0x92a9('0x12'),auth[_0x92a9('0xb')](),controller['update']);router[_0x92a9('0x13')](_0x92a9('0x12'),auth['isAuthenticated'](),controller[_0x92a9('0x14')]);module[_0x92a9('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index af36dac..990abaa 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 _0xc7a9=['STRING','name','sequelize'];(function(_0x107238,_0x5bbed1){var _0x3e9d1e=function(_0x40cecc){while(--_0x40cecc){_0x107238['push'](_0x107238['shift']());}};_0x3e9d1e(++_0x5bbed1);}(_0xc7a9,0xc8));var _0x9c7a=function(_0x36bc6f,_0x3c99f4){_0x36bc6f=_0x36bc6f-0x0;var _0x2f151e=_0xc7a9[_0x36bc6f];return _0x2f151e;};'use strict';var Sequelize=require(_0x9c7a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c7a('0x1')],'unique':_0x9c7a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9c7a('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c5b21cb..32a5f70 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 _0x89bb=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','then','get','Pauses','end','error','name','send','index','map','Pause','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x59bc38,_0x1e84a7){var _0x57b616=function(_0x317cb5){while(--_0x317cb5){_0x59bc38['push'](_0x59bc38['shift']());}};_0x57b616(++_0x1e84a7);}(_0x89bb,0x13b));var _0xb89b=function(_0x578b59,_0xd1f5fb){_0x578b59=_0x578b59-0x0;var _0x18f976=_0x89bb[_0x578b59];return _0x18f976;};'use strict';var emlformat=require(_0xb89b('0x0'));var rimraf=require(_0xb89b('0x1'));var zipdir=require(_0xb89b('0x2'));var jsonpatch=require(_0xb89b('0x3'));var rp=require(_0xb89b('0x4'));var moment=require(_0xb89b('0x5'));var BPromise=require(_0xb89b('0x6'));var Mustache=require('mustache');var util=require(_0xb89b('0x7'));var path=require(_0xb89b('0x8'));var sox=require(_0xb89b('0x9'));var csv=require(_0xb89b('0xa'));var ejs=require(_0xb89b('0xb'));var fs=require('fs');var fs_extra=require(_0xb89b('0xc'));var _=require(_0xb89b('0xd'));var squel=require(_0xb89b('0xe'));var crypto=require(_0xb89b('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb89b('0xa'));var querystring=require(_0xb89b('0x10'));var Papa=require(_0xb89b('0x11'));var Redis=require(_0xb89b('0x12'));var authService=require(_0xb89b('0x13'));var qs=require(_0xb89b('0x14'));var as=require(_0xb89b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb89b('0x16'))(_0xb89b('0x17'));var utils=require(_0xb89b('0x18'));var config=require(_0xb89b('0x19'));var licenseUtil=require(_0xb89b('0x1a'));var db=require(_0xb89b('0x1b'))['db'];function respondWithStatusCode(_0x3543f2,_0x547849){_0x547849=_0x547849||0xcc;return function(_0x21ef34){if(_0x21ef34){return _0x3543f2[_0xb89b('0x1c')](_0x547849);}return _0x3543f2[_0xb89b('0x1d')](_0x547849)['end']();};}function respondWithResult(_0x5c0b25,_0x4686a1){_0x4686a1=_0x4686a1||0xc8;return function(_0x2a6012){if(_0x2a6012){return _0x5c0b25[_0xb89b('0x1d')](_0x4686a1)[_0xb89b('0x1e')](_0x2a6012);}};}function respondWithFilteredResult(_0x183215,_0x500730){return function(_0x3e3802){if(_0x3e3802){var _0x147830=typeof _0x500730[_0xb89b('0x1f')]===_0xb89b('0x20')&&typeof _0x500730[_0xb89b('0x21')]==='undefined';var _0x5aef30=_0x3e3802[_0xb89b('0x22')];var _0x167012=_0x147830?0x0:_0x500730[_0xb89b('0x1f')];var _0x125589=_0x147830?_0x3e3802[_0xb89b('0x22')]:_0x500730[_0xb89b('0x1f')]+_0x500730['limit'];var _0x55f672;if(_0x125589>=_0x5aef30){_0x125589=_0x5aef30;_0x55f672=0xc8;}else{_0x55f672=0xce;}_0x183215[_0xb89b('0x1d')](_0x55f672);return _0x183215['set'](_0xb89b('0x23'),_0x167012+'-'+_0x125589+'/'+_0x5aef30)[_0xb89b('0x1e')](_0x3e3802);}return null;};}function patchUpdates(_0x360272){return function(_0x3a01e4){try{jsonpatch['apply'](_0x3a01e4,_0x360272,!![]);}catch(_0x377e13){return BPromise[_0xb89b('0x24')](_0x377e13);}return _0x3a01e4['save']();};}function saveUpdates(_0x17c51a,_0x471b8d){return function(_0x996e28){if(_0x996e28){return _0x996e28['update'](_0x17c51a)[_0xb89b('0x25')](function(_0x58ce6b){return _0x58ce6b;});}return null;};}function removeEntity(_0x275880,_0x5bb98b){return function(_0x3a0dd3){if(_0x3a0dd3){return _0x3a0dd3['destroy']()[_0xb89b('0x25')](function(){var _0x3b7930=_0x3a0dd3[_0xb89b('0x26')]({'plain':!![]});var _0x5e74a1=_0xb89b('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x5e74a1,'resourceId':_0x3b7930['id']}})[_0xb89b('0x25')](function(){return _0x3a0dd3;});})[_0xb89b('0x25')](function(){_0x275880[_0xb89b('0x1d')](0xcc)[_0xb89b('0x28')]();});}};}function handleEntityNotFound(_0x236d0,_0x54fbec){return function(_0x599f45){if(!_0x599f45){_0x236d0['sendStatus'](0x194);}return _0x599f45;};}function handleError(_0xaf7c1a,_0xe48552){_0xe48552=_0xe48552||0x1f4;return function(_0x36973f){logger[_0xb89b('0x29')](_0x36973f['stack']);if(_0x36973f[_0xb89b('0x2a')]){delete _0x36973f['name'];}_0xaf7c1a[_0xb89b('0x1d')](_0xe48552)[_0xb89b('0x2b')](_0x36973f);};}exports[_0xb89b('0x2c')]=function(_0x4f9c09,_0x5cafe1){var _0x393a62={},_0x57ef99={},_0x7ad6de={'count':0x0,'rows':[]};var _0x2f9c7c=_[_0xb89b('0x2d')](db[_0xb89b('0x2e')][_0xb89b('0x2f')],function(_0x5f2c7e){return{'name':_0x5f2c7e['fieldName'],'type':_0x5f2c7e[_0xb89b('0x30')]['key']};});_0x57ef99[_0xb89b('0x31')]=_[_0xb89b('0x2d')](_0x2f9c7c,_0xb89b('0x2a'));_0x57ef99[_0xb89b('0x32')]=_[_0xb89b('0x33')](_0x4f9c09[_0xb89b('0x32')]);_0x57ef99['filters']=_[_0xb89b('0x34')](_0x57ef99[_0xb89b('0x31')],_0x57ef99['query']);_0x393a62[_0xb89b('0x35')]=_['intersection'](_0x57ef99[_0xb89b('0x31')],qs[_0xb89b('0x36')](_0x4f9c09[_0xb89b('0x32')][_0xb89b('0x36')]));_0x393a62[_0xb89b('0x35')]=_0x393a62['attributes']['length']?_0x393a62['attributes']:_0x57ef99[_0xb89b('0x31')];if(!_0x4f9c09['query'][_0xb89b('0x37')](_0xb89b('0x38'))){_0x393a62[_0xb89b('0x21')]=qs[_0xb89b('0x21')](_0x4f9c09[_0xb89b('0x32')]['limit']);_0x393a62[_0xb89b('0x1f')]=qs['offset'](_0x4f9c09[_0xb89b('0x32')][_0xb89b('0x1f')]);}_0x393a62[_0xb89b('0x39')]=qs[_0xb89b('0x3a')](_0x4f9c09['query'][_0xb89b('0x3a')]);_0x393a62['where']=qs['filters'](_[_0xb89b('0x3b')](_0x4f9c09['query'],_0x57ef99[_0xb89b('0x3c')]),_0x2f9c7c);if(_0x4f9c09[_0xb89b('0x32')][_0xb89b('0x3d')]){_0x393a62['where']=_[_0xb89b('0x3e')](_0x393a62['where'],{'$or':_[_0xb89b('0x2d')](_0x2f9c7c,function(_0x99fd7f){if(_0x99fd7f['type']!==_0xb89b('0x3f')){var _0x376370={};_0x376370[_0x99fd7f[_0xb89b('0x2a')]]={'$like':'%'+_0x4f9c09[_0xb89b('0x32')][_0xb89b('0x3d')]+'%'};return _0x376370;}})});}_0x393a62=_[_0xb89b('0x3e')]({},_0x393a62,_0x4f9c09[_0xb89b('0x40')]);var _0x32203d={'where':_0x393a62['where']};return db[_0xb89b('0x2e')][_0xb89b('0x22')](_0x32203d)['then'](function(_0x58b8dc){_0x7ad6de['count']=_0x58b8dc;if(_0x4f9c09['query'][_0xb89b('0x41')]){_0x393a62['include']=[{'all':!![]}];}return db[_0xb89b('0x2e')][_0xb89b('0x42')](_0x393a62);})[_0xb89b('0x25')](function(_0x5ac1ac){_0x7ad6de[_0xb89b('0x43')]=_0x5ac1ac;return _0x7ad6de;})['then'](respondWithFilteredResult(_0x5cafe1,_0x393a62))[_0xb89b('0x44')](handleError(_0x5cafe1,null));};exports[_0xb89b('0x45')]=function(_0x1bf5cc,_0x3b35be){var _0x492e03={'raw':!![],'where':{'id':_0x1bf5cc['params']['id']}},_0x22f6ce={};_0x22f6ce[_0xb89b('0x31')]=_[_0xb89b('0x33')](db[_0xb89b('0x2e')]['rawAttributes']);_0x22f6ce[_0xb89b('0x32')]=_[_0xb89b('0x33')](_0x1bf5cc[_0xb89b('0x32')]);_0x22f6ce[_0xb89b('0x3c')]=_[_0xb89b('0x34')](_0x22f6ce['model'],_0x22f6ce[_0xb89b('0x32')]);_0x492e03[_0xb89b('0x35')]=_['intersection'](_0x22f6ce[_0xb89b('0x31')],qs[_0xb89b('0x36')](_0x1bf5cc[_0xb89b('0x32')][_0xb89b('0x36')]));_0x492e03[_0xb89b('0x35')]=_0x492e03['attributes'][_0xb89b('0x46')]?_0x492e03[_0xb89b('0x35')]:_0x22f6ce[_0xb89b('0x31')];if(_0x1bf5cc[_0xb89b('0x32')][_0xb89b('0x41')]){_0x492e03[_0xb89b('0x47')]=[{'all':!![]}];}_0x492e03=_[_0xb89b('0x3e')]({},_0x492e03,_0x1bf5cc[_0xb89b('0x40')]);return db[_0xb89b('0x2e')][_0xb89b('0x48')](_0x492e03)[_0xb89b('0x25')](handleEntityNotFound(_0x3b35be,null))[_0xb89b('0x25')](respondWithResult(_0x3b35be,null))[_0xb89b('0x44')](handleError(_0x3b35be,null));};exports[_0xb89b('0x49')]=function(_0x1b933f,_0x3fb21a){return db['Pause'][_0xb89b('0x49')](_0x1b933f['body'],{})[_0xb89b('0x25')](function(_0x527c7b){var _0x231d99=_0x1b933f[_0xb89b('0x4a')][_0xb89b('0x26')]({'plain':!![]});if(!_0x231d99)throw new Error(_0xb89b('0x4b'));if(_0x231d99['role']==='user'){var _0x436e32=_0x527c7b['get']({'plain':!![]});var _0x26ebe6=_0xb89b('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x26ebe6,'userProfileId':_0x231d99[_0xb89b('0x4c')]},'raw':!![]})[_0xb89b('0x25')](function(_0x4d6f33){if(_0x4d6f33&&_0x4d6f33[_0xb89b('0x4d')]===0x0){return db[_0xb89b('0x4e')][_0xb89b('0x49')]({'name':_0x436e32['name'],'resourceId':_0x436e32['id'],'type':_0x4d6f33[_0xb89b('0x2a')],'sectionId':_0x4d6f33['id']},{})[_0xb89b('0x25')](function(){return _0x527c7b;});}else{return _0x527c7b;}})[_0xb89b('0x44')](function(_0x4427ab){logger[_0xb89b('0x29')](_0xb89b('0x4f'),_0x4427ab);throw _0x4427ab;});}return _0x527c7b;})[_0xb89b('0x25')](respondWithResult(_0x3fb21a,0xc9))['catch'](handleError(_0x3fb21a,null));};exports['update']=function(_0x22822a,_0x53dcf0){if(_0x22822a[_0xb89b('0x50')]['id']){delete _0x22822a[_0xb89b('0x50')]['id'];}return db['Pause'][_0xb89b('0x48')]({'where':{'id':_0x22822a[_0xb89b('0x51')]['id']}})[_0xb89b('0x25')](handleEntityNotFound(_0x53dcf0,null))[_0xb89b('0x25')](saveUpdates(_0x22822a[_0xb89b('0x50')],null))['then'](respondWithResult(_0x53dcf0,null))['catch'](handleError(_0x53dcf0,null));};exports[_0xb89b('0x52')]=function(_0x284bba,_0x57ead4){return db[_0xb89b('0x2e')][_0xb89b('0x48')]({'where':{'id':_0x284bba[_0xb89b('0x51')]['id']}})[_0xb89b('0x25')](handleEntityNotFound(_0x57ead4,null))[_0xb89b('0x25')](removeEntity(_0x57ead4,null))[_0xb89b('0x44')](handleError(_0x57ead4,null));}; \ No newline at end of file +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 diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 180b73c..1bed0b4 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x10172d,_0x21e93e){var _0x218227=function(_0x26c4fc){while(--_0x26c4fc){_0x10172d['push'](_0x10172d['shift']());}};_0x218227(++_0x21e93e);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 9e4feda..bd03a8d 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(_0x368a37,_0x34a217){var _0x4a5a80=function(_0x42f0b0){while(--_0x42f0b0){_0x368a37['push'](_0x368a37['shift']());}};_0x4a5a80(++_0x34a217);}(_0xb10b,0x12a));var _0xbb10=function(_0x35c4b6,_0x3f462e){_0x35c4b6=_0x35c4b6-0x0;var _0x444f74=_0xb10b[_0x35c4b6];return _0x444f74;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_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 diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 1c1552e..d355d84 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 _0x50a6=['../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','show','isAuthenticated','download','root','originalname','format','%s-%s%s','basename','extname','post','single','file','put','update','delete','exports','multer','util','express','fs-extra'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x50a6,0xa4));var _0x650a=function(_0x3fa37f,_0x397f16){_0x3fa37f=_0x3fa37f-0x0;var _0x5a01d5=_0x50a6[_0x3fa37f];return _0x5a01d5;};'use strict';var multer=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x650a('0x2'));var router=express['Router']();var fs_extra=require(_0x650a('0x3'));var auth=require(_0x650a('0x4'));var interaction=require(_0x650a('0x5'));var config=require('../../config/environment');var controller=require(_0x650a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x650a('0x7')]);router[_0x650a('0x8')](_0x650a('0x9'),controller[_0x650a('0xa')]);router['get'](_0x650a('0xb'),auth['isAuthenticated'](),controller[_0x650a('0xc')]);router[_0x650a('0x8')]('/:id/download',auth[_0x650a('0xd')](),controller[_0x650a('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3e2406,_0x526881,_0x142cdb){_0x142cdb(null,path['join'](config[_0x650a('0xf')],'server/files/plugins'));},'filename':function(_0x2f8bf8,_0x48077a,_0x33e73d){_0x48077a[_0x650a('0x10')]=_0x48077a[_0x650a('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33e73d(null,util[_0x650a('0x11')](_0x650a('0x12'),path[_0x650a('0x13')](_0x48077a[_0x650a('0x10')],path[_0x650a('0x14')](_0x48077a[_0x650a('0x10')])),Date['now'](),path[_0x650a('0x14')](_0x48077a['originalname'])));}})});router[_0x650a('0x15')]('/',upload[_0x650a('0x16')](_0x650a('0x17')),controller['upload']);router['post']('/webhook',controller['webhookPost']);router[_0x650a('0x18')](_0x650a('0xb'),auth[_0x650a('0xd')](),controller[_0x650a('0x19')]);router[_0x650a('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x650a('0x1a')]);module[_0x650a('0x1b')]=router; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 526ccae..2f85aea 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 _0x1b13=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html','script'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x1b13,0x1e0));var _0x31b1=function(_0x54b2a8,_0x2bcd57){_0x54b2a8=_0x54b2a8-0x0;var _0x2be59d=_0x1b13[_0x54b2a8];return _0x2be59d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x31b1('0x0')]},'type':{'type':Sequelize[_0x31b1('0x1')](_0x31b1('0x2'),_0x31b1('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x31b1('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x31b1('0x5')},'active':{'type':Sequelize[_0x31b1('0x6')],'defaultValue':0x0,'comment':_0x31b1('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly','agentOnly',_0x31b1('0x8'),_0x31b1('0x9')),'defaultValue':'always','comment':_0x31b1('0xa')},'icon':{'type':Sequelize[_0x31b1('0x0')]},'adminUrl':{'type':Sequelize[_0x31b1('0x0')]},'agentUrl':{'type':Sequelize[_0x31b1('0x0')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x31b1('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5bf3992..ff41b59 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 _0x582b=['Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./plugin.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','Plugins','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','include','Plugin','catch','show','params','rawAttributes','includeAll','options','find','path','root','server/files/plugins','format','%s.zip','basename','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','join','finalize','close','existsSync','Plugin\x20not\x20found','download','unlinkSync','info','upload','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x582b,0x195));var _0xb582=function(_0x3ef74a,_0x195b43){_0x3ef74a=_0x3ef74a-0x0;var _0x2bdbe6=_0x582b[_0x3ef74a];return _0x2bdbe6;};'use strict';var emlformat=require(_0xb582('0x0'));var rimraf=require(_0xb582('0x1'));var zipdir=require(_0xb582('0x2'));var jsonpatch=require(_0xb582('0x3'));var rp=require(_0xb582('0x4'));var moment=require(_0xb582('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb582('0x6'));var path=require('path');var sox=require(_0xb582('0x7'));var csv=require(_0xb582('0x8'));var ejs=require(_0xb582('0x9'));var fs=require('fs');var fs_extra=require(_0xb582('0xa'));var _=require(_0xb582('0xb'));var squel=require(_0xb582('0xc'));var crypto=require(_0xb582('0xd'));var jsforce=require(_0xb582('0xe'));var deskjs=require(_0xb582('0xf'));var toCsv=require(_0xb582('0x8'));var querystring=require(_0xb582('0x10'));var Papa=require(_0xb582('0x11'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0xb582('0x12'));var Redis=require(_0xb582('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb582('0x14'));var as=require(_0xb582('0x15'));var hardwareService=require(_0xb582('0x16'));var logger=require('../../config/logger')(_0xb582('0x17'));var utils=require(_0xb582('0x18'));var config=require(_0xb582('0x19'));var licenseUtil=require(_0xb582('0x1a'));var db=require(_0xb582('0x1b'))['db'];config[_0xb582('0x1c')]=_['defaults'](config[_0xb582('0x1c')],{'host':_0xb582('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb582('0x1e'))['register'](socket);function respondWithStatusCode(_0x33f8c9,_0x1ed2ca){_0x1ed2ca=_0x1ed2ca||0xcc;return function(_0x465e3d){if(_0x465e3d){return _0x33f8c9[_0xb582('0x1f')](_0x1ed2ca);}return _0x33f8c9[_0xb582('0x20')](_0x1ed2ca)[_0xb582('0x21')]();};}function respondWithResult(_0xefc525,_0x59bed7){_0x59bed7=_0x59bed7||0xc8;return function(_0x1d0154){if(_0x1d0154){return _0xefc525[_0xb582('0x20')](_0x59bed7)[_0xb582('0x22')](_0x1d0154);}};}function respondWithFilteredResult(_0x248c22,_0x1c0c58){return function(_0x26cd0d){if(_0x26cd0d){var _0x7e2711=typeof _0x1c0c58['offset']===_0xb582('0x23')&&typeof _0x1c0c58[_0xb582('0x24')]===_0xb582('0x23');var _0x2f487b=_0x26cd0d[_0xb582('0x25')];var _0x5297c0=_0x7e2711?0x0:_0x1c0c58[_0xb582('0x26')];var _0x48879f=_0x7e2711?_0x26cd0d[_0xb582('0x25')]:_0x1c0c58[_0xb582('0x26')]+_0x1c0c58[_0xb582('0x24')];var _0x58c025;if(_0x48879f>=_0x2f487b){_0x48879f=_0x2f487b;_0x58c025=0xc8;}else{_0x58c025=0xce;}_0x248c22[_0xb582('0x20')](_0x58c025);return _0x248c22['set'](_0xb582('0x27'),_0x5297c0+'-'+_0x48879f+'/'+_0x2f487b)[_0xb582('0x22')](_0x26cd0d);}return null;};}function patchUpdates(_0x3489f1){return function(_0x3207cf){try{jsonpatch[_0xb582('0x28')](_0x3207cf,_0x3489f1,!![]);}catch(_0x11c4ca){return BPromise[_0xb582('0x29')](_0x11c4ca);}return _0x3207cf[_0xb582('0x2a')]();};}function saveUpdates(_0xdda91c,_0x1fb99d){return function(_0x5bd08c){if(_0x5bd08c){return _0x5bd08c[_0xb582('0x2b')](_0xdda91c)[_0xb582('0x2c')](function(_0x530dea){return _0x530dea;});}return null;};}function removeEntity(_0x589092,_0x121fa9){return function(_0x5aaffc){if(_0x5aaffc){return _0x5aaffc['destroy']()[_0xb582('0x2c')](function(){var _0x4cbf8e=_0x5aaffc['get']({'plain':!![]});var _0x1fd8ae=_0xb582('0x2d');return db['UserProfileResource'][_0xb582('0x2e')]({'where':{'type':_0x1fd8ae,'resourceId':_0x4cbf8e['id']}})['then'](function(){return _0x5aaffc;});})['then'](function(){_0x589092[_0xb582('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa9ff9,_0x1188f5){return function(_0x38cb2d){if(!_0x38cb2d){_0xfa9ff9[_0xb582('0x1f')](0x194);}return _0x38cb2d;};}function handleError(_0x2efae9,_0x42a76d){_0x42a76d=_0x42a76d||0x1f4;return function(_0x57c163){logger[_0xb582('0x2f')](_0x57c163[_0xb582('0x30')]);if(_0x57c163[_0xb582('0x31')]){delete _0x57c163[_0xb582('0x31')];}_0x2efae9[_0xb582('0x20')](_0x42a76d)['send'](_0x57c163);};}exports[_0xb582('0x32')]=function(_0x143e21,_0x364a0d){var _0x39f94f={},_0x3fd7b7={},_0x17f01a={'count':0x0,'rows':[]};var _0x3d12a3=_['map'](db['Plugin']['rawAttributes'],function(_0x5abe7a){return{'name':_0x5abe7a[_0xb582('0x33')],'type':_0x5abe7a[_0xb582('0x34')][_0xb582('0x35')]};});_0x3fd7b7[_0xb582('0x36')]=_[_0xb582('0x37')](_0x3d12a3,_0xb582('0x31'));_0x3fd7b7[_0xb582('0x38')]=_[_0xb582('0x39')](_0x143e21[_0xb582('0x38')]);_0x3fd7b7[_0xb582('0x3a')]=_['intersection'](_0x3fd7b7['model'],_0x3fd7b7[_0xb582('0x38')]);_0x39f94f['attributes']=_[_0xb582('0x3b')](_0x3fd7b7[_0xb582('0x36')],qs[_0xb582('0x3c')](_0x143e21['query']['fields']));_0x39f94f[_0xb582('0x3d')]=_0x39f94f['attributes'][_0xb582('0x3e')]?_0x39f94f[_0xb582('0x3d')]:_0x3fd7b7[_0xb582('0x36')];if(!_0x143e21[_0xb582('0x38')][_0xb582('0x3f')]('nolimit')){_0x39f94f['limit']=qs[_0xb582('0x24')](_0x143e21[_0xb582('0x38')]['limit']);_0x39f94f[_0xb582('0x26')]=qs['offset'](_0x143e21[_0xb582('0x38')][_0xb582('0x26')]);}_0x39f94f[_0xb582('0x40')]=qs[_0xb582('0x41')](_0x143e21[_0xb582('0x38')][_0xb582('0x41')]);_0x39f94f['where']=qs[_0xb582('0x3a')](_[_0xb582('0x42')](_0x143e21[_0xb582('0x38')],_0x3fd7b7[_0xb582('0x3a')]),_0x3d12a3);if(_0x143e21[_0xb582('0x38')][_0xb582('0x43')]){_0x39f94f[_0xb582('0x44')]=_['merge'](_0x39f94f['where'],{'$or':_[_0xb582('0x37')](_0x3d12a3,function(_0x54c38e){if(_0x54c38e[_0xb582('0x34')]!==_0xb582('0x45')){var _0x3f18b5={};_0x3f18b5[_0x54c38e['name']]={'$like':'%'+_0x143e21[_0xb582('0x38')][_0xb582('0x43')]+'%'};return _0x3f18b5;}})});}_0x39f94f=_[_0xb582('0x46')]({},_0x39f94f,_0x143e21['options']);var _0x1eee3e={'where':_0x39f94f[_0xb582('0x44')]};return db['Plugin'][_0xb582('0x25')](_0x1eee3e)[_0xb582('0x2c')](function(_0x208c8f){_0x17f01a[_0xb582('0x25')]=_0x208c8f;if(_0x143e21[_0xb582('0x38')]['includeAll']){_0x39f94f[_0xb582('0x47')]=[{'all':!![]}];}return db[_0xb582('0x48')]['findAll'](_0x39f94f);})[_0xb582('0x2c')](function(_0x26d150){_0x17f01a['rows']=_0x26d150;return _0x17f01a;})[_0xb582('0x2c')](respondWithFilteredResult(_0x364a0d,_0x39f94f))[_0xb582('0x49')](handleError(_0x364a0d,null));};exports[_0xb582('0x4a')]=function(_0x1eada1,_0x271958){var _0x53521f={'raw':!![],'where':{'id':_0x1eada1[_0xb582('0x4b')]['id']}},_0x3f56f2={};_0x3f56f2[_0xb582('0x36')]=_[_0xb582('0x39')](db[_0xb582('0x48')][_0xb582('0x4c')]);_0x3f56f2[_0xb582('0x38')]=_['keys'](_0x1eada1[_0xb582('0x38')]);_0x3f56f2[_0xb582('0x3a')]=_[_0xb582('0x3b')](_0x3f56f2[_0xb582('0x36')],_0x3f56f2[_0xb582('0x38')]);_0x53521f[_0xb582('0x3d')]=_[_0xb582('0x3b')](_0x3f56f2[_0xb582('0x36')],qs[_0xb582('0x3c')](_0x1eada1[_0xb582('0x38')][_0xb582('0x3c')]));_0x53521f[_0xb582('0x3d')]=_0x53521f[_0xb582('0x3d')]['length']?_0x53521f[_0xb582('0x3d')]:_0x3f56f2['model'];if(_0x1eada1['query'][_0xb582('0x4d')]){_0x53521f[_0xb582('0x47')]=[{'all':!![]}];}_0x53521f=_['merge']({},_0x53521f,_0x1eada1[_0xb582('0x4e')]);return db[_0xb582('0x48')]['find'](_0x53521f)[_0xb582('0x2c')](handleEntityNotFound(_0x271958,null))[_0xb582('0x2c')](respondWithResult(_0x271958,null))[_0xb582('0x49')](handleError(_0x271958,null));};exports['download']=function(_0x3c4e5a,_0x4a2f05,_0x592a84){return db[_0xb582('0x48')][_0xb582('0x4f')]({'where':{'id':_0x3c4e5a[_0xb582('0x4b')]['id']},'attributes':[_0xb582('0x31'),_0xb582('0x50')],'raw':!![]})[_0xb582('0x2c')](handleEntityNotFound(_0x4a2f05,null))['then'](function(_0xb590a2){if(_0xb590a2){var _0x24c7e0=path['join'](config[_0xb582('0x51')],_0xb582('0x52'),util[_0xb582('0x53')](_0xb582('0x54'),path[_0xb582('0x55')](_0xb590a2[_0xb582('0x50')])));var _0x57dd60=fs[_0xb582('0x56')](_0x24c7e0);var _0x45da0d=archiver('zip',{'zlib':{'level':0x9}});_0x45da0d['on']('warning',function(_0x2ee753){if(_0x2ee753[_0xb582('0x57')]===_0xb582('0x58')){logger[_0xb582('0x2f')](_0x2ee753);}else{throw new db[(_0xb582('0x59'))][(_0xb582('0x5a'))](_0xb582('0x5b'));}});_0x45da0d['on'](_0xb582('0x2f'),function(_0x3beaea){throw new db[(_0xb582('0x59'))][(_0xb582('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x45da0d[_0xb582('0x5c')](_0x57dd60);_0x45da0d[_0xb582('0x5d')](_0xb582('0x5e'),{'cwd':path['join'](config[_0xb582('0x51')],_0xb582('0x52'),path[_0xb582('0x5f')](_0xb590a2[_0xb582('0x50')])),'ignore':[path[_0xb582('0x60')](path[_0xb582('0x55')](_0xb590a2[_0xb582('0x50')]),'node_modules/**/*'),path[_0xb582('0x60')](path[_0xb582('0x55')](_0xb590a2['path']),'attachments/**/*')],'nodir':!![]})[_0xb582('0x61')]();_0x57dd60['on'](_0xb582('0x62'),function(){if(!fs[_0xb582('0x63')](_0x24c7e0)){throw new db['Sequelize'][(_0xb582('0x5a'))](_0xb582('0x64'));}return _0x4a2f05[_0xb582('0x65')](_0x24c7e0,util[_0xb582('0x53')]('%s.zip',path[_0xb582('0x55')](_0xb590a2[_0xb582('0x50')])),function(_0x2802d2){if(_0x2802d2){throw new db['Sequelize']['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb582('0x66')](_0x24c7e0);logger[_0xb582('0x67')]('Download\x20completed');logger[_0xb582('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xb582('0x49')](handleError(_0x4a2f05,null));};exports[_0xb582('0x68')]=function(_0x2e3760,_0x265d8d,_0x26b25a){var _0xf9c8ca=path[_0xb582('0x55')](_0x2e3760[_0xb582('0x69')]['filename'],path[_0xb582('0x6a')](_0x2e3760[_0xb582('0x69')][_0xb582('0x6b')]));var _0x1f7a18=path[_0xb582('0x60')](config[_0xb582('0x51')],'server/files/plugins',_0x2e3760[_0xb582('0x69')][_0xb582('0x6b')]);var _0x38c799=path[_0xb582('0x60')](config['root'],_0xb582('0x52'),_0xf9c8ca);logger[_0xb582('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x1f7a18);logger[_0xb582('0x67')](_0xb582('0x6c'),_0x38c799);try{fs[_0xb582('0x6d')](_0x1f7a18,parseInt('0777',0x8));extract(_0x1f7a18,{'dir':_0x38c799},function(_0x520385){if(_0x520385){logger[_0xb582('0x2f')](_0x520385);handleError(_0x520385,!![]);};var _0x24ebd6=fs['readdirSync'](_0x38c799);if(_0x24ebd6['length']>0x1){removeReferences(_0x1f7a18,_0x38c799);logger[_0xb582('0x2f')](_0xb582('0x6e'));return _0x26b25a(new Error(_0xb582('0x6e')));}var _0x58b553=fs[_0xb582('0x6f')](path[_0xb582('0x60')](_0x38c799,_0x24ebd6[0x0]));if(_0x58b553[_0xb582('0x70')]()){removeReferences(_0x1f7a18,_0x38c799);logger['error']('Invalid\x20plugin\x20structure');return _0x26b25a(new Error(_0xb582('0x6e')));}if(_0x58b553[_0xb582('0x71')]()){var _0x14ab13=fs[_0xb582('0x72')](path[_0xb582('0x60')](_0x38c799,_0x24ebd6[0x0]));if(_0x14ab13[_0xb582('0x3e')]===0x0){removeReferences(_0x1f7a18,_0x38c799);logger[_0xb582('0x2f')](_0xb582('0x6e'));return _0x26b25a(new Error('Invalid\x20plugin\x20structure'));}var _0x3c603b=_0x14ab13[_0xb582('0x73')](function(_0x3371ed){return _0x3371ed===_0xb582('0x74');});if(!_0x3c603b){return _0x26b25a(new Error(_0xb582('0x75')));}var _0x251a41=fs[_0xb582('0x76')](path[_0xb582('0x60')](_0x38c799,_0x24ebd6[0x0],_0xb582('0x74')));var _0x3f6e0c=JSON[_0xb582('0x77')](_0x251a41);if(_0xb582('0x23')==typeof _0x3f6e0c[_0xb582('0x31')]){return _0x26b25a(new Error(_0xb582('0x78')));}if(_0xb582('0x23')==typeof _0x3f6e0c[_0xb582('0x34')]){return _0x26b25a(new Error(_0xb582('0x79')));}if(_0xb582('0x23')==typeof _0x3f6e0c['version']){return _0x26b25a(new Error(_0xb582('0x7a')));}if(_0xb582('0x23')==typeof _0x3f6e0c[_0xb582('0x7b')]){return _0x26b25a(new Error(_0xb582('0x7c')));}if(_0x3f6e0c[_0xb582('0x34')]===_0xb582('0x7d')){if(_0xb582('0x23')==typeof _0x3f6e0c['parameters'][_0xb582('0x7e')]){return _0x26b25a(new Error(_0xb582('0x7f')));}if(_0xb582('0x23')==typeof _0x3f6e0c[_0xb582('0x7b')][_0xb582('0x7e')][_0xb582('0x80')]&&_0xb582('0x23')==typeof _0x3f6e0c[_0xb582('0x7b')]['views'][_0xb582('0x81')]){return _0x26b25a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3f6e0c[_0xb582('0x34')]==='script'){if('undefined'==typeof _0x3f6e0c[_0xb582('0x7b')][_0xb582('0x82')]){return _0x26b25a(new Error(_0xb582('0x83')));}if(_0xb582('0x23')==typeof _0x3f6e0c[_0xb582('0x7b')][_0xb582('0x84')]){return _0x26b25a(new Error(_0xb582('0x85')));}}else{return _0x26b25a(new Error(_0xb582('0x86')));}var _0x2db046=_0x3f6e0c[_0xb582('0x31')];var _0x3c27f5=_0x3f6e0c[_0xb582('0x87')];var _0x5c6234=_0x3f6e0c[_0xb582('0x34')];var _0x1f19b8=_0x3f6e0c['sidebar']?_0x3f6e0c[_0xb582('0x88')]:_0xb582('0x89');var _0x223458=_0x3f6e0c['icon']?_0x3f6e0c[_0xb582('0x8a')]:_0xb582('0x8b');var _0x283fc0='';var _0x36835f='';var _0x12648d='';var _0x3eef25='';var _0x1da1cd=_0x3f6e0c[_0xb582('0x8c')];if(_0x5c6234===_0xb582('0x7d')){if('undefined'!=typeof _0x3f6e0c['parameters'][_0xb582('0x7e')]['admin']){var _0x5520e2=_0x3f6e0c['parameters'][_0xb582('0x7e')][_0xb582('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xb582('0x8d')](_0x5520e2)){_0x283fc0=path[_0xb582('0x60')]('plugins',_0xf9c8ca,_0x24ebd6[0x0],_0x5520e2);}else{_0x283fc0=_0x5520e2;}}else{logger[_0xb582('0x67')](_0xb582('0x8e'));}if(_0xb582('0x23')!=typeof _0x3f6e0c[_0xb582('0x7b')][_0xb582('0x7e')]['agent']){var _0x1388c3=_0x3f6e0c[_0xb582('0x7b')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb582('0x8d')](_0x1388c3)){_0x36835f=path['join'](_0xb582('0x8f'),_0xf9c8ca,_0x24ebd6[0x0],_0x1388c3);}else{_0x36835f=_0x1388c3;}}else{logger[_0xb582('0x67')](_0xb582('0x90'));}}else if(_0x5c6234==='script'){_0x12648d=_0x3f6e0c['parameters'][_0xb582('0x82')];_0x3eef25=_0x3f6e0c[_0xb582('0x7b')][_0xb582('0x84')];if(_0xb582('0x23')!=typeof _0x3f6e0c['parameters']['views']){if(_0xb582('0x23')!=typeof _0x3f6e0c[_0xb582('0x7b')][_0xb582('0x7e')][_0xb582('0x80')]){var _0x5520e2=_0x3f6e0c[_0xb582('0x7b')][_0xb582('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb582('0x8d')](_0x5520e2)){_0x283fc0=path[_0xb582('0x60')](_0xb582('0x8f'),_0xf9c8ca,_0x24ebd6[0x0],_0x5520e2);}else{_0x283fc0=_0x5520e2;}}if(_0xb582('0x23')!=typeof _0x3f6e0c[_0xb582('0x7b')][_0xb582('0x7e')][_0xb582('0x81')]){var _0x1388c3=_0x3f6e0c[_0xb582('0x7b')][_0xb582('0x7e')][_0xb582('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xb582('0x8d')](_0x1388c3)){_0x36835f=path[_0xb582('0x60')](_0xb582('0x8f'),_0xf9c8ca,_0x24ebd6[0x0],_0x1388c3);}else{_0x36835f=_0x1388c3;}}}}var _0x1c021c={'name':_0x2db046,'description':_0x3c27f5,'path':path['join'](_0xf9c8ca,_0x24ebd6[0x0]),'type':_0x5c6234,'sidebar':_0x1f19b8,'icon':_0x223458,'adminUrl':_0x283fc0,'agentUrl':_0x36835f,'scriptName':_0x12648d,'scriptPath':_0x3eef25,'version':_0x1da1cd};removeReferences(_0x1f7a18,null);return db[_0xb582('0x48')][_0xb582('0x91')](_0x1c021c)[_0xb582('0x2c')](function(_0x1a4242){var _0x21ccce={'role':_0x2e3760[_0xb582('0x92')][_0xb582('0x93')],'userProfileId':_0x2e3760[_0xb582('0x92')][_0xb582('0x94')]};if(!_0x21ccce)throw new Error(_0xb582('0x95'));if(_0x21ccce['role']===_0xb582('0x96')){var _0x23fe7b=_0x1a4242['get']({'plain':!![]});return db[_0xb582('0x97')]['find']({'where':{'name':_0xb582('0x2d'),'userProfileId':_0x21ccce['userProfileId']},'raw':!![]})[_0xb582('0x2c')](function(_0x324921){if(_0x324921&&_0x324921[_0xb582('0x98')]===0x0){return db[_0xb582('0x99')]['create']({'name':_0x23fe7b['name'],'resourceId':_0x23fe7b['id'],'type':_0x324921[_0xb582('0x31')],'sectionId':_0x324921['id']},{})[_0xb582('0x2c')](function(){return _0x1a4242;});}else{return _0x1a4242;}})[_0xb582('0x49')](function(_0x4ba052){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ba052);throw _0x4ba052;});}return _0x1a4242;})[_0xb582('0x2c')](respondWithResult(_0x265d8d,null))[_0xb582('0x49')](handleError(_0x265d8d,null));}});}catch(_0x1951d1){_0x265d8d['status'](0x1f4)[_0xb582('0x9a')](_0x1951d1);}};function removeReferences(_0x3de3cb,_0x25c01f){try{if(_0x3de3cb){fs[_0xb582('0x66')](_0x3de3cb);logger[_0xb582('0x67')](_0xb582('0x9b'));}if(_0x25c01f){rimraf(_0x25c01f,function(){});logger[_0xb582('0x67')](_0xb582('0x9c'));}}catch(_0x3ff06e){logger['error'](_0x3ff06e);}}exports[_0xb582('0x2b')]=function(_0xf77ec5,_0xbaad5f,_0x30fb95){return db['Plugin'][_0xb582('0x4f')]({'where':{'id':_0xf77ec5[_0xb582('0x4b')]['id']}})[_0xb582('0x2c')](handleEntityNotFound(_0xbaad5f,null))[_0xb582('0x2c')](saveUpdates(_0xf77ec5[_0xb582('0x92')],null))['then'](respondWithResult(_0xbaad5f,null))['catch'](handleError(_0xbaad5f,null));};exports[_0xb582('0x9d')]=function(_0x88a945,_0x565a2b,_0x4e2c62){return db[_0xb582('0x48')][_0xb582('0x4f')]({'where':{'id':_0x88a945[_0xb582('0x4b')]['id']}})[_0xb582('0x2c')](function(_0x538195){if(_0x538195){return _0x538195['destroy']();}})[_0xb582('0x2c')](function(_0x5d5970){rimraf(path['join'](config[_0xb582('0x51')],_0xb582('0x52'),path[_0xb582('0x5f')](_0x5d5970[_0xb582('0x50')])),function(){});return _0x5d5970;})['then'](handleEntityNotFound(_0x565a2b,null))[_0xb582('0x2c')](respondWithStatusCode(_0x565a2b,null))[_0xb582('0x49')](handleError(_0x565a2b,null));};exports['webhookGet']=function(_0x41e1c2,_0x29b8dd,_0xfdbdcf){return BPromise[_0xb582('0x9e')]()[_0xb582('0x2c')](function(){if(!_0x41e1c2['query']['path']){throw new Error(_0xb582('0x9f'));}if(!_0x41e1c2[_0xb582('0x38')]['port']){throw new Error(_0xb582('0xa0'));}var _0xbdd8e3=_0x41e1c2[_0xb582('0x38')][_0xb582('0xa1')]?_0x41e1c2['query'][_0xb582('0xa1')]+':'+_0x41e1c2[_0xb582('0x38')][_0xb582('0xa2')]:_0xb582('0xa3')+_0x41e1c2[_0xb582('0x38')][_0xb582('0xa2')];var _0x42f3c8=_0x41e1c2[_0xb582('0x38')][_0xb582('0x22')]?_0x41e1c2[_0xb582('0x38')][_0xb582('0x22')]:!![];var _0x1a2cab=_0x41e1c2[_0xb582('0x38')]['encoding']?_0x41e1c2['query'][_0xb582('0xa4')]:null;var _0x29fec9={'method':_0x41e1c2[_0xb582('0xa5')],'uri':util['format'](_0xb582('0xa6'),_0xbdd8e3,_0x41e1c2[_0xb582('0x38')][_0xb582('0x50')]),'json':_0x42f3c8,'resolveWithFullResponse':!![],'encoding':_0x1a2cab,'qs':_0x41e1c2['query']};if(_0x41e1c2[_0xb582('0xa7')]){_0x29fec9[_0xb582('0xa7')]=_0x41e1c2['headers'];if(_0x29fec9['headers'][_0xb582('0xa8')]){delete _0x29fec9['headers']['content-length'];}}if(_0x29fec9[_0xb582('0xa7')][_0xb582('0xa9')]){delete _0x29fec9['headers'][_0xb582('0xa9')];}return rp(_0x29fec9);})[_0xb582('0x2c')](function(_0x54994c){if(_0x54994c){_0x29b8dd[_0xb582('0xaa')](_0x54994c[_0xb582('0xa7')]);logger['info'](_0x54994c[_0xb582('0x92')]);if(_[_0xb582('0xab')](_0x41e1c2[_0xb582('0x38')][_0xb582('0x50')],'download')&&_0x54994c[_0xb582('0xac')]==0x1f4){return _0x29b8dd['sendStatus'](_0x54994c['statusCode']);}else{return _0x29b8dd[_0xb582('0x20')](_0x54994c[_0xb582('0xac')])['send'](_0x54994c[_0xb582('0x92')]);}}else{return _0x29b8dd[_0xb582('0x1f')](0xc8);}})[_0xb582('0x49')](handleError(_0x29b8dd,null));};exports[_0xb582('0xad')]=function(_0x450d0e,_0x2b5e81,_0x59dc15){return BPromise[_0xb582('0x9e')]()[_0xb582('0x2c')](function(){if(!_0x450d0e['query']['path']){throw new Error(_0xb582('0x9f'));}if(!_0x450d0e['query']['port']){throw new Error(_0xb582('0xa0'));}var _0x359215=_0x450d0e[_0xb582('0x38')][_0xb582('0xa1')]?_0x450d0e[_0xb582('0x38')][_0xb582('0xa1')]+':'+_0x450d0e[_0xb582('0x38')][_0xb582('0xa2')]:_0xb582('0xa3')+_0x450d0e['query'][_0xb582('0xa2')];var _0x36431d=_0x450d0e['query'][_0xb582('0x22')]?_0x450d0e[_0xb582('0x38')][_0xb582('0x22')]:!![];var _0x5ee1cc=_0x450d0e[_0xb582('0x38')]['encoding']?_0x450d0e[_0xb582('0x38')]['encoding']:null;var _0x5a6067={'method':_0x450d0e[_0xb582('0xa5')],'uri':util['format'](_0xb582('0xa6'),_0x359215,_0x450d0e[_0xb582('0x38')][_0xb582('0x50')]),'json':_0x36431d,'resolveWithFullResponse':!![],'encoding':_0x5ee1cc,'body':_0x450d0e[_0xb582('0x92')]};if(_0x450d0e[_0xb582('0xa7')]){_0x5a6067[_0xb582('0xa7')]=_0x450d0e[_0xb582('0xa7')];if(_0x5a6067[_0xb582('0xa7')][_0xb582('0xa8')]){delete _0x5a6067[_0xb582('0xa7')][_0xb582('0xa8')];}}if(_0x5a6067[_0xb582('0xa7')][_0xb582('0xa9')]){delete _0x5a6067[_0xb582('0xa7')][_0xb582('0xa9')];}return rp(_0x5a6067);})['then'](function(_0x1425a2){if(_0x1425a2){_0x2b5e81[_0xb582('0xaa')](_0x1425a2[_0xb582('0xa7')]);logger['info'](_0x1425a2[_0xb582('0x92')]);return _0x2b5e81[_0xb582('0x20')](_0x1425a2['statusCode'])[_0xb582('0x9a')](_0x1425a2[_0xb582('0x92')]);}else{return _0x2b5e81[_0xb582('0x1f')](0xc8);}})['catch'](handleError(_0x2b5e81,null));}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5e9e26b..68d351d 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 _0x00b3=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x00b3,0x157));var _0x300b=function(_0x1ed48f,_0x320266){_0x1ed48f=_0x1ed48f-0x0;var _0x91449c=_0x00b3[_0x1ed48f];return _0x91449c;};'use strict';var EventEmitter=require(_0x300b('0x0'));var Plugin=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x300b('0x3')](0x0);var events={'afterCreate':_0x300b('0x4'),'afterUpdate':_0x300b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x968375){return function(_0x204f71,_0x494436,_0x2f3a41){PluginEvents['emit'](_0x968375+':'+_0x204f71['id'],_0x204f71);PluginEvents[_0x300b('0x6')](_0x968375,_0x204f71);_0x2f3a41(null);};}for(var e in events){if(events[_0x300b('0x7')](e)){var event=events[e];Plugin[_0x300b('0x8')](e,emitEvent(event));}}module[_0x300b('0x9')]=PluginEvents; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f284505..0cf744f 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 _0x7331=['path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','../../config/logger','api','bluebird'];(function(_0x5e410d,_0x4eaf38){var _0xa97676=function(_0x18d8c8){while(--_0x18d8c8){_0x5e410d['push'](_0x5e410d['shift']());}};_0xa97676(++_0x4eaf38);}(_0x7331,0xe3));var _0x1733=function(_0x3c6cfe,_0x5d5a71){_0x3c6cfe=_0x3c6cfe-0x0;var _0x10d015=_0x7331[_0x3c6cfe];return _0x10d015;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1733('0x0'))(_0x1733('0x1'));var moment=require('moment');var BPromise=require(_0x1733('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1733('0x3'));var rimraf=require(_0x1733('0x4'));var config=require(_0x1733('0x5'));var attributes=require(_0x1733('0x6'));module[_0x1733('0x7')]=function(_0x26202b,_0x44e554){return _0x26202b[_0x1733('0x8')](_0x1733('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 650d8b6..63aceb0 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 _0x26c6=['../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','code','error','message','catch','Plugin','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26c6,0xa2));var _0x626c=function(_0x433f36,_0x579dd3){_0x433f36=_0x433f36-0x0;var _0x4f7406=_0x26c6[_0x433f36];return _0x4f7406;};'use strict';var _=require('lodash');var util=require(_0x626c('0x0'));var moment=require(_0x626c('0x1'));var BPromise=require('bluebird');var rs=require(_0x626c('0x2'));var fs=require('fs');var Redis=require(_0x626c('0x3'));var db=require(_0x626c('0x4'))['db'];var utils=require(_0x626c('0x5'));var logger=require(_0x626c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x626c('0x7'));var client=jayson[_0x626c('0x8')][_0x626c('0x9')]({'port':0x232a});config[_0x626c('0xa')]=_[_0x626c('0xb')](config[_0x626c('0xa')],{'host':_0x626c('0xc'),'port':0x18eb});var socket=require(_0x626c('0xd'))(new Redis(config[_0x626c('0xa')]));require('./plugin.socket')[_0x626c('0xe')](socket);function respondWithRpcPromise(_0x5ed777,_0x38935f,_0x53327c){return new BPromise(function(_0x499220,_0x4dacb1){return client['request'](_0x5ed777,_0x53327c)[_0x626c('0xf')](function(_0x4491eb){logger[_0x626c('0x10')](_0x626c('0x11'),_0x38935f,_0x626c('0x12'));logger[_0x626c('0x13')](_0x626c('0x14'),_0x38935f,_0x626c('0x12'),JSON['stringify'](_0x4491eb));if(_0x4491eb['error']){if(_0x4491eb['error'][_0x626c('0x15')]===0x1f4){logger[_0x626c('0x16')](_0x626c('0x11'),_0x38935f,_0x4491eb[_0x626c('0x16')][_0x626c('0x17')]);return _0x4dacb1(_0x4491eb[_0x626c('0x16')][_0x626c('0x17')]);}logger[_0x626c('0x16')](_0x626c('0x11'),_0x38935f,_0x4491eb[_0x626c('0x16')]['message']);return _0x499220(_0x4491eb[_0x626c('0x16')][_0x626c('0x17')]);}else{logger[_0x626c('0x10')]('Plugin,\x20%s,\x20%s',_0x38935f,_0x626c('0x12'));_0x499220(_0x4491eb['result'][_0x626c('0x17')]);}})[_0x626c('0x18')](function(_0x3ced78){logger['error'](_0x626c('0x11'),_0x38935f,_0x3ced78);_0x4dacb1(_0x3ced78);});});}exports['CreatePlugin']=function(_0x406ac5){var _0x529332=this;return new Promise(function(_0xf9d20e,_0x4a37cc){return db[_0x626c('0x19')]['create'](_0x406ac5['body'],{'raw':_0x406ac5[_0x626c('0x1a')]?_0x406ac5[_0x626c('0x1a')][_0x626c('0x1b')]===undefined?!![]:![]:!![]})[_0x626c('0xf')](function(_0x274379){logger['info']('CreatePlugin',_0x406ac5);logger[_0x626c('0x13')]('CreatePlugin',_0x406ac5,JSON['stringify'](_0x274379));_0xf9d20e(_0x274379);})[_0x626c('0x18')](function(_0x43f379){logger['error']('CreatePlugin',_0x43f379[_0x626c('0x17')],_0x406ac5);_0x4a37cc(_0x529332[_0x626c('0x16')](0x1f4,_0x43f379[_0x626c('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2e53849..c94a9d3 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 _0x58af=['remove','update','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x30c1e0,_0x548be1){var _0x5b3a1d=function(_0x5b20fb){while(--_0x5b20fb){_0x30c1e0['push'](_0x30c1e0['shift']());}};_0x5b3a1d(++_0x548be1);}(_0x58af,0xa6));var _0xf58a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x58af[_0x397e5f];return _0x5302b8;};'use strict';var PluginEvents=require(_0xf58a('0x0'));var events=[_0xf58a('0x1'),_0xf58a('0x2'),_0xf58a('0x3')];function createListener(_0x239c48,_0x1db636){return function(_0xc2bae8){_0x1db636['emit'](_0x239c48,_0xc2bae8);};}function removeListener(_0x27b9f1,_0x2718f1){return function(){PluginEvents[_0xf58a('0x4')](_0x27b9f1,_0x2718f1);};}exports[_0xf58a('0x5')]=function(_0x4b8cce){for(var _0x12db34=0x0,_0x3208c2=events[_0xf58a('0x6')];_0x12db34<_0x3208c2;_0x12db34++){var _0x185236=events[_0x12db34];var _0xe39f37=createListener(_0xf58a('0x7')+_0x185236,_0x4b8cce);PluginEvents['on'](_0x185236,_0xe39f37);}}; \ No newline at end of file +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 diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 5f8146b..367f4d7 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(_0x54850d,_0xba6824){var _0x212655=function(_0x27b772){while(--_0x27b772){_0x54850d['push'](_0x54850d['shift']());}};_0x212655(++_0xba6824);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_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 diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index ef2937b..3dda4d7 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 _0x6c76=['status','npm\x20install','info','error','index','list','then','reject','motion2','length','catch','params','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','send','restart','stop','hasOwnProperty','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','child_process','sendStatus','stack','name'];(function(_0x2eeaa1,_0x477c72){var _0x232add=function(_0x31f41c){while(--_0x31f41c){_0x2eeaa1['push'](_0x2eeaa1['shift']());}};_0x232add(++_0x477c72);}(_0x6c76,0x184));var _0x66c7=function(_0x10272c,_0xe59704){_0x10272c=_0x10272c-0x0;var _0x1c56e9=_0x6c76[_0x10272c];return _0x1c56e9;};'use strict';var _=require(_0x66c7('0x0'));var pm2=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var path=require(_0x66c7('0x3'));var exec=require(_0x66c7('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x2f6db7,_0x2b7cf3){return function(_0x49d437){if(!_0x49d437){_0x2f6db7[_0x66c7('0x5')](0x194);;}return _0x49d437;};}function respondWithResult(_0x45b0a5,_0x52f71b){_0x52f71b=_0x52f71b||0xc8;return function(_0x23408c){if(_0x23408c){return _0x45b0a5['status'](_0x52f71b)['json'](_0x23408c);}return null;};}function handleError(_0x208d06,_0x2b0065){_0x2b0065=_0x2b0065||0x1f4;return function(_0x24349f){logger['error'](_0x24349f[_0x66c7('0x6')]);if(_0x24349f[_0x66c7('0x7')]){delete _0x24349f[_0x66c7('0x7')];}_0x208d06[_0x66c7('0x8')](_0x2b0065)['send'](_0x24349f);};}function execChildProcess(){return new BPromise(function(_0x464085,_0x45db57){exec(_0x66c7('0x9'),function(_0x187e00,_0x21fb64,_0x406e41){logger[_0x66c7('0xa')](_0x21fb64);logger['info'](_0x406e41);if(_0x187e00){logger[_0x66c7('0xb')](_0x187e00);return _0x45db57(_0x187e00);}return _0x464085(_0x21fb64);});});}exports[_0x66c7('0xc')]=function(_0x35cbc2,_0xea3f56){return pm2[_0x66c7('0xd')]()[_0x66c7('0xe')](function(_0x618bd7){if(_0x618bd7){var _0xf3b04=_[_0x66c7('0xf')](_0x618bd7,function(_0x5d44e1){return _0x5d44e1[_0x66c7('0x7')]==='express'||_0x5d44e1[_0x66c7('0x7')]===_0x66c7('0x10');});return{'rows':_0xf3b04,'count':_0xf3b04[_0x66c7('0x11')]};}return null;})[_0x66c7('0xe')](respondWithResult(_0xea3f56,null))[_0x66c7('0x12')](handleError(_0xea3f56,null));};exports['show']=function(_0x5cf913,_0x53fb36){return pm2['describe'](_0x5cf913[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x53fb36,null))['then'](handleEntityNotFound(_0x53fb36,null))['catch'](handleError(_0x53fb36,null));};exports[_0x66c7('0x14')]=function(_0x9b65cf,_0x4756f7){if(_0x9b65cf[_0x66c7('0x15')]['name']&&_0x9b65cf['body'][_0x66c7('0x16')]){var _0x237177=path[_0x66c7('0x17')](__dirname,_0x66c7('0x18'),_0x9b65cf[_0x66c7('0x15')][_0x66c7('0x16')]);var _0x4804cf=process[_0x66c7('0x19')]();process[_0x66c7('0x1a')](path['dirname'](_0x237177));return execChildProcess()[_0x66c7('0xe')](function(_0x8b96b1){process[_0x66c7('0x1a')](_0x4804cf);return pm2[_0x66c7('0x1b')]({'name':_0x9b65cf['body'][_0x66c7('0x7')],'script':_0x237177});})[_0x66c7('0xe')](function(_0x5b28e6){pm2[_0x66c7('0x1c')]();return _0x5b28e6[0x0];})[_0x66c7('0xe')](respondWithResult(_0x4756f7,0xc9))[_0x66c7('0x12')](handleError(_0x4756f7,null));}else{return _0x4756f7[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x4e514a,_0x2dd131){if(_0x4e514a[_0x66c7('0x15')]['id']){delete _0x4e514a['body']['id'];}var _0x9afd50={'online':_0x66c7('0x1e'),'stopped':_0x66c7('0x1f')};if(_0x9afd50[_0x66c7('0x20')](_0x4e514a[_0x66c7('0x15')][_0x66c7('0x8')])){return pm2[_0x9afd50[_0x4e514a['body'][_0x66c7('0x8')]]](_0x4e514a[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](respondWithResult(_0x2dd131,0xc8))[_0x66c7('0x12')](handleError(_0x2dd131,null));}else{return _0x2dd131[_0x66c7('0x8')](0x1f4)['send']({'message':_0x66c7('0x21')});}};exports['destroy']=function(_0xfbd97,_0x543fbf){if(_0xfbd97[_0x66c7('0x15')]['id']){delete _0xfbd97[_0x66c7('0x15')]['id'];}if(_0xfbd97[_0x66c7('0x13')]['id']){return pm2[_0x66c7('0x22')](_0xfbd97[_0x66c7('0x13')]['id'])[_0x66c7('0xe')](function(_0x559ab9){pm2['dump']();return _0x559ab9[0x0];})[_0x66c7('0xe')](respondWithResult(_0x543fbf,null))[_0x66c7('0x12')](handleError(_0x543fbf,null));}else{return _0x543fbf[_0x66c7('0x8')](0x1f4)[_0x66c7('0x1d')]({'message':_0x66c7('0x23')});}}; \ No newline at end of file +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 diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e6cec4d..d5ecc02 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 _0x016b=['getQueues','exports','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x98bb8d,_0x41e468){var _0x6bccb0=function(_0x435df2){while(--_0x435df2){_0x98bb8d['push'](_0x98bb8d['shift']());}};_0x6bccb0(++_0x41e468);}(_0x016b,0xb6));var _0xb016=function(_0x2715a5,_0x130cff){_0x2715a5=_0x2715a5-0x0;var _0x48cc79=_0x016b[_0x2715a5];return _0x48cc79;};'use strict';var express=require(_0xb016('0x0'));var router=express['Router']();var auth=require(_0xb016('0x1'));var controller=require(_0xb016('0x2'));router[_0xb016('0x3')](_0xb016('0x4'),auth[_0xb016('0x5')](),controller[_0xb016('0x6')]);router['get'](_0xb016('0x7'),auth[_0xb016('0x5')](),controller[_0xb016('0x8')]);module[_0xb016('0x9')]=router; \ No newline at end of file +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 diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2fbfb90..cca01ec 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(_0x1db646,_0x3021d1){var _0x2f4249=function(_0x8e0685){while(--_0x8e0685){_0x1db646['push'](_0x1db646['shift']());}};_0x2f4249(++_0x3021d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_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 diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 53c2457..42b3a9b 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1bbdbc,_0x1c18ba){var _0x537539=function(_0x8ec550){while(--_0x8ec550){_0x1bbdbc['push'](_0x1bbdbc['shift']());}};_0x537539(++_0x1c18ba);}(_0xe706,0xa3));var _0x6e70=function(_0x2b79f4,_0x50d267){_0x2b79f4=_0x2b79f4-0x0;var _0x111a9c=_0xe706[_0x2b79f4];return _0x111a9c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c5c575b..a60f067 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 _0x938d=['sequelize','exports','STRING','DATE','INTEGER'];(function(_0x56b2c9,_0x38d9e6){var _0x1624bb=function(_0x4d1872){while(--_0x4d1872){_0x56b2c9['push'](_0x56b2c9['shift']());}};_0x1624bb(++_0x38d9e6);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xd938('0x2')]},'scheduledat':{'type':Sequelize[_0xd938('0x3')]},'uniqueid':{'type':Sequelize[_0xd938('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd938('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd938('0x2')]},'campaigntype':{'type':Sequelize[_0xd938('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 476f032..a3fcfd4 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 _0xde75=['rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xde75,0x1e7));var _0x5de7=function(_0x289ee3,_0x569106){_0x289ee3=_0x289ee3-0x0;var _0x4917a8=_0xde75[_0x289ee3];return _0x4917a8;};'use strict';var _=require(_0x5de7('0x0'));var util=require(_0x5de7('0x1'));var logger=require(_0x5de7('0x2'))(_0x5de7('0x3'));var moment=require(_0x5de7('0x4'));var BPromise=require(_0x5de7('0x5'));var rp=require(_0x5de7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5de7('0x7'));var config=require('../../config/environment');var attributes=require(_0x5de7('0x8'));module[_0x5de7('0x9')]=function(_0x484c9f,_0x26bc08){return _0x484c9f[_0x5de7('0xa')](_0x5de7('0xb'),attributes,{'tableName':_0x5de7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index aea0e31..62d4476 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 _0x9bdc=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','then','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x2fa307,_0x7c92cc){var _0x22d4ad=function(_0x534101){while(--_0x534101){_0x2fa307['push'](_0x2fa307['shift']());}};_0x22d4ad(++_0x7c92cc);}(_0x9bdc,0x77));var _0xc9bd=function(_0x25669e,_0x5c36ea){_0x25669e=_0x25669e-0x0;var _0xa2cc7c=_0x9bdc[_0x25669e];return _0xa2cc7c;};'use strict';var _=require(_0xc9bd('0x0'));var util=require(_0xc9bd('0x1'));var moment=require(_0xc9bd('0x2'));var BPromise=require(_0xc9bd('0x3'));var rs=require(_0xc9bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9bd('0x5'));var logger=require('../../config/logger')(_0xc9bd('0x6'));var config=require(_0xc9bd('0x7'));var jayson=require(_0xc9bd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x333cd1,_0x4e59f8,_0x1f6349){return new BPromise(function(_0x4a86f5,_0x387f31){return client[_0xc9bd('0x9')](_0x333cd1,_0x1f6349)['then'](function(_0x5490df){logger['info'](_0xc9bd('0xa'),_0x4e59f8,_0xc9bd('0xb'));logger[_0xc9bd('0xc')](_0xc9bd('0xd'),_0x4e59f8,_0xc9bd('0xb'),JSON[_0xc9bd('0xe')](_0x5490df));if(_0x5490df[_0xc9bd('0xf')]){if(_0x5490df[_0xc9bd('0xf')][_0xc9bd('0x10')]===0x1f4){logger['error'](_0xc9bd('0xa'),_0x4e59f8,_0x5490df['error']['message']);return _0x387f31(_0x5490df[_0xc9bd('0xf')]['message']);}logger['error'](_0xc9bd('0xa'),_0x4e59f8,_0x5490df['error'][_0xc9bd('0x11')]);return _0x4a86f5(_0x5490df[_0xc9bd('0xf')]['message']);}else{logger[_0xc9bd('0x12')](_0xc9bd('0xa'),_0x4e59f8,_0xc9bd('0xb'));_0x4a86f5(_0x5490df['result'][_0xc9bd('0x11')]);}})[_0xc9bd('0x13')](function(_0xb85c){logger[_0xc9bd('0xf')](_0xc9bd('0xa'),_0x4e59f8,_0xb85c);_0x387f31(_0xb85c);});});}exports[_0xc9bd('0x14')]=function(_0x4d94ac){var _0x5d1e8f=this;return new Promise(function(_0x4492c2,_0x58dc14){return db[_0xc9bd('0x15')][_0xc9bd('0x16')](_0x4d94ac['body'],{'raw':_0x4d94ac[_0xc9bd('0x17')]?_0x4d94ac['options'][_0xc9bd('0x18')]===undefined?!![]:![]:!![]})[_0xc9bd('0x19')](function(_0x3c2cde){logger['info'](_0xc9bd('0x14'),_0x4d94ac);logger[_0xc9bd('0xc')]('CreateReportAgentPreview',_0x4d94ac,JSON[_0xc9bd('0xe')](_0x3c2cde));_0x4492c2(_0x3c2cde);})[_0xc9bd('0x13')](function(_0x5e9d85){logger[_0xc9bd('0xf')]('CreateReportAgentPreview',_0x5e9d85['message'],_0x4d94ac);_0x58dc14(_0x5d1e8f['error'](0x1f4,_0x5e9d85[_0xc9bd('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 7750469..4a2bc5b 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 _0x72e1=['voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','exports','multer','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id'];(function(_0x3564d6,_0x37d1cb){var _0x1f2267=function(_0xbf7dfb){while(--_0xbf7dfb){_0x3564d6['push'](_0x3564d6['shift']());}};_0x1f2267(++_0x37d1cb);}(_0x72e1,0x86));var _0x172e=function(_0x2008e0,_0x478f1d){_0x2008e0=_0x2008e0-0x0;var _0x482b83=_0x72e1[_0x2008e0];return _0x482b83;};'use strict';var multer=require(_0x172e('0x0'));var util=require('util');var path=require(_0x172e('0x1'));var express=require(_0x172e('0x2'));var router=express[_0x172e('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x172e('0x4'));router[_0x172e('0x5')](_0x172e('0x6'),auth[_0x172e('0x7')](),controller[_0x172e('0x8')]);router[_0x172e('0x5')](_0x172e('0x9'),auth[_0x172e('0x7')](),controller[_0x172e('0xa')]);router[_0x172e('0x5')](_0x172e('0xb'),auth['isAuthenticated'](),controller[_0x172e('0xc')]);router['get']('/voice/queues',auth[_0x172e('0x7')](),controller['voiceQueues']);router[_0x172e('0x5')]('/chat/queues',auth[_0x172e('0x7')](),controller[_0x172e('0xd')]);router[_0x172e('0x5')](_0x172e('0xe'),auth[_0x172e('0x7')](),controller[_0x172e('0xf')]);router[_0x172e('0x5')](_0x172e('0x10'),auth[_0x172e('0x7')](),controller[_0x172e('0x11')]);router[_0x172e('0x5')](_0x172e('0x12'),auth[_0x172e('0x7')](),controller['openchannelQueues']);router['get'](_0x172e('0x13'),auth[_0x172e('0x7')](),controller[_0x172e('0x14')]);router[_0x172e('0x5')](_0x172e('0x15'),auth[_0x172e('0x7')](),controller[_0x172e('0x16')]);router['get'](_0x172e('0x17'),auth[_0x172e('0x7')](),controller[_0x172e('0x18')]);router[_0x172e('0x5')](_0x172e('0x19'),auth[_0x172e('0x7')](),controller[_0x172e('0x1a')]);router[_0x172e('0x5')](_0x172e('0x1b'),auth[_0x172e('0x7')](),controller[_0x172e('0x1c')]);router['get'](_0x172e('0x1d'),auth[_0x172e('0x7')](),controller[_0x172e('0x1e')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x172e('0x1f')]);router[_0x172e('0x5')](_0x172e('0x20'),auth['isAuthenticated'](),controller[_0x172e('0x21')]);router['get']('/voice/queues/:id',auth[_0x172e('0x7')](),controller[_0x172e('0x22')]);router['put'](_0x172e('0x23'),auth[_0x172e('0x7')](),controller[_0x172e('0x24')]);router[_0x172e('0x5')](_0x172e('0x25'),auth['isAuthenticated'](),controller[_0x172e('0x26')]);router[_0x172e('0x5')](_0x172e('0x27'),auth[_0x172e('0x7')](),controller['outboundChannels']);router[_0x172e('0x5')](_0x172e('0x28'),auth[_0x172e('0x7')](),controller[_0x172e('0x29')]);router['put'](_0x172e('0x2a'),auth[_0x172e('0x7')](),controller['agentCapacity']);router['get'](_0x172e('0x2b'),auth[_0x172e('0x7')](),controller[_0x172e('0x2c')]);router[_0x172e('0x5')](_0x172e('0x2d'),auth[_0x172e('0x7')](),controller[_0x172e('0x2e')]);router[_0x172e('0x5')](_0x172e('0x2f'),auth['isAuthenticated'](),controller[_0x172e('0x30')]);router[_0x172e('0x5')]('/fax/accounts',auth[_0x172e('0x7')](),controller[_0x172e('0x31')]);router[_0x172e('0x5')]('/chat/queues/waitinginteractions',auth[_0x172e('0x7')](),controller[_0x172e('0x32')]);router[_0x172e('0x5')]('/mail/queues/waitinginteractions',auth[_0x172e('0x7')](),controller[_0x172e('0x33')]);router[_0x172e('0x5')](_0x172e('0x34'),auth['isAuthenticated'](),controller[_0x172e('0x35')]);router[_0x172e('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0x172e('0x7')](),controller[_0x172e('0x36')]);router[_0x172e('0x5')]('/sms/queues/waitinginteractions',auth[_0x172e('0x7')](),controller[_0x172e('0x37')]);router['get'](_0x172e('0x38'),auth[_0x172e('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x172e('0x5')](_0x172e('0x39'),auth[_0x172e('0x7')](),controller[_0x172e('0x3a')]);router[_0x172e('0x3b')]('/mail/queues/:id/notify',auth[_0x172e('0x7')](),controller[_0x172e('0x3c')](_0x172e('0x3d')));router[_0x172e('0x5')]('/mail/queues/:id',auth[_0x172e('0x7')](),controller[_0x172e('0x3e')]);router[_0x172e('0x3b')](_0x172e('0x3f'),auth['isAuthenticated'](),controller[_0x172e('0x3c')](_0x172e('0x40')));router[_0x172e('0x5')](_0x172e('0x41'),auth[_0x172e('0x7')](),controller[_0x172e('0x42')]);router[_0x172e('0x3b')](_0x172e('0x43'),auth['isAuthenticated'](),controller[_0x172e('0x3c')](_0x172e('0x44')));router['get'](_0x172e('0x45'),auth[_0x172e('0x7')](),controller[_0x172e('0x46')]);router[_0x172e('0x3b')](_0x172e('0x47'),auth[_0x172e('0x7')](),controller[_0x172e('0x3c')](_0x172e('0x48')));router[_0x172e('0x5')](_0x172e('0x49'),auth[_0x172e('0x7')](),controller[_0x172e('0x4a')]);router[_0x172e('0x3b')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x172e('0x3c')](_0x172e('0x4b')));router['post'](_0x172e('0x4c'),auth['isAuthenticated'](),controller[_0x172e('0x3c')]('whatsapp'));router[_0x172e('0x5')](_0x172e('0x4d'),auth[_0x172e('0x7')](),controller['showSmsQueues']);router[_0x172e('0x5')](_0x172e('0x4e'),auth[_0x172e('0x7')](),controller['showWhatsappQueues']);router[_0x172e('0x3b')]('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module[_0x172e('0x4f')]=router; \ No newline at end of file +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 diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a82e537..53a3cbf 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 _0x5e2d=['Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','update','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','agent','Agent\x20not\x20found','*,*,*,*','lodash','util','../../mysqldb','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','name','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','trunks'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x5e2d,0xc8));var _0xd5e2=function(_0x3d72f3,_0x506847){_0x3d72f3=_0x3d72f3-0x0;var _0x502036=_0x5e2d[_0x3d72f3];return _0x502036;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xd5e2('0x0'));var util=require(_0xd5e2('0x1'));var db=require(_0xd5e2('0x2'))['db'];var logger=require('../../config/logger')(_0xd5e2('0x3'));var jayson=require(_0xd5e2('0x4'));var amiClient=jayson[_0xd5e2('0x5')][_0xd5e2('0x6')]({'port':0x232a});var mailClient=jayson[_0xd5e2('0x5')][_0xd5e2('0x6')]({'port':0x232b});var routingClient=jayson[_0xd5e2('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3d87ff,_0x49546a,_0x3d5dd8){return new BPromise(function(_0x1acc09,_0x83e61f){var _0x185c80=_0x3d5dd8?_0x3d5dd8:amiClient;return _0x185c80['request'](_0x3d87ff,_0x49546a)[_0xd5e2('0x7')](function(_0x58cede){if(_0x58cede[_0xd5e2('0x8')]){if(_0x58cede['error'][_0xd5e2('0x9')]===0x1f4){return _0x83e61f(_0x58cede[_0xd5e2('0x8')]['message']);}return _0x1acc09(_0x58cede[_0xd5e2('0x8')][_0xd5e2('0xa')]);}else{_0x1acc09(_0x58cede[_0xd5e2('0xb')]);}})[_0xd5e2('0xc')](function(_0xe6995){_0x83e61f(_0xe6995);});});}function respondWithResult(_0x52afff,_0x44be85){_0x44be85=_0x44be85||0xc8;return function(_0x52e6f1){if(_0x52e6f1){return _0x52afff[_0xd5e2('0xd')](_0x44be85)[_0xd5e2('0xe')](_0x52e6f1);}return _0x52afff[_0xd5e2('0xf')](0x194);};}function handleError(_0x10e4e0,_0x30402b){_0x30402b=_0x30402b||0x1f4;return function(_0x50f356){logger['error'](_0x50f356[_0xd5e2('0x10')]);if(_0x50f356['name']){delete _0x50f356['name'];}_0x10e4e0['status'](_0x30402b)['send'](_0x50f356);};}function findById(_0x12d138){return function(_0x19af57){if(!_['isNil'](_0x12d138)&&!_[_0xd5e2('0x11')](_0x19af57)&&!_[_0xd5e2('0x11')](_0x19af57[_0xd5e2('0x12')])){return _[_0xd5e2('0x13')](_0x19af57['rows'],function(_0x41f20e){return _0x41f20e['id']==_0x12d138;});}return null;};}exports[_0xd5e2('0x14')]=function(_0x20fcae,_0x1e728c){return respondWithRpcPromise(_0xd5e2('0x15'),_0x20fcae['query'])[_0xd5e2('0x7')](respondWithResult(_0x1e728c,null))[_0xd5e2('0xc')](handleError(_0x1e728c,null));};exports[_0xd5e2('0x16')]=function(_0x510640,_0x2f84d6){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd5e2('0x17')](_0x510640[_0xd5e2('0x18')],_0x510640[_0xd5e2('0x19')]))['then'](respondWithResult(_0x2f84d6,null))['catch'](handleError(_0x2f84d6,null));};exports[_0xd5e2('0x1a')]=function(_0x10f09c,_0x10f592){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xd5e2('0x17')](_0x10f09c[_0xd5e2('0x18')],_0x10f09c[_0xd5e2('0x19')]))[_0xd5e2('0x7')](respondWithResult(_0x10f592,null))[_0xd5e2('0xc')](handleError(_0x10f592,null));};exports[_0xd5e2('0x1b')]=function(_0x23fb27,_0x45457f){return respondWithRpcPromise(_0xd5e2('0x1c'),_0x23fb27[_0xd5e2('0x18')])[_0xd5e2('0x7')](respondWithResult(_0x45457f,null))[_0xd5e2('0xc')](handleError(_0x45457f,null));};exports[_0xd5e2('0x1d')]=function(_0x2eae89,_0xb9a605){return respondWithRpcPromise(_0xd5e2('0x1c'),_0x2eae89[_0xd5e2('0x18')])['then'](findById(_0x2eae89[_0xd5e2('0x19')]['id']))[_0xd5e2('0x7')](respondWithResult(_0xb9a605,null))[_0xd5e2('0xc')](handleError(_0xb9a605,null));};exports[_0xd5e2('0x1e')]=function(_0x189a32,_0x1e24d9){return respondWithRpcPromise(_0xd5e2('0x1f'),_[_0xd5e2('0x17')](_0x189a32['body'],_0x189a32[_0xd5e2('0x19')]))[_0xd5e2('0x7')](respondWithResult(_0x1e24d9,null))[_0xd5e2('0xc')](handleError(_0x1e24d9,null));};exports[_0xd5e2('0x20')]=function(_0x216516,_0x176a0e){return respondWithRpcPromise(_0xd5e2('0x21'),_[_0xd5e2('0x17')](_0x216516['query'],_0x216516[_0xd5e2('0x19')]))['then'](respondWithResult(_0x176a0e,null))[_0xd5e2('0xc')](handleError(_0x176a0e,null));};exports[_0xd5e2('0x22')]=function(_0x5730ef,_0x5a594b){return respondWithRpcPromise('VoiceQueuesChannels',_0x5730ef[_0xd5e2('0x18')])[_0xd5e2('0x7')](respondWithResult(_0x5a594b,null))[_0xd5e2('0xc')](handleError(_0x5a594b,null));};exports[_0xd5e2('0x23')]=function(_0x5ac115,_0x4ddc47){return respondWithRpcPromise(_0xd5e2('0x24'),_[_0xd5e2('0x17')](_0x5ac115[_0xd5e2('0x18')],_0x5ac115[_0xd5e2('0x19')]))['then'](respondWithResult(_0x4ddc47,null))[_0xd5e2('0xc')](handleError(_0x4ddc47,null));};exports[_0xd5e2('0x25')]=function(_0x5922a0,_0x27934f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xd5e2('0x17')](_0x5922a0[_0xd5e2('0x18')],_0x5922a0[_0xd5e2('0x19')]))[_0xd5e2('0x7')](respondWithResult(_0x27934f,null))[_0xd5e2('0xc')](handleError(_0x27934f,null));};exports[_0xd5e2('0x26')]=function(_0x1dacd5,_0x5f01e2){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd5e2('0x17')](_0x1dacd5[_0xd5e2('0x18')],_0x1dacd5[_0xd5e2('0x19')]))[_0xd5e2('0x7')](respondWithResult(_0x5f01e2,null))[_0xd5e2('0xc')](handleError(_0x5f01e2,null));};exports[_0xd5e2('0x27')]=function(_0x3719e4,_0x4190e2){return respondWithRpcPromise('Outbound',_0x3719e4[_0xd5e2('0x18')])[_0xd5e2('0x7')](respondWithResult(_0x4190e2,null))[_0xd5e2('0xc')](handleError(_0x4190e2,null));};exports[_0xd5e2('0x28')]=function(_0x3018ea,_0xaa8b28){return respondWithRpcPromise(_0xd5e2('0x29'),_0x3018ea[_0xd5e2('0x18')])[_0xd5e2('0x7')](respondWithResult(_0xaa8b28,null))[_0xd5e2('0xc')](handleError(_0xaa8b28,null));};exports[_0xd5e2('0x2a')]=function(_0x8b8bcc,_0x514b78){var _0x28258d;return respondWithRpcPromise('Agents',_0x8b8bcc[_0xd5e2('0x18')])[_0xd5e2('0x7')](function(_0x4bdf12){_0x28258d=_0x4bdf12;return respondWithRpcPromise(_0xd5e2('0x2b'),_0x8b8bcc[_0xd5e2('0x18')],routingClient);})['then'](function(_0xb9c4f0){return _['merge']({},_0xb9c4f0,_0x28258d);})[_0xd5e2('0x7')](respondWithResult(_0x514b78,null))[_0xd5e2('0xc')](handleError(_0x514b78,null));};exports[_0xd5e2('0x2c')]=function(_0x8ad7b1,_0x32225a){if(_0x8ad7b1[_0xd5e2('0x2d')]&&_0x8ad7b1[_0xd5e2('0x2d')]['interaction']&&_0x8ad7b1[_0xd5e2('0x2e')]&&_0x8ad7b1[_0xd5e2('0x2e')]['name']){for(var _0x268814 in _0x8ad7b1[_0xd5e2('0x2d')][_0xd5e2('0x2f')]){if(_0x8ad7b1['body'][_0xd5e2('0x2f')][_0xd5e2('0x30')](_0x268814)){db['MemberReport'][_0xd5e2('0x31')]({'where':{'channel':_0x268814,'membername':_0x8ad7b1[_0xd5e2('0x2e')][_0xd5e2('0x32')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x8ad7b1['body'][_0xd5e2('0x2f')][_0x268814]&&_0x8ad7b1[_0xd5e2('0x2d')]['interaction'][_0x268814][_0xd5e2('0x33')]?{'$notIn':_0x8ad7b1[_0xd5e2('0x2d')][_0xd5e2('0x2f')][_0x268814]}:{'$ne':null}}})[_0xd5e2('0x7')](function(_0x11846e){var _0x3f5195=moment()[_0xd5e2('0x34')](_0xd5e2('0x35'));for(var _0x49581a=0x0,_0x3a8f8f=_0x11846e[_0xd5e2('0x33')];_0x49581a<_0x3a8f8f;_0x49581a+=0x1){_0x11846e[_0x49581a][_0xd5e2('0x36')]({'exitAt':_0x3f5195});}});for(var _0x4b8433=0x0;_0x4b8433<_0x8ad7b1[_0xd5e2('0x2d')][_0xd5e2('0x2f')][_0x268814][_0xd5e2('0x33')];_0x4b8433+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x268814,'membername':_0x8ad7b1[_0xd5e2('0x2e')][_0xd5e2('0x32')],'type':_0xd5e2('0x37'),'uniqueid':_0x8ad7b1[_0xd5e2('0x2d')][_0xd5e2('0x2f')][_0x268814][_0x4b8433],'exitAt':null},'defaults':{'channel':_0x268814,'membername':_0x8ad7b1[_0xd5e2('0x2e')][_0xd5e2('0x32')],'interface':_['isNil'](_0x8ad7b1[_0xd5e2('0x2e')][_0xd5e2('0x38')])?util[_0xd5e2('0x34')](_0xd5e2('0x39'),_0x8ad7b1[_0xd5e2('0x2e')][_0xd5e2('0x32')]):_0x8ad7b1[_0xd5e2('0x2e')]['interface'],'type':_0xd5e2('0x37'),'enterAt':moment()[_0xd5e2('0x34')](_0xd5e2('0x35')),'role':'agent','internal':_0x8ad7b1[_0xd5e2('0x2e')][_0xd5e2('0x3a')],'uniqueid':_0x8ad7b1[_0xd5e2('0x2d')]['interaction'][_0x268814][_0x4b8433]}});}}}}return respondWithRpcPromise(_0xd5e2('0x3b'),{'id':_0x8ad7b1[_0xd5e2('0x19')]['id'],'capacity':_0x8ad7b1[_0xd5e2('0x2d')][_0xd5e2('0x3c')]},routingClient)[_0xd5e2('0x7')](respondWithResult(_0x32225a,null))[_0xd5e2('0xc')](handleError(_0x32225a,null));};exports[_0xd5e2('0x3d')]=function(_0x1dff3c,_0x24451b){return respondWithRpcPromise(_0xd5e2('0x3e'),_0x1dff3c[_0xd5e2('0x18')])['then'](respondWithResult(_0x24451b,null))['catch'](handleError(_0x24451b,null));};exports[_0xd5e2('0x3f')]=function(_0x313977,_0xedd67d){return respondWithRpcPromise(_0xd5e2('0x40'),_0x313977[_0xd5e2('0x18')])[_0xd5e2('0x7')](respondWithResult(_0xedd67d,null))[_0xd5e2('0xc')](handleError(_0xedd67d,null));};exports[_0xd5e2('0x41')]=function(_0xcc068a,_0x360643){return respondWithRpcPromise(_0xd5e2('0x42'),_0xcc068a['query'])[_0xd5e2('0x7')](respondWithResult(_0x360643,null))[_0xd5e2('0xc')](handleError(_0x360643,null));};exports['chatQueues']=function(_0x450341,_0x245124){return respondWithRpcPromise(_0xd5e2('0x43'),_0x450341[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x245124,null))[_0xd5e2('0xc')](handleError(_0x245124,null));};exports[_0xd5e2('0x44')]=function(_0x363bf2,_0x176707){return respondWithRpcPromise(_0xd5e2('0x43'),_0x363bf2[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](findById(_0x363bf2['params']['id']))[_0xd5e2('0x7')](respondWithResult(_0x176707,null))[_0xd5e2('0xc')](handleError(_0x176707,null));};exports[_0xd5e2('0x45')]=function(_0x5c9c8d,_0x43618d){return respondWithRpcPromise(_0xd5e2('0x46'),_0x5c9c8d[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x43618d,null))[_0xd5e2('0xc')](handleError(_0x43618d,null));};exports[_0xd5e2('0x47')]=function(_0x38b38d,_0x860357){return respondWithRpcPromise('MailQueues',_0x38b38d[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](findById(_0x38b38d[_0xd5e2('0x19')]['id']))[_0xd5e2('0x7')](respondWithResult(_0x860357,null))[_0xd5e2('0xc')](handleError(_0x860357,null));};exports[_0xd5e2('0x48')]=function(_0x42949e,_0x3229d0){return respondWithRpcPromise(_0xd5e2('0x49'),_0x42949e[_0xd5e2('0x18')],mailClient)[_0xd5e2('0x7')](respondWithResult(_0x3229d0,null))[_0xd5e2('0xc')](handleError(_0x3229d0,null));};exports[_0xd5e2('0x4a')]=function(_0x5bc08b,_0x243fb0){return respondWithRpcPromise(_0xd5e2('0x4b'),_0x5bc08b['query'],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x243fb0,null))['catch'](handleError(_0x243fb0,null));};exports[_0xd5e2('0x4c')]=function(_0x200044,_0x3ba7fb){return respondWithRpcPromise(_0xd5e2('0x4b'),_0x200044['query'],routingClient)['then'](findById(_0x200044['params']['id']))[_0xd5e2('0x7')](respondWithResult(_0x3ba7fb,null))[_0xd5e2('0xc')](handleError(_0x3ba7fb,null));};exports[_0xd5e2('0x4d')]=function(_0x279d77,_0x396453){return respondWithRpcPromise(_0xd5e2('0x4e'),_0x279d77['query'],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x396453,null))['catch'](handleError(_0x396453,null));};exports['showSmsQueues']=function(_0x4f8cfa,_0x2aa0d2){return respondWithRpcPromise(_0xd5e2('0x4e'),_0x4f8cfa['query'],routingClient)[_0xd5e2('0x7')](findById(_0x4f8cfa[_0xd5e2('0x19')]['id']))['then'](respondWithResult(_0x2aa0d2,null))[_0xd5e2('0xc')](handleError(_0x2aa0d2,null));};exports[_0xd5e2('0x4f')]=function(_0x1da6ae,_0x2e0a19){return respondWithRpcPromise(_0xd5e2('0x50'),_0x1da6ae['query'],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x2e0a19,null))[_0xd5e2('0xc')](handleError(_0x2e0a19,null));};exports[_0xd5e2('0x51')]=function(_0x56d946,_0x127662){return respondWithRpcPromise(_0xd5e2('0x50'),_0x56d946[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](findById(_0x56d946['params']['id']))[_0xd5e2('0x7')](respondWithResult(_0x127662,null))[_0xd5e2('0xc')](handleError(_0x127662,null));};exports[_0xd5e2('0x52')]=function(_0xd4f19e,_0x490966){return respondWithRpcPromise(_0xd5e2('0x53'),_0xd4f19e[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x490966,null))[_0xd5e2('0xc')](handleError(_0x490966,null));};exports[_0xd5e2('0x54')]=function(_0x2abc4e,_0x207c73){return respondWithRpcPromise('FaxQueues',_0x2abc4e[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](findById(_0x2abc4e[_0xd5e2('0x19')]['id']))['then'](respondWithResult(_0x207c73,null))[_0xd5e2('0xc')](handleError(_0x207c73,null));};exports[_0xd5e2('0x55')]=function(_0xabc04,_0x1f01ad){return respondWithRpcPromise(_0xd5e2('0x56'),_0xabc04[_0xd5e2('0x18')])['then'](respondWithResult(_0x1f01ad,null))[_0xd5e2('0xc')](handleError(_0x1f01ad,null));};exports['chatQueuesWaitingInteractions']=function(_0x1f151f,_0xdb2f8){return respondWithRpcPromise(_0xd5e2('0x57'),_0x1f151f[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](respondWithResult(_0xdb2f8,null))['catch'](handleError(_0xdb2f8,null));};exports['mailQueuesWaitingInteractions']=function(_0x5b8194,_0x59ba4f){return respondWithRpcPromise(_0xd5e2('0x58'),_0x5b8194['query'],routingClient)['then'](respondWithResult(_0x59ba4f,null))['catch'](handleError(_0x59ba4f,null));};exports[_0xd5e2('0x59')]=function(_0x2f94ea,_0x19d488){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2f94ea[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x19d488,null))[_0xd5e2('0xc')](handleError(_0x19d488,null));};exports[_0xd5e2('0x5a')]=function(_0x5e7434,_0x2dc4f1){return respondWithRpcPromise(_0xd5e2('0x5b'),_0x5e7434['query'],routingClient)[_0xd5e2('0x7')](function(_0x4a3741){if(_0x5e7434[_0xd5e2('0x18')][_0xd5e2('0x5c')]!==undefined){var _0x589fc9=_(_0x4a3741[_0xd5e2('0x12')])['filter']([_0x5e7434[_0xd5e2('0x18')][_0xd5e2('0x5c')],_0x5e7434[_0xd5e2('0x19')]['id']])[_0xd5e2('0x5d')](_0xd5e2('0x5e'))[_0xd5e2('0x5f')]()[_0xd5e2('0x60')]();return _0x4a3741[_0xd5e2('0x12')][_0xd5e2('0x61')](function(_0x556bfa){return _0x589fc9[_0xd5e2('0x62')](_0x556bfa[_0xd5e2('0x5e')])>-0x1;});}else{return _0x4a3741[_0xd5e2('0x12')][_0xd5e2('0x61')](function(_0x5497b6){return _0x5497b6['queue_id']===parseInt(_0x5e7434[_0xd5e2('0x19')]['id']);});}})[_0xd5e2('0x7')](respondWithResult(_0x2dc4f1,null))[_0xd5e2('0xc')](handleError(_0x2dc4f1,null));};exports['smsQueuesWaitingInteractions']=function(_0x12203a,_0x5b8309){return respondWithRpcPromise(_0xd5e2('0x63'),_0x12203a['query'],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x5b8309,null))['catch'](handleError(_0x5b8309,null));};exports[_0xd5e2('0x64')]=function(_0x5157e5,_0x5da7b2){return respondWithRpcPromise(_0xd5e2('0x65'),_0x5157e5[_0xd5e2('0x18')],routingClient)[_0xd5e2('0x7')](respondWithResult(_0x5da7b2,null))[_0xd5e2('0xc')](handleError(_0x5da7b2,null));};exports[_0xd5e2('0x66')]=function(_0xa15bbb,_0x1585d7){return respondWithRpcPromise(_0xd5e2('0x67'),_0xa15bbb[_0xd5e2('0x18')],routingClient)['then'](respondWithResult(_0x1585d7,null))[_0xd5e2('0xc')](handleError(_0x1585d7,null));};exports[_0xd5e2('0x68')]=function(_0x110f46){return function(_0x373301,_0x3e1acb){var _0x256299,_0x4fd7ca;var _0x327b88=_[_0xd5e2('0x69')](_0x110f46);var _0x2b8b40=_0x110f46===_0xd5e2('0x6a')?_0xd5e2('0x6b'):_0xd5e2('0x6c');return db[_0x327b88+_0xd5e2('0x6d')][_0xd5e2('0x6e')]({'raw':!![],'where':{'id':_0x373301[_0xd5e2('0x19')]['id']}})[_0xd5e2('0x7')](function(_0x16b240){if(_[_0xd5e2('0x11')](_0x16b240)){throw new Error(_0x327b88+_0xd5e2('0x6f'));}_0x256299=_0x16b240;return db[_0x327b88+_0xd5e2('0x70')][_0xd5e2('0x6e')]({'where':{'id':_0x373301[_0xd5e2('0x2d')][_0xd5e2('0x71')]},'include':[{'model':db[_0x327b88+'Interaction'],'as':'Interaction'},{'model':db[_0x327b88+_0x2b8b40],'as':_0xd5e2('0x6c')}]});})[_0xd5e2('0x7')](function(_0x3b9f6a){if(_['isNil'](_0x3b9f6a)){throw new Error(_0x327b88+_0xd5e2('0x72'));}_0x4fd7ca=_0x3b9f6a;return _0x3b9f6a[_0xd5e2('0x73')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd5e2('0x7')](function(){var _0x34a545={'uniqueid':_0x110f46+'.'+_0x4fd7ca['id']+'.'+_0x4fd7ca[_0xd5e2('0x74')]['id'],'FromUserId':_0x373301[_0xd5e2('0x2e')]['id'],'type':_0xd5e2('0x75')};_0x34a545[_0x327b88+_0xd5e2('0x76')]=_0x4fd7ca['id'];_0x34a545[_0x327b88+_0xd5e2('0x77')]=_0x4fd7ca[_0xd5e2('0x74')]['id'];_0x34a545[_0xd5e2('0x78')+_0x327b88+_0x2b8b40+'Id']=_0x4fd7ca['Account']['id'];_0x34a545['To'+_0x327b88+_0xd5e2('0x79')]=_0x256299['id'];return db[_0x327b88+_0xd5e2('0x7a')][_0xd5e2('0x7b')](_0x34a545);})[_0xd5e2('0x7')](function(){return respondWithRpcPromise(_0xd5e2('0x7c'),{'channel':_0x110f46,'interaction':_0x4fd7ca[_0xd5e2('0x74')],'message':_0x4fd7ca,'account':_0x4fd7ca[_0xd5e2('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd5e2('0x75'),'appdata':_0x256299[_0xd5e2('0x32')]+','+(_0x4fd7ca['Account'][_0xd5e2('0x7d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd5e2('0x7')](respondWithResult(_0x3e1acb,null))['catch'](handleError(_0x3e1acb,null));};};exports[_0xd5e2('0x7e')]=function(_0x4a9f62,_0x222b21){var _0xa4cb82,_0xc933da;if(_[_0xd5e2('0x11')](_0x4a9f62['body'][_0xd5e2('0x7f')])){throw new Error(_0xd5e2('0x80'));}var _0x299c36=_0x4a9f62[_0xd5e2('0x2d')][_0xd5e2('0x7f')];var _0x39c937=_[_0xd5e2('0x69')](_0x299c36);var _0x560479=_0x299c36===_0xd5e2('0x6a')?'Website':_0xd5e2('0x6c');return db['User'][_0xd5e2('0x6e')]({'raw':!![],'where':{'id':_0x4a9f62[_0xd5e2('0x19')]['id'],'role':_0xd5e2('0x81')}})[_0xd5e2('0x7')](function(_0x173cca){if(_[_0xd5e2('0x11')](_0x173cca)){throw new Error(_0xd5e2('0x82'));}_0xa4cb82=_0x173cca;return db[_0x39c937+'Message'][_0xd5e2('0x6e')]({'where':{'id':_0x4a9f62['body'][_0xd5e2('0x71')]},'include':[{'model':db[_0x39c937+_0xd5e2('0x74')],'as':'Interaction'},{'model':db[_0x39c937+_0x560479],'as':_0xd5e2('0x6c')}]});})[_0xd5e2('0x7')](function(_0x23c6a2){if(_[_0xd5e2('0x11')](_0x23c6a2)){throw new Error(_0x39c937+_0xd5e2('0x72'));}_0xc933da=_0x23c6a2;return _0x23c6a2[_0xd5e2('0x73')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3aab68={'uniqueid':_0x299c36+'.'+_0xc933da['id']+'.'+_0xc933da[_0xd5e2('0x74')]['id'],'FromUserId':_0x4a9f62['user']['id'],'type':_0xd5e2('0x81'),'ToUserId':_0xa4cb82['id']};_0x3aab68[_0x39c937+_0xd5e2('0x76')]=_0xc933da['id'];_0x3aab68[_0x39c937+_0xd5e2('0x77')]=_0xc933da[_0xd5e2('0x74')]['id'];_0x3aab68['From'+_0x39c937+_0x560479+'Id']=_0xc933da[_0xd5e2('0x6c')]['id'];return db[_0x39c937+_0xd5e2('0x7a')][_0xd5e2('0x7b')](_0x3aab68);})[_0xd5e2('0x7')](function(){return respondWithRpcPromise(_0xd5e2('0x7c'),{'channel':_0x299c36,'interaction':_0xc933da[_0xd5e2('0x74')],'message':_0xc933da,'account':_0xc933da['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd5e2('0x81'),'appdata':_0xa4cb82[_0xd5e2('0x32')]+','+(_0xc933da[_0xd5e2('0x6c')]['agentTransferTimeout']||0x12c),'interval':_0xd5e2('0x83')}]},routingClient);})[_0xd5e2('0x7')](respondWithResult(_0x222b21,null))[_0xd5e2('0xc')](handleError(_0x222b21,null));}; \ No newline at end of file +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 diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e4815ab..62b858d 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 _0xd43c=['/:id','show','/:id/run','run','post','create','put','update','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index'];(function(_0x276d1c,_0x1f10bf){var _0x370eae=function(_0x550291){while(--_0x550291){_0x276d1c['push'](_0x276d1c['shift']());}};_0x370eae(++_0x1f10bf);}(_0xd43c,0x7b));var _0xcd43=function(_0x21463c,_0x109b1f){_0x21463c=_0x21463c-0x0;var _0xfb4c9a=_0xd43c[_0x21463c];return _0xfb4c9a;};'use strict';var multer=require(_0xcd43('0x0'));var util=require('util');var path=require(_0xcd43('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcd43('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcd43('0x3'));var interaction=require(_0xcd43('0x4'));var config=require(_0xcd43('0x5'));var controller=require(_0xcd43('0x6'));router[_0xcd43('0x7')]('/',auth[_0xcd43('0x8')](),controller[_0xcd43('0x9')]);router[_0xcd43('0x7')](_0xcd43('0xa'),auth[_0xcd43('0x8')](),controller[_0xcd43('0xb')]);router['get'](_0xcd43('0xc'),auth[_0xcd43('0x8')](),controller[_0xcd43('0xd')]);router[_0xcd43('0xe')]('/',auth[_0xcd43('0x8')](),controller[_0xcd43('0xf')]);router[_0xcd43('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcd43('0x11')]);router['delete'](_0xcd43('0xa'),auth[_0xcd43('0x8')](),controller[_0xcd43('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 74be9f7..18bbecf 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 _0xb091=['DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','custom','default','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*'];(function(_0x5475fc,_0x4544d9){var _0x1afc90=function(_0x32bc25){while(--_0x32bc25){_0x5475fc['push'](_0x5475fc['shift']());}};_0x1afc90(++_0x4544d9);}(_0xb091,0x19b));var _0x1b09=function(_0x42ebe0,_0x448677){_0x42ebe0=_0x42ebe0-0x0;var _0x1991bd=_0xb091[_0x42ebe0];return _0x1991bd;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1b09('0x1')],'allowNull':![],'defaultValue':_0x1b09('0x2')},'startAt':{'type':Sequelize[_0x1b09('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x1b09('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1b09('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1b09('0x5')](_0x1b09('0x6'),_0x1b09('0x7'),_0x1b09('0x8'),_0x1b09('0x9'),_0x1b09('0xa'),_0x1b09('0xb'),_0x1b09('0xc')),'allowNull':![],'defaultValue':_0x1b09('0xa')},'output':{'type':Sequelize[_0x1b09('0x5')](_0x1b09('0xd'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x1b09('0xd')},'type':{'type':Sequelize[_0x1b09('0x5')](_0x1b09('0xe'),_0x1b09('0xf')),'allowNull':![],'defaultValue':_0x1b09('0xe')},'sendMail':{'type':Sequelize[_0x1b09('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1b09('0x11')]},'bcc':{'type':Sequelize[_0x1b09('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x1b09('0x10')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3db9b62..1b02965 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 _0xea7d=['offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','Scheduler','sendStatus','error','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x4d7dc4,_0x32d76d){var _0x253b7e=function(_0x3dea03){while(--_0x3dea03){_0x4d7dc4['push'](_0x4d7dc4['shift']());}};_0x253b7e(++_0x32d76d);}(_0xea7d,0x136));var _0xdea7=function(_0x5e8602,_0x2ce012){_0x5e8602=_0x5e8602-0x0;var _0x4434fb=_0xea7d[_0x5e8602];return _0x4434fb;};'use strict';var emlformat=require(_0xdea7('0x0'));var rimraf=require(_0xdea7('0x1'));var zipdir=require(_0xdea7('0x2'));var jsonpatch=require(_0xdea7('0x3'));var rp=require('request-promise');var moment=require(_0xdea7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdea7('0x5'));var path=require(_0xdea7('0x6'));var sox=require(_0xdea7('0x7'));var csv=require(_0xdea7('0x8'));var ejs=require(_0xdea7('0x9'));var fs=require('fs');var fs_extra=require(_0xdea7('0xa'));var _=require(_0xdea7('0xb'));var squel=require(_0xdea7('0xc'));var crypto=require(_0xdea7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdea7('0xe'));var toCsv=require(_0xdea7('0x8'));var querystring=require(_0xdea7('0xf'));var Papa=require(_0xdea7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdea7('0x11'));var hardwareService=require(_0xdea7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xdea7('0x13'));var config=require(_0xdea7('0x14'));var licenseUtil=require(_0xdea7('0x15'));var db=require(_0xdea7('0x16'))['db'];function respondWithStatusCode(_0x3fc66f,_0x4ee9dc){_0x4ee9dc=_0x4ee9dc||0xcc;return function(_0x2d94af){if(_0x2d94af){return _0x3fc66f['sendStatus'](_0x4ee9dc);}return _0x3fc66f[_0xdea7('0x17')](_0x4ee9dc)[_0xdea7('0x18')]();};}function respondWithResult(_0x1471b3,_0x5cfafc){_0x5cfafc=_0x5cfafc||0xc8;return function(_0x31aabd){if(_0x31aabd){return _0x1471b3['status'](_0x5cfafc)[_0xdea7('0x19')](_0x31aabd);}};}function respondWithFilteredResult(_0x21a3b7,_0x4af71a){return function(_0x2f0984){if(_0x2f0984){var _0x5d2d6d=typeof _0x4af71a[_0xdea7('0x1a')]===_0xdea7('0x1b')&&typeof _0x4af71a[_0xdea7('0x1c')]===_0xdea7('0x1b');var _0x27f2ca=_0x2f0984['count'];var _0x1b244f=_0x5d2d6d?0x0:_0x4af71a[_0xdea7('0x1a')];var _0x2546fd=_0x5d2d6d?_0x2f0984[_0xdea7('0x1d')]:_0x4af71a[_0xdea7('0x1a')]+_0x4af71a['limit'];var _0x5a213b;if(_0x2546fd>=_0x27f2ca){_0x2546fd=_0x27f2ca;_0x5a213b=0xc8;}else{_0x5a213b=0xce;}_0x21a3b7[_0xdea7('0x17')](_0x5a213b);return _0x21a3b7[_0xdea7('0x1e')](_0xdea7('0x1f'),_0x1b244f+'-'+_0x2546fd+'/'+_0x27f2ca)[_0xdea7('0x19')](_0x2f0984);}return null;};}function patchUpdates(_0x4e058c){return function(_0x46b39c){try{jsonpatch[_0xdea7('0x20')](_0x46b39c,_0x4e058c,!![]);}catch(_0x276a28){return BPromise['reject'](_0x276a28);}return _0x46b39c[_0xdea7('0x21')]();};}function saveUpdates(_0x3aaf27,_0x2a6d38){return function(_0x1616a0){if(_0x1616a0){return _0x1616a0['update'](_0x3aaf27)[_0xdea7('0x22')](function(_0x409113){return _0x409113;});}return null;};}function removeEntity(_0x5af426,_0x3a4c79){return function(_0x91da55){if(_0x91da55){return _0x91da55[_0xdea7('0x23')]()[_0xdea7('0x22')](function(){var _0x1575d2=_0x91da55['get']({'plain':!![]});var _0x50af4d=_0xdea7('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x50af4d,'resourceId':_0x1575d2['id']}})[_0xdea7('0x22')](function(){return _0x91da55;});})[_0xdea7('0x22')](function(){_0x5af426[_0xdea7('0x17')](0xcc)[_0xdea7('0x18')]();});}};}function handleEntityNotFound(_0x1299cd,_0x14a75b){return function(_0x7d26d){if(!_0x7d26d){_0x1299cd[_0xdea7('0x25')](0x194);}return _0x7d26d;};}function handleError(_0x24abee,_0x43870d){_0x43870d=_0x43870d||0x1f4;return function(_0x23658e){logger[_0xdea7('0x26')](_0x23658e['stack']);if(_0x23658e['name']){delete _0x23658e[_0xdea7('0x27')];}_0x24abee[_0xdea7('0x17')](_0x43870d)[_0xdea7('0x28')](_0x23658e);};}exports[_0xdea7('0x29')]=function(_0x52b227,_0x180f19){var _0x3791fa={},_0x4d6a31={},_0x306294={'count':0x0,'rows':[]};var _0x39e96f=_['map'](db[_0xdea7('0x2a')][_0xdea7('0x2b')],function(_0x3ee491){return{'name':_0x3ee491[_0xdea7('0x2c')],'type':_0x3ee491[_0xdea7('0x2d')][_0xdea7('0x2e')]};});_0x4d6a31[_0xdea7('0x2f')]=_[_0xdea7('0x30')](_0x39e96f,_0xdea7('0x27'));_0x4d6a31[_0xdea7('0x31')]=_[_0xdea7('0x32')](_0x52b227[_0xdea7('0x31')]);_0x4d6a31[_0xdea7('0x33')]=_[_0xdea7('0x34')](_0x4d6a31['model'],_0x4d6a31[_0xdea7('0x31')]);_0x3791fa[_0xdea7('0x35')]=_[_0xdea7('0x34')](_0x4d6a31[_0xdea7('0x2f')],qs[_0xdea7('0x36')](_0x52b227['query'][_0xdea7('0x36')]));_0x3791fa[_0xdea7('0x35')]=_0x3791fa['attributes']['length']?_0x3791fa[_0xdea7('0x35')]:_0x4d6a31[_0xdea7('0x2f')];if(!_0x52b227[_0xdea7('0x31')][_0xdea7('0x37')](_0xdea7('0x38'))){_0x3791fa[_0xdea7('0x1c')]=qs[_0xdea7('0x1c')](_0x52b227[_0xdea7('0x31')][_0xdea7('0x1c')]);_0x3791fa[_0xdea7('0x1a')]=qs['offset'](_0x52b227[_0xdea7('0x31')][_0xdea7('0x1a')]);}_0x3791fa[_0xdea7('0x39')]=qs[_0xdea7('0x3a')](_0x52b227[_0xdea7('0x31')][_0xdea7('0x3a')]);_0x3791fa['where']=qs[_0xdea7('0x33')](_[_0xdea7('0x3b')](_0x52b227[_0xdea7('0x31')],_0x4d6a31[_0xdea7('0x33')]),_0x39e96f);if(_0x52b227[_0xdea7('0x31')]['filter']){_0x3791fa[_0xdea7('0x3c')]=_[_0xdea7('0x3d')](_0x3791fa[_0xdea7('0x3c')],{'$or':_['map'](_0x39e96f,function(_0x4a8923){if(_0x4a8923[_0xdea7('0x2d')]!=='VIRTUAL'){var _0x3011b9={};_0x3011b9[_0x4a8923['name']]={'$like':'%'+_0x52b227[_0xdea7('0x31')][_0xdea7('0x3e')]+'%'};return _0x3011b9;}})});}_0x3791fa=_['merge']({},_0x3791fa,_0x52b227['options']);var _0x8f7ca5={'where':_0x3791fa['where']};return db['Schedule'][_0xdea7('0x1d')](_0x8f7ca5)[_0xdea7('0x22')](function(_0x30f490){_0x306294[_0xdea7('0x1d')]=_0x30f490;if(_0x52b227['query'][_0xdea7('0x3f')]){_0x3791fa[_0xdea7('0x40')]=[{'all':!![]}];}return db[_0xdea7('0x2a')][_0xdea7('0x41')](_0x3791fa);})[_0xdea7('0x22')](function(_0x47251c){_0x306294[_0xdea7('0x42')]=_0x47251c;return _0x306294;})[_0xdea7('0x22')](respondWithFilteredResult(_0x180f19,_0x3791fa))[_0xdea7('0x43')](handleError(_0x180f19,null));};exports[_0xdea7('0x44')]=function(_0x4e7317,_0xe2050b){var _0x21ff32={'raw':![],'where':{'id':_0x4e7317['params']['id']}},_0x178029={};_0x178029[_0xdea7('0x2f')]=_[_0xdea7('0x32')](db[_0xdea7('0x2a')][_0xdea7('0x2b')]);_0x178029[_0xdea7('0x31')]=_[_0xdea7('0x32')](_0x4e7317[_0xdea7('0x31')]);_0x178029[_0xdea7('0x33')]=_['intersection'](_0x178029[_0xdea7('0x2f')],_0x178029['query']);_0x21ff32[_0xdea7('0x35')]=_['intersection'](_0x178029['model'],qs[_0xdea7('0x36')](_0x4e7317['query'][_0xdea7('0x36')]));_0x21ff32[_0xdea7('0x35')]=_0x21ff32[_0xdea7('0x35')][_0xdea7('0x45')]?_0x21ff32[_0xdea7('0x35')]:_0x178029['model'];if(_0x4e7317[_0xdea7('0x31')][_0xdea7('0x3f')]){_0x21ff32[_0xdea7('0x40')]=[{'all':!![]}];}_0x21ff32=_[_0xdea7('0x3d')]({},_0x21ff32,_0x4e7317[_0xdea7('0x46')]);return db[_0xdea7('0x2a')][_0xdea7('0x47')](_0x21ff32)[_0xdea7('0x22')](handleEntityNotFound(_0xe2050b,null))[_0xdea7('0x22')](respondWithResult(_0xe2050b,null))[_0xdea7('0x43')](handleError(_0xe2050b,null));};exports[_0xdea7('0x48')]=function(_0x6be29e,_0x4d6b42){return db['Schedule'][_0xdea7('0x48')](_0x6be29e[_0xdea7('0x49')],{})[_0xdea7('0x22')](function(_0xeab43d){var _0x3fbaf1=_0x6be29e[_0xdea7('0x4a')]['get']({'plain':!![]});if(!_0x3fbaf1)throw new Error(_0xdea7('0x4b'));if(_0x3fbaf1[_0xdea7('0x4c')]===_0xdea7('0x4a')){var _0x226847=_0xeab43d['get']({'plain':!![]});var _0x59ffb3=_0xdea7('0x24');return db['UserProfileSection'][_0xdea7('0x47')]({'where':{'name':_0x59ffb3,'userProfileId':_0x3fbaf1[_0xdea7('0x4d')]},'raw':!![]})['then'](function(_0x15f502){if(_0x15f502&&_0x15f502[_0xdea7('0x4e')]===0x0){return db['UserProfileResource'][_0xdea7('0x48')]({'name':_0x226847[_0xdea7('0x27')],'resourceId':_0x226847['id'],'type':_0x15f502['name'],'sectionId':_0x15f502['id']},{})[_0xdea7('0x22')](function(){return _0xeab43d;});}else{return _0xeab43d;}})[_0xdea7('0x43')](function(_0x166620){logger[_0xdea7('0x26')](_0xdea7('0x4f'),_0x166620);throw _0x166620;});}return _0xeab43d;})[_0xdea7('0x22')](respondWithResult(_0x4d6b42,0xc9))[_0xdea7('0x43')](handleError(_0x4d6b42,null));};exports[_0xdea7('0x50')]=function(_0xa2e8cc,_0x1cf296){if(_0xa2e8cc[_0xdea7('0x49')]['id']){delete _0xa2e8cc[_0xdea7('0x49')]['id'];}return db['Schedule'][_0xdea7('0x47')]({'where':{'id':_0xa2e8cc[_0xdea7('0x51')]['id']}})['then'](handleEntityNotFound(_0x1cf296,null))[_0xdea7('0x22')](saveUpdates(_0xa2e8cc[_0xdea7('0x49')],null))[_0xdea7('0x22')](respondWithResult(_0x1cf296,null))['catch'](handleError(_0x1cf296,null));};exports[_0xdea7('0x23')]=function(_0x567d75,_0x524f19){return db[_0xdea7('0x2a')][_0xdea7('0x47')]({'where':{'id':_0x567d75[_0xdea7('0x51')]['id']}})[_0xdea7('0x22')](handleEntityNotFound(_0x524f19,null))[_0xdea7('0x22')](removeEntity(_0x524f19,null))[_0xdea7('0x43')](handleError(_0x524f19,null));};exports['run']=function(_0x10f011,_0x2841dd,_0x193963){var _0x588c35=require(_0xdea7('0x52'));return db['Schedule']['find']({'where':{'id':_0x10f011[_0xdea7('0x51')]['id']},'raw':!![]})[_0xdea7('0x22')](handleEntityNotFound(_0x2841dd,null))[_0xdea7('0x22')](function(){_0x588c35[_0xdea7('0x53')](_0x10f011[_0xdea7('0x51')]['id']);})[_0xdea7('0x22')](respondWithStatusCode(_0x2841dd,null))[_0xdea7('0x43')](handleError(_0x2841dd,null));}; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3edc1a9..a8d4136 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 _0x2c52=['api','moment','bluebird','path','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','util'];(function(_0x15996d,_0x298faa){var _0x206617=function(_0x36b420){while(--_0x36b420){_0x15996d['push'](_0x15996d['shift']());}};_0x206617(++_0x298faa);}(_0x2c52,0xda));var _0x22c5=function(_0x1f2f5b,_0x1caf46){_0x1f2f5b=_0x1f2f5b-0x0;var _0x3a0e8b=_0x2c52[_0x1f2f5b];return _0x3a0e8b;};'use strict';var _=require(_0x22c5('0x0'));var util=require(_0x22c5('0x1'));var logger=require('../../config/logger')(_0x22c5('0x2'));var moment=require(_0x22c5('0x3'));var BPromise=require(_0x22c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22c5('0x5'));var rimraf=require('rimraf');var config=require(_0x22c5('0x6'));var attributes=require(_0x22c5('0x7'));module['exports']=function(_0x37917d,_0x1eba1d){return _0x37917d[_0x22c5('0x8')](_0x22c5('0x9'),attributes,{'tableName':_0x22c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ed28691..c84063d 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 _0x3c32=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3c99ef,_0x50b107){var _0x17550c=function(_0x4ff16b){while(--_0x4ff16b){_0x3c99ef['push'](_0x3c99ef['shift']());}};_0x17550c(++_0x50b107);}(_0x3c32,0x1ad));var _0x23c3=function(_0x50c160,_0x452f5c){_0x50c160=_0x50c160-0x0;var _0x2c11bc=_0x3c32[_0x50c160];return _0x2c11bc;};'use strict';var _=require(_0x23c3('0x0'));var util=require('util');var moment=require(_0x23c3('0x1'));var BPromise=require(_0x23c3('0x2'));var rs=require(_0x23c3('0x3'));var fs=require('fs');var Redis=require(_0x23c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x23c3('0x5'));var logger=require(_0x23c3('0x6'))('rpc');var config=require(_0x23c3('0x7'));var jayson=require(_0x23c3('0x8'));var client=jayson[_0x23c3('0x9')][_0x23c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34d5fd,_0x34b445,_0x4c24cf){return new BPromise(function(_0x2d0345,_0x4ca0c5){return client[_0x23c3('0xb')](_0x34d5fd,_0x4c24cf)[_0x23c3('0xc')](function(_0x31d0aa){logger[_0x23c3('0xd')](_0x23c3('0xe'),_0x34b445,_0x23c3('0xf'));logger[_0x23c3('0x10')](_0x23c3('0x11'),_0x34b445,_0x23c3('0xf'),JSON[_0x23c3('0x12')](_0x31d0aa));if(_0x31d0aa[_0x23c3('0x13')]){if(_0x31d0aa['error'][_0x23c3('0x14')]===0x1f4){logger[_0x23c3('0x13')](_0x23c3('0xe'),_0x34b445,_0x31d0aa[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x4ca0c5(_0x31d0aa['error'][_0x23c3('0x15')]);}logger['error'](_0x23c3('0xe'),_0x34b445,_0x31d0aa[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x2d0345(_0x31d0aa[_0x23c3('0x13')][_0x23c3('0x15')]);}else{logger[_0x23c3('0xd')](_0x23c3('0xe'),_0x34b445,'request\x20sent');_0x2d0345(_0x31d0aa[_0x23c3('0x16')][_0x23c3('0x15')]);}})[_0x23c3('0x17')](function(_0x1e0e97){logger[_0x23c3('0x13')](_0x23c3('0xe'),_0x34b445,_0x1e0e97);_0x4ca0c5(_0x1e0e97);});});} \ No newline at end of file +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 diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index cc1cb4e..a9a6cb6 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 _0xdf0e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy'];(function(_0x309515,_0x55f470){var _0x51f8bd=function(_0x4cd1ee){while(--_0x4cd1ee){_0x309515['push'](_0x309515['shift']());}};_0x51f8bd(++_0x55f470);}(_0xdf0e,0x72));var _0xedf0=function(_0x462bff,_0x151a16){_0x462bff=_0x462bff-0x0;var _0x27229a=_0xdf0e[_0x462bff];return _0x27229a;};'use strict';var multer=require(_0xedf0('0x0'));var util=require(_0xedf0('0x1'));var path=require(_0xedf0('0x2'));var timeout=require(_0xedf0('0x3'));var express=require(_0xedf0('0x4'));var router=express[_0xedf0('0x5')]();var fs_extra=require(_0xedf0('0x6'));var auth=require(_0xedf0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xedf0('0x8'));router['get']('/',auth[_0xedf0('0x9')](),controller[_0xedf0('0xa')]);router['get']('/describe',auth[_0xedf0('0x9')](),controller['describe']);router[_0xedf0('0xb')](_0xedf0('0xc'),auth[_0xedf0('0x9')](),controller['show']);router[_0xedf0('0xb')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xedf0('0xd')]('/',auth[_0xedf0('0x9')](),controller[_0xedf0('0xe')]);router[_0xedf0('0xf')]('/:id',auth[_0xedf0('0x9')](),controller[_0xedf0('0x10')]);router[_0xedf0('0x11')](_0xedf0('0xc'),auth[_0xedf0('0x9')](),controller[_0xedf0('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index fc79311..0eea8bd 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 _0x9672=['closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x419c9f,_0x5b816b){var _0x3dd347=function(_0x46e8b6){while(--_0x46e8b6){_0x419c9f['push'](_0x419c9f['shift']());}};_0x3dd347(++_0x5b816b);}(_0x9672,0xee));var _0x2967=function(_0x2667c8,_0x4b6763){_0x2667c8=_0x2667c8-0x0;var _0x29c2b9=_0x9672[_0x2667c8];return _0x29c2b9;};'use strict';var Sequelize=require(_0x2967('0x0'));var moment=require(_0x2967('0x1'));var path=require('path');var config=require(_0x2967('0x2'));module[_0x2967('0x3')]={'format':{'type':Sequelize[_0x2967('0x4')],'get':function(){return this[_0x2967('0x5')]('value')?path[_0x2967('0x6')](this[_0x2967('0x5')](_0x2967('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2967('0x8')],'set':function(_0x355e82){var _0x1aa9a5=_0x355e82[_0x2967('0x9')](/\\/g,'/');this[_0x2967('0xa')](_0x2967('0x7'),_0x1aa9a5);}},'rating':{'type':Sequelize[_0x2967('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2967('0xb')],'set':function(_0x4aec0f){this[_0x2967('0xa')](_0x2967('0xc'),moment()[_0x2967('0xd')](_0x4aec0f,'ms'));this[_0x2967('0xa')](_0x2967('0xe'),moment());this[_0x2967('0xa')]('duration',_0x4aec0f);}},'startedAt':{'type':Sequelize[_0x2967('0xf')],'get':function(){return moment(this['getDataValue'](_0x2967('0xc')))['format'](_0x2967('0x10'))[_0x2967('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2967('0x5')]('closedAt'))[_0x2967('0x12')](_0x2967('0x10'))[_0x2967('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2967('0x13')))[_0x2967('0x12')](_0x2967('0x10'))['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2967('0x5')](_0x2967('0x14')))[_0x2967('0x12')](_0x2967('0x10'))[_0x2967('0x11')]();}}}; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index db2b11b..7a744d7 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 _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x288788,_0x13b561){_0x288788=_0x288788-0x0;var _0x71cb99=_0xd0bb[_0x288788];return _0x71cb99;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e50ea9a..cbee65c 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 _0x1877=['request-promise','path','../../config/environment','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x39b417,_0x15111e){var _0x4173e9=function(_0x2e948e){while(--_0x2e948e){_0x39b417['push'](_0x39b417['shift']());}};_0x4173e9(++_0x15111e);}(_0x1877,0x174));var _0x7187=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0x1877[_0x12cbd8];return _0x2fb1ab;};'use strict';var _=require(_0x7187('0x0'));var util=require('util');var logger=require(_0x7187('0x1'))(_0x7187('0x2'));var moment=require(_0x7187('0x3'));var BPromise=require(_0x7187('0x4'));var rp=require(_0x7187('0x5'));var fs=require('fs');var path=require(_0x7187('0x6'));var rimraf=require('rimraf');var config=require(_0x7187('0x7'));var attributes=require(_0x7187('0x8'));module['exports']=function(_0x48dd1f,_0x431903){return _0x48dd1f[_0x7187('0x9')](_0x7187('0xa'),attributes,{'tableName':_0x7187('0xb'),'paranoid':![],'indexes':[{'name':_0x7187('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7bf8d6a..f0946ab 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 _0x7dd6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x10a5b2,_0x5c336e){var _0x49f460=function(_0x9a8dd2){while(--_0x9a8dd2){_0x10a5b2['push'](_0x10a5b2['shift']());}};_0x49f460(++_0x5c336e);}(_0x7dd6,0x1b7));var _0x67dd=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x7dd6[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x67dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x67dd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x67dd('0x2'));var db=require(_0x67dd('0x3'))['db'];var utils=require(_0x67dd('0x4'));var logger=require(_0x67dd('0x5'))(_0x67dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x67dd('0x7'));var client=jayson['client'][_0x67dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x441a48,_0x452fa3,_0x55836f){return new BPromise(function(_0x13f35a,_0x2c24a7){return client[_0x67dd('0x9')](_0x441a48,_0x55836f)[_0x67dd('0xa')](function(_0x399846){logger['info'](_0x67dd('0xb'),_0x452fa3,'request\x20sent');logger[_0x67dd('0xc')](_0x67dd('0xd'),_0x452fa3,_0x67dd('0xe'),JSON['stringify'](_0x399846));if(_0x399846[_0x67dd('0xf')]){if(_0x399846[_0x67dd('0xf')][_0x67dd('0x10')]===0x1f4){logger['error'](_0x67dd('0xb'),_0x452fa3,_0x399846['error'][_0x67dd('0x11')]);return _0x2c24a7(_0x399846['error'][_0x67dd('0x11')]);}logger['error'](_0x67dd('0xb'),_0x452fa3,_0x399846['error'][_0x67dd('0x11')]);return _0x13f35a(_0x399846[_0x67dd('0xf')][_0x67dd('0x11')]);}else{logger[_0x67dd('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x452fa3,'request\x20sent');_0x13f35a(_0x399846[_0x67dd('0x13')][_0x67dd('0x11')]);}})[_0x67dd('0x14')](function(_0x351783){logger[_0x67dd('0xf')](_0x67dd('0xb'),_0x452fa3,_0x351783);_0x2c24a7(_0x351783);});});} \ No newline at end of file +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 diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 1315fd3..4d96417 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 _0x41a9=['getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','getPreferred','/:id/favicon','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','join','root','format','logologin','file','addLogoLogin','diskStorage','/:id/preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now'];(function(_0x34ff12,_0x10c1aa){var _0x8b8d8e=function(_0x4a21b5){while(--_0x4a21b5){_0x34ff12['push'](_0x34ff12['shift']());}};_0x8b8d8e(++_0x10c1aa);}(_0x41a9,0x176));var _0x941a=function(_0x6d97a1,_0x2092b3){_0x6d97a1=_0x6d97a1-0x0;var _0x56aefa=_0x41a9[_0x6d97a1];return _0x56aefa;};'use strict';var multer=require(_0x941a('0x0'));var util=require(_0x941a('0x1'));var path=require(_0x941a('0x2'));var timeout=require(_0x941a('0x3'));var express=require(_0x941a('0x4'));var router=express['Router']();var fs_extra=require(_0x941a('0x5'));var auth=require(_0x941a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x941a('0x7'));var controller=require(_0x941a('0x8'));router[_0x941a('0x9')]('/',auth[_0x941a('0xa')](),controller[_0x941a('0xb')]);router[_0x941a('0x9')](_0x941a('0xc'),controller[_0x941a('0xd')]);router['get'](_0x941a('0xe'),controller[_0x941a('0xf')]);router[_0x941a('0x9')](_0x941a('0x10'),controller[_0x941a('0x11')]);router[_0x941a('0x9')](_0x941a('0x12'),controller['getLogoLogin']);router[_0x941a('0x9')](_0x941a('0x13'),controller['gdpr']);router['get']('/:id/preferred',controller[_0x941a('0x14')]);router['get'](_0x941a('0x15'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a173c,_0xb46f3c,_0x216ac0){_0x216ac0(null,path['join'](config['root'],_0x941a('0x16')));},'filename':function(_0x136547,_0x59b76e,_0x5a3911){_0x5a3911(null,util['format'](_0x941a('0x17'),_0x941a('0x18'),path[_0x941a('0x19')](_0x59b76e[_0x941a('0x1a')])));}})});router[_0x941a('0x1b')](_0x941a('0x10'),upload[_0x941a('0x1c')]('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37753f,_0x15149c,_0x51047e){_0x51047e(null,path[_0x941a('0x1d')](config[_0x941a('0x1e')],_0x941a('0x16')));},'filename':function(_0x790232,_0x1c4943,_0x43943c){_0x43943c(null,util[_0x941a('0x1f')](_0x941a('0x17'),_0x941a('0x20'),path[_0x941a('0x19')](_0x1c4943[_0x941a('0x1a')])));}})});router[_0x941a('0x1b')](_0x941a('0x12'),upload['single'](_0x941a('0x21')),controller[_0x941a('0x22')]);var upload=multer({'storage':multer[_0x941a('0x23')]({'destination':function(_0xc5fd75,_0x2b2b9e,_0x2ff1bf){_0x2ff1bf(null,path['join'](config[_0x941a('0x1e')],_0x941a('0x16')));},'filename':function(_0x537da4,_0x3539e9,_0x25d164){_0x25d164(null,util['format'](_0x941a('0x17'),'preferred',path[_0x941a('0x19')](_0x3539e9[_0x941a('0x1a')])));}})});router['post'](_0x941a('0x24'),upload[_0x941a('0x1c')](_0x941a('0x21')),controller[_0x941a('0x25')]);var upload=multer({'storage':multer[_0x941a('0x23')]({'destination':function(_0x562b36,_0x13090c,_0x555b72){_0x555b72(null,path[_0x941a('0x1d')](config[_0x941a('0x1e')],'server/files/images/logos/'));},'filename':function(_0xfa0d2,_0x2bf654,_0x5bb998){_0x5bb998(null,util[_0x941a('0x1f')](_0x941a('0x17'),_0x941a('0x26'),path[_0x941a('0x19')](_0x2bf654[_0x941a('0x1a')])));}})});router[_0x941a('0x1b')](_0x941a('0x15'),upload['single'](_0x941a('0x21')),controller[_0x941a('0x27')]);router[_0x941a('0x28')]('/:id',auth[_0x941a('0xa')](),controller[_0x941a('0x29')]);module[_0x941a('0x2a')]=router; \ No newline at end of file +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 diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index b0e9949..ed3623c 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(_0x31360c,_0x3ebd1b){var _0x3b46f3=function(_0x3c2285){while(--_0x3c2285){_0x31360c['push'](_0x31360c['shift']());}};_0x3b46f3(++_0x3ebd1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_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 diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b099a24..7185257 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 _0x8c7f=['VIRTUAL','filter','options','Setting','includeAll','include','findAll','rows','show','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','toLower','join','default_logo.svg','default','upperFirst','custom','existsSync','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','Sequelize','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x8c7f,0xb2));var _0xf8c7=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x8c7f[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0xf8c7('0x0'));var rimraf=require(_0xf8c7('0x1'));var zipdir=require(_0xf8c7('0x2'));var jsonpatch=require(_0xf8c7('0x3'));var rp=require('request-promise');var moment=require(_0xf8c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8c7('0x5'));var util=require('util');var path=require(_0xf8c7('0x6'));var sox=require(_0xf8c7('0x7'));var csv=require('to-csv');var ejs=require(_0xf8c7('0x8'));var fs=require('fs');var fs_extra=require(_0xf8c7('0x9'));var _=require(_0xf8c7('0xa'));var squel=require(_0xf8c7('0xb'));var crypto=require('crypto');var jsforce=require(_0xf8c7('0xc'));var deskjs=require(_0xf8c7('0xd'));var toCsv=require(_0xf8c7('0xe'));var querystring=require('querystring');var Papa=require(_0xf8c7('0xf'));var Redis=require(_0xf8c7('0x10'));var authService=require(_0xf8c7('0x11'));var qs=require(_0xf8c7('0x12'));var as=require(_0xf8c7('0x13'));var hardwareService=require(_0xf8c7('0x14'));var logger=require(_0xf8c7('0x15'))(_0xf8c7('0x16'));var utils=require(_0xf8c7('0x17'));var config=require(_0xf8c7('0x18'));var licenseUtil=require(_0xf8c7('0x19'));var db=require(_0xf8c7('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf8c7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x574113,_0x542552,_0x3eba7c,_0x3e8047){return new BPromise(function(_0x2115a2,_0x3e855f){var _0x3082d0=_0x3e8047||client;return _0x3082d0[_0xf8c7('0x1c')](_0x574113,_0x3eba7c)[_0xf8c7('0x1d')](function(_0x343156){logger[_0xf8c7('0x1e')](_0xf8c7('0x1f'),_0x542552,_0xf8c7('0x20'));logger[_0xf8c7('0x21')](_0xf8c7('0x22'),_0x542552,_0xf8c7('0x20'),JSON['stringify'](_0x343156));if(_0x343156[_0xf8c7('0x23')]){if(_0x343156[_0xf8c7('0x23')][_0xf8c7('0x24')]===0x1f4){logger[_0xf8c7('0x23')](_0xf8c7('0x1f'),_0x542552,_0x343156[_0xf8c7('0x23')]['message']);return _0x3e855f(_0x343156[_0xf8c7('0x23')]['message']);}logger[_0xf8c7('0x23')](_0xf8c7('0x1f'),_0x542552,_0x343156[_0xf8c7('0x23')][_0xf8c7('0x25')]);return _0x2115a2(_0x343156[_0xf8c7('0x23')][_0xf8c7('0x25')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x542552,_0xf8c7('0x20'));_0x2115a2(_0x343156[_0xf8c7('0x26')][_0xf8c7('0x25')]);}})[_0xf8c7('0x27')](function(_0x52e83b){logger[_0xf8c7('0x23')]('Setting,\x20%s,\x20%s',_0x542552,_0x52e83b);_0x3e855f(_0x52e83b);});});}function respondWithStatusCode(_0x2f4981,_0x1be3e9){_0x1be3e9=_0x1be3e9||0xcc;return function(_0x1e8729){if(_0x1e8729){return _0x2f4981['sendStatus'](_0x1be3e9);}return _0x2f4981['status'](_0x1be3e9)[_0xf8c7('0x28')]();};}function respondWithResult(_0x2070ba,_0x45216e){_0x45216e=_0x45216e||0xc8;return function(_0x4bef53){if(_0x4bef53){return _0x2070ba[_0xf8c7('0x29')](_0x45216e)[_0xf8c7('0x2a')](_0x4bef53);}};}function respondWithFilteredResult(_0x5310fb,_0x39a4cd){return function(_0x5240cd){if(_0x5240cd){var _0x5a6a16=typeof _0x39a4cd[_0xf8c7('0x2b')]===_0xf8c7('0x2c')&&typeof _0x39a4cd[_0xf8c7('0x2d')]===_0xf8c7('0x2c');var _0x542f65=_0x5240cd['count'];var _0x31d9c7=_0x5a6a16?0x0:_0x39a4cd[_0xf8c7('0x2b')];var _0x591041=_0x5a6a16?_0x5240cd[_0xf8c7('0x2e')]:_0x39a4cd[_0xf8c7('0x2b')]+_0x39a4cd[_0xf8c7('0x2d')];var _0x55057f;if(_0x591041>=_0x542f65){_0x591041=_0x542f65;_0x55057f=0xc8;}else{_0x55057f=0xce;}_0x5310fb[_0xf8c7('0x29')](_0x55057f);return _0x5310fb[_0xf8c7('0x2f')](_0xf8c7('0x30'),_0x31d9c7+'-'+_0x591041+'/'+_0x542f65)[_0xf8c7('0x2a')](_0x5240cd);}return null;};}function patchUpdates(_0x451bd6){return function(_0x4dfae3){try{jsonpatch[_0xf8c7('0x31')](_0x4dfae3,_0x451bd6,!![]);}catch(_0x23fb8e){return BPromise[_0xf8c7('0x32')](_0x23fb8e);}return _0x4dfae3['save']();};}function saveUpdates(_0x452e91,_0x2bec6e){return function(_0x2cfa8a){if(_0x2cfa8a){return _0x2cfa8a[_0xf8c7('0x33')](_0x452e91)[_0xf8c7('0x1d')](function(_0x300716){return _0x300716;});}return null;};}function removeEntity(_0x2b0bcc,_0x5e371e){return function(_0x2b9698){if(_0x2b9698){return _0x2b9698[_0xf8c7('0x34')]()['then'](function(){_0x2b0bcc[_0xf8c7('0x29')](0xcc)[_0xf8c7('0x28')]();});}};}function handleEntityNotFound(_0x472c53,_0x2b97dc){return function(_0x4589fa){if(!_0x4589fa){_0x472c53['sendStatus'](0x194);}return _0x4589fa;};}function handleError(_0x1f2fed,_0x18856d){_0x18856d=_0x18856d||0x1f4;return function(_0x522ce2){logger[_0xf8c7('0x23')](_0x522ce2[_0xf8c7('0x35')]);if(_0x522ce2['name']){delete _0x522ce2[_0xf8c7('0x36')];}_0x1f2fed[_0xf8c7('0x29')](_0x18856d)['send'](_0x522ce2);};}exports[_0xf8c7('0x37')]=function(_0x3ae6e8,_0x2bfc6f){var _0x77248f={},_0x5d7f60={},_0x526c10={'count':0x0,'rows':[]};var _0x401613=_['map'](db['Setting'][_0xf8c7('0x38')],function(_0x1fcb27){return{'name':_0x1fcb27[_0xf8c7('0x39')],'type':_0x1fcb27[_0xf8c7('0x3a')]['key']};});_0x5d7f60[_0xf8c7('0x3b')]=_[_0xf8c7('0x3c')](_0x401613,_0xf8c7('0x36'));_0x5d7f60[_0xf8c7('0x3d')]=_[_0xf8c7('0x3e')](_0x3ae6e8[_0xf8c7('0x3d')]);_0x5d7f60['filters']=_[_0xf8c7('0x3f')](_0x5d7f60['model'],_0x5d7f60[_0xf8c7('0x3d')]);_0x77248f[_0xf8c7('0x40')]=_[_0xf8c7('0x3f')](_0x5d7f60[_0xf8c7('0x3b')],qs[_0xf8c7('0x41')](_0x3ae6e8['query'][_0xf8c7('0x41')]));_0x77248f[_0xf8c7('0x40')]=_0x77248f[_0xf8c7('0x40')][_0xf8c7('0x42')]?_0x77248f[_0xf8c7('0x40')]:_0x5d7f60[_0xf8c7('0x3b')];if(!_0x3ae6e8[_0xf8c7('0x3d')][_0xf8c7('0x43')](_0xf8c7('0x44'))){_0x77248f[_0xf8c7('0x2d')]=qs[_0xf8c7('0x2d')](_0x3ae6e8[_0xf8c7('0x3d')]['limit']);_0x77248f[_0xf8c7('0x2b')]=qs[_0xf8c7('0x2b')](_0x3ae6e8[_0xf8c7('0x3d')]['offset']);}_0x77248f['order']=qs[_0xf8c7('0x45')](_0x3ae6e8['query'][_0xf8c7('0x45')]);_0x77248f['where']=qs[_0xf8c7('0x46')](_[_0xf8c7('0x47')](_0x3ae6e8[_0xf8c7('0x3d')],_0x5d7f60[_0xf8c7('0x46')]),_0x401613);if(_0x3ae6e8['query']['filter']){_0x77248f['where']=_[_0xf8c7('0x48')](_0x77248f[_0xf8c7('0x49')],{'$or':_[_0xf8c7('0x3c')](_0x401613,function(_0x564fd7){if(_0x564fd7[_0xf8c7('0x3a')]!==_0xf8c7('0x4a')){var _0x1de1e4={};_0x1de1e4[_0x564fd7['name']]={'$like':'%'+_0x3ae6e8[_0xf8c7('0x3d')][_0xf8c7('0x4b')]+'%'};return _0x1de1e4;}})});}_0x77248f=_[_0xf8c7('0x48')]({},_0x77248f,_0x3ae6e8[_0xf8c7('0x4c')]);var _0xeffd49={'where':_0x77248f[_0xf8c7('0x49')]};return db[_0xf8c7('0x4d')][_0xf8c7('0x2e')](_0xeffd49)[_0xf8c7('0x1d')](function(_0x2350c9){_0x526c10[_0xf8c7('0x2e')]=_0x2350c9;if(_0x3ae6e8[_0xf8c7('0x3d')][_0xf8c7('0x4e')]){_0x77248f[_0xf8c7('0x4f')]=[{'all':!![]}];}return db['Setting'][_0xf8c7('0x50')](_0x77248f);})['then'](function(_0x227813){_0x526c10[_0xf8c7('0x51')]=_0x227813;return _0x526c10;})[_0xf8c7('0x1d')](respondWithFilteredResult(_0x2bfc6f,_0x77248f))[_0xf8c7('0x27')](handleError(_0x2bfc6f,null));};exports[_0xf8c7('0x52')]=function(_0x24bbeb,_0x595034){var _0x5871e6={'raw':![],'where':{'id':_0x24bbeb['params']['id']}},_0x191e75={};_0x191e75[_0xf8c7('0x3b')]=_['keys'](db[_0xf8c7('0x4d')]['rawAttributes']);_0x191e75[_0xf8c7('0x3d')]=_[_0xf8c7('0x3e')](_0x24bbeb[_0xf8c7('0x3d')]);_0x191e75['filters']=_[_0xf8c7('0x3f')](_0x191e75[_0xf8c7('0x3b')],_0x191e75[_0xf8c7('0x3d')]);_0x5871e6[_0xf8c7('0x40')]=_[_0xf8c7('0x3f')](_0x191e75[_0xf8c7('0x3b')],qs[_0xf8c7('0x41')](_0x24bbeb[_0xf8c7('0x3d')]['fields']));_0x5871e6['attributes']=_0x5871e6[_0xf8c7('0x40')][_0xf8c7('0x42')]?_0x5871e6[_0xf8c7('0x40')]:_0x191e75[_0xf8c7('0x3b')];if(_0x24bbeb['query'][_0xf8c7('0x4e')]){_0x5871e6['include']=[{'all':!![]}];}_0x5871e6=_[_0xf8c7('0x48')]({},_0x5871e6,_0x24bbeb['options']);return db[_0xf8c7('0x4d')][_0xf8c7('0x53')](_0x5871e6)[_0xf8c7('0x1d')](handleEntityNotFound(_0x595034,null))[_0xf8c7('0x1d')](respondWithResult(_0x595034,null))[_0xf8c7('0x27')](handleError(_0x595034,null));};exports['update']=function(_0x2e8d42,_0x3d6f43){if(_0x2e8d42[_0xf8c7('0x54')]['id']){delete _0x2e8d42['body']['id'];}return db['Setting']['find']({'where':{'id':_0x2e8d42[_0xf8c7('0x55')]['id']}})[_0xf8c7('0x1d')](handleEntityNotFound(_0x3d6f43,null))[_0xf8c7('0x1d')](saveUpdates(_0x2e8d42[_0xf8c7('0x54')],null))[_0xf8c7('0x1d')](respondWithResult(_0x3d6f43,null))[_0xf8c7('0x27')](handleError(_0x3d6f43,null));};exports[_0xf8c7('0x56')]=function(_0x36cbaf,_0x4ccfe2,_0x365fe9){if(_0x36cbaf[_0xf8c7('0x57')]&&_0x36cbaf['file'][_0xf8c7('0x58')]){_0x36cbaf[_0xf8c7('0x54')][_0xf8c7('0x59')]=_0x36cbaf['file'][_0xf8c7('0x58')];}return db[_0xf8c7('0x4d')][_0xf8c7('0x53')]({'where':{'id':_0x36cbaf[_0xf8c7('0x55')]['id']}})[_0xf8c7('0x1d')](handleEntityNotFound(_0x4ccfe2,null))[_0xf8c7('0x1d')](saveUpdates(_0x36cbaf[_0xf8c7('0x54')],null))['then'](respondWithResult(_0x4ccfe2,null))[_0xf8c7('0x27')](handleError(_0x4ccfe2,null));};exports[_0xf8c7('0x5a')]=function(_0x5e5606,_0x465ad0,_0x16fdcb){if(_0x5e5606['file']&&_0x5e5606[_0xf8c7('0x57')][_0xf8c7('0x58')]){_0x5e5606[_0xf8c7('0x54')][_0xf8c7('0x5b')]=_0x5e5606[_0xf8c7('0x57')]['filename'];}return db['Setting']['find']({'where':{'id':_0x5e5606[_0xf8c7('0x55')]['id']}})[_0xf8c7('0x1d')](handleEntityNotFound(_0x465ad0,null))[_0xf8c7('0x1d')](saveUpdates(_0x5e5606[_0xf8c7('0x54')],null))['then'](respondWithResult(_0x465ad0,null))[_0xf8c7('0x27')](handleError(_0x465ad0,null));};var utilLicense=require(_0xf8c7('0x19'));exports['getLogo']=function(_0x13fa2d,_0x314b19,_0x187ef8){var _0x6f995f=_0xf8c7('0x5c');var _0x926406={'custom':![]};return utilLicense[_0xf8c7('0x5d')]()['then'](function(_0x1695f9){if(_0x1695f9){_0x926406=_0x1695f9;}return db[_0xf8c7('0x4d')]['find']({'where':{'id':_0x13fa2d['params']['id']},'attributes':[_0xf8c7('0x59'),'loginLogo',_0xf8c7('0x5e'),_0xf8c7('0x5f'),_0xf8c7('0x60'),_0xf8c7('0x61'),_0xf8c7('0x62'),_0xf8c7('0x63')],'raw':!![]});})[_0xf8c7('0x1d')](handleEntityNotFound(_0x314b19,null))[_0xf8c7('0x1d')](function(_0x524d25){if(_0x524d25){var _0x52bdb4=_0x524d25['logo']&&fs['existsSync'](path['join'](config[_0xf8c7('0x64')],_0x6f995f,_[_0xf8c7('0x65')](_0x524d25['logo'])))?path[_0xf8c7('0x66')](config[_0xf8c7('0x64')],_0x6f995f,_['toLower'](_0x524d25[_0xf8c7('0x59')])):path['join'](config[_0xf8c7('0x64')],_0x6f995f,_[_0xf8c7('0x65')](_0xf8c7('0x67')));var _0x5547bc=_0xf8c7('0x68')+_[_0xf8c7('0x69')](_0xf8c7('0x59'));if(_0x524d25[_0x5547bc]||!_0x926406[_0xf8c7('0x6a')]){_0x52bdb4=path['join'](config[_0xf8c7('0x64')],_0x6f995f,_['toLower']('default_logo.svg'));}if(!fs[_0xf8c7('0x6b')](_0x52bdb4)){throw new db['Sequelize'][(_0xf8c7('0x6c'))](_[_0xf8c7('0x69')]('logo')+_0xf8c7('0x6d'));}return _0x314b19[_0xf8c7('0x6e')](_0x52bdb4);}})[_0xf8c7('0x27')](handleError(_0x314b19,null));};var utilLicense=require(_0xf8c7('0x19'));exports[_0xf8c7('0x6f')]=function(_0x2f97b3,_0x415502,_0x290563){var _0x594650=_0xf8c7('0x5c');var _0x5e6567={'custom':![]};return utilLicense[_0xf8c7('0x5d')]()['then'](function(_0x4fb7e1){if(_0x4fb7e1){_0x5e6567=_0x4fb7e1;}return db[_0xf8c7('0x4d')][_0xf8c7('0x53')]({'where':{'id':_0x2f97b3[_0xf8c7('0x55')]['id']},'attributes':[_0xf8c7('0x59'),_0xf8c7('0x5b'),'preferred','favicon',_0xf8c7('0x60'),_0xf8c7('0x61'),_0xf8c7('0x62'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x415502,null))[_0xf8c7('0x1d')](function(_0x1c916c){if(_0x1c916c){var _0x101914=_0x1c916c[_0xf8c7('0x5b')]&&fs[_0xf8c7('0x6b')](path[_0xf8c7('0x66')](config[_0xf8c7('0x64')],_0x594650,_[_0xf8c7('0x65')](_0x1c916c['loginLogo'])))?path['join'](config[_0xf8c7('0x64')],_0x594650,_[_0xf8c7('0x65')](_0x1c916c[_0xf8c7('0x5b')])):path['join'](config['root'],_0x594650,_[_0xf8c7('0x65')](_0xf8c7('0x70')));var _0x183c13='default'+_['upperFirst'](_0xf8c7('0x5b'));if(_0x1c916c[_0x183c13]||!_0x5e6567['custom']){_0x101914=path['join'](config[_0xf8c7('0x64')],_0x594650,_[_0xf8c7('0x65')](_0xf8c7('0x70')));}if(!fs['existsSync'](_0x101914)){throw new db[(_0xf8c7('0x71'))][(_0xf8c7('0x6c'))](_[_0xf8c7('0x69')](_0xf8c7('0x5b'))+'\x20not\x20found');}return _0x415502[_0xf8c7('0x6e')](_0x101914);}})[_0xf8c7('0x27')](handleError(_0x415502,null));};exports[_0xf8c7('0x72')]=function(_0x2003b5,_0x5ae82c){return db[_0xf8c7('0x4d')][_0xf8c7('0x53')]({'where':{'id':_0x2003b5[_0xf8c7('0x55')]['id']},'attributes':[_0xf8c7('0x73')]})['then'](respondWithResult(_0x5ae82c,null))[_0xf8c7('0x27')](handleError(_0x5ae82c,null));};exports['addPreferred']=function(_0x2de690,_0x43e1dc,_0x19dcf8){if(_0x2de690['file']&&_0x2de690[_0xf8c7('0x57')][_0xf8c7('0x58')]){_0x2de690[_0xf8c7('0x54')][_0xf8c7('0x5e')]=_0x2de690[_0xf8c7('0x57')]['filename'];}return db[_0xf8c7('0x4d')][_0xf8c7('0x53')]({'where':{'id':_0x2de690['params']['id']}})[_0xf8c7('0x1d')](handleEntityNotFound(_0x43e1dc,null))[_0xf8c7('0x1d')](saveUpdates(_0x2de690[_0xf8c7('0x54')],null))[_0xf8c7('0x1d')](respondWithResult(_0x43e1dc,null))['catch'](handleError(_0x43e1dc,null));};var utilLicense=require(_0xf8c7('0x19'));exports[_0xf8c7('0x74')]=function(_0x1ce9dd,_0xc7f1ac,_0xd577bb){var _0x102780=_0xf8c7('0x5c');var _0x1b2100={'custom':![]};return utilLicense[_0xf8c7('0x5d')]()[_0xf8c7('0x1d')](function(_0x216fd7){if(_0x216fd7){_0x1b2100=_0x216fd7;}return db['Setting']['find']({'where':{'id':_0x1ce9dd['params']['id']},'attributes':[_0xf8c7('0x59'),_0xf8c7('0x5b'),_0xf8c7('0x5e'),_0xf8c7('0x5f'),_0xf8c7('0x60'),_0xf8c7('0x61'),'defaultPreferred',_0xf8c7('0x63')],'raw':!![]});})[_0xf8c7('0x1d')](handleEntityNotFound(_0xc7f1ac,null))['then'](function(_0xfb0638){if(_0xfb0638){var _0x457117=_0xfb0638[_0xf8c7('0x5e')]&&fs[_0xf8c7('0x6b')](path[_0xf8c7('0x66')](config[_0xf8c7('0x64')],_0x102780,_[_0xf8c7('0x65')](_0xfb0638[_0xf8c7('0x5e')])))?path['join'](config[_0xf8c7('0x64')],_0x102780,_['toLower'](_0xfb0638[_0xf8c7('0x5e')])):path[_0xf8c7('0x66')](config[_0xf8c7('0x64')],_0x102780,_[_0xf8c7('0x65')](_0xf8c7('0x75')));var _0x152f69='default'+_[_0xf8c7('0x69')]('preferred');if(_0xfb0638[_0x152f69]||!_0x1b2100[_0xf8c7('0x6a')]||!_0x1b2100[_0xf8c7('0x5e')]){_0x457117=path[_0xf8c7('0x66')](config[_0xf8c7('0x64')],_0x102780,_['toLower'](_0xf8c7('0x75')));}if(!fs[_0xf8c7('0x6b')](_0x457117)){throw new db[(_0xf8c7('0x71'))][(_0xf8c7('0x6c'))](_['upperFirst'](_0xf8c7('0x5e'))+_0xf8c7('0x6d'));}return _0xc7f1ac['download'](_0x457117);}})[_0xf8c7('0x27')](handleError(_0xc7f1ac,null));};exports[_0xf8c7('0x76')]=function(_0x462f31,_0x505719,_0xf8181b){if(_0x462f31['file']&&_0x462f31[_0xf8c7('0x57')]['filename']){_0x462f31[_0xf8c7('0x54')][_0xf8c7('0x5f')]=_0x462f31[_0xf8c7('0x57')][_0xf8c7('0x58')];}return db[_0xf8c7('0x4d')][_0xf8c7('0x53')]({'where':{'id':_0x462f31[_0xf8c7('0x55')]['id']}})[_0xf8c7('0x1d')](handleEntityNotFound(_0x505719,null))['then'](saveUpdates(_0x462f31[_0xf8c7('0x54')],null))[_0xf8c7('0x1d')](respondWithResult(_0x505719,null))[_0xf8c7('0x27')](handleError(_0x505719,null));};var utilLicense=require('../../config/license/util');exports[_0xf8c7('0x77')]=function(_0x1c8f32,_0x240ec6,_0x218334){var _0x30f351=_0xf8c7('0x5c');var _0x318de6={'custom':![]};return utilLicense['getLicense']()[_0xf8c7('0x1d')](function(_0x29c1a1){if(_0x29c1a1){_0x318de6=_0x29c1a1;}return db[_0xf8c7('0x4d')][_0xf8c7('0x53')]({'where':{'id':_0x1c8f32[_0xf8c7('0x55')]['id']},'attributes':[_0xf8c7('0x59'),'loginLogo',_0xf8c7('0x5e'),_0xf8c7('0x5f'),_0xf8c7('0x60'),_0xf8c7('0x61'),_0xf8c7('0x62'),_0xf8c7('0x63')],'raw':!![]});})[_0xf8c7('0x1d')](handleEntityNotFound(_0x240ec6,null))['then'](function(_0x56c29d){if(_0x56c29d){var _0x20751d=_0x56c29d[_0xf8c7('0x5f')]&&fs[_0xf8c7('0x6b')](path['join'](config['root'],_0x30f351,_[_0xf8c7('0x65')](_0x56c29d[_0xf8c7('0x5f')])))?path[_0xf8c7('0x66')](config['root'],_0x30f351,_[_0xf8c7('0x65')](_0x56c29d['favicon'])):path['join'](config['root'],_0x30f351,_['toLower'](_0xf8c7('0x78')));var _0x16e70d=_0xf8c7('0x68')+_['upperFirst']('favicon');if(_0x56c29d[_0x16e70d]||!_0x318de6[_0xf8c7('0x6a')]){_0x20751d=path[_0xf8c7('0x66')](config[_0xf8c7('0x64')],_0x30f351,_[_0xf8c7('0x65')]('default_favicon.ico'));}if(!fs[_0xf8c7('0x6b')](_0x20751d)){throw new db['Sequelize'][(_0xf8c7('0x6c'))](_[_0xf8c7('0x69')](_0xf8c7('0x5f'))+_0xf8c7('0x6d'));}return _0x240ec6[_0xf8c7('0x6e')](_0x20751d);}})[_0xf8c7('0x27')](handleError(_0x240ec6,null));};exports[_0xf8c7('0x79')]=function(_0x503e17,_0x23d9e4){var _0x4d64b9={'offset':moment()[_0xf8c7('0x7a')]()};_0x4d64b9[_0xf8c7('0x7b')]=moment()['utcOffset'](_0x4d64b9[_0xf8c7('0x2b')])[_0xf8c7('0x7c')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x23d9e4[_0xf8c7('0x29')](0xc8)[_0xf8c7('0x7d')](_0x4d64b9);}; \ No newline at end of file +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 diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index bd21710..a969c10 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x008c,0x188));var _0xc008=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x008c[_0x954b3a];return _0x3a313e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 98fb761..289068f 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 _0x79d8=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x553e6e,_0x4cbbe5){var _0x59f86b=function(_0x19eaeb){while(--_0x19eaeb){_0x553e6e['push'](_0x553e6e['shift']());}};_0x59f86b(++_0x4cbbe5);}(_0x79d8,0x181));var _0x879d=function(_0x134539,_0x412692){_0x134539=_0x134539-0x0;var _0x23cdc7=_0x79d8[_0x134539];return _0x23cdc7;};'use strict';var _=require(_0x879d('0x0'));var util=require(_0x879d('0x1'));var moment=require(_0x879d('0x2'));var BPromise=require(_0x879d('0x3'));var rs=require(_0x879d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x879d('0x5'))['db'];var utils=require(_0x879d('0x6'));var logger=require('../../config/logger')(_0x879d('0x7'));var config=require('../../config/environment');var jayson=require(_0x879d('0x8'));var client=jayson[_0x879d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a2029,_0x51f014,_0x3c2021){return new BPromise(function(_0x53bdcd,_0x437daf){return client[_0x879d('0xa')](_0x2a2029,_0x3c2021)['then'](function(_0x43c038){logger[_0x879d('0xb')](_0x879d('0xc'),_0x51f014,_0x879d('0xd'));logger[_0x879d('0xe')](_0x879d('0xf'),_0x51f014,_0x879d('0xd'),JSON[_0x879d('0x10')](_0x43c038));if(_0x43c038['error']){if(_0x43c038[_0x879d('0x11')][_0x879d('0x12')]===0x1f4){logger[_0x879d('0x11')](_0x879d('0xc'),_0x51f014,_0x43c038[_0x879d('0x11')][_0x879d('0x13')]);return _0x437daf(_0x43c038['error']['message']);}logger[_0x879d('0x11')]('Setting,\x20%s,\x20%s',_0x51f014,_0x43c038['error'][_0x879d('0x13')]);return _0x53bdcd(_0x43c038[_0x879d('0x11')][_0x879d('0x13')]);}else{logger[_0x879d('0xb')](_0x879d('0xc'),_0x51f014,_0x879d('0xd'));_0x53bdcd(_0x43c038['result']['message']);}})['catch'](function(_0x21ee6e){logger[_0x879d('0x11')]('Setting,\x20%s,\x20%s',_0x51f014,_0x21ee6e);_0x437daf(_0x21ee6e);});});}exports[_0x879d('0x14')]=function(_0x29ee9d){var _0x41b594=this;return new Promise(function(_0x3b5ce1,_0x51eff1){return db[_0x879d('0x15')]['find']({'raw':_0x29ee9d[_0x879d('0x16')]?_0x29ee9d[_0x879d('0x16')][_0x879d('0x17')]===undefined?!![]:![]:!![],'where':_0x29ee9d[_0x879d('0x16')]?_0x29ee9d[_0x879d('0x16')][_0x879d('0x18')]||null:null,'attributes':_0x29ee9d[_0x879d('0x16')]?_0x29ee9d[_0x879d('0x16')][_0x879d('0x19')]||null:null,'include':_0x29ee9d[_0x879d('0x16')]?_0x29ee9d[_0x879d('0x16')][_0x879d('0x1a')]?_[_0x879d('0x1b')](_0x29ee9d[_0x879d('0x16')][_0x879d('0x1a')],function(_0x2474cb){return{'model':db[_0x2474cb[_0x879d('0x1c')]],'as':_0x2474cb['as'],'attributes':_0x2474cb[_0x879d('0x19')],'include':_0x2474cb[_0x879d('0x1a')]?_['map'](_0x2474cb[_0x879d('0x1a')],function(_0x433592){return{'model':db[_0x433592[_0x879d('0x1c')]],'as':_0x433592['as'],'attributes':_0x433592['attributes'],'include':_0x433592[_0x879d('0x1a')]?_['map'](_0x433592[_0x879d('0x1a')],function(_0x5b520f){return{'model':db[_0x5b520f[_0x879d('0x1c')]],'as':_0x5b520f['as'],'attributes':_0x5b520f[_0x879d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6d1264){logger[_0x879d('0xb')](_0x879d('0x14'),_0x29ee9d);logger['debug'](_0x879d('0x14'),_0x29ee9d,JSON[_0x879d('0x10')](_0x6d1264));_0x3b5ce1(_0x6d1264);})[_0x879d('0x1d')](function(_0x3a6cfc){logger[_0x879d('0x11')](_0x879d('0x14'),_0x3a6cfc[_0x879d('0x13')],_0x29ee9d);_0x51eff1(_0x41b594[_0x879d('0x11')](0x1f4,_0x3a6cfc[_0x879d('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 38dc8de..d82657d 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(_0x1d3634,_0x2c1235){var _0x509d2=function(_0x163cf1){while(--_0x163cf1){_0x1d3634['push'](_0x1d3634['shift']());}};_0x509d2(++_0x2c1235);}(_0x7a54,0x106));var _0x47a5=function(_0x50789c,_0x1505e4){_0x50789c=_0x50789c-0x0;var _0x42e301=_0x7a54[_0x50789c];return _0x42e301;};'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(_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 diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e391e4a..c87d7f3 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 _0x08ea=['plivo','bandwidth','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x08ea,0xa2));var _0xa08e=function(_0x2ee547,_0xb743c5){_0x2ee547=_0x2ee547-0x0;var _0x5e789e=_0x08ea[_0x2ee547];return _0x5e789e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xa08e('0x0'));module[_0xa08e('0x1')]={'name':{'type':Sequelize[_0xa08e('0x2')],'unique':_0xa08e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xa08e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa08e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa08e('0x2')],'defaultValue':function(){return rs[_0xa08e('0x4')]();}},'phone':{'type':Sequelize[_0xa08e('0x2')]},'type':{'type':Sequelize[_0xa08e('0x5')](_0xa08e('0x6'),'skebby',_0xa08e('0x7'),_0xa08e('0x8'),_0xa08e('0x9'),'clickatell',_0xa08e('0xa'),'csc',_0xa08e('0xb'),'intelepeer')},'accountSid':{'type':Sequelize[_0xa08e('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa08e('0x2')]},'smsMethod':{'type':Sequelize[_0xa08e('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa08e('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa08e('0x2')]},'applicationId':{'type':Sequelize[_0xa08e('0x2')]},'accountId':{'type':Sequelize[_0xa08e('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xa08e('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa08e('0xd')],'defaultValue':function(){return _0xa08e('0xe');}},'notificationSound':{'type':Sequelize[_0xa08e('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa08e('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa08e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa08e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa08e('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa08e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa08e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa08e('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa08e('0x10'),'set':function(_0x22a890){if(!_0x22a890)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa08e('0x11')](_0xa08e('0x12'),_0x22a890);}}}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9e1fe9b..5a74afa 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 _0x2ea2=['Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','priority','account','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','stack','sendStatus','json','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','message_id','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','redis','register','client','request','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','count','Content-Range','reject','save','update','destroy','get','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','SmsAccount','findAll','rows','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions'];(function(_0x2ccb27,_0x21512f){var _0x200735=function(_0x13a91a){while(--_0x13a91a){_0x2ccb27['push'](_0x2ccb27['shift']());}};_0x200735(++_0x21512f);}(_0x2ea2,0x16d));var _0x22ea=function(_0x5453fd,_0x8f1185){_0x5453fd=_0x5453fd-0x0;var _0x60f153=_0x2ea2[_0x5453fd];return _0x60f153;};'use strict';var emlformat=require(_0x22ea('0x0'));var rimraf=require(_0x22ea('0x1'));var zipdir=require(_0x22ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x22ea('0x3'));var BPromise=require(_0x22ea('0x4'));var Mustache=require(_0x22ea('0x5'));var util=require(_0x22ea('0x6'));var path=require(_0x22ea('0x7'));var sox=require('sox');var csv=require(_0x22ea('0x8'));var ejs=require(_0x22ea('0x9'));var fs=require('fs');var fs_extra=require(_0x22ea('0xa'));var _=require(_0x22ea('0xb'));var squel=require(_0x22ea('0xc'));var crypto=require(_0x22ea('0xd'));var jsforce=require(_0x22ea('0xe'));var deskjs=require(_0x22ea('0xf'));var toCsv=require(_0x22ea('0x8'));var querystring=require(_0x22ea('0x10'));var Papa=require(_0x22ea('0x11'));var Redis=require(_0x22ea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x22ea('0x13'));var as=require(_0x22ea('0x14'));var hardwareService=require(_0x22ea('0x15'));var logger=require(_0x22ea('0x16'))(_0x22ea('0x17'));var utils=require('../../config/utils');var config=require(_0x22ea('0x18'));var licenseUtil=require(_0x22ea('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x22ea('0x1a')](config['redis'],{'host':_0x22ea('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x22ea('0x1c')]));require('./smsAccount.socket')[_0x22ea('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x22ea('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2a3c77,_0x3953a7,_0x398e15,_0x2953ef){return new BPromise(function(_0x48f1d5,_0x42f049){var _0xe0f4e9=_0x2953ef||client;return _0xe0f4e9[_0x22ea('0x1f')](_0x2a3c77,_0x398e15)[_0x22ea('0x20')](function(_0x47dd86){logger[_0x22ea('0x21')]('SmsAccount,\x20%s,\x20%s',_0x3953a7,_0x22ea('0x22'));logger[_0x22ea('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3953a7,_0x22ea('0x22'),JSON['stringify'](_0x47dd86));if(_0x47dd86[_0x22ea('0x24')]){if(_0x47dd86['error'][_0x22ea('0x25')]===0x1f4){logger[_0x22ea('0x24')](_0x22ea('0x26'),_0x3953a7,_0x47dd86[_0x22ea('0x24')][_0x22ea('0x27')]);return _0x42f049(_0x47dd86[_0x22ea('0x24')][_0x22ea('0x27')]);}logger[_0x22ea('0x24')](_0x22ea('0x26'),_0x3953a7,_0x47dd86[_0x22ea('0x24')][_0x22ea('0x27')]);return _0x48f1d5(_0x47dd86[_0x22ea('0x24')][_0x22ea('0x27')]);}else{logger[_0x22ea('0x21')](_0x22ea('0x26'),_0x3953a7,'request\x20sent');_0x48f1d5(_0x47dd86[_0x22ea('0x28')]['message']);}})[_0x22ea('0x29')](function(_0x2eb338){logger['error'](_0x22ea('0x26'),_0x3953a7,_0x2eb338);_0x42f049(_0x2eb338);});});}function respondWithStatusCode(_0x401d94,_0x484517){_0x484517=_0x484517||0xcc;return function(_0x1f63de){if(_0x1f63de){return _0x401d94['sendStatus'](_0x484517);}return _0x401d94[_0x22ea('0x2a')](_0x484517)[_0x22ea('0x2b')]();};}function respondWithResult(_0x122f38,_0x47eaed){_0x47eaed=_0x47eaed||0xc8;return function(_0x490894){if(_0x490894){return _0x122f38[_0x22ea('0x2a')](_0x47eaed)['json'](_0x490894);}};}function respondWithFilteredResult(_0x3b06c3,_0x3286ae){return function(_0x31718b){if(_0x31718b){var _0x7feb19=typeof _0x3286ae[_0x22ea('0x2c')]===_0x22ea('0x2d')&&typeof _0x3286ae['limit']==='undefined';var _0x2afc38=_0x31718b[_0x22ea('0x2e')];var _0x34f159=_0x7feb19?0x0:_0x3286ae['offset'];var _0x3c50f2=_0x7feb19?_0x31718b[_0x22ea('0x2e')]:_0x3286ae[_0x22ea('0x2c')]+_0x3286ae['limit'];var _0x5d516a;if(_0x3c50f2>=_0x2afc38){_0x3c50f2=_0x2afc38;_0x5d516a=0xc8;}else{_0x5d516a=0xce;}_0x3b06c3[_0x22ea('0x2a')](_0x5d516a);return _0x3b06c3['set'](_0x22ea('0x2f'),_0x34f159+'-'+_0x3c50f2+'/'+_0x2afc38)['json'](_0x31718b);}return null;};}function patchUpdates(_0x5bda8d){return function(_0x2d4a9e){try{jsonpatch['apply'](_0x2d4a9e,_0x5bda8d,!![]);}catch(_0x33d706){return BPromise[_0x22ea('0x30')](_0x33d706);}return _0x2d4a9e[_0x22ea('0x31')]();};}function saveUpdates(_0x2f9710,_0xf3e1e0){return function(_0x33c806){if(_0x33c806){return _0x33c806[_0x22ea('0x32')](_0x2f9710)['then'](function(_0x58b7fd){return _0x58b7fd;});}return null;};}function removeEntity(_0x191414,_0x3c3604){return function(_0x54ce1b){if(_0x54ce1b){return _0x54ce1b[_0x22ea('0x33')]()[_0x22ea('0x20')](function(){var _0x8c2313=_0x54ce1b[_0x22ea('0x34')]({'plain':!![]});var _0x2fc7cc='SmsAccounts';return db['UserProfileResource'][_0x22ea('0x33')]({'where':{'type':_0x2fc7cc,'resourceId':_0x8c2313['id']}})[_0x22ea('0x20')](function(){return _0x54ce1b;});})['then'](function(){_0x191414['status'](0xcc)[_0x22ea('0x2b')]();});}};}function handleEntityNotFound(_0x4ee180,_0x48d57d){return function(_0x4071bb){if(!_0x4071bb){_0x4ee180['sendStatus'](0x194);}return _0x4071bb;};}function handleError(_0x1c8d47,_0x34e447){_0x34e447=_0x34e447||0x1f4;return function(_0xf8767f){logger[_0x22ea('0x24')](_0xf8767f['stack']);if(_0xf8767f[_0x22ea('0x35')]){delete _0xf8767f[_0x22ea('0x35')];}_0x1c8d47['status'](_0x34e447)[_0x22ea('0x36')](_0xf8767f);};}exports[_0x22ea('0x37')]=function(_0x24e0e6,_0x1a581c){var _0x3ea3f5={'include':[{'model':db[_0x22ea('0x38')],'as':_0x22ea('0x39')}]},_0x2b989b={},_0x41026c={'count':0x0,'rows':[]};var _0x2e7c16=_[_0x22ea('0x3a')](db['SmsAccount'][_0x22ea('0x3b')],function(_0x2829c4){return{'name':_0x2829c4[_0x22ea('0x3c')],'type':_0x2829c4['type']['key']};});_0x2b989b[_0x22ea('0x3d')]=_[_0x22ea('0x3a')](_0x2e7c16,_0x22ea('0x35'));_0x2b989b[_0x22ea('0x3e')]=_['keys'](_0x24e0e6['query']);_0x2b989b[_0x22ea('0x3f')]=_[_0x22ea('0x40')](_0x2b989b[_0x22ea('0x3d')],_0x2b989b[_0x22ea('0x3e')]);_0x3ea3f5[_0x22ea('0x41')]=_[_0x22ea('0x40')](_0x2b989b[_0x22ea('0x3d')],qs[_0x22ea('0x42')](_0x24e0e6[_0x22ea('0x3e')]['fields']));_0x3ea3f5[_0x22ea('0x41')]=_0x3ea3f5[_0x22ea('0x41')][_0x22ea('0x43')]?_0x3ea3f5[_0x22ea('0x41')]:_0x2b989b['model'];if(!_0x24e0e6['query'][_0x22ea('0x44')]('nolimit')){_0x3ea3f5[_0x22ea('0x45')]=qs[_0x22ea('0x45')](_0x24e0e6['query'][_0x22ea('0x45')]);_0x3ea3f5[_0x22ea('0x2c')]=qs['offset'](_0x24e0e6[_0x22ea('0x3e')][_0x22ea('0x2c')]);}_0x3ea3f5[_0x22ea('0x46')]=qs['sort'](_0x24e0e6[_0x22ea('0x3e')][_0x22ea('0x47')]);_0x3ea3f5[_0x22ea('0x48')]=qs['filters'](_[_0x22ea('0x49')](_0x24e0e6[_0x22ea('0x3e')],_0x2b989b[_0x22ea('0x3f')]),_0x2e7c16);if(_0x24e0e6['query'][_0x22ea('0x4a')]){_0x3ea3f5[_0x22ea('0x48')]=_[_0x22ea('0x4b')](_0x3ea3f5['where'],{'$or':_[_0x22ea('0x3a')](_0x2e7c16,function(_0x263485){if(_0x263485['type']!==_0x22ea('0x4c')){var _0x147af7={};_0x147af7[_0x263485[_0x22ea('0x35')]]={'$like':'%'+_0x24e0e6[_0x22ea('0x3e')][_0x22ea('0x4a')]+'%'};return _0x147af7;}})});}_0x3ea3f5=_[_0x22ea('0x4b')]({},_0x3ea3f5,_0x24e0e6[_0x22ea('0x4d')]);var _0x36465e={'where':_0x3ea3f5[_0x22ea('0x48')]};return db['SmsAccount'][_0x22ea('0x2e')](_0x36465e)['then'](function(_0x374551){_0x41026c[_0x22ea('0x2e')]=_0x374551;if(_0x24e0e6[_0x22ea('0x3e')][_0x22ea('0x4e')]){_0x3ea3f5['include']=[{'all':!![]}];}return db[_0x22ea('0x4f')][_0x22ea('0x50')](_0x3ea3f5);})[_0x22ea('0x20')](function(_0x5b6139){_0x41026c[_0x22ea('0x51')]=_0x5b6139;return _0x41026c;})['then'](respondWithFilteredResult(_0x1a581c,_0x3ea3f5))[_0x22ea('0x29')](handleError(_0x1a581c,null));};exports[_0x22ea('0x52')]=function(_0x4d400a,_0x18e756){var _0x414e4d={'raw':![],'where':{'id':_0x4d400a[_0x22ea('0x53')]['id']},'include':[{'model':db[_0x22ea('0x38')],'as':_0x22ea('0x39')}]},_0x1bafc5={};_0x1bafc5[_0x22ea('0x3d')]=_[_0x22ea('0x54')](db[_0x22ea('0x4f')][_0x22ea('0x3b')]);_0x1bafc5['query']=_['keys'](_0x4d400a[_0x22ea('0x3e')]);_0x1bafc5[_0x22ea('0x3f')]=_[_0x22ea('0x40')](_0x1bafc5['model'],_0x1bafc5['query']);_0x414e4d[_0x22ea('0x41')]=_[_0x22ea('0x40')](_0x1bafc5[_0x22ea('0x3d')],qs[_0x22ea('0x42')](_0x4d400a['query'][_0x22ea('0x42')]));_0x414e4d[_0x22ea('0x41')]=_0x414e4d[_0x22ea('0x41')]['length']?_0x414e4d[_0x22ea('0x41')]:_0x1bafc5[_0x22ea('0x3d')];if(_0x4d400a[_0x22ea('0x3e')][_0x22ea('0x4e')]){_0x414e4d[_0x22ea('0x55')]=[{'all':!![]}];}_0x414e4d=_[_0x22ea('0x4b')]({},_0x414e4d,_0x4d400a[_0x22ea('0x4d')]);return db[_0x22ea('0x4f')][_0x22ea('0x56')](_0x414e4d)['then'](handleEntityNotFound(_0x18e756,null))[_0x22ea('0x20')](respondWithResult(_0x18e756,null))[_0x22ea('0x29')](handleError(_0x18e756,null));};exports[_0x22ea('0x57')]=function(_0x5c50d5,_0x2c3d73){return db[_0x22ea('0x4f')]['create'](_0x5c50d5[_0x22ea('0x58')],{})[_0x22ea('0x20')](function(_0x3fb792){var _0x5e1761=_0x5c50d5[_0x22ea('0x59')][_0x22ea('0x34')]({'plain':!![]});if(!_0x5e1761)throw new Error(_0x22ea('0x5a'));if(_0x5e1761['role']===_0x22ea('0x59')){var _0x18bd60=_0x3fb792[_0x22ea('0x34')]({'plain':!![]});var _0x31f304=_0x22ea('0x5b');return db[_0x22ea('0x5c')][_0x22ea('0x56')]({'where':{'name':_0x31f304,'userProfileId':_0x5e1761[_0x22ea('0x5d')]},'raw':!![]})[_0x22ea('0x20')](function(_0x273289){if(_0x273289&&_0x273289[_0x22ea('0x5e')]===0x0){return db[_0x22ea('0x5f')][_0x22ea('0x57')]({'name':_0x18bd60[_0x22ea('0x35')],'resourceId':_0x18bd60['id'],'type':_0x273289[_0x22ea('0x35')],'sectionId':_0x273289['id']},{})[_0x22ea('0x20')](function(){return _0x3fb792;});}else{return _0x3fb792;}})[_0x22ea('0x29')](function(_0x182d59){logger[_0x22ea('0x24')](_0x22ea('0x60'),_0x182d59);throw _0x182d59;});}return _0x3fb792;})[_0x22ea('0x20')](respondWithResult(_0x2c3d73,0xc9))[_0x22ea('0x29')](handleError(_0x2c3d73,null));};exports[_0x22ea('0x32')]=function(_0x2cee9b,_0x5e21f0){if(_0x2cee9b['body']['id']){delete _0x2cee9b[_0x22ea('0x58')]['id'];}return db['SmsAccount'][_0x22ea('0x56')]({'where':{'id':_0x2cee9b[_0x22ea('0x53')]['id']},'include':[{'model':db[_0x22ea('0x38')],'as':_0x22ea('0x39')}]})[_0x22ea('0x20')](handleEntityNotFound(_0x5e21f0,null))[_0x22ea('0x20')](saveUpdates(_0x2cee9b['body'],null))[_0x22ea('0x20')](respondWithResult(_0x5e21f0,null))['catch'](handleError(_0x5e21f0,null));};exports['destroy']=function(_0x4943bb,_0x517b07){return db[_0x22ea('0x4f')]['find']({'where':{'id':_0x4943bb[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x517b07,null))[_0x22ea('0x20')](removeEntity(_0x517b07,null))[_0x22ea('0x29')](handleError(_0x517b07,null));};exports[_0x22ea('0x61')]=function(_0xae6f94,_0xd0ec91){return db[_0x22ea('0x4f')][_0x22ea('0x61')]()['then'](respondWithResult(_0xd0ec91,null))[_0x22ea('0x29')](handleError(_0xd0ec91,null));};exports[_0x22ea('0x62')]=function(_0x3348b6,_0x1bdfec,_0x115ac7){if(_0x3348b6[_0x22ea('0x58')]['id']){delete _0x3348b6[_0x22ea('0x58')]['id'];}return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x3348b6[_0x22ea('0x53')]['id']}})['then'](handleEntityNotFound(_0x1bdfec,null))[_0x22ea('0x20')](function(_0x491f08){if(_0x491f08){_0x3348b6['body'][_0x22ea('0x63')]=_0x491f08['id'];return db['Disposition'][_0x22ea('0x57')](_0x3348b6['body']);}})['then'](respondWithResult(_0x1bdfec,null))[_0x22ea('0x29')](handleError(_0x1bdfec,null));};exports[_0x22ea('0x64')]=function(_0x10c740,_0x5a991a,_0x343e1d){var _0x46078d={'raw':![],'where':{}};var _0x21d996={};var _0x29cf22={'count':0x0,'rows':[]};return db[_0x22ea('0x4f')]['findOne']({'where':{'id':_0x10c740[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x5a991a,null))[_0x22ea('0x20')](function(_0x43beba){if(_0x43beba){_0x21d996[_0x22ea('0x3d')]=_[_0x22ea('0x54')](db[_0x22ea('0x65')][_0x22ea('0x3b')]);_0x21d996[_0x22ea('0x3e')]=_[_0x22ea('0x54')](_0x10c740[_0x22ea('0x3e')]);_0x21d996['filters']=_[_0x22ea('0x40')](_0x21d996['model'],_0x21d996['query']);_0x46078d['attributes']=_[_0x22ea('0x40')](_0x21d996[_0x22ea('0x3d')],qs[_0x22ea('0x42')](_0x10c740[_0x22ea('0x3e')]['fields']));_0x46078d[_0x22ea('0x41')]=_0x46078d[_0x22ea('0x41')][_0x22ea('0x43')]?_0x46078d[_0x22ea('0x41')]:_0x21d996['model'];if(!_0x10c740[_0x22ea('0x3e')][_0x22ea('0x44')](_0x22ea('0x66'))){_0x46078d[_0x22ea('0x45')]=qs[_0x22ea('0x45')](_0x10c740[_0x22ea('0x3e')][_0x22ea('0x45')]);_0x46078d[_0x22ea('0x2c')]=qs[_0x22ea('0x2c')](_0x10c740['query'][_0x22ea('0x2c')]);}_0x46078d[_0x22ea('0x46')]=qs['sort'](_0x10c740[_0x22ea('0x3e')][_0x22ea('0x47')]);_0x46078d[_0x22ea('0x48')]=qs[_0x22ea('0x3f')](_[_0x22ea('0x49')](_0x10c740[_0x22ea('0x3e')],_0x21d996['filters']));_0x46078d[_0x22ea('0x48')][_0x22ea('0x63')]=_0x43beba['id'];if(_0x10c740[_0x22ea('0x3e')][_0x22ea('0x4a')]){_0x46078d['where']=_[_0x22ea('0x4b')](_0x46078d[_0x22ea('0x48')],{'$or':_[_0x22ea('0x3a')](_0x46078d['attributes'],function(_0x2d4c11){var _0x5c6612={};_0x5c6612[_0x2d4c11]={'$like':'%'+_0x10c740['query']['filter']+'%'};return _0x5c6612;})});}_0x46078d=_['merge']({},_0x46078d,_0x10c740[_0x22ea('0x4d')]);return db[_0x22ea('0x65')][_0x22ea('0x2e')]({'where':_0x46078d[_0x22ea('0x48')]})[_0x22ea('0x20')](function(_0x37ec61){_0x29cf22[_0x22ea('0x2e')]=_0x37ec61;if(_0x10c740['query'][_0x22ea('0x4e')]){_0x46078d['include']=[{'all':!![]}];}return db[_0x22ea('0x65')][_0x22ea('0x50')](_0x46078d);})['then'](function(_0x11be2c){_0x29cf22[_0x22ea('0x51')]=_0x11be2c;return _0x29cf22;});}})['then'](respondWithFilteredResult(_0x5a991a,_0x46078d))[_0x22ea('0x29')](handleError(_0x5a991a,null));};exports[_0x22ea('0x67')]=function(_0x32d510,_0x4a7cf2,_0x9b1b81){return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x32d510[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x4a7cf2,null))[_0x22ea('0x20')](function(_0x33fd8e){if(_0x33fd8e){return _0x33fd8e['removeDispositions'](_0x32d510[_0x22ea('0x3e')][_0x22ea('0x68')]);}})[_0x22ea('0x20')](respondWithStatusCode(_0x4a7cf2,null))[_0x22ea('0x29')](handleError(_0x4a7cf2,null));};exports[_0x22ea('0x69')]=function(_0x5c5228,_0x446f42,_0x3848f7){if(_0x5c5228[_0x22ea('0x58')]['id']){delete _0x5c5228[_0x22ea('0x58')]['id'];}return db[_0x22ea('0x4f')]['find']({'where':{'id':_0x5c5228['params']['id']}})['then'](handleEntityNotFound(_0x446f42,null))['then'](function(_0x2256b4){if(_0x2256b4){_0x5c5228[_0x22ea('0x58')][_0x22ea('0x63')]=_0x2256b4['id'];return db[_0x22ea('0x6a')][_0x22ea('0x57')](_0x5c5228[_0x22ea('0x58')]);}})[_0x22ea('0x20')](respondWithResult(_0x446f42,null))[_0x22ea('0x29')](handleError(_0x446f42,null));};exports['getAnswers']=function(_0x65643f,_0x994068,_0x3d24b1){var _0x170598={'raw':![],'where':{}};var _0x1b56d1={};var _0x8b12f7={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x65643f[_0x22ea('0x53')]['id']}})['then'](handleEntityNotFound(_0x994068,null))[_0x22ea('0x20')](function(_0x38a761){if(_0x38a761){_0x1b56d1[_0x22ea('0x3d')]=_[_0x22ea('0x54')](db['CannedAnswer'][_0x22ea('0x3b')]);_0x1b56d1[_0x22ea('0x3e')]=_[_0x22ea('0x54')](_0x65643f[_0x22ea('0x3e')]);_0x1b56d1[_0x22ea('0x3f')]=_[_0x22ea('0x40')](_0x1b56d1[_0x22ea('0x3d')],_0x1b56d1[_0x22ea('0x3e')]);_0x170598[_0x22ea('0x41')]=_['intersection'](_0x1b56d1[_0x22ea('0x3d')],qs[_0x22ea('0x42')](_0x65643f[_0x22ea('0x3e')][_0x22ea('0x42')]));_0x170598[_0x22ea('0x41')]=_0x170598[_0x22ea('0x41')]['length']?_0x170598['attributes']:_0x1b56d1[_0x22ea('0x3d')];if(!_0x65643f[_0x22ea('0x3e')][_0x22ea('0x44')](_0x22ea('0x66'))){_0x170598[_0x22ea('0x45')]=qs['limit'](_0x65643f['query'][_0x22ea('0x45')]);_0x170598[_0x22ea('0x2c')]=qs['offset'](_0x65643f[_0x22ea('0x3e')]['offset']);}_0x170598[_0x22ea('0x46')]=qs[_0x22ea('0x47')](_0x65643f['query'][_0x22ea('0x47')]);_0x170598[_0x22ea('0x48')]=qs[_0x22ea('0x3f')](_['pick'](_0x65643f[_0x22ea('0x3e')],_0x1b56d1['filters']));_0x170598[_0x22ea('0x48')]['SmsAccountId']=_0x38a761['id'];if(_0x65643f['query'][_0x22ea('0x4a')]){_0x170598['where']=_[_0x22ea('0x4b')](_0x170598['where'],{'$or':_[_0x22ea('0x3a')](_0x170598[_0x22ea('0x41')],function(_0x23aa7d){var _0x3d621e={};_0x3d621e[_0x23aa7d]={'$like':'%'+_0x65643f[_0x22ea('0x3e')][_0x22ea('0x4a')]+'%'};return _0x3d621e;})});}_0x170598=_['merge']({},_0x170598,_0x65643f[_0x22ea('0x4d')]);return db['CannedAnswer']['count']({'where':_0x170598[_0x22ea('0x48')]})[_0x22ea('0x20')](function(_0x66725b){_0x8b12f7[_0x22ea('0x2e')]=_0x66725b;if(_0x65643f[_0x22ea('0x3e')][_0x22ea('0x4e')]){_0x170598[_0x22ea('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x22ea('0x50')](_0x170598);})[_0x22ea('0x20')](function(_0x407c78){_0x8b12f7['rows']=_0x407c78;return _0x8b12f7;});}})['then'](respondWithFilteredResult(_0x994068,_0x170598))[_0x22ea('0x29')](handleError(_0x994068,null));};exports[_0x22ea('0x6b')]=function(_0x22bc51,_0x42a514,_0x3f62cd){return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x22bc51[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x42a514,null))['then'](function(_0x2a5c81){if(_0x2a5c81){return _0x2a5c81['removeAnswers'](_0x22bc51[_0x22ea('0x3e')][_0x22ea('0x68')]);}})[_0x22ea('0x20')](respondWithStatusCode(_0x42a514,null))[_0x22ea('0x29')](handleError(_0x42a514,null));};exports['notify']=function(_0x45ea05,_0x2bdc7c,_0x59b545){var _0x24f512={'channel':_0x22ea('0x6c')};var _0x32c1ec=[];var _0x525126=[];var _0x102e92={};return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x45ea05[_0x22ea('0x53')]['id']},'include':[{'model':db[_0x22ea('0x6d')],'as':_0x22ea('0x6e')}]})['then'](handleEntityNotFound(_0x2bdc7c,null))[_0x22ea('0x20')](function(_0x199d22){_0x24f512['account']=_0x199d22;_0x24f512[_0x22ea('0x6f')]=_[_0x22ea('0x70')](_0x199d22[_0x22ea('0x6e')],[_0x22ea('0x71')],['asc']);if(_0x24f512['account'][_0x22ea('0x6e')]){delete _0x24f512[_0x22ea('0x72')][_0x22ea('0x6e')];}return db[_0x22ea('0x73')][_0x22ea('0x61')]();})[_0x22ea('0x20')](function(_0x4662fd){if(!_0x4662fd){throw new db[(_0x22ea('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x32c1ec=_[_0x22ea('0x75')](_['keys'](_0x4662fd),[_0x22ea('0x76'),_0x22ea('0x77')]);_0x525126=_[_0x22ea('0x75')](_['keys'](_0x4662fd),[_0x22ea('0x76'),'updatedAt',_0x22ea('0x78'),_0x22ea('0x79')]);_0x24f512[_0x22ea('0x58')]={'mapKey':_0x22ea('0x7a')};if(_0x24f512[_0x22ea('0x72')][_0x22ea('0x7b')]){switch(_0x24f512[_0x22ea('0x72')]['type']){case'twilio':_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')]=_0x45ea05['body'][_0x22ea('0x7d')];_0x24f512[_0x22ea('0x58')]['body']=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x7e')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x7f')]=_0x45ea05['body'][_0x22ea('0x80')];break;case _0x22ea('0x81'):_0x24f512['body'][_0x22ea('0x7c')]='+'+_0x45ea05[_0x22ea('0x58')][_0x22ea('0x82')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05['body'][_0x22ea('0x83')];break;case _0x22ea('0x84'):_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')]=_0x45ea05['body'][_0x22ea('0x7c')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x27')];break;case _0x22ea('0x85'):_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')]=_0x45ea05[_0x22ea('0x58')]['from'];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x58')];_0x24f512['body']['messageId']=_0x45ea05[_0x22ea('0x58')]['message_id'];break;case'plivo':_0x24f512['body'][_0x22ea('0x7c')]=_0x45ea05['body'][_0x22ea('0x7d')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x86')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x7f')]=_0x45ea05[_0x22ea('0x58')]['MessageUUID'];break;case _0x22ea('0x87'):_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')]='+'+_0x45ea05['body'][_0x22ea('0x88')][0x0][_0x22ea('0x7c')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05[_0x22ea('0x58')]['results'][0x0][_0x22ea('0x83')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x7f')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x88')][0x0][_0x22ea('0x7f')];break;case _0x22ea('0x89'):_0x24f512['body'][_0x22ea('0x7c')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x8a')];_0x24f512['body']['body']=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x8b')][_0x22ea('0x27')];break;case _0x22ea('0x8c'):_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')]=_0x45ea05[_0x22ea('0x58')]['fromNumber'];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05['body'][_0x22ea('0x83')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x7f')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x8d')];break;case _0x22ea('0x8e'):_0x24f512[_0x22ea('0x58')][_0x22ea('0x7f')]=_0x45ea05['body'][0x0][_0x22ea('0x27')]['id'];_0x24f512[_0x22ea('0x58')]['from']=_0x45ea05[_0x22ea('0x58')][0x0][_0x22ea('0x27')][_0x22ea('0x7c')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]=_0x45ea05['body'][0x0][_0x22ea('0x27')]['text'];break;case _0x22ea('0x8f'):_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x7c')];_0x24f512[_0x22ea('0x58')]['body']=_0x45ea05['body'][_0x22ea('0x27')];_0x24f512[_0x22ea('0x58')][_0x22ea('0x7f')]=_0x45ea05[_0x22ea('0x58')][_0x22ea('0x90')];break;}}if(_0x24f512[_0x22ea('0x58')]['id']){delete _0x24f512[_0x22ea('0x58')]['id'];}if(_[_0x22ea('0x91')](_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')])){throw new db['Sequelize']['ValidationError'](_0x22ea('0x92'));}if(_[_0x22ea('0x91')](_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')])||_0x24f512[_0x22ea('0x58')][_0x22ea('0x58')]===''){throw new db[(_0x22ea('0x74'))][(_0x22ea('0x93'))](_0x22ea('0x94'));}if(_[_0x22ea('0x91')](_0x24f512[_0x22ea('0x58')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x22ea('0x95')+_0x525126);}if(!_['includes'](_0x525126,_0x24f512[_0x22ea('0x58')]['mapKey'])){throw new db[(_0x22ea('0x74'))]['ValidationError'](_0x22ea('0x96')+_0x525126);}_0x102e92[_0x24f512[_0x22ea('0x58')][_0x22ea('0x97')]]=_0x24f512['body'][_0x22ea('0x7c')];return db[_0x22ea('0x98')][_0x22ea('0x56')]({'where':{'id':_0x24f512[_0x22ea('0x72')]['ListId']},'include':[{'model':db[_0x22ea('0x73')],'as':_0x22ea('0x99'),'where':_0x102e92,'limit':0x1,'order':[['updatedAt',_0x22ea('0x9a')]]}]});})['then'](handleEntityNotFound(_0x2bdc7c,null))[_0x22ea('0x20')](function(_0x175bcd){if(_0x175bcd){_0x24f512[_0x22ea('0x9b')]=_[_0x22ea('0x9c')](_0x175bcd,[_0x22ea('0x99')]);if(_0x175bcd[_0x22ea('0x99')][_0x22ea('0x43')]){return _0x175bcd[_0x22ea('0x99')][0x0];}var _0x25ba78=_[_0x22ea('0x1a')](_0x24f512[_0x22ea('0x58')],{'firstName':_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')],'ListId':_0x175bcd['id']});_0x25ba78[_0x24f512[_0x22ea('0x58')][_0x22ea('0x97')]]=_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')];return db[_0x22ea('0x73')][_0x22ea('0x57')](_0x25ba78,{'fields':_0x32c1ec,'raw':!![]});}})[_0x22ea('0x20')](handleEntityNotFound(_0x2bdc7c,null))[_0x22ea('0x20')](function(_0x1a36a4){if(_0x1a36a4){_0x24f512[_0x22ea('0x9d')]=_0x1a36a4;var _0x311066={'ContactId':_0x1a36a4['id'],'phone':_0x24f512[_0x22ea('0x58')]['from'],'SmsAccountId':_0x45ea05[_0x22ea('0x53')]['id']};var _0x500012={'ContactId':_0x1a36a4['id'],'SmsAccountId':_0x45ea05[_0x22ea('0x53')]['id'],'closed':![]};return db[_0x22ea('0x9e')][_0x22ea('0x56')]({'where':_0x500012})[_0x22ea('0x20')](function(_0x1414da){if(_0x1414da){return[_0x1414da,![]];}return db[_0x22ea('0x9e')]['create'](_0x311066)['then'](function(_0x1d1fa7){return[_0x1d1fa7,!![]];});});}})[_0x22ea('0x9f')](function(_0x302d5e,_0x5ba244){_0x24f512['interaction']=_0x302d5e[_0x22ea('0x34')]({'plain':!![]});_0x24f512[_0x22ea('0xa0')][_0x22ea('0xa1')]=![];if(_0x5ba244){if(_0x24f512[_0x22ea('0x72')][_0x22ea('0xa2')]){_0x24f512[_0x22ea('0x6f')][_0x22ea('0xa3')]({'id':0x0,'priority':_0x24f512['applications'][_0x22ea('0x43')]+0x1,'app':_0x22ea('0xa4'),'appdata':_0x22ea('0xa5'),'interval':_0x22ea('0xa6')});}_0x24f512[_0x22ea('0xa0')][_0x22ea('0xa1')]=!![];}return db[_0x22ea('0xa7')]['create']({'phone':_0x24f512[_0x22ea('0x58')][_0x22ea('0x7c')],'messageId':_0x24f512[_0x22ea('0x58')]['messageId'],'body':_0x24f512[_0x22ea('0x58')]['body'],'SmsAccountId':_0x45ea05['params']['id'],'SmsInteractionId':_0x302d5e['id'],'direction':'in','ContactId':_0x302d5e[_0x22ea('0xa8')],'AttachmentId':_0x24f512[_0x22ea('0x58')]['AttachmentId']});})['then'](function(_0x576fbe){_0x24f512[_0x22ea('0x27')]=_0x576fbe;if(!_0x24f512[_0x22ea('0xa0')][_0x22ea('0xa9')])return;return db[_0x22ea('0xaa')]['find']({'attributes':['id',_0x22ea('0x35')],'where':{'id':_0x24f512[_0x22ea('0xa0')][_0x22ea('0xa9')]}});})[_0x22ea('0x20')](function(_0x93aa64){if(_0x93aa64){_0x24f512[_0x22ea('0x6f')][_0x22ea('0xab')]({'id':0x0,'priority':0x0,'app':_0x22ea('0xac'),'appdata':_0x93aa64[_0x22ea('0x35')]+','+(_0x24f512[_0x22ea('0x72')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x24f512[_0x22ea('0xa0')][_0x22ea('0xad')])return;return db['SmsQueue'][_0x22ea('0x56')]({'attributes':['id',_0x22ea('0x35')],'where':{'id':_0x24f512[_0x22ea('0xa0')][_0x22ea('0xad')]}});})['then'](function(_0x1f28e3){if(_0x1f28e3){_0x24f512[_0x22ea('0x6f')][_0x22ea('0xab')]({'id':0x0,'priority':0x1,'app':_0x22ea('0xae'),'appdata':_0x1f28e3[_0x22ea('0x35')]+','+(_0x24f512['account'][_0x22ea('0xaf')]||0x12c),'interval':_0x22ea('0xa6')});}return respondWithRpcPromise(_0x22ea('0xb0'),_0x22ea('0xb1'),_0x24f512);})[_0x22ea('0x20')](function(_0xee4c46){if(_0xee4c46){var _0x4e9fcc=0xc8;var _0x1fa9ad=_0x22ea('0xb2');logger[_0x22ea('0x21')](_0x22ea('0xb3'),_0x1fa9ad,_0x4e9fcc,'entity\x20found');logger[_0x22ea('0x23')](_0x22ea('0xb4'),_0x1fa9ad,_0x4e9fcc,_0x22ea('0xb5'),JSON['stringify'](_0xee4c46));if(_0x24f512[_0x22ea('0x72')][_0x22ea('0x7b')]===_0x22ea('0xb6')){return _0x2bdc7c['status'](_0x4e9fcc)[_0x22ea('0xb7')](_0x22ea('0xb8'),_0x22ea('0xb9'))[_0x22ea('0x36')](_0x22ea('0xba'));}else{return _0x2bdc7c[_0x22ea('0x2a')](_0x4e9fcc)['json'](_0xee4c46);}}})[_0x22ea('0x29')](handleError(_0x2bdc7c,null));};exports[_0x22ea('0xbb')]=function(_0x2c9ee5,_0x4c2388){var _0x5ba852=_0x2c9ee5['params']['id'];var _0xef2033=_0x2c9ee5[_0x22ea('0x58')];var _0x5c992a=0xc8;var _0x5b4638=null;return db[_0x22ea('0xbc')][_0x22ea('0xbd')]({'isolationLevel':db[_0x22ea('0xbc')]['Transaction'][_0x22ea('0xbe')][_0x22ea('0xbf')]},function(_0x11f957){return db['SmsAccount'][_0x22ea('0xc0')]({'where':{'id':_0x5ba852},'transaction':_0x11f957})[_0x22ea('0x20')](function(_0x1e4520){if(_0x1e4520){return db['SmsApplication'][_0x22ea('0x33')]({'where':{'SmsAccountId':_0x5ba852},'transaction':_0x11f957})['then'](function(){var _0x387c4f=_[_0x22ea('0x3a')](_0xef2033,function(_0x45d86f){_0x45d86f[_0x22ea('0x63')]=_0x5ba852;return _0x45d86f;});return db['SmsApplication'][_0x22ea('0xc1')](_0x387c4f,{'transaction':_0x11f957});});}else{_0x5c992a=0x194;_0x5b4638=[];}});})[_0x22ea('0x20')](function(){if(_0x5c992a!==0x194){return db[_0x22ea('0x6d')][_0x22ea('0xc2')]({'where':{'SmsAccountId':_0x5ba852},'order':'priority'})[_0x22ea('0x20')](function(_0x5f1425){_0x5b4638=_0x5f1425;});}})[_0x22ea('0x29')](function(_0x2bed71){_0x5c992a=0x1f4;logger[_0x22ea('0x24')](_0x2bed71[_0x22ea('0xc3')]);if(_0x2bed71['name']){delete _0x2bed71[_0x22ea('0x35')];}_0x5b4638=_0x2bed71;})['finally'](function(){if(_0x5b4638===null){_0x4c2388[_0x22ea('0xc4')](_0x5c992a);}else{if(_0x5c992a===0x1f4){_0x4c2388[_0x22ea('0x2a')](_0x5c992a)[_0x22ea('0x36')](_0x5b4638);}else{_0x4c2388[_0x22ea('0x2a')](_0x5c992a)[_0x22ea('0xc5')](_0x5b4638);}}});};exports[_0x22ea('0xc6')]=function(_0x5c8d87,_0x2d6c2e,_0x2c786a){var _0x4d359a={};var _0x4bfc3b={};var _0x1541f9;var _0x2472a1;return db['SmsAccount']['findOne']({'where':{'id':_0x5c8d87[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x2d6c2e,null))['then'](function(_0x8b7c5){if(_0x8b7c5){_0x1541f9=_0x8b7c5;_0x4bfc3b[_0x22ea('0x3d')]=_[_0x22ea('0x54')](db['SmsApplication']['rawAttributes']);_0x4bfc3b['query']=_[_0x22ea('0x54')](_0x5c8d87[_0x22ea('0x3e')]);_0x4bfc3b['filters']=_[_0x22ea('0x40')](_0x4bfc3b[_0x22ea('0x3d')],_0x4bfc3b['query']);_0x4d359a[_0x22ea('0x41')]=_[_0x22ea('0x40')](_0x4bfc3b[_0x22ea('0x3d')],qs[_0x22ea('0x42')](_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x42')]));_0x4d359a['attributes']=_0x4d359a['attributes']['length']?_0x4d359a[_0x22ea('0x41')]:_0x4bfc3b['model'];_0x4d359a[_0x22ea('0x46')]=qs[_0x22ea('0x47')](_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x47')]);_0x4d359a[_0x22ea('0x48')]=qs[_0x22ea('0x3f')](_[_0x22ea('0x49')](_0x5c8d87['query'],_0x4bfc3b['filters']));if(_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x4a')]){_0x4d359a[_0x22ea('0x48')]=_['merge'](_0x4d359a[_0x22ea('0x48')],{'$or':_[_0x22ea('0x3a')](_0x4d359a['attributes'],function(_0x61b7d){var _0x200c0d={};_0x200c0d[_0x61b7d]={'$like':'%'+_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x4a')]+'%'};return _0x200c0d;})});}_0x4d359a=_[_0x22ea('0x4b')]({},_0x4d359a,_0x5c8d87[_0x22ea('0x4d')]);return _0x1541f9['getApplications'](_0x4d359a);}})['then'](function(_0x112385){if(_0x112385){_0x2472a1=_0x112385[_0x22ea('0x43')];if(!_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x44')](_0x22ea('0x66'))){_0x4d359a[_0x22ea('0x45')]=qs[_0x22ea('0x45')](_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x45')]);_0x4d359a[_0x22ea('0x2c')]=qs[_0x22ea('0x2c')](_0x5c8d87[_0x22ea('0x3e')][_0x22ea('0x2c')]);}return _0x1541f9[_0x22ea('0xc6')](_0x4d359a);}})['then'](function(_0xf81ff4){if(_0xf81ff4){return _0xf81ff4?{'count':_0x2472a1,'rows':_0xf81ff4}:null;}})[_0x22ea('0x20')](respondWithResult(_0x2d6c2e,null))[_0x22ea('0x29')](handleError(_0x2d6c2e,null));};exports['getInteractions']=function(_0x197ce6,_0xfe9677,_0x3b7636){var _0x1be761={'raw':![],'where':{}};var _0x29ede5={};var _0x5d03d8={'count':0x0,'rows':[]};return db[_0x22ea('0x4f')]['findOne']({'where':{'id':_0x197ce6[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0xfe9677,null))['then'](function(_0x561791){if(_0x561791){_0x29ede5['model']=_[_0x22ea('0x54')](db[_0x22ea('0x9e')][_0x22ea('0x3b')]);_0x29ede5['query']=_['keys'](_0x197ce6[_0x22ea('0x3e')]);_0x29ede5[_0x22ea('0x3f')]=_[_0x22ea('0x40')](_0x29ede5[_0x22ea('0x3d')],_0x29ede5[_0x22ea('0x3e')]);_0x1be761['attributes']=_[_0x22ea('0x40')](_0x29ede5['model'],qs[_0x22ea('0x42')](_0x197ce6[_0x22ea('0x3e')][_0x22ea('0x42')]));_0x1be761[_0x22ea('0x41')]=_0x1be761[_0x22ea('0x41')]['length']?_0x1be761[_0x22ea('0x41')]:_0x29ede5[_0x22ea('0x3d')];if(!_0x197ce6[_0x22ea('0x3e')][_0x22ea('0x44')]('nolimit')){_0x1be761[_0x22ea('0x45')]=qs[_0x22ea('0x45')](_0x197ce6['query'][_0x22ea('0x45')]);_0x1be761[_0x22ea('0x2c')]=qs['offset'](_0x197ce6['query']['offset']);}_0x1be761['order']=qs['sort'](_0x197ce6['query']['sort']);_0x1be761[_0x22ea('0x48')]=qs['filters'](_[_0x22ea('0x49')](_0x197ce6['query'],_0x29ede5[_0x22ea('0x3f')]));_0x1be761[_0x22ea('0x48')][_0x22ea('0x63')]=_0x561791['id'];if(_0x197ce6[_0x22ea('0x3e')][_0x22ea('0x4a')]){_0x1be761[_0x22ea('0x48')]=_[_0x22ea('0x4b')](_0x1be761[_0x22ea('0x48')],{'$or':_[_0x22ea('0x3a')](_0x1be761[_0x22ea('0x41')],function(_0x537758){var _0xb80ad6={};_0xb80ad6[_0x537758]={'$like':'%'+_0x197ce6[_0x22ea('0x3e')][_0x22ea('0x4a')]+'%'};return _0xb80ad6;})});}_0x1be761=_[_0x22ea('0x4b')]({},_0x1be761,_0x197ce6['options']);return db[_0x22ea('0x9e')][_0x22ea('0x2e')]({'where':_0x1be761['where']})[_0x22ea('0x20')](function(_0x2e4c0b){_0x5d03d8['count']=_0x2e4c0b;if(_0x197ce6[_0x22ea('0x3e')]['includeAll']){_0x1be761[_0x22ea('0x55')]=[{'model':db[_0x22ea('0x73')],'as':_0x22ea('0xc7'),'required':![]},{'model':db[_0x22ea('0xaa')],'as':_0x22ea('0xc8'),'attributes':[_0x22ea('0x35'),_0x22ea('0xc9'),'internal'],'required':![]},{'model':db[_0x22ea('0xca')],'as':_0x22ea('0xcb'),'attributes':['id',_0x22ea('0x35'),_0x22ea('0xcc')],'where':_0x197ce6[_0x22ea('0x3e')][_0x22ea('0xcd')]?{'id':_0x197ce6[_0x22ea('0x3e')][_0x22ea('0xcd')]}:undefined,'required':_0x197ce6[_0x22ea('0x3e')][_0x22ea('0xcd')]?!![]:![]}];}return db['SmsInteraction'][_0x22ea('0x50')](_0x1be761);})[_0x22ea('0x20')](function(_0x2c3ce7){_0x5d03d8[_0x22ea('0x51')]=_0x2c3ce7;return _0x5d03d8;});}})[_0x22ea('0x20')](respondWithFilteredResult(_0xfe9677,_0x1be761))[_0x22ea('0x29')](handleError(_0xfe9677,null));};exports[_0x22ea('0x36')]=function(_0x222c76,_0x23edfe,_0x349764){var _0x2f4a2a,_0x3b1846,_0x59e45e;if(_[_0x22ea('0x91')](_0x222c76['body']['body'])||_0x222c76[_0x22ea('0x58')][_0x22ea('0x58')]===''){throw new db['Sequelize'][(_0x22ea('0x93'))](_0x22ea('0x94'));}if(_['isNil'](_0x222c76[_0x22ea('0x58')]['to'])){throw new db[(_0x22ea('0x74'))][(_0x22ea('0x93'))](_0x22ea('0xce'));}_0x2f4a2a=_0x222c76['body']['to'];return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x222c76[_0x22ea('0x53')]['id']},'include':[{'model':db[_0x22ea('0x98')],'as':'List','include':[{'model':db[_0x22ea('0x73')],'as':_0x22ea('0x99'),'where':{'mobile':_0x2f4a2a},'limit':0x1,'order':[[_0x22ea('0x77'),_0x22ea('0x9a')]]}]}]})[_0x22ea('0x20')](handleEntityNotFound(_0x23edfe,null))[_0x22ea('0x20')](function(_0x53b204){if(_0x53b204&&_0x53b204[_0x22ea('0xcf')]){_0x3b1846=_0x53b204[_0x22ea('0x34')]({'plain':!![]});if(_0x3b1846['List']&&_0x3b1846[_0x22ea('0xcf')][_0x22ea('0x99')][_0x22ea('0x43')]){return _0x3b1846['List'][_0x22ea('0x99')][0x0];}return db[_0x22ea('0x73')][_0x22ea('0x57')](_['defaults'](_0x222c76['body'],{'firstName':_0x2f4a2a,'mobile':_0x2f4a2a,'phone':_0x2f4a2a,'ListId':_0x3b1846[_0x22ea('0x79')]}));}})[_0x22ea('0x20')](handleEntityNotFound(_0x23edfe,null))[_0x22ea('0x20')](function(_0x5c5f24){if(_0x5c5f24){_0x59e45e=_0x5c5f24;return db[_0x22ea('0x9e')][_0x22ea('0x56')]({'where':{'ContactId':_0x59e45e['id'],'closed':![],'SmsAccountId':_0x3b1846['id']}})[_0x22ea('0x20')](function(_0x1403e4){if(_0x1403e4){return[_0x1403e4,![]];}return db[_0x22ea('0x9e')][_0x22ea('0x57')]({'UserId':_0x222c76['user']['id'],'ContactId':_0x59e45e['id'],'SmsAccountId':_0x3b1846['id'],'phone':_0x2f4a2a,'firstMsgDirection':_0x22ea('0xd0'),'Messages':[_['merge'](_0x222c76[_0x22ea('0x58')],{'read':![],'body':_0x222c76[_0x22ea('0x58')]['body'],'phone':_0x2f4a2a,'SmsAccountId':_0x3b1846['id'],'UserId':_0x222c76[_0x22ea('0x59')]['id'],'ContactId':_0x59e45e['id']})]},{'include':[{'model':db[_0x22ea('0xa7')],'as':_0x22ea('0xd1')}]})[_0x22ea('0x20')](function(_0x22bf05){return[_0x22bf05,!![]];});});}})[_0x22ea('0x9f')](function(_0x4af429,_0x495a43){if(_0x495a43){return _0x4af429;}return db[_0x22ea('0xa7')][_0x22ea('0x57')](_[_0x22ea('0x4b')](_0x222c76[_0x22ea('0x58')],{'read':![],'body':_0x222c76[_0x22ea('0x58')]['body'],'phone':_0x2f4a2a,'SmsAccountId':_0x3b1846['id'],'SmsInteractionId':_0x4af429['id'],'UserId':_0x222c76['user']['id'],'ContactId':_0x59e45e['id']}))[_0x22ea('0x20')](function(_0x102301){_0x4af429[_0x22ea('0xd2')][_0x22ea('0xd1')]=[];_0x4af429[_0x22ea('0xd2')][_0x22ea('0xd1')][_0x22ea('0xa3')](_0x102301[_0x22ea('0xd2')]);return _0x4af429;});})[_0x22ea('0x20')](respondWithResult(_0x23edfe,null))[_0x22ea('0x29')](handleError(_0x23edfe,null));};exports['status']=function(_0x54b1d6,_0x21b208,_0x478df7){if(_0x54b1d6[_0x22ea('0x58')]['id']){delete _0x54b1d6['body']['id'];}var _0x4764d9,_0x1c20e7,_0x4e00df;return db[_0x22ea('0x4f')]['find']({'where':{'id':_0x54b1d6[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x21b208,null))[_0x22ea('0x20')](function(_0x4fd387){if(_0x4fd387){_0x4e00df=_0x4fd387;logger[_0x22ea('0x23')](_0x22ea('0xb3'),_0x22ea('0x2a'),_0x22ea('0xd3'),_0x4fd387[_0x22ea('0x7b')],util[_0x22ea('0xd4')](_0x54b1d6['body'],{'showHidden':![],'depth':null}));switch(_0x4fd387[_0x22ea('0x7b')]){case _0x22ea('0x81'):if(_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd5')]&&_0x54b1d6['body'][_0x22ea('0x2a')]){_0x1c20e7=_0x54b1d6['body'][_0x22ea('0x2a')];return db[_0x22ea('0xa7')][_0x22ea('0x56')]({'where':{'messageId':_0x54b1d6['body'][_0x22ea('0xd5')]}});}break;case _0x22ea('0x84'):if(_0x54b1d6[_0x22ea('0x58')]['requestid']&&_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd6')]){_0x1c20e7=_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd6')];return db[_0x22ea('0xa7')][_0x22ea('0x56')]({'where':{'messageId':_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd7')]}});}break;case _0x22ea('0x85'):if(_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd8')]&&_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd9')]){_0x1c20e7=_0x54b1d6[_0x22ea('0x58')][_0x22ea('0xd9')];return db[_0x22ea('0xa7')]['find']({'where':{'messageId':_0x54b1d6['body'][_0x22ea('0xd8')]}});}break;case _0x22ea('0x87'):var _0x4e1048=_0x54b1d6[_0x22ea('0x58')][_0x22ea('0x88')][0x0];if(_0x4e1048[_0x22ea('0x7f')]&&_0x4e1048[_0x22ea('0x2a')][_0x22ea('0xda')]===_0x22ea('0xdb')){_0x1c20e7=_0x4e1048['status']['groupName'];return db[_0x22ea('0xa7')][_0x22ea('0x56')]({'where':{'messageId':_0x4e1048[_0x22ea('0x7f')]}});}break;case'clickatell':if(_0x54b1d6[_0x22ea('0x58')]['messageId']&&_0x54b1d6['body'][_0x22ea('0x2a')]){_0x1c20e7=_0x54b1d6['body'][_0x22ea('0x2a')];return db[_0x22ea('0xa7')][_0x22ea('0x56')]({'where':{'messageId':_0x54b1d6[_0x22ea('0x58')]['messageId']}});}break;case _0x22ea('0x8e'):if(_0x54b1d6[_0x22ea('0x58')][0x0][_0x22ea('0x27')]['id']){_0x1c20e7=_0x54b1d6[_0x22ea('0x58')][0x0][_0x22ea('0x7b')];return db['SmsMessage']['find']({'where':{'messageId':_0x54b1d6[_0x22ea('0x58')][0x0][_0x22ea('0x27')]['id']}});}break;case'intelepeer':if(_0x54b1d6['body']['redif']&&_0x54b1d6[_0x22ea('0x58')][_0x22ea('0x2a')]){_0x1c20e7=_0x54b1d6['body'][_0x22ea('0x2a')];return db['SmsMessage'][_0x22ea('0x56')]({'where':{'messageId':_0x54b1d6['body'][_0x22ea('0xdc')]}});}break;}}})[_0x22ea('0x20')](handleEntityNotFound(_0x21b208,null))[_0x22ea('0x20')](function(_0x93339){if(_0x93339){_0x4764d9=_0x93339;switch(_0x4e00df[_0x22ea('0x7b')]){case _0x22ea('0x81'):if(_0x1c20e7===_0x22ea('0xdb')){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger[_0x22ea('0x24')](_0x22ea('0xb3'),_0x22ea('0x2a'),_0x22ea('0x81'),util[_0x22ea('0xd4')](_0x54b1d6[_0x22ea('0x58')],{'showHidden':![],'depth':null}));}break;case _0x22ea('0x84'):if(_0x1c20e7==='1'){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22ea('0x2a'),_0x22ea('0x81'),util[_0x22ea('0xd4')](_0x54b1d6[_0x22ea('0x58')],{'showHidden':![],'depth':null}));}break;case _0x22ea('0x85'):if(!_0x54b1d6['body']['error_code']&&_0x1c20e7>=0xc8&&_0x1c20e7<=0xce){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger[_0x22ea('0x24')](_0x22ea('0xb3'),'status','clicksend',util['inspect'](_0x54b1d6[_0x22ea('0x58')],{'showHidden':![],'depth':null}));}break;case _0x22ea('0x87'):var _0x1c5ca0=_0x54b1d6[_0x22ea('0x58')]['results'][0x0];if(_0x1c5ca0['status'][_0x22ea('0xda')]==='DELIVERED'){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger[_0x22ea('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x22ea('0x2a'),'infobip',util[_0x22ea('0xd4')](_0x54b1d6['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x1c20e7==_0x22ea('0xdd')||_0x1c20e7=='RECEIVED_BY_RECIPIENT'){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger[_0x22ea('0x24')](_0x22ea('0xb3'),_0x22ea('0x2a'),_0x22ea('0x8c'),util[_0x22ea('0xd4')](_0x54b1d6['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x1c20e7==_0x22ea('0xde')){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger['error'](_0x22ea('0xb3'),'status','bandwidth',util['inspect'](_0x54b1d6['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1c20e7===_0x22ea('0xdf')||_0x1c20e7===_0x22ea('0xe0')){return _0x4764d9[_0x22ea('0x32')]({'read':!![]});}else{logger['error'](_0x22ea('0xb3'),'status',_0x22ea('0x8f'),util[_0x22ea('0xd4')](_0x54b1d6[_0x22ea('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4764d9;}})[_0x22ea('0x20')](respondWithResult(_0x21b208,null))['catch'](handleError(_0x21b208,null));};exports['statusGet']=function(_0x45b845,_0x144289,_0x7adaf5){var _0x4e2d50,_0xec18af,_0x2c5c68;return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x45b845[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x144289,null))[_0x22ea('0x20')](function(_0x550d8e){if(_0x550d8e){_0x2c5c68=_0x550d8e;logger[_0x22ea('0x23')](_0x22ea('0xb3'),_0x22ea('0x2a'),'received\x20delivery\x20report\x20from',_0x550d8e[_0x22ea('0x7b')],util[_0x22ea('0xd4')](_0x45b845['query'],{'showHidden':![],'depth':null}));switch(_0x550d8e[_0x22ea('0x7b')]){case _0x22ea('0x89'):if(_0x45b845[_0x22ea('0x3e')][_0x22ea('0xe1')]&&_0x45b845[_0x22ea('0x3e')][_0x22ea('0xe2')]){_0xec18af=_0x45b845[_0x22ea('0x3e')][_0x22ea('0xe2')];return db['SmsMessage'][_0x22ea('0x56')]({'where':{'messageId':_0x45b845[_0x22ea('0x3e')][_0x22ea('0xe1')]}});}break;}}})[_0x22ea('0x20')](handleEntityNotFound(_0x144289,null))['then'](function(_0x37b0d1){if(_0x37b0d1){_0x4e2d50=_0x37b0d1;switch(_0x2c5c68[_0x22ea('0x7b')]){case _0x22ea('0x89'):if(_0xec18af==='2'||_0xec18af==='6'){return _0x4e2d50[_0x22ea('0x32')]({'read':!![]});}else{logger[_0x22ea('0x24')](_0x22ea('0xb3'),_0x22ea('0x2a'),_0x22ea('0x89'),util['inspect'](_0x45b845[_0x22ea('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x4e2d50;}})[_0x22ea('0x20')](respondWithResult(_0x144289,null))[_0x22ea('0x29')](handleError(_0x144289,null));};exports[_0x22ea('0xe3')]=function(_0x2b73ce,_0x3b79db,_0x288ff0){return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x2b73ce[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x3b79db,null))[_0x22ea('0x20')](function(_0x21feac){if(_0x21feac){return _0x21feac[_0x22ea('0xe3')](_0x2b73ce['body'][_0x22ea('0x68')],_[_0x22ea('0x9c')](_0x2b73ce[_0x22ea('0x58')],[_0x22ea('0x68'),'id'])||{})['spread'](function(_0x5878df){for(var _0x4bb404=0x0;_0x4bb404<_0x2b73ce[_0x22ea('0x58')]['ids']['length'];_0x4bb404+=0x1){socket[_0x22ea('0xe4')](_0x22ea('0xe5'),{'UserId':Number(_0x2b73ce['body'][_0x22ea('0x68')][_0x4bb404]),'SmsAccountId':Number(_0x2b73ce[_0x22ea('0x53')]['id'])});}return _0x5878df;});}})[_0x22ea('0x20')](respondWithResult(_0x3b79db,null))[_0x22ea('0x29')](handleError(_0x3b79db,null));};exports[_0x22ea('0xe6')]=function(_0x1cb87c,_0x482b7d,_0x4f778e){return db[_0x22ea('0x4f')][_0x22ea('0x56')]({'where':{'id':_0x1cb87c[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x482b7d,null))[_0x22ea('0x20')](function(_0x52d419){if(_0x52d419){return _0x52d419[_0x22ea('0xe6')](_0x1cb87c[_0x22ea('0x3e')]['ids'])[_0x22ea('0x20')](function(){if(_['isArray'](_0x1cb87c[_0x22ea('0x3e')][_0x22ea('0x68')])){for(var _0x48ef44=0x0;_0x48ef44<_0x1cb87c[_0x22ea('0x3e')][_0x22ea('0x68')][_0x22ea('0x43')];_0x48ef44+=0x1){socket[_0x22ea('0xe4')](_0x22ea('0xe7'),{'UserId':Number(_0x1cb87c[_0x22ea('0x3e')][_0x22ea('0x68')][_0x48ef44]),'SmsAccountId':Number(_0x1cb87c[_0x22ea('0x53')]['id'])});}}else{socket[_0x22ea('0xe4')](_0x22ea('0xe7'),{'UserId':Number(_0x1cb87c[_0x22ea('0x3e')][_0x22ea('0x68')]),'SmsAccountId':Number(_0x1cb87c[_0x22ea('0x53')]['id'])});}});}})[_0x22ea('0x20')](respondWithStatusCode(_0x482b7d,null))[_0x22ea('0x29')](handleError(_0x482b7d,null));};exports[_0x22ea('0xe8')]=function(_0x1b986b,_0x459a4b,_0x3cc21c){var _0x26abaa={};var _0x50216c={};var _0x26f6ea;var _0x828638;return db['SmsAccount']['findOne']({'where':{'id':_0x1b986b[_0x22ea('0x53')]['id']}})[_0x22ea('0x20')](handleEntityNotFound(_0x459a4b,null))[_0x22ea('0x20')](function(_0x4ace16){if(_0x4ace16){_0x26f6ea=_0x4ace16;_0x50216c[_0x22ea('0x3d')]=_[_0x22ea('0x54')](db[_0x22ea('0xaa')][_0x22ea('0x3b')]);_0x50216c['query']=_[_0x22ea('0x54')](_0x1b986b[_0x22ea('0x3e')]);_0x50216c[_0x22ea('0x3f')]=_[_0x22ea('0x40')](_0x50216c[_0x22ea('0x3d')],_0x50216c['query']);_0x26abaa['attributes']=_['intersection'](_0x50216c[_0x22ea('0x3d')],qs[_0x22ea('0x42')](_0x1b986b[_0x22ea('0x3e')][_0x22ea('0x42')]));_0x26abaa[_0x22ea('0x41')]=_0x26abaa['attributes'][_0x22ea('0x43')]?_0x26abaa['attributes']:_0x50216c['model'];_0x26abaa[_0x22ea('0x46')]=qs[_0x22ea('0x47')](_0x1b986b[_0x22ea('0x3e')][_0x22ea('0x47')]);_0x26abaa['where']=qs[_0x22ea('0x3f')](_[_0x22ea('0x49')](_0x1b986b[_0x22ea('0x3e')],_0x50216c[_0x22ea('0x3f')]));if(_0x1b986b[_0x22ea('0x3e')]['filter']){_0x26abaa[_0x22ea('0x48')]=_[_0x22ea('0x4b')](_0x26abaa[_0x22ea('0x48')],{'$or':_['map'](_0x26abaa['attributes'],function(_0xd59a2c){var _0x48402e={};_0x48402e[_0xd59a2c]={'$like':'%'+_0x1b986b[_0x22ea('0x3e')][_0x22ea('0x4a')]+'%'};return _0x48402e;})});}_0x26abaa=_['merge']({},_0x26abaa,_0x1b986b[_0x22ea('0x4d')]);return _0x26f6ea[_0x22ea('0xe8')](_0x26abaa);}})[_0x22ea('0x20')](function(_0x554b24){if(_0x554b24){_0x828638=_0x554b24[_0x22ea('0x43')];if(!_0x1b986b[_0x22ea('0x3e')][_0x22ea('0x44')]('nolimit')){_0x26abaa[_0x22ea('0x45')]=qs[_0x22ea('0x45')](_0x1b986b['query'][_0x22ea('0x45')]);_0x26abaa[_0x22ea('0x2c')]=qs[_0x22ea('0x2c')](_0x1b986b[_0x22ea('0x3e')][_0x22ea('0x2c')]);}return _0x26f6ea[_0x22ea('0xe8')](_0x26abaa);}})['then'](function(_0x179351){if(_0x179351){return _0x179351?{'count':_0x828638,'rows':_0x179351}:null;}})['then'](respondWithResult(_0x459a4b,null))[_0x22ea('0x29')](handleError(_0x459a4b,null));}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f34b2f3..071a244 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 _0x9ec9=['remove','emit','hasOwnProperty','exports','update'];(function(_0x546a0e,_0x3dda63){var _0x3d1acd=function(_0x4d4a90){while(--_0x4d4a90){_0x546a0e['push'](_0x546a0e['shift']());}};_0x3d1acd(++_0x3dda63);}(_0x9ec9,0x6d));var _0x99ec=function(_0x10c2d3,_0x2f5914){_0x10c2d3=_0x10c2d3-0x0;var _0x5a0b13=_0x9ec9[_0x10c2d3];return _0x5a0b13;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x99ec('0x0'),'afterDestroy':_0x99ec('0x1')};function emitEvent(_0x4a6bac){return function(_0x3e0a21,_0x2341f6,_0x45ed79){SmsAccountEvents[_0x99ec('0x2')](_0x4a6bac+':'+_0x3e0a21['id'],_0x3e0a21);SmsAccountEvents[_0x99ec('0x2')](_0x4a6bac,_0x3e0a21);_0x45ed79(null);};}for(var e in events){if(events[_0x99ec('0x3')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x99ec('0x4')]=SmsAccountEvents; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index dd18e36..4c5bb17 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 _0x72a4=['../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x72a4,0x164));var _0x472a=function(_0x5ee89d,_0x1a7c29){_0x5ee89d=_0x5ee89d-0x0;var _0x3fa4cc=_0x72a4[_0x5ee89d];return _0x3fa4cc;};'use strict';var _=require(_0x472a('0x0'));var util=require(_0x472a('0x1'));var logger=require(_0x472a('0x2'))(_0x472a('0x3'));var moment=require(_0x472a('0x4'));var BPromise=require(_0x472a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x472a('0x6'));var rimraf=require(_0x472a('0x7'));var config=require(_0x472a('0x8'));var attributes=require('./smsAccount.attributes');module[_0x472a('0x9')]=function(_0x28f665,_0x5bfda0){return _0x28f665[_0x472a('0xa')](_0x472a('0xb'),attributes,{'tableName':_0x472a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b2daa00..de98a9f 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 _0x2c0e=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','options','raw','attributes','map','model','include','ShowSmsAccount','stringify','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x2508c2,_0x366d23){var _0x10cfce=function(_0x54adec){while(--_0x54adec){_0x2508c2['push'](_0x2508c2['shift']());}};_0x10cfce(++_0x366d23);}(_0x2c0e,0xcd));var _0xe2c0=function(_0x1fc7b5,_0x5d4779){_0x1fc7b5=_0x1fc7b5-0x0;var _0x3ef5db=_0x2c0e[_0x1fc7b5];return _0x3ef5db;};'use strict';var _=require('lodash');var util=require(_0xe2c0('0x0'));var moment=require(_0xe2c0('0x1'));var BPromise=require(_0xe2c0('0x2'));var rs=require(_0xe2c0('0x3'));var fs=require('fs');var Redis=require(_0xe2c0('0x4'));var db=require(_0xe2c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2c0('0x6'))(_0xe2c0('0x7'));var config=require(_0xe2c0('0x8'));var jayson=require(_0xe2c0('0x9'));var client=jayson[_0xe2c0('0xa')][_0xe2c0('0xb')]({'port':0x232a});config[_0xe2c0('0xc')]=_['defaults'](config[_0xe2c0('0xc')],{'host':_0xe2c0('0xd'),'port':0x18eb});var socket=require(_0xe2c0('0xe'))(new Redis(config[_0xe2c0('0xc')]));require(_0xe2c0('0xf'))[_0xe2c0('0x10')](socket);function respondWithRpcPromise(_0x331925,_0xeae0,_0x2a7450){return new BPromise(function(_0x297648,_0x4a1336){return client['request'](_0x331925,_0x2a7450)[_0xe2c0('0x11')](function(_0x96ee73){logger[_0xe2c0('0x12')]('SmsAccount,\x20%s,\x20%s',_0xeae0,_0xe2c0('0x13'));logger[_0xe2c0('0x14')](_0xe2c0('0x15'),_0xeae0,_0xe2c0('0x13'),JSON['stringify'](_0x96ee73));if(_0x96ee73[_0xe2c0('0x16')]){if(_0x96ee73[_0xe2c0('0x16')][_0xe2c0('0x17')]===0x1f4){logger[_0xe2c0('0x16')](_0xe2c0('0x18'),_0xeae0,_0x96ee73[_0xe2c0('0x16')][_0xe2c0('0x19')]);return _0x4a1336(_0x96ee73[_0xe2c0('0x16')][_0xe2c0('0x19')]);}logger['error'](_0xe2c0('0x18'),_0xeae0,_0x96ee73['error'][_0xe2c0('0x19')]);return _0x297648(_0x96ee73[_0xe2c0('0x16')][_0xe2c0('0x19')]);}else{logger[_0xe2c0('0x12')](_0xe2c0('0x18'),_0xeae0,_0xe2c0('0x13'));_0x297648(_0x96ee73['result'][_0xe2c0('0x19')]);}})['catch'](function(_0x4c5969){logger[_0xe2c0('0x16')](_0xe2c0('0x18'),_0xeae0,_0x4c5969);_0x4a1336(_0x4c5969);});});}exports['ShowSmsAccount']=function(_0x1005da){var _0xca2db7=this;return new Promise(function(_0x3d7876,_0x19d517){return db['SmsAccount']['find']({'raw':_0x1005da[_0xe2c0('0x1a')]?_0x1005da[_0xe2c0('0x1a')][_0xe2c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x1005da[_0xe2c0('0x1a')]?_0x1005da[_0xe2c0('0x1a')]['where']||null:null,'attributes':_0x1005da[_0xe2c0('0x1a')]?_0x1005da[_0xe2c0('0x1a')][_0xe2c0('0x1c')]||null:null,'include':_0x1005da[_0xe2c0('0x1a')]?_0x1005da[_0xe2c0('0x1a')]['include']?_[_0xe2c0('0x1d')](_0x1005da[_0xe2c0('0x1a')]['include'],function(_0x5543d2){return{'model':db[_0x5543d2[_0xe2c0('0x1e')]],'as':_0x5543d2['as'],'attributes':_0x5543d2['attributes'],'include':_0x5543d2[_0xe2c0('0x1f')]?_[_0xe2c0('0x1d')](_0x5543d2[_0xe2c0('0x1f')],function(_0x4600c8){return{'model':db[_0x4600c8[_0xe2c0('0x1e')]],'as':_0x4600c8['as'],'attributes':_0x4600c8[_0xe2c0('0x1c')],'include':_0x4600c8[_0xe2c0('0x1f')]?_[_0xe2c0('0x1d')](_0x4600c8[_0xe2c0('0x1f')],function(_0x5461e1){return{'model':db[_0x5461e1[_0xe2c0('0x1e')]],'as':_0x5461e1['as'],'attributes':_0x5461e1[_0xe2c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe2c0('0x11')](function(_0xcaa235){logger[_0xe2c0('0x12')](_0xe2c0('0x20'),_0x1005da);logger['debug'](_0xe2c0('0x20'),_0x1005da,JSON[_0xe2c0('0x21')](_0xcaa235));_0x3d7876(_0xcaa235);})[_0xe2c0('0x22')](function(_0x35dcf1){logger['error'](_0xe2c0('0x20'),_0x35dcf1[_0xe2c0('0x19')],_0x1005da);_0x19d517(_0xca2db7[_0xe2c0('0x16')](0x1f4,_0x35dcf1[_0xe2c0('0x19')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e4cd7a9..b0f0678 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_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 diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index faa672c..4358eca 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2f1040,_0x435ee9){var _0x2f4e09=function(_0x571a62){while(--_0x571a62){_0x2f1040['push'](_0x2f1040['shift']());}};_0x2f4e09(++_0x435ee9);}(_0xedd9,0xfc));var _0x9edd=function(_0x154d19,_0x549ae9){_0x154d19=_0x154d19-0x0;var _0x2a2a47=_0xedd9[_0x154d19];return _0x2a2a47;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1310a7c..9754e4b 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 _0xc0ac=['STRING','*,*,*,*','sequelize','exports','noop'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc0ac,0x66));var _0xcc0a=function(_0x57fcf7,_0x4ac030){_0x57fcf7=_0x57fcf7-0x0;var _0x2a1aa1=_0xc0ac[_0x57fcf7];return _0x2a1aa1;};'use strict';var Sequelize=require(_0xcc0a('0x0'));module[_0xcc0a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcc0a('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcc0a('0x3')]},'interval':{'type':Sequelize[_0xcc0a('0x3')],'defaultValue':_0xcc0a('0x4')}}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5dc8554..d50334b 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 _0xae2b=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','options','includeAll','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xae2b,0x120));var _0xbae2=function(_0x253289,_0x4899f9){_0x253289=_0x253289-0x0;var _0x29661b=_0xae2b[_0x253289];return _0x29661b;};'use strict';var emlformat=require(_0xbae2('0x0'));var rimraf=require(_0xbae2('0x1'));var zipdir=require(_0xbae2('0x2'));var jsonpatch=require(_0xbae2('0x3'));var rp=require(_0xbae2('0x4'));var moment=require(_0xbae2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbae2('0x6'));var util=require(_0xbae2('0x7'));var path=require(_0xbae2('0x8'));var sox=require('sox');var csv=require(_0xbae2('0x9'));var ejs=require(_0xbae2('0xa'));var fs=require('fs');var fs_extra=require(_0xbae2('0xb'));var _=require(_0xbae2('0xc'));var squel=require(_0xbae2('0xd'));var crypto=require(_0xbae2('0xe'));var jsforce=require(_0xbae2('0xf'));var deskjs=require(_0xbae2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbae2('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbae2('0x12'));var qs=require(_0xbae2('0x13'));var as=require(_0xbae2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbae2('0x15'))(_0xbae2('0x16'));var utils=require(_0xbae2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbae2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c493,_0x9e978e){_0x9e978e=_0x9e978e||0xcc;return function(_0x4b37bf){if(_0x4b37bf){return _0x11c493[_0xbae2('0x19')](_0x9e978e);}return _0x11c493[_0xbae2('0x1a')](_0x9e978e)[_0xbae2('0x1b')]();};}function respondWithResult(_0x13cc5c,_0x5c77c0){_0x5c77c0=_0x5c77c0||0xc8;return function(_0x12a5e1){if(_0x12a5e1){return _0x13cc5c[_0xbae2('0x1a')](_0x5c77c0)[_0xbae2('0x1c')](_0x12a5e1);}};}function respondWithFilteredResult(_0x430334,_0x168476){return function(_0xac29f6){if(_0xac29f6){var _0x56cfd6=typeof _0x168476[_0xbae2('0x1d')]===_0xbae2('0x1e')&&typeof _0x168476[_0xbae2('0x1f')]===_0xbae2('0x1e');var _0x127227=_0xac29f6[_0xbae2('0x20')];var _0x251274=_0x56cfd6?0x0:_0x168476[_0xbae2('0x1d')];var _0x4e40ce=_0x56cfd6?_0xac29f6[_0xbae2('0x20')]:_0x168476['offset']+_0x168476[_0xbae2('0x1f')];var _0x36c9b1;if(_0x4e40ce>=_0x127227){_0x4e40ce=_0x127227;_0x36c9b1=0xc8;}else{_0x36c9b1=0xce;}_0x430334[_0xbae2('0x1a')](_0x36c9b1);return _0x430334['set'](_0xbae2('0x21'),_0x251274+'-'+_0x4e40ce+'/'+_0x127227)[_0xbae2('0x1c')](_0xac29f6);}return null;};}function patchUpdates(_0x4081f7){return function(_0xf5dc2){try{jsonpatch['apply'](_0xf5dc2,_0x4081f7,!![]);}catch(_0x2176f4){return BPromise[_0xbae2('0x22')](_0x2176f4);}return _0xf5dc2[_0xbae2('0x23')]();};}function saveUpdates(_0x5263bd,_0x5ca6db){return function(_0x370d58){if(_0x370d58){return _0x370d58[_0xbae2('0x24')](_0x5263bd)[_0xbae2('0x25')](function(_0x152d48){return _0x152d48;});}return null;};}function removeEntity(_0x5db4b2,_0x2da0a0){return function(_0x353266){if(_0x353266){return _0x353266[_0xbae2('0x26')]()['then'](function(){_0x5db4b2[_0xbae2('0x1a')](0xcc)[_0xbae2('0x1b')]();});}};}function handleEntityNotFound(_0x301983,_0x90d270){return function(_0x415f7a){if(!_0x415f7a){_0x301983[_0xbae2('0x19')](0x194);}return _0x415f7a;};}function handleError(_0x16ecea,_0x202b01){_0x202b01=_0x202b01||0x1f4;return function(_0x56c984){logger[_0xbae2('0x27')](_0x56c984[_0xbae2('0x28')]);if(_0x56c984[_0xbae2('0x29')]){delete _0x56c984[_0xbae2('0x29')];}_0x16ecea['status'](_0x202b01)[_0xbae2('0x2a')](_0x56c984);};}exports[_0xbae2('0x2b')]=function(_0x2db3f7,_0x53e380){var _0x373df6={},_0x4ae67a={},_0x5283ec={'count':0x0,'rows':[]};var _0x8f9c3f=_[_0xbae2('0x2c')](db[_0xbae2('0x2d')][_0xbae2('0x2e')],function(_0x2323bf){return{'name':_0x2323bf[_0xbae2('0x2f')],'type':_0x2323bf[_0xbae2('0x30')][_0xbae2('0x31')]};});_0x4ae67a[_0xbae2('0x32')]=_[_0xbae2('0x2c')](_0x8f9c3f,'name');_0x4ae67a[_0xbae2('0x33')]=_[_0xbae2('0x34')](_0x2db3f7[_0xbae2('0x33')]);_0x4ae67a[_0xbae2('0x35')]=_[_0xbae2('0x36')](_0x4ae67a[_0xbae2('0x32')],_0x4ae67a['query']);_0x373df6[_0xbae2('0x37')]=_[_0xbae2('0x36')](_0x4ae67a[_0xbae2('0x32')],qs[_0xbae2('0x38')](_0x2db3f7[_0xbae2('0x33')][_0xbae2('0x38')]));_0x373df6[_0xbae2('0x37')]=_0x373df6['attributes'][_0xbae2('0x39')]?_0x373df6[_0xbae2('0x37')]:_0x4ae67a['model'];if(!_0x2db3f7['query']['hasOwnProperty'](_0xbae2('0x3a'))){_0x373df6['limit']=qs[_0xbae2('0x1f')](_0x2db3f7[_0xbae2('0x33')][_0xbae2('0x1f')]);_0x373df6[_0xbae2('0x1d')]=qs['offset'](_0x2db3f7[_0xbae2('0x33')][_0xbae2('0x1d')]);}_0x373df6[_0xbae2('0x3b')]=qs['sort'](_0x2db3f7[_0xbae2('0x33')]['sort']);_0x373df6[_0xbae2('0x3c')]=qs['filters'](_['pick'](_0x2db3f7[_0xbae2('0x33')],_0x4ae67a[_0xbae2('0x35')]),_0x8f9c3f);if(_0x2db3f7[_0xbae2('0x33')][_0xbae2('0x3d')]){_0x373df6[_0xbae2('0x3c')]=_[_0xbae2('0x3e')](_0x373df6[_0xbae2('0x3c')],{'$or':_[_0xbae2('0x2c')](_0x8f9c3f,function(_0x581b4f){if(_0x581b4f['type']!=='VIRTUAL'){var _0x593ec0={};_0x593ec0[_0x581b4f['name']]={'$like':'%'+_0x2db3f7['query'][_0xbae2('0x3d')]+'%'};return _0x593ec0;}})});}_0x373df6=_['merge']({},_0x373df6,_0x2db3f7[_0xbae2('0x3f')]);var _0x25ddc9={'where':_0x373df6[_0xbae2('0x3c')]};return db[_0xbae2('0x2d')][_0xbae2('0x20')](_0x25ddc9)[_0xbae2('0x25')](function(_0x31581e){_0x5283ec[_0xbae2('0x20')]=_0x31581e;if(_0x2db3f7[_0xbae2('0x33')][_0xbae2('0x40')]){_0x373df6['include']=[{'all':!![]}];}return db['SmsApplication'][_0xbae2('0x41')](_0x373df6);})['then'](function(_0x1e1dce){_0x5283ec[_0xbae2('0x42')]=_0x1e1dce;return _0x5283ec;})[_0xbae2('0x25')](respondWithFilteredResult(_0x53e380,_0x373df6))['catch'](handleError(_0x53e380,null));};exports[_0xbae2('0x43')]=function(_0x2f6721,_0x2053ab){var _0xc2aff2={'raw':!![],'where':{'id':_0x2f6721[_0xbae2('0x44')]['id']}},_0x325298={};_0x325298[_0xbae2('0x32')]=_['keys'](db[_0xbae2('0x2d')]['rawAttributes']);_0x325298[_0xbae2('0x33')]=_[_0xbae2('0x34')](_0x2f6721[_0xbae2('0x33')]);_0x325298[_0xbae2('0x35')]=_['intersection'](_0x325298[_0xbae2('0x32')],_0x325298[_0xbae2('0x33')]);_0xc2aff2['attributes']=_[_0xbae2('0x36')](_0x325298[_0xbae2('0x32')],qs[_0xbae2('0x38')](_0x2f6721['query'][_0xbae2('0x38')]));_0xc2aff2['attributes']=_0xc2aff2[_0xbae2('0x37')][_0xbae2('0x39')]?_0xc2aff2[_0xbae2('0x37')]:_0x325298[_0xbae2('0x32')];if(_0x2f6721[_0xbae2('0x33')][_0xbae2('0x40')]){_0xc2aff2['include']=[{'all':!![]}];}_0xc2aff2=_['merge']({},_0xc2aff2,_0x2f6721[_0xbae2('0x3f')]);return db['SmsApplication']['find'](_0xc2aff2)['then'](handleEntityNotFound(_0x2053ab,null))[_0xbae2('0x25')](respondWithResult(_0x2053ab,null))[_0xbae2('0x45')](handleError(_0x2053ab,null));};exports[_0xbae2('0x46')]=function(_0x151b9b,_0x2e9a21){return db[_0xbae2('0x2d')][_0xbae2('0x46')](_0x151b9b[_0xbae2('0x47')],{})[_0xbae2('0x25')](respondWithResult(_0x2e9a21,0xc9))[_0xbae2('0x45')](handleError(_0x2e9a21,null));};exports[_0xbae2('0x24')]=function(_0x51e4f2,_0x204d82){if(_0x51e4f2[_0xbae2('0x47')]['id']){delete _0x51e4f2['body']['id'];}return db[_0xbae2('0x2d')][_0xbae2('0x48')]({'where':{'id':_0x51e4f2[_0xbae2('0x44')]['id']}})[_0xbae2('0x25')](handleEntityNotFound(_0x204d82,null))[_0xbae2('0x25')](saveUpdates(_0x51e4f2[_0xbae2('0x47')],null))['then'](respondWithResult(_0x204d82,null))[_0xbae2('0x45')](handleError(_0x204d82,null));};exports['destroy']=function(_0x4e523c,_0x5a1534){return db[_0xbae2('0x2d')]['find']({'where':{'id':_0x4e523c[_0xbae2('0x44')]['id']}})[_0xbae2('0x25')](handleEntityNotFound(_0x5a1534,null))[_0xbae2('0x25')](removeEntity(_0x5a1534,null))[_0xbae2('0x45')](handleError(_0x5a1534,null));}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index fe3f082..e5c1a68 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 _0x7e06=['exports','define','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x2dfb19,_0x557cf1){var _0x4f99da=function(_0x30341e){while(--_0x30341e){_0x2dfb19['push'](_0x2dfb19['shift']());}};_0x4f99da(++_0x557cf1);}(_0x7e06,0x1b0));var _0x67e0=function(_0xa1e60d,_0x4e426b){_0xa1e60d=_0xa1e60d-0x0;var _0x4d7381=_0x7e06[_0xa1e60d];return _0x4d7381;};'use strict';var _=require('lodash');var util=require(_0x67e0('0x0'));var logger=require(_0x67e0('0x1'))(_0x67e0('0x2'));var moment=require(_0x67e0('0x3'));var BPromise=require(_0x67e0('0x4'));var rp=require(_0x67e0('0x5'));var fs=require('fs');var path=require(_0x67e0('0x6'));var rimraf=require(_0x67e0('0x7'));var config=require(_0x67e0('0x8'));var attributes=require(_0x67e0('0x9'));module[_0x67e0('0xa')]=function(_0x32b223,_0x3d8edd){return _0x32b223[_0x67e0('0xb')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x67e0('0xc')});}; \ No newline at end of file +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 diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6fb539e..506cd8b 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 _0xeba2=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xeba2,0x70));var _0x2eba=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xeba2[_0x38c632];return _0x12737e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2eba('0x0'));var BPromise=require(_0x2eba('0x1'));var rs=require(_0x2eba('0x2'));var fs=require('fs');var Redis=require(_0x2eba('0x3'));var db=require(_0x2eba('0x4'))['db'];var utils=require(_0x2eba('0x5'));var logger=require(_0x2eba('0x6'))(_0x2eba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2eba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4d9a,_0x14c40a,_0x4e7a50){return new BPromise(function(_0x279806,_0x1fed79){return client[_0x2eba('0x9')](_0x1b4d9a,_0x4e7a50)[_0x2eba('0xa')](function(_0x1cc4e){logger[_0x2eba('0xb')](_0x2eba('0xc'),_0x14c40a,_0x2eba('0xd'));logger[_0x2eba('0xe')](_0x2eba('0xf'),_0x14c40a,'request\x20sent',JSON[_0x2eba('0x10')](_0x1cc4e));if(_0x1cc4e[_0x2eba('0x11')]){if(_0x1cc4e['error'][_0x2eba('0x12')]===0x1f4){logger[_0x2eba('0x11')](_0x2eba('0xc'),_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x1fed79(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x14c40a,_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);return _0x279806(_0x1cc4e[_0x2eba('0x11')][_0x2eba('0x13')]);}else{logger[_0x2eba('0xb')]('SmsApplication,\x20%s,\x20%s',_0x14c40a,_0x2eba('0xd'));_0x279806(_0x1cc4e[_0x2eba('0x14')][_0x2eba('0x13')]);}})[_0x2eba('0x15')](function(_0x2de66e){logger['error'](_0x2eba('0xc'),_0x14c40a,_0x2de66e);_0x1fed79(_0x2de66e);});});} \ No newline at end of file +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 diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index bc14b70..c243775 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 _0x9348=['addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x9348,0x10d));var _0x8934=function(_0x237c8c,_0x21d4c5){_0x237c8c=_0x237c8c-0x0;var _0x42e698=_0x9348[_0x237c8c];return _0x42e698;};'use strict';var multer=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var path=require(_0x8934('0x2'));var timeout=require(_0x8934('0x3'));var express=require(_0x8934('0x4'));var router=express['Router']();var fs_extra=require(_0x8934('0x5'));var auth=require(_0x8934('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8934('0x7'));var controller=require(_0x8934('0x8'));router[_0x8934('0x9')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0xb')]);router[_0x8934('0x9')]('/describe',auth[_0x8934('0xa')](),controller[_0x8934('0xc')]);router[_0x8934('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8934('0xd'),auth['isAuthenticated'](),controller[_0x8934('0xe')]);router[_0x8934('0x9')](_0x8934('0xf'),auth[_0x8934('0xa')](),controller[_0x8934('0x10')]);router[_0x8934('0x11')]('/',auth[_0x8934('0xa')](),controller[_0x8934('0x12')]);router['post'](_0x8934('0xd'),auth[_0x8934('0xa')](),controller[_0x8934('0x13')]);router[_0x8934('0x11')](_0x8934('0x14'),auth[_0x8934('0xa')](),interaction['tracked'](_0x8934('0x15'),_0x8934('0x16')),controller[_0x8934('0x17')]);router[_0x8934('0x18')](_0x8934('0x19'),auth[_0x8934('0xa')](),interaction[_0x8934('0x1a')](_0x8934('0x15'),'smsinteraction:update'),controller[_0x8934('0x1b')]);router[_0x8934('0x1c')](_0x8934('0x19'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x8934('0x1d')),controller['destroy']);router[_0x8934('0x1c')](_0x8934('0x14'),auth[_0x8934('0xa')](),controller[_0x8934('0x1e')]);module[_0x8934('0x1f')]=router; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e4465ad..ccfcd6c 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 _0xda2d=['out','INTEGER','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xda2d,0x102));var _0xdda2=function(_0x1de2f2,_0x27271c){_0x1de2f2=_0x1de2f2-0x0;var _0x4746c5=_0xda2d[_0x1de2f2];return _0x4746c5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdda2('0x0'));module[_0xdda2('0x1')]={'closed':{'type':Sequelize[_0xdda2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdda2('0x3')]},'disposition':{'type':Sequelize[_0xdda2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdda2('0x4')]},'read1stAt':{'type':Sequelize[_0xdda2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdda2('0x5')]('in',_0xdda2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdda2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdda2('0x5')]('in',_0xdda2('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdda2('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdda2('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c5318d4..7a7efb2 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 _0x378c=['SmsInteractionId','map','$gte','split','format','rows','addTags','color','removeTags','download','toString','server','files','tmp','join','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Messages','createdAt','direction','read','Account','Sms','Owner','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','filter','out','System','firstName','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','SmsInteraction','rawAttributes','key','getOptions','findAll','sms','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','keys','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x5bbda1,_0x2fdf26){var _0x341e27=function(_0x4bebf3){while(--_0x4bebf3){_0x5bbda1['push'](_0x5bbda1['shift']());}};_0x341e27(++_0x2fdf26);}(_0x378c,0x1e1));var _0xc378=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x378c[_0x3e5086];return _0xfeb102;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc378('0x0'));var moment=require(_0xc378('0x1'));var BPromise=require(_0xc378('0x2'));var util=require(_0xc378('0x3'));var path=require(_0xc378('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc378('0x5'));var Redis=require(_0xc378('0x6'));var interaction=require(_0xc378('0x7'));var qs=require(_0xc378('0x8'));var pdf=require(_0xc378('0x9'));var logger=require(_0xc378('0xa'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc378('0xb')]=_['defaults'](config[_0xc378('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc378('0xc'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xc378('0xd')](socket);function respondWithStatusCode(_0x153247,_0x418ce){_0x418ce=_0x418ce||0xcc;return function(_0x36765e){if(_0x36765e){return _0x153247[_0xc378('0xe')](_0x418ce);}return _0x153247[_0xc378('0xf')](_0x418ce)[_0xc378('0x10')]();};}function respondWithResult(_0x1be2c4,_0x12e42b){_0x12e42b=_0x12e42b||0xc8;return function(_0x5e7344){if(_0x5e7344){return _0x1be2c4[_0xc378('0xf')](_0x12e42b)[_0xc378('0x11')](_0x5e7344);}};}function respondWithFilteredResult(_0x342d88,_0x56db85){return function(_0x242163){if(_0x242163){var _0x50d821=typeof _0x56db85[_0xc378('0x12')]==='undefined'&&typeof _0x56db85['limit']===_0xc378('0x13');var _0x443940=_0x242163['count'];var _0x5ca3af=_0x50d821?0x0:_0x56db85[_0xc378('0x12')];var _0x22ac0b=_0x50d821?_0x242163[_0xc378('0x14')]:_0x56db85['offset']+_0x56db85[_0xc378('0x15')];var _0x4209e8;if(_0x22ac0b>=_0x443940){_0x22ac0b=_0x443940;_0x4209e8=0xc8;}else{_0x4209e8=0xce;}_0x342d88[_0xc378('0xf')](_0x4209e8);return _0x342d88[_0xc378('0x16')](_0xc378('0x17'),_0x5ca3af+'-'+_0x22ac0b+'/'+_0x443940)[_0xc378('0x11')](_0x242163);}return null;};}function saveUpdates(_0xa814c3){return function(_0x45b569){if(_0x45b569){return _0x45b569[_0xc378('0x18')](_0xa814c3)[_0xc378('0x19')](function(_0x1e0082){return _0x1e0082;});}return null;};}function removeEntity(_0x729ba4){return function(_0x437a5e){if(_0x437a5e){return _0x437a5e[_0xc378('0x1a')]()['then'](function(){_0x729ba4[_0xc378('0xf')](0xcc)[_0xc378('0x10')]();});}};}function handleEntityNotFound(_0x233d51){return function(_0x53e40f){if(!_0x53e40f){_0x233d51['sendStatus'](0x194);}return _0x53e40f;};}function handleError(_0x177088,_0x2b5bf0){_0x2b5bf0=_0x2b5bf0||0x1f4;return function(_0x1ac4b7){logger[_0xc378('0x1b')](_0x1ac4b7[_0xc378('0x1c')]);if(_0x1ac4b7[_0xc378('0x1d')]){delete _0x1ac4b7[_0xc378('0x1d')];}_0x177088[_0xc378('0xf')](_0x2b5bf0)[_0xc378('0x1e')](_0x1ac4b7);};}exports['index']=function(_0x36d013,_0x43c1e3){var _0x4869e5={};var _0xfc05e9=_['map'](db[_0xc378('0x1f')][_0xc378('0x20')],function(_0x1f32e2){return{'name':_0x1f32e2['fieldName'],'type':_0x1f32e2['type'][_0xc378('0x21')]};});_0x4869e5=qs[_0xc378('0x22')](_0xfc05e9,_0x36d013);return interaction[_0xc378('0x23')](_0xc378('0x24'),_0x36d013[_0xc378('0x25')],_0x36d013['user'],_0x4869e5,_0xfc05e9)['then'](respondWithFilteredResult(_0x43c1e3,_0x4869e5))['catch'](handleError(_0x43c1e3,null));};exports['show']=function(_0x43ef91,_0x2ea104){var _0x4ded03={'raw':![],'where':{'id':_0x43ef91['params']['id']}},_0x227b86={};_0x227b86['model']=_['keys'](db[_0xc378('0x1f')][_0xc378('0x20')]);_0x227b86[_0xc378('0x25')]=_['keys'](_0x43ef91['query']);_0x227b86[_0xc378('0x26')]=_[_0xc378('0x27')](_0x227b86[_0xc378('0x28')],_0x227b86['query']);_0x4ded03[_0xc378('0x29')]=_[_0xc378('0x27')](_0x227b86['model'],qs[_0xc378('0x2a')](_0x43ef91[_0xc378('0x25')][_0xc378('0x2a')]));_0x4ded03['attributes']=_0x4ded03[_0xc378('0x29')][_0xc378('0x2b')]?_0x4ded03[_0xc378('0x29')]:_0x227b86[_0xc378('0x28')];if(_0x43ef91['query'][_0xc378('0x2c')]){_0x4ded03['include']=[{'all':!![]}];}_0x4ded03=_[_0xc378('0x2d')]({},_0x4ded03,_0x43ef91[_0xc378('0x2e')]);return db[_0xc378('0x1f')][_0xc378('0x2f')](_0x4ded03)[_0xc378('0x19')](handleEntityNotFound(_0x2ea104,null))[_0xc378('0x19')](respondWithResult(_0x2ea104,null))[_0xc378('0x30')](handleError(_0x2ea104,null));};exports[_0xc378('0x31')]=function(_0x558e16,_0x21d212){return db[_0xc378('0x1f')][_0xc378('0x31')](_0x558e16[_0xc378('0x32')],{})['then'](respondWithResult(_0x21d212,0xc9))[_0xc378('0x30')](handleError(_0x21d212,null));};exports[_0xc378('0x18')]=function(_0x5894ae,_0x3af6c1){if(_0x5894ae[_0xc378('0x32')]['id']){delete _0x5894ae['body']['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x5894ae[_0xc378('0x33')]['id']}})[_0xc378('0x19')](handleEntityNotFound(_0x3af6c1,null))['then'](saveUpdates(_0x5894ae[_0xc378('0x32')],null))[_0xc378('0x19')](respondWithResult(_0x3af6c1,null))[_0xc378('0x30')](handleError(_0x3af6c1,null));};exports[_0xc378('0x1a')]=function(_0x3f82a8,_0x1dfc82){return db[_0xc378('0x1f')][_0xc378('0x2f')]({'where':{'id':_0x3f82a8[_0xc378('0x33')]['id']}})[_0xc378('0x19')](handleEntityNotFound(_0x1dfc82,null))['then'](removeEntity(_0x1dfc82,null))[_0xc378('0x30')](handleError(_0x1dfc82,null));};exports[_0xc378('0x34')]=function(_0x51e8b0,_0x3b8db4){return db[_0xc378('0x1f')][_0xc378('0x34')]()[_0xc378('0x19')](respondWithResult(_0x3b8db4,null))['catch'](handleError(_0x3b8db4,null));};exports[_0xc378('0x35')]=function(_0x2c2961,_0x3088b7){return db[_0xc378('0x36')]['find']({'where':{'id':_0x2c2961[_0xc378('0x33')]['id']}})[_0xc378('0x19')](handleEntityNotFound(_0x3088b7,null))['then'](function(_0x2154dc){if(_0x2154dc){return _0x2154dc[_0xc378('0x35')](_0x2c2961['body']['ids'],_['omit'](_0x2c2961['body'],[_0xc378('0x37'),'id'])||{});}})[_0xc378('0x19')](respondWithResult(_0x3088b7,null))['catch'](handleError(_0x3088b7,null));};exports[_0xc378('0x38')]=function(_0x1685a1,_0x3d0489){var _0x377147={'raw':![],'where':{}};var _0x2aaa72={};var _0x2e2737={'count':0x0,'rows':[]};return db[_0xc378('0x1f')][_0xc378('0x39')]({'where':{'id':_0x1685a1[_0xc378('0x33')]['id']}})[_0xc378('0x19')](handleEntityNotFound(_0x3d0489,null))[_0xc378('0x19')](function(_0x48632a){if(_0x48632a){_0x2aaa72[_0xc378('0x28')]=_[_0xc378('0x3a')](db[_0xc378('0x36')][_0xc378('0x20')]);_0x2aaa72[_0xc378('0x25')]=_[_0xc378('0x3a')](_0x1685a1['query']);_0x2aaa72[_0xc378('0x26')]=_[_0xc378('0x27')](_0x2aaa72[_0xc378('0x28')],_0x2aaa72[_0xc378('0x25')]);_0x377147[_0xc378('0x29')]=_['intersection'](_0x2aaa72['model'],qs[_0xc378('0x2a')](_0x1685a1[_0xc378('0x25')][_0xc378('0x2a')]));_0x377147[_0xc378('0x29')]=_0x377147[_0xc378('0x29')]['length']?_0x377147[_0xc378('0x29')]:_0x2aaa72[_0xc378('0x28')];if(!_0x1685a1['query'][_0xc378('0x3b')](_0xc378('0x3c'))){_0x377147[_0xc378('0x15')]=qs[_0xc378('0x15')](_0x1685a1['query'][_0xc378('0x15')]);_0x377147[_0xc378('0x12')]=qs[_0xc378('0x12')](_0x1685a1['query']['offset']);}_0x377147['order']=qs[_0xc378('0x3d')](_0x1685a1[_0xc378('0x25')][_0xc378('0x3d')]);_0x377147[_0xc378('0x3e')]=qs[_0xc378('0x26')](_[_0xc378('0x3f')](_0x1685a1['query'],_0x2aaa72[_0xc378('0x26')]));_0x377147['where'][_0xc378('0x40')]=_0x48632a['id'];if(_0x1685a1[_0xc378('0x25')]['filter']){_0x377147[_0xc378('0x3e')]=_['merge'](_0x377147[_0xc378('0x3e')],{'$or':_[_0xc378('0x41')](_0x377147[_0xc378('0x29')],function(_0x5b85ba){var _0x3bb3a6={};_0x3bb3a6[_0x5b85ba]={'$like':'%'+_0x1685a1[_0xc378('0x25')]['filter']+'%'};return _0x3bb3a6;})});}if(_0x1685a1[_0xc378('0x25')]['$gte']){var _0x1f7635=_0x1685a1[_0xc378('0x25')][_0xc378('0x42')][_0xc378('0x43')](',');var _0x4bf03b={};_0x4bf03b[_0x1f7635[0x0]]={'$gte':moment(_0x1f7635[0x1])[_0xc378('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x377147[_0xc378('0x3e')]=_[_0xc378('0x2d')](_0x377147['where'],_0x4bf03b);}_0x377147=_['merge']({},_0x377147,_0x1685a1[_0xc378('0x2e')]);return db[_0xc378('0x36')][_0xc378('0x14')]({'where':_0x377147[_0xc378('0x3e')]})[_0xc378('0x19')](function(_0x148b35){_0x2e2737[_0xc378('0x14')]=_0x148b35;if(_0x1685a1[_0xc378('0x25')][_0xc378('0x2c')]){_0x377147['include']=[{'all':!![]}];}return db[_0xc378('0x36')][_0xc378('0x23')](_0x377147);})[_0xc378('0x19')](function(_0x3b9015){_0x2e2737[_0xc378('0x45')]=_0x3b9015;return _0x2e2737;});}})[_0xc378('0x19')](respondWithFilteredResult(_0x3d0489,_0x377147))[_0xc378('0x30')](handleError(_0x3d0489,null));};exports[_0xc378('0x46')]=function(_0x3fe271,_0x17cc91){return db[_0xc378('0x1f')]['find']({'where':{'id':_0x3fe271[_0xc378('0x33')]['id']}})['then'](handleEntityNotFound(_0x17cc91,null))[_0xc378('0x19')](function(_0x45ce22){if(_0x45ce22){return _0x45ce22['setTags'](_0x3fe271[_0xc378('0x32')][_0xc378('0x37')],_['omit'](_0x3fe271['body'],[_0xc378('0x37'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xc378('0x1d'),_0xc378('0x47')],'where':{'id':_0x3fe271[_0xc378('0x32')][_0xc378('0x37')]}});})[_0xc378('0x19')](function(_0x3f4ef1){socket['emit']('smsInteractionTags:save',{'id':Number(_0x3fe271[_0xc378('0x33')]['id']),'tags':_0x3f4ef1||[]});return{'id':Number(_0x3fe271[_0xc378('0x33')]['id']),'tags':_0x3f4ef1||[]};});}})[_0xc378('0x19')](respondWithResult(_0x17cc91,null))['catch'](handleError(_0x17cc91,null));};exports[_0xc378('0x48')]=function(_0x3821fe,_0x538727){return db[_0xc378('0x1f')][_0xc378('0x2f')]({'where':{'id':_0x3821fe['params']['id']}})[_0xc378('0x19')](handleEntityNotFound(_0x538727,null))[_0xc378('0x19')](function(_0x12c012){if(_0x12c012){return _0x12c012[_0xc378('0x48')](_0x3821fe['query'][_0xc378('0x37')]);}})['then'](respondWithStatusCode(_0x538727,null))[_0xc378('0x30')](handleError(_0x538727,null));};exports[_0xc378('0x49')]=function(_0x2ae844,_0x3ccf2){var _0x3a3900=moment()['unix']()[_0xc378('0x4a')]();var _0x30274b=path['join'](config['root'],_0xc378('0x4b'),_0xc378('0x4c'),_0xc378('0x4d'));var _0x44dc99=path[_0xc378('0x4e')](_0x30274b,_0x3a3900);var _0x3ef861=util[_0xc378('0x44')](_0xc378('0x4f'),_0x2ae844[_0xc378('0x33')]['id'],_0x3a3900);var _0x5a79fc=path[_0xc378('0x4e')](_0x30274b,_0x3ef861);var _0x137b3f=[];_0x137b3f[_0xc378('0x50')]({'model':db[_0xc378('0x51')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x137b3f['push']({'model':db[_0xc378('0x52')],'as':_0xc378('0x53'),'attributes':['id','firstName',_0xc378('0x54')],'raw':!![]});var _0xd3d3dd=[{'model':db[_0xc378('0x36')],'as':_0xc378('0x55'),'attributes':['id',_0xc378('0x32'),_0xc378('0x56'),_0xc378('0x57'),'secret',_0xc378('0x58')],'include':_0x137b3f}];_0xd3d3dd[_0xc378('0x50')]({'model':db['SmsAccount'],'as':_0xc378('0x59'),'attributes':['id',_0xc378('0x1d')]});_0xd3d3dd['push']({'model':db[_0xc378('0x51')],'as':'Owner','attributes':['id','fullname']});return db[_0xc378('0x1f')][_0xc378('0x2f')]({'where':{'id':_0x2ae844[_0xc378('0x33')]['id']},'include':_0xd3d3dd})[_0xc378('0x19')](handleEntityNotFound(_0x3ccf2,null))[_0xc378('0x19')](function(_0x2e195c){if(_0x2e195c){var _0x558e0e=_0x2e195c['get']({'plain':!![]});fs['mkdirSync'](_0x44dc99);var _0x539e78={'channel':_0xc378('0x5a'),'account':_0x558e0e[_0xc378('0x59')][_0xc378('0x1d')],'agent':_0x558e0e['Owner']?_0x558e0e[_0xc378('0x5b')][_0xc378('0x5c')]:_0xc378('0x5d'),'createdAt':moment(_0x558e0e['createdAt'])[_0xc378('0x44')](_0xc378('0x5e'))[_0xc378('0x4a')](),'closedAt':_0x558e0e[_0xc378('0x5f')]?moment(_0x558e0e[_0xc378('0x60')])[_0xc378('0x44')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc378('0x4a')]():'','disposition':_0x558e0e[_0xc378('0x61')],'messages':_(_0x558e0e[_0xc378('0x55')])[_0xc378('0x62')]({'secret':![]})[_0xc378('0x41')](function(_0x6a14f){return{'date':moment(_0x6a14f[_0xc378('0x56')])[_0xc378('0x44')](_0xc378('0x5e'))[_0xc378('0x4a')](),'sender':_0x6a14f[_0xc378('0x57')]===_0xc378('0x63')?_0x6a14f[_0xc378('0x51')]?_0x6a14f[_0xc378('0x51')][_0xc378('0x5c')]:_0xc378('0x64'):_0x6a14f[_0xc378('0x53')][_0xc378('0x65')]+(_0x6a14f[_0xc378('0x53')]['lastName']?'\x20'+_0x6a14f[_0xc378('0x53')][_0xc378('0x54')]:''),'body':_0x6a14f[_0xc378('0x32')],'direction':_0x6a14f[_0xc378('0x57')]===_0xc378('0x63')?'A':'C','secret':_0x6a14f['secret'],'read':_0x6a14f['read']};})['value']()};return ejs[_0xc378('0x66')](path[_0xc378('0x4e')](config[_0xc378('0x67')],_0xc378('0x4b'),_0xc378('0x68'),_0xc378('0x69')),{'interaction':_0x539e78})['then'](function(_0x2dc674){var _0x3a0c0e=path[_0xc378('0x4e')](_0x44dc99,'transcript-'+_0x558e0e['id']+'-'+_0x3a3900+_0xc378('0x6a'));var _0x399225={'path':_0x3a0c0e,'channel':_0xc378('0x5a'),'interactionId':_0x558e0e['id']};return pdf[_0xc378('0x6b')](_0x2dc674,_0x399225);})[_0xc378('0x19')](function(){return new BPromise(function(_0x584503,_0x45e9fc){zipdir(_0x44dc99,{'saveTo':_0x5a79fc},function(_0x248568,_0xbc73ae){if(_0x248568)return _0x45e9fc(_0x248568);return _0x584503(_0xbc73ae);});})[_0xc378('0x19')](function(){return new BPromise(function(_0x533402,_0x1956e5){rimraf(_0x44dc99,function(_0x47d702){if(_0x47d702)_0x1956e5(_0x47d702);return _0x533402();});});})[_0xc378('0x19')](function(){return _0x3ccf2[_0xc378('0x49')](_0x5a79fc,_0x3ef861,function(_0x18e78c){if(_0x18e78c){console['log'](_0xc378('0x6c'),_0x18e78c);}else{fs['unlinkSync'](_0x5a79fc);}});});});}else{return _0x3ccf2[_0xc378('0xe')](0xc8);}})['catch'](handleError(_0x3ccf2,null));}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 82c2a1c..1833b0d 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 _0x5fdc=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x4bf494,_0x3731fd){var _0x5801fe=function(_0x4cca14){while(--_0x4cca14){_0x4bf494['push'](_0x4bf494['shift']());}};_0x5801fe(++_0x3731fd);}(_0x5fdc,0x127));var _0xc5fd=function(_0x2e0626,_0xcc48be){_0x2e0626=_0x2e0626-0x0;var _0x1232e4=_0x5fdc[_0x2e0626];return _0x1232e4;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var SmsInteraction=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var SmsMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5fd('0x4')](0x0);var events={'afterCreate':_0xc5fd('0x5'),'afterUpdate':_0xc5fd('0x6'),'afterDestroy':_0xc5fd('0x7')};function emitEvent(_0x1b6205){return function(_0xca27a0,_0xea5748,_0x44722b){_0xca27a0[_0xc5fd('0x8')]({'attributes':['id'],'raw':!![]})[_0xc5fd('0x9')](function(_0x5a2eb4){_0xca27a0['setDataValue']('Users',_0x5a2eb4[_0xc5fd('0xa')](function(_0x46bce3){return{'id':_0x46bce3['id']};}));return SmsMessage[_0xc5fd('0xb')]({'where':{'SmsInteractionId':_0xca27a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5fd('0x9')](function(_0x4e6d35){_0xca27a0['setDataValue'](_0xc5fd('0xc'),_0x4e6d35[_0xc5fd('0xd')]);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205+':'+_0xca27a0['id'],_0xca27a0);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205,_0xca27a0);_0x44722b(null);})[_0xc5fd('0xf')](_0x44722b(null));};}for(var e in events){if(events[_0xc5fd('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc5fd('0x11')]=SmsInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9ba8e08..252ab77 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 _0xf1e8=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed'];(function(_0x372a45,_0x2ade34){var _0x10bb05=function(_0x512c77){while(--_0x512c77){_0x372a45['push'](_0x372a45['shift']());}};_0x10bb05(++_0x2ade34);}(_0xf1e8,0x69));var _0x8f1e=function(_0x29a3b7,_0x470850){_0x29a3b7=_0x29a3b7-0x0;var _0x2da824=_0xf1e8[_0x29a3b7];return _0x2da824;};'use strict';var _=require('lodash');var util=require(_0x8f1e('0x0'));var logger=require(_0x8f1e('0x1'))(_0x8f1e('0x2'));var moment=require(_0x8f1e('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f1e('0x4'));var fs=require('fs');var path=require(_0x8f1e('0x5'));var rimraf=require(_0x8f1e('0x6'));var config=require(_0x8f1e('0x7'));var attributes=require(_0x8f1e('0x8'));module[_0x8f1e('0x9')]=function(_0xb9a050,_0x283f3e){return _0xb9a050[_0x8f1e('0xa')](_0x8f1e('0xb'),attributes,{'tableName':_0x8f1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d567e,_0x5c1394,_0x3c955d){if(_0x1d567e['changed'](_0x8f1e('0xd'))){_0x1d567e[_0x8f1e('0xe')]=moment()[_0x8f1e('0xf')](_0x8f1e('0x10'));}_0x3c955d(null,_0x1d567e);}}});}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3280d7d..3a3290e 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 _0xdb2f=['options','raw','where','attributes','then','debug','stringify','AddTagsToSmsInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body'];(function(_0x1716ca,_0x4b9ffa){var _0x348b42=function(_0x28361d){while(--_0x28361d){_0x1716ca['push'](_0x1716ca['shift']());}};_0x348b42(++_0x4b9ffa);}(_0xdb2f,0x15c));var _0xfdb2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb2f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfdb2('0x0'));var util=require(_0xfdb2('0x1'));var moment=require(_0xfdb2('0x2'));var BPromise=require(_0xfdb2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdb2('0x4'));var db=require(_0xfdb2('0x5'))['db'];var utils=require(_0xfdb2('0x6'));var logger=require(_0xfdb2('0x7'))(_0xfdb2('0x8'));var config=require(_0xfdb2('0x9'));var jayson=require(_0xfdb2('0xa'));var client=jayson['client'][_0xfdb2('0xb')]({'port':0x232a});config[_0xfdb2('0xc')]=_[_0xfdb2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfdb2('0xe'))(new Redis(config['redis']));require(_0xfdb2('0xf'))[_0xfdb2('0x10')](socket);function respondWithRpcPromise(_0x4a933e,_0x7dad30,_0x2786a5){return new BPromise(function(_0x31d04a,_0x2af714){return client[_0xfdb2('0x11')](_0x4a933e,_0x2786a5)['then'](function(_0x4eabe2){logger[_0xfdb2('0x12')](_0xfdb2('0x13'),_0x7dad30,'request\x20sent');logger['debug'](_0xfdb2('0x14'),_0x7dad30,_0xfdb2('0x15'),JSON['stringify'](_0x4eabe2));if(_0x4eabe2[_0xfdb2('0x16')]){if(_0x4eabe2[_0xfdb2('0x16')]['code']===0x1f4){logger[_0xfdb2('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x7dad30,_0x4eabe2[_0xfdb2('0x16')][_0xfdb2('0x17')]);return _0x2af714(_0x4eabe2[_0xfdb2('0x16')][_0xfdb2('0x17')]);}logger[_0xfdb2('0x16')](_0xfdb2('0x13'),_0x7dad30,_0x4eabe2[_0xfdb2('0x16')][_0xfdb2('0x17')]);return _0x31d04a(_0x4eabe2['error'][_0xfdb2('0x17')]);}else{logger[_0xfdb2('0x12')](_0xfdb2('0x13'),_0x7dad30,_0xfdb2('0x15'));_0x31d04a(_0x4eabe2[_0xfdb2('0x18')]['message']);}})[_0xfdb2('0x19')](function(_0x48578d){logger[_0xfdb2('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x7dad30,_0x48578d);_0x2af714(_0x48578d);});});}exports[_0xfdb2('0x1a')]=function(_0x4a5f1e){var _0x307619=this;return new Promise(function(_0x30976c,_0x33cb2c){return db[_0xfdb2('0x1b')][_0xfdb2('0x1c')](_0x4a5f1e[_0xfdb2('0x1d')],{'raw':_0x4a5f1e[_0xfdb2('0x1e')]?_0x4a5f1e[_0xfdb2('0x1e')][_0xfdb2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5f1e['options']?_0x4a5f1e[_0xfdb2('0x1e')][_0xfdb2('0x20')]||null:null,'attributes':_0x4a5f1e[_0xfdb2('0x1e')]?_0x4a5f1e[_0xfdb2('0x1e')][_0xfdb2('0x21')]||null:null,'limit':_0x4a5f1e[_0xfdb2('0x1e')]?_0x4a5f1e[_0xfdb2('0x1e')]['limit']||null:null})[_0xfdb2('0x22')](function(_0x59ae6a){logger[_0xfdb2('0x12')](_0xfdb2('0x1a'),_0x4a5f1e);logger[_0xfdb2('0x23')]('UpdateSmsInteraction',_0x4a5f1e,JSON[_0xfdb2('0x24')](_0x59ae6a));_0x30976c(_0x59ae6a);})[_0xfdb2('0x19')](function(_0x583fda){logger['error'](_0xfdb2('0x1a'),_0x583fda[_0xfdb2('0x17')],_0x4a5f1e);_0x33cb2c(_0x307619['error'](0x1f4,_0x583fda['message']));});});};exports[_0xfdb2('0x25')]=function(_0x45fd10){return new Promise(function(_0x3bedd5,_0x173b33){return db[_0xfdb2('0x1b')][_0xfdb2('0x26')]({'where':_0x45fd10[_0xfdb2('0x1e')]?_0x45fd10[_0xfdb2('0x1e')][_0xfdb2('0x20')]||null:null})[_0xfdb2('0x22')](function(_0x5eb809){if(_0x5eb809){return _0x5eb809[_0xfdb2('0x27')](_0x45fd10[_0xfdb2('0x1d')][_0xfdb2('0x28')],_['omit'](_0x45fd10[_0xfdb2('0x1d')],['ids','id'])||{});}})['spread'](function(_0x363bdd){logger['info'](_0xfdb2('0x29'),_0x45fd10);logger[_0xfdb2('0x23')](_0xfdb2('0x29'),_0x45fd10,JSON[_0xfdb2('0x24')](_0x363bdd));_0x3bedd5(_0x363bdd);})[_0xfdb2('0x19')](function(_0x19aac1){logger[_0xfdb2('0x16')]('AddTags',_0x19aac1[_0xfdb2('0x17')],_0x45fd10);_0x173b33(_this['error'](0x1f4,_0x19aac1[_0xfdb2('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5831803..ae93508 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 _0x6fa6=['length','./smsInteraction.events','save','remove','removeListener'];(function(_0x4c556e,_0x1504af){var _0x389475=function(_0x12937f){while(--_0x12937f){_0x4c556e['push'](_0x4c556e['shift']());}};_0x389475(++_0x1504af);}(_0x6fa6,0x14b));var _0x66fa=function(_0xac2784,_0x3e4161){_0xac2784=_0xac2784-0x0;var _0x18dae0=_0x6fa6[_0xac2784];return _0x18dae0;};'use strict';var SmsInteractionEvents=require(_0x66fa('0x0'));var events=[_0x66fa('0x1'),_0x66fa('0x2'),'update'];function createListener(_0x4258c2,_0x4cfa56){return function(_0x19b96d){_0x4cfa56['emit'](_0x4258c2,_0x19b96d);};}function removeListener(_0x59275e,_0xa43263){return function(){SmsInteractionEvents[_0x66fa('0x3')](_0x59275e,_0xa43263);};}exports['register']=function(_0x350ea7){for(var _0xedb622=0x0,_0x579873=events[_0x66fa('0x4')];_0xedb622<_0x579873;_0xedb622++){var _0x46791e=events[_0xedb622];var _0xb337ed=createListener('smsInteraction:'+_0x46791e,_0x350ea7);SmsInteractionEvents['on'](_0x46791e,_0xb337ed);}}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 3ab4876..f2d0266 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 _0xeff6=['tracked','create','status','put','update','accept','/:id/reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post'];(function(_0x4a8e76,_0x1bca49){var _0x582d70=function(_0x131988){while(--_0x131988){_0x4a8e76['push'](_0x4a8e76['shift']());}};_0x582d70(++_0x1bca49);}(_0xeff6,0xf9));var _0x6eff=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeff6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6eff('0x0'));var util=require(_0x6eff('0x1'));var path=require(_0x6eff('0x2'));var timeout=require(_0x6eff('0x3'));var express=require(_0x6eff('0x4'));var router=express[_0x6eff('0x5')]();var fs_extra=require(_0x6eff('0x6'));var auth=require(_0x6eff('0x7'));var interaction=require(_0x6eff('0x8'));var config=require(_0x6eff('0x9'));var controller=require('./smsMessage.controller');router[_0x6eff('0xa')]('/',auth[_0x6eff('0xb')](),controller['index']);router['get']('/describe',auth[_0x6eff('0xb')](),controller['describe']);router[_0x6eff('0xa')](_0x6eff('0xc'),auth[_0x6eff('0xb')](),controller[_0x6eff('0xd')]);router[_0x6eff('0xe')]('/',auth['isAuthenticated'](),interaction[_0x6eff('0xf')]('sms','smsmessage:create'),controller[_0x6eff('0x10')]);router[_0x6eff('0xe')]('/:id/status',controller[_0x6eff('0x11')]);router[_0x6eff('0x12')]('/:id',auth[_0x6eff('0xb')](),controller[_0x6eff('0x13')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x6eff('0x14')]);router[_0x6eff('0x12')](_0x6eff('0x15'),auth[_0x6eff('0xb')](),controller['reject']);router['delete'](_0x6eff('0xc'),auth[_0x6eff('0xb')](),controller[_0x6eff('0x16')]);module[_0x6eff('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 79f4958..72492eb 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 _0x9b8a=['out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x9b8a,0x106));var _0xa9b8=function(_0x13b70c,_0x40be1c){_0x13b70c=_0x13b70c-0x0;var _0x2d0edd=_0x9b8a[_0x13b70c];return _0x2d0edd;};'use strict';var Sequelize=require(_0xa9b8('0x0'));module[_0xa9b8('0x1')]={'body':{'type':Sequelize[_0xa9b8('0x2')](_0xa9b8('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa9b8('0x4')),'defaultValue':_0xa9b8('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa9b8('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa9b8('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa9b8('0x5')]},'providerResponse':{'type':Sequelize[_0xa9b8('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0726ee5..9f02937 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 _0x930b=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','map','SmsMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','create','body','params','find','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE: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','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','ContactId','sequelize','event','SmsAccount','SmsAccountId','inspect','type','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','infobip','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request'];(function(_0x4a0a1b,_0x2715d1){var _0xe101df=function(_0x2db51e){while(--_0x2db51e){_0x4a0a1b['push'](_0x4a0a1b['shift']());}};_0xe101df(++_0x2715d1);}(_0x930b,0x106));var _0xb930=function(_0x4ca684,_0x1e9556){_0x4ca684=_0x4ca684-0x0;var _0x4a357c=_0x930b[_0x4ca684];return _0x4a357c;};'use strict';var emlformat=require(_0xb930('0x0'));var rimraf=require(_0xb930('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb930('0x2'));var rp=require(_0xb930('0x3'));var moment=require(_0xb930('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb930('0x5'));var path=require(_0xb930('0x6'));var sox=require(_0xb930('0x7'));var csv=require('to-csv');var ejs=require(_0xb930('0x8'));var fs=require('fs');var fs_extra=require(_0xb930('0x9'));var _=require(_0xb930('0xa'));var squel=require('squel');var crypto=require(_0xb930('0xb'));var jsforce=require(_0xb930('0xc'));var deskjs=require(_0xb930('0xd'));var toCsv=require(_0xb930('0xe'));var querystring=require(_0xb930('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb930('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb930('0x11'));var hardwareService=require(_0xb930('0x12'));var logger=require(_0xb930('0x13'))(_0xb930('0x14'));var utils=require(_0xb930('0x15'));var config=require(_0xb930('0x16'));var licenseUtil=require(_0xb930('0x17'));var db=require(_0xb930('0x18'))['db'];config['redis']=_['defaults'](config[_0xb930('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xb930('0x1a'))(new Redis(config[_0xb930('0x19')]));require('./smsMessage.socket')[_0xb930('0x1b')](socket);var jayson=require(_0xb930('0x1c'));var client=jayson[_0xb930('0x1d')][_0xb930('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xb930('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2631c9,_0x5d10fe,_0x2833b8,_0x4268e8){return new BPromise(function(_0x496aef,_0x191617){var _0x171e72=_0x4268e8||client;return _0x171e72[_0xb930('0x1f')](_0x2631c9,_0x2833b8)[_0xb930('0x20')](function(_0x1ad4f5){logger[_0xb930('0x21')](_0xb930('0x22'),_0x5d10fe,_0xb930('0x23'));logger[_0xb930('0x24')](_0xb930('0x25'),_0x5d10fe,_0xb930('0x23'),JSON['stringify'](_0x1ad4f5));if(_0x1ad4f5[_0xb930('0x26')]){if(_0x1ad4f5['error'][_0xb930('0x27')]===0x1f4){logger[_0xb930('0x26')](_0xb930('0x22'),_0x5d10fe,_0x1ad4f5[_0xb930('0x26')][_0xb930('0x28')]);return _0x191617(_0x1ad4f5['error'][_0xb930('0x28')]);}logger['error'](_0xb930('0x22'),_0x5d10fe,_0x1ad4f5['error'][_0xb930('0x28')]);return _0x496aef(_0x1ad4f5[_0xb930('0x26')][_0xb930('0x28')]);}else{logger[_0xb930('0x21')](_0xb930('0x22'),_0x5d10fe,_0xb930('0x23'));_0x496aef(_0x1ad4f5[_0xb930('0x29')]['message']);}})[_0xb930('0x2a')](function(_0x1fa805){logger[_0xb930('0x26')](_0xb930('0x22'),_0x5d10fe,_0x1fa805);_0x191617(_0x1fa805);});});}function respondWithStatusCode(_0x5ac173,_0x45f733){_0x45f733=_0x45f733||0xcc;return function(_0x56f524){if(_0x56f524){return _0x5ac173['sendStatus'](_0x45f733);}return _0x5ac173[_0xb930('0x2b')](_0x45f733)[_0xb930('0x2c')]();};}function respondWithResult(_0x2ab4c9,_0x2dadb3){_0x2dadb3=_0x2dadb3||0xc8;return function(_0x4b8c4f){if(_0x4b8c4f){return _0x2ab4c9[_0xb930('0x2b')](_0x2dadb3)[_0xb930('0x2d')](_0x4b8c4f);}};}function respondWithFilteredResult(_0x4f79ef,_0x248340){return function(_0x36ca4a){if(_0x36ca4a){var _0x3d45c2=typeof _0x248340[_0xb930('0x2e')]===_0xb930('0x2f')&&typeof _0x248340[_0xb930('0x30')]===_0xb930('0x2f');var _0x3bcec1=_0x36ca4a[_0xb930('0x31')];var _0x925ac6=_0x3d45c2?0x0:_0x248340['offset'];var _0x25a691=_0x3d45c2?_0x36ca4a[_0xb930('0x31')]:_0x248340[_0xb930('0x2e')]+_0x248340[_0xb930('0x30')];var _0x385c92;if(_0x25a691>=_0x3bcec1){_0x25a691=_0x3bcec1;_0x385c92=0xc8;}else{_0x385c92=0xce;}_0x4f79ef['status'](_0x385c92);return _0x4f79ef['set'](_0xb930('0x32'),_0x925ac6+'-'+_0x25a691+'/'+_0x3bcec1)['json'](_0x36ca4a);}return null;};}function patchUpdates(_0x535cb6){return function(_0x1c7e5a){try{jsonpatch[_0xb930('0x33')](_0x1c7e5a,_0x535cb6,!![]);}catch(_0x44a8b7){return BPromise[_0xb930('0x34')](_0x44a8b7);}return _0x1c7e5a[_0xb930('0x35')]();};}function saveUpdates(_0x3976f4,_0xbd1acb){return function(_0x131093){if(_0x131093){return _0x131093[_0xb930('0x36')](_0x3976f4)['then'](function(_0x12f106){return _0x12f106;});}return null;};}function removeEntity(_0x56e362,_0x10cd2c){return function(_0x8b168d){if(_0x8b168d){return _0x8b168d[_0xb930('0x37')]()[_0xb930('0x20')](function(){_0x56e362[_0xb930('0x2b')](0xcc)[_0xb930('0x2c')]();});}};}function handleEntityNotFound(_0x31caef,_0xcf567e){return function(_0x1f6bd7){if(!_0x1f6bd7){_0x31caef['sendStatus'](0x194);}return _0x1f6bd7;};}function handleError(_0x4b666f,_0x2491e1){_0x2491e1=_0x2491e1||0x1f4;return function(_0x3c45da){logger[_0xb930('0x26')](_0x3c45da['stack']);if(_0x3c45da[_0xb930('0x38')]){delete _0x3c45da[_0xb930('0x38')];}_0x4b666f['status'](_0x2491e1)[_0xb930('0x39')](_0x3c45da);};}exports['index']=function(_0x5496ce,_0x391186){var _0x38aa74={},_0x75b09b={},_0x4881c1={'count':0x0,'rows':[]};var _0x583516=_[_0xb930('0x3a')](db[_0xb930('0x3b')][_0xb930('0x3c')],function(_0x68f18b){return{'name':_0x68f18b[_0xb930('0x3d')],'type':_0x68f18b['type'][_0xb930('0x3e')]};});_0x75b09b[_0xb930('0x3f')]=_[_0xb930('0x3a')](_0x583516,_0xb930('0x38'));_0x75b09b['query']=_[_0xb930('0x40')](_0x5496ce[_0xb930('0x41')]);_0x75b09b[_0xb930('0x42')]=_[_0xb930('0x43')](_0x75b09b[_0xb930('0x3f')],_0x75b09b[_0xb930('0x41')]);_0x38aa74['attributes']=_[_0xb930('0x43')](_0x75b09b[_0xb930('0x3f')],qs['fields'](_0x5496ce[_0xb930('0x41')][_0xb930('0x44')]));_0x38aa74[_0xb930('0x45')]=_0x38aa74[_0xb930('0x45')][_0xb930('0x46')]?_0x38aa74[_0xb930('0x45')]:_0x75b09b[_0xb930('0x3f')];if(!_0x5496ce[_0xb930('0x41')][_0xb930('0x47')](_0xb930('0x48'))){_0x38aa74[_0xb930('0x30')]=qs[_0xb930('0x30')](_0x5496ce[_0xb930('0x41')]['limit']);_0x38aa74[_0xb930('0x2e')]=qs[_0xb930('0x2e')](_0x5496ce[_0xb930('0x41')][_0xb930('0x2e')]);}_0x38aa74['order']=qs[_0xb930('0x49')](_0x5496ce[_0xb930('0x41')][_0xb930('0x49')]);_0x38aa74[_0xb930('0x4a')]=qs[_0xb930('0x42')](_['pick'](_0x5496ce[_0xb930('0x41')],_0x75b09b[_0xb930('0x42')]),_0x583516);if(_0x5496ce[_0xb930('0x41')][_0xb930('0x4b')]){_0x38aa74[_0xb930('0x4a')]=_['merge'](_0x38aa74[_0xb930('0x4a')],{'$or':_[_0xb930('0x3a')](_0x583516,function(_0x344f2f){if(_0x344f2f['type']!==_0xb930('0x4c')){var _0x161a3e={};_0x161a3e[_0x344f2f['name']]={'$like':'%'+_0x5496ce[_0xb930('0x41')][_0xb930('0x4b')]+'%'};return _0x161a3e;}})});}_0x38aa74=_[_0xb930('0x4d')]({},_0x38aa74,_0x5496ce[_0xb930('0x4e')]);var _0x4ac807={'where':_0x38aa74[_0xb930('0x4a')]};return db[_0xb930('0x3b')][_0xb930('0x31')](_0x4ac807)[_0xb930('0x20')](function(_0x41094d){_0x4881c1[_0xb930('0x31')]=_0x41094d;if(_0x5496ce['query'][_0xb930('0x4f')]){_0x38aa74[_0xb930('0x50')]=[{'all':!![]}];}return db[_0xb930('0x3b')][_0xb930('0x51')](_0x38aa74);})[_0xb930('0x20')](function(_0x417d82){_0x4881c1[_0xb930('0x52')]=_0x417d82;return _0x4881c1;})[_0xb930('0x20')](respondWithFilteredResult(_0x391186,_0x38aa74))[_0xb930('0x2a')](handleError(_0x391186,null));};exports[_0xb930('0x53')]=function(_0x2b349d,_0x4c5b85){var _0x2c8fbe={'raw':!![],'where':{'id':_0x2b349d['params']['id']}},_0x30e498={};_0x30e498[_0xb930('0x3f')]=_[_0xb930('0x40')](db['SmsMessage'][_0xb930('0x3c')]);_0x30e498[_0xb930('0x41')]=_['keys'](_0x2b349d['query']);_0x30e498['filters']=_[_0xb930('0x43')](_0x30e498[_0xb930('0x3f')],_0x30e498['query']);_0x2c8fbe[_0xb930('0x45')]=_[_0xb930('0x43')](_0x30e498[_0xb930('0x3f')],qs[_0xb930('0x44')](_0x2b349d[_0xb930('0x41')]['fields']));_0x2c8fbe[_0xb930('0x45')]=_0x2c8fbe['attributes'][_0xb930('0x46')]?_0x2c8fbe[_0xb930('0x45')]:_0x30e498['model'];if(_0x2b349d[_0xb930('0x41')][_0xb930('0x4f')]){_0x2c8fbe[_0xb930('0x50')]=[{'all':!![]}];}_0x2c8fbe=_[_0xb930('0x4d')]({},_0x2c8fbe,_0x2b349d[_0xb930('0x4e')]);return db[_0xb930('0x3b')]['find'](_0x2c8fbe)[_0xb930('0x20')](handleEntityNotFound(_0x4c5b85,null))['then'](respondWithResult(_0x4c5b85,null))[_0xb930('0x2a')](handleError(_0x4c5b85,null));};exports['create']=function(_0x3e8870,_0x562a99){return db['SmsMessage'][_0xb930('0x54')](_0x3e8870[_0xb930('0x55')],{})['then'](respondWithResult(_0x562a99,0xc9))[_0xb930('0x2a')](handleError(_0x562a99,null));};exports[_0xb930('0x36')]=function(_0x59d4ea,_0x58b814){if(_0x59d4ea[_0xb930('0x55')]['id']){delete _0x59d4ea[_0xb930('0x55')]['id'];}return db[_0xb930('0x3b')]['find']({'where':{'id':_0x59d4ea[_0xb930('0x56')]['id']}})['then'](handleEntityNotFound(_0x58b814,null))[_0xb930('0x20')](saveUpdates(_0x59d4ea['body'],null))[_0xb930('0x20')](respondWithResult(_0x58b814,null))['catch'](handleError(_0x58b814,null));};exports[_0xb930('0x37')]=function(_0x699e4f,_0x32c435){return db[_0xb930('0x3b')][_0xb930('0x57')]({'where':{'id':_0x699e4f[_0xb930('0x56')]['id']}})[_0xb930('0x20')](handleEntityNotFound(_0x32c435,null))['then'](removeEntity(_0x32c435,null))['catch'](handleError(_0x32c435,null));};exports[_0xb930('0x58')]=function(_0x263b8e,_0x3c45a8){return db[_0xb930('0x3b')][_0xb930('0x58')]()[_0xb930('0x20')](respondWithResult(_0x3c45a8,null))[_0xb930('0x2a')](handleError(_0x3c45a8,null));};var interaction_log=require('../../config/logger')(_0xb930('0x59'));exports['accept']=function(_0x5a8d9b,_0x4c7779,_0xd917b3){var _0x47b7bf={'agent':{},'channel':_0xb930('0x5a')};if(_0x5a8d9b[_0xb930('0x55')]['id']){delete _0x5a8d9b[_0xb930('0x55')]['id'];}_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5b')]=!![];_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5c')]=moment()['format'](_0xb930('0x5d'));_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')]=_0x5a8d9b['body']['UserId']||_0x5a8d9b[_0xb930('0x5f')]['id'];_0x47b7bf[_0xb930('0x60')]['id']=_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')];return db[_0xb930('0x3b')]['find']({'where':{'id':_0x5a8d9b[_0xb930('0x56')]['id'],'UserId':null}})[_0xb930('0x20')](handleEntityNotFound(_0x4c7779,null))[_0xb930('0x20')](saveUpdates(_0x5a8d9b[_0xb930('0x55')],null))[_0xb930('0x20')](function(_0x411c6d){if(_0x411c6d){_0x47b7bf[_0xb930('0x28')]=_0x411c6d[_0xb930('0x61')]({'plain':!![]});return db[_0xb930('0x62')]['find']({'where':{'id':_0x411c6d[_0xb930('0x63')]}});}return null;})[_0xb930('0x20')](handleEntityNotFound(_0x4c7779,null))[_0xb930('0x20')](function(_0x17a0db){if(_0x17a0db){return _0x17a0db['update']({'UserId':_0x5a8d9b['body'][_0xb930('0x5e')],'read1stAt':_[_0xb930('0x64')](_0x17a0db[_0xb930('0x65')])?moment()[_0xb930('0x66')](_0xb930('0x5d')):undefined});}return null;})['then'](function(_0x1065ea){if(_0x1065ea){_0x47b7bf[_0xb930('0x67')]=_0x1065ea[_0xb930('0x61')]({'plain':!![]});interaction_log[_0xb930('0x21')](_0xb930('0x68'),_0x5a8d9b['user']['id'],_0x5a8d9b[_0xb930('0x5f')][_0xb930('0x38')],_0x5a8d9b[_0xb930('0x5f')][_0xb930('0x69')],_0x47b7bf[_0xb930('0x67')]['id'],_0x5a8d9b[_0xb930('0x55')]?JSON[_0xb930('0x6a')](_0x5a8d9b[_0xb930('0x55')]):_0xb930('0x6b'));return respondWithRpcPromise(_0xb930('0x6c'),_0xb930('0x6d'),_0x47b7bf);}return null;})['then'](function(_0x5ee0c3){var _0x18131b=_0xb930('0x6e')+_0x5ee0c3[_0xb930('0x28')]['ContactId'];return db['sequelize'][_0xb930('0x41')](_0x18131b,{'type':db[_0xb930('0x6f')][_0xb930('0x70')][_0xb930('0x71')],'raw':!![]})[_0xb930('0x20')](function(_0x219f1e){return _0x219f1e;});})['then'](function(_0xf8abf9){if(_0xf8abf9){_0x47b7bf[_0xb930('0x28')][_0xb930('0x72')]=_0xf8abf9[0x0];if(!_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')])return;return db[_0xb930('0x73')]['find']({'where':{'id':_0x5a8d9b[_0xb930('0x55')][_0xb930('0x5e')],'role':_0xb930('0x60')},'attributes':['id',_0xb930('0x38'),_0xb930('0x74'),_0xb930('0x75'),_0xb930('0x76')],'raw':!![]});}return null;})['then'](function(_0x1e6582){if(!_0x1e6582)return null;_0x47b7bf[_0xb930('0x28')]['agent']=_0x1e6582;return _0x47b7bf;})[_0xb930('0x20')](function(_0x4e990b){if(_0x4e990b){if(_0x5a8d9b[_0xb930('0x55')][_0xb930('0x77')]){_0x47b7bf['message'][_0xb930('0x78')]=util[_0xb930('0x66')](_0xb930('0x79'),_0x5a8d9b[_0xb930('0x5f')]['name']);_0x47b7bf[_0xb930('0x28')][_0xb930('0x7a')]=_0x47b7bf[_0xb930('0x7a')];_0x47b7bf[_0xb930('0x28')][_0xb930('0x7b')]=_0x47b7bf[_0xb930('0x7a')];_0x47b7bf[_0xb930('0x28')]['event']=_0xb930('0x7c');return respondWithRpcPromise(_0xb930('0x7d'),_0xb930('0x7d'),{'event':_0xb930('0x7e'),'message':_0x47b7bf[_0xb930('0x28')]},client9002)[_0xb930('0x20')](function(){return _0x47b7bf;});}return _0x47b7bf;}return null;})[_0xb930('0x20')](respondWithResult(_0x4c7779,null))['catch'](handleError(_0x4c7779,null));};var interaction_log=require(_0xb930('0x13'))(_0xb930('0x59'));exports[_0xb930('0x34')]=function(_0x519930,_0x4beab4,_0x586f60){var _0x25cc2e={'agent':{},'channel':_0xb930('0x5a')};if(_0x519930[_0xb930('0x55')]['id']){delete _0x519930[_0xb930('0x55')]['id'];}_0x519930[_0xb930('0x55')][_0xb930('0x5e')]=_0x519930[_0xb930('0x55')][_0xb930('0x5e')]||_0x519930[_0xb930('0x5f')]['id'];_0x25cc2e[_0xb930('0x60')]['id']=_0x519930['body']['UserId'];return db[_0xb930('0x3b')]['find']({'where':{'id':_0x519930['params']['id'],'UserId':null}})[_0xb930('0x20')](handleEntityNotFound(_0x4beab4,null))[_0xb930('0x20')](function(_0x59bebd){if(_0x59bebd){_0x25cc2e[_0xb930('0x28')]=_0x59bebd[_0xb930('0x61')]({'plain':!![]});return db[_0xb930('0x62')][_0xb930('0x57')]({'where':{'id':_0x59bebd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4beab4,null))[_0xb930('0x20')](function(_0x55fa5a){if(_0x55fa5a){_0x25cc2e[_0xb930('0x67')]=_0x55fa5a[_0xb930('0x61')]({'plain':!![]});interaction_log[_0xb930('0x21')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x519930[_0xb930('0x5f')]['id'],_0x519930[_0xb930('0x5f')][_0xb930('0x38')],_0x519930[_0xb930('0x5f')][_0xb930('0x69')],_0x25cc2e[_0xb930('0x67')]['id'],_0x519930['body']?JSON[_0xb930('0x6a')](_0x519930[_0xb930('0x55')]):_0xb930('0x6b'));return respondWithRpcPromise(_0xb930('0x7f'),_0xb930('0x80'),_0x25cc2e);}return null;})[_0xb930('0x20')](function(_0x74b28b){var _0x1a3ce3=_0xb930('0x6e')+_0x74b28b['message'][_0xb930('0x81')];return db[_0xb930('0x82')][_0xb930('0x41')](_0x1a3ce3,{'type':db[_0xb930('0x6f')][_0xb930('0x70')][_0xb930('0x71')],'raw':!![]})[_0xb930('0x20')](function(_0x194b91){return _0x194b91;});})[_0xb930('0x20')](function(_0x2f3ac3){if(_0x2f3ac3){_0x25cc2e[_0xb930('0x28')]['contact']=_0x2f3ac3[0x0];if(!_0x519930[_0xb930('0x55')][_0xb930('0x5e')])return;return db[_0xb930('0x73')]['find']({'where':{'id':_0x519930[_0xb930('0x55')]['UserId'],'role':_0xb930('0x60')},'attributes':['id',_0xb930('0x38'),'fullname','email',_0xb930('0x76')],'raw':!![]});}return null;})[_0xb930('0x20')](function(_0x1ade32){if(!_0x1ade32)return null;_0x25cc2e[_0xb930('0x28')][_0xb930('0x60')]=_0x1ade32;return _0x25cc2e;})[_0xb930('0x20')](function(_0x4f9f00){if(_0x4f9f00){_0x4f9f00[_0xb930('0x28')]['interface']=util[_0xb930('0x66')](_0xb930('0x79'),_0x519930[_0xb930('0x5f')][_0xb930('0x38')]);_0x4f9f00[_0xb930('0x28')]['channel']=_0x25cc2e['channel'];_0x4f9f00[_0xb930('0x28')][_0xb930('0x7b')]=_0x25cc2e[_0xb930('0x7a')];_0x4f9f00['message'][_0xb930('0x83')]=_0xb930('0x34');respondWithRpcPromise(_0xb930('0x7d'),'EventManager',{'event':'rejectmessage','message':_0x4f9f00[_0xb930('0x28')]},client9002);return _0x25cc2e;}return null;})[_0xb930('0x20')](respondWithResult(_0x4beab4,null))[_0xb930('0x2a')](handleError(_0x4beab4,null));};exports[_0xb930('0x2b')]=function(_0x4d6f06,_0x394a0c,_0x1253f2){if(_0x4d6f06[_0xb930('0x55')]['id']){delete _0x4d6f06[_0xb930('0x55')]['id'];}var _0x7e0502;return db[_0xb930('0x3b')][_0xb930('0x57')]({'where':{'id':_0x4d6f06[_0xb930('0x56')]['id']}})[_0xb930('0x20')](handleEntityNotFound(_0x394a0c,null))[_0xb930('0x20')](function(_0x50eb6b){if(_0x50eb6b){_0x7e0502=_0x50eb6b;return db[_0xb930('0x84')][_0xb930('0x57')]({'where':{'id':_0x50eb6b[_0xb930('0x85')]}});}})['then'](handleEntityNotFound(_0x394a0c,null))[_0xb930('0x20')](function(_0x362957){if(_0x362957){logger[_0xb930('0x24')](_0xb930('0x25'),_0xb930('0x2b'),'received\x20delivery\x20report\x20from',_0x362957['type'],util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));switch(_0x362957[_0xb930('0x87')]){case _0xb930('0x88'):if(_0x4d6f06[_0xb930('0x55')][_0xb930('0x89')]&&_0x4d6f06[_0xb930('0x55')]['MessageSid']===_0x7e0502[_0xb930('0x8a')]){return _0x7e0502[_0xb930('0x36')]({'read':!![]});}else{logger['error'](_0xb930('0x8b'),_0xb930('0x2b'),_0xb930('0x88'),util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));}break;case _0xb930('0x8c'):if(_0x4d6f06[_0xb930('0x55')][_0xb930('0x8d')]&&_0x4d6f06[_0xb930('0x55')][_0xb930('0x8d')]===_0x7e0502[_0xb930('0x8a')]&&_[_0xb930('0x8e')]([_0xb930('0x8f'),'delivered'],_0x4d6f06[_0xb930('0x55')]['Status'])>=0x0){return _0x7e0502[_0xb930('0x36')]({'read':!![]});}else{logger[_0xb930('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb930('0x2b'),'plivio',util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));}break;case _0xb930('0x90'):var _0x4e240b=_0x4d6f06[_0xb930('0x55')]['results'][0x0];if(_0x4e240b['status'][_0xb930('0x91')]===_0xb930('0x92')){return _0x7e0502['update']({'read':!![]});}else{logger[_0xb930('0x26')](_0xb930('0x8b'),'status',_0xb930('0x90'),util[_0xb930('0x86')](_0x4d6f06[_0xb930('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x7e0502;}})[_0xb930('0x20')](respondWithResult(_0x394a0c,null))[_0xb930('0x2a')](handleError(_0x394a0c,null));}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7963d94..5b1a655 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 _0x8936=['emit','hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','remove'];(function(_0x1f4086,_0x1f9aa5){var _0x364086=function(_0x404ecb){while(--_0x404ecb){_0x1f4086['push'](_0x1f4086['shift']());}};_0x364086(++_0x1f9aa5);}(_0x8936,0x1c3));var _0x6893=function(_0x1acc03,_0x1794d6){_0x1acc03=_0x1acc03-0x0;var _0x51bc63=_0x8936[_0x1acc03];return _0x51bc63;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x6893('0x0'))['db'][_0x6893('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6893('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6893('0x3')};function emitEvent(_0x136d5d){return function(_0x28dbe9,_0x3cc5b8,_0x7f7d79){SmsMessageEvents[_0x6893('0x4')](_0x136d5d+':'+_0x28dbe9['id'],_0x28dbe9);SmsMessageEvents[_0x6893('0x4')](_0x136d5d,_0x28dbe9);_0x7f7d79(null);};}for(var e in events){if(events[_0x6893('0x5')](e)){var event=events[e];SmsMessage[_0x6893('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 9d709c5..06c46e8 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 _0x3494=['message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','util','../../config/logger','api','bluebird','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteractionId','SmsInteraction','update','createdAt','error','out','SmsAccount','find','SmsAccountId','then','type','twilio','phone','accountSid','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','catch','inspect','skebby','password','smsMethod','sender','login?username=','username','&password=','GET','split','POST','user_key','session_key','total_sent','read','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','%s:%s','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','messageId','infobip','csc','crypto','apiKey','login','timestamp','keys','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x3494,0x166));var _0x4349=function(_0x2dd2b0,_0x51dde8){_0x2dd2b0=_0x2dd2b0-0x0;var _0x538a2f=_0x3494[_0x2dd2b0];return _0x538a2f;};'use strict';var _=require('lodash');var util=require(_0x4349('0x0'));var logger=require(_0x4349('0x1'))(_0x4349('0x2'));var moment=require('moment');var BPromise=require(_0x4349('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4349('0x4'));var config=require('../../config/environment');var attributes=require(_0x4349('0x5'));module['exports']=function(_0x1a453d,_0x4f2a42){return _0x1a453d[_0x4349('0x6')](_0x4349('0x7'),attributes,{'tableName':_0x4349('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x4349('0x9'),'fields':[_0x4349('0xa')],'type':_0x4349('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5103a1,_0x73d771,_0xb4a88d){var _0x4e99f4=_0x1a453d[_0x4349('0xc')];var _0x5c8684=_0x5103a1[_0x4349('0xd')]({'plain':!![]});if(_0x5c8684[_0x4349('0xe')][_0x4349('0xf')]()==='in'||_0x5c8684[_0x4349('0xe')][_0x4349('0xf')]()==='out'&&!_0x5c8684[_0x4349('0x10')]&&!_['isNil'](_0x5c8684[_0x4349('0x11')])&&!_[_0x4349('0x12')](_0x5c8684[_0x4349('0x13')])){_0x4e99f4[_0x4349('0x14')]['findOne']({'where':{'id':_0x5c8684[_0x4349('0x13')]}})['then'](function(_0x333add){if(_0x333add){_0x333add[_0x4349('0x15')]({'lastMsgAt':_0x5c8684[_0x4349('0x16')],'lastMsgDirection':_0x5c8684['direction'][_0x4349('0xf')]()});}})['catch'](function(_0x1ce83e){console[_0x4349('0x17')](_0x1ce83e);});}if(_0x5c8684['direction']===_0x4349('0x18')&&!_0x5c8684[_0x4349('0x10')]){var _0x1666b9;_0x4e99f4[_0x4349('0x19')][_0x4349('0x1a')]({'where':{'id':_0x5c8684[_0x4349('0x1b')]},'raw':!![]})[_0x4349('0x1c')](function(_0x326a12){_0x1666b9=_0x326a12;if(_0x1666b9&&_0x1666b9[_0x4349('0x1d')]){switch(_0x1666b9['type']){case _0x4349('0x1e'):var _0x4659ea=require(_0x4349('0x1e'));if(_0x1666b9['accountSid']&&_0x1666b9['authToken']&&_0x1666b9[_0x4349('0x1f')]){var _0x332818=new _0x4659ea(_0x1666b9[_0x4349('0x20')],_0x1666b9[_0x4349('0x21')]);_0x332818[_0x4349('0x22')][_0x4349('0x23')]({'body':_0x5c8684[_0x4349('0xa')],'to':_0x5c8684[_0x4349('0x1f')],'from':_0x1666b9['phone'],'statusCallback':_0x1666b9['remote']+_0x4349('0x24')+_0x5c8684['id']+_0x4349('0x25')+_0x1666b9[_0x4349('0x26')]})[_0x4349('0x1c')](function(_0x2038ab){if(_0x2038ab[_0x4349('0x27')]){return _0x5103a1[_0x4349('0x15')]({'messageId':_0x2038ab[_0x4349('0x27')]});}})[_0x4349('0x28')](function(_0xb487cb){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x4349('0x29')](_0xb487cb,{'showHidden':![],'depth':null}));});}else{logger[_0x4349('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4349('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x4349('0x2a'):var _0x1f5819='https://api.skebby.it/API/v1.0/REST/';if(_0x1666b9['username']&&_0x1666b9[_0x4349('0x2b')]){var _0xd4c34b={'recipient':[_0x5c8684['phone']],'message':_0x5c8684[_0x4349('0xa')],'message_type':_0x1666b9[_0x4349('0x2c')]};if(_0x1666b9['smsMethod']&&_0x1666b9['smsMethod']!=='SI'){_0xd4c34b[_0x4349('0x2d')]=_0x1666b9[_0x4349('0x1f')];}var _0x54e01a={'url':_0x1f5819+_0x4349('0x2e')+_0x1666b9[_0x4349('0x2f')]+_0x4349('0x30')+_0x1666b9['password'],'method':_0x4349('0x31')};rp(_0x54e01a)['then'](function(_0x4444cd){var _0x5efb23=_0x4444cd[_0x4349('0x32')](';');var _0x16ae99={'user_key':_0x5efb23[0x0],'session_key':_0x5efb23[0x1]};_0x54e01a={'url':_0x1f5819+'sms','method':_0x4349('0x33'),'headers':{'user_key':_0x16ae99[_0x4349('0x34')],'Session_key':_0x16ae99[_0x4349('0x35')]},'json':!![],'body':_0xd4c34b};return rp(_0x54e01a);})['then'](function(_0x33c781){if(_0x33c781[_0x4349('0x36')]>=0x1){var _0xd48aef={'messageId':_0x33c781['internal_order_id']};if(_0x1666b9[_0x4349('0x2c')]!=='GP'||!_0x1666b9['deliveryReport']){_0xd48aef[_0x4349('0x37')]=!![];}return _0x5103a1['update'](_0xd48aef);}else{return logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x2a'),util[_0x4349('0x29')](_0x33c781,{'showHidden':![],'depth':null}));}})[_0x4349('0x28')](function(_0x2f4644){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),_0x4349('0x2a'),util[_0x4349('0x29')](_0x2f4644,{'showHidden':![],'depth':null}));});}else{logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x4349('0x3a'):if(_0x1666b9['authToken']){var _0x22a439={'recipient':_0x5c8684['phone'],'message':_0x5c8684[_0x4349('0xa')],'sender':_0x1666b9[_0x4349('0x3b')]||_0x1666b9[_0x4349('0x1f')],'authorization':_0x1666b9[_0x4349('0x21')]};var _0x73d771={'method':_0x4349('0x33'),'uri':_0x4349('0x3c'),'body':_0x22a439,'json':!![]};rp(_0x73d771)['then'](function(_0x3261f5){var _0x5510b6={'messageId':_0x3261f5[_0x4349('0x3d')]};if(!_0x1666b9[_0x4349('0x3e')]){_0x5510b6[_0x4349('0x37')]=!![];}return _0x5103a1[_0x4349('0x15')](_0x5510b6);})[_0x4349('0x28')](function(_0x433a9d){logger[_0x4349('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),_0x4349('0x3a'),util[_0x4349('0x29')](_0x433a9d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x3a'),_0x4349('0x3f'));}break;case _0x4349('0x40'):if(_0x1666b9[_0x4349('0x2f')]&&_0x1666b9[_0x4349('0x2b')]){var _0x22a439={'messages':[{'source':_0x4349('0x41'),'to':_0x5c8684[_0x4349('0x1f')],'body':_0x5c8684['body'],'from':_0x1666b9['senderString']||_0x1666b9[_0x4349('0x1f')]}]};var _0x552ebb=util[_0x4349('0x42')]('%s:%s',_0x1666b9['username'],_0x1666b9[_0x4349('0x2b')]);var _0x73d771={'method':_0x4349('0x33'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x22a439,'headers':{'Authorization':util['format'](_0x4349('0x43'),new Buffer(_0x552ebb)[_0x4349('0x44')](_0x4349('0x45')))},'json':!![]};rp(_0x73d771)[_0x4349('0x1c')](function(_0x14722e){if(_0x14722e['http_code']>=0xc8&&_0x14722e[_0x4349('0x46')]<=0xce){if(_0x14722e[_0x4349('0x47')]&&_0x14722e[_0x4349('0x47')]['queued_count']>0x0){var _0x1bada0=_[_0x4349('0x48')](_0x14722e[_0x4349('0x47')][_0x4349('0x22')]);var _0x155417={'messageId':_0x1bada0[_0x4349('0x49')]};if(!_0x1666b9[_0x4349('0x3e')]){_0x155417[_0x4349('0x37')]=!![];}return _0x5103a1[_0x4349('0x15')](_0x155417);}else{logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x4a'),util[_0x4349('0x29')](_0x14722e,{'showHidden':![],'depth':null}));}}else{logger[_0x4349('0x17')](_0x4349('0x38'),'afterCreate',_0x4349('0x4a'),util[_0x4349('0x29')](_0x14722e,{'showHidden':![],'depth':null}));}})[_0x4349('0x28')](function(_0x5164f3){logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x4a'),util[_0x4349('0x29')](_0x5164f3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4349('0x38'),_0x4349('0x39'),'clickSend',_0x4349('0x4b'));}break;case _0x4349('0x4c'):if(_0x1666b9[_0x4349('0x4d')]&&_0x1666b9['authToken']){var _0x22a439={'dst':_0x5c8684[_0x4349('0x1f')],'text':_0x5c8684[_0x4349('0xa')],'src':_0x1666b9[_0x4349('0x3b')]||_0x1666b9[_0x4349('0x1f')],'url':_0x1666b9[_0x4349('0x4e')]+_0x4349('0x24')+_0x5c8684['id']+_0x4349('0x25')+_0x1666b9['token']};var _0x552ebb=util[_0x4349('0x42')](_0x4349('0x4f'),_0x1666b9[_0x4349('0x4d')],_0x1666b9[_0x4349('0x21')]);var _0x73d771={'method':_0x4349('0x33'),'uri':util[_0x4349('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1666b9[_0x4349('0x4d')]),'body':_0x22a439,'headers':{'Authorization':util[_0x4349('0x42')](_0x4349('0x43'),new Buffer(_0x552ebb)[_0x4349('0x44')](_0x4349('0x45')))},'json':!![]};rp(_0x73d771)[_0x4349('0x1c')](function(_0x4594d0){var _0x5ec25f={'messageId':_0x4594d0[_0x4349('0x50')][0x0]};return _0x5103a1[_0x4349('0x15')](_0x5ec25f);})[_0x4349('0x28')](function(_0x2ddcdf){logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x4c'),util[_0x4349('0x29')](_0x2ddcdf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x1666b9[_0x4349('0x2f')]&&_0x1666b9[_0x4349('0x2b')]){if(_0x1666b9[_0x4349('0x51')]){var _0x4ec1db={'method':_0x4349('0x33'),'uri':_0x1666b9[_0x4349('0x51')]+_0x4349('0x52'),'body':{'username':_0x1666b9[_0x4349('0x2f')],'password':_0x1666b9[_0x4349('0x2b')]},'json':!![]};return rp(_0x4ec1db)['then'](function(_0x5483ba){var _0x4426ef={'method':_0x4349('0x33'),'uri':_0x1666b9[_0x4349('0x51')]+_0x4349('0x53'),'body':{'messages':[{'from':_0x1666b9['phone'],'destinations':[{'to':_0x5c8684[_0x4349('0x1f')]}],'text':_0x5c8684['body'],'notifyUrl':_0x1666b9[_0x4349('0x4e')]+_0x4349('0x24')+_0x5c8684['id']+_0x4349('0x25')+_0x1666b9[_0x4349('0x26')],'notifyContentType':'application/json','callbackData':_0x1666b9[_0x4349('0x1f')]+';'+_0x5c8684[_0x4349('0xa')]}]},'headers':{'Authorization':_0x4349('0x54')+_0x5483ba[_0x4349('0x26')]},'json':!![]};return rp(_0x4426ef)[_0x4349('0x1c')](function(_0x40f7ea){if(_0x40f7ea['messages']){var _0x5eff37={'messageId':_0x40f7ea[_0x4349('0x22')][0x0][_0x4349('0x55')]};if(!_0x1666b9[_0x4349('0x3e')]){_0x5eff37['read']=!![];}return _0x5103a1[_0x4349('0x15')](_0x5eff37);}else{return logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x56'),util['inspect'](_0x40f7ea,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x4d1239){return logger['error'](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x56'),util[_0x4349('0x29')](_0x4d1239,{'showHidden':![],'depth':null}));});}else{logger[_0x4349('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x4349('0x38'),'afterCreate','infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x4349('0x57'):var _0x34202=require(_0x4349('0x58'));if(_0x1666b9[_0x4349('0x59')]){var _0x405328={};_0x405328[_0x4349('0x5a')]=_0x1666b9[_0x4349('0x2f')];_0x405328[_0x4349('0x1f')]=_0x5c8684[_0x4349('0x1f')];_0x405328[_0x4349('0x2d')]=_0x1666b9['phone'];_0x405328['text']=_0x5c8684[_0x4349('0xa')];_0x405328[_0x4349('0x5b')]=+new Date();var _0x3d15e2='';var _0x32c5c8='';var _0x23add3=Object[_0x4349('0x5c')](_0x405328);_0x23add3['sort']();for(var _0x21f337=0x0;_0x21f337<_0x23add3['length'];_0x21f337++){if(_0x3d15e2!=''){_0x3d15e2+='&';}_0x3d15e2+=_0x23add3[_0x21f337]+'='+encodeURIComponent(_0x405328[_0x23add3[_0x21f337]]);_0x32c5c8+=_0x405328[_0x23add3[_0x21f337]];}_0x32c5c8+=_0x1666b9[_0x4349('0x59')];_0x32c5c8=_0x34202['createHash'](_0x4349('0x5d'))['update'](_0x32c5c8)['digest'](_0x4349('0x5e'));if(_0x3d15e2!==''){_0x3d15e2+='&';}_0x3d15e2+=_0x4349('0x5f')+_0x32c5c8;var _0x54e01a={'method':'GET','uri':_0x1666b9[_0x4349('0x51')]+_0x4349('0x60')+_0x3d15e2,'json':!![]};return rp(_0x54e01a)['then'](function(_0x413eb9){var _0x171d18=Object['keys'](_0x413eb9);if(_0x413eb9[_0x171d18[0x0]][_0x4349('0x17')]&&parseInt(_0x413eb9[_0x171d18[0x0]]['error'])===0x0){var _0x3dd9aa={'messageId':_0x413eb9[_0x171d18[0x0]][_0x4349('0x61')]};if(!_0x1666b9[_0x4349('0x3e')]){_0x3dd9aa[_0x4349('0x37')]=!![];}return _0x5103a1['update'](_0x3dd9aa);}else{return logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x57'),util[_0x4349('0x29')](_0x413eb9['error'],{'showHidden':![],'depth':null}));}})[_0x4349('0x28')](function(_0x43da5c){return logger[_0x4349('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),_0x4349('0x57'),util[_0x4349('0x29')](_0x43da5c,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4349('0x57'),_0x4349('0x62'));}break;case'clickatell':if(_0x1666b9[_0x4349('0x59')]){var _0xd78c0c={'method':_0x4349('0x33'),'uri':_0x4349('0x63'),'headers':{'Authorization':_0x1666b9['apiKey']},'body':{'content':_0x5c8684[_0x4349('0xa')],'to':[_0x5c8684[_0x4349('0x1f')]],'from':_0x1666b9[_0x4349('0x1f')],'binary':![],'clientMessageId':_0x4349('0x64'),'charset':_0x4349('0x65')},'json':!![]};rp(_0xd78c0c)[_0x4349('0x1c')](function(_0x5931dc){if(!_0x5931dc[_0x4349('0x17')]){var _0x1125c2={'messageId':_0x5931dc['messages'][0x0][_0x4349('0x66')]};if(!_0x1666b9['deliveryReport']){_0x1125c2['read']=!![];}return _0x5103a1[_0x4349('0x15')](_0x1125c2);}else{return logger[_0x4349('0x17')](_0x4349('0x38'),'afterCreate',_0x4349('0x67'),util['inspect'](_0x5931dc[_0x4349('0x17')],{'showHidden':![],'depth':null}));}})[_0x4349('0x28')](function(_0x3b8909){return logger['error'](_0x4349('0x38'),_0x4349('0x39'),_0x4349('0x67'),util[_0x4349('0x29')](_0x3b8909,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),_0x4349('0x67'),_0x4349('0x62'));}break;case'bandwidth':if(_0x1666b9[_0x4349('0x2f')]&&_0x1666b9[_0x4349('0x2b')]){var _0x552ebb=util[_0x4349('0x42')](_0x4349('0x4f'),_0x1666b9[_0x4349('0x2f')],_0x1666b9[_0x4349('0x2b')]);var _0x73d771={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1666b9['accountId']+_0x4349('0x68'),'body':{'to':[_0x5c8684[_0x4349('0x1f')]],'text':_0x5c8684[_0x4349('0xa')],'from':_0x1666b9['phone'],'applicationId':_0x1666b9['applicationId']},'headers':{'Authorization':util[_0x4349('0x42')](_0x4349('0x43'),new Buffer(_0x552ebb)[_0x4349('0x44')](_0x4349('0x45')))},'json':!![]};rp(_0x73d771)[_0x4349('0x1c')](function(_0x426f4d){if(_0x426f4d['id']){var _0x3925f1={'messageId':_0x426f4d['id']};return _0x5103a1['update'](_0x3925f1);}else{logger[_0x4349('0x17')](_0x4349('0x38'),'afterCreate',_0x4349('0x69'),util[_0x4349('0x29')](_0x426f4d,{'showHidden':![],'depth':null}));}})[_0x4349('0x28')](function(_0x403b07){logger[_0x4349('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),'bandwidth',util[_0x4349('0x29')](_0x403b07,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4349('0x38'),'afterCreate','bandwidth',_0x4349('0x4b'));}break;case _0x4349('0x6a'):if(_0x1666b9['apiKey']){var _0x386a05={};var _0x54e01a={'method':'POST','uri':_0x4349('0x6b'),'headers':{'Authorization':'Bearer\x20'+_0x1666b9['apiKey'],'Content-Type':_0x4349('0x6c')},'body':{'from':_0x1666b9['phone'],'to':_0x5c8684['phone'],'text':_0x5c8684['body']},'json':!![]};return rp(_0x54e01a)[_0x4349('0x1c')](function(_0x20bf7e){if(_0x20bf7e[_0x4349('0x6d')]==0xca){_0x386a05[_0x4349('0x6e')]=_0x20bf7e;var _0x21338e={'method':_0x4349('0x33'),'uri':_0x4349('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x1666b9['apiKey'],'Content-Type':_0x4349('0x6c')},'body':{'refid':_0x386a05[_0x4349('0x6e')][_0x4349('0x70')]},'json':!![]};return rp(_0x21338e)[_0x4349('0x1c')](function(_0x4a33fc){_0x386a05[_0x4349('0x71')]=_0x4a33fc;var _0x3686ff={'messageId':_0x386a05[_0x4349('0x6e')][_0x4349('0x70')],'read':!![]};return _0x5103a1[_0x4349('0x15')](_0x3686ff);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4349('0x39'),_0x4349('0x6a'),util[_0x4349('0x29')](_0x20bf7e,{'showHidden':![],'depth':null}));}})[_0x4349('0x28')](function(_0x34eed5){return logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),'intelepeer',util[_0x4349('0x29')](_0x34eed5,{'showHidden':![],'depth':null}));});}else{return logger[_0x4349('0x17')](_0x4349('0x38'),_0x4349('0x39'),'intelepeer',_0x4349('0x72'));}break;}}})[_0x4349('0x73')](function(){_0xb4a88d();});}else{_0xb4a88d();}}},'charset':_0x4349('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 83ce053..2d78c04 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 _0x3299=['create','body','options','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSmsMessage'];(function(_0x508fc2,_0x4b11f2){var _0x3fa242=function(_0x46858c){while(--_0x46858c){_0x508fc2['push'](_0x508fc2['shift']());}};_0x3fa242(++_0x4b11f2);}(_0x3299,0x74));var _0x9329=function(_0x2501f3,_0x5ac17d){_0x2501f3=_0x2501f3-0x0;var _0x443df6=_0x3299[_0x2501f3];return _0x443df6;};'use strict';var _=require(_0x9329('0x0'));var util=require(_0x9329('0x1'));var moment=require('moment');var BPromise=require(_0x9329('0x2'));var rs=require(_0x9329('0x3'));var fs=require('fs');var Redis=require(_0x9329('0x4'));var db=require(_0x9329('0x5'))['db'];var utils=require(_0x9329('0x6'));var logger=require('../../config/logger')(_0x9329('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9329('0x8')]({'port':0x232a});config[_0x9329('0x9')]=_['defaults'](config[_0x9329('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9329('0xa'))(new Redis(config[_0x9329('0x9')]));require(_0x9329('0xb'))[_0x9329('0xc')](socket);function respondWithRpcPromise(_0x352219,_0xeea5d1,_0x213aa0){return new BPromise(function(_0x5cc889,_0x22e084){return client[_0x9329('0xd')](_0x352219,_0x213aa0)['then'](function(_0x5a5a12){logger[_0x9329('0xe')](_0x9329('0xf'),_0xeea5d1,_0x9329('0x10'));logger[_0x9329('0x11')](_0x9329('0x12'),_0xeea5d1,_0x9329('0x10'),JSON['stringify'](_0x5a5a12));if(_0x5a5a12[_0x9329('0x13')]){if(_0x5a5a12['error']['code']===0x1f4){logger[_0x9329('0x13')](_0x9329('0xf'),_0xeea5d1,_0x5a5a12[_0x9329('0x13')][_0x9329('0x14')]);return _0x22e084(_0x5a5a12[_0x9329('0x13')][_0x9329('0x14')]);}logger[_0x9329('0x13')](_0x9329('0xf'),_0xeea5d1,_0x5a5a12[_0x9329('0x13')]['message']);return _0x5cc889(_0x5a5a12[_0x9329('0x13')][_0x9329('0x14')]);}else{logger[_0x9329('0xe')]('SmsMessage,\x20%s,\x20%s',_0xeea5d1,_0x9329('0x10'));_0x5cc889(_0x5a5a12[_0x9329('0x15')][_0x9329('0x14')]);}})[_0x9329('0x16')](function(_0x32f61f){logger[_0x9329('0x13')]('SmsMessage,\x20%s,\x20%s',_0xeea5d1,_0x32f61f);_0x22e084(_0x32f61f);});});}exports[_0x9329('0x17')]=function(_0x538efc){var _0x2809a3=this;return new Promise(function(_0x279d93,_0x7fbe63){return db['SmsMessage'][_0x9329('0x18')](_0x538efc[_0x9329('0x19')],{'raw':_0x538efc['options']?_0x538efc[_0x9329('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x9329('0x1b')](function(_0x4da090){logger[_0x9329('0xe')](_0x9329('0x17'),_0x538efc);logger[_0x9329('0x11')](_0x9329('0x17'),_0x538efc,JSON['stringify'](_0x4da090));_0x279d93(_0x4da090);})[_0x9329('0x16')](function(_0x329e43){logger[_0x9329('0x13')]('CreateSmsMessage',_0x329e43['message'],_0x538efc);_0x7fbe63(_0x2809a3['error'](0x1f4,_0x329e43[_0x9329('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ca691f6..23a48ff 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 _0xf55f=['update','emit','removeListener','register','length','smsMessage:','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf55f,0x7e));var _0xff55=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf55f[_0x5a95fa];return _0x1a61b8;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xff55('0x0'),_0xff55('0x1'),_0xff55('0x2')];function createListener(_0x432297,_0xd9dcf0){return function(_0x59b17c){_0xd9dcf0[_0xff55('0x3')](_0x432297,_0x59b17c);};}function removeListener(_0x5dbab1,_0x37c8ef){return function(){SmsMessageEvents[_0xff55('0x4')](_0x5dbab1,_0x37c8ef);};}exports[_0xff55('0x5')]=function(_0x373933){for(var _0x43e382=0x0,_0x845b8b=events[_0xff55('0x6')];_0x43e382<_0x845b8b;_0x43e382++){var _0x238ea9=events[_0x43e382];var _0x50ff72=createListener(_0xff55('0x7')+_0x238ea9,_0x373933);SmsMessageEvents['on'](_0x238ea9,_0x50ff72);}}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f413f43..bc6a9c9 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 _0x97ca=['delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','put','update'];(function(_0x436024,_0x3996bf){var _0x5060ca=function(_0x2b91e1){while(--_0x2b91e1){_0x436024['push'](_0x436024['shift']());}};_0x5060ca(++_0x3996bf);}(_0x97ca,0x108));var _0xa97c=function(_0x4e1205,_0xb52446){_0x4e1205=_0x4e1205-0x0;var _0x180e0b=_0x97ca[_0x4e1205];return _0x180e0b;};'use strict';var multer=require(_0xa97c('0x0'));var util=require(_0xa97c('0x1'));var path=require(_0xa97c('0x2'));var timeout=require(_0xa97c('0x3'));var express=require(_0xa97c('0x4'));var router=express[_0xa97c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa97c('0x6'));var config=require(_0xa97c('0x7'));var controller=require(_0xa97c('0x8'));router[_0xa97c('0x9')]('/',auth[_0xa97c('0xa')](),controller[_0xa97c('0xb')]);router[_0xa97c('0x9')](_0xa97c('0xc'),auth['isAuthenticated'](),controller[_0xa97c('0xd')]);router['get'](_0xa97c('0xe'),auth['isAuthenticated'](),controller[_0xa97c('0xf')]);router[_0xa97c('0x9')]('/:id/members',auth[_0xa97c('0xa')](),controller[_0xa97c('0x10')]);router[_0xa97c('0x9')](_0xa97c('0x11'),auth[_0xa97c('0xa')](),controller[_0xa97c('0x12')]);router[_0xa97c('0x9')]('/:id/users',auth[_0xa97c('0xa')](),controller[_0xa97c('0x13')]);router[_0xa97c('0x14')]('/',auth[_0xa97c('0xa')](),controller[_0xa97c('0x15')]);router[_0xa97c('0x14')](_0xa97c('0x11'),auth[_0xa97c('0xa')](),controller[_0xa97c('0x16')]);router[_0xa97c('0x14')](_0xa97c('0x17'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa97c('0x18')](_0xa97c('0xe'),auth[_0xa97c('0xa')](),controller[_0xa97c('0x19')]);router[_0xa97c('0x1a')](_0xa97c('0xe'),auth[_0xa97c('0xa')](),controller['destroy']);router[_0xa97c('0x1a')](_0xa97c('0x11'),auth[_0xa97c('0xa')](),controller[_0xa97c('0x1b')]);router['delete'](_0xa97c('0x17'),auth[_0xa97c('0xa')](),controller['removeAgents']);module[_0xa97c('0x1c')]=router; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index dba862a..0d32753 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 _0x0c9e=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x39579b,_0x221cc0){var _0x3de2e1=function(_0x291083){while(--_0x291083){_0x39579b['push'](_0x39579b['shift']());}};_0x3de2e1(++_0x221cc0);}(_0x0c9e,0x131));var _0xe0c9=function(_0x1c16cb,_0x536954){_0x1c16cb=_0x1c16cb-0x0;var _0x1f129d=_0x0c9e[_0x1c16cb];return _0x1f129d;};'use strict';var Sequelize=require(_0xe0c9('0x0'));module[_0xe0c9('0x1')]={'name':{'type':Sequelize[_0xe0c9('0x2')],'unique':_0xe0c9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe0c9('0x2')]},'timeout':{'type':Sequelize[_0xe0c9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe0c9('0x5')](_0xe0c9('0x6'),_0xe0c9('0x7'),_0xe0c9('0x8'))}}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 5d69774..2568463 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0xadb5,0xad));var _0x5adb=function(_0x285111,_0x1c96f9){_0x285111=_0x285111-0x0;var _0x4e09b1=_0xadb5[_0x285111];return _0x4e09b1;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a3a0174..5fa3a4a 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 _0x9bda=['remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x43821f,_0x323882){var _0x241e63=function(_0x3c94b8){while(--_0x3c94b8){_0x43821f['push'](_0x43821f['shift']());}};_0x241e63(++_0x323882);}(_0x9bda,0x19e));var _0xa9bd=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x9bda[_0x4fbb15];return _0x436338;};'use strict';var EventEmitter=require(_0xa9bd('0x0'));var SmsQueue=require(_0xa9bd('0x1'))['db'][_0xa9bd('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa9bd('0x3')](0x0);var events={'afterCreate':_0xa9bd('0x4'),'afterUpdate':_0xa9bd('0x5'),'afterDestroy':_0xa9bd('0x6')};function emitEvent(_0x59cec4){return function(_0x1b4175,_0x38c8cc,_0x4ec539){SmsQueueEvents['emit'](_0x59cec4+':'+_0x1b4175['id'],_0x1b4175);SmsQueueEvents[_0xa9bd('0x7')](_0x59cec4,_0x1b4175);_0x4ec539(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xa9bd('0x8')](e,emitEvent(event));}}module[_0xa9bd('0x9')]=SmsQueueEvents; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 60d4bdd..c221d6f 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 _0x93e2=['exports','sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93e2,0x1e6));var _0x293e=function(_0x45000f,_0xd7f431){_0x45000f=_0x45000f-0x0;var _0x3a397c=_0x93e2[_0x45000f];return _0x3a397c;};'use strict';var _=require(_0x293e('0x0'));var util=require(_0x293e('0x1'));var logger=require(_0x293e('0x2'))(_0x293e('0x3'));var moment=require(_0x293e('0x4'));var BPromise=require('bluebird');var rp=require(_0x293e('0x5'));var fs=require('fs');var path=require(_0x293e('0x6'));var rimraf=require(_0x293e('0x7'));var config=require(_0x293e('0x8'));var attributes=require('./smsQueue.attributes');module[_0x293e('0x9')]=function(_0x505c4b,_0x4220ea){return _0x505c4b['define']('SmsQueue',attributes,{'tableName':_0x293e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f30b0a3..eafbfe5 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 _0x1791=['redis','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','SmsQueue','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','find','ShowSmsQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter'];(function(_0x297dcf,_0x448cf5){var _0xe1699b=function(_0x8b1e0f){while(--_0x8b1e0f){_0x297dcf['push'](_0x297dcf['shift']());}};_0xe1699b(++_0x448cf5);}(_0x1791,0x123));var _0x1179=function(_0x247a5e,_0x40b75d){_0x247a5e=_0x247a5e-0x0;var _0x16e004=_0x1791[_0x247a5e];return _0x16e004;};'use strict';var _=require('lodash');var util=require(_0x1179('0x0'));var moment=require(_0x1179('0x1'));var BPromise=require(_0x1179('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1179('0x3'));var db=require(_0x1179('0x4'))['db'];var utils=require(_0x1179('0x5'));var logger=require(_0x1179('0x6'))(_0x1179('0x7'));var config=require('../../config/environment');var jayson=require(_0x1179('0x8'));var client=jayson[_0x1179('0x9')]['http']({'port':0x232a});config['redis']=_[_0x1179('0xa')](config['redis'],{'host':_0x1179('0xb'),'port':0x18eb});var socket=require(_0x1179('0xc'))(new Redis(config[_0x1179('0xd')]));require(_0x1179('0xe'))[_0x1179('0xf')](socket);function respondWithRpcPromise(_0x485395,_0x14b0a8,_0x2382bc){return new BPromise(function(_0x1291b9,_0x5a16fd){return client[_0x1179('0x10')](_0x485395,_0x2382bc)[_0x1179('0x11')](function(_0x2102b8){logger['info'](_0x1179('0x12'),_0x14b0a8,_0x1179('0x13'));logger[_0x1179('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x14b0a8,'request\x20sent',JSON[_0x1179('0x15')](_0x2102b8));if(_0x2102b8[_0x1179('0x16')]){if(_0x2102b8[_0x1179('0x16')]['code']===0x1f4){logger[_0x1179('0x16')](_0x1179('0x12'),_0x14b0a8,_0x2102b8[_0x1179('0x16')][_0x1179('0x17')]);return _0x5a16fd(_0x2102b8[_0x1179('0x16')][_0x1179('0x17')]);}logger[_0x1179('0x16')](_0x1179('0x12'),_0x14b0a8,_0x2102b8['error'][_0x1179('0x17')]);return _0x1291b9(_0x2102b8[_0x1179('0x16')][_0x1179('0x17')]);}else{logger[_0x1179('0x18')](_0x1179('0x12'),_0x14b0a8,_0x1179('0x13'));_0x1291b9(_0x2102b8['result'][_0x1179('0x17')]);}})[_0x1179('0x19')](function(_0x167d09){logger[_0x1179('0x16')](_0x1179('0x12'),_0x14b0a8,_0x167d09);_0x5a16fd(_0x167d09);});});}exports['GetSmsQueue']=function(_0xb04882){var _0x55b922=this;return new Promise(function(_0xa3b215,_0x4a43b4){return db[_0x1179('0x1a')]['findAll']({'raw':_0xb04882[_0x1179('0x1b')]?_0xb04882['options'][_0x1179('0x1c')]===undefined?!![]:![]:!![],'where':_0xb04882[_0x1179('0x1b')]?_0xb04882[_0x1179('0x1b')][_0x1179('0x1d')]||null:null,'attributes':_0xb04882[_0x1179('0x1b')]?_0xb04882[_0x1179('0x1b')][_0x1179('0x1e')]||null:null,'limit':_0xb04882[_0x1179('0x1b')]?_0xb04882[_0x1179('0x1b')][_0x1179('0x1f')]||null:null,'include':_0xb04882[_0x1179('0x1b')]?_0xb04882[_0x1179('0x1b')][_0x1179('0x20')]?_[_0x1179('0x21')](_0xb04882[_0x1179('0x1b')][_0x1179('0x20')],function(_0x1ca350){return{'model':db[_0x1ca350[_0x1179('0x22')]],'as':_0x1ca350['as'],'attributes':_0x1ca350[_0x1179('0x1e')],'include':_0x1ca350[_0x1179('0x20')]?_[_0x1179('0x21')](_0x1ca350[_0x1179('0x20')],function(_0x40f5d9){return{'model':db[_0x40f5d9['model']],'as':_0x40f5d9['as'],'attributes':_0x40f5d9['attributes'],'include':_0x40f5d9[_0x1179('0x20')]?_[_0x1179('0x21')](_0x40f5d9[_0x1179('0x20')],function(_0x4bf61f){return{'model':db[_0x4bf61f[_0x1179('0x22')]],'as':_0x4bf61f['as'],'attributes':_0x4bf61f[_0x1179('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1179('0x11')](function(_0x20adcd){logger[_0x1179('0x18')](_0x1179('0x23'),_0xb04882);logger[_0x1179('0x14')]('GetSmsQueue',_0xb04882,JSON[_0x1179('0x15')](_0x20adcd));_0xa3b215(_0x20adcd);})[_0x1179('0x19')](function(_0x57a08e){logger[_0x1179('0x16')]('GetSmsQueue',_0x57a08e['message'],_0xb04882);_0x4a43b4(_0x55b922['error'](0x1f4,_0x57a08e[_0x1179('0x17')]));});});};exports['ShowSmsQueue']=function(_0x1055a3){var _0x38c625=this;return new Promise(function(_0x341ce7,_0x5842cc){return db[_0x1179('0x1a')][_0x1179('0x24')]({'raw':_0x1055a3[_0x1179('0x1b')]?_0x1055a3[_0x1179('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1055a3[_0x1179('0x1b')]?_0x1055a3[_0x1179('0x1b')][_0x1179('0x1d')]||null:null,'attributes':_0x1055a3[_0x1179('0x1b')]?_0x1055a3['options'][_0x1179('0x1e')]||null:null,'include':_0x1055a3['options']?_0x1055a3['options'][_0x1179('0x20')]?_[_0x1179('0x21')](_0x1055a3['options'][_0x1179('0x20')],function(_0x5727c0){return{'model':db[_0x5727c0[_0x1179('0x22')]],'as':_0x5727c0['as'],'attributes':_0x5727c0[_0x1179('0x1e')],'include':_0x5727c0[_0x1179('0x20')]?_[_0x1179('0x21')](_0x5727c0[_0x1179('0x20')],function(_0x48265a){return{'model':db[_0x48265a[_0x1179('0x22')]],'as':_0x48265a['as'],'attributes':_0x48265a[_0x1179('0x1e')],'include':_0x48265a['include']?_[_0x1179('0x21')](_0x48265a['include'],function(_0x4b7f29){return{'model':db[_0x4b7f29[_0x1179('0x22')]],'as':_0x4b7f29['as'],'attributes':_0x4b7f29[_0x1179('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1179('0x11')](function(_0x88d7ab){logger[_0x1179('0x18')](_0x1179('0x25'),_0x1055a3);logger['debug'](_0x1179('0x25'),_0x1055a3,JSON[_0x1179('0x15')](_0x88d7ab));_0x341ce7(_0x88d7ab);})[_0x1179('0x19')](function(_0x277f5c){logger['error'](_0x1179('0x25'),_0x277f5c[_0x1179('0x17')],_0x1055a3);_0x5842cc(_0x38c625[_0x1179('0x16')](0x1f4,_0x277f5c[_0x1179('0x17')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7ba2b5d..7778cdc 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 _0xa063=['./smsQueue.events','save','register','length','smsQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa063,0x1c2));var _0x3a06=function(_0x427a48,_0x3ff28b){_0x427a48=_0x427a48-0x0;var _0x3f9d0d=_0xa063[_0x427a48];return _0x3f9d0d;};'use strict';var SmsQueueEvents=require(_0x3a06('0x0'));var events=[_0x3a06('0x1'),'remove','update'];function createListener(_0x467c4e,_0x1da67e){return function(_0x1eb52a){_0x1da67e['emit'](_0x467c4e,_0x1eb52a);};}function removeListener(_0xd45b1f,_0x3758b0){return function(){SmsQueueEvents['removeListener'](_0xd45b1f,_0x3758b0);};}exports[_0x3a06('0x2')]=function(_0x14f451){for(var _0x5cb8a2=0x0,_0x19816d=events[_0x3a06('0x3')];_0x5cb8a2<_0x19816d;_0x5cb8a2++){var _0xb64d23=events[_0x5cb8a2];var _0x5cceb2=createListener(_0x3a06('0x4')+_0xb64d23,_0x14f451);SmsQueueEvents['on'](_0xb64d23,_0x5cceb2);}}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 051f19d..753c785 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 _0xedf2=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','show','post','/:id','update','exports'];(function(_0x376f2a,_0x4c8708){var _0x17ec0b=function(_0x3e5ce8){while(--_0x3e5ce8){_0x376f2a['push'](_0x376f2a['shift']());}};_0x17ec0b(++_0x4c8708);}(_0xedf2,0xa2));var _0x2edf=function(_0x4aedc8,_0x17a88a){_0x4aedc8=_0x4aedc8-0x0;var _0x36a8b6=_0xedf2[_0x4aedc8];return _0x36a8b6;};'use strict';var multer=require('multer');var util=require(_0x2edf('0x0'));var path=require('path');var timeout=require(_0x2edf('0x1'));var express=require(_0x2edf('0x2'));var router=express[_0x2edf('0x3')]();var fs_extra=require(_0x2edf('0x4'));var auth=require(_0x2edf('0x5'));var interaction=require(_0x2edf('0x6'));var config=require(_0x2edf('0x7'));var controller=require(_0x2edf('0x8'));router[_0x2edf('0x9')]('/',auth[_0x2edf('0xa')](),controller[_0x2edf('0xb')]);router[_0x2edf('0x9')](_0x2edf('0xc'),auth[_0x2edf('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2edf('0xd')]);router[_0x2edf('0xe')]('/',auth[_0x2edf('0xa')](),controller['create']);router['put'](_0x2edf('0xf'),auth[_0x2edf('0xa')](),controller[_0x2edf('0x10')]);router['delete'](_0x2edf('0xf'),auth[_0x2edf('0xa')](),controller['destroy']);module[_0x2edf('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f513b62..b02ea12 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 _0xdae0=['DATE','moment','sequelize','exports','STRING'];(function(_0x2037be,_0xb8ff58){var _0x5f21f3=function(_0x1b48b1){while(--_0x1b48b1){_0x2037be['push'](_0x2037be['shift']());}};_0x5f21f3(++_0xb8ff58);}(_0xdae0,0x15a));var _0x0dae=function(_0x2eb9ea,_0x500f29){_0x2eb9ea=_0x2eb9ea-0x0;var _0x1bc458=_0xdae0[_0x2eb9ea];return _0x1bc458;};'use strict';var moment=require(_0x0dae('0x0'));var Sequelize=require(_0x0dae('0x1'));module[_0x0dae('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0dae('0x3')]},'joinAt':{'type':Sequelize[_0x0dae('0x4')]},'leaveAt':{'type':Sequelize[_0x0dae('0x4')]},'acceptAt':{'type':Sequelize[_0x0dae('0x4')]},'exitAt':{'type':Sequelize[_0x0dae('0x4')]},'reason':{'type':Sequelize[_0x0dae('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 296bc51..0978207 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 _0xf39d=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','include','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','end','sendStatus','stack','name','send','map','SmsQueueReport','fieldName','type','model','query'];(function(_0x50ff65,_0x12c8cd){var _0x3fe3d5=function(_0x2dc67d){while(--_0x2dc67d){_0x50ff65['push'](_0x50ff65['shift']());}};_0x3fe3d5(++_0x12c8cd);}(_0xf39d,0x139));var _0xdf39=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xf39d[_0x202c61];return _0x540691;};'use strict';var emlformat=require(_0xdf39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf39('0x1'));var jsonpatch=require(_0xdf39('0x2'));var rp=require(_0xdf39('0x3'));var moment=require(_0xdf39('0x4'));var BPromise=require(_0xdf39('0x5'));var Mustache=require(_0xdf39('0x6'));var util=require(_0xdf39('0x7'));var path=require(_0xdf39('0x8'));var sox=require(_0xdf39('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf39('0xa'));var _=require(_0xdf39('0xb'));var squel=require(_0xdf39('0xc'));var crypto=require(_0xdf39('0xd'));var jsforce=require(_0xdf39('0xe'));var deskjs=require(_0xdf39('0xf'));var toCsv=require(_0xdf39('0x10'));var querystring=require(_0xdf39('0x11'));var Papa=require(_0xdf39('0x12'));var Redis=require(_0xdf39('0x13'));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(_0xdf39('0x14'))(_0xdf39('0x15'));var utils=require(_0xdf39('0x16'));var config=require(_0xdf39('0x17'));var licenseUtil=require(_0xdf39('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ca579,_0x5cdf0e){_0x5cdf0e=_0x5cdf0e||0xcc;return function(_0x5527c4){if(_0x5527c4){return _0x1ca579['sendStatus'](_0x5cdf0e);}return _0x1ca579[_0xdf39('0x19')](_0x5cdf0e)['end']();};}function respondWithResult(_0x4e4e4b,_0x191426){_0x191426=_0x191426||0xc8;return function(_0x5c8003){if(_0x5c8003){return _0x4e4e4b[_0xdf39('0x19')](_0x191426)['json'](_0x5c8003);}};}function respondWithFilteredResult(_0x46b220,_0x442f37){return function(_0x40d542){if(_0x40d542){var _0xf933fc=typeof _0x442f37[_0xdf39('0x1a')]==='undefined'&&typeof _0x442f37[_0xdf39('0x1b')]===_0xdf39('0x1c');var _0x559644=_0x40d542[_0xdf39('0x1d')];var _0x1b1e57=_0xf933fc?0x0:_0x442f37[_0xdf39('0x1a')];var _0x4d8aef=_0xf933fc?_0x40d542[_0xdf39('0x1d')]:_0x442f37['offset']+_0x442f37[_0xdf39('0x1b')];var _0x214a92;if(_0x4d8aef>=_0x559644){_0x4d8aef=_0x559644;_0x214a92=0xc8;}else{_0x214a92=0xce;}_0x46b220[_0xdf39('0x19')](_0x214a92);return _0x46b220[_0xdf39('0x1e')](_0xdf39('0x1f'),_0x1b1e57+'-'+_0x4d8aef+'/'+_0x559644)[_0xdf39('0x20')](_0x40d542);}return null;};}function patchUpdates(_0x4944cb){return function(_0x49b318){try{jsonpatch['apply'](_0x49b318,_0x4944cb,!![]);}catch(_0x431890){return BPromise['reject'](_0x431890);}return _0x49b318[_0xdf39('0x21')]();};}function saveUpdates(_0x4c4fe5,_0x29f1f8){return function(_0x4471ad){if(_0x4471ad){return _0x4471ad[_0xdf39('0x22')](_0x4c4fe5)[_0xdf39('0x23')](function(_0x12854c){return _0x12854c;});}return null;};}function removeEntity(_0x49273f,_0x746b35){return function(_0xcf6340){if(_0xcf6340){return _0xcf6340['destroy']()[_0xdf39('0x23')](function(){_0x49273f[_0xdf39('0x19')](0xcc)[_0xdf39('0x24')]();});}};}function handleEntityNotFound(_0x39d883,_0x58ca29){return function(_0x559061){if(!_0x559061){_0x39d883[_0xdf39('0x25')](0x194);}return _0x559061;};}function handleError(_0x150de8,_0x33066e){_0x33066e=_0x33066e||0x1f4;return function(_0x510fa9){logger['error'](_0x510fa9[_0xdf39('0x26')]);if(_0x510fa9['name']){delete _0x510fa9[_0xdf39('0x27')];}_0x150de8[_0xdf39('0x19')](_0x33066e)[_0xdf39('0x28')](_0x510fa9);};}exports['index']=function(_0x2e299d,_0x14913a){var _0x2c984d={},_0x3cf8d1={},_0x5493ee={'count':0x0,'rows':[]};var _0x253448=_[_0xdf39('0x29')](db[_0xdf39('0x2a')]['rawAttributes'],function(_0x5a8eff){return{'name':_0x5a8eff[_0xdf39('0x2b')],'type':_0x5a8eff[_0xdf39('0x2c')]['key']};});_0x3cf8d1[_0xdf39('0x2d')]=_['map'](_0x253448,'name');_0x3cf8d1[_0xdf39('0x2e')]=_['keys'](_0x2e299d[_0xdf39('0x2e')]);_0x3cf8d1[_0xdf39('0x2f')]=_[_0xdf39('0x30')](_0x3cf8d1['model'],_0x3cf8d1['query']);_0x2c984d[_0xdf39('0x31')]=_[_0xdf39('0x30')](_0x3cf8d1[_0xdf39('0x2d')],qs['fields'](_0x2e299d[_0xdf39('0x2e')][_0xdf39('0x32')]));_0x2c984d[_0xdf39('0x31')]=_0x2c984d[_0xdf39('0x31')][_0xdf39('0x33')]?_0x2c984d[_0xdf39('0x31')]:_0x3cf8d1['model'];if(!_0x2e299d['query'][_0xdf39('0x34')]('nolimit')){_0x2c984d[_0xdf39('0x1b')]=qs['limit'](_0x2e299d[_0xdf39('0x2e')]['limit']);_0x2c984d[_0xdf39('0x1a')]=qs[_0xdf39('0x1a')](_0x2e299d[_0xdf39('0x2e')][_0xdf39('0x1a')]);}_0x2c984d[_0xdf39('0x35')]=qs[_0xdf39('0x36')](_0x2e299d[_0xdf39('0x2e')][_0xdf39('0x36')]);_0x2c984d[_0xdf39('0x37')]=qs['filters'](_[_0xdf39('0x38')](_0x2e299d['query'],_0x3cf8d1['filters']),_0x253448);if(_0x2e299d['query'][_0xdf39('0x39')]){_0x2c984d[_0xdf39('0x37')]=_[_0xdf39('0x3a')](_0x2c984d['where'],{'$or':_[_0xdf39('0x29')](_0x253448,function(_0x1b61d9){if(_0x1b61d9[_0xdf39('0x2c')]!==_0xdf39('0x3b')){var _0x31c319={};_0x31c319[_0x1b61d9[_0xdf39('0x27')]]={'$like':'%'+_0x2e299d[_0xdf39('0x2e')][_0xdf39('0x39')]+'%'};return _0x31c319;}})});}_0x2c984d=_[_0xdf39('0x3a')]({},_0x2c984d,_0x2e299d[_0xdf39('0x3c')]);var _0x584623={'where':_0x2c984d['where']};return db[_0xdf39('0x2a')][_0xdf39('0x1d')](_0x584623)['then'](function(_0xca33f9){_0x5493ee[_0xdf39('0x1d')]=_0xca33f9;if(_0x2e299d[_0xdf39('0x2e')][_0xdf39('0x3d')]){_0x2c984d['include']=[{'all':!![]}];}return db[_0xdf39('0x2a')]['findAll'](_0x2c984d);})[_0xdf39('0x23')](function(_0x1dc45d){_0x5493ee[_0xdf39('0x3e')]=_0x1dc45d;return _0x5493ee;})[_0xdf39('0x23')](respondWithFilteredResult(_0x14913a,_0x2c984d))[_0xdf39('0x3f')](handleError(_0x14913a,null));};exports['show']=function(_0x44f2d1,_0x3f2246){var _0x253da7={'raw':!![],'where':{'id':_0x44f2d1[_0xdf39('0x40')]['id']}},_0x3c501f={};_0x3c501f[_0xdf39('0x2d')]=_['keys'](db[_0xdf39('0x2a')][_0xdf39('0x41')]);_0x3c501f[_0xdf39('0x2e')]=_['keys'](_0x44f2d1[_0xdf39('0x2e')]);_0x3c501f[_0xdf39('0x2f')]=_[_0xdf39('0x30')](_0x3c501f[_0xdf39('0x2d')],_0x3c501f[_0xdf39('0x2e')]);_0x253da7[_0xdf39('0x31')]=_[_0xdf39('0x30')](_0x3c501f['model'],qs[_0xdf39('0x32')](_0x44f2d1[_0xdf39('0x2e')][_0xdf39('0x32')]));_0x253da7[_0xdf39('0x31')]=_0x253da7['attributes'][_0xdf39('0x33')]?_0x253da7[_0xdf39('0x31')]:_0x3c501f['model'];if(_0x44f2d1[_0xdf39('0x2e')][_0xdf39('0x3d')]){_0x253da7[_0xdf39('0x42')]=[{'all':!![]}];}_0x253da7=_[_0xdf39('0x3a')]({},_0x253da7,_0x44f2d1[_0xdf39('0x3c')]);return db[_0xdf39('0x2a')][_0xdf39('0x43')](_0x253da7)[_0xdf39('0x23')](handleEntityNotFound(_0x3f2246,null))[_0xdf39('0x23')](respondWithResult(_0x3f2246,null))[_0xdf39('0x3f')](handleError(_0x3f2246,null));};exports[_0xdf39('0x44')]=function(_0x17538f,_0x5c0527){return db[_0xdf39('0x2a')][_0xdf39('0x44')](_0x17538f[_0xdf39('0x45')],{})[_0xdf39('0x23')](respondWithResult(_0x5c0527,0xc9))[_0xdf39('0x3f')](handleError(_0x5c0527,null));};exports[_0xdf39('0x22')]=function(_0x22c213,_0x211bef){if(_0x22c213[_0xdf39('0x45')]['id']){delete _0x22c213[_0xdf39('0x45')]['id'];}return db[_0xdf39('0x2a')][_0xdf39('0x43')]({'where':{'id':_0x22c213[_0xdf39('0x40')]['id']}})[_0xdf39('0x23')](handleEntityNotFound(_0x211bef,null))[_0xdf39('0x23')](saveUpdates(_0x22c213['body'],null))[_0xdf39('0x23')](respondWithResult(_0x211bef,null))[_0xdf39('0x3f')](handleError(_0x211bef,null));};exports[_0xdf39('0x46')]=function(_0x4e6d90,_0xf164a8){return db[_0xdf39('0x2a')][_0xdf39('0x43')]({'where':{'id':_0x4e6d90[_0xdf39('0x40')]['id']}})['then'](handleEntityNotFound(_0xf164a8,null))[_0xdf39('0x23')](removeEntity(_0xf164a8,null))['catch'](handleError(_0xf164a8,null));};exports[_0xdf39('0x47')]=function(_0x3a2728,_0x483e6e){return db['SmsQueueReport'][_0xdf39('0x47')]()[_0xdf39('0x23')](respondWithResult(_0x483e6e,null))['catch'](handleError(_0x483e6e,null));}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5b5ef86..2f597cf 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x3fe2a2,_0x30c2b7){var _0x333dc4=function(_0x327b2f){while(--_0x327b2f){_0x3fe2a2['push'](_0x3fe2a2['shift']());}};_0x333dc4(++_0x30c2b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0xcb91[_0x296144];return _0x5329b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0f79858..076a658 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 _0xff9b=['request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','info','result','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','attributes','limit','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x2067dd,_0x2245b7){var _0x16721b=function(_0x56e2fd){while(--_0x56e2fd){_0x2067dd['push'](_0x2067dd['shift']());}};_0x16721b(++_0x2245b7);}(_0xff9b,0x175));var _0xbff9=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xff9b[_0x54ea7a];return _0x65a10d;};'use strict';var _=require('lodash');var util=require(_0xbff9('0x0'));var moment=require(_0xbff9('0x1'));var BPromise=require('bluebird');var rs=require(_0xbff9('0x2'));var fs=require('fs');var Redis=require(_0xbff9('0x3'));var db=require(_0xbff9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbff9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbff9('0x6'));var client=jayson[_0xbff9('0x7')][_0xbff9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12c33d,_0x1ea491,_0x4b7398){return new BPromise(function(_0x356f88,_0x11b1b0){return client[_0xbff9('0x9')](_0x12c33d,_0x4b7398)[_0xbff9('0xa')](function(_0x8c6309){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1ea491,_0xbff9('0xb'));logger['debug'](_0xbff9('0xc'),_0x1ea491,_0xbff9('0xb'),JSON['stringify'](_0x8c6309));if(_0x8c6309[_0xbff9('0xd')]){if(_0x8c6309[_0xbff9('0xd')][_0xbff9('0xe')]===0x1f4){logger[_0xbff9('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x1ea491,_0x8c6309[_0xbff9('0xd')]['message']);return _0x11b1b0(_0x8c6309[_0xbff9('0xd')]['message']);}logger[_0xbff9('0xd')](_0xbff9('0xf'),_0x1ea491,_0x8c6309[_0xbff9('0xd')]['message']);return _0x356f88(_0x8c6309[_0xbff9('0xd')]['message']);}else{logger[_0xbff9('0x10')](_0xbff9('0xf'),_0x1ea491,'request\x20sent');_0x356f88(_0x8c6309[_0xbff9('0x11')][_0xbff9('0x12')]);}})[_0xbff9('0x13')](function(_0x51ccfd){logger[_0xbff9('0xd')](_0xbff9('0xf'),_0x1ea491,_0x51ccfd);_0x11b1b0(_0x51ccfd);});});}exports[_0xbff9('0x14')]=function(_0x520dd1){var _0xde3cf=this;return new Promise(function(_0x1e0297,_0x1464a9){return db[_0xbff9('0x15')][_0xbff9('0x16')](_0x520dd1[_0xbff9('0x17')],{'raw':_0x520dd1[_0xbff9('0x18')]?_0x520dd1[_0xbff9('0x18')][_0xbff9('0x19')]===undefined?!![]:![]:!![]})[_0xbff9('0xa')](function(_0x572d50){logger[_0xbff9('0x10')](_0xbff9('0x14'),_0x520dd1);logger[_0xbff9('0x1a')](_0xbff9('0x14'),_0x520dd1,JSON['stringify'](_0x572d50));_0x1e0297(_0x572d50);})[_0xbff9('0x13')](function(_0x5ec8d9){logger[_0xbff9('0xd')](_0xbff9('0x14'),_0x5ec8d9[_0xbff9('0x12')],_0x520dd1);_0x1464a9(_0xde3cf[_0xbff9('0xd')](0x1f4,_0x5ec8d9[_0xbff9('0x12')]));});});};exports[_0xbff9('0x1b')]=function(_0x296ab9){var _0x432368=this;return new Promise(function(_0x1e95c5,_0x378cbf){return db['SmsQueueReport'][_0xbff9('0x1c')](_0x296ab9['body'],{'raw':_0x296ab9['options']?_0x296ab9[_0xbff9('0x18')][_0xbff9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x296ab9[_0xbff9('0x18')]?_0x296ab9[_0xbff9('0x18')]['where']||null:null,'attributes':_0x296ab9['options']?_0x296ab9[_0xbff9('0x18')][_0xbff9('0x1d')]||null:null,'limit':_0x296ab9[_0xbff9('0x18')]?_0x296ab9[_0xbff9('0x18')][_0xbff9('0x1e')]||null:null})[_0xbff9('0xa')](function(_0x2dd4ba){logger[_0xbff9('0x10')](_0xbff9('0x1b'),_0x296ab9);logger[_0xbff9('0x1a')](_0xbff9('0x1b'),_0x296ab9,JSON[_0xbff9('0x1f')](_0x2dd4ba));_0x1e95c5(_0x2dd4ba);})[_0xbff9('0x13')](function(_0x5e620b){logger['error'](_0xbff9('0x1b'),_0x5e620b['message'],_0x296ab9);_0x378cbf(_0x432368[_0xbff9('0xd')](0x1f4,_0x5e620b[_0xbff9('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7d07ed2..c2e1bfb 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(_0x5d12f4,_0x55c739){var _0x345b20=function(_0x3679a2){while(--_0x3679a2){_0x5d12f4['push'](_0x5d12f4['shift']());}};_0x345b20(++_0x55c739);}(_0x99c9,0x13c));var _0x999c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x99c9[_0x321bb2];return _0x9c12ed;};'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 _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 diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index cab562f..ccb714e 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x92c90b,_0x365e19){var _0x2ecc92=function(_0x5c16de){while(--_0x5c16de){_0x92c90b['push'](_0x92c90b['shift']());}};_0x2ecc92(++_0x365e19);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x4b84[_0x2b7764];return _0x848dcb;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 05e866b..e37d9cb 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 _0xf96f=['limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x4b442b,_0x5de20a){var _0x12c389=function(_0x3fc6eb){while(--_0x3fc6eb){_0x4b442b['push'](_0x4b442b['shift']());}};_0x12c389(++_0x5de20a);}(_0xf96f,0x7c));var _0xff96=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf96f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff96('0x0'));var zipdir=require(_0xff96('0x1'));var jsonpatch=require(_0xff96('0x2'));var rp=require(_0xff96('0x3'));var moment=require(_0xff96('0x4'));var BPromise=require(_0xff96('0x5'));var Mustache=require(_0xff96('0x6'));var util=require(_0xff96('0x7'));var path=require(_0xff96('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff96('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff96('0xa'));var squel=require(_0xff96('0xb'));var crypto=require(_0xff96('0xc'));var jsforce=require(_0xff96('0xd'));var deskjs=require(_0xff96('0xe'));var toCsv=require(_0xff96('0xf'));var querystring=require(_0xff96('0x10'));var Papa=require(_0xff96('0x11'));var Redis=require('ioredis');var authService=require(_0xff96('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xff96('0x13'));var hardwareService=require(_0xff96('0x14'));var logger=require(_0xff96('0x15'))('api');var utils=require(_0xff96('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff96('0x17'));var db=require(_0xff96('0x18'))['db'];function respondWithStatusCode(_0x129317,_0x4873df){_0x4873df=_0x4873df||0xcc;return function(_0x517b02){if(_0x517b02){return _0x129317[_0xff96('0x19')](_0x4873df);}return _0x129317[_0xff96('0x1a')](_0x4873df)[_0xff96('0x1b')]();};}function respondWithResult(_0x306e33,_0x300177){_0x300177=_0x300177||0xc8;return function(_0x3efe02){if(_0x3efe02){return _0x306e33['status'](_0x300177)['json'](_0x3efe02);}};}function respondWithFilteredResult(_0x3c3bc3,_0x5ae562){return function(_0x18c8e1){if(_0x18c8e1){var _0x29593d=typeof _0x5ae562[_0xff96('0x1c')]===_0xff96('0x1d')&&typeof _0x5ae562[_0xff96('0x1e')]===_0xff96('0x1d');var _0x2cd6a2=_0x18c8e1[_0xff96('0x1f')];var _0x27afd6=_0x29593d?0x0:_0x5ae562[_0xff96('0x1c')];var _0x1e62e3=_0x29593d?_0x18c8e1[_0xff96('0x1f')]:_0x5ae562[_0xff96('0x1c')]+_0x5ae562[_0xff96('0x1e')];var _0x490afa;if(_0x1e62e3>=_0x2cd6a2){_0x1e62e3=_0x2cd6a2;_0x490afa=0xc8;}else{_0x490afa=0xce;}_0x3c3bc3[_0xff96('0x1a')](_0x490afa);return _0x3c3bc3[_0xff96('0x20')](_0xff96('0x21'),_0x27afd6+'-'+_0x1e62e3+'/'+_0x2cd6a2)['json'](_0x18c8e1);}return null;};}function patchUpdates(_0x5ec823){return function(_0x4aaf10){try{jsonpatch[_0xff96('0x22')](_0x4aaf10,_0x5ec823,!![]);}catch(_0x2c5f01){return BPromise['reject'](_0x2c5f01);}return _0x4aaf10[_0xff96('0x23')]();};}function saveUpdates(_0x747c48,_0xc736db){return function(_0x61b18a){if(_0x61b18a){return _0x61b18a[_0xff96('0x24')](_0x747c48)[_0xff96('0x25')](function(_0xe2645d){return _0xe2645d;});}return null;};}function removeEntity(_0x2ab29c,_0x2ce7dc){return function(_0x306828){if(_0x306828){return _0x306828[_0xff96('0x26')]()[_0xff96('0x25')](function(){_0x2ab29c[_0xff96('0x1a')](0xcc)[_0xff96('0x1b')]();});}};}function handleEntityNotFound(_0xf20ec7,_0x172a3b){return function(_0x27be7e){if(!_0x27be7e){_0xf20ec7[_0xff96('0x19')](0x194);}return _0x27be7e;};}function handleError(_0x116ce7,_0x3f058d){_0x3f058d=_0x3f058d||0x1f4;return function(_0x3d6a6c){logger['error'](_0x3d6a6c[_0xff96('0x27')]);if(_0x3d6a6c[_0xff96('0x28')]){delete _0x3d6a6c[_0xff96('0x28')];}_0x116ce7[_0xff96('0x1a')](_0x3f058d)[_0xff96('0x29')](_0x3d6a6c);};}exports[_0xff96('0x2a')]=function(_0x4aba43,_0x58aa52){var _0x59e9f3={},_0x3c8f6a={},_0x4b02c5={'count':0x0,'rows':[]};var _0x2cef4b=_[_0xff96('0x2b')](db[_0xff96('0x2c')][_0xff96('0x2d')],function(_0xb67eb8){return{'name':_0xb67eb8[_0xff96('0x2e')],'type':_0xb67eb8['type'][_0xff96('0x2f')]};});_0x3c8f6a[_0xff96('0x30')]=_[_0xff96('0x2b')](_0x2cef4b,_0xff96('0x28'));_0x3c8f6a[_0xff96('0x31')]=_[_0xff96('0x32')](_0x4aba43[_0xff96('0x31')]);_0x3c8f6a['filters']=_['intersection'](_0x3c8f6a[_0xff96('0x30')],_0x3c8f6a[_0xff96('0x31')]);_0x59e9f3[_0xff96('0x33')]=_[_0xff96('0x34')](_0x3c8f6a['model'],qs[_0xff96('0x35')](_0x4aba43[_0xff96('0x31')][_0xff96('0x35')]));_0x59e9f3[_0xff96('0x33')]=_0x59e9f3[_0xff96('0x33')][_0xff96('0x36')]?_0x59e9f3[_0xff96('0x33')]:_0x3c8f6a[_0xff96('0x30')];if(!_0x4aba43[_0xff96('0x31')][_0xff96('0x37')](_0xff96('0x38'))){_0x59e9f3[_0xff96('0x1e')]=qs[_0xff96('0x1e')](_0x4aba43[_0xff96('0x31')][_0xff96('0x1e')]);_0x59e9f3[_0xff96('0x1c')]=qs['offset'](_0x4aba43[_0xff96('0x31')][_0xff96('0x1c')]);}_0x59e9f3[_0xff96('0x39')]=qs[_0xff96('0x3a')](_0x4aba43[_0xff96('0x31')]['sort']);_0x59e9f3[_0xff96('0x3b')]=qs['filters'](_[_0xff96('0x3c')](_0x4aba43[_0xff96('0x31')],_0x3c8f6a[_0xff96('0x3d')]),_0x2cef4b);if(_0x4aba43[_0xff96('0x31')][_0xff96('0x3e')]){_0x59e9f3[_0xff96('0x3b')]=_['merge'](_0x59e9f3['where'],{'$or':_[_0xff96('0x2b')](_0x2cef4b,function(_0x507653){if(_0x507653[_0xff96('0x3f')]!=='VIRTUAL'){var _0x21e273={};_0x21e273[_0x507653[_0xff96('0x28')]]={'$like':'%'+_0x4aba43[_0xff96('0x31')][_0xff96('0x3e')]+'%'};return _0x21e273;}})});}_0x59e9f3=_['merge']({},_0x59e9f3,_0x4aba43[_0xff96('0x40')]);var _0x4f8703={'where':_0x59e9f3[_0xff96('0x3b')]};return db[_0xff96('0x2c')][_0xff96('0x1f')](_0x4f8703)[_0xff96('0x25')](function(_0x56a155){_0x4b02c5[_0xff96('0x1f')]=_0x56a155;if(_0x4aba43[_0xff96('0x31')][_0xff96('0x41')]){_0x59e9f3[_0xff96('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xff96('0x43')](_0x59e9f3);})[_0xff96('0x25')](function(_0x4f6d0b){_0x4b02c5[_0xff96('0x44')]=_0x4f6d0b;return _0x4b02c5;})[_0xff96('0x25')](respondWithFilteredResult(_0x58aa52,_0x59e9f3))[_0xff96('0x45')](handleError(_0x58aa52,null));};exports[_0xff96('0x46')]=function(_0x4548c3,_0x10c1b8){var _0x1f2a31={'raw':!![],'where':{'id':_0x4548c3['params']['id']}},_0xb4f0af={};_0xb4f0af[_0xff96('0x30')]=_[_0xff96('0x32')](db['SmsTransferReport']['rawAttributes']);_0xb4f0af[_0xff96('0x31')]=_[_0xff96('0x32')](_0x4548c3['query']);_0xb4f0af[_0xff96('0x3d')]=_['intersection'](_0xb4f0af['model'],_0xb4f0af[_0xff96('0x31')]);_0x1f2a31[_0xff96('0x33')]=_['intersection'](_0xb4f0af[_0xff96('0x30')],qs['fields'](_0x4548c3[_0xff96('0x31')][_0xff96('0x35')]));_0x1f2a31[_0xff96('0x33')]=_0x1f2a31[_0xff96('0x33')][_0xff96('0x36')]?_0x1f2a31['attributes']:_0xb4f0af[_0xff96('0x30')];if(_0x4548c3['query']['includeAll']){_0x1f2a31['include']=[{'all':!![]}];}_0x1f2a31=_[_0xff96('0x47')]({},_0x1f2a31,_0x4548c3[_0xff96('0x40')]);return db[_0xff96('0x2c')][_0xff96('0x48')](_0x1f2a31)[_0xff96('0x25')](handleEntityNotFound(_0x10c1b8,null))[_0xff96('0x25')](respondWithResult(_0x10c1b8,null))[_0xff96('0x45')](handleError(_0x10c1b8,null));};exports[_0xff96('0x49')]=function(_0x377871,_0x4b08b3){return db[_0xff96('0x2c')][_0xff96('0x49')](_0x377871[_0xff96('0x4a')],{})[_0xff96('0x25')](respondWithResult(_0x4b08b3,0xc9))[_0xff96('0x45')](handleError(_0x4b08b3,null));};exports[_0xff96('0x24')]=function(_0x412d92,_0x4be432){if(_0x412d92[_0xff96('0x4a')]['id']){delete _0x412d92['body']['id'];}return db[_0xff96('0x2c')][_0xff96('0x48')]({'where':{'id':_0x412d92[_0xff96('0x4b')]['id']}})[_0xff96('0x25')](handleEntityNotFound(_0x4be432,null))['then'](saveUpdates(_0x412d92[_0xff96('0x4a')],null))[_0xff96('0x25')](respondWithResult(_0x4be432,null))[_0xff96('0x45')](handleError(_0x4be432,null));};exports[_0xff96('0x26')]=function(_0x1c20ea,_0x2f16b5){return db[_0xff96('0x2c')][_0xff96('0x48')]({'where':{'id':_0x1c20ea[_0xff96('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f16b5,null))[_0xff96('0x25')](removeEntity(_0x2f16b5,null))[_0xff96('0x45')](handleError(_0x2f16b5,null));};exports[_0xff96('0x4c')]=function(_0x86f355,_0x5f0ea2){return db[_0xff96('0x2c')][_0xff96('0x4c')]()[_0xff96('0x25')](respondWithResult(_0x5f0ea2,null))[_0xff96('0x45')](handleError(_0x5f0ea2,null));}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0bab4eb..4c7caec 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 _0x4ddd=['path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x2858f8,_0x1dab75){var _0x92bf0e=function(_0x32a99c){while(--_0x32a99c){_0x2858f8['push'](_0x2858f8['shift']());}};_0x92bf0e(++_0x1dab75);}(_0x4ddd,0x18b));var _0xd4dd=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4ddd[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xd4dd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4dd('0x1'));var rimraf=require(_0xd4dd('0x2'));var config=require(_0xd4dd('0x3'));var attributes=require('./smsTransferReport.attributes');module[_0xd4dd('0x4')]=function(_0x207f91,_0x2796e1){return _0x207f91[_0xd4dd('0x5')](_0xd4dd('0x6'),attributes,{'tableName':_0xd4dd('0x7'),'paranoid':![],'indexes':[{'name':_0xd4dd('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c117609..0ca0201 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 _0x6c32=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var moment=require(_0x26c3('0x2'));var BPromise=require(_0x26c3('0x3'));var rs=require(_0x26c3('0x4'));var fs=require('fs');var Redis=require(_0x26c3('0x5'));var db=require(_0x26c3('0x6'))['db'];var utils=require(_0x26c3('0x7'));var logger=require(_0x26c3('0x8'))('rpc');var config=require(_0x26c3('0x9'));var jayson=require(_0x26c3('0xa'));var client=jayson[_0x26c3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x187b81,_0x5b3a5f,_0x3dde22){return new BPromise(function(_0x3ff8e7,_0x1a4c5b){return client[_0x26c3('0xc')](_0x187b81,_0x3dde22)[_0x26c3('0xd')](function(_0xda2203){logger[_0x26c3('0xe')](_0x26c3('0xf'),_0x5b3a5f,_0x26c3('0x10'));logger[_0x26c3('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5b3a5f,'request\x20sent',JSON['stringify'](_0xda2203));if(_0xda2203['error']){if(_0xda2203[_0x26c3('0x12')][_0x26c3('0x13')]===0x1f4){logger[_0x26c3('0x12')](_0x26c3('0xf'),_0x5b3a5f,_0xda2203['error']['message']);return _0x1a4c5b(_0xda2203[_0x26c3('0x12')][_0x26c3('0x14')]);}logger[_0x26c3('0x12')](_0x26c3('0xf'),_0x5b3a5f,_0xda2203[_0x26c3('0x12')]['message']);return _0x3ff8e7(_0xda2203['error'][_0x26c3('0x14')]);}else{logger[_0x26c3('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x5b3a5f,'request\x20sent');_0x3ff8e7(_0xda2203[_0x26c3('0x15')]['message']);}})[_0x26c3('0x16')](function(_0x486486){logger['error'](_0x26c3('0xf'),_0x5b3a5f,_0x486486);_0x1a4c5b(_0x486486);});});} \ No newline at end of file +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 diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 566ab69..6b11ba5 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 _0x66d0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','post','single','put','update','delete','exports','multer','util','path'];(function(_0x34052f,_0xa3ed34){var _0xf40062=function(_0x4e1360){while(--_0x4e1360){_0x34052f['push'](_0x34052f['shift']());}};_0xf40062(++_0xa3ed34);}(_0x66d0,0x79));var _0x066d=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x66d0[_0x2d91c6];return _0x3a8d19;};'use strict';var multer=require(_0x066d('0x0'));var util=require(_0x066d('0x1'));var path=require(_0x066d('0x2'));var timeout=require(_0x066d('0x3'));var express=require('express');var router=express[_0x066d('0x4')]();var fs_extra=require(_0x066d('0x5'));var auth=require(_0x066d('0x6'));var interaction=require(_0x066d('0x7'));var config=require(_0x066d('0x8'));var controller=require(_0x066d('0x9'));router[_0x066d('0xa')]('/',auth[_0x066d('0xb')](),controller[_0x066d('0xc')]);router[_0x066d('0xa')](_0x066d('0xd'),auth['isAuthenticated'](),controller[_0x066d('0xe')]);router[_0x066d('0xa')](_0x066d('0xf'),auth[_0x066d('0xb')](),controller[_0x066d('0x10')]);var upload=multer({'storage':multer[_0x066d('0x11')]({'destination':function(_0x13ead5,_0x29c6e8,_0x189365){_0x189365(null,path[_0x066d('0x12')](config['root'],_0x066d('0x13')));},'filename':function(_0x57e759,_0x534ddc,_0x5bda9b){_0x534ddc['originalname']=_0x534ddc[_0x066d('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bda9b(null,util[_0x066d('0x15')](_0x066d('0x16'),path[_0x066d('0x17')](_0x534ddc[_0x066d('0x14')],path[_0x066d('0x18')](_0x534ddc[_0x066d('0x14')])),Date['now'](),path[_0x066d('0x18')](_0x534ddc[_0x066d('0x14')])));}})});router[_0x066d('0x19')]('/',upload[_0x066d('0x1a')]('file'),controller['create']);router[_0x066d('0x1b')](_0x066d('0xd'),auth[_0x066d('0xb')](),controller[_0x066d('0x1c')]);router[_0x066d('0x1d')](_0x066d('0xd'),auth['isAuthenticated'](),controller[_0x066d('0x1d')]);module[_0x066d('0x1e')]=router; \ No newline at end of file +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 diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 09bbe5d..1b04941 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 _0xf05d=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf05d,0xd4));var _0xdf05=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf05d[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0xdf05('0x0')]={'name':{'type':Sequelize[_0xdf05('0x1')],'unique':_0xdf05('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xdf05('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xdf05('0x1')]},'original_format':{'type':Sequelize[_0xdf05('0x1')]},'original_duration':{'type':Sequelize[_0xdf05('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xdf05('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xdf05('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xdf05('0x4')]},'converted_channelCount':{'type':Sequelize[_0xdf05('0x5')]},'converted_bitRate':{'type':Sequelize[_0xdf05('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xdf05('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 889aa80..202b397 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 _0xffb8=['nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','originalname','file','filename','extname','substring','wav','info','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','name','send','Sound','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xffb8,0xb8));var _0x8ffb=function(_0x4135d1,_0x5c4035){_0x4135d1=_0x4135d1-0x0;var _0x2ee87e=_0xffb8[_0x4135d1];return _0x2ee87e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ffb('0x0'));var zipdir=require(_0x8ffb('0x1'));var jsonpatch=require(_0x8ffb('0x2'));var rp=require(_0x8ffb('0x3'));var moment=require('moment');var BPromise=require(_0x8ffb('0x4'));var Mustache=require(_0x8ffb('0x5'));var util=require(_0x8ffb('0x6'));var path=require(_0x8ffb('0x7'));var sox=require(_0x8ffb('0x8'));var csv=require(_0x8ffb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ffb('0xa'));var squel=require('squel');var crypto=require(_0x8ffb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8ffb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8ffb('0xd'));var Papa=require('papaparse');var Redis=require(_0x8ffb('0xe'));var authService=require(_0x8ffb('0xf'));var qs=require(_0x8ffb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ffb('0x11'));var logger=require(_0x8ffb('0x12'))(_0x8ffb('0x13'));var utils=require(_0x8ffb('0x14'));var config=require(_0x8ffb('0x15'));var licenseUtil=require(_0x8ffb('0x16'));var db=require(_0x8ffb('0x17'))['db'];function respondWithStatusCode(_0x64349b,_0x289f9b){_0x289f9b=_0x289f9b||0xcc;return function(_0x2c5770){if(_0x2c5770){return _0x64349b['sendStatus'](_0x289f9b);}return _0x64349b['status'](_0x289f9b)['end']();};}function respondWithResult(_0x3899c9,_0x12eaf1){_0x12eaf1=_0x12eaf1||0xc8;return function(_0x4ce3dd){if(_0x4ce3dd){return _0x3899c9[_0x8ffb('0x18')](_0x12eaf1)['json'](_0x4ce3dd);}};}function respondWithFilteredResult(_0x703d57,_0x30ea00){return function(_0x272fcc){if(_0x272fcc){var _0x3a612f=typeof _0x30ea00[_0x8ffb('0x19')]===_0x8ffb('0x1a')&&typeof _0x30ea00[_0x8ffb('0x1b')]===_0x8ffb('0x1a');var _0x31bec6=_0x272fcc[_0x8ffb('0x1c')];var _0x13327b=_0x3a612f?0x0:_0x30ea00[_0x8ffb('0x19')];var _0x1aef1d=_0x3a612f?_0x272fcc['count']:_0x30ea00[_0x8ffb('0x19')]+_0x30ea00['limit'];var _0x1d1400;if(_0x1aef1d>=_0x31bec6){_0x1aef1d=_0x31bec6;_0x1d1400=0xc8;}else{_0x1d1400=0xce;}_0x703d57[_0x8ffb('0x18')](_0x1d1400);return _0x703d57['set'](_0x8ffb('0x1d'),_0x13327b+'-'+_0x1aef1d+'/'+_0x31bec6)[_0x8ffb('0x1e')](_0x272fcc);}return null;};}function patchUpdates(_0x16319c){return function(_0x10fbc2){try{jsonpatch[_0x8ffb('0x1f')](_0x10fbc2,_0x16319c,!![]);}catch(_0x2ae490){return BPromise[_0x8ffb('0x20')](_0x2ae490);}return _0x10fbc2[_0x8ffb('0x21')]();};}function saveUpdates(_0x4e3549,_0x367d62){return function(_0x148498){if(_0x148498){return _0x148498[_0x8ffb('0x22')](_0x4e3549)[_0x8ffb('0x23')](function(_0x4f17c1){return _0x4f17c1;});}return null;};}function removeEntity(_0x47c629,_0x197f44){return function(_0x2dedd2){if(_0x2dedd2){return _0x2dedd2[_0x8ffb('0x24')]()[_0x8ffb('0x23')](function(){var _0x5977cb=_0x2dedd2[_0x8ffb('0x25')]({'plain':!![]});var _0x5ea7ec='Sounds';return db[_0x8ffb('0x26')]['destroy']({'where':{'type':_0x5ea7ec,'resourceId':_0x5977cb['id']}})[_0x8ffb('0x23')](function(){return _0x2dedd2;});})[_0x8ffb('0x23')](function(){_0x47c629[_0x8ffb('0x18')](0xcc)[_0x8ffb('0x27')]();});}};}function handleEntityNotFound(_0x1feae7,_0x260875){return function(_0x15c3c5){if(!_0x15c3c5){_0x1feae7[_0x8ffb('0x28')](0x194);}return _0x15c3c5;};}function handleError(_0x3bd662,_0x59957d){_0x59957d=_0x59957d||0x1f4;return function(_0x4b6d19){logger[_0x8ffb('0x29')](_0x4b6d19['stack']);if(_0x4b6d19[_0x8ffb('0x2a')]){delete _0x4b6d19[_0x8ffb('0x2a')];}_0x3bd662[_0x8ffb('0x18')](_0x59957d)[_0x8ffb('0x2b')](_0x4b6d19);};}exports['index']=function(_0x6522f0,_0x5cc23d){var _0x5c419d={},_0x2c4504={},_0x53a524={'count':0x0,'rows':[]};var _0x23e66c=_['map'](db[_0x8ffb('0x2c')][_0x8ffb('0x2d')],function(_0x2e1d12){return{'name':_0x2e1d12['fieldName'],'type':_0x2e1d12[_0x8ffb('0x2e')][_0x8ffb('0x2f')]};});_0x2c4504[_0x8ffb('0x30')]=_[_0x8ffb('0x31')](_0x23e66c,_0x8ffb('0x2a'));_0x2c4504[_0x8ffb('0x32')]=_[_0x8ffb('0x33')](_0x6522f0[_0x8ffb('0x32')]);_0x2c4504[_0x8ffb('0x34')]=_[_0x8ffb('0x35')](_0x2c4504[_0x8ffb('0x30')],_0x2c4504['query']);_0x5c419d[_0x8ffb('0x36')]=_['intersection'](_0x2c4504[_0x8ffb('0x30')],qs[_0x8ffb('0x37')](_0x6522f0[_0x8ffb('0x32')]['fields']));_0x5c419d[_0x8ffb('0x36')]=_0x5c419d[_0x8ffb('0x36')][_0x8ffb('0x38')]?_0x5c419d[_0x8ffb('0x36')]:_0x2c4504['model'];if(!_0x6522f0[_0x8ffb('0x32')][_0x8ffb('0x39')](_0x8ffb('0x3a'))){_0x5c419d[_0x8ffb('0x1b')]=qs[_0x8ffb('0x1b')](_0x6522f0[_0x8ffb('0x32')]['limit']);_0x5c419d[_0x8ffb('0x19')]=qs[_0x8ffb('0x19')](_0x6522f0[_0x8ffb('0x32')][_0x8ffb('0x19')]);}_0x5c419d[_0x8ffb('0x3b')]=qs[_0x8ffb('0x3c')](_0x6522f0[_0x8ffb('0x32')]['sort']);_0x5c419d['where']=qs[_0x8ffb('0x34')](_[_0x8ffb('0x3d')](_0x6522f0['query'],_0x2c4504['filters']),_0x23e66c);if(_0x6522f0[_0x8ffb('0x32')][_0x8ffb('0x3e')]){_0x5c419d[_0x8ffb('0x3f')]=_[_0x8ffb('0x40')](_0x5c419d['where'],{'$or':_[_0x8ffb('0x31')](_0x23e66c,function(_0x900cb2){if(_0x900cb2[_0x8ffb('0x2e')]!=='VIRTUAL'){var _0x2ab51c={};_0x2ab51c[_0x900cb2[_0x8ffb('0x2a')]]={'$like':'%'+_0x6522f0[_0x8ffb('0x32')][_0x8ffb('0x3e')]+'%'};return _0x2ab51c;}})});}_0x5c419d=_['merge']({},_0x5c419d,_0x6522f0[_0x8ffb('0x41')]);var _0x1d0700={'where':_0x5c419d[_0x8ffb('0x3f')]};return db[_0x8ffb('0x2c')][_0x8ffb('0x1c')](_0x1d0700)[_0x8ffb('0x23')](function(_0x5c58ae){_0x53a524[_0x8ffb('0x1c')]=_0x5c58ae;if(_0x6522f0[_0x8ffb('0x32')][_0x8ffb('0x42')]){_0x5c419d[_0x8ffb('0x43')]=[{'all':!![]}];}return db[_0x8ffb('0x2c')][_0x8ffb('0x44')](_0x5c419d);})[_0x8ffb('0x23')](function(_0x2b942a){_0x53a524[_0x8ffb('0x45')]=_0x2b942a;return _0x53a524;})[_0x8ffb('0x23')](respondWithFilteredResult(_0x5cc23d,_0x5c419d))[_0x8ffb('0x46')](handleError(_0x5cc23d,null));};exports[_0x8ffb('0x47')]=function(_0xf297a1,_0x54ba5b){var _0x15a619={'raw':!![],'where':{'id':_0xf297a1[_0x8ffb('0x48')]['id']}},_0x3631aa={};_0x3631aa[_0x8ffb('0x30')]=_[_0x8ffb('0x33')](db[_0x8ffb('0x2c')][_0x8ffb('0x2d')]);_0x3631aa[_0x8ffb('0x32')]=_[_0x8ffb('0x33')](_0xf297a1[_0x8ffb('0x32')]);_0x3631aa[_0x8ffb('0x34')]=_['intersection'](_0x3631aa[_0x8ffb('0x30')],_0x3631aa['query']);_0x15a619[_0x8ffb('0x36')]=_[_0x8ffb('0x35')](_0x3631aa['model'],qs[_0x8ffb('0x37')](_0xf297a1['query'][_0x8ffb('0x37')]));_0x15a619[_0x8ffb('0x36')]=_0x15a619[_0x8ffb('0x36')]['length']?_0x15a619['attributes']:_0x3631aa['model'];if(_0xf297a1[_0x8ffb('0x32')]['includeAll']){_0x15a619[_0x8ffb('0x43')]=[{'all':!![]}];}_0x15a619=_[_0x8ffb('0x40')]({},_0x15a619,_0xf297a1[_0x8ffb('0x41')]);return db['Sound'][_0x8ffb('0x49')](_0x15a619)[_0x8ffb('0x23')](handleEntityNotFound(_0x54ba5b,null))[_0x8ffb('0x23')](respondWithResult(_0x54ba5b,null))[_0x8ffb('0x46')](handleError(_0x54ba5b,null));};exports[_0x8ffb('0x4a')]=function(_0x1ad3ce,_0x5399fe,_0x13bdb6){return db['Sound'][_0x8ffb('0x49')]({'where':{'id':_0x1ad3ce[_0x8ffb('0x48')]['id']},'attributes':[_0x8ffb('0x2a'),_0x8ffb('0x4b'),'converted_format'],'raw':!![]})[_0x8ffb('0x23')](handleEntityNotFound(_0x5399fe,null))[_0x8ffb('0x23')](function(_0x22878f){if(_0x22878f){if(!fs[_0x8ffb('0x4c')](path[_0x8ffb('0x4d')](config[_0x8ffb('0x4e')],_0x8ffb('0x4f'),_0x22878f['save_name']+'.'+_0x22878f[_0x8ffb('0x50')]))){throw new db['Sequelize'][(_0x8ffb('0x51'))](_0x8ffb('0x52'));}return _0x5399fe['download'](path[_0x8ffb('0x4d')](config['root'],_0x8ffb('0x4f'),util[_0x8ffb('0x53')](_0x8ffb('0x54'),_0x22878f['save_name'],_0x22878f[_0x8ffb('0x50')])),util[_0x8ffb('0x53')](_0x8ffb('0x54'),_0x22878f[_0x8ffb('0x2a')],_0x22878f[_0x8ffb('0x50')]));}return null;})[_0x8ffb('0x46')](handleError(_0x5399fe,null));};exports['create']=function(_0x573625,_0x59ec4c,_0x111d4e){var _0x302aa7={'name':path[_0x8ffb('0x55')](_0x573625['file'][_0x8ffb('0x56')],path['extname'](_0x573625[_0x8ffb('0x57')][_0x8ffb('0x56')])),'save_name':path[_0x8ffb('0x55')](_0x573625['file'][_0x8ffb('0x58')],path[_0x8ffb('0x59')](_0x573625[_0x8ffb('0x57')][_0x8ffb('0x58')])),'original_format':path['extname'](_0x573625[_0x8ffb('0x57')][_0x8ffb('0x56')])[_0x8ffb('0x5a')](0x1),'converted_format':_0x8ffb('0x5b')};var _0x4f66bd=path[_0x8ffb('0x4d')](config[_0x8ffb('0x4e')],'server/files/sounds/original',_0x573625[_0x8ffb('0x57')][_0x8ffb('0x58')]);var _0x5811f4=path[_0x8ffb('0x4d')](config[_0x8ffb('0x4e')],_0x8ffb('0x4f'),util[_0x8ffb('0x53')]('%s.%s',path['basename'](_0x573625[_0x8ffb('0x57')]['filename'],path[_0x8ffb('0x59')](_0x573625[_0x8ffb('0x57')][_0x8ffb('0x58')])),_0x302aa7[_0x8ffb('0x50')]));logger[_0x8ffb('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x4f66bd);logger[_0x8ffb('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x5811f4);try{fs[_0x8ffb('0x5d')](_0x4f66bd,parseInt(_0x8ffb('0x5e'),0x8));var _0x5307eb=sox[_0x8ffb('0x5f')](_0x4f66bd,_0x5811f4,{'sampleRate':0x1f40,'format':_0x8ffb('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5307eb['on'](_0x8ffb('0x29'),function(_0x37cfbe){fs[_0x8ffb('0x60')](_0x4f66bd);_0x59ec4c[_0x8ffb('0x18')](0x1f4)['send'](_0x37cfbe);});_0x5307eb['on'](_0x8ffb('0x61'),function(_0x3a9bd1){_0x302aa7[_0x8ffb('0x62')]=isNaN(_0x3a9bd1['duration'])?null:_0x3a9bd1[_0x8ffb('0x63')]*0x3e8;_0x302aa7[_0x8ffb('0x64')]=isNaN(_0x3a9bd1[_0x8ffb('0x65')])?null:_0x3a9bd1[_0x8ffb('0x65')];_0x302aa7[_0x8ffb('0x66')]=isNaN(_0x3a9bd1[_0x8ffb('0x67')])?null:_0x3a9bd1[_0x8ffb('0x67')];_0x302aa7['original_bitRate']=isNaN(_0x3a9bd1[_0x8ffb('0x68')])?null:_0x3a9bd1[_0x8ffb('0x68')];_0x302aa7[_0x8ffb('0x69')]=isNaN(_0x3a9bd1[_0x8ffb('0x6a')])?null:_0x3a9bd1[_0x8ffb('0x6a')];});_0x5307eb['on'](_0x8ffb('0x6b'),function(_0x36e88a){_0x302aa7[_0x8ffb('0x6c')]=isNaN(_0x36e88a['duration'])?null:_0x36e88a[_0x8ffb('0x63')]*0x3e8;_0x302aa7['converted_sampleCount']=isNaN(_0x36e88a['sampleCount'])?null:_0x36e88a[_0x8ffb('0x65')];_0x302aa7['converted_channelCount']=isNaN(_0x36e88a[_0x8ffb('0x67')])?null:_0x36e88a[_0x8ffb('0x67')];_0x302aa7[_0x8ffb('0x6d')]=isNaN(_0x36e88a[_0x8ffb('0x68')])?null:_0x36e88a['bitRate'];_0x302aa7[_0x8ffb('0x6e')]=isNaN(_0x36e88a['sampleRate'])?null:_0x36e88a[_0x8ffb('0x6a')];});_0x5307eb['on']('end',function(){fs['chmodSync'](_0x5811f4,parseInt(_0x8ffb('0x5e'),0x8));return db[_0x8ffb('0x2c')][_0x8ffb('0x6f')](_0x302aa7)[_0x8ffb('0x23')](function(_0xbbde1c){var _0x5279a9={'role':_0x573625[_0x8ffb('0x70')][_0x8ffb('0x71')],'userProfileId':_0x573625[_0x8ffb('0x70')][_0x8ffb('0x72')]};if(!_0x5279a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5279a9['role']==='user'){var _0x5b948f=_0xbbde1c[_0x8ffb('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x8ffb('0x49')]({'where':{'name':_0x8ffb('0x73'),'userProfileId':_0x5279a9[_0x8ffb('0x72')]},'raw':!![]})[_0x8ffb('0x23')](function(_0x3fe4b8){if(_0x3fe4b8&&_0x3fe4b8['autoAssociation']===0x0){return db['UserProfileResource'][_0x8ffb('0x6f')]({'name':_0x5b948f[_0x8ffb('0x2a')],'resourceId':_0x5b948f['id'],'type':_0x3fe4b8[_0x8ffb('0x2a')],'sectionId':_0x3fe4b8['id']},{})['then'](function(){return _0xbbde1c;});}else{return _0xbbde1c;}})[_0x8ffb('0x46')](function(_0x562b94){logger[_0x8ffb('0x29')](_0x8ffb('0x74'),_0x562b94);throw _0x562b94;});}return _0xbbde1c;})['then'](respondWithResult(_0x59ec4c,null))[_0x8ffb('0x46')](handleError(_0x59ec4c,null));});_0x5307eb['start']();}catch(_0x2c89ab){_0x59ec4c[_0x8ffb('0x18')](0x1f4)['send'](_0x2c89ab);}};exports[_0x8ffb('0x22')]=function(_0x3c06b8,_0x3d62e1,_0x5158d3){return db[_0x8ffb('0x2c')][_0x8ffb('0x49')]({'where':{'id':_0x3c06b8[_0x8ffb('0x48')]['id']}})[_0x8ffb('0x23')](handleEntityNotFound(_0x3d62e1,null))[_0x8ffb('0x23')](saveUpdates(_[_0x8ffb('0x3d')](_0x3c06b8[_0x8ffb('0x70')],['name',_0x8ffb('0x75')]),null))[_0x8ffb('0x23')](respondWithResult(_0x3d62e1,null))['catch'](handleError(_0x3d62e1,null));};exports[_0x8ffb('0x76')]=function(_0xd4d456,_0x28c179,_0x5d8a5b){return db['Sound'][_0x8ffb('0x49')]({'where':{'id':_0xd4d456[_0x8ffb('0x48')]['id']}})['then'](function(_0x2608ee){if(_0x2608ee){return _0x2608ee[_0x8ffb('0x24')]();}})[_0x8ffb('0x23')](function(_0xee8d4f){var _0x33a256=path['join'](config[_0x8ffb('0x4e')],_0x8ffb('0x77'),util['format'](_0x8ffb('0x54'),_0xee8d4f['save_name'],_0xee8d4f[_0x8ffb('0x78')]));var _0x413e3b=path[_0x8ffb('0x4d')](config['root'],_0x8ffb('0x4f'),util[_0x8ffb('0x53')](_0x8ffb('0x54'),_0xee8d4f[_0x8ffb('0x4b')],_0xee8d4f[_0x8ffb('0x50')]));fs[_0x8ffb('0x60')](_0x33a256);fs[_0x8ffb('0x60')](_0x413e3b);return _0xee8d4f;})[_0x8ffb('0x23')](function(_0x50cfe3){if(_0x50cfe3){return _0x28c179[_0x8ffb('0x18')](0xcc)[_0x8ffb('0x27')]();}})[_0x8ffb('0x23')](handleEntityNotFound(_0x28c179,null))['catch'](handleError(_0x28c179,null));}; \ No newline at end of file +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 diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 0c73e3b..896426b 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 _0x4080=['tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','Sound'];(function(_0x1ff7d8,_0x323a12){var _0x5ff39=function(_0x1280dd){while(--_0x1280dd){_0x1ff7d8['push'](_0x1ff7d8['shift']());}};_0x5ff39(++_0x323a12);}(_0x4080,0xcd));var _0x0408=function(_0x225b4e,_0x179ee4){_0x225b4e=_0x225b4e-0x0;var _0x24237a=_0x4080[_0x225b4e];return _0x24237a;};'use strict';var _=require(_0x0408('0x0'));var util=require(_0x0408('0x1'));var logger=require(_0x0408('0x2'))(_0x0408('0x3'));var moment=require(_0x0408('0x4'));var BPromise=require(_0x0408('0x5'));var rp=require(_0x0408('0x6'));var fs=require('fs');var path=require(_0x0408('0x7'));var rimraf=require(_0x0408('0x8'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x2c6707,_0x5c0779){return _0x2c6707[_0x0408('0x9')](_0x0408('0xa'),attributes,{'tableName':_0x0408('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 9763565..439f982 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 _0xfcc5=['code','message','result','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x227817,_0x240ea2){var _0x23c3c1=function(_0x16291c){while(--_0x16291c){_0x227817['push'](_0x227817['shift']());}};_0x23c3c1(++_0x240ea2);}(_0xfcc5,0x10e));var _0x5fcc=function(_0x1be03d,_0x46cccf){_0x1be03d=_0x1be03d-0x0;var _0x45aeda=_0xfcc5[_0x1be03d];return _0x45aeda;};'use strict';var _=require(_0x5fcc('0x0'));var util=require(_0x5fcc('0x1'));var moment=require(_0x5fcc('0x2'));var BPromise=require(_0x5fcc('0x3'));var rs=require(_0x5fcc('0x4'));var fs=require('fs');var Redis=require(_0x5fcc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fcc('0x6'));var logger=require(_0x5fcc('0x7'))(_0x5fcc('0x8'));var config=require(_0x5fcc('0x9'));var jayson=require(_0x5fcc('0xa'));var client=jayson[_0x5fcc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1de81a,_0x10d9e2,_0x524d20){return new BPromise(function(_0xa39688,_0x4a90ad){return client[_0x5fcc('0xc')](_0x1de81a,_0x524d20)['then'](function(_0x2269a3){logger[_0x5fcc('0xd')](_0x5fcc('0xe'),_0x10d9e2,'request\x20sent');logger['debug'](_0x5fcc('0xf'),_0x10d9e2,'request\x20sent',JSON[_0x5fcc('0x10')](_0x2269a3));if(_0x2269a3[_0x5fcc('0x11')]){if(_0x2269a3[_0x5fcc('0x11')][_0x5fcc('0x12')]===0x1f4){logger[_0x5fcc('0x11')](_0x5fcc('0xe'),_0x10d9e2,_0x2269a3[_0x5fcc('0x11')][_0x5fcc('0x13')]);return _0x4a90ad(_0x2269a3[_0x5fcc('0x11')][_0x5fcc('0x13')]);}logger[_0x5fcc('0x11')](_0x5fcc('0xe'),_0x10d9e2,_0x2269a3[_0x5fcc('0x11')][_0x5fcc('0x13')]);return _0xa39688(_0x2269a3[_0x5fcc('0x11')][_0x5fcc('0x13')]);}else{logger[_0x5fcc('0xd')]('Sound,\x20%s,\x20%s',_0x10d9e2,'request\x20sent');_0xa39688(_0x2269a3[_0x5fcc('0x14')][_0x5fcc('0x13')]);}})['catch'](function(_0x3d6e75){logger[_0x5fcc('0x11')](_0x5fcc('0xe'),_0x10d9e2,_0x3d6e75);_0x4a90ad(_0x3d6e75);});});}exports[_0x5fcc('0x15')]=function(_0x2d78e0){var _0x241420=this;return new Promise(function(_0x468117,_0x224479){return db[_0x5fcc('0x16')][_0x5fcc('0x17')]({'raw':_0x2d78e0[_0x5fcc('0x18')]?_0x2d78e0['options'][_0x5fcc('0x19')]===undefined?!![]:![]:!![],'where':_0x2d78e0[_0x5fcc('0x18')]?_0x2d78e0[_0x5fcc('0x18')][_0x5fcc('0x1a')]||null:null,'attributes':_0x2d78e0[_0x5fcc('0x18')]?_0x2d78e0['options'][_0x5fcc('0x1b')]||null:null,'include':_0x2d78e0['options']?_0x2d78e0[_0x5fcc('0x18')]['include']?_[_0x5fcc('0x1c')](_0x2d78e0['options'][_0x5fcc('0x1d')],function(_0x2191bd){return{'model':db[_0x2191bd[_0x5fcc('0x1e')]],'as':_0x2191bd['as'],'attributes':_0x2191bd[_0x5fcc('0x1b')],'include':_0x2191bd[_0x5fcc('0x1d')]?_[_0x5fcc('0x1c')](_0x2191bd[_0x5fcc('0x1d')],function(_0xb60ecd){return{'model':db[_0xb60ecd[_0x5fcc('0x1e')]],'as':_0xb60ecd['as'],'attributes':_0xb60ecd['attributes'],'include':_0xb60ecd[_0x5fcc('0x1d')]?_['map'](_0xb60ecd[_0x5fcc('0x1d')],function(_0x8a8797){return{'model':db[_0x8a8797[_0x5fcc('0x1e')]],'as':_0x8a8797['as'],'attributes':_0x8a8797[_0x5fcc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa5c52a){logger['info']('ShowSound',_0x2d78e0);logger[_0x5fcc('0x1f')](_0x5fcc('0x15'),_0x2d78e0,JSON[_0x5fcc('0x10')](_0xa5c52a));_0x468117(_0xa5c52a);})['catch'](function(_0xd7e7fd){logger[_0x5fcc('0x11')]('ShowSound',_0xd7e7fd['message'],_0x2d78e0);_0x224479(_0x241420[_0x5fcc('0x11')](0x1f4,_0xd7e7fd[_0x5fcc('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ec48613..5414d47 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x47c65b,_0x443ae3){var _0x5f2ace=function(_0x3c33da){while(--_0x3c33da){_0x47c65b['push'](_0x47c65b['shift']());}};_0x5f2ace(++_0x443ae3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index ecfe0be..9504708 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 _0x2534=['exports','STRING','TEXT','medium','ENUM','out'];(function(_0x172f5d,_0x2bff0f){var _0x268a72=function(_0x3dba89){while(--_0x3dba89){_0x172f5d['push'](_0x172f5d['shift']());}};_0x268a72(++_0x2bff0f);}(_0x2534,0xe4));var _0x4253=function(_0x456a0b,_0x20d937){_0x456a0b=_0x456a0b-0x0;var _0x2b67ef=_0x2534[_0x456a0b];return _0x2b67ef;};'use strict';var Sequelize=require('sequelize');module[_0x4253('0x0')]={'uniqueid':{'type':Sequelize[_0x4253('0x1')]},'body':{'type':Sequelize[_0x4253('0x2')](_0x4253('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x4253('0x4')]('in',_0x4253('0x5')),'defaultValue':_0x4253('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4253('0x1')]},'providerResponse':{'type':Sequelize[_0x4253('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8c804f6..37b41fe 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 _0x74e6=['where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','end','error','stack','name','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x5e2b26,_0x3a9b9a){var _0x41f745=function(_0x163ba2){while(--_0x163ba2){_0x5e2b26['push'](_0x5e2b26['shift']());}};_0x41f745(++_0x3a9b9a);}(_0x74e6,0xed));var _0x674e=function(_0x24fc44,_0x10a3f1){_0x24fc44=_0x24fc44-0x0;var _0x560bfe=_0x74e6[_0x24fc44];return _0x560bfe;};'use strict';var emlformat=require(_0x674e('0x0'));var rimraf=require(_0x674e('0x1'));var zipdir=require(_0x674e('0x2'));var jsonpatch=require(_0x674e('0x3'));var rp=require('request-promise');var moment=require(_0x674e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x674e('0x5'));var util=require(_0x674e('0x6'));var path=require(_0x674e('0x7'));var sox=require(_0x674e('0x8'));var csv=require('to-csv');var ejs=require(_0x674e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x674e('0xa'));var squel=require(_0x674e('0xb'));var crypto=require(_0x674e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x674e('0xd'));var querystring=require('querystring');var Papa=require(_0x674e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x674e('0xf'));var as=require(_0x674e('0x10'));var hardwareService=require(_0x674e('0x11'));var logger=require(_0x674e('0x12'))(_0x674e('0x13'));var utils=require(_0x674e('0x14'));var config=require(_0x674e('0x15'));var licenseUtil=require(_0x674e('0x16'));var db=require(_0x674e('0x17'))['db'];function respondWithStatusCode(_0x5458dd,_0x259ae3){_0x259ae3=_0x259ae3||0xcc;return function(_0x24a8c0){if(_0x24a8c0){return _0x5458dd[_0x674e('0x18')](_0x259ae3);}return _0x5458dd['status'](_0x259ae3)['end']();};}function respondWithResult(_0xc863b3,_0x10037d){_0x10037d=_0x10037d||0xc8;return function(_0x4c559e){if(_0x4c559e){return _0xc863b3['status'](_0x10037d)[_0x674e('0x19')](_0x4c559e);}};}function respondWithFilteredResult(_0xb063c,_0x649460){return function(_0x50beb4){if(_0x50beb4){var _0x4c00d0=typeof _0x649460[_0x674e('0x1a')]===_0x674e('0x1b')&&typeof _0x649460[_0x674e('0x1c')]==='undefined';var _0x52eaa8=_0x50beb4['count'];var _0x397cb0=_0x4c00d0?0x0:_0x649460[_0x674e('0x1a')];var _0x32b08=_0x4c00d0?_0x50beb4[_0x674e('0x1d')]:_0x649460[_0x674e('0x1a')]+_0x649460[_0x674e('0x1c')];var _0x13fe1b;if(_0x32b08>=_0x52eaa8){_0x32b08=_0x52eaa8;_0x13fe1b=0xc8;}else{_0x13fe1b=0xce;}_0xb063c[_0x674e('0x1e')](_0x13fe1b);return _0xb063c[_0x674e('0x1f')]('Content-Range',_0x397cb0+'-'+_0x32b08+'/'+_0x52eaa8)['json'](_0x50beb4);}return null;};}function patchUpdates(_0x59c426){return function(_0x36f49b){try{jsonpatch[_0x674e('0x20')](_0x36f49b,_0x59c426,!![]);}catch(_0x1fc50f){return BPromise[_0x674e('0x21')](_0x1fc50f);}return _0x36f49b[_0x674e('0x22')]();};}function saveUpdates(_0x473309,_0x513662){return function(_0x588929){if(_0x588929){return _0x588929[_0x674e('0x23')](_0x473309)[_0x674e('0x24')](function(_0x2c596a){return _0x2c596a;});}return null;};}function removeEntity(_0x3e816e,_0x5dfbf7){return function(_0x496edd){if(_0x496edd){return _0x496edd['destroy']()['then'](function(){_0x3e816e[_0x674e('0x1e')](0xcc)[_0x674e('0x25')]();});}};}function handleEntityNotFound(_0x4674d2,_0x2f37a0){return function(_0x55aaf1){if(!_0x55aaf1){_0x4674d2[_0x674e('0x18')](0x194);}return _0x55aaf1;};}function handleError(_0x4d7fde,_0x243b2f){_0x243b2f=_0x243b2f||0x1f4;return function(_0x8de59e){logger[_0x674e('0x26')](_0x8de59e[_0x674e('0x27')]);if(_0x8de59e['name']){delete _0x8de59e[_0x674e('0x28')];}_0x4d7fde[_0x674e('0x1e')](_0x243b2f)['send'](_0x8de59e);};}exports[_0x674e('0x29')]=function(_0x5d1f5b,_0x27ee32){var _0x483d13={},_0x45f960={},_0x349d91={'count':0x0,'rows':[]};var _0x54ccaa=_['map'](db[_0x674e('0x2a')][_0x674e('0x2b')],function(_0x57031d){return{'name':_0x57031d[_0x674e('0x2c')],'type':_0x57031d[_0x674e('0x2d')][_0x674e('0x2e')]};});_0x45f960[_0x674e('0x2f')]=_[_0x674e('0x30')](_0x54ccaa,_0x674e('0x28'));_0x45f960[_0x674e('0x31')]=_[_0x674e('0x32')](_0x5d1f5b[_0x674e('0x31')]);_0x45f960[_0x674e('0x33')]=_[_0x674e('0x34')](_0x45f960['model'],_0x45f960[_0x674e('0x31')]);_0x483d13[_0x674e('0x35')]=_[_0x674e('0x34')](_0x45f960[_0x674e('0x2f')],qs['fields'](_0x5d1f5b[_0x674e('0x31')][_0x674e('0x36')]));_0x483d13[_0x674e('0x35')]=_0x483d13[_0x674e('0x35')][_0x674e('0x37')]?_0x483d13[_0x674e('0x35')]:_0x45f960[_0x674e('0x2f')];if(!_0x5d1f5b[_0x674e('0x31')][_0x674e('0x38')]('nolimit')){_0x483d13['limit']=qs[_0x674e('0x1c')](_0x5d1f5b['query'][_0x674e('0x1c')]);_0x483d13[_0x674e('0x1a')]=qs[_0x674e('0x1a')](_0x5d1f5b[_0x674e('0x31')][_0x674e('0x1a')]);}_0x483d13[_0x674e('0x39')]=qs[_0x674e('0x3a')](_0x5d1f5b[_0x674e('0x31')]['sort']);_0x483d13[_0x674e('0x3b')]=qs['filters'](_[_0x674e('0x3c')](_0x5d1f5b[_0x674e('0x31')],_0x45f960[_0x674e('0x33')]),_0x54ccaa);if(_0x5d1f5b[_0x674e('0x31')][_0x674e('0x3d')]){_0x483d13[_0x674e('0x3b')]=_[_0x674e('0x3e')](_0x483d13['where'],{'$or':_[_0x674e('0x30')](_0x54ccaa,function(_0x4fd117){if(_0x4fd117['type']!==_0x674e('0x3f')){var _0x564a0e={};_0x564a0e[_0x4fd117[_0x674e('0x28')]]={'$like':'%'+_0x5d1f5b[_0x674e('0x31')][_0x674e('0x3d')]+'%'};return _0x564a0e;}})});}_0x483d13=_['merge']({},_0x483d13,_0x5d1f5b[_0x674e('0x40')]);var _0x5385e6={'where':_0x483d13[_0x674e('0x3b')]};return db['SquareMessage'][_0x674e('0x1d')](_0x5385e6)[_0x674e('0x24')](function(_0x5e5d2b){_0x349d91[_0x674e('0x1d')]=_0x5e5d2b;if(_0x5d1f5b[_0x674e('0x31')][_0x674e('0x41')]){_0x483d13['include']=[{'all':!![]}];}return db[_0x674e('0x2a')]['findAll'](_0x483d13);})[_0x674e('0x24')](function(_0x57fe71){_0x349d91[_0x674e('0x42')]=_0x57fe71;return _0x349d91;})[_0x674e('0x24')](respondWithFilteredResult(_0x27ee32,_0x483d13))[_0x674e('0x43')](handleError(_0x27ee32,null));};exports[_0x674e('0x44')]=function(_0x4ae225,_0x3b8282){var _0x598a82={'raw':!![],'where':{'id':_0x4ae225['params']['id']}},_0x2a3d36={};_0x2a3d36['model']=_['keys'](db[_0x674e('0x2a')]['rawAttributes']);_0x2a3d36[_0x674e('0x31')]=_[_0x674e('0x32')](_0x4ae225['query']);_0x2a3d36[_0x674e('0x33')]=_[_0x674e('0x34')](_0x2a3d36[_0x674e('0x2f')],_0x2a3d36[_0x674e('0x31')]);_0x598a82['attributes']=_[_0x674e('0x34')](_0x2a3d36[_0x674e('0x2f')],qs[_0x674e('0x36')](_0x4ae225['query']['fields']));_0x598a82[_0x674e('0x35')]=_0x598a82[_0x674e('0x35')]['length']?_0x598a82[_0x674e('0x35')]:_0x2a3d36[_0x674e('0x2f')];if(_0x4ae225[_0x674e('0x31')][_0x674e('0x41')]){_0x598a82['include']=[{'all':!![]}];}_0x598a82=_[_0x674e('0x3e')]({},_0x598a82,_0x4ae225[_0x674e('0x40')]);return db['SquareMessage'][_0x674e('0x45')](_0x598a82)[_0x674e('0x24')](handleEntityNotFound(_0x3b8282,null))[_0x674e('0x24')](respondWithResult(_0x3b8282,null))['catch'](handleError(_0x3b8282,null));};exports[_0x674e('0x46')]=function(_0x2f1f71,_0x121657){return db['SquareMessage']['create'](_0x2f1f71[_0x674e('0x47')],{})[_0x674e('0x24')](respondWithResult(_0x121657,0xc9))[_0x674e('0x43')](handleError(_0x121657,null));};exports[_0x674e('0x23')]=function(_0x1c359d,_0xf832ed){if(_0x1c359d[_0x674e('0x47')]['id']){delete _0x1c359d['body']['id'];}return db[_0x674e('0x2a')][_0x674e('0x45')]({'where':{'id':_0x1c359d['params']['id']}})['then'](handleEntityNotFound(_0xf832ed,null))[_0x674e('0x24')](saveUpdates(_0x1c359d['body'],null))[_0x674e('0x24')](respondWithResult(_0xf832ed,null))[_0x674e('0x43')](handleError(_0xf832ed,null));};exports[_0x674e('0x48')]=function(_0x47f786,_0x19e956){return db[_0x674e('0x2a')][_0x674e('0x45')]({'where':{'id':_0x47f786[_0x674e('0x49')]['id']}})[_0x674e('0x24')](handleEntityNotFound(_0x19e956,null))[_0x674e('0x24')](removeEntity(_0x19e956,null))[_0x674e('0x43')](handleError(_0x19e956,null));}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index af6ba7c..dc0fe83 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 _0xb734=['SquareMessage','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0xb734,0xe2));var _0x4b73=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0xb734[_0x120123];return _0x3bec4c;};'use strict';var _=require(_0x4b73('0x0'));var util=require('util');var logger=require(_0x4b73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4b73('0x2'));var rp=require(_0x4b73('0x3'));var fs=require('fs');var path=require(_0x4b73('0x4'));var rimraf=require(_0x4b73('0x5'));var config=require('../../config/environment');var attributes=require(_0x4b73('0x6'));module[_0x4b73('0x7')]=function(_0x1d84d1,_0x11914b){return _0x1d84d1['define'](_0x4b73('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 4dee1b1..96ce2b4 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 _0xcc36=['result','catch','CreateSquareMessage','SquareMessage','create','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3f7176,_0xf060f5){var _0x3783a0=function(_0xe736c6){while(--_0xe736c6){_0x3f7176['push'](_0x3f7176['shift']());}};_0x3783a0(++_0xf060f5);}(_0xcc36,0x156));var _0x6cc3=function(_0x557818,_0x7d23b1){_0x557818=_0x557818-0x0;var _0x87238f=_0xcc36[_0x557818];return _0x87238f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6cc3('0x0'));var BPromise=require(_0x6cc3('0x1'));var rs=require(_0x6cc3('0x2'));var fs=require('fs');var Redis=require(_0x6cc3('0x3'));var db=require(_0x6cc3('0x4'))['db'];var utils=require(_0x6cc3('0x5'));var logger=require(_0x6cc3('0x6'))(_0x6cc3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cc3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c666,_0x1bf39d,_0x11325a){return new BPromise(function(_0x6ddc68,_0x1a0bf6){return client['request'](_0x10c666,_0x11325a)[_0x6cc3('0x9')](function(_0x25f160){logger[_0x6cc3('0xa')](_0x6cc3('0xb'),_0x1bf39d,_0x6cc3('0xc'));logger[_0x6cc3('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x1bf39d,_0x6cc3('0xc'),JSON[_0x6cc3('0xe')](_0x25f160));if(_0x25f160[_0x6cc3('0xf')]){if(_0x25f160['error'][_0x6cc3('0x10')]===0x1f4){logger[_0x6cc3('0xf')](_0x6cc3('0xb'),_0x1bf39d,_0x25f160[_0x6cc3('0xf')][_0x6cc3('0x11')]);return _0x1a0bf6(_0x25f160[_0x6cc3('0xf')][_0x6cc3('0x11')]);}logger[_0x6cc3('0xf')](_0x6cc3('0xb'),_0x1bf39d,_0x25f160['error'][_0x6cc3('0x11')]);return _0x6ddc68(_0x25f160[_0x6cc3('0xf')][_0x6cc3('0x11')]);}else{logger[_0x6cc3('0xa')](_0x6cc3('0xb'),_0x1bf39d,_0x6cc3('0xc'));_0x6ddc68(_0x25f160[_0x6cc3('0x12')][_0x6cc3('0x11')]);}})[_0x6cc3('0x13')](function(_0x19fc68){logger['error'](_0x6cc3('0xb'),_0x1bf39d,_0x19fc68);_0x1a0bf6(_0x19fc68);});});}exports[_0x6cc3('0x14')]=function(_0x19f1ac){var _0x167cb8=this;return new Promise(function(_0x1985f7,_0x1d355f){return db[_0x6cc3('0x15')][_0x6cc3('0x16')](_0x19f1ac[_0x6cc3('0x17')],{'raw':_0x19f1ac['options']?_0x19f1ac['options']['raw']===undefined?!![]:![]:!![]})[_0x6cc3('0x9')](function(_0x5bb140){logger[_0x6cc3('0xa')](_0x6cc3('0x14'),_0x19f1ac);logger[_0x6cc3('0xd')](_0x6cc3('0x14'),_0x19f1ac,JSON[_0x6cc3('0xe')](_0x5bb140));_0x1985f7(_0x5bb140);})['catch'](function(_0x3d35b1){logger['error'](_0x6cc3('0x14'),_0x3d35b1[_0x6cc3('0x11')],_0x19f1ac);_0x1d355f(_0x167cb8['error'](0x1f4,_0x3d35b1[_0x6cc3('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7321a9f..de264dd 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 _0xcac5=['../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','15s','test','put','update','delete','destroy','exports','path','connect-timeout','fs-extra'];(function(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0xcac5,0x107));var _0x5cac=function(_0x153fa3,_0x4e8ffb){_0x153fa3=_0x153fa3-0x0;var _0x1bc960=_0xcac5[_0x153fa3];return _0x1bc960;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5cac('0x0'));var timeout=require(_0x5cac('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5cac('0x2'));var auth=require(_0x5cac('0x3'));var interaction=require(_0x5cac('0x4'));var config=require('../../config/environment');var controller=require(_0x5cac('0x5'));router[_0x5cac('0x6')]('/',auth['isAuthenticated'](),controller[_0x5cac('0x7')]);router[_0x5cac('0x6')](_0x5cac('0x8'),auth[_0x5cac('0x9')](),controller[_0x5cac('0xa')]);router[_0x5cac('0x6')](_0x5cac('0xb'),auth[_0x5cac('0x9')](),timeout(_0x5cac('0xc')),controller[_0x5cac('0xd')]);router['post']('/',auth[_0x5cac('0x9')](),controller['create']);router[_0x5cac('0xe')](_0x5cac('0x8'),auth[_0x5cac('0x9')](),controller[_0x5cac('0xf')]);router[_0x5cac('0x10')](_0x5cac('0x8'),auth[_0x5cac('0x9')](),controller[_0x5cac('0x11')]);module[_0x5cac('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8b3cfb4..1b7a116 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 _0xaa8b=['sequelize','STRING','name'];(function(_0x5960d9,_0x2ce32f){var _0x12b84d=function(_0x3fba6b){while(--_0x3fba6b){_0x5960d9['push'](_0x5960d9['shift']());}};_0x12b84d(++_0x2ce32f);}(_0xaa8b,0xcf));var _0xbaa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa8b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbaa8('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaa8('0x1')],'unique':_0xbaa8('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xbaa8('0x1')]},'description':{'type':Sequelize[_0xbaa8('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 120af67..ebce39d 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 _0xb64c=['send','index','map','SquareOdbc','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','odbc','openSync','dsn','closeSync','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','apply','reject','save','then','get','ODBC','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x50246d,_0x287f86){var _0x15fb99=function(_0x4b821f){while(--_0x4b821f){_0x50246d['push'](_0x50246d['shift']());}};_0x15fb99(++_0x287f86);}(_0xb64c,0x181));var _0xcb64=function(_0x3e2c1e,_0x1e8d40){_0x3e2c1e=_0x3e2c1e-0x0;var _0x1c6666=_0xb64c[_0x3e2c1e];return _0x1c6666;};'use strict';var emlformat=require(_0xcb64('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb64('0x2'));var moment=require(_0xcb64('0x3'));var BPromise=require(_0xcb64('0x4'));var Mustache=require('mustache');var util=require(_0xcb64('0x5'));var path=require(_0xcb64('0x6'));var sox=require(_0xcb64('0x7'));var csv=require('to-csv');var ejs=require(_0xcb64('0x8'));var fs=require('fs');var fs_extra=require(_0xcb64('0x9'));var _=require(_0xcb64('0xa'));var squel=require(_0xcb64('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb64('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb64('0xd'));var querystring=require('querystring');var Papa=require(_0xcb64('0xe'));var Redis=require(_0xcb64('0xf'));var authService=require(_0xcb64('0x10'));var qs=require(_0xcb64('0x11'));var as=require(_0xcb64('0x12'));var hardwareService=require(_0xcb64('0x13'));var logger=require(_0xcb64('0x14'))(_0xcb64('0x15'));var utils=require(_0xcb64('0x16'));var config=require(_0xcb64('0x17'));var licenseUtil=require(_0xcb64('0x18'));var db=require(_0xcb64('0x19'))['db'];function respondWithStatusCode(_0x14b625,_0x3ac344){_0x3ac344=_0x3ac344||0xcc;return function(_0xac06b4){if(_0xac06b4){return _0x14b625['sendStatus'](_0x3ac344);}return _0x14b625[_0xcb64('0x1a')](_0x3ac344)[_0xcb64('0x1b')]();};}function respondWithResult(_0x4731d3,_0xefd7f0){_0xefd7f0=_0xefd7f0||0xc8;return function(_0x2a8dac){if(_0x2a8dac){return _0x4731d3['status'](_0xefd7f0)['json'](_0x2a8dac);}};}function respondWithFilteredResult(_0x10f780,_0x23bbf5){return function(_0x256465){if(_0x256465){var _0x2cbf75=typeof _0x23bbf5[_0xcb64('0x1c')]===_0xcb64('0x1d')&&typeof _0x23bbf5[_0xcb64('0x1e')]===_0xcb64('0x1d');var _0x1c173f=_0x256465['count'];var _0x3476b4=_0x2cbf75?0x0:_0x23bbf5[_0xcb64('0x1c')];var _0x46bb4=_0x2cbf75?_0x256465[_0xcb64('0x1f')]:_0x23bbf5[_0xcb64('0x1c')]+_0x23bbf5[_0xcb64('0x1e')];var _0x2c27ee;if(_0x46bb4>=_0x1c173f){_0x46bb4=_0x1c173f;_0x2c27ee=0xc8;}else{_0x2c27ee=0xce;}_0x10f780[_0xcb64('0x1a')](_0x2c27ee);return _0x10f780[_0xcb64('0x20')]('Content-Range',_0x3476b4+'-'+_0x46bb4+'/'+_0x1c173f)['json'](_0x256465);}return null;};}function patchUpdates(_0x162bb6){return function(_0x805a1b){try{jsonpatch[_0xcb64('0x21')](_0x805a1b,_0x162bb6,!![]);}catch(_0x74482a){return BPromise[_0xcb64('0x22')](_0x74482a);}return _0x805a1b[_0xcb64('0x23')]();};}function saveUpdates(_0x25654e,_0x1d0e0f){return function(_0x465f65){if(_0x465f65){return _0x465f65['update'](_0x25654e)[_0xcb64('0x24')](function(_0x1e2718){return _0x1e2718;});}return null;};}function removeEntity(_0x43a087,_0x5a0551){return function(_0x1fcd7d){if(_0x1fcd7d){return _0x1fcd7d['destroy']()[_0xcb64('0x24')](function(){var _0x55119f=_0x1fcd7d[_0xcb64('0x25')]({'plain':!![]});var _0x4e9856=_0xcb64('0x26');return db[_0xcb64('0x27')][_0xcb64('0x28')]({'where':{'type':_0x4e9856,'resourceId':_0x55119f['id']}})[_0xcb64('0x24')](function(){return _0x1fcd7d;});})['then'](function(){_0x43a087['status'](0xcc)[_0xcb64('0x1b')]();});}};}function handleEntityNotFound(_0x2eb67c,_0x1be234){return function(_0x10185f){if(!_0x10185f){_0x2eb67c[_0xcb64('0x29')](0x194);}return _0x10185f;};}function handleError(_0x2bedff,_0x5ebb60){_0x5ebb60=_0x5ebb60||0x1f4;return function(_0x42799c){logger[_0xcb64('0x2a')](_0x42799c[_0xcb64('0x2b')]);if(_0x42799c[_0xcb64('0x2c')]){delete _0x42799c[_0xcb64('0x2c')];}_0x2bedff[_0xcb64('0x1a')](_0x5ebb60)[_0xcb64('0x2d')](_0x42799c);};}exports[_0xcb64('0x2e')]=function(_0x144d24,_0x540a72){var _0x45e6a9={},_0x4c7080={},_0x334241={'count':0x0,'rows':[]};var _0x366da3=_[_0xcb64('0x2f')](db[_0xcb64('0x30')][_0xcb64('0x31')],function(_0x35c43a){return{'name':_0x35c43a['fieldName'],'type':_0x35c43a[_0xcb64('0x32')]['key']};});_0x4c7080[_0xcb64('0x33')]=_[_0xcb64('0x2f')](_0x366da3,'name');_0x4c7080['query']=_['keys'](_0x144d24[_0xcb64('0x34')]);_0x4c7080[_0xcb64('0x35')]=_[_0xcb64('0x36')](_0x4c7080[_0xcb64('0x33')],_0x4c7080[_0xcb64('0x34')]);_0x45e6a9[_0xcb64('0x37')]=_['intersection'](_0x4c7080['model'],qs[_0xcb64('0x38')](_0x144d24['query'][_0xcb64('0x38')]));_0x45e6a9[_0xcb64('0x37')]=_0x45e6a9[_0xcb64('0x37')][_0xcb64('0x39')]?_0x45e6a9[_0xcb64('0x37')]:_0x4c7080['model'];if(!_0x144d24[_0xcb64('0x34')]['hasOwnProperty'](_0xcb64('0x3a'))){_0x45e6a9[_0xcb64('0x1e')]=qs['limit'](_0x144d24['query'][_0xcb64('0x1e')]);_0x45e6a9['offset']=qs[_0xcb64('0x1c')](_0x144d24[_0xcb64('0x34')][_0xcb64('0x1c')]);}_0x45e6a9['order']=qs[_0xcb64('0x3b')](_0x144d24[_0xcb64('0x34')]['sort']);_0x45e6a9[_0xcb64('0x3c')]=qs[_0xcb64('0x35')](_[_0xcb64('0x3d')](_0x144d24[_0xcb64('0x34')],_0x4c7080[_0xcb64('0x35')]),_0x366da3);if(_0x144d24[_0xcb64('0x34')][_0xcb64('0x3e')]){_0x45e6a9[_0xcb64('0x3c')]=_['merge'](_0x45e6a9['where'],{'$or':_[_0xcb64('0x2f')](_0x366da3,function(_0x5872dd){if(_0x5872dd['type']!=='VIRTUAL'){var _0x21b7ef={};_0x21b7ef[_0x5872dd[_0xcb64('0x2c')]]={'$like':'%'+_0x144d24[_0xcb64('0x34')][_0xcb64('0x3e')]+'%'};return _0x21b7ef;}})});}_0x45e6a9=_['merge']({},_0x45e6a9,_0x144d24[_0xcb64('0x3f')]);var _0x1a61e4={'where':_0x45e6a9[_0xcb64('0x3c')]};return db[_0xcb64('0x30')][_0xcb64('0x1f')](_0x1a61e4)[_0xcb64('0x24')](function(_0x4862e0){_0x334241[_0xcb64('0x1f')]=_0x4862e0;if(_0x144d24[_0xcb64('0x34')]['includeAll']){_0x45e6a9[_0xcb64('0x40')]=[{'all':!![]}];}return db['SquareOdbc'][_0xcb64('0x41')](_0x45e6a9);})['then'](function(_0x418275){_0x334241[_0xcb64('0x42')]=_0x418275;return _0x334241;})['then'](respondWithFilteredResult(_0x540a72,_0x45e6a9))[_0xcb64('0x43')](handleError(_0x540a72,null));};exports[_0xcb64('0x44')]=function(_0x4a8829,_0x592b48){var _0x17a495={'raw':!![],'where':{'id':_0x4a8829[_0xcb64('0x45')]['id']}},_0x2eec63={};_0x2eec63[_0xcb64('0x33')]=_[_0xcb64('0x46')](db[_0xcb64('0x30')][_0xcb64('0x31')]);_0x2eec63[_0xcb64('0x34')]=_[_0xcb64('0x46')](_0x4a8829[_0xcb64('0x34')]);_0x2eec63['filters']=_[_0xcb64('0x36')](_0x2eec63[_0xcb64('0x33')],_0x2eec63[_0xcb64('0x34')]);_0x17a495[_0xcb64('0x37')]=_[_0xcb64('0x36')](_0x2eec63[_0xcb64('0x33')],qs['fields'](_0x4a8829['query']['fields']));_0x17a495[_0xcb64('0x37')]=_0x17a495[_0xcb64('0x37')][_0xcb64('0x39')]?_0x17a495[_0xcb64('0x37')]:_0x2eec63[_0xcb64('0x33')];if(_0x4a8829[_0xcb64('0x34')][_0xcb64('0x47')]){_0x17a495[_0xcb64('0x40')]=[{'all':!![]}];}_0x17a495=_['merge']({},_0x17a495,_0x4a8829[_0xcb64('0x3f')]);return db[_0xcb64('0x30')][_0xcb64('0x48')](_0x17a495)[_0xcb64('0x24')](handleEntityNotFound(_0x592b48,null))[_0xcb64('0x24')](respondWithResult(_0x592b48,null))['catch'](handleError(_0x592b48,null));};exports[_0xcb64('0x49')]=function(_0x38d35c,_0x425a8d){return db['SquareOdbc'][_0xcb64('0x49')](_0x38d35c['body'],{})[_0xcb64('0x24')](function(_0xee40cc){var _0x2950f5=_0x38d35c[_0xcb64('0x4a')][_0xcb64('0x25')]({'plain':!![]});if(!_0x2950f5)throw new Error(_0xcb64('0x4b'));if(_0x2950f5[_0xcb64('0x4c')]===_0xcb64('0x4a')){var _0x30a22b=_0xee40cc[_0xcb64('0x25')]({'plain':!![]});var _0x350761=_0xcb64('0x26');return db['UserProfileSection'][_0xcb64('0x48')]({'where':{'name':_0x350761,'userProfileId':_0x2950f5[_0xcb64('0x4d')]},'raw':!![]})['then'](function(_0x577eb6){if(_0x577eb6&&_0x577eb6['autoAssociation']===0x0){return db['UserProfileResource'][_0xcb64('0x49')]({'name':_0x30a22b[_0xcb64('0x2c')],'resourceId':_0x30a22b['id'],'type':_0x577eb6[_0xcb64('0x2c')],'sectionId':_0x577eb6['id']},{})[_0xcb64('0x24')](function(){return _0xee40cc;});}else{return _0xee40cc;}})['catch'](function(_0x5338e2){logger['error'](_0xcb64('0x4e'),_0x5338e2);throw _0x5338e2;});}return _0xee40cc;})[_0xcb64('0x24')](respondWithResult(_0x425a8d,0xc9))[_0xcb64('0x43')](handleError(_0x425a8d,null));};exports[_0xcb64('0x4f')]=function(_0x2e03c8,_0x330c79){if(_0x2e03c8[_0xcb64('0x50')]['id']){delete _0x2e03c8['body']['id'];}return db[_0xcb64('0x30')][_0xcb64('0x48')]({'where':{'id':_0x2e03c8[_0xcb64('0x45')]['id']}})['then'](handleEntityNotFound(_0x330c79,null))[_0xcb64('0x24')](saveUpdates(_0x2e03c8[_0xcb64('0x50')],null))[_0xcb64('0x24')](respondWithResult(_0x330c79,null))[_0xcb64('0x43')](handleError(_0x330c79,null));};exports[_0xcb64('0x28')]=function(_0x1ed9c0,_0x3e3b79){return db[_0xcb64('0x30')][_0xcb64('0x48')]({'where':{'id':_0x1ed9c0[_0xcb64('0x45')]['id']}})[_0xcb64('0x24')](handleEntityNotFound(_0x3e3b79,null))[_0xcb64('0x24')](removeEntity(_0x3e3b79,null))[_0xcb64('0x43')](handleError(_0x3e3b79,null));};exports[_0xcb64('0x51')]=function(_0x5e0886,_0x48a0b9,_0x29b327){var _0x4f3ea0;return db['SquareOdbc'][_0xcb64('0x48')]({'where':{'id':_0x5e0886['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x48a0b9,null))['then'](function(_0x385fa8){if(_0x385fa8){var _0x471a48=require(_0xcb64('0x52'))();_0x471a48[_0xcb64('0x53')](_0x385fa8[_0xcb64('0x54')]);_0x471a48[_0xcb64('0x55')]();return _0x385fa8;}})[_0xcb64('0x24')](respondWithResult(_0x48a0b9,null))[_0xcb64('0x43')](handleError(_0x48a0b9,null));}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 08cca75..0d5f2cc 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 _0x1b0f=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','square_odbc','lodash'];(function(_0x3d8c1d,_0xdbbc6e){var _0x3808b1=function(_0x336fe6){while(--_0x336fe6){_0x3d8c1d['push'](_0x3d8c1d['shift']());}};_0x3808b1(++_0xdbbc6e);}(_0x1b0f,0x1e5));var _0xf1b0=function(_0x1fbca0,_0x50c4a0){_0x1fbca0=_0x1fbca0-0x0;var _0xe16fe1=_0x1b0f[_0x1fbca0];return _0xe16fe1;};'use strict';var _=require(_0xf1b0('0x0'));var util=require('util');var logger=require(_0xf1b0('0x1'))('api');var moment=require(_0xf1b0('0x2'));var BPromise=require(_0xf1b0('0x3'));var rp=require(_0xf1b0('0x4'));var fs=require('fs');var path=require(_0xf1b0('0x5'));var rimraf=require('rimraf');var config=require(_0xf1b0('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xf1b0('0x7')]=function(_0x1cffd6,_0x1bb189){return _0x1cffd6['define']('SquareOdbc',attributes,{'tableName':_0xf1b0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 16b537b..c32c165 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 _0x30df=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','SquareOdbc','find','options','raw','attributes','include','model','map','lodash','util'];(function(_0x9b4cda,_0x206ec1){var _0x1ac6c5=function(_0x4ba0a3){while(--_0x4ba0a3){_0x9b4cda['push'](_0x9b4cda['shift']());}};_0x1ac6c5(++_0x206ec1);}(_0x30df,0x115));var _0xf30d=function(_0x26bea7,_0x53a0fe){_0x26bea7=_0x26bea7-0x0;var _0x315a9d=_0x30df[_0x26bea7];return _0x315a9d;};'use strict';var _=require(_0xf30d('0x0'));var util=require(_0xf30d('0x1'));var moment=require(_0xf30d('0x2'));var BPromise=require(_0xf30d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf30d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf30d('0x5'));var logger=require(_0xf30d('0x6'))(_0xf30d('0x7'));var config=require(_0xf30d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf30d('0x9')][_0xf30d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba27d,_0x1ccb64,_0x5d7cb6){return new BPromise(function(_0x50ab77,_0x2ee535){return client['request'](_0x5ba27d,_0x5d7cb6)[_0xf30d('0xb')](function(_0x5abfa8){logger[_0xf30d('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x1ccb64,_0xf30d('0xd'));logger[_0xf30d('0xe')](_0xf30d('0xf'),_0x1ccb64,_0xf30d('0xd'),JSON[_0xf30d('0x10')](_0x5abfa8));if(_0x5abfa8[_0xf30d('0x11')]){if(_0x5abfa8[_0xf30d('0x11')][_0xf30d('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1ccb64,_0x5abfa8['error'][_0xf30d('0x13')]);return _0x2ee535(_0x5abfa8[_0xf30d('0x11')]['message']);}logger[_0xf30d('0x11')](_0xf30d('0x14'),_0x1ccb64,_0x5abfa8[_0xf30d('0x11')]['message']);return _0x50ab77(_0x5abfa8[_0xf30d('0x11')][_0xf30d('0x13')]);}else{logger[_0xf30d('0xc')](_0xf30d('0x14'),_0x1ccb64,_0xf30d('0xd'));_0x50ab77(_0x5abfa8[_0xf30d('0x15')][_0xf30d('0x13')]);}})[_0xf30d('0x16')](function(_0x15a621){logger[_0xf30d('0x11')](_0xf30d('0x14'),_0x1ccb64,_0x15a621);_0x2ee535(_0x15a621);});});}exports['ShowSquareOdbc']=function(_0x3078dc){var _0x292080=this;return new Promise(function(_0xb70c05,_0x25013e){return db[_0xf30d('0x17')][_0xf30d('0x18')]({'raw':_0x3078dc[_0xf30d('0x19')]?_0x3078dc[_0xf30d('0x19')][_0xf30d('0x1a')]===undefined?!![]:![]:!![],'where':_0x3078dc[_0xf30d('0x19')]?_0x3078dc[_0xf30d('0x19')]['where']||null:null,'attributes':_0x3078dc['options']?_0x3078dc[_0xf30d('0x19')][_0xf30d('0x1b')]||null:null,'include':_0x3078dc['options']?_0x3078dc['options'][_0xf30d('0x1c')]?_['map'](_0x3078dc[_0xf30d('0x19')][_0xf30d('0x1c')],function(_0x270f69){return{'model':db[_0x270f69[_0xf30d('0x1d')]],'as':_0x270f69['as'],'attributes':_0x270f69['attributes'],'include':_0x270f69['include']?_[_0xf30d('0x1e')](_0x270f69['include'],function(_0x57e5ed){return{'model':db[_0x57e5ed[_0xf30d('0x1d')]],'as':_0x57e5ed['as'],'attributes':_0x57e5ed[_0xf30d('0x1b')],'include':_0x57e5ed['include']?_['map'](_0x57e5ed['include'],function(_0x3e7276){return{'model':db[_0x3e7276['model']],'as':_0x3e7276['as'],'attributes':_0x3e7276[_0xf30d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf30d('0xb')](function(_0x15dd6c){logger[_0xf30d('0xc')]('ShowSquareOdbc',_0x3078dc);logger[_0xf30d('0xe')]('ShowSquareOdbc',_0x3078dc,JSON[_0xf30d('0x10')](_0x15dd6c));_0xb70c05(_0x15dd6c);})[_0xf30d('0x16')](function(_0x1aaa19){logger[_0xf30d('0x11')]('ShowSquareOdbc',_0x1aaa19['message'],_0x3078dc);_0x25013e(_0x292080[_0xf30d('0x11')](0x1f4,_0x1aaa19[_0xf30d('0x13')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 723d2c4..7d005fe 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 _0xefeb=['Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x351168,_0x3fa444){var _0x5594fe=function(_0x26ecdd){while(--_0x26ecdd){_0x351168['push'](_0x351168['shift']());}};_0x5594fe(++_0x3fa444);}(_0xefeb,0x93));var _0xbefe=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xefeb[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xbefe('0x0'));var util=require(_0xbefe('0x1'));var path=require(_0xbefe('0x2'));var timeout=require(_0xbefe('0x3'));var express=require(_0xbefe('0x4'));var router=express[_0xbefe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbefe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbefe('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xbefe('0x8')](),controller[_0xbefe('0x9')]);router[_0xbefe('0xa')](_0xbefe('0xb'),auth[_0xbefe('0x8')](),controller[_0xbefe('0xc')]);router[_0xbefe('0xd')]('/',auth['isAuthenticated'](),controller[_0xbefe('0xe')]);router[_0xbefe('0xf')](_0xbefe('0xb'),auth[_0xbefe('0x8')](),controller[_0xbefe('0x10')]);router[_0xbefe('0x11')](_0xbefe('0xb'),auth[_0xbefe('0x8')](),controller[_0xbefe('0x12')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 2a2f7e5..3f3bec8 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 _0xda4d=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','TEXT','BLOB'];(function(_0x3bf102,_0x31ec09){var _0xe7fc54=function(_0x36010f){while(--_0x36010f){_0x3bf102['push'](_0x3bf102['shift']());}};_0xe7fc54(++_0x31ec09);}(_0xda4d,0x179));var _0xdda4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xda4d[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xdda4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xdda4('0x1')]},'preproduction':{'type':Sequelize[_0xdda4('0x2')](_0xdda4('0x3')),'get':function(){if(this[_0xdda4('0x4')](_0xdda4('0x5'))){return this[_0xdda4('0x4')](_0xdda4('0x5'))[_0xdda4('0x6')](_0xdda4('0x7'));}}},'production':{'type':Sequelize[_0xdda4('0x2')](_0xdda4('0x3')),'get':function(){if(this[_0xdda4('0x4')](_0xdda4('0x8'))){return this[_0xdda4('0x4')](_0xdda4('0x8'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xdda4('0x9')]},'publishedAt':{'type':Sequelize[_0xdda4('0x9')]}}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5286e97..91203a8 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 _0xd3ef=['json','offset','undefined','limit','count','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','sendStatus','name','send','map','SquareProject','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','findAll','catch','params','rawAttributes','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','stringify','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','./squareProject.socket','register','status'];(function(_0x504d,_0x239c33){var _0x35287f=function(_0x35a2d9){while(--_0x35a2d9){_0x504d['push'](_0x504d['shift']());}};_0x35287f(++_0x239c33);}(_0xd3ef,0x76));var _0xfd3e=function(_0xad416d,_0x3790df){_0xad416d=_0xad416d-0x0;var _0x3fd85e=_0xd3ef[_0xad416d];return _0x3fd85e;};'use strict';var _=require(_0xfd3e('0x0'));var Redis=require('ioredis');var qs=require(_0xfd3e('0x1'));var logger=require(_0xfd3e('0x2'))(_0xfd3e('0x3'));var config=require(_0xfd3e('0x4'));var db=require('../../mysqldb')['db'];config[_0xfd3e('0x5')]=_[_0xfd3e('0x6')](config[_0xfd3e('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd3e('0x5')]));require(_0xfd3e('0x7'))[_0xfd3e('0x8')](socket);function respondWithResult(_0x128ae2,_0x6c1d1b){_0x6c1d1b=_0x6c1d1b||0xc8;return function(_0x4504d9){if(_0x4504d9){return _0x128ae2[_0xfd3e('0x9')](_0x6c1d1b)[_0xfd3e('0xa')](_0x4504d9);}};}function respondWithFilteredResult(_0x281eb5,_0x6ba984){return function(_0x25f7d7){if(_0x25f7d7){var _0x55bb15=typeof _0x6ba984[_0xfd3e('0xb')]===_0xfd3e('0xc')&&typeof _0x6ba984[_0xfd3e('0xd')]==='undefined';var _0x16968c=_0x25f7d7[_0xfd3e('0xe')];var _0x538d37=_0x55bb15?0x0:_0x6ba984['offset'];var _0x54cadc=_0x55bb15?_0x25f7d7[_0xfd3e('0xe')]:_0x6ba984['offset']+_0x6ba984['limit'];var _0x134276;if(_0x54cadc>=_0x16968c){_0x54cadc=_0x16968c;_0x134276=0xc8;}else{_0x134276=0xce;}_0x281eb5[_0xfd3e('0x9')](_0x134276);return _0x281eb5['set'](_0xfd3e('0xf'),_0x538d37+'-'+_0x54cadc+'/'+_0x16968c)['json'](_0x25f7d7);}return null;};}function saveUpdates(_0x4206c3){return function(_0x409592){if(_0x409592){return _0x409592[_0xfd3e('0x10')](_0x4206c3)[_0xfd3e('0x11')](function(_0x27f589){return _0x27f589;});}return null;};}function removeEntity(_0x7b1e69){return function(_0x3cba8b){if(_0x3cba8b){return _0x3cba8b[_0xfd3e('0x12')]()[_0xfd3e('0x11')](function(){var _0x373676=_0x3cba8b['get']({'plain':!![]});var _0x560f9b=_0xfd3e('0x13');return db[_0xfd3e('0x14')][_0xfd3e('0x12')]({'where':{'type':_0x560f9b,'resourceId':_0x373676['id']}})[_0xfd3e('0x11')](function(){return _0x3cba8b;});})['then'](function(){var _0x3e53cc=new Redis(config[_0xfd3e('0x5')]);_0x3e53cc['publish']('agi',JSON['stringify']({'id':_0x3cba8b['id'],'deleted':!![]}));})['then'](function(){_0x7b1e69[_0xfd3e('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db63e){return function(_0x4548fa){if(!_0x4548fa){_0x3db63e[_0xfd3e('0x15')](0x194);}return _0x4548fa;};}function handleError(_0x3e8845,_0x36ede6){_0x36ede6=_0x36ede6||0x1f4;return function(_0x532300){logger['error'](_0x532300['stack']);if(_0x532300[_0xfd3e('0x16')]){delete _0x532300[_0xfd3e('0x16')];}_0x3e8845[_0xfd3e('0x9')](_0x36ede6)[_0xfd3e('0x17')](_0x532300);};}exports['index']=function(_0x498755,_0x3d989a){var _0x2873a3={},_0xe83521={},_0x1a67bb={'count':0x0,'rows':[]};var _0x3a9597=_[_0xfd3e('0x18')](db[_0xfd3e('0x19')]['rawAttributes'],function(_0x4bce6c){return{'name':_0x4bce6c[_0xfd3e('0x1a')],'type':_0x4bce6c[_0xfd3e('0x1b')]['key']};});_0xe83521[_0xfd3e('0x1c')]=_['map'](_0x3a9597,_0xfd3e('0x16'));_0xe83521[_0xfd3e('0x1d')]=_[_0xfd3e('0x1e')](_0x498755['query']);_0xe83521['filters']=_[_0xfd3e('0x1f')](_0xe83521[_0xfd3e('0x1c')],_0xe83521[_0xfd3e('0x1d')]);_0x2873a3[_0xfd3e('0x20')]=_['intersection'](_0xe83521[_0xfd3e('0x1c')],qs[_0xfd3e('0x21')](_0x498755['query'][_0xfd3e('0x21')]));_0x2873a3['attributes']=_0x2873a3[_0xfd3e('0x20')][_0xfd3e('0x22')]?_0x2873a3[_0xfd3e('0x20')]:_0xe83521['model'];if(!_0x498755[_0xfd3e('0x1d')][_0xfd3e('0x23')](_0xfd3e('0x24'))){_0x2873a3[_0xfd3e('0xd')]=qs[_0xfd3e('0xd')](_0x498755[_0xfd3e('0x1d')][_0xfd3e('0xd')]);_0x2873a3[_0xfd3e('0xb')]=qs['offset'](_0x498755[_0xfd3e('0x1d')][_0xfd3e('0xb')]);}_0x2873a3[_0xfd3e('0x25')]=qs['sort'](_0x498755[_0xfd3e('0x1d')]['sort']);_0x2873a3[_0xfd3e('0x26')]=qs[_0xfd3e('0x27')](_[_0xfd3e('0x28')](_0x498755[_0xfd3e('0x1d')],_0xe83521['filters']),_0x3a9597);if(_0x498755[_0xfd3e('0x1d')][_0xfd3e('0x29')]){_0x2873a3[_0xfd3e('0x26')]=_[_0xfd3e('0x2a')](_0x2873a3[_0xfd3e('0x26')],{'$or':_[_0xfd3e('0x18')](_0x3a9597,function(_0x2d4c52){if(_0x2d4c52[_0xfd3e('0x1b')]!==_0xfd3e('0x2b')){var _0x474a9f={};_0x474a9f[_0x2d4c52[_0xfd3e('0x16')]]={'$like':'%'+_0x498755['query'][_0xfd3e('0x29')]+'%'};return _0x474a9f;}})});}_0x2873a3=_['merge']({},_0x2873a3,_0x498755[_0xfd3e('0x2c')]);var _0xf76ec5={'where':_0x2873a3[_0xfd3e('0x26')]};return db[_0xfd3e('0x19')][_0xfd3e('0xe')](_0xf76ec5)['then'](function(_0x1bd481){_0x1a67bb[_0xfd3e('0xe')]=_0x1bd481;if(_0x498755['query']['includeAll']){_0x2873a3['include']=[{'all':!![]}];}return db['SquareProject'][_0xfd3e('0x2d')](_0x2873a3);})[_0xfd3e('0x11')](function(_0x5e982c){_0x1a67bb['rows']=_0x5e982c;return _0x1a67bb;})[_0xfd3e('0x11')](respondWithFilteredResult(_0x3d989a,_0x2873a3))[_0xfd3e('0x2e')](handleError(_0x3d989a,null));};exports['show']=function(_0x3f4af0,_0x4c24e7){var _0x3bcd3c={'raw':![],'where':{'id':_0x3f4af0[_0xfd3e('0x2f')]['id']}},_0x4f599b={};_0x4f599b[_0xfd3e('0x1c')]=_[_0xfd3e('0x1e')](db[_0xfd3e('0x19')][_0xfd3e('0x30')]);_0x4f599b[_0xfd3e('0x1d')]=_[_0xfd3e('0x1e')](_0x3f4af0[_0xfd3e('0x1d')]);_0x4f599b['filters']=_[_0xfd3e('0x1f')](_0x4f599b[_0xfd3e('0x1c')],_0x4f599b[_0xfd3e('0x1d')]);_0x3bcd3c['attributes']=_[_0xfd3e('0x1f')](_0x4f599b[_0xfd3e('0x1c')],qs['fields'](_0x3f4af0['query'][_0xfd3e('0x21')]));_0x3bcd3c[_0xfd3e('0x20')]=_0x3bcd3c['attributes'][_0xfd3e('0x22')]?_0x3bcd3c[_0xfd3e('0x20')]:_0x4f599b[_0xfd3e('0x1c')];if(_0x3f4af0[_0xfd3e('0x1d')][_0xfd3e('0x31')]){_0x3bcd3c[_0xfd3e('0x32')]=[{'all':!![]}];}_0x3bcd3c=_[_0xfd3e('0x2a')]({},_0x3bcd3c,_0x3f4af0[_0xfd3e('0x2c')]);return db[_0xfd3e('0x19')]['find'](_0x3bcd3c)[_0xfd3e('0x11')](handleEntityNotFound(_0x4c24e7,null))[_0xfd3e('0x11')](respondWithResult(_0x4c24e7,null))['catch'](handleError(_0x4c24e7,null));};exports[_0xfd3e('0x33')]=function(_0x51edaf,_0x204689){return db[_0xfd3e('0x19')][_0xfd3e('0x33')](_0x51edaf[_0xfd3e('0x34')],{})[_0xfd3e('0x11')](function(_0x3095cd){var _0x5c5e87=_0x51edaf[_0xfd3e('0x35')][_0xfd3e('0x36')]({'plain':!![]});if(!_0x5c5e87)throw new Error(_0xfd3e('0x37'));if(_0x5c5e87[_0xfd3e('0x38')]===_0xfd3e('0x35')){var _0x4cffab=_0x3095cd['get']({'plain':!![]});var _0x14f08d=_0xfd3e('0x13');return db['UserProfileSection'][_0xfd3e('0x39')]({'where':{'name':_0x14f08d,'userProfileId':_0x5c5e87[_0xfd3e('0x3a')]},'raw':!![]})[_0xfd3e('0x11')](function(_0x481f6d){if(_0x481f6d&&_0x481f6d['autoAssociation']===0x0){return db[_0xfd3e('0x14')][_0xfd3e('0x33')]({'name':_0x4cffab[_0xfd3e('0x16')],'resourceId':_0x4cffab['id'],'type':_0x481f6d['name'],'sectionId':_0x481f6d['id']},{})['then'](function(){return _0x3095cd;});}else{return _0x3095cd;}})[_0xfd3e('0x2e')](function(_0x142adb){logger[_0xfd3e('0x3b')](_0xfd3e('0x3c'),_0x142adb);throw _0x142adb;});}return _0x3095cd;})[_0xfd3e('0x11')](respondWithResult(_0x204689,0xc9))[_0xfd3e('0x2e')](handleError(_0x204689,null));};exports[_0xfd3e('0x10')]=function(_0x3c72a6,_0x420492){if(_0x3c72a6[_0xfd3e('0x34')]['id']){delete _0x3c72a6[_0xfd3e('0x34')]['id'];}return db[_0xfd3e('0x19')][_0xfd3e('0x39')]({'where':{'id':_0x3c72a6[_0xfd3e('0x2f')]['id']}})[_0xfd3e('0x11')](handleEntityNotFound(_0x420492,null))[_0xfd3e('0x11')](saveUpdates(_0x3c72a6['body'],null))['then'](function(_0x1c8367){if(!_0x1c8367)return;var _0x49e545=_0x1c8367[_0xfd3e('0x36')]({'plain':!![]});return _0x49e545;})[_0xfd3e('0x11')](function(_0x3cd4e0){var _0x372592=new Redis(config[_0xfd3e('0x5')]);_0x372592['publish'](_0xfd3e('0x3d'),JSON[_0xfd3e('0x3e')](_[_0xfd3e('0x28')](_0x3cd4e0,['id','name',_0xfd3e('0x3f')])));return _0x3cd4e0;})[_0xfd3e('0x11')](respondWithResult(_0x420492,null))[_0xfd3e('0x2e')](handleError(_0x420492,null));};exports[_0xfd3e('0x12')]=function(_0x1464a4,_0x1bcd6e){return db[_0xfd3e('0x19')][_0xfd3e('0x39')]({'where':{'id':_0x1464a4[_0xfd3e('0x2f')]['id']}})[_0xfd3e('0x11')](handleEntityNotFound(_0x1bcd6e,null))[_0xfd3e('0x11')](removeEntity(_0x1bcd6e,null))['catch'](handleError(_0x1bcd6e,null));}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 12eb188..19162f9 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 _0x8049=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x4600ca,_0x535057){var _0x2b6236=function(_0x45e68c){while(--_0x45e68c){_0x4600ca['push'](_0x4600ca['shift']());}};_0x2b6236(++_0x535057);}(_0x8049,0x1a2));var _0x9804=function(_0x51a37f,_0x1c8172){_0x51a37f=_0x51a37f-0x0;var _0x59ffcd=_0x8049[_0x51a37f];return _0x59ffcd;};'use strict';var EventEmitter=require(_0x9804('0x0'));var SquareProject=require(_0x9804('0x1'))['db'][_0x9804('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9804('0x3')](0x0);var events={'afterCreate':_0x9804('0x4'),'afterUpdate':_0x9804('0x5'),'afterDestroy':_0x9804('0x6')};function emitEvent(_0x3dea3b){return function(_0x20aecb,_0x685a0,_0x1aa610){SquareProjectEvents[_0x9804('0x7')](_0x3dea3b+':'+_0x20aecb['id'],_0x20aecb);SquareProjectEvents['emit'](_0x3dea3b,_0x20aecb);_0x1aa610(null);};}for(var e in events){if(events[_0x9804('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4e13257..231cd50 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 _0xa6c8=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','api','moment','bluebird','path','./squareProject.attributes','exports','define'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa6c8,0x88));var _0x8a6c=function(_0x3da66b,_0x34edcd){_0x3da66b=_0x3da66b-0x0;var _0x49a7f9=_0xa6c8[_0x3da66b];return _0x49a7f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8a6c('0x0'));var moment=require(_0x8a6c('0x1'));var BPromise=require(_0x8a6c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a6c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a6c('0x4'));module[_0x8a6c('0x5')]=function(_0x4ed0c6,_0x2b6bf4){return _0x4ed0c6[_0x8a6c('0x6')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5efabc,_0x430f1a,_0x15a006){if(_0x5efabc[_0x8a6c('0x7')](_0x8a6c('0x8'))){_0x5efabc['savedAt']=moment()[_0x8a6c('0x9')](_0x8a6c('0xa'));}if(_0x5efabc[_0x8a6c('0x7')](_0x8a6c('0xb'))){_0x5efabc[_0x8a6c('0xc')]=moment()[_0x8a6c('0x9')](_0x8a6c('0xa'));}_0x15a006(null,_0x5efabc);}}});}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 966a28b..87692f7 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 _0x9ea7=['./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','GetSquareProjects','stringify','error','message','ShowSquareProject','find','info','debug','catch','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x47a70e,_0x103bf8){var _0x392ed6=function(_0x49caa4){while(--_0x49caa4){_0x47a70e['push'](_0x47a70e['shift']());}};_0x392ed6(++_0x103bf8);}(_0x9ea7,0x12d));var _0x79ea=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x9ea7[_0x13187a];return _0x65b85f;};'use strict';var _=require('lodash');var Redis=require(_0x79ea('0x0'));var db=require(_0x79ea('0x1'))['db'];var logger=require(_0x79ea('0x2'))(_0x79ea('0x3'));var config=require(_0x79ea('0x4'));config[_0x79ea('0x5')]=_[_0x79ea('0x6')](config['redis'],{'host':_0x79ea('0x7'),'port':0x18eb});var socket=require(_0x79ea('0x8'))(new Redis(config['redis']));require(_0x79ea('0x9'))[_0x79ea('0xa')](socket);exports['GetSquareProjects']=function(_0x14c7f0){var _0x1f5aa1=this;return new Promise(function(_0x1d25ad,_0x1a81eb){return db[_0x79ea('0xb')][_0x79ea('0xc')]({'raw':_0x14c7f0[_0x79ea('0xd')]?_0x14c7f0['options'][_0x79ea('0xe')]===undefined?!![]:![]:!![],'where':_0x14c7f0[_0x79ea('0xd')]?_0x14c7f0['options'][_0x79ea('0xf')]||null:null,'attributes':_0x14c7f0[_0x79ea('0xd')]?_0x14c7f0[_0x79ea('0xd')][_0x79ea('0x10')]||null:null,'limit':_0x14c7f0[_0x79ea('0xd')]?_0x14c7f0[_0x79ea('0xd')][_0x79ea('0x11')]||null:null,'include':_0x14c7f0[_0x79ea('0xd')]?_0x14c7f0[_0x79ea('0xd')][_0x79ea('0x12')]?_[_0x79ea('0x13')](_0x14c7f0[_0x79ea('0xd')][_0x79ea('0x12')],function(_0x250100){return{'model':db[_0x250100['model']],'as':_0x250100['as'],'attributes':_0x250100['attributes'],'include':_0x250100[_0x79ea('0x12')]?_['map'](_0x250100[_0x79ea('0x12')],function(_0x3ff96c){return{'model':db[_0x3ff96c[_0x79ea('0x14')]],'as':_0x3ff96c['as'],'attributes':_0x3ff96c[_0x79ea('0x10')],'include':_0x3ff96c[_0x79ea('0x12')]?_[_0x79ea('0x13')](_0x3ff96c['include'],function(_0x17dc90){return{'model':db[_0x17dc90[_0x79ea('0x14')]],'as':_0x17dc90['as'],'attributes':_0x17dc90[_0x79ea('0x10')]};}):[]};}):[]};}):[]:[]})[_0x79ea('0x15')](function(_0x46817d){logger['info'](_0x79ea('0x16'),_0x14c7f0);logger['debug'](_0x79ea('0x16'),_0x14c7f0,JSON[_0x79ea('0x17')](_0x46817d));_0x1d25ad(_0x46817d);})['catch'](function(_0x1fb0e5){logger[_0x79ea('0x18')](_0x79ea('0x16'),_0x1fb0e5[_0x79ea('0x19')],_0x14c7f0);_0x1a81eb(_0x1f5aa1[_0x79ea('0x18')](0x1f4,_0x1fb0e5[_0x79ea('0x19')]));});});};exports[_0x79ea('0x1a')]=function(_0x455285){var _0x335d67=this;return new Promise(function(_0x347563,_0x41a78f){return db[_0x79ea('0xb')][_0x79ea('0x1b')]({'raw':_0x455285['options']?_0x455285[_0x79ea('0xd')][_0x79ea('0xe')]===undefined?!![]:![]:!![],'where':_0x455285[_0x79ea('0xd')]?_0x455285[_0x79ea('0xd')][_0x79ea('0xf')]||null:null,'attributes':_0x455285[_0x79ea('0xd')]?_0x455285[_0x79ea('0xd')][_0x79ea('0x10')]||null:null,'include':_0x455285[_0x79ea('0xd')]?_0x455285[_0x79ea('0xd')][_0x79ea('0x12')]?_[_0x79ea('0x13')](_0x455285['options'][_0x79ea('0x12')],function(_0x354259){return{'model':db[_0x354259[_0x79ea('0x14')]],'as':_0x354259['as'],'attributes':_0x354259['attributes'],'include':_0x354259['include']?_[_0x79ea('0x13')](_0x354259['include'],function(_0x54d68e){return{'model':db[_0x54d68e[_0x79ea('0x14')]],'as':_0x54d68e['as'],'attributes':_0x54d68e[_0x79ea('0x10')],'include':_0x54d68e[_0x79ea('0x12')]?_[_0x79ea('0x13')](_0x54d68e['include'],function(_0x372505){return{'model':db[_0x372505[_0x79ea('0x14')]],'as':_0x372505['as'],'attributes':_0x372505[_0x79ea('0x10')]};}):[]};}):[]};}):[]:[]})[_0x79ea('0x15')](function(_0xc32f7d){logger[_0x79ea('0x1c')](_0x79ea('0x1a'),_0x455285);logger[_0x79ea('0x1d')](_0x79ea('0x1a'),_0x455285,JSON[_0x79ea('0x17')](_0xc32f7d));_0x347563(_0xc32f7d);})[_0x79ea('0x1e')](function(_0x157201){logger[_0x79ea('0x18')](_0x79ea('0x1a'),_0x157201['message'],_0x455285);_0x41a78f(_0x335d67[_0x79ea('0x18')](0x1f4,_0x157201[_0x79ea('0x19')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a2b47ad..eb35bad 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 _0xcc8c=['emit','register','squareProject:','save','remove','update'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0xcc8c,0x1b3));var _0xccc8=function(_0x4b3d10,_0x3da823){_0x4b3d10=_0x4b3d10-0x0;var _0x3f62cc=_0xcc8c[_0x4b3d10];return _0x3f62cc;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xccc8('0x0'),_0xccc8('0x1'),_0xccc8('0x2')];function createListener(_0x218cd7,_0x5867e3){return function(_0x4a8dd5){_0x5867e3[_0xccc8('0x3')](_0x218cd7,_0x4a8dd5);};}function removeListener(_0x227248,_0x33d446){return function(){SquareProjectEvents['removeListener'](_0x227248,_0x33d446);};}exports[_0xccc8('0x4')]=function(_0x28f4b9){for(var _0x5e7f85=0x0,_0x57a46d=events['length'];_0x5e7f85<_0x57a46d;_0x5e7f85++){var _0x28e046=events[_0x5e7f85];var _0x227016=createListener(_0xccc8('0x5')+_0x28e046,_0x28f4b9);SquareProjectEvents['on'](_0x28e046,_0x227016);}}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 310089c..d8be611 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x42a1b0,_0x59c7d6){var _0x409715=function(_0x49b9c2){while(--_0x49b9c2){_0x42a1b0['push'](_0x42a1b0['shift']());}};_0x409715(++_0x59c7d6);}(_0x814b,0x1a2));var _0xb814=function(_0x386cef,_0x112e10){_0x386cef=_0x386cef-0x0;var _0x2f866f=_0x814b[_0x386cef];return _0x2f866f;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index bf992e3..f9d134d 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 _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x16fd3d,_0x157323){var _0x26baf9=function(_0x2cd44b){while(--_0x2cd44b){_0x16fd3d['push'](_0x16fd3d['shift']());}};_0x26baf9(++_0x157323);}(_0x5fd1,0x155));var _0x15fd=function(_0x1dec41,_0x4f0520){_0x1dec41=_0x1dec41-0x0;var _0x294655=_0x5fd1[_0x1dec41];return _0x294655;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ebdb945..fe9f79d 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 _0xc094=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0xc094,0x164));var _0x4c09=function(_0x3e7d73,_0x5bad84){_0x3e7d73=_0x3e7d73-0x0;var _0x194fa7=_0xc094[_0x3e7d73];return _0x194fa7;};'use strict';var emlformat=require(_0x4c09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c09('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c09('0x2'));var moment=require(_0x4c09('0x3'));var BPromise=require(_0x4c09('0x4'));var Mustache=require(_0x4c09('0x5'));var util=require('util');var path=require(_0x4c09('0x6'));var sox=require(_0x4c09('0x7'));var csv=require(_0x4c09('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c09('0x9'));var squel=require(_0x4c09('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c09('0xb'));var toCsv=require(_0x4c09('0x8'));var querystring=require(_0x4c09('0xc'));var Papa=require(_0x4c09('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c09('0xe'));var as=require(_0x4c09('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4c09('0x10'));var utils=require(_0x4c09('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4c09('0x12'));var db=require(_0x4c09('0x13'))['db'];function respondWithStatusCode(_0x4aea91,_0x730445){_0x730445=_0x730445||0xcc;return function(_0x57b00b){if(_0x57b00b){return _0x4aea91[_0x4c09('0x14')](_0x730445);}return _0x4aea91[_0x4c09('0x15')](_0x730445)['end']();};}function respondWithResult(_0x1c56f3,_0x1c2805){_0x1c2805=_0x1c2805||0xc8;return function(_0x69608d){if(_0x69608d){return _0x1c56f3[_0x4c09('0x15')](_0x1c2805)[_0x4c09('0x16')](_0x69608d);}};}function respondWithFilteredResult(_0x32b60e,_0x44f247){return function(_0x64cb6f){if(_0x64cb6f){var _0x4729cf=typeof _0x44f247[_0x4c09('0x17')]===_0x4c09('0x18')&&typeof _0x44f247[_0x4c09('0x19')]==='undefined';var _0x24968c=_0x64cb6f[_0x4c09('0x1a')];var _0x13ef3e=_0x4729cf?0x0:_0x44f247[_0x4c09('0x17')];var _0x119632=_0x4729cf?_0x64cb6f[_0x4c09('0x1a')]:_0x44f247[_0x4c09('0x17')]+_0x44f247[_0x4c09('0x19')];var _0x27912f;if(_0x119632>=_0x24968c){_0x119632=_0x24968c;_0x27912f=0xc8;}else{_0x27912f=0xce;}_0x32b60e[_0x4c09('0x15')](_0x27912f);return _0x32b60e['set'](_0x4c09('0x1b'),_0x13ef3e+'-'+_0x119632+'/'+_0x24968c)[_0x4c09('0x16')](_0x64cb6f);}return null;};}function patchUpdates(_0x2837f6){return function(_0x365a18){try{jsonpatch['apply'](_0x365a18,_0x2837f6,!![]);}catch(_0x10982c){return BPromise['reject'](_0x10982c);}return _0x365a18['save']();};}function saveUpdates(_0x5d5ab5,_0x50a343){return function(_0x426c63){if(_0x426c63){return _0x426c63[_0x4c09('0x1c')](_0x5d5ab5)['then'](function(_0x1a5df5){return _0x1a5df5;});}return null;};}function removeEntity(_0x4f3bcc,_0x460d65){return function(_0x5ad8c1){if(_0x5ad8c1){return _0x5ad8c1[_0x4c09('0x1d')]()[_0x4c09('0x1e')](function(){_0x4f3bcc[_0x4c09('0x15')](0xcc)[_0x4c09('0x1f')]();});}};}function handleEntityNotFound(_0x1d521a,_0x9bb08b){return function(_0x572999){if(!_0x572999){_0x1d521a[_0x4c09('0x14')](0x194);}return _0x572999;};}function handleError(_0x4a1931,_0x1c5270){_0x1c5270=_0x1c5270||0x1f4;return function(_0x442c10){logger[_0x4c09('0x20')](_0x442c10[_0x4c09('0x21')]);if(_0x442c10['name']){delete _0x442c10[_0x4c09('0x22')];}_0x4a1931[_0x4c09('0x15')](_0x1c5270)['send'](_0x442c10);};}exports[_0x4c09('0x23')]=function(_0x2a9f52,_0x238019){var _0x11576a={},_0x2c526d={},_0x49a5d1={'count':0x0,'rows':[]};var _0x1c7904=_[_0x4c09('0x24')](db[_0x4c09('0x25')][_0x4c09('0x26')],function(_0xfcc7d9){return{'name':_0xfcc7d9[_0x4c09('0x27')],'type':_0xfcc7d9['type'][_0x4c09('0x28')]};});_0x2c526d[_0x4c09('0x29')]=_[_0x4c09('0x24')](_0x1c7904,'name');_0x2c526d['query']=_[_0x4c09('0x2a')](_0x2a9f52[_0x4c09('0x2b')]);_0x2c526d[_0x4c09('0x2c')]=_[_0x4c09('0x2d')](_0x2c526d[_0x4c09('0x29')],_0x2c526d[_0x4c09('0x2b')]);_0x11576a[_0x4c09('0x2e')]=_['intersection'](_0x2c526d['model'],qs[_0x4c09('0x2f')](_0x2a9f52['query']['fields']));_0x11576a[_0x4c09('0x2e')]=_0x11576a['attributes'][_0x4c09('0x30')]?_0x11576a[_0x4c09('0x2e')]:_0x2c526d[_0x4c09('0x29')];if(!_0x2a9f52[_0x4c09('0x2b')][_0x4c09('0x31')]('nolimit')){_0x11576a[_0x4c09('0x19')]=qs[_0x4c09('0x19')](_0x2a9f52[_0x4c09('0x2b')][_0x4c09('0x19')]);_0x11576a[_0x4c09('0x17')]=qs[_0x4c09('0x17')](_0x2a9f52['query']['offset']);}_0x11576a[_0x4c09('0x32')]=qs[_0x4c09('0x33')](_0x2a9f52['query'][_0x4c09('0x33')]);_0x11576a['where']=qs['filters'](_[_0x4c09('0x34')](_0x2a9f52['query'],_0x2c526d['filters']),_0x1c7904);if(_0x2a9f52['query'][_0x4c09('0x35')]){_0x11576a[_0x4c09('0x36')]=_['merge'](_0x11576a[_0x4c09('0x36')],{'$or':_[_0x4c09('0x24')](_0x1c7904,function(_0x3da994){if(_0x3da994['type']!=='VIRTUAL'){var _0x1ee3bf={};_0x1ee3bf[_0x3da994['name']]={'$like':'%'+_0x2a9f52['query'][_0x4c09('0x35')]+'%'};return _0x1ee3bf;}})});}_0x11576a=_[_0x4c09('0x37')]({},_0x11576a,_0x2a9f52[_0x4c09('0x38')]);var _0x116420={'where':_0x11576a['where']};return db[_0x4c09('0x25')]['count'](_0x116420)[_0x4c09('0x1e')](function(_0x197934){_0x49a5d1[_0x4c09('0x1a')]=_0x197934;if(_0x2a9f52[_0x4c09('0x2b')]['includeAll']){_0x11576a[_0x4c09('0x39')]=[{'all':!![]}];}return db[_0x4c09('0x25')][_0x4c09('0x3a')](_0x11576a);})['then'](function(_0x44ad42){_0x49a5d1[_0x4c09('0x3b')]=_0x44ad42;return _0x49a5d1;})[_0x4c09('0x1e')](respondWithFilteredResult(_0x238019,_0x11576a))[_0x4c09('0x3c')](handleError(_0x238019,null));};exports['show']=function(_0xe52030,_0xdb9c3b){var _0xa31443={'raw':!![],'where':{'id':_0xe52030[_0x4c09('0x3d')]['id']}},_0x198a84={};_0x198a84['model']=_[_0x4c09('0x2a')](db[_0x4c09('0x25')][_0x4c09('0x26')]);_0x198a84[_0x4c09('0x2b')]=_[_0x4c09('0x2a')](_0xe52030[_0x4c09('0x2b')]);_0x198a84['filters']=_[_0x4c09('0x2d')](_0x198a84['model'],_0x198a84[_0x4c09('0x2b')]);_0xa31443['attributes']=_['intersection'](_0x198a84['model'],qs['fields'](_0xe52030[_0x4c09('0x2b')][_0x4c09('0x2f')]));_0xa31443[_0x4c09('0x2e')]=_0xa31443[_0x4c09('0x2e')][_0x4c09('0x30')]?_0xa31443['attributes']:_0x198a84[_0x4c09('0x29')];if(_0xe52030[_0x4c09('0x2b')][_0x4c09('0x3e')]){_0xa31443[_0x4c09('0x39')]=[{'all':!![]}];}_0xa31443=_[_0x4c09('0x37')]({},_0xa31443,_0xe52030[_0x4c09('0x38')]);return db[_0x4c09('0x25')][_0x4c09('0x3f')](_0xa31443)[_0x4c09('0x1e')](handleEntityNotFound(_0xdb9c3b,null))[_0x4c09('0x1e')](respondWithResult(_0xdb9c3b,null))[_0x4c09('0x3c')](handleError(_0xdb9c3b,null));};exports[_0x4c09('0x40')]=function(_0x366635,_0x28d0aa){return db[_0x4c09('0x25')]['create'](_0x366635[_0x4c09('0x41')],{})[_0x4c09('0x1e')](respondWithResult(_0x28d0aa,0xc9))[_0x4c09('0x3c')](handleError(_0x28d0aa,null));};exports[_0x4c09('0x1c')]=function(_0x200176,_0x334d71){if(_0x200176[_0x4c09('0x41')]['id']){delete _0x200176['body']['id'];}return db['SquareRecording'][_0x4c09('0x3f')]({'where':{'id':_0x200176['params']['id']}})[_0x4c09('0x1e')](handleEntityNotFound(_0x334d71,null))['then'](saveUpdates(_0x200176[_0x4c09('0x41')],null))[_0x4c09('0x1e')](respondWithResult(_0x334d71,null))['catch'](handleError(_0x334d71,null));};exports[_0x4c09('0x42')]=function(_0x1f7fa3,_0x3074c4,_0x1c53eb){var _0x154d43=require(_0x4c09('0x43'));var _0x5a8fe3=![];var _0x1304a6={};if(_0x1f7fa3[_0x4c09('0x2b')][_0x4c09('0x44')]&&_0x1f7fa3['query'][_0x4c09('0x44')]===_0x4c09('0x45')){_0x1304a6[_0x4c09('0x45')]=_0x1f7fa3[_0x4c09('0x3d')]['id'];}else{_0x1304a6['id']=_0x1f7fa3[_0x4c09('0x3d')]['id'];}return db[_0x4c09('0x25')][_0x4c09('0x3f')]({'where':_0x1304a6,'attributes':['id',_0x4c09('0x46'),_0x4c09('0x47')],'raw':!![]})[_0x4c09('0x1e')](handleEntityNotFound(_0x3074c4,null))[_0x4c09('0x1e')](function(_0x3e2345){if(_0x3e2345){var _0x5b3dd9=_0x3e2345[_0x4c09('0x46')];var _0x50381a=util['format'](_0x4c09('0x48'),_0x5b3dd9);if(fs[_0x4c09('0x49')](_0x50381a)){_0x5a8fe3=!![];return _0x154d43[_0x4c09('0x4a')](_0x50381a,_0x5b3dd9,config[_0x4c09('0x4b')][_0x4c09('0x4c')])[_0x4c09('0x1e')](function(){return _0x3e2345;});}return _0x3e2345;}})['then'](function(_0x4d6a5c){if(_0x4d6a5c){var _0x42f8cc=_0x4d6a5c[_0x4c09('0x46')];if(!fs['existsSync'](_0x42f8cc)){throw new db[(_0x4c09('0x4d'))]['ValidationError'](_0x4c09('0x4e'));}if(_0x4d6a5c[_0x4c09('0x47')]){return _0x3074c4[_0x4c09('0x42')](_0x42f8cc,_0x4d6a5c[_0x4c09('0x47')]+path[_0x4c09('0x4f')](_0x42f8cc),function(){if(_0x5a8fe3){fs[_0x4c09('0x50')](_0x42f8cc);}});}else{return _0x3074c4[_0x4c09('0x42')](_0x42f8cc,function(_0x14a02a){if(_0x5a8fe3){fs[_0x4c09('0x50')](_0x42f8cc);}});}}})[_0x4c09('0x3c')](function(_0xdcb4e){if(_0xdcb4e[_0x4c09('0x51')]===_0x4c09('0x4e')){_0x3074c4['status'](0x194)[_0x4c09('0x52')](_0x4c09('0x53'));}else{return handleError(_0x3074c4,null);}});};exports[_0x4c09('0x1d')]=function(_0x1143e6,_0x395286){return db['SquareRecording'][_0x4c09('0x3f')]({'where':{'id':_0x1143e6[_0x4c09('0x3d')]['id']}})[_0x4c09('0x1e')](function(_0x287e41){if(_['isNil'](_0x287e41)){throw new ReferenceError(_0x4c09('0x54'));}return _0x287e41;})[_0x4c09('0x1e')](function(_0x11b075){var _0x38ddb8=_0x11b075[_0x4c09('0x46')];logger['info'](_0x4c09('0x55'),_0x38ddb8);if(!_[_0x4c09('0x56')](_0x11b075[_0x4c09('0x46')])&&fs['existsSync'](_0x38ddb8)){logger['info'](_0x4c09('0x57')+_0x38ddb8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x38ddb8);}_0x38ddb8=_0x38ddb8+_0x4c09('0x58');if(!_[_0x4c09('0x56')](_0x11b075[_0x4c09('0x46')])&&fs[_0x4c09('0x49')](_0x38ddb8)){logger[_0x4c09('0x59')](_0x4c09('0x57')+_0x38ddb8+_0x4c09('0x5a'));fs[_0x4c09('0x5b')](_0x38ddb8);}return _0x11b075;})[_0x4c09('0x1e')](function(_0x163e62){if(!_0x163e62)throw new InternalError();return _0x163e62[_0x4c09('0x1d')]();})[_0x4c09('0x1e')](function(){_0x395286[_0x4c09('0x15')](0xcc)[_0x4c09('0x1f')]();})['catch'](handleError(_0x395286,null));}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e5ce55f..19a9ab1 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 _0x229c=['moment','path','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','util'];(function(_0x1ad15c,_0x394acd){var _0x2925c7=function(_0x52dd65){while(--_0x52dd65){_0x1ad15c['push'](_0x1ad15c['shift']());}};_0x2925c7(++_0x394acd);}(_0x229c,0xcf));var _0xc229=function(_0x12bd80,_0xd68bbe){_0x12bd80=_0x12bd80-0x0;var _0x102555=_0x229c[_0x12bd80];return _0x102555;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc229('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc229('0x2'));var rimraf=require('rimraf');var config=require(_0xc229('0x3'));var attributes=require(_0xc229('0x4'));module[_0xc229('0x5')]=function(_0x5a0d2c,_0x44aba3){return _0x5a0d2c['define'](_0xc229('0x6'),attributes,{'tableName':_0xc229('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index af7267b..d6158a4 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 _0xd48b=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','moment','bluebird'];(function(_0x2563cd,_0x94ca16){var _0x336df5=function(_0x2d5ee2){while(--_0x2d5ee2){_0x2563cd['push'](_0x2563cd['shift']());}};_0x336df5(++_0x94ca16);}(_0xd48b,0x8a));var _0xbd48=function(_0xbf8603,_0x2fee0d){_0xbf8603=_0xbf8603-0x0;var _0x490b8e=_0xd48b[_0xbf8603];return _0x490b8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbd48('0x0'));var BPromise=require(_0xbd48('0x1'));var rs=require(_0xbd48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd48('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd48('0x4'))(_0xbd48('0x5'));var config=require(_0xbd48('0x6'));var jayson=require(_0xbd48('0x7'));var client=jayson[_0xbd48('0x8')][_0xbd48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5bbe,_0x599b1b,_0x6e05f8){return new BPromise(function(_0x2dd3ec,_0x408f79){return client[_0xbd48('0xa')](_0x1b5bbe,_0x6e05f8)[_0xbd48('0xb')](function(_0x310080){logger['info']('SquareRecording,\x20%s,\x20%s',_0x599b1b,_0xbd48('0xc'));logger[_0xbd48('0xd')](_0xbd48('0xe'),_0x599b1b,_0xbd48('0xc'),JSON[_0xbd48('0xf')](_0x310080));if(_0x310080[_0xbd48('0x10')]){if(_0x310080[_0xbd48('0x10')][_0xbd48('0x11')]===0x1f4){logger[_0xbd48('0x10')]('SquareRecording,\x20%s,\x20%s',_0x599b1b,_0x310080[_0xbd48('0x10')][_0xbd48('0x12')]);return _0x408f79(_0x310080[_0xbd48('0x10')][_0xbd48('0x12')]);}logger[_0xbd48('0x10')](_0xbd48('0x13'),_0x599b1b,_0x310080[_0xbd48('0x10')][_0xbd48('0x12')]);return _0x2dd3ec(_0x310080[_0xbd48('0x10')][_0xbd48('0x12')]);}else{logger['info'](_0xbd48('0x13'),_0x599b1b,_0xbd48('0xc'));_0x2dd3ec(_0x310080[_0xbd48('0x14')][_0xbd48('0x12')]);}})[_0xbd48('0x15')](function(_0x1b373b){logger[_0xbd48('0x10')]('SquareRecording,\x20%s,\x20%s',_0x599b1b,_0x1b373b);_0x408f79(_0x1b373b);});});}exports[_0xbd48('0x16')]=function(_0x11a62d){var _0x2f39fb=this;return new Promise(function(_0x432e1d,_0x31b1bc){return db[_0xbd48('0x17')][_0xbd48('0x18')](_0x11a62d[_0xbd48('0x19')],{'raw':_0x11a62d[_0xbd48('0x1a')]?_0x11a62d[_0xbd48('0x1a')][_0xbd48('0x1b')]===undefined?!![]:![]:!![]})[_0xbd48('0xb')](function(_0x249921){logger['info'](_0xbd48('0x16'),_0x11a62d);logger['debug'](_0xbd48('0x16'),_0x11a62d,JSON['stringify'](_0x249921));_0x432e1d(_0x249921);})['catch'](function(_0x262edb){logger[_0xbd48('0x10')](_0xbd48('0x16'),_0x262edb[_0xbd48('0x12')],_0x11a62d);_0x31b1bc(_0x2f39fb[_0xbd48('0x10')](0x1f4,_0x262edb[_0xbd48('0x12')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7db1a0e..42a313b 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x495c3d,_0x297212){var _0x1b4ad4=function(_0x37f9e7){while(--_0x37f9e7){_0x495c3d['push'](_0x495c3d['shift']());}};_0x1b4ad4(++_0x297212);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 94d891b..e8fe2b5 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 _0xd664=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xd664,0xf8));var _0x4d66=function(_0x16b664,_0x32ad90){_0x16b664=_0x16b664-0x0;var _0x5a190b=_0xd664[_0x16b664];return _0x5a190b;};'use strict';var Sequelize=require(_0x4d66('0x0'));module[_0x4d66('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4d66('0x2')]},'channel':{'type':Sequelize[_0x4d66('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d66('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x4d66('0x2')]},'callerid':{'type':Sequelize[_0x4d66('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x4d66('0x2')]},'callingani2':{'type':Sequelize[_0x4d66('0x2')]},'callington':{'type':Sequelize[_0x4d66('0x2')]},'callingtns':{'type':Sequelize[_0x4d66('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x4d66('0x2')]},'context':{'type':Sequelize[_0x4d66('0x2')]},'extension':{'type':Sequelize[_0x4d66('0x2')]},'priority':{'type':Sequelize[_0x4d66('0x2')]},'enhanced':{'type':Sequelize[_0x4d66('0x2')]},'accountcode':{'type':Sequelize[_0x4d66('0x2')]},'threadid':{'type':Sequelize[_0x4d66('0x2')]},'project_name':{'type':Sequelize[_0x4d66('0x2')]},'joinAt':{'type':Sequelize[_0x4d66('0x3')]},'leaveAt':{'type':Sequelize[_0x4d66('0x3')]},'bot':{'type':Sequelize[_0x4d66('0x4')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2bc3a9b..1de1a0c 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 _0x6fec=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','error','name','send','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SquareReport','includeAll','include','findAll','then','catch','show','params','find','create','body','describe','eml-format','rimraf'];(function(_0x12f374,_0x25c67d){var _0x530625=function(_0xe3d9b4){while(--_0xe3d9b4){_0x12f374['push'](_0x12f374['shift']());}};_0x530625(++_0x25c67d);}(_0x6fec,0xd9));var _0xc6fe=function(_0x395a42,_0x1acada){_0x395a42=_0x395a42-0x0;var _0xf5df12=_0x6fec[_0x395a42];return _0xf5df12;};'use strict';var emlformat=require(_0xc6fe('0x0'));var rimraf=require(_0xc6fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6fe('0x2'));var rp=require(_0xc6fe('0x3'));var moment=require(_0xc6fe('0x4'));var BPromise=require(_0xc6fe('0x5'));var Mustache=require(_0xc6fe('0x6'));var util=require('util');var path=require(_0xc6fe('0x7'));var sox=require(_0xc6fe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6fe('0x9'));var squel=require(_0xc6fe('0xa'));var crypto=require(_0xc6fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc6fe('0xc'));var toCsv=require(_0xc6fe('0xd'));var querystring=require('querystring');var Papa=require(_0xc6fe('0xe'));var Redis=require(_0xc6fe('0xf'));var authService=require(_0xc6fe('0x10'));var qs=require(_0xc6fe('0x11'));var as=require(_0xc6fe('0x12'));var hardwareService=require(_0xc6fe('0x13'));var logger=require('../../config/logger')(_0xc6fe('0x14'));var utils=require('../../config/utils');var config=require(_0xc6fe('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6fe('0x16'))['db'];function respondWithStatusCode(_0x414ebd,_0x57a8a8){_0x57a8a8=_0x57a8a8||0xcc;return function(_0x3ecc14){if(_0x3ecc14){return _0x414ebd[_0xc6fe('0x17')](_0x57a8a8);}return _0x414ebd[_0xc6fe('0x18')](_0x57a8a8)['end']();};}function respondWithResult(_0x25c1f3,_0x2a1200){_0x2a1200=_0x2a1200||0xc8;return function(_0x391aba){if(_0x391aba){return _0x25c1f3[_0xc6fe('0x18')](_0x2a1200)[_0xc6fe('0x19')](_0x391aba);}};}function respondWithFilteredResult(_0x1e48c0,_0x3355a7){return function(_0x42ff8d){if(_0x42ff8d){var _0x5355aa=typeof _0x3355a7[_0xc6fe('0x1a')]==='undefined'&&typeof _0x3355a7[_0xc6fe('0x1b')]===_0xc6fe('0x1c');var _0x2df51e=_0x42ff8d[_0xc6fe('0x1d')];var _0x501778=_0x5355aa?0x0:_0x3355a7['offset'];var _0x3c8782=_0x5355aa?_0x42ff8d['count']:_0x3355a7['offset']+_0x3355a7[_0xc6fe('0x1b')];var _0x3d066f;if(_0x3c8782>=_0x2df51e){_0x3c8782=_0x2df51e;_0x3d066f=0xc8;}else{_0x3d066f=0xce;}_0x1e48c0['status'](_0x3d066f);return _0x1e48c0['set'](_0xc6fe('0x1e'),_0x501778+'-'+_0x3c8782+'/'+_0x2df51e)[_0xc6fe('0x19')](_0x42ff8d);}return null;};}function patchUpdates(_0x566ea6){return function(_0x433ca4){try{jsonpatch[_0xc6fe('0x1f')](_0x433ca4,_0x566ea6,!![]);}catch(_0x570dcd){return BPromise[_0xc6fe('0x20')](_0x570dcd);}return _0x433ca4[_0xc6fe('0x21')]();};}function saveUpdates(_0xf10987,_0x3842c9){return function(_0x90616e){if(_0x90616e){return _0x90616e[_0xc6fe('0x22')](_0xf10987)['then'](function(_0x3d6788){return _0x3d6788;});}return null;};}function removeEntity(_0x337b24,_0x203c0){return function(_0x104ae0){if(_0x104ae0){return _0x104ae0[_0xc6fe('0x23')]()['then'](function(){_0x337b24[_0xc6fe('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13877b,_0x56ce21){return function(_0x28436f){if(!_0x28436f){_0x13877b[_0xc6fe('0x17')](0x194);}return _0x28436f;};}function handleError(_0x14d5ab,_0x8240ae){_0x8240ae=_0x8240ae||0x1f4;return function(_0x120558){logger[_0xc6fe('0x24')](_0x120558['stack']);if(_0x120558[_0xc6fe('0x25')]){delete _0x120558[_0xc6fe('0x25')];}_0x14d5ab['status'](_0x8240ae)[_0xc6fe('0x26')](_0x120558);};}exports['index']=function(_0x41796d,_0x421d34){var _0x4d1554={},_0x5ef447={},_0x2c6fb7={'count':0x0,'rows':[]};var _0x4c13af=_[_0xc6fe('0x27')](db['SquareReport']['rawAttributes'],function(_0x57e267){return{'name':_0x57e267[_0xc6fe('0x28')],'type':_0x57e267[_0xc6fe('0x29')][_0xc6fe('0x2a')]};});_0x5ef447['model']=_[_0xc6fe('0x27')](_0x4c13af,'name');_0x5ef447[_0xc6fe('0x2b')]=_[_0xc6fe('0x2c')](_0x41796d[_0xc6fe('0x2b')]);_0x5ef447[_0xc6fe('0x2d')]=_[_0xc6fe('0x2e')](_0x5ef447['model'],_0x5ef447[_0xc6fe('0x2b')]);_0x4d1554[_0xc6fe('0x2f')]=_[_0xc6fe('0x2e')](_0x5ef447[_0xc6fe('0x30')],qs['fields'](_0x41796d['query'][_0xc6fe('0x31')]));_0x4d1554['attributes']=_0x4d1554[_0xc6fe('0x2f')][_0xc6fe('0x32')]?_0x4d1554['attributes']:_0x5ef447[_0xc6fe('0x30')];if(!_0x41796d[_0xc6fe('0x2b')][_0xc6fe('0x33')](_0xc6fe('0x34'))){_0x4d1554[_0xc6fe('0x1b')]=qs['limit'](_0x41796d['query'][_0xc6fe('0x1b')]);_0x4d1554['offset']=qs['offset'](_0x41796d[_0xc6fe('0x2b')]['offset']);}_0x4d1554[_0xc6fe('0x35')]=qs['sort'](_0x41796d[_0xc6fe('0x2b')][_0xc6fe('0x36')]);_0x4d1554[_0xc6fe('0x37')]=qs[_0xc6fe('0x2d')](_[_0xc6fe('0x38')](_0x41796d[_0xc6fe('0x2b')],_0x5ef447[_0xc6fe('0x2d')]),_0x4c13af);if(_0x41796d[_0xc6fe('0x2b')]['filter']){_0x4d1554[_0xc6fe('0x37')]=_[_0xc6fe('0x39')](_0x4d1554['where'],{'$or':_[_0xc6fe('0x27')](_0x4c13af,function(_0x43bd9a){if(_0x43bd9a[_0xc6fe('0x29')]!==_0xc6fe('0x3a')){var _0x5eec0a={};_0x5eec0a[_0x43bd9a[_0xc6fe('0x25')]]={'$like':'%'+_0x41796d[_0xc6fe('0x2b')][_0xc6fe('0x3b')]+'%'};return _0x5eec0a;}})});}_0x4d1554=_['merge']({},_0x4d1554,_0x41796d[_0xc6fe('0x3c')]);var _0x37e1ee={'where':_0x4d1554[_0xc6fe('0x37')]};return db[_0xc6fe('0x3d')][_0xc6fe('0x1d')](_0x37e1ee)['then'](function(_0x275bb2){_0x2c6fb7[_0xc6fe('0x1d')]=_0x275bb2;if(_0x41796d[_0xc6fe('0x2b')][_0xc6fe('0x3e')]){_0x4d1554[_0xc6fe('0x3f')]=[{'all':!![]}];}return db[_0xc6fe('0x3d')][_0xc6fe('0x40')](_0x4d1554);})['then'](function(_0x39223a){_0x2c6fb7['rows']=_0x39223a;return _0x2c6fb7;})[_0xc6fe('0x41')](respondWithFilteredResult(_0x421d34,_0x4d1554))[_0xc6fe('0x42')](handleError(_0x421d34,null));};exports[_0xc6fe('0x43')]=function(_0x534ae0,_0x46ac7e){var _0x4646c8={'raw':!![],'where':{'id':_0x534ae0[_0xc6fe('0x44')]['id']}},_0x4bb9a9={};_0x4bb9a9[_0xc6fe('0x30')]=_['keys'](db['SquareReport']['rawAttributes']);_0x4bb9a9['query']=_[_0xc6fe('0x2c')](_0x534ae0[_0xc6fe('0x2b')]);_0x4bb9a9[_0xc6fe('0x2d')]=_[_0xc6fe('0x2e')](_0x4bb9a9[_0xc6fe('0x30')],_0x4bb9a9[_0xc6fe('0x2b')]);_0x4646c8[_0xc6fe('0x2f')]=_[_0xc6fe('0x2e')](_0x4bb9a9[_0xc6fe('0x30')],qs[_0xc6fe('0x31')](_0x534ae0['query']['fields']));_0x4646c8[_0xc6fe('0x2f')]=_0x4646c8[_0xc6fe('0x2f')][_0xc6fe('0x32')]?_0x4646c8[_0xc6fe('0x2f')]:_0x4bb9a9[_0xc6fe('0x30')];if(_0x534ae0['query'][_0xc6fe('0x3e')]){_0x4646c8[_0xc6fe('0x3f')]=[{'all':!![]}];}_0x4646c8=_[_0xc6fe('0x39')]({},_0x4646c8,_0x534ae0[_0xc6fe('0x3c')]);return db[_0xc6fe('0x3d')][_0xc6fe('0x45')](_0x4646c8)[_0xc6fe('0x41')](handleEntityNotFound(_0x46ac7e,null))['then'](respondWithResult(_0x46ac7e,null))[_0xc6fe('0x42')](handleError(_0x46ac7e,null));};exports[_0xc6fe('0x46')]=function(_0x2cc1ef,_0x5feead){return db[_0xc6fe('0x3d')][_0xc6fe('0x46')](_0x2cc1ef[_0xc6fe('0x47')],{})[_0xc6fe('0x41')](respondWithResult(_0x5feead,0xc9))[_0xc6fe('0x42')](handleError(_0x5feead,null));};exports['update']=function(_0x5ed8f7,_0x2ec400){if(_0x5ed8f7[_0xc6fe('0x47')]['id']){delete _0x5ed8f7[_0xc6fe('0x47')]['id'];}return db[_0xc6fe('0x3d')]['find']({'where':{'id':_0x5ed8f7[_0xc6fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ec400,null))[_0xc6fe('0x41')](saveUpdates(_0x5ed8f7[_0xc6fe('0x47')],null))[_0xc6fe('0x41')](respondWithResult(_0x2ec400,null))[_0xc6fe('0x42')](handleError(_0x2ec400,null));};exports[_0xc6fe('0x23')]=function(_0x45ccb4,_0xd943bc){return db[_0xc6fe('0x3d')][_0xc6fe('0x45')]({'where':{'id':_0x45ccb4[_0xc6fe('0x44')]['id']}})[_0xc6fe('0x41')](handleEntityNotFound(_0xd943bc,null))[_0xc6fe('0x41')](removeEntity(_0xd943bc,null))[_0xc6fe('0x42')](handleError(_0xd943bc,null));};exports[_0xc6fe('0x48')]=function(_0x33afda,_0x401780){return db[_0xc6fe('0x3d')][_0xc6fe('0x48')]()[_0xc6fe('0x41')](respondWithResult(_0x401780,null))[_0xc6fe('0x42')](handleError(_0x401780,null));}; \ No newline at end of file +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 diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1331d34..6679e81 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 _0xd6b5=['lodash','util','../../config/logger','path','rimraf','exports','SquareReport','uid_pname','project_name','leaveAt'];(function(_0x3e2c33,_0x579090){var _0x533aa0=function(_0x40f12a){while(--_0x40f12a){_0x3e2c33['push'](_0x3e2c33['shift']());}};_0x533aa0(++_0x579090);}(_0xd6b5,0x1e0));var _0x5d6b=function(_0x23e43c,_0xdf9611){_0x23e43c=_0x23e43c-0x0;var _0x5da7a0=_0xd6b5[_0x23e43c];return _0x5da7a0;};'use strict';var _=require(_0x5d6b('0x0'));var util=require(_0x5d6b('0x1'));var logger=require(_0x5d6b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d6b('0x3'));var rimraf=require(_0x5d6b('0x4'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x5d6b('0x5')]=function(_0xeee5ed,_0x56c084){return _0xeee5ed['define'](_0x5d6b('0x6'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x5d6b('0x7'),'fields':['uniqueid',_0x5d6b('0x8')]},{'name':_0x5d6b('0x9'),'fields':[_0x5d6b('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index aeb4f36..a8b7eb9 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 _0x0b63=['info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','update','body','where','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x188edb,_0x19fed6){var _0x669a3d=function(_0x40b5d9){while(--_0x40b5d9){_0x188edb['push'](_0x188edb['shift']());}};_0x669a3d(++_0x19fed6);}(_0x0b63,0x16e));var _0x30b6=function(_0x552f30,_0x2aaf4b){_0x552f30=_0x552f30-0x0;var _0x65be36=_0x0b63[_0x552f30];return _0x65be36;};'use strict';var _=require(_0x30b6('0x0'));var util=require(_0x30b6('0x1'));var moment=require(_0x30b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30b6('0x3'));var db=require(_0x30b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30b6('0x5'))(_0x30b6('0x6'));var config=require(_0x30b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x30b6('0x8')][_0x30b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44ff2a,_0xcbc6fb,_0x1b7264){return new BPromise(function(_0x32da17,_0x19da85){return client['request'](_0x44ff2a,_0x1b7264)[_0x30b6('0xa')](function(_0x489500){logger[_0x30b6('0xb')](_0x30b6('0xc'),_0xcbc6fb,_0x30b6('0xd'));logger['debug'](_0x30b6('0xe'),_0xcbc6fb,_0x30b6('0xd'),JSON[_0x30b6('0xf')](_0x489500));if(_0x489500[_0x30b6('0x10')]){if(_0x489500[_0x30b6('0x10')]['code']===0x1f4){logger['error'](_0x30b6('0xc'),_0xcbc6fb,_0x489500[_0x30b6('0x10')][_0x30b6('0x11')]);return _0x19da85(_0x489500['error'][_0x30b6('0x11')]);}logger[_0x30b6('0x10')](_0x30b6('0xc'),_0xcbc6fb,_0x489500['error'][_0x30b6('0x11')]);return _0x32da17(_0x489500['error']['message']);}else{logger[_0x30b6('0xb')]('SquareReport,\x20%s,\x20%s',_0xcbc6fb,_0x30b6('0xd'));_0x32da17(_0x489500[_0x30b6('0x12')]['message']);}})[_0x30b6('0x13')](function(_0x27250a){logger[_0x30b6('0x10')](_0x30b6('0xc'),_0xcbc6fb,_0x27250a);_0x19da85(_0x27250a);});});}exports['CreateSquareReport']=function(_0x5b83c7){var _0x14d832=this;return new Promise(function(_0x40833f,_0x294148){return db['SquareReport']['create'](_0x5b83c7['body'],{'raw':_0x5b83c7['options']?_0x5b83c7[_0x30b6('0x14')][_0x30b6('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x2c36d3){logger[_0x30b6('0xb')]('CreateSquareReport',_0x5b83c7);logger['debug'](_0x30b6('0x16'),_0x5b83c7,JSON[_0x30b6('0xf')](_0x2c36d3));_0x40833f(_0x2c36d3);})['catch'](function(_0xffc7e8){logger[_0x30b6('0x10')]('CreateSquareReport',_0xffc7e8[_0x30b6('0x11')],_0x5b83c7);_0x294148(_0x14d832[_0x30b6('0x10')](0x1f4,_0xffc7e8['message']));});});};exports[_0x30b6('0x17')]=function(_0x1823e8){var _0x48b378=this;return new Promise(function(_0x3e9e72,_0x44f4dd){return db[_0x30b6('0x18')][_0x30b6('0x19')](_0x1823e8[_0x30b6('0x1a')],{'raw':_0x1823e8[_0x30b6('0x14')]?_0x1823e8[_0x30b6('0x14')][_0x30b6('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1823e8[_0x30b6('0x14')]?_0x1823e8[_0x30b6('0x14')][_0x30b6('0x1b')]||null:null,'attributes':_0x1823e8[_0x30b6('0x14')]?_0x1823e8[_0x30b6('0x14')]['attributes']||null:null,'limit':_0x1823e8['options']?_0x1823e8['options']['limit']||null:null})['then'](function(_0x3d1200){logger[_0x30b6('0xb')]('UpdateSquareReport',_0x1823e8);logger[_0x30b6('0x1c')](_0x30b6('0x17'),_0x1823e8,JSON[_0x30b6('0xf')](_0x3d1200));_0x3e9e72(_0x3d1200);})[_0x30b6('0x13')](function(_0x175b94){logger['error']('UpdateSquareReport',_0x175b94[_0x30b6('0x11')],_0x1823e8);_0x44f4dd(_0x48b378[_0x30b6('0x10')](0x1f4,_0x175b94[_0x30b6('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5e20fda..aa19e40 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 _0x2df4=['get','isAuthenticated','index','/describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller'];(function(_0x2cf437,_0x5b0508){var _0x2f1fd2=function(_0x30f000){while(--_0x30f000){_0x2cf437['push'](_0x2cf437['shift']());}};_0x2f1fd2(++_0x5b0508);}(_0x2df4,0x156));var _0x42df=function(_0x3494e8,_0x4111ea){_0x3494e8=_0x3494e8-0x0;var _0x20bd8c=_0x2df4[_0x3494e8];return _0x20bd8c;};'use strict';var multer=require(_0x42df('0x0'));var util=require(_0x42df('0x1'));var path=require(_0x42df('0x2'));var timeout=require(_0x42df('0x3'));var express=require(_0x42df('0x4'));var router=express[_0x42df('0x5')]();var fs_extra=require(_0x42df('0x6'));var auth=require(_0x42df('0x7'));var interaction=require(_0x42df('0x8'));var config=require('../../config/environment');var controller=require(_0x42df('0x9'));router[_0x42df('0xa')]('/',auth[_0x42df('0xb')](),controller[_0x42df('0xc')]);router['get'](_0x42df('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x42df('0xa')]('/:id',auth[_0x42df('0xb')](),controller['show']);router[_0x42df('0xe')]('/',auth[_0x42df('0xb')](),controller[_0x42df('0xf')]);router[_0x42df('0x10')](_0x42df('0x11'),auth['isAuthenticated'](),controller[_0x42df('0x12')]);router[_0x42df('0x13')](_0x42df('0x11'),auth[_0x42df('0xb')](),controller[_0x42df('0x14')]);module[_0x42df('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index df3b1a9..4e8473a 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 _0x1e10=['STRING'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1e10,0x179));var _0x01e1=function(_0x5d997d,_0x4e3d5b){_0x5d997d=_0x5d997d-0x0;var _0x37dda1=_0x1e10[_0x5d997d];return _0x37dda1;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x01e1('0x0')]},'node':{'type':Sequelize[_0x01e1('0x0')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x01e1('0x0')]}}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 543c9de..66f01e9 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 _0xe226=['VIRTUAL','includeAll','include','SquareDetailsReport','findAll','rows','catch','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xe226,0x1db));var _0x6e22=function(_0x488d77,_0x93cac4){_0x488d77=_0x488d77-0x0;var _0x1083c3=_0xe226[_0x488d77];return _0x1083c3;};'use strict';var emlformat=require(_0x6e22('0x0'));var rimraf=require(_0x6e22('0x1'));var zipdir=require(_0x6e22('0x2'));var jsonpatch=require(_0x6e22('0x3'));var rp=require(_0x6e22('0x4'));var moment=require('moment');var BPromise=require(_0x6e22('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6e22('0x6'));var csv=require(_0x6e22('0x7'));var ejs=require(_0x6e22('0x8'));var fs=require('fs');var fs_extra=require(_0x6e22('0x9'));var _=require(_0x6e22('0xa'));var squel=require(_0x6e22('0xb'));var crypto=require(_0x6e22('0xc'));var jsforce=require(_0x6e22('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e22('0x7'));var querystring=require(_0x6e22('0xe'));var Papa=require(_0x6e22('0xf'));var Redis=require(_0x6e22('0x10'));var authService=require(_0x6e22('0x11'));var qs=require(_0x6e22('0x12'));var as=require(_0x6e22('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e22('0x14'))(_0x6e22('0x15'));var utils=require(_0x6e22('0x16'));var config=require(_0x6e22('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e22('0x18'))['db'];function respondWithStatusCode(_0x25c741,_0x108892){_0x108892=_0x108892||0xcc;return function(_0x153165){if(_0x153165){return _0x25c741[_0x6e22('0x19')](_0x108892);}return _0x25c741['status'](_0x108892)[_0x6e22('0x1a')]();};}function respondWithResult(_0x385bda,_0x27031c){_0x27031c=_0x27031c||0xc8;return function(_0x1cc40c){if(_0x1cc40c){return _0x385bda['status'](_0x27031c)[_0x6e22('0x1b')](_0x1cc40c);}};}function respondWithFilteredResult(_0x14519b,_0x234a02){return function(_0x244140){if(_0x244140){var _0x1ee0d8=typeof _0x234a02[_0x6e22('0x1c')]===_0x6e22('0x1d')&&typeof _0x234a02[_0x6e22('0x1e')]===_0x6e22('0x1d');var _0x29bd3d=_0x244140['count'];var _0x26b902=_0x1ee0d8?0x0:_0x234a02[_0x6e22('0x1c')];var _0x5951b2=_0x1ee0d8?_0x244140[_0x6e22('0x1f')]:_0x234a02[_0x6e22('0x1c')]+_0x234a02['limit'];var _0xa2440b;if(_0x5951b2>=_0x29bd3d){_0x5951b2=_0x29bd3d;_0xa2440b=0xc8;}else{_0xa2440b=0xce;}_0x14519b[_0x6e22('0x20')](_0xa2440b);return _0x14519b[_0x6e22('0x21')](_0x6e22('0x22'),_0x26b902+'-'+_0x5951b2+'/'+_0x29bd3d)[_0x6e22('0x1b')](_0x244140);}return null;};}function patchUpdates(_0x54db70){return function(_0x1e0789){try{jsonpatch['apply'](_0x1e0789,_0x54db70,!![]);}catch(_0x5181d8){return BPromise[_0x6e22('0x23')](_0x5181d8);}return _0x1e0789[_0x6e22('0x24')]();};}function saveUpdates(_0x33e0c5,_0x45e13d){return function(_0x14f765){if(_0x14f765){return _0x14f765[_0x6e22('0x25')](_0x33e0c5)[_0x6e22('0x26')](function(_0x53cd74){return _0x53cd74;});}return null;};}function removeEntity(_0x35a76d,_0x4f1c90){return function(_0x4b2021){if(_0x4b2021){return _0x4b2021[_0x6e22('0x27')]()['then'](function(){_0x35a76d[_0x6e22('0x20')](0xcc)[_0x6e22('0x1a')]();});}};}function handleEntityNotFound(_0x48ccce,_0x7301ed){return function(_0x37e12f){if(!_0x37e12f){_0x48ccce[_0x6e22('0x19')](0x194);}return _0x37e12f;};}function handleError(_0x1d79d4,_0x28a827){_0x28a827=_0x28a827||0x1f4;return function(_0x4ef02b){logger['error'](_0x4ef02b[_0x6e22('0x28')]);if(_0x4ef02b['name']){delete _0x4ef02b[_0x6e22('0x29')];}_0x1d79d4[_0x6e22('0x20')](_0x28a827)[_0x6e22('0x2a')](_0x4ef02b);};}exports[_0x6e22('0x2b')]=function(_0x462aff,_0x5c0f4e){var _0x5944cb={},_0x24e642={},_0x16aa4e={'count':0x0,'rows':[]};var _0x15ceda=_[_0x6e22('0x2c')](db['SquareDetailsReport'][_0x6e22('0x2d')],function(_0x53a1c2){return{'name':_0x53a1c2[_0x6e22('0x2e')],'type':_0x53a1c2[_0x6e22('0x2f')][_0x6e22('0x30')]};});_0x24e642[_0x6e22('0x31')]=_[_0x6e22('0x2c')](_0x15ceda,_0x6e22('0x29'));_0x24e642[_0x6e22('0x32')]=_[_0x6e22('0x33')](_0x462aff[_0x6e22('0x32')]);_0x24e642[_0x6e22('0x34')]=_[_0x6e22('0x35')](_0x24e642['model'],_0x24e642[_0x6e22('0x32')]);_0x5944cb[_0x6e22('0x36')]=_[_0x6e22('0x35')](_0x24e642[_0x6e22('0x31')],qs[_0x6e22('0x37')](_0x462aff[_0x6e22('0x32')]['fields']));_0x5944cb[_0x6e22('0x36')]=_0x5944cb[_0x6e22('0x36')][_0x6e22('0x38')]?_0x5944cb[_0x6e22('0x36')]:_0x24e642['model'];if(!_0x462aff['query']['hasOwnProperty'](_0x6e22('0x39'))){_0x5944cb[_0x6e22('0x1e')]=qs[_0x6e22('0x1e')](_0x462aff[_0x6e22('0x32')][_0x6e22('0x1e')]);_0x5944cb[_0x6e22('0x1c')]=qs[_0x6e22('0x1c')](_0x462aff[_0x6e22('0x32')][_0x6e22('0x1c')]);}_0x5944cb[_0x6e22('0x3a')]=qs[_0x6e22('0x3b')](_0x462aff[_0x6e22('0x32')][_0x6e22('0x3b')]);_0x5944cb['where']=qs[_0x6e22('0x34')](_[_0x6e22('0x3c')](_0x462aff[_0x6e22('0x32')],_0x24e642[_0x6e22('0x34')]),_0x15ceda);if(_0x462aff[_0x6e22('0x32')][_0x6e22('0x3d')]){_0x5944cb[_0x6e22('0x3e')]=_[_0x6e22('0x3f')](_0x5944cb['where'],{'$or':_[_0x6e22('0x2c')](_0x15ceda,function(_0x2ba5b5){if(_0x2ba5b5[_0x6e22('0x2f')]!==_0x6e22('0x40')){var _0x875f34={};_0x875f34[_0x2ba5b5[_0x6e22('0x29')]]={'$like':'%'+_0x462aff[_0x6e22('0x32')][_0x6e22('0x3d')]+'%'};return _0x875f34;}})});}_0x5944cb=_[_0x6e22('0x3f')]({},_0x5944cb,_0x462aff['options']);var _0x2f9f8f={'where':_0x5944cb[_0x6e22('0x3e')]};return db['SquareDetailsReport']['count'](_0x2f9f8f)[_0x6e22('0x26')](function(_0x2cb897){_0x16aa4e[_0x6e22('0x1f')]=_0x2cb897;if(_0x462aff[_0x6e22('0x32')][_0x6e22('0x41')]){_0x5944cb[_0x6e22('0x42')]=[{'all':!![]}];}return db[_0x6e22('0x43')][_0x6e22('0x44')](_0x5944cb);})[_0x6e22('0x26')](function(_0x540bcd){_0x16aa4e[_0x6e22('0x45')]=_0x540bcd;return _0x16aa4e;})[_0x6e22('0x26')](respondWithFilteredResult(_0x5c0f4e,_0x5944cb))[_0x6e22('0x46')](handleError(_0x5c0f4e,null));};exports['show']=function(_0x3b2f7c,_0x8c4970){var _0x5683c7={'raw':!![],'where':{'id':_0x3b2f7c[_0x6e22('0x47')]['id']}},_0x5e0751={};_0x5e0751['model']=_[_0x6e22('0x33')](db['SquareDetailsReport'][_0x6e22('0x2d')]);_0x5e0751[_0x6e22('0x32')]=_[_0x6e22('0x33')](_0x3b2f7c[_0x6e22('0x32')]);_0x5e0751['filters']=_[_0x6e22('0x35')](_0x5e0751[_0x6e22('0x31')],_0x5e0751['query']);_0x5683c7[_0x6e22('0x36')]=_[_0x6e22('0x35')](_0x5e0751[_0x6e22('0x31')],qs['fields'](_0x3b2f7c[_0x6e22('0x32')][_0x6e22('0x37')]));_0x5683c7['attributes']=_0x5683c7[_0x6e22('0x36')][_0x6e22('0x38')]?_0x5683c7['attributes']:_0x5e0751[_0x6e22('0x31')];if(_0x3b2f7c[_0x6e22('0x32')][_0x6e22('0x41')]){_0x5683c7[_0x6e22('0x42')]=[{'all':!![]}];}_0x5683c7=_[_0x6e22('0x3f')]({},_0x5683c7,_0x3b2f7c[_0x6e22('0x48')]);return db[_0x6e22('0x43')]['find'](_0x5683c7)['then'](handleEntityNotFound(_0x8c4970,null))[_0x6e22('0x26')](respondWithResult(_0x8c4970,null))[_0x6e22('0x46')](handleError(_0x8c4970,null));};exports[_0x6e22('0x49')]=function(_0x2990da,_0x3393c3){return db[_0x6e22('0x43')][_0x6e22('0x49')](_0x2990da[_0x6e22('0x4a')],{})[_0x6e22('0x26')](respondWithResult(_0x3393c3,0xc9))[_0x6e22('0x46')](handleError(_0x3393c3,null));};exports[_0x6e22('0x25')]=function(_0xfe2be1,_0x1c7de5){if(_0xfe2be1[_0x6e22('0x4a')]['id']){delete _0xfe2be1[_0x6e22('0x4a')]['id'];}return db[_0x6e22('0x43')]['find']({'where':{'id':_0xfe2be1[_0x6e22('0x47')]['id']}})[_0x6e22('0x26')](handleEntityNotFound(_0x1c7de5,null))[_0x6e22('0x26')](saveUpdates(_0xfe2be1[_0x6e22('0x4a')],null))[_0x6e22('0x26')](respondWithResult(_0x1c7de5,null))[_0x6e22('0x46')](handleError(_0x1c7de5,null));};exports[_0x6e22('0x27')]=function(_0x5b0b1d,_0x42152){return db[_0x6e22('0x43')][_0x6e22('0x4b')]({'where':{'id':_0x5b0b1d[_0x6e22('0x47')]['id']}})[_0x6e22('0x26')](handleEntityNotFound(_0x42152,null))['then'](removeEntity(_0x42152,null))[_0x6e22('0x46')](handleError(_0x42152,null));};exports['describe']=function(_0x14dd74,_0x362881){return db['SquareDetailsReport'][_0x6e22('0x4c')]()[_0x6e22('0x26')](respondWithResult(_0x362881,null))[_0x6e22('0x46')](handleError(_0x362881,null));}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ce0fc7e..d52e5fc 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 _0xa4bc=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','SquareDetailsReport','lodash','util'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xa4bc,0x174));var _0xca4b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa4bc[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xca4b('0x0'));var util=require(_0xca4b('0x1'));var logger=require(_0xca4b('0x2'))(_0xca4b('0x3'));var moment=require(_0xca4b('0x4'));var BPromise=require('bluebird');var rp=require(_0xca4b('0x5'));var fs=require('fs');var path=require(_0xca4b('0x6'));var rimraf=require(_0xca4b('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xca4b('0x8')]=function(_0x30a55d,_0x2e3407){return _0x30a55d[_0xca4b('0x9')](_0xca4b('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 499df6f..71ffab3 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 _0x6a95=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3d9d41,_0x1adfac){var _0x1a59f1=function(_0x3d210a){while(--_0x3d210a){_0x3d9d41['push'](_0x3d9d41['shift']());}};_0x1a59f1(++_0x1adfac);}(_0x6a95,0x1db));var _0x56a9=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6a95[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});}; \ No newline at end of file +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 diff --git a/server/api/system/index.js b/server/api/system/index.js index f1a6615..ec8bc30 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 _0x7a1f=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a1f,0x166));var _0xf7a1=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x7a1f[_0x218994];return _0x3f350b;};'use strict';var express=require(_0xf7a1('0x0'));var router=express[_0xf7a1('0x1')]();var auth=require(_0xf7a1('0x2'));var controller=require(_0xf7a1('0x3'));router[_0xf7a1('0x4')]('/',auth[_0xf7a1('0x5')](),controller[_0xf7a1('0x6')]);router[_0xf7a1('0x4')](_0xf7a1('0x7'),auth[_0xf7a1('0x5')](),controller[_0xf7a1('0x8')]);module[_0xf7a1('0x9')]=router; \ No newline at end of file +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 diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 56695e4..94a2064 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 _0xe25c=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','index','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','util','bluebird','lodash','error'];(function(_0x574fa5,_0x191515){var _0x23f807=function(_0x233d19){while(--_0x233d19){_0x574fa5['push'](_0x574fa5['shift']());}};_0x23f807(++_0x191515);}(_0xe25c,0x8e));var _0xce25=function(_0x173d1b,_0x769081){_0x173d1b=_0x173d1b-0x0;var _0x48672c=_0xe25c[_0x173d1b];return _0x48672c;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xce25('0x0'))('api');var util=require(_0xce25('0x1'));var BPromise=require(_0xce25('0x2'));var _=require(_0xce25('0x3'));function handleError(_0x4ef9ee,_0x5e7281,_0x44c668){_0x5e7281=_0x5e7281||0x1f4;return function(_0x495c02){logger[_0xce25('0x4')](_0xce25('0x5'),_0x44c668,_0x5e7281,util[_0xce25('0x6')](_0x495c02,{'showHidden':![],'depth':null}));delete _0x495c02['name'];_0x4ef9ee[_0xce25('0x7')](_0x5e7281)['send'](_0x495c02);};}exports[_0xce25('0x8')]=function(_0x42f3c7,_0x390ad5){return info['getAllData']()['then'](function(_0x4868dc){return _0x390ad5[_0xce25('0x7')](0xc8)[_0xce25('0x9')](_0x4868dc);})['catch'](function(_0xde774d){return _0x390ad5[_0xce25('0x7')](0x1f4)[_0xce25('0x9')](_0xde774d);});};exports['killProcess']=function(_0x59ad9c,_0x20531e){var _0x303dba=[_0xce25('0xa')];return new BPromise(function(_0x24ec78,_0x2ddd80){return exec(util[_0xce25('0xb')](_0xce25('0xc'),_0x59ad9c[_0xce25('0xd')][_0xce25('0xe')]),function(_0x4d3344,_0x4f9291,_0x583fef){if(_0x4d3344){return _0x2ddd80(_0x4d3344);}return _0x24ec78(_0x4f9291);});})['then'](function(_0x565fcf){var _0x31b763=![];var _0x58214a=_0x565fcf[_0xce25('0xf')](/\n/);for(var _0xb93047=0x0,_0x4896c8=_0x303dba[_0xce25('0x10')];_0xb93047<_0x4896c8,_0x31b763===![];_0xb93047+=0x1){if(_0x565fcf['indexOf'](_0x303dba[_0xb93047])>=0x0){_0x31b763=!![];}}if(!_0x31b763){throw new Error(util[_0xce25('0xb')](_0xce25('0x11'),_0x59ad9c['params'][_0xce25('0xe')]));}process[_0xce25('0x12')](_0x59ad9c[_0xce25('0xd')][_0xce25('0xe')],_0xce25('0x13'));return _0x20531e['status'](0xc8)[_0xce25('0x9')]({'message':util[_0xce25('0xb')](_0xce25('0x14'),_0x59ad9c[_0xce25('0xd')][_0xce25('0xe')])});})['catch'](handleError(_0x20531e,null,'killProcess'));}; \ No newline at end of file +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 diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 14b633e..65555f5 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 _0x6bdd=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','get','index','show','post','isAuthenticated','create'];(function(_0x7f5e4e,_0x2b673a){var _0x10e253=function(_0x1207d1){while(--_0x1207d1){_0x7f5e4e['push'](_0x7f5e4e['shift']());}};_0x10e253(++_0x2b673a);}(_0x6bdd,0xe9));var _0xd6bd=function(_0x14a79a,_0x281ce9){_0x14a79a=_0x14a79a-0x0;var _0x55d55b=_0x6bdd[_0x14a79a];return _0x55d55b;};'use strict';var multer=require('multer');var util=require(_0xd6bd('0x0'));var path=require(_0xd6bd('0x1'));var timeout=require(_0xd6bd('0x2'));var express=require(_0xd6bd('0x3'));var router=express[_0xd6bd('0x4')]();var fs_extra=require(_0xd6bd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6bd('0x6'));var config=require('../../config/environment');var controller=require(_0xd6bd('0x7'));router[_0xd6bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xd6bd('0x9')]);router[_0xd6bd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd6bd('0xa')]);router[_0xd6bd('0xb')]('/',auth[_0xd6bd('0xc')](),controller[_0xd6bd('0xd')]);router[_0xd6bd('0xe')]('/:id',auth[_0xd6bd('0xc')](),controller[_0xd6bd('0xf')]);router[_0xd6bd('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd6bd('0x11')]);module[_0xd6bd('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d12e880..c2ddd91 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 _0x793b=['name','sequelize','exports','STRING'];(function(_0x5b76da,_0x9d4329){var _0x2a2c7c=function(_0x3e47ab){while(--_0x3e47ab){_0x5b76da['push'](_0x5b76da['shift']());}};_0x2a2c7c(++_0x9d4329);}(_0x793b,0x189));var _0xb793=function(_0x1c794c,_0x398f67){_0x1c794c=_0x1c794c-0x0;var _0x1cc902=_0x793b[_0x1c794c];return _0x1cc902;};'use strict';var Sequelize=require(_0xb793('0x0'));module[_0xb793('0x1')]={'name':{'type':Sequelize[_0xb793('0x2')],'unique':_0xb793('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb793('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb793('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index ad3ea04..82dc53b 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 _0x5b02=['sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','Tag','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x35da2b,_0x17a8ad){var _0x1fa3a7=function(_0x36f3e4){while(--_0x36f3e4){_0x35da2b['push'](_0x35da2b['shift']());}};_0x1fa3a7(++_0x17a8ad);}(_0x5b02,0xe9));var _0x25b0=function(_0x23b7e1,_0x14cc33){_0x23b7e1=_0x23b7e1-0x0;var _0x53dd22=_0x5b02[_0x23b7e1];return _0x53dd22;};'use strict';var emlformat=require(_0x25b0('0x0'));var rimraf=require(_0x25b0('0x1'));var zipdir=require(_0x25b0('0x2'));var jsonpatch=require(_0x25b0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25b0('0x4'));var Mustache=require('mustache');var util=require(_0x25b0('0x5'));var path=require(_0x25b0('0x6'));var sox=require(_0x25b0('0x7'));var csv=require(_0x25b0('0x8'));var ejs=require(_0x25b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var licenseUtil=require(_0x25b0('0x17'));var db=require(_0x25b0('0x18'))['db'];function respondWithStatusCode(_0x1d3178,_0x184452){_0x184452=_0x184452||0xcc;return function(_0x26a34f){if(_0x26a34f){return _0x1d3178[_0x25b0('0x19')](_0x184452);}return _0x1d3178[_0x25b0('0x1a')](_0x184452)[_0x25b0('0x1b')]();};}function respondWithResult(_0x42cc07,_0x293203){_0x293203=_0x293203||0xc8;return function(_0x211658){if(_0x211658){return _0x42cc07[_0x25b0('0x1a')](_0x293203)[_0x25b0('0x1c')](_0x211658);}};}function respondWithFilteredResult(_0x40071c,_0x5ac18d){return function(_0x51542b){if(_0x51542b){var _0xfe1ea6=typeof _0x5ac18d['offset']===_0x25b0('0x1d')&&typeof _0x5ac18d[_0x25b0('0x1e')]===_0x25b0('0x1d');var _0x3267b9=_0x51542b['count'];var _0x1d850f=_0xfe1ea6?0x0:_0x5ac18d[_0x25b0('0x1f')];var _0x20762e=_0xfe1ea6?_0x51542b[_0x25b0('0x20')]:_0x5ac18d[_0x25b0('0x1f')]+_0x5ac18d[_0x25b0('0x1e')];var _0x54f458;if(_0x20762e>=_0x3267b9){_0x20762e=_0x3267b9;_0x54f458=0xc8;}else{_0x54f458=0xce;}_0x40071c[_0x25b0('0x1a')](_0x54f458);return _0x40071c[_0x25b0('0x21')](_0x25b0('0x22'),_0x1d850f+'-'+_0x20762e+'/'+_0x3267b9)[_0x25b0('0x1c')](_0x51542b);}return null;};}function patchUpdates(_0x1dc691){return function(_0xea4162){try{jsonpatch[_0x25b0('0x23')](_0xea4162,_0x1dc691,!![]);}catch(_0x19599b){return BPromise[_0x25b0('0x24')](_0x19599b);}return _0xea4162[_0x25b0('0x25')]();};}function saveUpdates(_0x2b2eda,_0x3ce1da){return function(_0x5cb746){if(_0x5cb746){return _0x5cb746[_0x25b0('0x26')](_0x2b2eda)[_0x25b0('0x27')](function(_0x517ec5){return _0x517ec5;});}return null;};}function removeEntity(_0x2d7c17,_0x2023d8){return function(_0x3546f0){if(_0x3546f0){return _0x3546f0['destroy']()['then'](function(){var _0x50089e=_0x3546f0[_0x25b0('0x28')]({'plain':!![]});var _0x433085=_0x25b0('0x29');return db[_0x25b0('0x2a')][_0x25b0('0x2b')]({'where':{'type':_0x433085,'resourceId':_0x50089e['id']}})[_0x25b0('0x27')](function(){return _0x3546f0;});})[_0x25b0('0x27')](function(){_0x2d7c17[_0x25b0('0x1a')](0xcc)[_0x25b0('0x1b')]();});}};}function handleEntityNotFound(_0x596d14,_0x2ea408){return function(_0xbfba84){if(!_0xbfba84){_0x596d14['sendStatus'](0x194);}return _0xbfba84;};}function handleError(_0x567775,_0x5de43d){_0x5de43d=_0x5de43d||0x1f4;return function(_0x1a6212){logger[_0x25b0('0x2c')](_0x1a6212[_0x25b0('0x2d')]);if(_0x1a6212[_0x25b0('0x2e')]){delete _0x1a6212[_0x25b0('0x2e')];}_0x567775[_0x25b0('0x1a')](_0x5de43d)[_0x25b0('0x2f')](_0x1a6212);};}exports[_0x25b0('0x30')]=function(_0x36b81d,_0x285a2b){var _0x1e217c={},_0x3161c1={},_0x1ea374={'count':0x0,'rows':[]};var _0x4f640f=_['map'](db[_0x25b0('0x31')]['rawAttributes'],function(_0x4dfeea){return{'name':_0x4dfeea[_0x25b0('0x32')],'type':_0x4dfeea[_0x25b0('0x33')][_0x25b0('0x34')]};});_0x3161c1[_0x25b0('0x35')]=_[_0x25b0('0x36')](_0x4f640f,'name');_0x3161c1[_0x25b0('0x37')]=_[_0x25b0('0x38')](_0x36b81d['query']);_0x3161c1[_0x25b0('0x39')]=_[_0x25b0('0x3a')](_0x3161c1['model'],_0x3161c1[_0x25b0('0x37')]);_0x1e217c['attributes']=_[_0x25b0('0x3a')](_0x3161c1[_0x25b0('0x35')],qs[_0x25b0('0x3b')](_0x36b81d[_0x25b0('0x37')][_0x25b0('0x3b')]));_0x1e217c[_0x25b0('0x3c')]=_0x1e217c[_0x25b0('0x3c')][_0x25b0('0x3d')]?_0x1e217c[_0x25b0('0x3c')]:_0x3161c1['model'];if(!_0x36b81d[_0x25b0('0x37')][_0x25b0('0x3e')](_0x25b0('0x3f'))){_0x1e217c[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x36b81d[_0x25b0('0x37')][_0x25b0('0x1e')]);_0x1e217c[_0x25b0('0x1f')]=qs[_0x25b0('0x1f')](_0x36b81d[_0x25b0('0x37')]['offset']);}_0x1e217c[_0x25b0('0x40')]=qs[_0x25b0('0x41')](_0x36b81d[_0x25b0('0x37')]['sort']);_0x1e217c[_0x25b0('0x42')]=qs[_0x25b0('0x39')](_[_0x25b0('0x43')](_0x36b81d[_0x25b0('0x37')],_0x3161c1[_0x25b0('0x39')]),_0x4f640f);if(_0x36b81d[_0x25b0('0x37')][_0x25b0('0x44')]){_0x1e217c[_0x25b0('0x42')]=_['merge'](_0x1e217c['where'],{'$or':_[_0x25b0('0x36')](_0x4f640f,function(_0x30d1e3){if(_0x30d1e3[_0x25b0('0x33')]!=='VIRTUAL'){var _0x9c6ab4={};_0x9c6ab4[_0x30d1e3['name']]={'$like':'%'+_0x36b81d[_0x25b0('0x37')][_0x25b0('0x44')]+'%'};return _0x9c6ab4;}})});}_0x1e217c=_[_0x25b0('0x45')]({},_0x1e217c,_0x36b81d[_0x25b0('0x46')]);var _0x8a2eeb={'where':_0x1e217c['where']};return db[_0x25b0('0x31')][_0x25b0('0x20')](_0x8a2eeb)[_0x25b0('0x27')](function(_0x376d8a){_0x1ea374[_0x25b0('0x20')]=_0x376d8a;if(_0x36b81d['query'][_0x25b0('0x47')]){_0x1e217c[_0x25b0('0x48')]=[{'all':!![]}];}return db[_0x25b0('0x31')][_0x25b0('0x49')](_0x1e217c);})[_0x25b0('0x27')](function(_0x1adf8d){_0x1ea374[_0x25b0('0x4a')]=_0x1adf8d;return _0x1ea374;})[_0x25b0('0x27')](respondWithFilteredResult(_0x285a2b,_0x1e217c))[_0x25b0('0x4b')](handleError(_0x285a2b,null));};exports[_0x25b0('0x4c')]=function(_0x124d4b,_0x5186cc){var _0x13e2cf={'raw':!![],'where':{'id':_0x124d4b[_0x25b0('0x4d')]['id']}},_0x5cb047={};_0x5cb047[_0x25b0('0x35')]=_[_0x25b0('0x38')](db[_0x25b0('0x31')]['rawAttributes']);_0x5cb047[_0x25b0('0x37')]=_[_0x25b0('0x38')](_0x124d4b[_0x25b0('0x37')]);_0x5cb047['filters']=_[_0x25b0('0x3a')](_0x5cb047[_0x25b0('0x35')],_0x5cb047[_0x25b0('0x37')]);_0x13e2cf[_0x25b0('0x3c')]=_[_0x25b0('0x3a')](_0x5cb047[_0x25b0('0x35')],qs[_0x25b0('0x3b')](_0x124d4b['query'][_0x25b0('0x3b')]));_0x13e2cf[_0x25b0('0x3c')]=_0x13e2cf[_0x25b0('0x3c')]['length']?_0x13e2cf[_0x25b0('0x3c')]:_0x5cb047[_0x25b0('0x35')];if(_0x124d4b[_0x25b0('0x37')][_0x25b0('0x47')]){_0x13e2cf[_0x25b0('0x48')]=[{'all':!![]}];}_0x13e2cf=_['merge']({},_0x13e2cf,_0x124d4b[_0x25b0('0x46')]);return db[_0x25b0('0x31')][_0x25b0('0x4e')](_0x13e2cf)['then'](handleEntityNotFound(_0x5186cc,null))[_0x25b0('0x27')](respondWithResult(_0x5186cc,null))[_0x25b0('0x4b')](handleError(_0x5186cc,null));};exports[_0x25b0('0x4f')]=function(_0x1d6d55,_0x29165e){return db[_0x25b0('0x31')]['create'](_0x1d6d55['body'],{})['then'](function(_0x1eb908){var _0x4bd7ba=_0x1d6d55['user'][_0x25b0('0x28')]({'plain':!![]});if(!_0x4bd7ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bd7ba[_0x25b0('0x50')]==='user'){var _0x4fc22d=_0x1eb908[_0x25b0('0x28')]({'plain':!![]});var _0x14a8a7=_0x25b0('0x29');return db[_0x25b0('0x51')][_0x25b0('0x4e')]({'where':{'name':_0x14a8a7,'userProfileId':_0x4bd7ba[_0x25b0('0x52')]},'raw':!![]})[_0x25b0('0x27')](function(_0x2d5522){if(_0x2d5522&&_0x2d5522[_0x25b0('0x53')]===0x0){return db[_0x25b0('0x2a')]['create']({'name':_0x4fc22d['name'],'resourceId':_0x4fc22d['id'],'type':_0x2d5522['name'],'sectionId':_0x2d5522['id']},{})[_0x25b0('0x27')](function(){return _0x1eb908;});}else{return _0x1eb908;}})[_0x25b0('0x4b')](function(_0x2a28fb){logger[_0x25b0('0x2c')](_0x25b0('0x54'),_0x2a28fb);throw _0x2a28fb;});}return _0x1eb908;})[_0x25b0('0x27')](respondWithResult(_0x29165e,0xc9))[_0x25b0('0x4b')](handleError(_0x29165e,null));};exports['update']=function(_0x64ffa3,_0x4a8adc){if(_0x64ffa3[_0x25b0('0x55')]['id']){delete _0x64ffa3['body']['id'];}return db['Tag'][_0x25b0('0x4e')]({'where':{'id':_0x64ffa3['params']['id']}})['then'](handleEntityNotFound(_0x4a8adc,null))[_0x25b0('0x27')](saveUpdates(_0x64ffa3[_0x25b0('0x55')],null))[_0x25b0('0x27')](respondWithResult(_0x4a8adc,null))[_0x25b0('0x4b')](handleError(_0x4a8adc,null));};exports[_0x25b0('0x2b')]=function(_0x367d57,_0x8bbdb3){return db[_0x25b0('0x31')][_0x25b0('0x4e')]({'where':{'id':_0x367d57[_0x25b0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8bbdb3,null))['then'](removeEntity(_0x8bbdb3,null))[_0x25b0('0x4b')](handleError(_0x8bbdb3,null));}; \ No newline at end of file +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 diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3d92047..53d82fb 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 _0xc8a6=['tools_tags','lodash','util','../../config/logger','moment','request-promise','path','./tag.attributes','define','Tag'];(function(_0x563d77,_0x305794){var _0x24cfdf=function(_0x2ed7bc){while(--_0x2ed7bc){_0x563d77['push'](_0x563d77['shift']());}};_0x24cfdf(++_0x305794);}(_0xc8a6,0xbf));var _0x6c8a=function(_0x1d1f32,_0x505f0c){_0x1d1f32=_0x1d1f32-0x0;var _0x3916ac=_0xc8a6[_0x1d1f32];return _0x3916ac;};'use strict';var _=require(_0x6c8a('0x0'));var util=require(_0x6c8a('0x1'));var logger=require(_0x6c8a('0x2'))('api');var moment=require(_0x6c8a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c8a('0x4'));var fs=require('fs');var path=require(_0x6c8a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c8a('0x6'));module['exports']=function(_0x456c33,_0x2c207c){return _0x456c33[_0x6c8a('0x7')](_0x6c8a('0x8'),attributes,{'tableName':_0x6c8a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 8c46221..b2bf6d5 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 _0xa37e=['Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x5e7ca8,_0x519484){var _0x2b6250=function(_0x5d00f5){while(--_0x5d00f5){_0x5e7ca8['push'](_0x5e7ca8['shift']());}};_0x2b6250(++_0x519484);}(_0xa37e,0x97));var _0xea37=function(_0x11d746,_0x1ae836){_0x11d746=_0x11d746-0x0;var _0x31ccb5=_0xa37e[_0x11d746];return _0x31ccb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea37('0x0'));var BPromise=require(_0xea37('0x1'));var rs=require(_0xea37('0x2'));var fs=require('fs');var Redis=require(_0xea37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xea37('0x4'));var logger=require('../../config/logger')(_0xea37('0x5'));var config=require(_0xea37('0x6'));var jayson=require(_0xea37('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36c489,_0x4a9e08,_0x4ae081){return new BPromise(function(_0x2c2890,_0x1401e1){return client[_0xea37('0x8')](_0x36c489,_0x4ae081)[_0xea37('0x9')](function(_0x5e4ebe){logger[_0xea37('0xa')](_0xea37('0xb'),_0x4a9e08,_0xea37('0xc'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x4a9e08,_0xea37('0xc'),JSON[_0xea37('0xd')](_0x5e4ebe));if(_0x5e4ebe[_0xea37('0xe')]){if(_0x5e4ebe['error'][_0xea37('0xf')]===0x1f4){logger[_0xea37('0xe')](_0xea37('0xb'),_0x4a9e08,_0x5e4ebe['error'][_0xea37('0x10')]);return _0x1401e1(_0x5e4ebe[_0xea37('0xe')]['message']);}logger[_0xea37('0xe')]('Tag,\x20%s,\x20%s',_0x4a9e08,_0x5e4ebe[_0xea37('0xe')]['message']);return _0x2c2890(_0x5e4ebe[_0xea37('0xe')][_0xea37('0x10')]);}else{logger[_0xea37('0xa')](_0xea37('0xb'),_0x4a9e08,'request\x20sent');_0x2c2890(_0x5e4ebe[_0xea37('0x11')]['message']);}})['catch'](function(_0x3ae3cc){logger['error'](_0xea37('0xb'),_0x4a9e08,_0x3ae3cc);_0x1401e1(_0x3ae3cc);});});} \ No newline at end of file +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 diff --git a/server/api/team/index.js b/server/api/team/index.js index 975e220..ceab08e 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_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 diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 8a46ac5..82e6304 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x3c8a06,_0x402f6e){var _0x7bd31f=function(_0x2b29b6){while(--_0x2b29b6){_0x3c8a06['push'](_0x3c8a06['shift']());}};_0x7bd31f(++_0x402f6e);}(_0x2032,0xd9));var _0x2203=function(_0x8af896,_0x31e479){_0x8af896=_0x8af896-0x0;var _0x4cb7ee=_0x2032[_0x8af896];return _0x4cb7ee;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f315ee7..b5e6fc6 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 _0xbffe=['isArray','ids','Voice','Mail','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','all','upsert','spread','removeAgents','Chat','Sms','Queues','emit','Queue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','register','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','status','send','index','Team','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','removeQueues','remove','addAgents'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xbffe,0x1ed));var _0xebff=function(_0x1e1cad,_0x270089){_0x1e1cad=_0x1e1cad-0x0;var _0x461671=_0xbffe[_0x1e1cad];return _0x461671;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebff('0x0'));var zipdir=require(_0xebff('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebff('0x2'));var moment=require(_0xebff('0x3'));var BPromise=require(_0xebff('0x4'));var Mustache=require(_0xebff('0x5'));var util=require(_0xebff('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xebff('0x7'));var ejs=require(_0xebff('0x8'));var fs=require('fs');var fs_extra=require(_0xebff('0x9'));var _=require(_0xebff('0xa'));var squel=require(_0xebff('0xb'));var crypto=require(_0xebff('0xc'));var jsforce=require(_0xebff('0xd'));var deskjs=require(_0xebff('0xe'));var toCsv=require(_0xebff('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xebff('0xf'));var authService=require(_0xebff('0x10'));var qs=require(_0xebff('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebff('0x12'));var logger=require('../../config/logger')(_0xebff('0x13'));var utils=require(_0xebff('0x14'));var config=require(_0xebff('0x15'));var licenseUtil=require(_0xebff('0x16'));var db=require('../../mysqldb')['db'];config[_0xebff('0x17')]=_['defaults'](config[_0xebff('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xebff('0x18'))(new Redis(config[_0xebff('0x17')]));require('./team.socket')[_0xebff('0x19')](socket);function respondWithStatusCode(_0x5d0ac5,_0xa32ac8){_0xa32ac8=_0xa32ac8||0xcc;return function(_0x5308f5){if(_0x5308f5){return _0x5d0ac5[_0xebff('0x1a')](_0xa32ac8);}return _0x5d0ac5['status'](_0xa32ac8)['end']();};}function respondWithResult(_0xeb39f8,_0x2eebc1){_0x2eebc1=_0x2eebc1||0xc8;return function(_0x3418dc){if(_0x3418dc){return _0xeb39f8['status'](_0x2eebc1)[_0xebff('0x1b')](_0x3418dc);}};}function respondWithFilteredResult(_0x3a2b6a,_0x1c21c4){return function(_0x1d2081){if(_0x1d2081){var _0x25e178=typeof _0x1c21c4[_0xebff('0x1c')]===_0xebff('0x1d')&&typeof _0x1c21c4[_0xebff('0x1e')]===_0xebff('0x1d');var _0x19c7a8=_0x1d2081[_0xebff('0x1f')];var _0x5b2bda=_0x25e178?0x0:_0x1c21c4['offset'];var _0x1c9692=_0x25e178?_0x1d2081[_0xebff('0x1f')]:_0x1c21c4[_0xebff('0x1c')]+_0x1c21c4['limit'];var _0x2ba91d;if(_0x1c9692>=_0x19c7a8){_0x1c9692=_0x19c7a8;_0x2ba91d=0xc8;}else{_0x2ba91d=0xce;}_0x3a2b6a['status'](_0x2ba91d);return _0x3a2b6a[_0xebff('0x20')](_0xebff('0x21'),_0x5b2bda+'-'+_0x1c9692+'/'+_0x19c7a8)['json'](_0x1d2081);}return null;};}function patchUpdates(_0x320c40){return function(_0x3d72b6){try{jsonpatch['apply'](_0x3d72b6,_0x320c40,!![]);}catch(_0x447af9){return BPromise[_0xebff('0x22')](_0x447af9);}return _0x3d72b6[_0xebff('0x23')]();};}function saveUpdates(_0x1e9225,_0x2bba97){return function(_0x59789c){if(_0x59789c){return _0x59789c[_0xebff('0x24')](_0x1e9225)[_0xebff('0x25')](function(_0x5ab603){return _0x5ab603;});}return null;};}function handleEntityNotFound(_0x50205b,_0x4ba334){return function(_0x4795d5){if(!_0x4795d5){_0x50205b[_0xebff('0x1a')](0x194);}return _0x4795d5;};}function handleError(_0x15db4b,_0x3b79df){_0x3b79df=_0x3b79df||0x1f4;return function(_0x58f3cc){logger[_0xebff('0x26')](_0x58f3cc[_0xebff('0x27')]);if(_0x58f3cc[_0xebff('0x28')]){delete _0x58f3cc[_0xebff('0x28')];}_0x15db4b[_0xebff('0x29')](_0x3b79df)[_0xebff('0x2a')](_0x58f3cc);};}exports[_0xebff('0x2b')]=function(_0x725cc6,_0x2ff9e3){var _0x523799={},_0x362434={},_0x55c78f={'count':0x0,'rows':[]};var _0x1fd21a=_['map'](db[_0xebff('0x2c')][_0xebff('0x2d')],function(_0x3b26ab){return{'name':_0x3b26ab['fieldName'],'type':_0x3b26ab[_0xebff('0x2e')][_0xebff('0x2f')]};});_0x362434[_0xebff('0x30')]=_[_0xebff('0x31')](_0x1fd21a,_0xebff('0x28'));_0x362434[_0xebff('0x32')]=_[_0xebff('0x33')](_0x725cc6[_0xebff('0x32')]);_0x362434[_0xebff('0x34')]=_[_0xebff('0x35')](_0x362434[_0xebff('0x30')],_0x362434[_0xebff('0x32')]);_0x523799[_0xebff('0x36')]=_[_0xebff('0x35')](_0x362434[_0xebff('0x30')],qs[_0xebff('0x37')](_0x725cc6[_0xebff('0x32')][_0xebff('0x37')]));_0x523799[_0xebff('0x36')]=_0x523799[_0xebff('0x36')][_0xebff('0x38')]?_0x523799[_0xebff('0x36')]:_0x362434[_0xebff('0x30')];if(!_0x725cc6[_0xebff('0x32')][_0xebff('0x39')](_0xebff('0x3a'))){_0x523799[_0xebff('0x1e')]=qs['limit'](_0x725cc6[_0xebff('0x32')][_0xebff('0x1e')]);_0x523799[_0xebff('0x1c')]=qs['offset'](_0x725cc6[_0xebff('0x32')][_0xebff('0x1c')]);}_0x523799['order']=qs[_0xebff('0x3b')](_0x725cc6[_0xebff('0x32')][_0xebff('0x3b')]);_0x523799['where']=qs['filters'](_[_0xebff('0x3c')](_0x725cc6[_0xebff('0x32')],_0x362434[_0xebff('0x34')]),_0x1fd21a);if(_0x725cc6[_0xebff('0x32')][_0xebff('0x3d')]){_0x523799[_0xebff('0x3e')]=_[_0xebff('0x3f')](_0x523799[_0xebff('0x3e')],{'$or':_['map'](_0x1fd21a,function(_0x1e688b){if(_0x1e688b['type']!==_0xebff('0x40')){var _0x15de1c={};_0x15de1c[_0x1e688b[_0xebff('0x28')]]={'$like':'%'+_0x725cc6[_0xebff('0x32')][_0xebff('0x3d')]+'%'};return _0x15de1c;}})});}_0x523799=_['merge']({},_0x523799,_0x725cc6[_0xebff('0x41')]);var _0xc6ff10={'where':_0x523799[_0xebff('0x3e')]};return db['Team'][_0xebff('0x1f')](_0xc6ff10)[_0xebff('0x25')](function(_0x1b5693){_0x55c78f[_0xebff('0x1f')]=_0x1b5693;if(_0x725cc6[_0xebff('0x32')][_0xebff('0x42')]){_0x523799[_0xebff('0x43')]=[{'all':!![]}];}return db['Team']['findAll'](_0x523799);})['then'](function(_0xd753dc){_0x55c78f[_0xebff('0x44')]=_0xd753dc;return _0x55c78f;})[_0xebff('0x25')](respondWithFilteredResult(_0x2ff9e3,_0x523799))[_0xebff('0x45')](handleError(_0x2ff9e3,null));};exports[_0xebff('0x46')]=function(_0x579fcc,_0x3dd294){var _0x130518={'raw':![],'where':{'id':_0x579fcc[_0xebff('0x47')]['id']}},_0x4e77b5={};_0x4e77b5[_0xebff('0x30')]=_[_0xebff('0x33')](db[_0xebff('0x2c')][_0xebff('0x2d')]);_0x4e77b5[_0xebff('0x32')]=_['keys'](_0x579fcc[_0xebff('0x32')]);_0x4e77b5['filters']=_[_0xebff('0x35')](_0x4e77b5[_0xebff('0x30')],_0x4e77b5[_0xebff('0x32')]);_0x130518['attributes']=_['intersection'](_0x4e77b5[_0xebff('0x30')],qs['fields'](_0x579fcc[_0xebff('0x32')][_0xebff('0x37')]));_0x130518[_0xebff('0x36')]=_0x130518[_0xebff('0x36')][_0xebff('0x38')]?_0x130518[_0xebff('0x36')]:_0x4e77b5[_0xebff('0x30')];if(_0x579fcc[_0xebff('0x32')]['includeAll']){_0x130518['include']=[{'all':!![]}];}_0x130518=_[_0xebff('0x3f')]({},_0x130518,_0x579fcc[_0xebff('0x41')]);return db[_0xebff('0x2c')][_0xebff('0x48')](_0x130518)[_0xebff('0x25')](handleEntityNotFound(_0x3dd294,null))[_0xebff('0x25')](respondWithResult(_0x3dd294,null))[_0xebff('0x45')](handleError(_0x3dd294,null));};exports[_0xebff('0x49')]=function(_0x167165,_0x3909ef){return db[_0xebff('0x2c')][_0xebff('0x49')](_0x167165['body'],{})[_0xebff('0x25')](function(_0x2d4cc4){var _0x59433c=_0x167165[_0xebff('0x4a')][_0xebff('0x4b')]({'plain':!![]});if(!_0x59433c)throw new Error(_0xebff('0x4c'));if(_0x59433c[_0xebff('0x4d')]==='user'){var _0x53d69b=_0x2d4cc4[_0xebff('0x4b')]({'plain':!![]});var _0xc3eddc=_0xebff('0x4e');return db[_0xebff('0x4f')][_0xebff('0x48')]({'where':{'name':_0xc3eddc,'userProfileId':_0x59433c['userProfileId']},'raw':!![]})[_0xebff('0x25')](function(_0x3a23fe){if(_0x3a23fe&&_0x3a23fe[_0xebff('0x50')]===0x0){return db['UserProfileResource'][_0xebff('0x49')]({'name':_0x53d69b[_0xebff('0x28')],'resourceId':_0x53d69b['id'],'type':_0x3a23fe[_0xebff('0x28')],'sectionId':_0x3a23fe['id']},{})[_0xebff('0x25')](function(){return _0x2d4cc4;});}else{return _0x2d4cc4;}})[_0xebff('0x45')](function(_0x1bb75d){logger['error'](_0xebff('0x51'),_0x1bb75d);throw _0x1bb75d;});}return _0x2d4cc4;})[_0xebff('0x25')](respondWithResult(_0x3909ef,0xc9))[_0xebff('0x45')](handleError(_0x3909ef,null));};exports[_0xebff('0x24')]=function(_0x42c91d,_0x96bf84){if(_0x42c91d[_0xebff('0x52')]['id']){delete _0x42c91d['body']['id'];}return db[_0xebff('0x2c')][_0xebff('0x48')]({'where':{'id':_0x42c91d['params']['id']}})[_0xebff('0x25')](handleEntityNotFound(_0x96bf84,null))[_0xebff('0x25')](saveUpdates(_0x42c91d[_0xebff('0x52')],null))[_0xebff('0x25')](respondWithResult(_0x96bf84,null))[_0xebff('0x45')](handleError(_0x96bf84,null));};exports[_0xebff('0x53')]=function(_0xb2be1,_0x3199ab){var _0x3a3d88=_0xb2be1[_0xebff('0x47')]['id'];var _0x38b824=[];return db[_0xebff('0x54')][_0xebff('0x55')](function(_0x3d3707){var _0x3af2b0=_0xebff('0x56')+_0x3a3d88;return db[_0xebff('0x54')][_0xebff('0x32')](_0x3af2b0,{'type':db[_0xebff('0x57')][_0xebff('0x58')][_0xebff('0x59')],'raw':!![],'transaction':_0x3d3707})['then'](function(_0x4f7e2b){_0x38b824=_['map'](_0x4f7e2b,function(_0x57f91c){return Number(_0x57f91c[_0xebff('0x5a')]);});})[_0xebff('0x25')](function(){var _0xd2e0a7='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3a3d88;return db['sequelize'][_0xebff('0x32')](_0xd2e0a7,{'type':db['Sequelize'][_0xebff('0x58')]['SELECT'],'raw':!![],'transaction':_0x3d3707});})[_0xebff('0x25')](function(_0xdaef06){var _0xee4608=_[_0xebff('0x31')](_0xdaef06,function(_0x227a9a){return Number(_0x227a9a[_0xebff('0x5b')]);});return db[_0xebff('0x5c')][_0xebff('0x53')]({'where':{'UserId':{'$in':_0x38b824},'VoiceQueueId':{'$in':_0xee4608}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){var _0x59e110=_0xebff('0x5d')+_0x3a3d88;return db[_0xebff('0x54')]['query'](_0x59e110,{'type':db[_0xebff('0x57')][_0xebff('0x58')]['SELECT'],'raw':!![],'transaction':_0x3d3707});})['then'](function(_0x35f954){var _0x3efd33=_[_0xebff('0x31')](_0x35f954,function(_0x27b9f5){return Number(_0x27b9f5[_0xebff('0x5e')]);});return db[_0xebff('0x5f')][_0xebff('0x53')]({'where':{'UserId':{'$in':_0x38b824},'MailQueueId':{'$in':_0x3efd33}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){var _0x32def1='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3a3d88;return db[_0xebff('0x54')]['query'](_0x32def1,{'type':db[_0xebff('0x57')][_0xebff('0x58')][_0xebff('0x59')],'raw':!![],'transaction':_0x3d3707});})[_0xebff('0x25')](function(_0x5e307f){var _0x39f1ea=_[_0xebff('0x31')](_0x5e307f,function(_0x1feadf){return Number(_0x1feadf[_0xebff('0x60')]);});return db['UserSmsQueue'][_0xebff('0x53')]({'where':{'UserId':{'$in':_0x38b824},'SmsQueueId':{'$in':_0x39f1ea}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){var _0x59e6c6='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3a3d88;return db[_0xebff('0x54')][_0xebff('0x32')](_0x59e6c6,{'type':db[_0xebff('0x57')]['QueryTypes'][_0xebff('0x59')],'raw':!![],'transaction':_0x3d3707});})[_0xebff('0x25')](function(_0x4d49d0){var _0x36faa3=_['map'](_0x4d49d0,function(_0x270aaa){return Number(_0x270aaa[_0xebff('0x61')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x38b824},'ChatQueueId':{'$in':_0x36faa3}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){var _0x3fd6c2=_0xebff('0x62')+_0x3a3d88;return db[_0xebff('0x54')][_0xebff('0x32')](_0x3fd6c2,{'type':db[_0xebff('0x57')]['QueryTypes'][_0xebff('0x59')],'raw':!![],'transaction':_0x3d3707});})['then'](function(_0x50624b){var _0x482c0e=_[_0xebff('0x31')](_0x50624b,function(_0x488b3e){return Number(_0x488b3e[_0xebff('0x63')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x38b824},'FaxQueueId':{'$in':_0x482c0e}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){var _0x305c83=_0xebff('0x64')+_0x3a3d88;return db['sequelize'][_0xebff('0x32')](_0x305c83,{'type':db[_0xebff('0x57')][_0xebff('0x58')][_0xebff('0x59')],'raw':!![],'transaction':_0x3d3707});})[_0xebff('0x25')](function(_0x3e7f3f){var _0x3fc5f2=_['map'](_0x3e7f3f,function(_0x4c1afd){return Number(_0x4c1afd[_0xebff('0x65')]);});return db[_0xebff('0x66')][_0xebff('0x53')]({'where':{'UserId':{'$in':_0x38b824},'OpenchannelQueueId':{'$in':_0x3fc5f2}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){var _0x315329='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3a3d88;return db[_0xebff('0x54')][_0xebff('0x32')](_0x315329,{'type':db[_0xebff('0x57')][_0xebff('0x58')][_0xebff('0x59')],'raw':!![],'transaction':_0x3d3707});})[_0xebff('0x25')](function(_0x2d82c8){var _0x351cc7=_[_0xebff('0x31')](_0x2d82c8,function(_0x444844){return Number(_0x444844[_0xebff('0x67')]);});return db[_0xebff('0x68')][_0xebff('0x53')]({'where':{'UserId':{'$in':_0x38b824},'WhatsappQueueId':{'$in':_0x351cc7}},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){return db[_0xebff('0x69')][_0xebff('0x48')]({'where':{'TeamId':_0x3a3d88}});})[_0xebff('0x25')](function(_0x30345f){if(_0x30345f===null){return;}return db[_0xebff('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x38b824},'VoicePrefixId':_0x30345f[_0xebff('0x6b')]},'transaction':_0x3d3707});})[_0xebff('0x25')](function(){return db['Team'][_0xebff('0x53')]({'where':{'id':_0x3a3d88},'cascade':!![],'transaction':_0x3d3707});})['then'](function(_0x14ab1b){if(_0x14ab1b===0x0){_0x3199ab['sendStatus'](0x194);}else{return db[_0xebff('0x6c')][_0xebff('0x53')]({'where':{'type':_0xebff('0x4e'),'resourceId':_0x3a3d88},'cascade':!![],'transaction':_0x3d3707})[_0xebff('0x25')](function(){_0x3199ab['status'](0xcc)[_0xebff('0x6d')]();});}})['catch'](function(_0x1f656b){_0x3199ab[_0xebff('0x29')](0x1f4)[_0xebff('0x2a')](_0x1f656b);});});};exports[_0xebff('0x6e')]=function(_0x48b896,_0x5ca9c6,_0x298261){return db[_0xebff('0x2c')][_0xebff('0x6f')]({'where':{'id':_0x48b896[_0xebff('0x47')]['id']}})[_0xebff('0x25')](handleEntityNotFound(_0x5ca9c6,null))[_0xebff('0x25')](function(_0x42903c){if(!_0x48b896['query'][_0xebff('0x70')]||!utils[_0xebff('0x71')](_0x48b896[_0xebff('0x32')][_0xebff('0x70')])){throw new db['Sequelize'][(_0xebff('0x72'))](_0xebff('0x73'));}var _0x4fe762={};var _0x3d1447={};_0x3d1447['model']=_[_0xebff('0x33')](db[_[_0xebff('0x74')](_0x48b896['query'][_0xebff('0x70')][_0xebff('0x75')]())+_0xebff('0x76')]['rawAttributes']);_0x3d1447['query']=_[_0xebff('0x33')](_0x48b896[_0xebff('0x32')]);_0x3d1447['filters']=_[_0xebff('0x35')](_0x3d1447['model'],_0x3d1447[_0xebff('0x32')]);_0x4fe762[_0xebff('0x36')]=_[_0xebff('0x35')](_0x3d1447['model'],qs[_0xebff('0x37')](_0x48b896[_0xebff('0x32')]['fields']));_0x4fe762[_0xebff('0x36')]=_0x4fe762[_0xebff('0x36')][_0xebff('0x38')]?_0x4fe762[_0xebff('0x36')]:_0x3d1447[_0xebff('0x30')];_0x4fe762[_0xebff('0x1e')]=qs[_0xebff('0x1e')](_0x48b896[_0xebff('0x32')][_0xebff('0x1e')]);_0x4fe762[_0xebff('0x1c')]=qs['offset'](_0x48b896[_0xebff('0x32')][_0xebff('0x1c')]);_0x4fe762['order']=qs[_0xebff('0x3b')](_0x48b896[_0xebff('0x32')]['sort']);_0x4fe762[_0xebff('0x3e')]=qs[_0xebff('0x34')](_[_0xebff('0x3c')](_0x48b896[_0xebff('0x32')],_0x3d1447[_0xebff('0x34')]));_0x4fe762=_[_0xebff('0x3f')]({},_0x4fe762,_0x48b896[_0xebff('0x41')]);return _0x42903c[_0xebff('0x4b')+_[_0xebff('0x74')](_0x48b896[_0xebff('0x32')][_0xebff('0x70')][_0xebff('0x75')]())+'Queues'](_0x4fe762);})[_0xebff('0x25')](respondWithResult(_0x5ca9c6,null))[_0xebff('0x45')](handleError(_0x5ca9c6,null));};exports[_0xebff('0x77')]=function(_0x2a2f43,_0x34c118,_0x3fd758){return db[_0xebff('0x2c')][_0xebff('0x6f')]({'where':{'id':_0x2a2f43[_0xebff('0x47')]['id']}})['then'](function(_0x4ad390){if(_0x4ad390){if(!_0x2a2f43['body']['channel']||!utils[_0xebff('0x71')](_0x2a2f43[_0xebff('0x52')][_0xebff('0x70')])){throw new db[(_0xebff('0x57'))][(_0xebff('0x72'))](_0xebff('0x73'));}return _0x4ad390['add'+_[_0xebff('0x74')](_0x2a2f43[_0xebff('0x52')][_0xebff('0x70')][_0xebff('0x75')]())+'Queues'](_0x2a2f43[_0xebff('0x52')]['ids']);}return null;})[_0xebff('0x25')](handleEntityNotFound(_0x34c118,null))[_0xebff('0x25')](respondWithStatusCode(_0x34c118,null))['catch'](handleError(_0x34c118,null));};exports[_0xebff('0x78')]=function(_0xcab11,_0x5c0207,_0x2143cd){return db[_0xebff('0x2c')][_0xebff('0x6f')]({'where':{'id':_0xcab11[_0xebff('0x47')]['id']}})['then'](function(_0x40b3cb){if(_0x40b3cb){if(!_0xcab11[_0xebff('0x32')][_0xebff('0x70')]||!utils['isValidChannel'](_0xcab11[_0xebff('0x32')]['channel'])){throw new db[(_0xebff('0x57'))][(_0xebff('0x72'))]('Unknown\x20channel');}return _0x40b3cb[_0xebff('0x79')+_[_0xebff('0x74')](_0xcab11[_0xebff('0x32')][_0xebff('0x70')]['toLowerCase']())+'Queues'](_0xcab11['query']['ids']);}return null;})[_0xebff('0x25')](handleEntityNotFound(_0x5c0207,null))[_0xebff('0x25')](respondWithStatusCode(_0x5c0207,null))['catch'](handleError(_0x5c0207,null));};exports[_0xebff('0x7a')]=function(_0x586c40,_0x51114f){var _0x562f84=_[_0xebff('0x7b')](_0x586c40[_0xebff('0x52')][_0xebff('0x7c')])?_0x586c40[_0xebff('0x52')][_0xebff('0x7c')]:[_0x586c40[_0xebff('0x52')][_0xebff('0x7c')]];var _0x1eceea=_0x586c40['params']['id'];return db['Team'][_0xebff('0x48')]({'where':{'id':_0x1eceea}})[_0xebff('0x25')](handleEntityNotFound(_0x51114f,null))[_0xebff('0x25')](function(_0x300980){if(_0x300980){var _0x35bd0d=[_0xebff('0x7d'),'Chat',_0xebff('0x7e'),'Sms',_0xebff('0x7f'),_0xebff('0x80'),_0xebff('0x81')];return db[_0xebff('0x54')][_0xebff('0x55')](function(_0x9c31ff){var _0x3dc3f9=_['map'](_0x35bd0d,function(_0x1987d8){var _0x3c706d={'attributes':['id',_0xebff('0x28')]};if(_0x1987d8==='Voice'){_0x3c706d[_0xebff('0x82')]={'attributes':[_0xebff('0x83')]};}return _0x300980[_0xebff('0x4b')+_0x1987d8+'Queues'](_0x3c706d)['then'](function(_0x1fbc84){var _0x4a909b=_[_0xebff('0x31')](_0x1fbc84,function(_0x33f0d6){var _0xa61800=_[_0xebff('0x31')](_0x562f84,function(_0x4a3257){var _0x3f326e={'where':{'UserId':_0x4a3257,[_0x1987d8+_0xebff('0x84')]:_0x33f0d6['id']},'transaction':_0x9c31ff};if(_0x1987d8===_0xebff('0x7d')){_0x3f326e[_0xebff('0x85')]={'penalty':_0x33f0d6[_0xebff('0x86')]['penalty']};}return db[_0xebff('0x87')+_0x1987d8+'Queue'][_0xebff('0x88')](_0x3f326e)[_0xebff('0x25')](function(){socket['emit'](_0xebff('0x4a')+_0x1987d8+_0xebff('0x89'),{'UserId':_0x4a3257,[_0x1987d8+_0xebff('0x84')]:_0x33f0d6['id']});if(_0x1987d8!==_0xebff('0x7d')){return;}return db[_0xebff('0x87')]['findAll']({'where':{'id':_0x562f84,'online':0x1},'attributes':['id',_0xebff('0x28'),_0xebff('0x8a'),_0xebff('0x8b'),_0xebff('0x8c')],'raw':!![]})[_0xebff('0x25')](function(_0x11e550){var _0x266be6=_[_0xebff('0x31')](_0x11e550,function(_0x36553a){return db[_0xebff('0x8d')]['upsert']({'membername':_0x36553a[_0xebff('0x28')],'UserId':_0x36553a['id'],'queue_name':_0x33f0d6[_0xebff('0x28')],'VoiceQueueId':_0x33f0d6['id'],'interface':_['isNil'](_0x36553a['interface'])?util[_0xebff('0x8e')](_0xebff('0x8f'),_0x36553a['name']):_0x36553a[_0xebff('0x8c')],'paused':_0x36553a['voicePause']||![],'penalty':_0x33f0d6[_0xebff('0x86')][_0xebff('0x83')]},{'transaction':_0x9c31ff});});return Promise['all'](_0x266be6);});});});return Promise[_0xebff('0x90')](_0xa61800);});return Promise['all'](_0x4a909b);})['then'](function(){return db[_0xebff('0x69')][_0xebff('0x6f')]({'where':{'teamId':_0x1eceea}})[_0xebff('0x25')](function(_0x10be18){if(_0x10be18){var _0x77f10=_[_0xebff('0x31')](_0x562f84,function(_0x418a01){db[_0xebff('0x6a')][_0xebff('0x91')]({'UserId':_0x418a01,'VoicePrefixId':_0x10be18[_0xebff('0x6b')]});});return Promise[_0xebff('0x90')](_0x77f10);}});});});return Promise['all'](_0x3dc3f9)['then'](function(){return _0x300980[_0xebff('0x7a')](_0x562f84,{'transaction':_0x9c31ff})[_0xebff('0x92')](function(_0x2b751a){return _0x2b751a;});});});}})[_0xebff('0x25')](respondWithResult(_0x51114f,null))[_0xebff('0x45')](handleError(_0x51114f,null));};exports[_0xebff('0x93')]=function(_0xaade5,_0x5cfae4){var _0x38ff40=_[_0xebff('0x7b')](_0xaade5[_0xebff('0x32')]['ids'])?_0xaade5['query'][_0xebff('0x7c')]:[_0xaade5['query']['ids']];var _0x1244f4=_0xaade5[_0xebff('0x47')]['id'];return db[_0xebff('0x2c')][_0xebff('0x48')]({'where':{'id':_0x1244f4}})[_0xebff('0x25')](handleEntityNotFound(_0x5cfae4,null))['then'](function(_0x419998){if(_0x419998){var _0x320311=[_0xebff('0x7d'),_0xebff('0x94'),_0xebff('0x7e'),_0xebff('0x95'),_0xebff('0x7f'),_0xebff('0x80'),'Whatsapp'];return db[_0xebff('0x54')]['transaction'](function(_0x195436){var _0xdf6be2=_[_0xebff('0x31')](_0x320311,function(_0x44526b){var _0x5b0c6b={'attributes':['id',_0xebff('0x28')]};return _0x419998[_0xebff('0x4b')+_0x44526b+_0xebff('0x96')](_0x5b0c6b)['then'](function(_0x404c4d){var _0x37df6f=_['map'](_0x404c4d,function(_0x18c528){return _0x18c528[_0xebff('0x93')](_0x38ff40,{'transaction':_0x195436})['then'](function(){var _0x18dfdf=_['map'](_0x38ff40,function(_0x418b28){socket[_0xebff('0x97')](_0xebff('0x4a')+_0x44526b+_0xebff('0x98'),{'UserId':Number(_0x418b28),[_0x44526b+_0xebff('0x84')]:_0x18c528['id']});if(_0x44526b!==_0xebff('0x7d')){return;}return db[_0xebff('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x18c528['id'],'UserId':_0x418b28},'transaction':_0x195436});});return Promise[_0xebff('0x90')](_0x18dfdf);});});return Promise[_0xebff('0x90')](_0x37df6f);});});return Promise['all'](_0xdf6be2)['then'](function(){return _0x419998[_0xebff('0x93')](_0x38ff40,{'transaction':_0x195436});})['then'](function(){return db[_0xebff('0x69')][_0xebff('0x6f')]({'where':{'teamId':_0x1244f4}})[_0xebff('0x25')](function(_0x527004){if(_0x527004){var _0x13f9f5=_[_0xebff('0x31')](_0x38ff40,function(_0x4be2cd){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4be2cd,'VoicePrefixId':_0x527004[_0xebff('0x6b')]}});});return Promise[_0xebff('0x90')](_0x13f9f5);}});});});}})['then'](respondWithStatusCode(_0x5cfae4,null))[_0xebff('0x45')](handleError(_0x5cfae4,null));};exports[_0xebff('0x99')]=function(_0xfd453a,_0x1d77f8,_0xceaa12){var _0x2d53d3={};var _0x410874={};var _0x1d272c;var _0x5b4c3e;return db[_0xebff('0x2c')][_0xebff('0x6f')]({'where':{'id':_0xfd453a[_0xebff('0x47')]['id']}})[_0xebff('0x25')](handleEntityNotFound(_0x1d77f8,null))['then'](function(_0x5dcf5f){if(_0x5dcf5f){_0x1d272c=_0x5dcf5f;_0x410874[_0xebff('0x30')]=_['keys'](db['User'][_0xebff('0x2d')]);_0x410874['query']=_[_0xebff('0x33')](_0xfd453a[_0xebff('0x32')]);_0x410874[_0xebff('0x34')]=_[_0xebff('0x35')](_0x410874[_0xebff('0x30')],_0x410874[_0xebff('0x32')]);_0x2d53d3[_0xebff('0x36')]=_[_0xebff('0x35')](_0x410874[_0xebff('0x30')],qs[_0xebff('0x37')](_0xfd453a['query'][_0xebff('0x37')]));_0x2d53d3[_0xebff('0x36')]=_0x2d53d3['attributes'][_0xebff('0x38')]?_0x2d53d3['attributes']:_0x410874[_0xebff('0x30')];_0x2d53d3['order']=qs['sort'](_0xfd453a[_0xebff('0x32')][_0xebff('0x3b')]);_0x2d53d3[_0xebff('0x3e')]=qs['filters'](_[_0xebff('0x3c')](_0xfd453a[_0xebff('0x32')],_0x410874['filters']));if(_0xfd453a[_0xebff('0x32')]['filter']){_0x2d53d3[_0xebff('0x3e')]=_[_0xebff('0x3f')](_0x2d53d3[_0xebff('0x3e')],{'$or':_[_0xebff('0x31')](_0x2d53d3[_0xebff('0x36')],function(_0x4e0818){var _0x5baa81={};_0x5baa81[_0x4e0818]={'$like':'%'+_0xfd453a[_0xebff('0x32')][_0xebff('0x3d')]+'%'};return _0x5baa81;})});}_0x2d53d3=_[_0xebff('0x3f')]({},_0x2d53d3,_0xfd453a['options']);return _0x1d272c[_0xebff('0x99')](_0x2d53d3);}})[_0xebff('0x25')](function(_0x4c75d5){if(_0x4c75d5){_0x5b4c3e=_0x4c75d5[_0xebff('0x38')];if(!_0xfd453a[_0xebff('0x32')][_0xebff('0x39')](_0xebff('0x3a'))){_0x2d53d3[_0xebff('0x1e')]=qs[_0xebff('0x1e')](_0xfd453a[_0xebff('0x32')][_0xebff('0x1e')]);_0x2d53d3[_0xebff('0x1c')]=qs[_0xebff('0x1c')](_0xfd453a[_0xebff('0x32')][_0xebff('0x1c')]);}return _0x1d272c[_0xebff('0x99')](_0x2d53d3);}})['then'](function(_0x583dd7){if(_0x583dd7){return _0x583dd7?{'count':_0x5b4c3e,'rows':_0x583dd7}:null;}})[_0xebff('0x25')](respondWithResult(_0x1d77f8,null))[_0xebff('0x45')](handleError(_0x1d77f8,null));}; \ No newline at end of file +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 diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6b314f7..c4df17c 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 _0x0f82=['hasOwnProperty','exports','../../mysqldb','Team','setMaxListeners','save','update','remove','emit'];(function(_0x17cbdb,_0x16f019){var _0x9f7c9=function(_0x11314c){while(--_0x11314c){_0x17cbdb['push'](_0x17cbdb['shift']());}};_0x9f7c9(++_0x16f019);}(_0x0f82,0x1c4));var _0x20f8=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x0f82[_0x519756];return _0x37047e;};'use strict';var EventEmitter=require('events');var Team=require(_0x20f8('0x0'))['db'][_0x20f8('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x20f8('0x2')](0x0);var events={'afterCreate':_0x20f8('0x3'),'afterUpdate':_0x20f8('0x4'),'afterDestroy':_0x20f8('0x5')};function emitEvent(_0x25e9e1){return function(_0xb6cba4,_0x58a6aa,_0x38ddbf){TeamEvents[_0x20f8('0x6')](_0x25e9e1+':'+_0xb6cba4['id'],_0xb6cba4);TeamEvents[_0x20f8('0x6')](_0x25e9e1,_0xb6cba4);_0x38ddbf(null);};}for(var e in events){if(events[_0x20f8('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x20f8('0x8')]=TeamEvents; \ No newline at end of file +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 diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 63f00bd..c98a130 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 _0xf2c2=['then','map','setDataValue','catch','exports','define','Team','teams','Fax','Mail','Openchannel','Voice','Whatsapp','resolve','all','./team.attributes','get','Queues'];(function(_0x2536b5,_0x229384){var _0x51b72b=function(_0x43f3a9){while(--_0x43f3a9){_0x2536b5['push'](_0x2536b5['shift']());}};_0x51b72b(++_0x229384);}(_0xf2c2,0xb1));var _0x2f2c=function(_0x52b418,_0x5c9758){_0x52b418=_0x52b418-0x0;var _0x4f7eb=_0xf2c2[_0x52b418];return _0x4f7eb;};'use strict';var _=require('lodash');var attributes=require(_0x2f2c('0x0'));function getQueuesByChannel(_0x19c11f,_0x2ea6b8){var _0x46cddb=_0x2f2c('0x1')+_0x2ea6b8+_0x2f2c('0x2');return _0x19c11f[_0x46cddb]()[_0x2f2c('0x3')](function(_0x111bff){return _[_0x2f2c('0x4')](_0x111bff,function(_0x1f0196){_0x1f0196[_0x2f2c('0x5')]('channel',_0x2ea6b8);return _0x1f0196;});})[_0x2f2c('0x6')](function(_0x1a0a72){throw _0x1a0a72;});}module[_0x2f2c('0x7')]=function(_0x9d89b9){return _0x9d89b9[_0x2f2c('0x8')](_0x2f2c('0x9'),attributes,{'tableName':_0x2f2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1fdc1b=this;var _0x3b2ba6=['Chat',_0x2f2c('0xb'),_0x2f2c('0xc'),_0x2f2c('0xd'),'Sms',_0x2f2c('0xe'),_0x2f2c('0xf')];return Promise[_0x2f2c('0x10')]()[_0x2f2c('0x3')](function(){var _0x47f528=_[_0x2f2c('0x4')](_0x3b2ba6,function(_0x96135){return getQueuesByChannel(_0x1fdc1b,_0x96135);});return Promise[_0x2f2c('0x11')](_0x47f528);})['catch'](function(_0x2f017e){throw _0x2f017e;});}}});}; \ No newline at end of file +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 diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9ff7187..3c85a35 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 _0xb58f=['defaults','localhost','socket.io-emitter','./team.socket','register','request','info','request\x20sent','debug','stringify','code','error','message','Team,\x20%s,\x20%s','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x22c50e,_0x4ea131){var _0x500f85=function(_0x412f7b){while(--_0x412f7b){_0x22c50e['push'](_0x22c50e['shift']());}};_0x500f85(++_0x4ea131);}(_0xb58f,0xcc));var _0xfb58=function(_0x4a6f4d,_0x2bbb2a){_0x4a6f4d=_0x4a6f4d-0x0;var _0x17ffad=_0xb58f[_0x4a6f4d];return _0x17ffad;};'use strict';var _=require(_0xfb58('0x0'));var util=require('util');var moment=require(_0xfb58('0x1'));var BPromise=require(_0xfb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb58('0x3'));var db=require(_0xfb58('0x4'))['db'];var utils=require(_0xfb58('0x5'));var logger=require(_0xfb58('0x6'))(_0xfb58('0x7'));var config=require(_0xfb58('0x8'));var jayson=require(_0xfb58('0x9'));var client=jayson[_0xfb58('0xa')]['http']({'port':0x232a});config[_0xfb58('0xb')]=_[_0xfb58('0xc')](config[_0xfb58('0xb')],{'host':_0xfb58('0xd'),'port':0x18eb});var socket=require(_0xfb58('0xe'))(new Redis(config[_0xfb58('0xb')]));require(_0xfb58('0xf'))[_0xfb58('0x10')](socket);function respondWithRpcPromise(_0x265b56,_0x335f74,_0x5948cf){return new BPromise(function(_0x58f550,_0x8e705b){return client[_0xfb58('0x11')](_0x265b56,_0x5948cf)['then'](function(_0x25edc1){logger[_0xfb58('0x12')]('Team,\x20%s,\x20%s',_0x335f74,_0xfb58('0x13'));logger[_0xfb58('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x335f74,_0xfb58('0x13'),JSON[_0xfb58('0x15')](_0x25edc1));if(_0x25edc1['error']){if(_0x25edc1['error'][_0xfb58('0x16')]===0x1f4){logger[_0xfb58('0x17')]('Team,\x20%s,\x20%s',_0x335f74,_0x25edc1['error'][_0xfb58('0x18')]);return _0x8e705b(_0x25edc1['error']['message']);}logger['error'](_0xfb58('0x19'),_0x335f74,_0x25edc1[_0xfb58('0x17')][_0xfb58('0x18')]);return _0x58f550(_0x25edc1[_0xfb58('0x17')]['message']);}else{logger[_0xfb58('0x12')](_0xfb58('0x19'),_0x335f74,_0xfb58('0x13'));_0x58f550(_0x25edc1[_0xfb58('0x1a')]['message']);}})['catch'](function(_0x540c03){logger['error']('Team,\x20%s,\x20%s',_0x335f74,_0x540c03);_0x8e705b(_0x540c03);});});} \ No newline at end of file +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 diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b854fbe..a2faa4f 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 _0x0962=['remove','update','emit','removeListener','team:','./team.events','save'];(function(_0x26e2e9,_0x102bed){var _0x13cee7=function(_0x1985e6){while(--_0x1985e6){_0x26e2e9['push'](_0x26e2e9['shift']());}};_0x13cee7(++_0x102bed);}(_0x0962,0x116));var _0x2096=function(_0xd2efd8,_0x1f69ee){_0xd2efd8=_0xd2efd8-0x0;var _0x23677d=_0x0962[_0xd2efd8];return _0x23677d;};'use strict';var TeamEvents=require(_0x2096('0x0'));var events=[_0x2096('0x1'),_0x2096('0x2'),_0x2096('0x3')];function createListener(_0x114710,_0x42c6d1){return function(_0x3a5367){_0x42c6d1[_0x2096('0x4')](_0x114710,_0x3a5367);};}function removeListener(_0x5ef565,_0x42b1fa){return function(){TeamEvents[_0x2096('0x5')](_0x5ef565,_0x42b1fa);};}exports['register']=function(_0x233148){for(var _0x38b92b=0x0,_0x2a4579=events['length'];_0x38b92b<_0x2a4579;_0x38b92b++){var _0x52d828=events[_0x38b92b];var _0x1c37b5=createListener(_0x2096('0x6')+_0x52d828,_0x233148);TeamEvents['on'](_0x52d828,_0x1c37b5);}}; \ No newline at end of file +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 diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 9828a0d..0043f49 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 _0xcea2=['sequelize','INTEGER'];(function(_0x1166a0,_0x36ccae){var _0x2b5c69=function(_0x51cd3c){while(--_0x51cd3c){_0x1166a0['push'](_0x1166a0['shift']());}};_0x2b5c69(++_0x36ccae);}(_0xcea2,0x15a));var _0x2cea=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xcea2[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x2cea('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x2cea('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +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 diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index edd27ed..cac93ff 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 _0xad13=['exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x4e7490,_0x4b26ae){var _0x3622d0=function(_0x40a2bb){while(--_0x40a2bb){_0x4e7490['push'](_0x4e7490['shift']());}};_0x3622d0(++_0x4b26ae);}(_0xad13,0x79));var _0x3ad1=function(_0x2b04eb,_0x496171){_0x2b04eb=_0x2b04eb-0x0;var _0x1ec29b=_0xad13[_0x2b04eb];return _0x1ec29b;};'use strict';var _=require(_0x3ad1('0x0'));var util=require('util');var logger=require(_0x3ad1('0x1'))(_0x3ad1('0x2'));var moment=require(_0x3ad1('0x3'));var BPromise=require(_0x3ad1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ad1('0x5'));var rimraf=require(_0x3ad1('0x6'));var config=require(_0x3ad1('0x7'));var attributes=require(_0x3ad1('0x8'));module[_0x3ad1('0x9')]=function(_0x416e30,_0x42ab5c){return _0x416e30[_0x3ad1('0xa')](_0x3ad1('0xb'),attributes,{'tableName':_0x3ad1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c692629..4a9fdd1 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x79be43,_0x47de22){var _0xe01bf3=function(_0x3c8f2f){while(--_0x3c8f2f){_0x79be43['push'](_0x79be43['shift']());}};_0xe01bf3(++_0x47de22);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0xcb91[_0x2ac4af];return _0x3a36df;};'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 _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 diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 19a6433..04feda1 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 _0x54a9=['sequelize','INTEGER'];(function(_0x38dae8,_0x307d5a){var _0x26da79=function(_0x5baed3){while(--_0x5baed3){_0x38dae8['push'](_0x38dae8['shift']());}};_0x26da79(++_0x307d5a);}(_0x54a9,0x186));var _0x954a=function(_0x9f452a,_0x2c921d){_0x9f452a=_0x9f452a-0x0;var _0x48a272=_0x54a9[_0x9f452a];return _0x48a272;};'use strict';var Sequelize=require(_0x954a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x954a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 1ec9539..66701a0 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 _0x2dd3=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x2dd3,0x6e));var _0x32dd=function(_0x1d610c,_0x3e8350){_0x1d610c=_0x1d610c-0x0;var _0x242f08=_0x2dd3[_0x1d610c];return _0x242f08;};'use strict';var _=require('lodash');var util=require(_0x32dd('0x0'));var logger=require(_0x32dd('0x1'))(_0x32dd('0x2'));var moment=require(_0x32dd('0x3'));var BPromise=require(_0x32dd('0x4'));var rp=require(_0x32dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32dd('0x6'));var config=require(_0x32dd('0x7'));var attributes=require(_0x32dd('0x8'));module[_0x32dd('0x9')]=function(_0x15aa74,_0x2ca4f9){return _0x15aa74[_0x32dd('0xa')](_0x32dd('0xb'),attributes,{'tableName':_0x32dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 290c993..e6d32e3 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 _0x21ca=['error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4102a9,_0x1d1248){var _0x3ceca0=function(_0x2c27e1){while(--_0x2c27e1){_0x4102a9['push'](_0x4102a9['shift']());}};_0x3ceca0(++_0x1d1248);}(_0x21ca,0x14e));var _0xa21c=function(_0x4676fd,_0x1fa47d){_0x4676fd=_0x4676fd-0x0;var _0x1dc06b=_0x21ca[_0x4676fd];return _0x1dc06b;};'use strict';var _=require('lodash');var util=require(_0xa21c('0x0'));var moment=require(_0xa21c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa21c('0x2'));var fs=require('fs');var Redis=require(_0xa21c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa21c('0x4'));var logger=require(_0xa21c('0x5'))(_0xa21c('0x6'));var config=require(_0xa21c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa21c('0x8')][_0xa21c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a1b82,_0x1b4f67,_0x59d27b){return new BPromise(function(_0x15d1be,_0x22d996){return client[_0xa21c('0xa')](_0x5a1b82,_0x59d27b)[_0xa21c('0xb')](function(_0x41277c){logger[_0xa21c('0xc')](_0xa21c('0xd'),_0x1b4f67,_0xa21c('0xe'));logger[_0xa21c('0xf')](_0xa21c('0x10'),_0x1b4f67,_0xa21c('0xe'),JSON[_0xa21c('0x11')](_0x41277c));if(_0x41277c['error']){if(_0x41277c[_0xa21c('0x12')]['code']===0x1f4){logger['error'](_0xa21c('0xd'),_0x1b4f67,_0x41277c['error'][_0xa21c('0x13')]);return _0x22d996(_0x41277c[_0xa21c('0x12')][_0xa21c('0x13')]);}logger[_0xa21c('0x12')](_0xa21c('0xd'),_0x1b4f67,_0x41277c[_0xa21c('0x12')][_0xa21c('0x13')]);return _0x15d1be(_0x41277c[_0xa21c('0x12')][_0xa21c('0x13')]);}else{logger[_0xa21c('0xc')](_0xa21c('0xd'),_0x1b4f67,_0xa21c('0xe'));_0x15d1be(_0x41277c[_0xa21c('0x14')][_0xa21c('0x13')]);}})[_0xa21c('0x15')](function(_0x2e6bcf){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1b4f67,_0x2e6bcf);_0x22d996(_0x2e6bcf);});});} \ No newline at end of file +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 diff --git a/server/api/template/index.js b/server/api/template/index.js index 4198ea8..268b945 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 _0x8838=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','path'];(function(_0x2a9ef5,_0x58e607){var _0xb0b690=function(_0x5efb9e){while(--_0x5efb9e){_0x2a9ef5['push'](_0x2a9ef5['shift']());}};_0xb0b690(++_0x58e607);}(_0x8838,0x90));var _0x8883=function(_0x540032,_0xbdf568){_0x540032=_0x540032-0x0;var _0x5a3233=_0x8838[_0x540032];return _0x5a3233;};'use strict';var multer=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var path=require(_0x8883('0x2'));var timeout=require(_0x8883('0x3'));var express=require(_0x8883('0x4'));var router=express[_0x8883('0x5')]();var fs_extra=require(_0x8883('0x6'));var auth=require(_0x8883('0x7'));var interaction=require(_0x8883('0x8'));var config=require(_0x8883('0x9'));var controller=require(_0x8883('0xa'));router[_0x8883('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8883('0xb')]('/:id',auth[_0x8883('0xc')](),controller[_0x8883('0xd')]);router[_0x8883('0xe')]('/',auth[_0x8883('0xc')](),controller[_0x8883('0xf')]);router[_0x8883('0x10')](_0x8883('0x11'),auth['isAuthenticated'](),controller[_0x8883('0x12')]);router[_0x8883('0x13')](_0x8883('0x11'),auth[_0x8883('0xc')](),controller['destroy']);module[_0x8883('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 85081ea..e21889b 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 _0x3032=['exports','STRING','TEXT','sequelize'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x3032,0x7f));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2303('0x0'));module[_0x2303('0x1')]={'name':{'type':Sequelize[_0x2303('0x2')]},'description':{'type':Sequelize[_0x2303('0x2')]},'html':{'type':Sequelize[_0x2303('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a74afa8..8e2540e 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 _0x3a09=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','stack','name','index','map','Template','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4a16c2,_0x18647d){var _0x1e26ac=function(_0x500447){while(--_0x500447){_0x4a16c2['push'](_0x4a16c2['shift']());}};_0x1e26ac(++_0x18647d);}(_0x3a09,0xf8));var _0x93a0=function(_0x2f85f7,_0x4cff9d){_0x2f85f7=_0x2f85f7-0x0;var _0x117851=_0x3a09[_0x2f85f7];return _0x117851;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93a0('0x0'));var zipdir=require(_0x93a0('0x1'));var jsonpatch=require(_0x93a0('0x2'));var rp=require(_0x93a0('0x3'));var moment=require(_0x93a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93a0('0x5'));var util=require(_0x93a0('0x6'));var path=require(_0x93a0('0x7'));var sox=require(_0x93a0('0x8'));var csv=require(_0x93a0('0x9'));var ejs=require(_0x93a0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93a0('0xb'));var squel=require(_0x93a0('0xc'));var crypto=require(_0x93a0('0xd'));var jsforce=require(_0x93a0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x93a0('0x9'));var querystring=require(_0x93a0('0xf'));var Papa=require(_0x93a0('0x10'));var Redis=require(_0x93a0('0x11'));var authService=require(_0x93a0('0x12'));var qs=require(_0x93a0('0x13'));var as=require(_0x93a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93a0('0x15'));var utils=require(_0x93a0('0x16'));var config=require(_0x93a0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x93a0('0x18'))['db'];function respondWithStatusCode(_0x6e0599,_0x52ae36){_0x52ae36=_0x52ae36||0xcc;return function(_0x46ff57){if(_0x46ff57){return _0x6e0599[_0x93a0('0x19')](_0x52ae36);}return _0x6e0599[_0x93a0('0x1a')](_0x52ae36)[_0x93a0('0x1b')]();};}function respondWithResult(_0x50659a,_0x597f68){_0x597f68=_0x597f68||0xc8;return function(_0xf8f49c){if(_0xf8f49c){return _0x50659a['status'](_0x597f68)['json'](_0xf8f49c);}};}function respondWithFilteredResult(_0x4f2849,_0xa5db59){return function(_0x510235){if(_0x510235){var _0x5f7edc=typeof _0xa5db59[_0x93a0('0x1c')]==='undefined'&&typeof _0xa5db59[_0x93a0('0x1d')]===_0x93a0('0x1e');var _0x103db3=_0x510235[_0x93a0('0x1f')];var _0x4e8ffd=_0x5f7edc?0x0:_0xa5db59[_0x93a0('0x1c')];var _0x6f5f=_0x5f7edc?_0x510235['count']:_0xa5db59['offset']+_0xa5db59[_0x93a0('0x1d')];var _0x39ecdf;if(_0x6f5f>=_0x103db3){_0x6f5f=_0x103db3;_0x39ecdf=0xc8;}else{_0x39ecdf=0xce;}_0x4f2849[_0x93a0('0x1a')](_0x39ecdf);return _0x4f2849[_0x93a0('0x20')](_0x93a0('0x21'),_0x4e8ffd+'-'+_0x6f5f+'/'+_0x103db3)['json'](_0x510235);}return null;};}function patchUpdates(_0x56b171){return function(_0x3cc54c){try{jsonpatch[_0x93a0('0x22')](_0x3cc54c,_0x56b171,!![]);}catch(_0x5eac4b){return BPromise[_0x93a0('0x23')](_0x5eac4b);}return _0x3cc54c[_0x93a0('0x24')]();};}function saveUpdates(_0x4b729f,_0x3fd412){return function(_0x5bd8d2){if(_0x5bd8d2){return _0x5bd8d2[_0x93a0('0x25')](_0x4b729f)['then'](function(_0x3ce1d9){return _0x3ce1d9;});}return null;};}function removeEntity(_0x145f44,_0x5c0804){return function(_0xbdb918){if(_0xbdb918){return _0xbdb918[_0x93a0('0x26')]()[_0x93a0('0x27')](function(){var _0x1a1cca=_0xbdb918[_0x93a0('0x28')]({'plain':!![]});var _0x409cb4=_0x93a0('0x29');return db[_0x93a0('0x2a')][_0x93a0('0x26')]({'where':{'type':_0x409cb4,'resourceId':_0x1a1cca['id']}})[_0x93a0('0x27')](function(){return _0xbdb918;});})[_0x93a0('0x27')](function(){_0x145f44[_0x93a0('0x1a')](0xcc)[_0x93a0('0x1b')]();});}};}function handleEntityNotFound(_0x255dff,_0x1a95ec){return function(_0x535ee3){if(!_0x535ee3){_0x255dff[_0x93a0('0x19')](0x194);}return _0x535ee3;};}function handleError(_0x3b3cb0,_0x9bf3){_0x9bf3=_0x9bf3||0x1f4;return function(_0x93e04e){logger['error'](_0x93e04e[_0x93a0('0x2b')]);if(_0x93e04e[_0x93a0('0x2c')]){delete _0x93e04e['name'];}_0x3b3cb0[_0x93a0('0x1a')](_0x9bf3)['send'](_0x93e04e);};}exports[_0x93a0('0x2d')]=function(_0x2fe253,_0x521c91){var _0x273e27={},_0x139b3a={},_0x59624e={'count':0x0,'rows':[]};var _0x241a50=_[_0x93a0('0x2e')](db[_0x93a0('0x2f')]['rawAttributes'],function(_0x27605a){return{'name':_0x27605a[_0x93a0('0x30')],'type':_0x27605a[_0x93a0('0x31')][_0x93a0('0x32')]};});_0x139b3a[_0x93a0('0x33')]=_[_0x93a0('0x2e')](_0x241a50,_0x93a0('0x2c'));_0x139b3a[_0x93a0('0x34')]=_[_0x93a0('0x35')](_0x2fe253[_0x93a0('0x34')]);_0x139b3a[_0x93a0('0x36')]=_[_0x93a0('0x37')](_0x139b3a['model'],_0x139b3a[_0x93a0('0x34')]);_0x273e27[_0x93a0('0x38')]=_[_0x93a0('0x37')](_0x139b3a[_0x93a0('0x33')],qs[_0x93a0('0x39')](_0x2fe253[_0x93a0('0x34')][_0x93a0('0x39')]));_0x273e27[_0x93a0('0x38')]=_0x273e27[_0x93a0('0x38')][_0x93a0('0x3a')]?_0x273e27[_0x93a0('0x38')]:_0x139b3a[_0x93a0('0x33')];if(!_0x2fe253[_0x93a0('0x34')][_0x93a0('0x3b')](_0x93a0('0x3c'))){_0x273e27[_0x93a0('0x1d')]=qs['limit'](_0x2fe253[_0x93a0('0x34')][_0x93a0('0x1d')]);_0x273e27['offset']=qs['offset'](_0x2fe253[_0x93a0('0x34')][_0x93a0('0x1c')]);}_0x273e27[_0x93a0('0x3d')]=qs[_0x93a0('0x3e')](_0x2fe253[_0x93a0('0x34')][_0x93a0('0x3e')]);_0x273e27[_0x93a0('0x3f')]=qs['filters'](_['pick'](_0x2fe253[_0x93a0('0x34')],_0x139b3a[_0x93a0('0x36')]),_0x241a50);if(_0x2fe253['query']['filter']){_0x273e27[_0x93a0('0x3f')]=_['merge'](_0x273e27['where'],{'$or':_[_0x93a0('0x2e')](_0x241a50,function(_0x226386){if(_0x226386['type']!==_0x93a0('0x40')){var _0x4e0b23={};_0x4e0b23[_0x226386[_0x93a0('0x2c')]]={'$like':'%'+_0x2fe253[_0x93a0('0x34')][_0x93a0('0x41')]+'%'};return _0x4e0b23;}})});}_0x273e27=_[_0x93a0('0x42')]({},_0x273e27,_0x2fe253[_0x93a0('0x43')]);var _0x1a6414={'where':_0x273e27[_0x93a0('0x3f')]};return db[_0x93a0('0x2f')][_0x93a0('0x1f')](_0x1a6414)['then'](function(_0x35ba61){_0x59624e[_0x93a0('0x1f')]=_0x35ba61;if(_0x2fe253[_0x93a0('0x34')][_0x93a0('0x44')]){_0x273e27[_0x93a0('0x45')]=[{'all':!![]}];}return db['Template'][_0x93a0('0x46')](_0x273e27);})[_0x93a0('0x27')](function(_0x43fc3c){_0x59624e['rows']=_0x43fc3c;return _0x59624e;})[_0x93a0('0x27')](respondWithFilteredResult(_0x521c91,_0x273e27))['catch'](handleError(_0x521c91,null));};exports[_0x93a0('0x47')]=function(_0x5106e4,_0x19fc42){var _0xa7d75d={'raw':!![],'where':{'id':_0x5106e4[_0x93a0('0x48')]['id']}},_0xc314ae={};_0xc314ae[_0x93a0('0x33')]=_[_0x93a0('0x35')](db[_0x93a0('0x2f')][_0x93a0('0x49')]);_0xc314ae[_0x93a0('0x34')]=_[_0x93a0('0x35')](_0x5106e4[_0x93a0('0x34')]);_0xc314ae[_0x93a0('0x36')]=_[_0x93a0('0x37')](_0xc314ae['model'],_0xc314ae[_0x93a0('0x34')]);_0xa7d75d[_0x93a0('0x38')]=_[_0x93a0('0x37')](_0xc314ae[_0x93a0('0x33')],qs[_0x93a0('0x39')](_0x5106e4[_0x93a0('0x34')]['fields']));_0xa7d75d['attributes']=_0xa7d75d[_0x93a0('0x38')][_0x93a0('0x3a')]?_0xa7d75d[_0x93a0('0x38')]:_0xc314ae['model'];if(_0x5106e4['query'][_0x93a0('0x44')]){_0xa7d75d[_0x93a0('0x45')]=[{'all':!![]}];}_0xa7d75d=_[_0x93a0('0x42')]({},_0xa7d75d,_0x5106e4['options']);return db[_0x93a0('0x2f')][_0x93a0('0x4a')](_0xa7d75d)[_0x93a0('0x27')](handleEntityNotFound(_0x19fc42,null))['then'](respondWithResult(_0x19fc42,null))[_0x93a0('0x4b')](handleError(_0x19fc42,null));};exports[_0x93a0('0x4c')]=function(_0x5ae9e0,_0xc21649){return db[_0x93a0('0x2f')][_0x93a0('0x4c')](_0x5ae9e0['body'],{})[_0x93a0('0x27')](function(_0x16e49e){var _0x11aee1=_0x5ae9e0['user'][_0x93a0('0x28')]({'plain':!![]});if(!_0x11aee1)throw new Error(_0x93a0('0x4d'));if(_0x11aee1[_0x93a0('0x4e')]===_0x93a0('0x4f')){var _0x54d8f6=_0x16e49e['get']({'plain':!![]});var _0x17e1c2='Templates';return db[_0x93a0('0x50')][_0x93a0('0x4a')]({'where':{'name':_0x17e1c2,'userProfileId':_0x11aee1['userProfileId']},'raw':!![]})[_0x93a0('0x27')](function(_0x4d374f){if(_0x4d374f&&_0x4d374f[_0x93a0('0x51')]===0x0){return db[_0x93a0('0x2a')][_0x93a0('0x4c')]({'name':_0x54d8f6['name'],'resourceId':_0x54d8f6['id'],'type':_0x4d374f['name'],'sectionId':_0x4d374f['id']},{})[_0x93a0('0x27')](function(){return _0x16e49e;});}else{return _0x16e49e;}})[_0x93a0('0x4b')](function(_0x5ab54a){logger[_0x93a0('0x52')](_0x93a0('0x53'),_0x5ab54a);throw _0x5ab54a;});}return _0x16e49e;})[_0x93a0('0x27')](respondWithResult(_0xc21649,0xc9))[_0x93a0('0x4b')](handleError(_0xc21649,null));};exports['update']=function(_0xaed6ed,_0x391b6e){if(_0xaed6ed['body']['id']){delete _0xaed6ed['body']['id'];}return db[_0x93a0('0x2f')][_0x93a0('0x4a')]({'where':{'id':_0xaed6ed[_0x93a0('0x48')]['id']}})[_0x93a0('0x27')](handleEntityNotFound(_0x391b6e,null))[_0x93a0('0x27')](saveUpdates(_0xaed6ed['body'],null))[_0x93a0('0x27')](respondWithResult(_0x391b6e,null))[_0x93a0('0x4b')](handleError(_0x391b6e,null));};exports[_0x93a0('0x26')]=function(_0x4e9c50,_0x573bb7){return db[_0x93a0('0x2f')][_0x93a0('0x4a')]({'where':{'id':_0x4e9c50['params']['id']}})[_0x93a0('0x27')](handleEntityNotFound(_0x573bb7,null))['then'](removeEntity(_0x573bb7,null))[_0x93a0('0x4b')](handleError(_0x573bb7,null));}; \ No newline at end of file +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 diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8254cf4..7f7a85b 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 _0x4928=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','lodash','util','api','moment'];(function(_0x213a78,_0x2310de){var _0x1b1abd=function(_0x3bec5a){while(--_0x3bec5a){_0x213a78['push'](_0x213a78['shift']());}};_0x1b1abd(++_0x2310de);}(_0x4928,0xa6));var _0x8492=function(_0x89561,_0x2b6b84){_0x89561=_0x89561-0x0;var _0x153df7=_0x4928[_0x89561];return _0x153df7;};'use strict';var _=require(_0x8492('0x0'));var util=require(_0x8492('0x1'));var logger=require('../../config/logger')(_0x8492('0x2'));var moment=require(_0x8492('0x3'));var BPromise=require('bluebird');var rp=require(_0x8492('0x4'));var fs=require('fs');var path=require(_0x8492('0x5'));var rimraf=require(_0x8492('0x6'));var config=require(_0x8492('0x7'));var attributes=require(_0x8492('0x8'));module[_0x8492('0x9')]=function(_0x2c9f79,_0x1636a7){return _0x2c9f79['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 1528233..4b20797 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 _0x243b=['jayson/promise','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTemplate','Template','findAll','options','raw','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x54bd0d,_0x24a67f){var _0x4d20ff=function(_0xacac3e){while(--_0xacac3e){_0x54bd0d['push'](_0x54bd0d['shift']());}};_0x4d20ff(++_0x24a67f);}(_0x243b,0x9c));var _0xb243=function(_0x5d7153,_0x10b602){_0x5d7153=_0x5d7153-0x0;var _0x254ba2=_0x243b[_0x5d7153];return _0x254ba2;};'use strict';var _=require(_0xb243('0x0'));var util=require(_0xb243('0x1'));var moment=require(_0xb243('0x2'));var BPromise=require(_0xb243('0x3'));var rs=require(_0xb243('0x4'));var fs=require('fs');var Redis=require(_0xb243('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb243('0x6'));var logger=require('../../config/logger')(_0xb243('0x7'));var config=require(_0xb243('0x8'));var jayson=require(_0xb243('0x9'));var client=jayson[_0xb243('0xa')][_0xb243('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8c8cc,_0x567690,_0x3e794c){return new BPromise(function(_0x4b196c,_0x233ed6){return client['request'](_0x8c8cc,_0x3e794c)[_0xb243('0xc')](function(_0x57382a){logger['info'](_0xb243('0xd'),_0x567690,_0xb243('0xe'));logger[_0xb243('0xf')](_0xb243('0x10'),_0x567690,_0xb243('0xe'),JSON[_0xb243('0x11')](_0x57382a));if(_0x57382a[_0xb243('0x12')]){if(_0x57382a[_0xb243('0x12')][_0xb243('0x13')]===0x1f4){logger[_0xb243('0x12')]('Template,\x20%s,\x20%s',_0x567690,_0x57382a[_0xb243('0x12')][_0xb243('0x14')]);return _0x233ed6(_0x57382a[_0xb243('0x12')][_0xb243('0x14')]);}logger[_0xb243('0x12')](_0xb243('0xd'),_0x567690,_0x57382a[_0xb243('0x12')][_0xb243('0x14')]);return _0x4b196c(_0x57382a['error']['message']);}else{logger[_0xb243('0x15')](_0xb243('0xd'),_0x567690,_0xb243('0xe'));_0x4b196c(_0x57382a[_0xb243('0x16')][_0xb243('0x14')]);}})['catch'](function(_0x1ef831){logger[_0xb243('0x12')](_0xb243('0xd'),_0x567690,_0x1ef831);_0x233ed6(_0x1ef831);});});}exports[_0xb243('0x17')]=function(_0x410aca){var _0x23cdf3=this;return new Promise(function(_0x2e3efa,_0x2c9f29){return db[_0xb243('0x18')][_0xb243('0x19')]({'raw':_0x410aca[_0xb243('0x1a')]?_0x410aca[_0xb243('0x1a')][_0xb243('0x1b')]===undefined?!![]:![]:!![],'where':_0x410aca[_0xb243('0x1a')]?_0x410aca['options']['where']||null:null,'attributes':_0x410aca[_0xb243('0x1a')]?_0x410aca['options'][_0xb243('0x1c')]||null:null,'limit':_0x410aca['options']?_0x410aca[_0xb243('0x1a')]['limit']||null:null,'include':_0x410aca[_0xb243('0x1a')]?_0x410aca[_0xb243('0x1a')][_0xb243('0x1d')]?_[_0xb243('0x1e')](_0x410aca[_0xb243('0x1a')][_0xb243('0x1d')],function(_0x380cd1){return{'model':db[_0x380cd1[_0xb243('0x1f')]],'as':_0x380cd1['as'],'attributes':_0x380cd1['attributes'],'include':_0x380cd1[_0xb243('0x1d')]?_[_0xb243('0x1e')](_0x380cd1[_0xb243('0x1d')],function(_0x402de0){return{'model':db[_0x402de0[_0xb243('0x1f')]],'as':_0x402de0['as'],'attributes':_0x402de0['attributes'],'include':_0x402de0[_0xb243('0x1d')]?_['map'](_0x402de0['include'],function(_0x13caee){return{'model':db[_0x13caee[_0xb243('0x1f')]],'as':_0x13caee['as'],'attributes':_0x13caee['attributes']};}):[]};}):[]};}):[]:[]})[_0xb243('0xc')](function(_0x326fce){logger['info'](_0xb243('0x17'),_0x410aca);logger[_0xb243('0xf')](_0xb243('0x17'),_0x410aca,JSON[_0xb243('0x11')](_0x326fce));_0x2e3efa(_0x326fce);})[_0xb243('0x20')](function(_0x14ca7b){logger[_0xb243('0x12')](_0xb243('0x17'),_0x14ca7b[_0xb243('0x14')],_0x410aca);_0x2c9f29(_0x23cdf3[_0xb243('0x12')](0x1f4,_0x14ca7b[_0xb243('0x14')]));});});}; \ No newline at end of file +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 diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 67c1b77..22b525f 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 _0x0a17=['fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','destroy','exports','multer','path','Router'];(function(_0x384186,_0x12252b){var _0x3d0592=function(_0x4b0392){while(--_0x4b0392){_0x384186['push'](_0x384186['shift']());}};_0x3d0592(++_0x12252b);}(_0x0a17,0x1a6));var _0x70a1=function(_0x901253,_0x2c944d){_0x901253=_0x901253-0x0;var _0x5e8687=_0x0a17[_0x901253];return _0x5e8687;};'use strict';var multer=require(_0x70a1('0x0'));var util=require('util');var path=require(_0x70a1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x70a1('0x2')]();var fs_extra=require(_0x70a1('0x3'));var auth=require(_0x70a1('0x4'));var interaction=require(_0x70a1('0x5'));var config=require('../../config/environment');var controller=require(_0x70a1('0x6'));router[_0x70a1('0x7')]('/',auth[_0x70a1('0x8')](),controller[_0x70a1('0x9')]);router[_0x70a1('0x7')](_0x70a1('0xa'),auth[_0x70a1('0x8')](),controller[_0x70a1('0xb')]);router['get'](_0x70a1('0xc'),auth[_0x70a1('0x8')](),controller[_0x70a1('0xd')]);router[_0x70a1('0x7')]('/:id/any_conditions',auth[_0x70a1('0x8')](),controller[_0x70a1('0xe')]);router[_0x70a1('0x7')](_0x70a1('0xf'),auth[_0x70a1('0x8')](),controller[_0x70a1('0x10')]);router[_0x70a1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x70a1('0x11')](_0x70a1('0xc'),auth[_0x70a1('0x8')](),controller[_0x70a1('0x12')]);router[_0x70a1('0x11')]('/:id/any_conditions',auth[_0x70a1('0x8')](),controller[_0x70a1('0x13')]);router[_0x70a1('0x11')]('/:id/actions',auth[_0x70a1('0x8')](),controller[_0x70a1('0x14')]);router[_0x70a1('0x15')]('/:id',auth[_0x70a1('0x8')](),controller[_0x70a1('0x16')]);router['delete'](_0x70a1('0xa'),auth['isAuthenticated'](),controller[_0x70a1('0x17')]);module[_0x70a1('0x18')]=router; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 691ca64..a43b434 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 _0x3f9d=['STRING','BOOLEAN','exports'];(function(_0x2c21be,_0x10ae28){var _0x4e19d8=function(_0x26460f){while(--_0x26460f){_0x2c21be['push'](_0x2c21be['shift']());}};_0x4e19d8(++_0x10ae28);}(_0x3f9d,0x179));var _0xd3f9=function(_0x459847,_0x3d79f4){_0x459847=_0x459847-0x0;var _0x3720fe=_0x3f9d[_0x459847];return _0x3720fe;};'use strict';var Sequelize=require('sequelize');module[_0xd3f9('0x0')]={'name':{'type':Sequelize[_0xd3f9('0x1')]},'channel':{'type':Sequelize[_0xd3f9('0x1')]},'description':{'type':Sequelize[_0xd3f9('0x1')]},'status':{'type':Sequelize[_0xd3f9('0x2')],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5d4d984..b2e5c70 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 _0x821c=['lodash','squel','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','count','limit','set','Content-Range','reject','update','destroy','get','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','order','sort','where','pick','filter','options','then','includeAll','include','findAll','catch','show','keys','merge','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','intersection','hasOwnProperty','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x52746a,_0x5b3177){var _0x31081a=function(_0x558ab5){while(--_0x558ab5){_0x52746a['push'](_0x52746a['shift']());}};_0x31081a(++_0x5b3177);}(_0x821c,0x1cd));var _0xc821=function(_0x204e14,_0x430bda){_0x204e14=_0x204e14-0x0;var _0x218450=_0x821c[_0x204e14];return _0x218450;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc821('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc821('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc821('0x2'));var Mustache=require(_0xc821('0x3'));var util=require(_0xc821('0x4'));var path=require(_0xc821('0x5'));var sox=require(_0xc821('0x6'));var csv=require('to-csv');var ejs=require(_0xc821('0x7'));var fs=require('fs');var fs_extra=require(_0xc821('0x8'));var _=require(_0xc821('0x9'));var squel=require(_0xc821('0xa'));var crypto=require('crypto');var jsforce=require(_0xc821('0xb'));var deskjs=require(_0xc821('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc821('0xd'));var Redis=require(_0xc821('0xe'));var authService=require(_0xc821('0xf'));var qs=require(_0xc821('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc821('0x11'));var logger=require(_0xc821('0x12'))(_0xc821('0x13'));var utils=require(_0xc821('0x14'));var config=require(_0xc821('0x15'));var licenseUtil=require(_0xc821('0x16'));var db=require(_0xc821('0x17'))['db'];function respondWithStatusCode(_0x59b4d7,_0x240ea3){_0x240ea3=_0x240ea3||0xcc;return function(_0x9e24d){if(_0x9e24d){return _0x59b4d7[_0xc821('0x18')](_0x240ea3);}return _0x59b4d7[_0xc821('0x19')](_0x240ea3)[_0xc821('0x1a')]();};}function respondWithResult(_0x2f5546,_0x3e0908){_0x3e0908=_0x3e0908||0xc8;return function(_0x2d00a6){if(_0x2d00a6){return _0x2f5546[_0xc821('0x19')](_0x3e0908)[_0xc821('0x1b')](_0x2d00a6);}};}function respondWithFilteredResult(_0x380844,_0x4db380){return function(_0x3ec752){if(_0x3ec752){var _0xf68954=typeof _0x4db380[_0xc821('0x1c')]==='undefined'&&typeof _0x4db380['limit']===_0xc821('0x1d');var _0x66622=_0x3ec752[_0xc821('0x1e')];var _0x513908=_0xf68954?0x0:_0x4db380[_0xc821('0x1c')];var _0x28179b=_0xf68954?_0x3ec752['count']:_0x4db380[_0xc821('0x1c')]+_0x4db380[_0xc821('0x1f')];var _0xe10725;if(_0x28179b>=_0x66622){_0x28179b=_0x66622;_0xe10725=0xc8;}else{_0xe10725=0xce;}_0x380844['status'](_0xe10725);return _0x380844[_0xc821('0x20')](_0xc821('0x21'),_0x513908+'-'+_0x28179b+'/'+_0x66622)[_0xc821('0x1b')](_0x3ec752);}return null;};}function patchUpdates(_0x3074bd){return function(_0x26a9b1){try{jsonpatch['apply'](_0x26a9b1,_0x3074bd,!![]);}catch(_0x280aee){return BPromise[_0xc821('0x22')](_0x280aee);}return _0x26a9b1['save']();};}function saveUpdates(_0x201b39,_0x23a82f){return function(_0xb5f8ec){if(_0xb5f8ec){return _0xb5f8ec[_0xc821('0x23')](_0x201b39)['then'](function(_0x182323){return _0x182323;});}return null;};}function removeEntity(_0x1e3fa6,_0x1ea829){return function(_0x4b4339){if(_0x4b4339){return _0x4b4339[_0xc821('0x24')]()['then'](function(){var _0x5d4b6b=_0x4b4339[_0xc821('0x25')]({'plain':!![]});var _0x2bb49e=_0xc821('0x26');return db[_0xc821('0x27')][_0xc821('0x24')]({'where':{'type':_0x2bb49e,'resourceId':_0x5d4b6b['id']}})['then'](function(){return _0x4b4339;});})['then'](function(){_0x1e3fa6['status'](0xcc)[_0xc821('0x1a')]();});}};}function handleEntityNotFound(_0x27b916,_0x1a4b4a){return function(_0x4ebf9f){if(!_0x4ebf9f){_0x27b916['sendStatus'](0x194);}return _0x4ebf9f;};}function handleError(_0x35acf5,_0x224d12){_0x224d12=_0x224d12||0x1f4;return function(_0x5831b8){logger[_0xc821('0x28')](_0x5831b8[_0xc821('0x29')]);if(_0x5831b8[_0xc821('0x2a')]){delete _0x5831b8[_0xc821('0x2a')];}_0x35acf5[_0xc821('0x19')](_0x224d12)['send'](_0x5831b8);};}exports[_0xc821('0x2b')]=function(_0x4bf7e5,_0x1db2ff){var _0x5b8298={},_0x4669d6={},_0x26a814={'count':0x0,'rows':[]};var _0x10a165=_[_0xc821('0x2c')](db[_0xc821('0x2d')][_0xc821('0x2e')],function(_0x2b1255){return{'name':_0x2b1255[_0xc821('0x2f')],'type':_0x2b1255[_0xc821('0x30')][_0xc821('0x31')]};});_0x4669d6[_0xc821('0x32')]=_[_0xc821('0x2c')](_0x10a165,_0xc821('0x2a'));_0x4669d6['query']=_['keys'](_0x4bf7e5[_0xc821('0x33')]);_0x4669d6[_0xc821('0x34')]=_['intersection'](_0x4669d6[_0xc821('0x32')],_0x4669d6[_0xc821('0x33')]);_0x5b8298[_0xc821('0x35')]=_['intersection'](_0x4669d6['model'],qs[_0xc821('0x36')](_0x4bf7e5[_0xc821('0x33')][_0xc821('0x36')]));_0x5b8298[_0xc821('0x35')]=_0x5b8298[_0xc821('0x35')][_0xc821('0x37')]?_0x5b8298[_0xc821('0x35')]:_0x4669d6[_0xc821('0x32')];if(!_0x4bf7e5[_0xc821('0x33')]['hasOwnProperty']('nolimit')){_0x5b8298[_0xc821('0x1f')]=qs[_0xc821('0x1f')](_0x4bf7e5[_0xc821('0x33')]['limit']);_0x5b8298[_0xc821('0x1c')]=qs['offset'](_0x4bf7e5[_0xc821('0x33')][_0xc821('0x1c')]);}_0x5b8298[_0xc821('0x38')]=qs[_0xc821('0x39')](_0x4bf7e5[_0xc821('0x33')][_0xc821('0x39')]);_0x5b8298[_0xc821('0x3a')]=qs[_0xc821('0x34')](_[_0xc821('0x3b')](_0x4bf7e5[_0xc821('0x33')],_0x4669d6[_0xc821('0x34')]),_0x10a165);if(_0x4bf7e5['query'][_0xc821('0x3c')]){_0x5b8298[_0xc821('0x3a')]=_['merge'](_0x5b8298[_0xc821('0x3a')],{'$or':_['map'](_0x10a165,function(_0x20a832){if(_0x20a832[_0xc821('0x30')]!=='VIRTUAL'){var _0x271e2a={};_0x271e2a[_0x20a832[_0xc821('0x2a')]]={'$like':'%'+_0x4bf7e5['query'][_0xc821('0x3c')]+'%'};return _0x271e2a;}})});}_0x5b8298=_['merge']({},_0x5b8298,_0x4bf7e5[_0xc821('0x3d')]);var _0x493e2a={'where':_0x5b8298[_0xc821('0x3a')]};return db[_0xc821('0x2d')][_0xc821('0x1e')](_0x493e2a)[_0xc821('0x3e')](function(_0x19bb89){_0x26a814[_0xc821('0x1e')]=_0x19bb89;if(_0x4bf7e5[_0xc821('0x33')][_0xc821('0x3f')]){_0x5b8298[_0xc821('0x40')]=[{'all':!![]}];}return db[_0xc821('0x2d')][_0xc821('0x41')](_0x5b8298);})[_0xc821('0x3e')](function(_0x130a7c){_0x26a814['rows']=_0x130a7c;return _0x26a814;})[_0xc821('0x3e')](respondWithFilteredResult(_0x1db2ff,_0x5b8298))[_0xc821('0x42')](handleError(_0x1db2ff,null));};exports[_0xc821('0x43')]=function(_0x43bf6f,_0x3d5699){var _0x1adba7={'raw':![],'where':{'id':_0x43bf6f['params']['id']}},_0x3a7468={};_0x3a7468[_0xc821('0x32')]=_[_0xc821('0x44')](db['Trigger'][_0xc821('0x2e')]);_0x3a7468[_0xc821('0x33')]=_[_0xc821('0x44')](_0x43bf6f[_0xc821('0x33')]);_0x3a7468[_0xc821('0x34')]=_['intersection'](_0x3a7468[_0xc821('0x32')],_0x3a7468[_0xc821('0x33')]);_0x1adba7[_0xc821('0x35')]=_['intersection'](_0x3a7468[_0xc821('0x32')],qs[_0xc821('0x36')](_0x43bf6f['query'][_0xc821('0x36')]));_0x1adba7['attributes']=_0x1adba7[_0xc821('0x35')][_0xc821('0x37')]?_0x1adba7[_0xc821('0x35')]:_0x3a7468[_0xc821('0x32')];if(_0x43bf6f['query'][_0xc821('0x3f')]){_0x1adba7[_0xc821('0x40')]=[{'all':!![]}];}_0x1adba7=_[_0xc821('0x45')]({},_0x1adba7,_0x43bf6f[_0xc821('0x3d')]);return db['Trigger'][_0xc821('0x46')](_0x1adba7)['then'](handleEntityNotFound(_0x3d5699,null))[_0xc821('0x3e')](respondWithResult(_0x3d5699,null))['catch'](handleError(_0x3d5699,null));};exports[_0xc821('0x47')]=function(_0x58f7a7,_0x5f3729){return db[_0xc821('0x2d')][_0xc821('0x47')](_0x58f7a7[_0xc821('0x48')],{})[_0xc821('0x3e')](function(_0x1a9c31){var _0x14288f=_0x58f7a7[_0xc821('0x49')][_0xc821('0x25')]({'plain':!![]});if(!_0x14288f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14288f[_0xc821('0x4a')]===_0xc821('0x49')){var _0x25ca50=_0x1a9c31[_0xc821('0x25')]({'plain':!![]});var _0x546573=_0xc821('0x26');return db[_0xc821('0x4b')][_0xc821('0x46')]({'where':{'name':_0x546573,'userProfileId':_0x14288f['userProfileId']},'raw':!![]})[_0xc821('0x3e')](function(_0x30c9e3){if(_0x30c9e3&&_0x30c9e3[_0xc821('0x4c')]===0x0){return db[_0xc821('0x27')]['create']({'name':_0x25ca50[_0xc821('0x2a')],'resourceId':_0x25ca50['id'],'type':_0x30c9e3[_0xc821('0x2a')],'sectionId':_0x30c9e3['id']},{})[_0xc821('0x3e')](function(){return _0x1a9c31;});}else{return _0x1a9c31;}})[_0xc821('0x42')](function(_0x278f1e){logger[_0xc821('0x28')](_0xc821('0x4d'),_0x278f1e);throw _0x278f1e;});}return _0x1a9c31;})[_0xc821('0x3e')](respondWithResult(_0x5f3729,0xc9))['catch'](handleError(_0x5f3729,null));};exports[_0xc821('0x23')]=function(_0x31d48a,_0x7bcb81){if(_0x31d48a['body']['id']){delete _0x31d48a[_0xc821('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x31d48a[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x7bcb81,null))[_0xc821('0x3e')](saveUpdates(_0x31d48a[_0xc821('0x48')],null))[_0xc821('0x3e')](respondWithResult(_0x7bcb81,null))[_0xc821('0x42')](handleError(_0x7bcb81,null));};exports[_0xc821('0x24')]=function(_0x2ce097,_0x1db2e4){return db[_0xc821('0x2d')]['find']({'where':{'id':_0x2ce097[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x1db2e4,null))[_0xc821('0x3e')](removeEntity(_0x1db2e4,null))['catch'](handleError(_0x1db2e4,null));};exports[_0xc821('0x4f')]=function(_0x13b88f,_0x360cb9,_0x4d3509){if(_0x13b88f[_0xc821('0x48')]['id']){delete _0x13b88f[_0xc821('0x48')]['id'];}return db[_0xc821('0x2d')]['find']({'where':{'id':_0x13b88f[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x360cb9,null))['then'](function(_0x114096){if(_0x114096){_0x13b88f[_0xc821('0x48')][_0xc821('0x50')]=_0x114096['id'];return db[_0xc821('0x51')][_0xc821('0x47')](_0x13b88f[_0xc821('0x48')]);}})[_0xc821('0x3e')](respondWithResult(_0x360cb9,null))[_0xc821('0x42')](handleError(_0x360cb9,null));};exports[_0xc821('0x52')]=function(_0x508655,_0x2eba91,_0x481ea4){if(_0x508655[_0xc821('0x48')]['id']){delete _0x508655[_0xc821('0x48')]['id'];}return db[_0xc821('0x2d')][_0xc821('0x46')]({'where':{'id':_0x508655[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x2eba91,null))[_0xc821('0x3e')](function(_0x492bc2){if(_0x492bc2){_0x508655['body'][_0xc821('0x53')]=_0x492bc2['id'];return db[_0xc821('0x51')][_0xc821('0x47')](_0x508655[_0xc821('0x48')]);}})[_0xc821('0x3e')](respondWithResult(_0x2eba91,null))[_0xc821('0x42')](handleError(_0x2eba91,null));};exports[_0xc821('0x54')]=function(_0x1717b7,_0x570ad0,_0x41deb0){var _0x1def4a={};var _0x2dafc1={};var _0x2647e6;var _0x2dfeae;return db[_0xc821('0x2d')][_0xc821('0x55')]({'where':{'id':_0x1717b7[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x570ad0,null))[_0xc821('0x3e')](function(_0x569af5){if(_0x569af5){_0x2647e6=_0x569af5;_0x2dafc1[_0xc821('0x32')]=_[_0xc821('0x44')](db[_0xc821('0x51')][_0xc821('0x2e')]);_0x2dafc1['query']=_[_0xc821('0x44')](_0x1717b7[_0xc821('0x33')]);_0x2dafc1[_0xc821('0x34')]=_[_0xc821('0x56')](_0x2dafc1['model'],_0x2dafc1[_0xc821('0x33')]);_0x1def4a[_0xc821('0x35')]=_[_0xc821('0x56')](_0x2dafc1[_0xc821('0x32')],qs[_0xc821('0x36')](_0x1717b7[_0xc821('0x33')][_0xc821('0x36')]));_0x1def4a['attributes']=_0x1def4a[_0xc821('0x35')][_0xc821('0x37')]?_0x1def4a['attributes']:_0x2dafc1[_0xc821('0x32')];_0x1def4a[_0xc821('0x38')]=qs[_0xc821('0x39')](_0x1717b7[_0xc821('0x33')]['sort']);_0x1def4a['where']=qs['filters'](_[_0xc821('0x3b')](_0x1717b7['query'],_0x2dafc1['filters']));if(_0x1717b7[_0xc821('0x33')][_0xc821('0x3c')]){_0x1def4a[_0xc821('0x3a')]=_['merge'](_0x1def4a[_0xc821('0x3a')],{'$or':_[_0xc821('0x2c')](_0x1def4a[_0xc821('0x35')],function(_0x2443ce){var _0x3258f1={};_0x3258f1[_0x2443ce]={'$like':'%'+_0x1717b7[_0xc821('0x33')][_0xc821('0x3c')]+'%'};return _0x3258f1;})});}_0x1def4a=_[_0xc821('0x45')]({},_0x1def4a,_0x1717b7[_0xc821('0x3d')]);return _0x2647e6[_0xc821('0x54')](_0x1def4a);}})['then'](function(_0x1f9205){if(_0x1f9205){_0x2dfeae=_0x1f9205[_0xc821('0x37')];if(!_0x1717b7[_0xc821('0x33')][_0xc821('0x57')](_0xc821('0x58'))){_0x1def4a[_0xc821('0x1f')]=qs['limit'](_0x1717b7[_0xc821('0x33')][_0xc821('0x1f')]);_0x1def4a[_0xc821('0x1c')]=qs[_0xc821('0x1c')](_0x1717b7[_0xc821('0x33')][_0xc821('0x1c')]);}return _0x2647e6[_0xc821('0x54')](_0x1def4a);}})[_0xc821('0x3e')](function(_0x5ea6a4){if(_0x5ea6a4){return _0x5ea6a4?{'count':_0x2dfeae,'rows':_0x5ea6a4}:null;}})[_0xc821('0x3e')](respondWithResult(_0x570ad0,null))['catch'](handleError(_0x570ad0,null));};exports[_0xc821('0x59')]=function(_0xe34c8d,_0x28454e,_0x51f6a9){var _0x365d55={};var _0x399a87={};var _0x1a1194;var _0x2f4cb2;return db[_0xc821('0x2d')][_0xc821('0x55')]({'where':{'id':_0xe34c8d[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x28454e,null))[_0xc821('0x3e')](function(_0x3dfc25){if(_0x3dfc25){_0x1a1194=_0x3dfc25;_0x399a87[_0xc821('0x32')]=_['keys'](db['Condition']['rawAttributes']);_0x399a87[_0xc821('0x33')]=_[_0xc821('0x44')](_0xe34c8d[_0xc821('0x33')]);_0x399a87[_0xc821('0x34')]=_[_0xc821('0x56')](_0x399a87[_0xc821('0x32')],_0x399a87[_0xc821('0x33')]);_0x365d55[_0xc821('0x35')]=_[_0xc821('0x56')](_0x399a87[_0xc821('0x32')],qs['fields'](_0xe34c8d[_0xc821('0x33')]['fields']));_0x365d55[_0xc821('0x35')]=_0x365d55[_0xc821('0x35')]['length']?_0x365d55[_0xc821('0x35')]:_0x399a87[_0xc821('0x32')];_0x365d55[_0xc821('0x38')]=qs[_0xc821('0x39')](_0xe34c8d[_0xc821('0x33')][_0xc821('0x39')]);_0x365d55[_0xc821('0x3a')]=qs['filters'](_['pick'](_0xe34c8d[_0xc821('0x33')],_0x399a87[_0xc821('0x34')]));if(_0xe34c8d['query'][_0xc821('0x3c')]){_0x365d55['where']=_[_0xc821('0x45')](_0x365d55['where'],{'$or':_[_0xc821('0x2c')](_0x365d55['attributes'],function(_0xeef1a7){var _0x3b4d99={};_0x3b4d99[_0xeef1a7]={'$like':'%'+_0xe34c8d[_0xc821('0x33')][_0xc821('0x3c')]+'%'};return _0x3b4d99;})});}_0x365d55=_[_0xc821('0x45')]({},_0x365d55,_0xe34c8d[_0xc821('0x3d')]);return _0x1a1194[_0xc821('0x59')](_0x365d55);}})[_0xc821('0x3e')](function(_0x18a29f){if(_0x18a29f){_0x2f4cb2=_0x18a29f[_0xc821('0x37')];if(!_0xe34c8d['query'][_0xc821('0x57')](_0xc821('0x58'))){_0x365d55[_0xc821('0x1f')]=qs[_0xc821('0x1f')](_0xe34c8d[_0xc821('0x33')][_0xc821('0x1f')]);_0x365d55['offset']=qs['offset'](_0xe34c8d['query']['offset']);}return _0x1a1194[_0xc821('0x59')](_0x365d55);}})[_0xc821('0x3e')](function(_0x10247d){if(_0x10247d){return _0x10247d?{'count':_0x2f4cb2,'rows':_0x10247d}:null;}})[_0xc821('0x3e')](respondWithResult(_0x28454e,null))[_0xc821('0x42')](handleError(_0x28454e,null));};exports[_0xc821('0x5a')]=function(_0x21e028,_0x25b371,_0x5b1096){if(_0x21e028[_0xc821('0x48')]['id']){delete _0x21e028[_0xc821('0x48')]['id'];}return db['Trigger'][_0xc821('0x46')]({'where':{'id':_0x21e028[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x25b371,null))[_0xc821('0x3e')](function(_0x3706f7){if(_0x3706f7){_0x21e028['body'][_0xc821('0x5b')]=_0x3706f7['id'];return db[_0xc821('0x5c')][_0xc821('0x47')](_0x21e028['body']);}})[_0xc821('0x3e')](respondWithResult(_0x25b371,null))['catch'](handleError(_0x25b371,null));};exports[_0xc821('0x5d')]=function(_0x5871ea,_0x1dd4c8,_0x4e9b63){var _0x16b526={};var _0x6c8eb4={};var _0x4af6c6;var _0x44212b;return db[_0xc821('0x2d')][_0xc821('0x55')]({'where':{'id':_0x5871ea[_0xc821('0x4e')]['id']}})[_0xc821('0x3e')](handleEntityNotFound(_0x1dd4c8,null))[_0xc821('0x3e')](function(_0x483c6b){if(_0x483c6b){_0x4af6c6=_0x483c6b;_0x6c8eb4[_0xc821('0x32')]=_['keys'](db[_0xc821('0x5c')][_0xc821('0x2e')]);_0x6c8eb4[_0xc821('0x33')]=_[_0xc821('0x44')](_0x5871ea[_0xc821('0x33')]);_0x6c8eb4[_0xc821('0x34')]=_[_0xc821('0x56')](_0x6c8eb4[_0xc821('0x32')],_0x6c8eb4['query']);_0x16b526['attributes']=_[_0xc821('0x56')](_0x6c8eb4[_0xc821('0x32')],qs[_0xc821('0x36')](_0x5871ea['query'][_0xc821('0x36')]));_0x16b526[_0xc821('0x35')]=_0x16b526[_0xc821('0x35')]['length']?_0x16b526[_0xc821('0x35')]:_0x6c8eb4['model'];_0x16b526['order']=qs['sort'](_0x5871ea['query']['sort']);_0x16b526[_0xc821('0x3a')]=qs['filters'](_[_0xc821('0x3b')](_0x5871ea['query'],_0x6c8eb4[_0xc821('0x34')]));if(_0x5871ea[_0xc821('0x33')][_0xc821('0x3c')]){_0x16b526[_0xc821('0x3a')]=_[_0xc821('0x45')](_0x16b526[_0xc821('0x3a')],{'$or':_[_0xc821('0x2c')](_0x16b526['attributes'],function(_0x25904a){var _0x58f7a1={};_0x58f7a1[_0x25904a]={'$like':'%'+_0x5871ea[_0xc821('0x33')][_0xc821('0x3c')]+'%'};return _0x58f7a1;})});}_0x16b526=_[_0xc821('0x45')]({},_0x16b526,_0x5871ea['options']);return _0x4af6c6[_0xc821('0x5d')](_0x16b526);}})[_0xc821('0x3e')](function(_0x13a11b){if(_0x13a11b){_0x44212b=_0x13a11b[_0xc821('0x37')];if(!_0x5871ea[_0xc821('0x33')][_0xc821('0x57')]('nolimit')){_0x16b526[_0xc821('0x1f')]=qs['limit'](_0x5871ea[_0xc821('0x33')][_0xc821('0x1f')]);_0x16b526[_0xc821('0x1c')]=qs['offset'](_0x5871ea[_0xc821('0x33')][_0xc821('0x1c')]);}return _0x4af6c6[_0xc821('0x5d')](_0x16b526);}})['then'](function(_0x34805f){if(_0x34805f){return _0x34805f?{'count':_0x44212b,'rows':_0x34805f}:null;}})[_0xc821('0x3e')](respondWithResult(_0x1dd4c8,null))['catch'](handleError(_0x1dd4c8,null));}; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ddbdee8..0ff79be 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 _0x851e=['../../config/environment','exports','define','Trigger','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1155bd,_0x1b1a63){var _0x534f75=function(_0x56dae8){while(--_0x56dae8){_0x1155bd['push'](_0x1155bd['shift']());}};_0x534f75(++_0x1b1a63);}(_0x851e,0x1e8));var _0xe851=function(_0x5ddb91,_0x50a3c6){_0x5ddb91=_0x5ddb91-0x0;var _0x222f31=_0x851e[_0x5ddb91];return _0x222f31;};'use strict';var _=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var logger=require(_0xe851('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe851('0x3'));var rp=require(_0xe851('0x4'));var fs=require('fs');var path=require(_0xe851('0x5'));var rimraf=require(_0xe851('0x6'));var config=require(_0xe851('0x7'));var attributes=require('./trigger.attributes');module[_0xe851('0x8')]=function(_0x2b36b5,_0xba0648){return _0x2b36b5[_0xe851('0x9')](_0xe851('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 622facd..a333338 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 _0x5c79=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','ShowTrigger','lodash','util','moment','bluebird','ioredis'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5c79,0x64));var _0x95c7=function(_0x27a125,_0x330c0e){_0x27a125=_0x27a125-0x0;var _0x36eac1=_0x5c79[_0x27a125];return _0x36eac1;};'use strict';var _=require(_0x95c7('0x0'));var util=require(_0x95c7('0x1'));var moment=require(_0x95c7('0x2'));var BPromise=require(_0x95c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95c7('0x4'));var db=require(_0x95c7('0x5'))['db'];var utils=require(_0x95c7('0x6'));var logger=require(_0x95c7('0x7'))(_0x95c7('0x8'));var config=require(_0x95c7('0x9'));var jayson=require(_0x95c7('0xa'));var client=jayson[_0x95c7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3475e5,_0x46bd84,_0x391829){return new BPromise(function(_0x227370,_0x383337){return client[_0x95c7('0xc')](_0x3475e5,_0x391829)[_0x95c7('0xd')](function(_0x52b092){logger[_0x95c7('0xe')]('Trigger,\x20%s,\x20%s',_0x46bd84,_0x95c7('0xf'));logger[_0x95c7('0x10')](_0x95c7('0x11'),_0x46bd84,'request\x20sent',JSON[_0x95c7('0x12')](_0x52b092));if(_0x52b092[_0x95c7('0x13')]){if(_0x52b092[_0x95c7('0x13')][_0x95c7('0x14')]===0x1f4){logger[_0x95c7('0x13')](_0x95c7('0x15'),_0x46bd84,_0x52b092[_0x95c7('0x13')]['message']);return _0x383337(_0x52b092[_0x95c7('0x13')][_0x95c7('0x16')]);}logger[_0x95c7('0x13')]('Trigger,\x20%s,\x20%s',_0x46bd84,_0x52b092['error']['message']);return _0x227370(_0x52b092[_0x95c7('0x13')][_0x95c7('0x16')]);}else{logger[_0x95c7('0xe')](_0x95c7('0x15'),_0x46bd84,_0x95c7('0xf'));_0x227370(_0x52b092['result'][_0x95c7('0x16')]);}})[_0x95c7('0x17')](function(_0x4e7a7b){logger['error'](_0x95c7('0x15'),_0x46bd84,_0x4e7a7b);_0x383337(_0x4e7a7b);});});}exports[_0x95c7('0x18')]=function(_0x2fcd4d){var _0x31c14d=this;return new Promise(function(_0x9372bf,_0x444bcf){return db[_0x95c7('0x19')]['findAll']({'raw':_0x2fcd4d[_0x95c7('0x1a')]?_0x2fcd4d[_0x95c7('0x1a')][_0x95c7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fcd4d[_0x95c7('0x1a')]?_0x2fcd4d[_0x95c7('0x1a')][_0x95c7('0x1c')]||null:null,'attributes':_0x2fcd4d[_0x95c7('0x1a')]?_0x2fcd4d['options'][_0x95c7('0x1d')]||null:null,'limit':_0x2fcd4d[_0x95c7('0x1a')]?_0x2fcd4d['options'][_0x95c7('0x1e')]||null:null,'include':_0x2fcd4d[_0x95c7('0x1a')]?_0x2fcd4d[_0x95c7('0x1a')][_0x95c7('0x1f')]?_[_0x95c7('0x20')](_0x2fcd4d[_0x95c7('0x1a')][_0x95c7('0x1f')],function(_0x17b5a5){return{'model':db[_0x17b5a5[_0x95c7('0x21')]],'as':_0x17b5a5['as'],'attributes':_0x17b5a5['attributes'],'include':_0x17b5a5[_0x95c7('0x1f')]?_[_0x95c7('0x20')](_0x17b5a5[_0x95c7('0x1f')],function(_0x35c010){return{'model':db[_0x35c010[_0x95c7('0x21')]],'as':_0x35c010['as'],'attributes':_0x35c010[_0x95c7('0x1d')],'include':_0x35c010['include']?_[_0x95c7('0x20')](_0x35c010[_0x95c7('0x1f')],function(_0x17d5b5){return{'model':db[_0x17d5b5[_0x95c7('0x21')]],'as':_0x17d5b5['as'],'attributes':_0x17d5b5[_0x95c7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x95c7('0xd')](function(_0x38e398){logger[_0x95c7('0xe')]('GetTrigger',_0x2fcd4d);logger[_0x95c7('0x10')]('GetTrigger',_0x2fcd4d,JSON[_0x95c7('0x12')](_0x38e398));_0x9372bf(_0x38e398);})[_0x95c7('0x17')](function(_0x55a550){logger[_0x95c7('0x13')](_0x95c7('0x18'),_0x55a550[_0x95c7('0x16')],_0x2fcd4d);_0x444bcf(_0x31c14d[_0x95c7('0x13')](0x1f4,_0x55a550[_0x95c7('0x16')]));});});};exports[_0x95c7('0x22')]=function(_0x2aa7f8){var _0x2bb809=this;return new Promise(function(_0x27b69d,_0x58a7e2){return db[_0x95c7('0x19')]['find']({'raw':_0x2aa7f8['options']?_0x2aa7f8[_0x95c7('0x1a')][_0x95c7('0x1b')]===undefined?!![]:![]:!![],'where':_0x2aa7f8[_0x95c7('0x1a')]?_0x2aa7f8[_0x95c7('0x1a')]['where']||null:null,'attributes':_0x2aa7f8[_0x95c7('0x1a')]?_0x2aa7f8[_0x95c7('0x1a')][_0x95c7('0x1d')]||null:null,'include':_0x2aa7f8['options']?_0x2aa7f8[_0x95c7('0x1a')][_0x95c7('0x1f')]?_[_0x95c7('0x20')](_0x2aa7f8[_0x95c7('0x1a')][_0x95c7('0x1f')],function(_0x1dc276){return{'model':db[_0x1dc276[_0x95c7('0x21')]],'as':_0x1dc276['as'],'attributes':_0x1dc276[_0x95c7('0x1d')],'include':_0x1dc276['include']?_['map'](_0x1dc276['include'],function(_0x1cf57e){return{'model':db[_0x1cf57e[_0x95c7('0x21')]],'as':_0x1cf57e['as'],'attributes':_0x1cf57e[_0x95c7('0x1d')],'include':_0x1cf57e[_0x95c7('0x1f')]?_[_0x95c7('0x20')](_0x1cf57e[_0x95c7('0x1f')],function(_0x322d15){return{'model':db[_0x322d15[_0x95c7('0x21')]],'as':_0x322d15['as'],'attributes':_0x322d15['attributes']};}):[]};}):[]};}):[]:[]})[_0x95c7('0xd')](function(_0x10728b){logger[_0x95c7('0xe')]('ShowTrigger',_0x2aa7f8);logger['debug'](_0x95c7('0x22'),_0x2aa7f8,JSON[_0x95c7('0x12')](_0x10728b));_0x27b69d(_0x10728b);})[_0x95c7('0x17')](function(_0x68980c){logger[_0x95c7('0x13')](_0x95c7('0x22'),_0x68980c[_0x95c7('0x16')],_0x2aa7f8);_0x58a7e2(_0x2bb809[_0x95c7('0x13')](0x1f4,_0x68980c[_0x95c7('0x16')]));});});}; \ No newline at end of file +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 diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 316cee2..233e543 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 _0xb659=['util','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','show','post','/:id/clone','isAuthenticated','put','update','delete','destroy','exports','multer'];(function(_0x127103,_0x20e19b){var _0x5055f8=function(_0x334ef2){while(--_0x334ef2){_0x127103['push'](_0x127103['shift']());}};_0x5055f8(++_0x20e19b);}(_0xb659,0x12f));var _0x9b65=function(_0x5c6f53,_0x5f08f6){_0x5c6f53=_0x5c6f53-0x0;var _0x4b9fff=_0xb659[_0x5c6f53];return _0x4b9fff;};'use strict';var multer=require(_0x9b65('0x0'));var util=require(_0x9b65('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9b65('0x2')]();var fs_extra=require(_0x9b65('0x3'));var auth=require(_0x9b65('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9b65('0x5'));var controller=require(_0x9b65('0x6'));router[_0x9b65('0x7')]('/',auth['isAuthenticated'](),controller[_0x9b65('0x8')]);router['get'](_0x9b65('0x9'),auth['isAuthenticated'](),controller[_0x9b65('0xa')]);router[_0x9b65('0xb')](_0x9b65('0xc'),auth[_0x9b65('0xd')](),controller['clone']);router[_0x9b65('0xb')]('/',auth[_0x9b65('0xd')](),controller['create']);router[_0x9b65('0xe')]('/:id',auth[_0x9b65('0xd')](),controller[_0x9b65('0xf')]);router[_0x9b65('0x10')](_0x9b65('0x9'),auth[_0x9b65('0xd')](),controller[_0x9b65('0x11')]);module[_0x9b65('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9459632..224f25e 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 _0xf52a=['accept','refuse','originate','uac','pai','certificate','active','passive','actpass','dynamic','update','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','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\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER'];(function(_0x3679d5,_0x599997){var _0x2db5f9=function(_0x505bac){while(--_0x505bac){_0x3679d5['push'](_0x3679d5['shift']());}};_0x2db5f9(++_0x599997);}(_0xf52a,0x1e9));var _0xaf52=function(_0x419f61,_0xcaa640){_0x419f61=_0x419f61-0x0;var _0x46fce0=_0xf52a[_0x419f61];return _0x46fce0;};'use strict';var Sequelize=require(_0xaf52('0x0'));module[_0xaf52('0x1')]={'name':{'type':Sequelize[_0xaf52('0x2')],'allowNull':![],'unique':_0xaf52('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x5'),_0xaf52('0x6'),_0xaf52('0x7')),'allowNull':![],'defaultValue':_0xaf52('0x5')},'context':{'type':Sequelize[_0xaf52('0x2')],'allowNull':![],'defaultValue':_0xaf52('0x8')},'callingpres':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x9'),_0xaf52('0xa'),_0xaf52('0xb'),_0xaf52('0xc'),_0xaf52('0xd'),_0xaf52('0xe'),_0xaf52('0xf'),_0xaf52('0x10'))},'deny':{'type':Sequelize[_0xaf52('0x2')]},'permit':{'type':Sequelize[_0xaf52('0x2')]},'secret':{'type':Sequelize[_0xaf52('0x2')]},'md5secret':{'type':Sequelize[_0xaf52('0x2')]},'remotesecret':{'type':Sequelize[_0xaf52('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0xf2d318){this[_0xaf52('0x11')](_0xaf52('0x12'),_0xf2d318?_0xf2d318['join'](','):null);},'get':function(){return this[_0xaf52('0x13')](_0xaf52('0x12'))?this[_0xaf52('0x13')](_0xaf52('0x12'))[_0xaf52('0x14')](','):null;},'comment':_0xaf52('0x15')},'dtmfmode':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x16'),_0xaf52('0x17'),_0xaf52('0x18'),_0xaf52('0x19'),_0xaf52('0x1a')),'defaultValue':_0xaf52('0x16')},'directmedia':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no',_0xaf52('0x1c'),'update',_0xaf52('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaf52('0x2')]},'directmediadeny':{'type':Sequelize[_0xaf52('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0xcb4ef){this[_0xaf52('0x11')](_0xaf52('0x1e'),_0xcb4ef?_0xcb4ef[_0xaf52('0x1f')](','):null);},'get':function(){return this[_0xaf52('0x13')](_0xaf52('0x1e'))?this['getDataValue'](_0xaf52('0x1e'))[_0xaf52('0x14')](','):null;},'comment':_0xaf52('0x20')},'callgroup':{'type':Sequelize[_0xaf52('0x2')]},'namedcallgroup':{'type':Sequelize[_0xaf52('0x2')]},'pickupgroup':{'type':Sequelize[_0xaf52('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xaf52('0x2')]},'language':{'type':Sequelize[_0xaf52('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xaf52('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xaf52('0x2')],'defaultValue':_0xaf52('0x21')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaf52('0x22'),'set':function(_0xa50f3b){this[_0xaf52('0x11')](_0xaf52('0x23'),_0xa50f3b?_0xa50f3b[_0xaf52('0x1f')](';'):_0xaf52('0x22'));},'get':function(){return this[_0xaf52('0x13')](_0xaf52('0x23'))?this[_0xaf52('0x13')](_0xaf52('0x23'))['split'](';'):null;},'comment':_0xaf52('0x24')},'autoframing':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no')},'insecure':{'type':Sequelize[_0xaf52('0x2')],'defaultValue':'port,invite','set':function(_0x952850){this[_0xaf52('0x11')]('insecure',_0x952850?_0x952850[_0xaf52('0x1f')](','):null);},'get':function(){return this[_0xaf52('0x13')](_0xaf52('0x25'))?this['getDataValue'](_0xaf52('0x25'))['split'](','):null;},'comment':_0xaf52('0x26')},'trustrpid':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no',_0xaf52('0x27'))},'promiscredir':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xaf52('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0xaf52('0x28')](0xb)},'setvar':{'type':Sequelize[_0xaf52('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xaf52('0x2')]},'callcounter':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xaf52('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xaf52('0x2')]},'template':{'type':Sequelize[_0xaf52('0x2')]},'videosupport':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'mailbox':{'type':Sequelize[_0xaf52('0x2')]},'session_timers':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x29'),_0xaf52('0x2a'),_0xaf52('0x2b'))},'session_expires':{'type':Sequelize[_0xaf52('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x2c'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xaf52('0x2')]},'fromdomain':{'type':Sequelize[_0xaf52('0x2')]},'fromuser':{'type':Sequelize[_0xaf52('0x2')]},'port':{'type':Sequelize[_0xaf52('0x28')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no'),'defaultValue':_0xaf52('0x1b')},'keepalive':{'type':Sequelize[_0xaf52('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xaf52('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xaf52('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xaf52('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xaf52('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xaf52('0x4')]('yes','no',_0xaf52('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xaf52('0x2')]},'callbackextension':{'type':Sequelize[_0xaf52('0x2')]},'timert1':{'type':Sequelize[_0xaf52('0x28')](0xb)},'timerb':{'type':Sequelize[_0xaf52('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xaf52('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xaf52('0x2')]},'contactdeny':{'type':Sequelize[_0xaf52('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xaf52('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xaf52('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no','fingerprint',_0xaf52('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xaf52('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xaf52('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xaf52('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xaf52('0x2')]},'dtlscapath':{'type':Sequelize[_0xaf52('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xaf52('0x2f'),_0xaf52('0x30'),_0xaf52('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xaf52('0x2')]},'usereqphone':{'type':Sequelize[_0xaf52('0x4')](_0xaf52('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xaf52('0x2')]},'recordofffeature':{'type':Sequelize[_0xaf52('0x2')]},'call_limit':{'type':Sequelize[_0xaf52('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xaf52('0x4')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xaf52('0x2')]},'parkinglot':{'type':Sequelize[_0xaf52('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaf52('0x2')],'defaultValue':_0xaf52('0x32')},'canreinvite':{'type':Sequelize['ENUM'](_0xaf52('0x1b'),'no',_0xaf52('0x1c'),_0xaf52('0x33'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xaf52('0x2')]},'otherFields':{'type':Sequelize[_0xaf52('0x2')]},'active':{'type':Sequelize[_0xaf52('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xaf52('0x2')],'defaultValue':'no'}}; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index e8e5f71..799adb2 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x423c56,_0x87b400){var _0xb0ae13=function(_0xf47e6d){while(--_0xf47e6d){_0x423c56['push'](_0x423c56['shift']());}};_0xb0ae13(++_0x87b400);}(_0xedd9,0xfc));var _0x9edd=function(_0xcac792,_0x3d8b23){_0xcac792=_0xcac792-0x0;var _0x44480b=_0xedd9[_0xcac792];return _0x44480b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 55538c2..61cc366 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 _0xdeca=['exports','define','Trunk','../../config/logger','api','moment','bluebird','../../config/environment','./trunk.attributes'];(function(_0x312ea6,_0x49f40c){var _0xbb34b6=function(_0x5390c9){while(--_0x5390c9){_0x312ea6['push'](_0x312ea6['shift']());}};_0xbb34b6(++_0x49f40c);}(_0xdeca,0x1a1));var _0xadec=function(_0x18d4f9,_0x187a7c){_0x18d4f9=_0x18d4f9-0x0;var _0x32ac41=_0xdeca[_0x18d4f9];return _0x32ac41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xadec('0x0'))(_0xadec('0x1'));var moment=require(_0xadec('0x2'));var BPromise=require(_0xadec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xadec('0x4'));var attributes=require(_0xadec('0x5'));module[_0xadec('0x6')]=function(_0x3125f1,_0x34567c){return _0x3125f1[_0xadec('0x7')](_0xadec('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index ce963ed..b1783f5 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 _0xabd7=['include','map','model','ShowTrunk','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit'];(function(_0x244e32,_0xb7d837){var _0x3c52e6=function(_0x8fda4){while(--_0x8fda4){_0x244e32['push'](_0x244e32['shift']());}};_0x3c52e6(++_0xb7d837);}(_0xabd7,0x6b));var _0x7abd=function(_0x449de4,_0x575cec){_0x449de4=_0x449de4-0x0;var _0x3996fc=_0xabd7[_0x449de4];return _0x3996fc;};'use strict';var _=require('lodash');var util=require(_0x7abd('0x0'));var moment=require(_0x7abd('0x1'));var BPromise=require(_0x7abd('0x2'));var rs=require(_0x7abd('0x3'));var fs=require('fs');var Redis=require(_0x7abd('0x4'));var db=require(_0x7abd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7abd('0x6'))(_0x7abd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7abd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e59c4,_0x2fd071,_0x2e4951){return new BPromise(function(_0x25599c,_0x570f29){return client[_0x7abd('0x9')](_0x2e59c4,_0x2e4951)[_0x7abd('0xa')](function(_0x4a5541){logger[_0x7abd('0xb')](_0x7abd('0xc'),_0x2fd071,'request\x20sent');logger[_0x7abd('0xd')](_0x7abd('0xe'),_0x2fd071,'request\x20sent',JSON[_0x7abd('0xf')](_0x4a5541));if(_0x4a5541[_0x7abd('0x10')]){if(_0x4a5541[_0x7abd('0x10')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2fd071,_0x4a5541[_0x7abd('0x10')][_0x7abd('0x11')]);return _0x570f29(_0x4a5541[_0x7abd('0x10')]['message']);}logger[_0x7abd('0x10')](_0x7abd('0xc'),_0x2fd071,_0x4a5541[_0x7abd('0x10')][_0x7abd('0x11')]);return _0x25599c(_0x4a5541['error'][_0x7abd('0x11')]);}else{logger[_0x7abd('0xb')](_0x7abd('0xc'),_0x2fd071,_0x7abd('0x12'));_0x25599c(_0x4a5541[_0x7abd('0x13')][_0x7abd('0x11')]);}})[_0x7abd('0x14')](function(_0x141bb5){logger['error'](_0x7abd('0xc'),_0x2fd071,_0x141bb5);_0x570f29(_0x141bb5);});});}exports[_0x7abd('0x15')]=function(_0x961e20){var _0x2248eb=this;return new Promise(function(_0x1e8838,_0x3aa1e7){return db[_0x7abd('0x16')][_0x7abd('0x17')]({'raw':_0x961e20[_0x7abd('0x18')]?_0x961e20[_0x7abd('0x18')][_0x7abd('0x19')]===undefined?!![]:![]:!![],'where':_0x961e20[_0x7abd('0x18')]?_0x961e20[_0x7abd('0x18')][_0x7abd('0x1a')]||null:null,'attributes':_0x961e20[_0x7abd('0x18')]?_0x961e20['options'][_0x7abd('0x1b')]||null:null,'limit':_0x961e20[_0x7abd('0x18')]?_0x961e20[_0x7abd('0x18')][_0x7abd('0x1c')]||null:null,'include':_0x961e20[_0x7abd('0x18')]?_0x961e20[_0x7abd('0x18')][_0x7abd('0x1d')]?_[_0x7abd('0x1e')](_0x961e20[_0x7abd('0x18')][_0x7abd('0x1d')],function(_0x59cf5b){return{'model':db[_0x59cf5b[_0x7abd('0x1f')]],'as':_0x59cf5b['as'],'attributes':_0x59cf5b['attributes'],'include':_0x59cf5b[_0x7abd('0x1d')]?_[_0x7abd('0x1e')](_0x59cf5b['include'],function(_0x24b6c2){return{'model':db[_0x24b6c2['model']],'as':_0x24b6c2['as'],'attributes':_0x24b6c2['attributes'],'include':_0x24b6c2[_0x7abd('0x1d')]?_[_0x7abd('0x1e')](_0x24b6c2[_0x7abd('0x1d')],function(_0x4310bc){return{'model':db[_0x4310bc['model']],'as':_0x4310bc['as'],'attributes':_0x4310bc[_0x7abd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7abd('0xa')](function(_0x141585){logger[_0x7abd('0xb')](_0x7abd('0x15'),_0x961e20);logger[_0x7abd('0xd')](_0x7abd('0x15'),_0x961e20,JSON[_0x7abd('0xf')](_0x141585));_0x1e8838(_0x141585);})[_0x7abd('0x14')](function(_0x2500ba){logger[_0x7abd('0x10')](_0x7abd('0x15'),_0x2500ba[_0x7abd('0x11')],_0x961e20);_0x3aa1e7(_0x2248eb[_0x7abd('0x10')](0x1f4,_0x2500ba['message']));});});};exports[_0x7abd('0x20')]=function(_0x883efc){var _0x3228a1=this;return new Promise(function(_0x513518,_0x4909b2){return db[_0x7abd('0x16')][_0x7abd('0x21')]({'raw':_0x883efc['options']?_0x883efc['options']['raw']===undefined?!![]:![]:!![],'where':_0x883efc[_0x7abd('0x18')]?_0x883efc[_0x7abd('0x18')]['where']||null:null,'attributes':_0x883efc[_0x7abd('0x18')]?_0x883efc['options'][_0x7abd('0x1b')]||null:null,'include':_0x883efc[_0x7abd('0x18')]?_0x883efc['options'][_0x7abd('0x1d')]?_[_0x7abd('0x1e')](_0x883efc[_0x7abd('0x18')][_0x7abd('0x1d')],function(_0x39b5a6){return{'model':db[_0x39b5a6[_0x7abd('0x1f')]],'as':_0x39b5a6['as'],'attributes':_0x39b5a6['attributes'],'include':_0x39b5a6[_0x7abd('0x1d')]?_[_0x7abd('0x1e')](_0x39b5a6['include'],function(_0x43a405){return{'model':db[_0x43a405['model']],'as':_0x43a405['as'],'attributes':_0x43a405['attributes'],'include':_0x43a405['include']?_['map'](_0x43a405[_0x7abd('0x1d')],function(_0x436220){return{'model':db[_0x436220[_0x7abd('0x1f')]],'as':_0x436220['as'],'attributes':_0x436220[_0x7abd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7abd('0xa')](function(_0x53d298){logger['info']('ShowTrunk',_0x883efc);logger[_0x7abd('0xd')](_0x7abd('0x20'),_0x883efc,JSON['stringify'](_0x53d298));_0x513518(_0x53d298);})['catch'](function(_0x21091c){logger[_0x7abd('0x10')](_0x7abd('0x20'),_0x21091c[_0x7abd('0x11')],_0x883efc);_0x4909b2(_0x3228a1[_0x7abd('0x10')](0x1f4,_0x21091c[_0x7abd('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 56b5059..6314175 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 _0x2f2e=['./user-setting.controller','isAuthenticated','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2f2e,0x7b));var _0xe2f2=function(_0x2d9da8,_0x5d5072){_0x2d9da8=_0x2d9da8-0x0;var _0x57a29c=_0x2f2e[_0x2d9da8];return _0x57a29c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe2f2('0x0'));router['put']('/:id',auth[_0xe2f2('0x1')](),controller[_0xe2f2('0x2')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 36eb690..95fa9fc 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 _0xee8c=['debug','exports','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0xa0eef9,_0x20fcac){var _0x2a6ee5=function(_0x38de51){while(--_0x38de51){_0xa0eef9['push'](_0xa0eef9['shift']());}};_0x2a6ee5(++_0x20fcac);}(_0xee8c,0xbb));var _0xcee8=function(_0x8955b3,_0x3af8b4){_0x8955b3=_0x8955b3-0x0;var _0x369673=_0xee8c[_0x8955b3];return _0x369673;};'use strict';var Sequelize=require(_0xcee8('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xcee8('0x1'),_0xcee8('0x2'),'info',_0xcee8('0x3')];module[_0xcee8('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xcee8('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xcee8('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xcee8('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xcee8('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xcee8('0x8')],'unique':_0xcee8('0x9')}}; \ No newline at end of file +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 diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index d34f724..a4f5db1 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 _0xc818=['api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','update','then','sendStatus','stack','name','status','send','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger'];(function(_0xf74ddb,_0x8383bd){var _0x44e4cd=function(_0x20be15){while(--_0x20be15){_0xf74ddb['push'](_0xf74ddb['shift']());}};_0x44e4cd(++_0x8383bd);}(_0xc818,0x1e3));var _0x8c81=function(_0x176d25,_0x2b85da){_0x176d25=_0x176d25-0x0;var _0x51957c=_0xc818[_0x176d25];return _0x51957c;};'use strict';var _=require(_0x8c81('0x0'));var Redis=require(_0x8c81('0x1'));var logger=require(_0x8c81('0x2'))(_0x8c81('0x3'));var config=require('../../config/environment');var db=require(_0x8c81('0x4'))['db'];var socket=require(_0x8c81('0x5'))(new Redis(config[_0x8c81('0x6')]));require(_0x8c81('0x7'))[_0x8c81('0x8')](socket);config[_0x8c81('0x6')]=_[_0x8c81('0x9')](config['redis'],{'host':_0x8c81('0xa'),'port':0x18eb});function respondWithResult(_0x3d663e,_0x32cf31){_0x32cf31=_0x32cf31||0xc8;return function(_0x43d142){if(_0x43d142){return _0x3d663e['status'](_0x32cf31)[_0x8c81('0xb')](_0x43d142);}};}function saveUpdates(_0x448af6){return function(_0x186783){if(_0x186783){return _0x186783[_0x8c81('0xc')](_0x448af6)[_0x8c81('0xd')](function(_0x2ce097){return _0x2ce097;});}return null;};}function handleEntityNotFound(_0x64a425){return function(_0x4c8021){if(!_0x4c8021){_0x64a425[_0x8c81('0xe')](0x194);}return _0x4c8021;};}function handleError(_0x37dbb4,_0x639c8f){_0x639c8f=_0x639c8f||0x1f4;return function(_0x1775a6){logger['error'](_0x1775a6[_0x8c81('0xf')]);if(_0x1775a6[_0x8c81('0x10')]){delete _0x1775a6[_0x8c81('0x10')];}_0x37dbb4[_0x8c81('0x11')](_0x639c8f)[_0x8c81('0x12')](_0x1775a6);};}exports[_0x8c81('0xc')]=function(_0x1b7b1b,_0xd04a1){if(_0x1b7b1b[_0x8c81('0x13')]['role']!=='admin')throw new Error(_0x8c81('0x14'));if(isNaN(Number(_0x1b7b1b[_0x8c81('0x15')]['id'])))throw new Error(_0x8c81('0x16'));return db[_0x8c81('0x17')][_0x8c81('0x18')]({'where':{'id':_0x1b7b1b[_0x8c81('0x15')]['id']}})['then'](handleEntityNotFound(_0xd04a1,null))[_0x8c81('0xd')](saveUpdates(_0x1b7b1b[_0x8c81('0x19')],null))[_0x8c81('0xd')](respondWithResult(_0xd04a1,null))[_0x8c81('0x1a')](handleError(_0xd04a1,null));}; \ No newline at end of file +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 diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 41d1912..993fc09 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 _0x11df=['UserSetting','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x11df,0x18e));var _0xf11d=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x11df[_0xc6be3a];return _0x56a310;};'use strict';var EventEmitter=require(_0xf11d('0x0'));var UserSetting=require(_0xf11d('0x1'))['db'][_0xf11d('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xf11d('0x3')](0x0);var events={'afterCreate':_0xf11d('0x4'),'afterUpdate':'update','afterDestroy':_0xf11d('0x5')};function emitEvent(_0x1f9c65){return function(_0x3c65cd,_0x1ba753,_0x556959){UserSettingEvents['emit'](_0x1f9c65+':'+_0x3c65cd['id'],_0x3c65cd);UserSettingEvents[_0xf11d('0x6')](_0x1f9c65,_0x3c65cd);_0x556959(null);};}for(var e in events){if(events[_0xf11d('0x7')](e)){var event=events[e];UserSetting[_0xf11d('0x8')](e,emitEvent(event));}}module[_0xf11d('0x9')]=UserSettingEvents; \ No newline at end of file +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 diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index fa6a66a..9e420b9 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 _0x13f6=['user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting'];(function(_0x28bc21,_0x26bb94){var _0x1d8569=function(_0x319677){while(--_0x319677){_0x28bc21['push'](_0x28bc21['shift']());}};_0x1d8569(++_0x26bb94);}(_0x13f6,0x124));var _0x613f=function(_0x17c3cb,_0x2fab9b){_0x17c3cb=_0x17c3cb-0x0;var _0x59f56b=_0x13f6[_0x17c3cb];return _0x59f56b;};'use strict';var attributes=require(_0x613f('0x0'));module[_0x613f('0x1')]=function(_0x5f1b3e){return _0x5f1b3e['define'](_0x613f('0x2'),attributes,{'tableName':_0x613f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12dc5a){if(!_0x12dc5a['clientSideLoggingEnabled'])_0x12dc5a[_0x613f('0x4')]=null;else if(_0x12dc5a[_0x613f('0x4')]===null)_0x12dc5a[_0x613f('0x4')]=new Date();}}});}; \ No newline at end of file +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 diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 3d5c368..637a345 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 _0x8664=['emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','user-setting:update'];(function(_0x4b2f7d,_0x261e06){var _0x2cf0a1=function(_0x1d4cdb){while(--_0x1d4cdb){_0x4b2f7d['push'](_0x4b2f7d['shift']());}};_0x2cf0a1(++_0x261e06);}(_0x8664,0x1b4));var _0x4866=function(_0x13bd0a,_0x38a1a2){_0x13bd0a=_0x13bd0a-0x0;var _0xc3774a=_0x8664[_0x13bd0a];return _0xc3774a;};'use strict';var UserSettingEvents=require(_0x4866('0x0'));var events=[_0x4866('0x1'),_0x4866('0x2'),'update'];function createListener(_0x2c5ebc,_0x5163b9){return function(_0xf39e0){_0x5163b9['emit'](_0x2c5ebc,_0xf39e0);if(_0x2c5ebc===_0x4866('0x3')){_0x5163b9[_0x4866('0x4')](_0x4866('0x5')+_0xf39e0[_0x4866('0x6')],_0xf39e0);}};}exports[_0x4866('0x7')]=function(_0x6003f9){for(var _0x3b6514=0x0,_0x4f5a02=events[_0x4866('0x8')];_0x3b6514<_0x4f5a02;_0x3b6514++){var _0x13262d=events[_0x3b6514];var _0x519bad=createListener(_0x4866('0x9')+_0x13262d,_0x6003f9);UserSettingEvents['on'](_0x13262d,_0x519bad);}}; \ No newline at end of file +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 diff --git a/server/api/user/index.js b/server/api/user/index.js index 435be5e..d96a56a 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 _0x2fed=['/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','isAuthenticated','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','diskStorage','server/files/images/','format','now','single','file','login','/:id/logout','logout'];(function(_0x3a73fa,_0x4d3f00){var _0x143a68=function(_0x266280){while(--_0x266280){_0x3a73fa['push'](_0x3a73fa['shift']());}};_0x143a68(++_0x4d3f00);}(_0x2fed,0x11b));var _0xd2fe=function(_0x1f6461,_0x580715){_0x1f6461=_0x1f6461-0x0;var _0x5f0bbf=_0x2fed[_0x1f6461];return _0x5f0bbf;};'use strict';var multer=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var path=require(_0xd2fe('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2fe('0x3'));var router=express[_0xd2fe('0x4')]();var fs_extra=require(_0xd2fe('0x5'));var auth=require(_0xd2fe('0x6'));var interaction=require(_0xd2fe('0x7'));var config=require(_0xd2fe('0x8'));var controller=require(_0xd2fe('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2fe('0xa')]);router[_0xd2fe('0xb')](_0xd2fe('0xc'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0xe')]);router[_0xd2fe('0xb')]('/whoami',auth['isAuthenticated'](),controller[_0xd2fe('0xf')]);router[_0xd2fe('0xb')](_0xd2fe('0x10'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x11')]);router[_0xd2fe('0xb')](_0xd2fe('0x12'),auth['isAuthenticated'](),controller[_0xd2fe('0x13')]);router[_0xd2fe('0xb')](_0xd2fe('0x14'),controller[_0xd2fe('0x15')]);router['get'](_0xd2fe('0x16'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x17')]);router[_0xd2fe('0xb')]('/:id/contacts',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x18')]);router[_0xd2fe('0xb')](_0xd2fe('0x19'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x1a')]);router[_0xd2fe('0xb')](_0xd2fe('0x1b'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x1c')]);router[_0xd2fe('0xb')]('/:id/groups',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x1d')]);router[_0xd2fe('0xb')]('/:id/recordings',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x1e')]);router[_0xd2fe('0xb')](_0xd2fe('0x1f'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x20')]);router[_0xd2fe('0xb')]('/:id/chat/interactions',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x21')]);router[_0xd2fe('0xb')]('/:id/openchannel/interactions',auth[_0xd2fe('0xd')](),controller['getOpenchannelInteractions']);router[_0xd2fe('0xb')](_0xd2fe('0x22'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x23')]);router['get']('/:id/sms/interactions',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x24')]);router[_0xd2fe('0xb')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xd2fe('0x25')]);router[_0xd2fe('0xb')](_0xd2fe('0x26'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x27')]);router[_0xd2fe('0xb')](_0xd2fe('0x28'),auth[_0xd2fe('0xd')](),controller['getTeams']);router[_0xd2fe('0xb')](_0xd2fe('0x29'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x2a')]);router['get']('/:id/agents',auth[_0xd2fe('0xd')](),controller['getAgents']);router[_0xd2fe('0xb')](_0xd2fe('0x2b'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x2c')]);router[_0xd2fe('0xb')](_0xd2fe('0x2d'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x2e')]);router[_0xd2fe('0xb')]('/:id/mail_accounts',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x2f')]);router[_0xd2fe('0xb')](_0xd2fe('0x30'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x31')]);router[_0xd2fe('0xb')](_0xd2fe('0x32'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x33')]);router['get']('/:id/chat_websites',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x34')]);router[_0xd2fe('0xb')](_0xd2fe('0x35'),auth['isAuthenticated'](),controller[_0xd2fe('0x36')]);router[_0xd2fe('0xb')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xd2fe('0x37')]);router['get'](_0xd2fe('0x38'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x39')]);router[_0xd2fe('0x3a')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xd2fe('0x3b')]);router[_0xd2fe('0x3a')]('/',auth[_0xd2fe('0xd')](),controller['create']);router[_0xd2fe('0x3a')](_0xd2fe('0x3c'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x3d')]);router[_0xd2fe('0x3a')](_0xd2fe('0x19'),auth[_0xd2fe('0xd')](),controller['addQueues']);var upload=multer({'storage':multer[_0xd2fe('0x3e')]({'destination':function(_0x1d5749,_0x42d3e5,_0x5a4925){_0x5a4925(null,path['join'](config['root'],_0xd2fe('0x3f')));},'filename':function(_0x55870d,_0x50818b,_0x27dd0c){_0x27dd0c(null,util[_0xd2fe('0x40')]('%s-%s',Date[_0xd2fe('0x41')](),_0x50818b['originalname']));}})});router[_0xd2fe('0x3a')](_0xd2fe('0x14'),upload[_0xd2fe('0x42')](_0xd2fe('0x43')),controller['addAvatar']);router[_0xd2fe('0x3a')]('/:id/login',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x44')]);router['post'](_0xd2fe('0x45'),auth['isAuthenticated'](),controller[_0xd2fe('0x46')]);router[_0xd2fe('0x3a')](_0xd2fe('0x47'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x48')]);router[_0xd2fe('0x3a')](_0xd2fe('0x49'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x4a')]);router[_0xd2fe('0x3a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd2fe('0x4b')]);router['post'](_0xd2fe('0x4c'),auth['isAuthenticated'](),controller[_0xd2fe('0x4d')]);router[_0xd2fe('0x3a')](_0xd2fe('0x4e'),auth['isAuthenticated'](),controller[_0xd2fe('0x4f')]);router[_0xd2fe('0x3a')](_0xd2fe('0x50'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x51')]);router['post'](_0xd2fe('0x52'),auth['isAuthenticated'](),controller[_0xd2fe('0x53')]);router[_0xd2fe('0x3a')](_0xd2fe('0x54'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x55')]);router[_0xd2fe('0x3a')](_0xd2fe('0x56'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x57')]);router[_0xd2fe('0x3a')]('/:id/fax_accounts',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x58')]);router['post'](_0xd2fe('0x59'),auth[_0xd2fe('0xd')](),controller['addMailAccounts']);router[_0xd2fe('0x3a')]('/:id/openchannel_accounts',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x5a')]);router[_0xd2fe('0x3a')]('/:id/sms_accounts',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x5b')]);router[_0xd2fe('0x3a')]('/:id/chat_websites',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x5c')]);router[_0xd2fe('0x3a')](_0xd2fe('0x35'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x5d')]);router[_0xd2fe('0x3a')](_0xd2fe('0x38'),auth['isAuthenticated'](),controller[_0xd2fe('0x5e')]);router[_0xd2fe('0x5f')](_0xd2fe('0x12'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x60')]);router['put'](_0xd2fe('0x61'),auth['isAuthenticated'](),controller[_0xd2fe('0x62')]);router['delete']('/:id/queues',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x63')]);router[_0xd2fe('0x64')](_0xd2fe('0x28'),auth[_0xd2fe('0xd')](),controller['removeTeams']);router[_0xd2fe('0x64')](_0xd2fe('0x12'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x65')]);router[_0xd2fe('0x64')](_0xd2fe('0x4c'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x66')]);router[_0xd2fe('0x64')](_0xd2fe('0x4e'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x67')]);router[_0xd2fe('0x64')](_0xd2fe('0x50'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x68')]);router[_0xd2fe('0x64')](_0xd2fe('0x52'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x69')]);router[_0xd2fe('0x64')](_0xd2fe('0x54'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x6a')]);router['delete'](_0xd2fe('0x56'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x6b')]);router['delete'](_0xd2fe('0x2d'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x6c')]);router[_0xd2fe('0x64')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xd2fe('0x6d')]);router['delete'](_0xd2fe('0x30'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x6e')]);router[_0xd2fe('0x64')](_0xd2fe('0x32'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x6f')]);router[_0xd2fe('0x64')]('/:id/chat_websites',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x70')]);router[_0xd2fe('0x64')]('/:id/whatsapp_accounts',auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x71')]);router[_0xd2fe('0x64')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xd2fe('0x72')]);router[_0xd2fe('0x3a')](_0xd2fe('0x73'),auth[_0xd2fe('0xd')](),controller[_0xd2fe('0x74')]);module[_0xd2fe('0x75')]=router; \ No newline at end of file +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 diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c8bfa22..822e6f4 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 _0xe71a=['join','split','info','shortinfo','inband','rfc2833','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','refuse','originate','uas','certificate','passive','update,nonat','TEXT','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','exports','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','peer','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xe71a,0xec));var _0xae71=function(_0x2933fe,_0x3f3c14){_0x2933fe=_0x2933fe-0x0;var _0xdc847e=_0xe71a[_0x2933fe];return _0xdc847e;};'use strict';var Sequelize=require(_0xae71('0x0'));var moment=require(_0xae71('0x1'));var util=require(_0xae71('0x2'));var _=require('lodash');module[_0xae71('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x194038){this[_0xae71('0x4')](_0xae71('0x5'),_0x194038);this[_0xae71('0x4')](_0xae71('0x6'),_0x194038);},'comment':_0xae71('0x7')},'fullname':{'type':Sequelize[_0xae71('0x8')],'allowNull':![],'set':function(_0x4c07e7){this[_0xae71('0x4')](_0xae71('0x9'),_0x4c07e7);this[_0xae71('0x4')](_0xae71('0xa'),util[_0xae71('0xb')](_0xae71('0xc'),_0x4c07e7,this[_0xae71('0xd')](_0xae71('0xe'))));}},'alias':{'type':Sequelize[_0xae71('0x8')]},'email':{'type':Sequelize[_0xae71('0x8')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x519aba){if(_0x519aba){this[_0xae71('0x4')](_0xae71('0xf'),_0x519aba[_0xae71('0x10')]());}}},'role':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x12'),_0xae71('0x13'),_0xae71('0x14'),_0xae71('0x15')),'allowNull':![]},'password':{'type':Sequelize[_0xae71('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xae71('0x16')},'internal':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':![],'unique':'internal','set':function(_0x5cd7df){this[_0xae71('0x4')](_0xae71('0xe'),_0x5cd7df);this[_0xae71('0x4')](_0xae71('0x18'),_0x5cd7df);this['setDataValue'](_0xae71('0xa'),util[_0xae71('0xb')](_0xae71('0xc'),this[_0xae71('0xd')](_0xae71('0x9')),_0x5cd7df));}},'salt':{'type':Sequelize[_0xae71('0x8')]},'phone':{'type':Sequelize[_0xae71('0x8')]},'mobile':{'type':Sequelize[_0xae71('0x8')]},'address':{'type':Sequelize[_0xae71('0x8')]},'zipcode':{'type':Sequelize[_0xae71('0x8')]},'userpic':{'type':Sequelize[_0xae71('0x8')]},'city':{'type':Sequelize[_0xae71('0x8')]},'country':{'type':Sequelize[_0xae71('0x8')]},'online':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xae71('0x1a')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xae71('0x8')],'defaultValue':_0xae71('0x1b')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xae71('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xae71('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![],'defaultValue':_0xae71('0x1c')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xae71('0x11')]('friend',_0xae71('0x13'),_0xae71('0x1d')),'allowNull':!![],'defaultValue':_0xae71('0x1e')},'context':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![],'defaultValue':_0xae71('0x1f')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xae71('0x20'),_0xae71('0x21'),_0xae71('0x22'),'PROHIB_NOT_SCREENED',_0xae71('0x23'),_0xae71('0x24'),_0xae71('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![],'defaultValue':_0xae71('0x26'),'set':function(_0x25fd90){this[_0xae71('0x4')](_0xae71('0x27'),_0x25fd90?_0x25fd90[_0xae71('0x28')](','):null);},'get':function(){return this[_0xae71('0xd')](_0xae71('0x27'))?this[_0xae71('0xd')]('transport')[_0xae71('0x29')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xae71('0x2a'),_0xae71('0x2b'),_0xae71('0x2c'),'auto'),'allowNull':!![],'defaultValue':_0xae71('0x2d')},'directmedia':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no',_0xae71('0x2f'),_0xae71('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xae71('0x31'),'set':function(_0xb10caf){this[_0xae71('0x4')](_0xae71('0x32'),_0xb10caf?_0xb10caf[_0xae71('0x28')](','):null);},'get':function(){return this['getDataValue'](_0xae71('0x32'))?this[_0xae71('0xd')]('nat')[_0xae71('0x29')](','):null;},'comment':_0xae71('0x33')},'callgroup':{'type':Sequelize[_0xae71('0x8')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xae71('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xae71('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xae71('0x8')]},'disallow':{'type':Sequelize[_0xae71('0x8')],'allowNull':![],'defaultValue':_0xae71('0x34')},'allow':{'type':Sequelize[_0xae71('0x8')],'allowNull':![],'defaultValue':_0xae71('0x35'),'set':function(_0x20ad06){this[_0xae71('0x4')](_0xae71('0x36'),_0x20ad06?_0x20ad06[_0xae71('0x28')](';'):_0xae71('0x35'));},'get':function(){return this[_0xae71('0xd')](_0xae71('0x36'))?this[_0xae71('0xd')](_0xae71('0x36'))[_0xae71('0x29')](';'):null;},'comment':_0xae71('0x37')},'autoframing':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![],'set':function(_0x4979dc){this[_0xae71('0x4')]('insecure',_0x4979dc?_0x4979dc[_0xae71('0x28')](','):null);},'get':function(){return this[_0xae71('0xd')](_0xae71('0x38'))?this[_0xae71('0xd')](_0xae71('0x38'))[_0xae71('0x29')](','):null;},'comment':_0xae71('0x39')},'trustrpid':{'type':Sequelize['ENUM'](_0xae71('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xae71('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no',_0xae71('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xae71('0x11')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xae71('0x2e')},'busylevel':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xae71('0x11')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xae71('0x3b'),_0xae71('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xae71('0x11')]('uac',_0xae71('0x3d')),'allowNull':!![],'defaultValue':_0xae71('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xae71('0x2e'),'no','fingerprint',_0xae71('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xae71('0x11')]('active',_0xae71('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xae71('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xae71('0x11')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no',_0xae71('0x2f'),_0xae71('0x30'),_0xae71('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xae71('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xae71('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xae71('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xae71('0x41')]},'showWebBar':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0,'set':function(_0x2d9bd5){this[_0xae71('0x4')]('showWebBar',_0x2d9bd5);var _0x3113c6=this['get']({'plain':!![]});switch(_0x2d9bd5){case 0x0:case 0x1:var _0x4db4b5=_0x3113c6[_0xae71('0x27')]?_[_0xae71('0x42')](_0x3113c6['transport'])?_0x3113c6['transport']['join']():_0x3113c6[_0xae71('0x27')]:_0xae71('0x26');if(_0x4db4b5==='wss'){_0x4db4b5='udp';}this[_0xae71('0x4')](_0xae71('0x27'),_0x4db4b5);this['setDataValue'](_0xae71('0x43'),'no');this[_0xae71('0x4')](_0xae71('0x44'),null);this[_0xae71('0x4')](_0xae71('0x45'),null);this[_0xae71('0x4')](_0xae71('0x46'),null);this[_0xae71('0x4')](_0xae71('0x47'),null);this[_0xae71('0x4')](_0xae71('0x48'),null);this[_0xae71('0x4')](_0xae71('0x49'),null);this['setDataValue'](_0xae71('0x4a'),null);this['setDataValue'](_0xae71('0x4b'),null);this[_0xae71('0x4')](_0xae71('0x4c'),'no');break;case 0x2:this[_0xae71('0x4')](_0xae71('0x27'),_0xae71('0x4d'));this['setDataValue'](_0xae71('0x43'),_0xae71('0x2e'));this[_0xae71('0x4')](_0xae71('0x44'),_0xae71('0x2e'));this['setDataValue'](_0xae71('0x45'),_0xae71('0x2e'));this[_0xae71('0x4')](_0xae71('0x46'),'yes');this[_0xae71('0x4')](_0xae71('0x47'),'yes');this[_0xae71('0x4')](_0xae71('0x48'),'no');this[_0xae71('0x4')](_0xae71('0x49'),_0xae71('0x4e'));this[_0xae71('0x4')](_0xae71('0x4a'),_0x3113c6['dtlscertfile']||_0xae71('0x4f'));this[_0xae71('0x4')]('dtlsprivatekey',_0x3113c6['dtlsprivatekey']||_0xae71('0x50'));this[_0xae71('0x4')](_0xae71('0x4c'),_0xae71('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xae71('0x41')],'set':function(_0x2bcc0a){this[_0xae71('0x4')](_0xae71('0x51'),_0x2bcc0a?_0x2bcc0a[_0xae71('0x28')](','):[]);},'get':function(){return this['getDataValue'](_0xae71('0x51'))?_[_0xae71('0x52')](this[_0xae71('0xd')](_0xae71('0x51'))[_0xae71('0x29')](','),function(_0x5c1775){return parseInt(_0x5c1775,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xae71('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xae71('0x8')]},'phoneBarBusyNumber':{'type':Sequelize[_0xae71('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xae71('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xae71('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xae71('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xae71('0x11')](_0xae71('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xae71('0x53')],'get':function(){return this[_0xae71('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0xae71('0xd')](_0xae71('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xae71('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x137eae){if(typeof _0x137eae==='string'){var _0x37819f=_0x137eae==='1'?!![]:_0x137eae==='0'?![]:_0x137eae===_0xae71('0x55')?!![]:_0x137eae===_0xae71('0x56')?![]:![];this[_0xae71('0x4')](_0xae71('0x57'),_0x37819f);}else{this[_0xae71('0x4')](_0xae71('0x57'),_0x137eae);}}},'blocked':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![],'set':function(_0x42292a){this['setDataValue'](_0xae71('0x58'),_0x42292a);if(_0x42292a===!![]){this[_0xae71('0x4')]('blockedAt',moment());this[_0xae71('0x4')](_0xae71('0x59'),0x0);}else{this[_0xae71('0x4')](_0xae71('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xae71('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xae71('0x19')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xae71('0x17')](0x5)[_0xae71('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xae71('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xae71('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xae71('0x19')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xae71('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xae71('0x19')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 08fc413..b106550 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 _0x9dd0=['moment','util','path','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','api','../../errors/api','APINotFoundError','handleError','../../mysqldb','./user.socket','register','redis','defaults','localhost','status','end','json','undefined','offset','count','limit','Content-Range','emit','destroy','then','get','admin','user','Agents','agent','Telephones','ignore','map','value','includes','role','find','name','UserProfileResource','sendStatus','error','stack','User','rawAttributes','fieldName','type','key','filter','password','salt','previousPasswords','resetPasswordExpires','md5secret','getOptions','query','include','userSetting','true','attributes','findAll','openTabs','rows','length','chat','push','sms','dataValues','mail','openchannel','whatsapp','all','show','params','includeAll','UserSetting','merge','fax','catch','update','describe','addContacts','body','ids','omit','Setting','securePassword','validatePasswordPattern','max','isNil','internal','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','permissions','101','102','103','113','110','104','105','106','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','autoAssociation','bulkCreate','some','telephone','UserProfileSection','isEmpty','compact','changePassword','newPassword','Sequelize','ValidationError','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','VoiceQueue','voice','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tags','color','tag','getQueues','keys','Queue','filters','intersection','fields','order','sort','where','Unknown\x20role','nolimit','getVoiceQueuesRt','model','pick','options','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','format','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','lastPauseAt','getTeams','Team','addTeams','sequelize','transaction','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','removeAgent','UserVoicePrefix','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','CmHopper','$and','$gt','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notLike','$iLike','$notILike','$like','$contains','lastName','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','inbound','flatten','toString','asc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9dd0,0x188));var _0x09dd=function(_0x38b08b,_0x114501){_0x38b08b=_0x38b08b-0x0;var _0x2bc5ef=_0x9dd0[_0x38b08b];return _0x2bc5ef;};'use strict';var moment=require(_0x09dd('0x0'));var util=require(_0x09dd('0x1'));var path=require(_0x09dd('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x09dd('0x3'));var Redis=require(_0x09dd('0x4'));var authService=require(_0x09dd('0x5'));var contacts=require(_0x09dd('0x6'));var qs=require('../../components/parsers/qs');var rta=require(_0x09dd('0x7'));var logger=require('../../config/logger')(_0x09dd('0x8'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x09dd('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0x09dd('0x9'))[_0x09dd('0xa')];var APIHandleError=require(_0x09dd('0x9'))[_0x09dd('0xb')];var db=require(_0x09dd('0xc'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x09dd('0xd'))[_0x09dd('0xe')](socket);config[_0x09dd('0xf')]=_[_0x09dd('0x10')](config[_0x09dd('0xf')],{'host':_0x09dd('0x11'),'port':0x18eb});var values;function respondWithStatusCode(_0x3ad57d,_0x40e125){_0x40e125=_0x40e125||0xcc;return function(_0x156507){if(_0x156507){return _0x3ad57d['sendStatus'](_0x40e125);}return _0x3ad57d[_0x09dd('0x12')](_0x40e125)[_0x09dd('0x13')]();};}function respondWithResult(_0x236fec,_0x140abe){_0x140abe=_0x140abe||0xc8;return function(_0x127c62){if(_0x127c62){return _0x236fec[_0x09dd('0x12')](_0x140abe)[_0x09dd('0x14')](_0x127c62);}};}function respondWithFilteredResult(_0x4a5f14,_0x455e68){return function(_0x5439b1){if(_0x5439b1){var _0x111b9f=typeof _0x455e68['offset']===_0x09dd('0x15')&&typeof _0x455e68['limit']===_0x09dd('0x15');var _0x4dbfc0=_0x5439b1['count'];var _0x57b5b1=_0x111b9f?0x0:_0x455e68[_0x09dd('0x16')];var _0x4201e3=_0x111b9f?_0x5439b1[_0x09dd('0x17')]:_0x455e68[_0x09dd('0x16')]+_0x455e68[_0x09dd('0x18')];var _0x3ccf58;if(_0x4201e3>=_0x4dbfc0){_0x4201e3=_0x4dbfc0;_0x3ccf58=0xc8;}else{_0x3ccf58=0xce;}_0x4a5f14[_0x09dd('0x12')](_0x3ccf58);return _0x4a5f14['set'](_0x09dd('0x19'),_0x57b5b1+'-'+_0x4201e3+'/'+_0x4dbfc0)['json'](_0x5439b1);}return null;};}function saveUpdates(_0x54a750){return function(_0x7990cc){if(_0x7990cc){return _0x7990cc['update'](_0x54a750)['then'](function(_0x1c0bad){if(_0x1c0bad['role']==='agent'){socket[_0x09dd('0x1a')]('userNotification:recalc:'+_0x1c0bad['id'],_0x1c0bad);}return _0x1c0bad;});}return null;};}function removeEntity(_0x4966c4){return function(_0x10ece8){if(_0x10ece8){return _0x10ece8[_0x09dd('0x1b')]()[_0x09dd('0x1c')](function(){var _0x4d93a0=_0x10ece8[_0x09dd('0x1d')]({'plain':!![]});if(_0x4d93a0['role']===_0x09dd('0x1e'))return;var _0x46e2ad=[{'name':'Users','value':_0x09dd('0x1f'),'ignore':!![]},{'name':_0x09dd('0x20'),'value':_0x09dd('0x21'),'ignore':![]},{'name':_0x09dd('0x22'),'value':'telephone','ignore':![]}];var _0x48d2a5=_(_0x46e2ad)['filter'](_0x09dd('0x23'))[_0x09dd('0x24')](_0x09dd('0x25'))[_0x09dd('0x25')]();if(_[_0x09dd('0x26')](_0x48d2a5,_0x4d93a0[_0x09dd('0x27')])){return;}var _0x2b7ccc=_[_0x09dd('0x28')](_0x46e2ad,[_0x09dd('0x25'),_0x4d93a0['role']])[_0x09dd('0x29')];return db[_0x09dd('0x2a')][_0x09dd('0x1b')]({'where':{'type':_0x2b7ccc,'resourceId':_0x4d93a0['id']}})[_0x09dd('0x1c')](function(){return _0x10ece8;});})['then'](function(){_0x4966c4[_0x09dd('0x12')](0xcc)[_0x09dd('0x13')]();});}};}function handleEntityNotFound(_0x4e7b8b){return function(_0x235f4f){if(!_0x235f4f){_0x4e7b8b[_0x09dd('0x2b')](0x194);}return _0x235f4f;};}function handleError(_0x55d919,_0x4f6921){_0x4f6921=_0x4f6921||0x1f4;return function(_0x574350){logger[_0x09dd('0x2c')](_0x574350[_0x09dd('0x2d')]);if(_0x574350['name']){delete _0x574350[_0x09dd('0x29')];}_0x55d919[_0x09dd('0x12')](_0x4f6921)['send'](_0x574350);};}function getUserAttributes(){return _(db[_0x09dd('0x2e')][_0x09dd('0x2f')])[_0x09dd('0x24')](function(_0x85f394){return{'name':_0x85f394[_0x09dd('0x30')],'type':_0x85f394[_0x09dd('0x31')][_0x09dd('0x32')]};})[_0x09dd('0x33')](function(_0x469842){return![_0x09dd('0x34'),_0x09dd('0x35'),_0x09dd('0x36'),'resetPasswordToken',_0x09dd('0x37'),_0x09dd('0x38')]['includes'](_0x469842[_0x09dd('0x29')]);})[_0x09dd('0x25')]();}exports['index']=function(_0x483d99,_0x143c95){var _0x1f36dc={},_0x4a8151={'count':0x0,'rows':[]};var _0x3c9567=getUserAttributes();_0x1f36dc=qs[_0x09dd('0x39')](_0x3c9567,_0x483d99);var _0x30ebd5={'where':_0x1f36dc['where']};return db[_0x09dd('0x2e')][_0x09dd('0x17')](_0x30ebd5)[_0x09dd('0x1c')](function(_0x3f0e78){_0x4a8151['count']=_0x3f0e78;if(_0x483d99[_0x09dd('0x3a')]['includeAll']){_0x1f36dc[_0x09dd('0x3b')]=[{'all':!![]}];}if(_0x483d99[_0x09dd('0x3a')][_0x09dd('0x3c')]===_0x09dd('0x3d')){_0x1f36dc[_0x09dd('0x3b')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x09dd('0x26')](_0x1f36dc[_0x09dd('0x3e')],'id')){_0x1f36dc[_0x09dd('0x3e')]['push']('id');}return db[_0x09dd('0x2e')][_0x09dd('0x3f')](_0x1f36dc);})[_0x09dd('0x1c')](function(_0x8d920a){_0x4a8151['rows']=_0x8d920a;if(_0x483d99[_0x09dd('0x3a')][_0x09dd('0x40')]==='true'){var _0x3126db=[];for(var _0x2091f5=0x0;_0x2091f5<_0x4a8151[_0x09dd('0x41')][_0x09dd('0x42')];_0x2091f5++){_0x3126db['push'](get_open_tabs(_0x09dd('0x43'),_0x4a8151[_0x09dd('0x41')][_0x2091f5]['dataValues']));_0x3126db[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x45'),_0x4a8151[_0x09dd('0x41')][_0x2091f5][_0x09dd('0x46')]));_0x3126db[_0x09dd('0x44')](get_open_tabs('fax',_0x4a8151[_0x09dd('0x41')][_0x2091f5][_0x09dd('0x46')]));_0x3126db[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x47'),_0x4a8151[_0x09dd('0x41')][_0x2091f5][_0x09dd('0x46')]));_0x3126db[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x48'),_0x4a8151[_0x09dd('0x41')][_0x2091f5]['dataValues']));_0x3126db[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x49'),_0x4a8151['rows'][_0x2091f5][_0x09dd('0x46')]));}return Promise[_0x09dd('0x4a')](_0x3126db)[_0x09dd('0x1c')](function(){return _0x4a8151;});}else{return _0x4a8151;}})[_0x09dd('0x1c')](respondWithFilteredResult(_0x143c95,_0x1f36dc))['catch'](handleError(_0x143c95,null));};exports[_0x09dd('0x4b')]=function(_0x557172,_0x412a0d){var _0x4aecc1=getUserAttributes();_0x557172[_0x09dd('0x3a')]['id']=_0x557172[_0x09dd('0x4c')]['id'];var _0x2d5bef=qs[_0x09dd('0x39')](_0x4aecc1,_0x557172);if(_0x557172['query'][_0x09dd('0x4d')]){_0x2d5bef[_0x09dd('0x3b')]=[{'all':!![]}];}if(_0x557172[_0x09dd('0x3a')][_0x09dd('0x3c')]==='true'){_0x2d5bef[_0x09dd('0x3b')]=[{'model':db[_0x09dd('0x4e')],'as':_0x09dd('0x3c')}];}_0x2d5bef=_[_0x09dd('0x4f')]({},_0x2d5bef,_0x557172['options']);if(!_['includes'](_0x2d5bef['attributes'],'id')){_0x2d5bef[_0x09dd('0x3e')]['push']('id');}return db[_0x09dd('0x2e')][_0x09dd('0x28')](_0x2d5bef)[_0x09dd('0x1c')](handleEntityNotFound(_0x412a0d,null))[_0x09dd('0x1c')](function(_0x56dabb){var _0xa94f5e=[];values=_0x56dabb;if(_0x557172['query'][_0x09dd('0x40')]==='true'){_0xa94f5e[_0x09dd('0x44')](get_open_tabs('chat',_0x56dabb[_0x09dd('0x46')]));_0xa94f5e[_0x09dd('0x44')](get_open_tabs('sms',_0x56dabb[_0x09dd('0x46')]));_0xa94f5e[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x48'),_0x56dabb[_0x09dd('0x46')]));_0xa94f5e['push'](get_open_tabs(_0x09dd('0x49'),_0x56dabb['dataValues']));_0xa94f5e[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x50'),_0x56dabb['dataValues']));_0xa94f5e[_0x09dd('0x44')](get_open_tabs('mail',_0x56dabb['dataValues']));return Promise[_0x09dd('0x4a')](_0xa94f5e);}else{return values;}})[_0x09dd('0x1c')](function(){return values;})[_0x09dd('0x1c')](respondWithResult(_0x412a0d,null))[_0x09dd('0x51')](handleError(_0x412a0d,null));};exports[_0x09dd('0x52')]=function(_0xb82a7e,_0x146ab3){if(_0xb82a7e['body']['id']){delete _0xb82a7e['body']['id'];}delete _0xb82a7e['body']['role'];return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0xb82a7e[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x146ab3,null))[_0x09dd('0x1c')](saveUpdates(_0xb82a7e['body'],null))[_0x09dd('0x1c')](respondWithResult(_0x146ab3,null))['catch'](handleError(_0x146ab3,null));};exports[_0x09dd('0x53')]=function(_0xa80532,_0x52f550){return db[_0x09dd('0x2e')][_0x09dd('0x53')]()[_0x09dd('0x1c')](respondWithResult(_0x52f550,null))[_0x09dd('0x51')](handleError(_0x52f550,null));};exports[_0x09dd('0x54')]=function(_0x18136b,_0x12bbdf){return db[_0x09dd('0x2e')]['find']({'where':{'id':_0x18136b[_0x09dd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12bbdf,null))[_0x09dd('0x1c')](function(_0x49ae4e){if(_0x49ae4e){return _0x49ae4e['addContacts'](_0x18136b[_0x09dd('0x55')][_0x09dd('0x56')],_[_0x09dd('0x57')](_0x18136b[_0x09dd('0x55')],[_0x09dd('0x56'),'id'])||{});}})[_0x09dd('0x1c')](respondWithResult(_0x12bbdf,null))['catch'](handleError(_0x12bbdf,null));};function validateUser(_0x4a3a34){return new Promise(function(_0x4cc5ce,_0x480efc){if(_0x4a3a34['internal'])return _0x4cc5ce(_0x4a3a34);return db[_0x09dd('0x58')]['findById'](0x1)[_0x09dd('0x1c')](function(_0x238004){if(_0x238004[_0x09dd('0x59')])authService[_0x09dd('0x5a')](_0x4a3a34[_0x09dd('0x34')]);db[_0x09dd('0x2e')][_0x09dd('0x5b')]('internal')[_0x09dd('0x1c')](function(_0x579d4f){if(_[_0x09dd('0x5c')](_0x579d4f)){_0x4a3a34[_0x09dd('0x5d')]=_0x238004[_0x09dd('0x5e')]||0x1;return;}if(_[_0x09dd('0x5c')](_0x238004[_0x09dd('0x5e')])||_0x238004[_0x09dd('0x5e')]===_0x579d4f){_0x4a3a34[_0x09dd('0x5d')]=_0x579d4f+0x1;return;}if(_0x238004[_0x09dd('0x5e')]>_0x579d4f){_0x4a3a34[_0x09dd('0x5d')]=_0x238004[_0x09dd('0x5e')];return;}return db['sequelize'][_0x09dd('0x3a')](_0x09dd('0x5f'),{'type':db['sequelize'][_0x09dd('0x60')][_0x09dd('0x61')]})['then'](function(_0x430467){if(_0x430467&&_0x430467[_0x09dd('0x42')]){for(var _0x1ed3bf=0x0,_0x357c42=_0x430467[_0x09dd('0x42')];_0x1ed3bf<_0x357c42&&_[_0x09dd('0x5c')](_0x4a3a34[_0x09dd('0x5d')]);_0x1ed3bf++){if(_0x238004[_0x09dd('0x5e')]<=_0x430467[_0x1ed3bf][_0x09dd('0x62')]){_0x4a3a34['internal']=_0x430467[_0x1ed3bf][_0x09dd('0x62')];}else if(_0x238004['min_internal']>_0x430467[_0x1ed3bf][_0x09dd('0x62')]&&_0x238004[_0x09dd('0x5e')]<=_0x430467[_0x1ed3bf]['to']){_0x4a3a34['internal']=_0x238004[_0x09dd('0x5e')];}}}if(_['isNil'](_0x4a3a34[_0x09dd('0x5d')])){_0x4a3a34[_0x09dd('0x5d')]=_0x579d4f+0x1;}return _0x4cc5ce(_0x4a3a34);});});})[_0x09dd('0x51')](function(_0xcea0e9){_0x480efc(_0xcea0e9);});});}function updateUser(_0x1e6481){return new Promise(function(_0x277d7f,_0x3fd230){try{if(_0x1e6481[_0x09dd('0x63')]){_0x1e6481[_0x09dd('0x64')]=_0x1e6481[_0x09dd('0x5d')];_0x1e6481['VoiceMail']={'mailbox':_0x1e6481[_0x09dd('0x5d')],'password':_0x1e6481[_0x09dd('0x34')],'fullname':_0x1e6481['fullname'],'email':_0x1e6481['email']};}if(_0x1e6481[_0x09dd('0x27')]===_0x09dd('0x21')){if(!_0x1e6481[_0x09dd('0x65')])_0x1e6481[_0x09dd('0x65')]=[_0x09dd('0x66'),_0x09dd('0x67'),_0x09dd('0x68'),_0x09dd('0x69'),_0x09dd('0x6a'),_0x09dd('0x6b'),_0x09dd('0x6c'),_0x09dd('0x6d'),_0x09dd('0x6e'),_0x09dd('0x6f'),_0x09dd('0x70'),_0x09dd('0x71'),_0x09dd('0x72'),_0x09dd('0x73'),_0x09dd('0x74')];}_0x277d7f(_0x1e6481);}catch(_0x5d060b){_0x3fd230(_0x5d060b);}});}exports[_0x09dd('0x75')]=function(_0x36b0cb,_0x4911e3){if(_0x36b0cb[_0x09dd('0x1f')][_0x09dd('0x27')]===_0x09dd('0x21'))throw new Error(_0x09dd('0x76'));if(_0x36b0cb[_0x09dd('0x55')]['role']==='user'&&_0x36b0cb[_0x09dd('0x1f')][_0x09dd('0x27')]!==_0x09dd('0x1e')){throw new Error(_0x09dd('0x77'));}if(_0x36b0cb[_0x09dd('0x55')]['role']===_0x09dd('0x1e')&&_0x36b0cb[_0x09dd('0x1f')][_0x09dd('0x27')]!==_0x09dd('0x1e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x09dd('0x78')]([_0x36b0cb['body']])['then'](function(){return validateUser(_0x36b0cb['body']);})[_0x09dd('0x1c')](function(_0x1708eb){return updateUser(_0x1708eb)[_0x09dd('0x1c')](function(_0xb03d1c){if(_0xb03d1c[_0x09dd('0x27')]===_0x09dd('0x1e')){_0xb03d1c[_0x09dd('0x79')]=_0x36b0cb[_0x09dd('0x1f')][_0x09dd('0x79')];delete _0xb03d1c[_0x09dd('0x7a')];}return _0xb03d1c;});})[_0x09dd('0x1c')](function(_0x4fdb2a){return db['User'][_0x09dd('0x75')](_0x4fdb2a,{'include':[{'model':db[_0x09dd('0x7b')],'as':'VoiceMail'}]});})[_0x09dd('0x1c')](function(_0x393f9a){if(_0x36b0cb[_0x09dd('0x55')][_0x09dd('0x27')]===_0x09dd('0x1f'))return _0x393f9a;if(_0x36b0cb[_0x09dd('0x1f')][_0x09dd('0x27')]!=='user')return _0x393f9a;return db['UserProfileSection'][_0x09dd('0x28')]({'where':{'name':_0x393f9a[_0x09dd('0x27')]==='agent'?_0x09dd('0x20'):_0x09dd('0x22'),'userProfileId':_0x36b0cb[_0x09dd('0x1f')][_0x09dd('0x7a')]},'raw':!![]})[_0x09dd('0x1c')](function(_0x14a59a){if(!_0x14a59a||_0x14a59a[_0x09dd('0x7c')]!=0x0)return _0x393f9a;return db[_0x09dd('0x2a')][_0x09dd('0x75')]({'name':_0x393f9a[_0x09dd('0x29')],'resourceId':_0x393f9a['id'],'type':_0x14a59a[_0x09dd('0x29')],'sectionId':_0x14a59a['id']},{})[_0x09dd('0x1c')](function(){return _0x393f9a;});})[_0x09dd('0x51')](function(_0x286f46){logger[_0x09dd('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286f46);throw _0x286f46;});})[_0x09dd('0x1c')](respondWithResult(_0x4911e3,0xc9))[_0x09dd('0x51')](handleError(_0x4911e3,null));};exports[_0x09dd('0x7d')]=function(_0x91aedd,_0x192d5a){var _0x36fb5c=_0x91aedd[_0x09dd('0x55')];var _0x5328eb=[];if(_0x91aedd[_0x09dd('0x1f')][_0x09dd('0x27')]===_0x09dd('0x21'))throw new Error(_0x09dd('0x76'));if(_[_0x09dd('0x7e')](_0x36fb5c,[_0x09dd('0x27'),_0x09dd('0x1f')])&&_0x91aedd[_0x09dd('0x1f')]['role']!=='admin'){throw new Error(_0x09dd('0x77'));}if(_[_0x09dd('0x7e')](_0x36fb5c,['role',_0x09dd('0x1e')])&&_0x91aedd['user'][_0x09dd('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x09dd('0x78')](_0x36fb5c)[_0x09dd('0x1c')](function(){return validateUser(_0x36fb5c[0x0]);})[_0x09dd('0x1c')](function(){for(var _0x7eea51=0x1;_0x7eea51<_0x36fb5c[_0x09dd('0x42')];_0x7eea51++){var _0x180f53=_0x36fb5c[_0x7eea51-0x1][_0x09dd('0x5d')];if(!_0x36fb5c[_0x7eea51][_0x09dd('0x5d')])_0x36fb5c[_0x7eea51][_0x09dd('0x5d')]=_0x180f53+0x1;_0x5328eb[_0x09dd('0x44')](validateUser(_0x36fb5c[_0x7eea51]));}return Promise[_0x09dd('0x4a')](_0x5328eb);})[_0x09dd('0x1c')](function(){_0x5328eb=[];for(var _0x3b31e1=0x0;_0x3b31e1<_0x36fb5c[_0x09dd('0x42')];_0x3b31e1++){_0x5328eb[_0x09dd('0x44')](updateUser(_0x36fb5c[_0x3b31e1]));}return Promise[_0x09dd('0x4a')](_0x5328eb);})[_0x09dd('0x1c')](function(){_0x5328eb=_0x36fb5c['map'](function(_0x3a5767){return db[_0x09dd('0x2e')][_0x09dd('0x75')](_0x3a5767,{'include':[{'model':db[_0x09dd('0x7b')],'as':_0x09dd('0x7b')}]})['then'](function(_0x16adc0){_0x3a5767['id']=_0x16adc0['id'];return _0x3a5767;});});return Promise['all'](_0x5328eb);})[_0x09dd('0x1c')](function(_0x3430f4){if(_0x91aedd['body']['role']==='user')return _0x3430f4;if(_0x91aedd[_0x09dd('0x1f')][_0x09dd('0x27')]!==_0x09dd('0x1f'))return _0x3430f4;var _0x38e2ff=_[_0x09dd('0x7e')](_0x3430f4,function(_0x4cb24c){return _0x4cb24c[_0x09dd('0x27')]==='agent'||_0x4cb24c[_0x09dd('0x27')]===_0x09dd('0x7f');});if(!_0x38e2ff)return _0x3430f4;return db[_0x09dd('0x80')][_0x09dd('0x3f')]({'where':{'name':{'$or':[_0x09dd('0x20'),_0x09dd('0x22')]},'userProfileId':_0x91aedd[_0x09dd('0x1f')][_0x09dd('0x7a')]},'raw':!![]})[_0x09dd('0x1c')](function(_0x3c8a71){if(_[_0x09dd('0x81')](_0x3c8a71)||!_[_0x09dd('0x7e')](_0x3c8a71,[_0x09dd('0x7c'),0x0]))return _0x3430f4;_0x5328eb=[];var _0x322739=_(_0x3c8a71)[_0x09dd('0x24')](function(_0x2db742){if(_0x2db742['autoAssociation']===0x1)return;return _0x2db742[_0x09dd('0x29')]==='Agents'?_0x09dd('0x21'):_0x09dd('0x7f');})[_0x09dd('0x82')]()[_0x09dd('0x25')]();for(var _0x26965d=0x0;_0x26965d<_0x3430f4['length'];_0x26965d++){if(!_[_0x09dd('0x26')](_0x322739,_0x3430f4[_0x26965d][_0x09dd('0x27')]))return;var _0x2d7427=_0x3430f4[_0x26965d][_0x09dd('0x27')]==='agent'?_0x09dd('0x20'):_0x09dd('0x22');_0x5328eb[_0x09dd('0x44')](db[_0x09dd('0x2a')][_0x09dd('0x75')]({'name':_0x3430f4[_0x26965d][_0x09dd('0x29')],'resourceId':_0x3430f4[_0x26965d]['id'],'type':_0x2d7427,'sectionId':_[_0x09dd('0x28')](_0x3c8a71,['name',_0x2d7427])['id']},{}));}return Promise[_0x09dd('0x4a')](_0x5328eb);});})[_0x09dd('0x1c')](respondWithResult(_0x192d5a,0xc9))[_0x09dd('0x51')](handleError(_0x192d5a,null));};exports[_0x09dd('0x83')]=function(_0xf5b3a5,_0x3eaf82){if(_0xf5b3a5[_0x09dd('0x55')]['id']){delete _0xf5b3a5[_0x09dd('0x55')]['id'];}return db['User'][_0x09dd('0x28')]({'where':{'id':_0xf5b3a5[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](function(_0x4e7ea2){if(!_0x4e7ea2)return null;if(_0x4e7ea2['id']===_0xf5b3a5[_0x09dd('0x1f')]['id']){if(!_0xf5b3a5[_0x09dd('0x55')]['oldPassword']||!_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x84')]){throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4e7ea2[_0x09dd('0x87')](_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x88')])){throw new db[(_0x09dd('0x85'))]['ValidationError'](_0x09dd('0x89'));}if(_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x88')]===_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x84')]){throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))](_0x09dd('0x8a'));}}else if(_0xf5b3a5['user']['role']===_0x09dd('0x1e')){if(!_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x84')]){throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xf5b3a5[_0x09dd('0x1f')][_0x09dd('0x27')]==='user'){if(!_0xf5b3a5[_0x09dd('0x55')]['newPassword']){throw new db['Sequelize'][(_0x09dd('0x86'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4e7ea2['role']!==_0x09dd('0x21')){throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))](_0x09dd('0x76'));}}else{throw new db['Sequelize'][(_0x09dd('0x86'))]('Unauthorized');}return _0x4e7ea2;})[_0x09dd('0x1c')](handleEntityNotFound(_0x3eaf82,null))['then'](function(_0x3b539f){return db[_0x09dd('0x58')]['findOne']({'attributes':['id','securePassword',_0x09dd('0x8b'),_0x09dd('0x8c')]})[_0x09dd('0x1c')](function(_0x5ad433){if(_0x5ad433[_0x09dd('0x59')])authService[_0x09dd('0x5a')](_0xf5b3a5[_0x09dd('0x55')]['newPassword']);if(!_0x5ad433[_0x09dd('0x8b')]||!_0x3b539f[_0x09dd('0x36')])return _0x3b539f;authService[_0x09dd('0x8d')](_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x84')],_0x3b539f[_0x09dd('0x36')],_0x5ad433['passwordHistoryLimit']);return _0x3b539f;})['then'](saveUpdates({'password':_0xf5b3a5[_0x09dd('0x55')]['newPassword'],'passwordResetAt':_0xf5b3a5[_0x09dd('0x1f')]['id']==_0xf5b3a5[_0x09dd('0x4c')]['id']?moment():null,'previousPasswords':authService[_0x09dd('0x8e')](_0xf5b3a5[_0x09dd('0x55')][_0x09dd('0x84')],_0x3b539f[_0x09dd('0x36')])},null));})[_0x09dd('0x1c')](respondWithResult(_0x3eaf82,null))['catch'](handleError(_0x3eaf82,null));};exports[_0x09dd('0x8f')]=function(_0x147960,_0x2d1e6f){var _0x39346b=_0x147960[_0x09dd('0x55')][_0x09dd('0x90')];return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0x147960[_0x09dd('0x4c')]['id']},'attributes':['id','name',_0x09dd('0x27'),_0x09dd('0x91'),_0x09dd('0x92'),_0x09dd('0x93'),_0x09dd('0x94')]})[_0x09dd('0x1c')](handleEntityNotFound(_0x2d1e6f,null))[_0x09dd('0x1c')](function(_0x1be239){if(_0x1be239){if(!utils[_0x09dd('0x95')](_0x39346b)){throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))]('Unknown\x20channel');}return _0x1be239[_0x09dd('0x96')+_[_0x09dd('0x97')](_0x39346b[_0x09dd('0x98')]())+_0x09dd('0x99')](_0x147960[_0x09dd('0x55')]['ids'],{'penalty':_0x147960[_0x09dd('0x55')][_0x09dd('0x9a')]||0x0})['spread'](function(_0x275842){for(var _0x2eb6b0=0x0;_0x2eb6b0<_0x147960[_0x09dd('0x55')][_0x09dd('0x56')][_0x09dd('0x42')];_0x2eb6b0+=0x1){var _0x38406f={'UserId':Number(_0x147960[_0x09dd('0x4c')]['id'])};_0x38406f[_[_0x09dd('0x97')](_0x39346b[_0x09dd('0x98')]())+_0x09dd('0x9b')]=Number(_0x147960['body'][_0x09dd('0x56')][_0x2eb6b0]);socket[_0x09dd('0x1a')]('user'+_[_0x09dd('0x97')](_0x39346b[_0x09dd('0x98')]())+_0x09dd('0x9c'),_0x38406f);}return _0x275842;})[_0x09dd('0x1c')](function(){if(_0x39346b==='voice'){return db[_0x09dd('0x9d')][_0x09dd('0x3f')]({'where':{'id':_0x147960['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x3937bf){var _0x10331e=_0x1be239[_0x09dd('0x1d')]({'plain':!![]});var _0x3b14b1=[];if(_0x39346b===_0x09dd('0x9e')&&_0x10331e[_0x09dd('0x27')]==='agent'&&_0x10331e[_0x09dd('0x91')]){for(let _0x9fb804=0x0;_0x9fb804<_0x3937bf[_0x09dd('0x42')];_0x9fb804+=0x1){_0x3b14b1['push']({'membername':_0x10331e['name'],'UserId':_0x10331e['id'],'queue_name':_0x3937bf[_0x9fb804][_0x09dd('0x29')],'VoiceQueueId':_0x3937bf[_0x9fb804]['id'],'interface':_[_0x09dd('0x5c')](_0x10331e[_0x09dd('0x94')])?util['format'](_0x09dd('0x9f'),_0x10331e[_0x09dd('0x29')]):_0x10331e[_0x09dd('0x94')],'paused':_0x10331e[_0x09dd('0x93')]||![],'penalty':_0x147960[_0x09dd('0x55')][_0x09dd('0x9a')]||0x0});}return Promise['all'](_0x3b14b1[_0x09dd('0x24')](function(_0x4123dd){return db[_0x09dd('0xa0')][_0x09dd('0xa1')](_0x4123dd);}));}return _0x1be239;});}})[_0x09dd('0x1c')](respondWithStatusCode(_0x2d1e6f,null))[_0x09dd('0x51')](handleError(_0x2d1e6f,null));};exports[_0x09dd('0xa2')]=function(_0x3f47c0,_0x134a7f){var _0x49a65f,_0x4f337b;return db[_0x09dd('0x2e')]['find']({'where':{'id':_0x3f47c0[_0x09dd('0x4c')]['id']},'attributes':['id',_0x09dd('0x29'),_0x09dd('0x27')]})['then'](handleEntityNotFound(_0x134a7f,null))[_0x09dd('0x1c')](function(_0x28d0be){if(_0x28d0be){_0x49a65f=_0x28d0be;if(!_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x90')]||!utils['isValidChannel'](_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x90')])){throw new db[(_0x09dd('0x85'))]['ValidationError'](_0x09dd('0xa3'));}return _0x28d0be[_0x09dd('0xa4')+_[_0x09dd('0x97')](_0x3f47c0['query'][_0x09dd('0x90')][_0x09dd('0x98')]())+_0x09dd('0x99')](_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x56')]);}})[_0x09dd('0x1c')](function(_0x38fc8f){if(_[_0x09dd('0xa5')](_0x3f47c0['query'][_0x09dd('0x56')])){for(var _0x258477=0x0;_0x258477<_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x56')][_0x09dd('0x42')];_0x258477+=0x1){_0x4f337b={'UserId':Number(_0x3f47c0[_0x09dd('0x4c')]['id'])};_0x4f337b[_[_0x09dd('0x97')](_0x3f47c0[_0x09dd('0x3a')]['channel']['toLowerCase']())+'QueueId']=Number(_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x56')][_0x258477]);socket[_0x09dd('0x1a')](_0x09dd('0x1f')+_[_0x09dd('0x97')](_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x90')][_0x09dd('0x98')]())+_0x09dd('0xa6'),_0x4f337b);}}else{_0x4f337b={'UserId':Number(_0x3f47c0[_0x09dd('0x4c')]['id'])};_0x4f337b[_[_0x09dd('0x97')](_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x90')][_0x09dd('0x98')]())+'QueueId']=Number(_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x56')]);socket['emit'](_0x09dd('0x1f')+_['capitalize'](_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x90')]['toLowerCase']())+_0x09dd('0xa6'),_0x4f337b);}return _0x38fc8f;})[_0x09dd('0x1c')](function(){if(_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x90')]===_0x09dd('0x9e')){return db[_0x09dd('0xa0')][_0x09dd('0x1b')]({'where':{'UserId':_0x3f47c0[_0x09dd('0x4c')]['id'],'VoiceQueueId':_0x3f47c0[_0x09dd('0x3a')][_0x09dd('0x56')]},'individualHooks':!![]})[_0x09dd('0x1c')](function(){return _0x49a65f;});}return _0x49a65f;})['then'](respondWithStatusCode(_0x134a7f,null))[_0x09dd('0x51')](handleError(_0x134a7f,null));};exports[_0x09dd('0xa7')]=function(_0x5538fd,_0x202ce5){_0x5538fd[_0x09dd('0x55')][_0x09dd('0xa8')]=_0x5538fd[_0x09dd('0xa9')][_0x09dd('0xaa')];return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0x5538fd[_0x09dd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x202ce5,null))[_0x09dd('0x1c')](saveUpdates(_0x5538fd[_0x09dd('0x55')],null))[_0x09dd('0x1c')](respondWithResult(_0x202ce5,null))[_0x09dd('0x51')](handleError(_0x202ce5,null));};exports[_0x09dd('0xab')]=function(_0x6b48e5,_0x33d114){var _0x546f97=path[_0x09dd('0xac')](config[_0x09dd('0xad')],_0x09dd('0xae'));return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0x6b48e5[_0x09dd('0x4c')]['id']},'attributes':['id',_0x09dd('0xa8')],'raw':!![]})[_0x09dd('0x1c')](handleEntityNotFound(_0x33d114,null))['then'](function(_0x5c6c72){if(_0x5c6c72){if(_[_0x09dd('0x5c')](_0x5c6c72[_0x09dd('0xa8')])){return _0x33d114[_0x09dd('0xaf')](_0x546f97);}else{if(!fs[_0x09dd('0xb0')](path[_0x09dd('0xac')](config[_0x09dd('0xad')],_0x09dd('0xb1'),_0x5c6c72['userpic']))){return _0x33d114['download'](_0x546f97);}return _0x33d114[_0x09dd('0xaf')](path[_0x09dd('0xac')](config['root'],_0x09dd('0xb1'),_0x5c6c72[_0x09dd('0xa8')]));}}})[_0x09dd('0x51')](handleError(_0x33d114,null));};exports[_0x09dd('0xb2')]=function(_0x5766e0,_0x4cd039){return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0x5766e0['params']['id']},'attributes':['id']})[_0x09dd('0x1c')](handleEntityNotFound(_0x4cd039,null))[_0x09dd('0x1c')](function(_0x57fcee){var _0x2736ba=[];values=_0x57fcee['dataValues'];_0x2736ba[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x43'),_0x57fcee[_0x09dd('0x46')]));_0x2736ba[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x45'),_0x57fcee[_0x09dd('0x46')]));_0x2736ba['push'](get_open_tabs(_0x09dd('0x48'),_0x57fcee[_0x09dd('0x46')]));_0x2736ba[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x49'),_0x57fcee['dataValues']));_0x2736ba[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x50'),_0x57fcee[_0x09dd('0x46')]));_0x2736ba[_0x09dd('0x44')](get_open_tabs(_0x09dd('0x47'),_0x57fcee[_0x09dd('0x46')]));return Promise[_0x09dd('0x4a')](_0x2736ba);})[_0x09dd('0x1c')](function(_0x340a48){if(_0x340a48){var _0x5ca995=_[_0x09dd('0x24')](values[_0x09dd('0xb3')],function(_0x28199c){return{'channel':_0x09dd('0xb4'),'id':_0x28199c['id'],'createdAt':_0x28199c[_0x09dd('0xb5')]};});var _0x4f8fe4=_[_0x09dd('0x24')](values['FaxOpenTabs'],function(_0x523aff){return{'channel':'FAX','id':_0x523aff['id'],'createdAt':_0x523aff[_0x09dd('0xb5')]};});var _0x46128c=_[_0x09dd('0x24')](values['OpenchannelOpenTabs'],function(_0x1878d3){return{'channel':_0x09dd('0xb6'),'id':_0x1878d3['id'],'createdAt':_0x1878d3['createdAt']};});var _0x264890=_[_0x09dd('0x24')](values[_0x09dd('0xb7')],function(_0x3b4f33){return{'channel':_0x09dd('0xb8'),'id':_0x3b4f33['id'],'createdAt':_0x3b4f33['createdAt']};});var _0x4f0a25=_['map'](values['SmsOpenTabs'],function(_0xabd8ed){return{'channel':_0x09dd('0xb9'),'id':_0xabd8ed['id'],'createdAt':_0xabd8ed[_0x09dd('0xb5')]};});var _0x2447f4=_['map'](values[_0x09dd('0xba')],function(_0x558d08){return{'channel':_0x09dd('0xbb'),'id':_0x558d08['id'],'createdAt':_0x558d08[_0x09dd('0xb5')]};});var _0x22eda8=_[_0x09dd('0xbc')](_0x5ca995,_0x4f8fe4,_0x46128c,_0x264890,_0x4f0a25,_0x2447f4);var _0x5d57b3={'count':_0x22eda8[_0x09dd('0x42')],'rows':_0x22eda8};return _0x5d57b3;}else return null;})[_0x09dd('0x1c')](respondWithResult(_0x4cd039,null))[_0x09dd('0x51')](handleError(_0x4cd039,null));};exports[_0x09dd('0xbd')]=function(_0x258b41,_0x5a0117){var _0xe37927={};return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x258b41[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](function(_0x2e20ee){if(!_0x2e20ee){throw new APINotFoundError(util['format'](_0x09dd('0xbf'),_0x258b41[_0x09dd('0x4c')]['id']));}return contacts['describe']();})['then'](function(_0x4128c3){_0x258b41[_0x09dd('0x3a')][_0x09dd('0x2e')]=_0x258b41['params']['id'];_0xe37927=qs[_0x09dd('0x39')](_0x4128c3,_0x258b41);if(_0x258b41[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0x4d'))){_0xe37927['include']=[{'model':db[_0x09dd('0xc1')],'as':_0x09dd('0xc2'),'required':![]},{'model':db['Tag'],'as':_0x09dd('0xc3'),'attributes':['id',_0x09dd('0x29'),_0x09dd('0xc4')],'where':_0x258b41['query'][_0x09dd('0xc5')]?{'id':_0x258b41[_0x09dd('0x3a')][_0x09dd('0xc5')]}:undefined,'required':_0x258b41[_0x09dd('0x3a')]['tag']?!![]:![]}];}return contacts[_0x09dd('0x3f')](_0x258b41[_0x09dd('0x3a')],_0x258b41[_0x09dd('0x1f')],_0xe37927,_0x4128c3);})['then'](respondWithFilteredResult(_0x5a0117,_0xe37927))[_0x09dd('0x51')](APIHandleError(_0x5a0117));};exports[_0x09dd('0xc6')]=function(_0x5bb14e,_0xb306da){var _0x5bff4f;var _0x14907d={};var _0x4d7e9b;return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x5bb14e['params']['id']},'attributes':['id',_0x09dd('0x29'),_0x09dd('0x27')]})[_0x09dd('0x1c')](handleEntityNotFound(_0xb306da,null))[_0x09dd('0x1c')](function(_0x25a69c){if(!utils[_0x09dd('0x95')](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0x90')])){throw new db[(_0x09dd('0x85'))]['ValidationError']('Unknown\x20channel');}_0x5bff4f=_0x25a69c;var _0x85795c={};_0x85795c['model']=_[_0x09dd('0xc7')](db[_[_0x09dd('0x97')](_0x5bb14e['query'][_0x09dd('0x90')])+_0x09dd('0xc8')]['rawAttributes']);_0x85795c['query']=_[_0x09dd('0xc7')](_0x5bb14e['query']);_0x85795c[_0x09dd('0xc9')]=_[_0x09dd('0xca')](_0x85795c['model'],_0x85795c[_0x09dd('0x3a')]);_0x14907d[_0x09dd('0x3e')]=_[_0x09dd('0xca')](_0x85795c['model'],qs[_0x09dd('0xcb')](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x14907d[_0x09dd('0x3e')]=_0x14907d['attributes'][_0x09dd('0x42')]?_0x14907d[_0x09dd('0x3e')]:_0x85795c['model'];_0x14907d[_0x09dd('0xcc')]=qs['sort'](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x14907d[_0x09dd('0xce')]=qs['filters'](_['pick'](_0x5bb14e['query'],_0x85795c[_0x09dd('0xc9')]));if(_0x5bb14e['query'][_0x09dd('0x33')]){_0x14907d[_0x09dd('0xce')]=_['merge'](_0x14907d[_0x09dd('0xce')],{'$or':_[_0x09dd('0x24')](_0x14907d[_0x09dd('0x3e')],function(_0x3285d9){var _0x1522ff={};_0x1522ff[_0x3285d9]={'$like':'%'+_0x5bb14e['query'][_0x09dd('0x33')]+'%'};return _0x1522ff;})});}_0x14907d=_[_0x09dd('0x4f')]({},_0x14907d,_0x5bb14e['options']);switch(_0x5bff4f[_0x09dd('0x27')]){case'admin':return db[_['capitalize'](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0x90')])+_0x09dd('0xc8')]['findAll'](_0x14907d);case'user':case _0x09dd('0x21'):return _0x5bff4f['get'+_['capitalize'](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0x90')])+_0x09dd('0x99')](_0x14907d);default:throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))](_0x09dd('0xcf'));}})[_0x09dd('0x1c')](function(_0x43bfd8){_0x4d7e9b=_0x43bfd8[_0x09dd('0x42')];if(!_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x14907d['limit']=qs[_0x09dd('0x18')](_0x5bb14e['query'][_0x09dd('0x18')]);_0x14907d[_0x09dd('0x16')]=qs['offset'](_0x5bb14e[_0x09dd('0x3a')]['offset']);}switch(_0x5bff4f[_0x09dd('0x27')]){case _0x09dd('0x1e'):return db[_[_0x09dd('0x97')](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0x90')])+_0x09dd('0xc8')][_0x09dd('0x3f')](_0x14907d);case _0x09dd('0x1f'):case'agent':return _0x5bff4f[_0x09dd('0x1d')+_['capitalize'](_0x5bb14e[_0x09dd('0x3a')][_0x09dd('0x90')])+_0x09dd('0x99')](_0x14907d);}})[_0x09dd('0x1c')](function(_0x3b5ea1){return{'count':_0x4d7e9b,'rows':_0x3b5ea1};})[_0x09dd('0x1c')](respondWithResult(_0xb306da,null))[_0x09dd('0x51')](handleError(_0xb306da,null));};exports[_0x09dd('0xd1')]=function(_0x564f8d,_0x238417){var _0x2b12c2={};var _0x41415b={};var _0xf45fb9;var _0xc561d6;return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x564f8d[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x238417,null))['then'](function(_0x4e6218){if(_0x4e6218){_0xf45fb9=_0x4e6218;_0x41415b['model']=_[_0x09dd('0xc7')](db[_0x09dd('0xa0')][_0x09dd('0x2f')]);_0x41415b[_0x09dd('0x3a')]=_['keys'](_0x564f8d['query']);_0x41415b[_0x09dd('0xc9')]=_['intersection'](_0x41415b[_0x09dd('0xd2')],_0x41415b['query']);_0x2b12c2[_0x09dd('0x3e')]=_['intersection'](_0x41415b['model'],qs['fields'](_0x564f8d[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x2b12c2[_0x09dd('0x3e')]=_0x2b12c2[_0x09dd('0x3e')][_0x09dd('0x42')]?_0x2b12c2[_0x09dd('0x3e')]:_0x41415b['model'];_0x2b12c2[_0x09dd('0xcc')]=qs['sort'](_0x564f8d['query']['sort']);_0x2b12c2[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x564f8d[_0x09dd('0x3a')],_0x41415b[_0x09dd('0xc9')]));if(_0x564f8d['query'][_0x09dd('0x33')]){_0x2b12c2['where']=_[_0x09dd('0x4f')](_0x2b12c2['where'],{'$or':_[_0x09dd('0x24')](_0x2b12c2[_0x09dd('0x3e')],function(_0x28bd98){var _0x1d5a6d={};_0x1d5a6d[_0x28bd98]={'$like':'%'+_0x564f8d[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x1d5a6d;})});}_0x2b12c2=_[_0x09dd('0x4f')]({},_0x2b12c2,_0x564f8d[_0x09dd('0xd4')]);return _0xf45fb9[_0x09dd('0xd1')](_0x2b12c2);}})[_0x09dd('0x1c')](function(_0x5b603e){if(_0x5b603e){_0xc561d6=_0x5b603e[_0x09dd('0x42')];if(!_0x564f8d[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x2b12c2[_0x09dd('0x18')]=qs['limit'](_0x564f8d[_0x09dd('0x3a')][_0x09dd('0x18')]);_0x2b12c2[_0x09dd('0x16')]=qs['offset'](_0x564f8d['query'][_0x09dd('0x16')]);}return _0xf45fb9['getVoiceQueuesRt'](_0x2b12c2);}})[_0x09dd('0x1c')](function(_0x55e32c){if(_0x55e32c){return _0x55e32c?{'count':_0xc561d6,'rows':_0x55e32c}:null;}})['then'](respondWithResult(_0x238417,null))['catch'](handleError(_0x238417,null));};exports[_0x09dd('0xd5')]=function(_0x4d833e,_0x467df9){var _0x21d88c={};var _0x447efb={};var _0x58cd9b;var _0x497ed6;return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x4d833e[_0x09dd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x467df9,null))[_0x09dd('0x1c')](function(_0x342c49){if(_0x342c49){_0x58cd9b=_0x342c49;_0x447efb[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db['ChatGroup'][_0x09dd('0x2f')]);_0x447efb[_0x09dd('0x3a')]=_['keys'](_0x4d833e[_0x09dd('0x3a')]);_0x447efb[_0x09dd('0xc9')]=_[_0x09dd('0xca')](_0x447efb[_0x09dd('0xd2')],_0x447efb['query']);_0x21d88c['attributes']=_['intersection'](_0x447efb[_0x09dd('0xd2')],qs[_0x09dd('0xcb')](_0x4d833e[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x21d88c[_0x09dd('0x3e')]=_0x21d88c[_0x09dd('0x3e')]['length']?_0x21d88c[_0x09dd('0x3e')]:_0x447efb['model'];_0x21d88c[_0x09dd('0xcc')]=qs['sort'](_0x4d833e[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x21d88c[_0x09dd('0xce')]=qs['filters'](_[_0x09dd('0xd3')](_0x4d833e['query'],_0x447efb[_0x09dd('0xc9')]));if(_0x4d833e[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x21d88c[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x21d88c[_0x09dd('0xce')],{'$or':_['map'](_0x21d88c[_0x09dd('0x3e')],function(_0x5c977d){var _0x2161ec={};_0x2161ec[_0x5c977d]={'$like':'%'+_0x4d833e[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x2161ec;})});}_0x21d88c=_[_0x09dd('0x4f')]({},_0x21d88c,_0x4d833e[_0x09dd('0xd4')]);return _0x58cd9b[_0x09dd('0xd5')](_0x21d88c);}})[_0x09dd('0x1c')](function(_0x46c2b1){if(_0x46c2b1){_0x497ed6=_0x46c2b1['length'];if(!_0x4d833e[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x21d88c[_0x09dd('0x18')]=qs['limit'](_0x4d833e[_0x09dd('0x3a')][_0x09dd('0x18')]);_0x21d88c[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x4d833e['query'][_0x09dd('0x16')]);}return _0x58cd9b[_0x09dd('0xd5')](_0x21d88c);}})['then'](function(_0x366c4e){if(_0x366c4e){return _0x366c4e?{'count':_0x497ed6,'rows':_0x366c4e}:null;}})[_0x09dd('0x1c')](respondWithResult(_0x467df9,null))[_0x09dd('0x51')](handleError(_0x467df9,null));};exports[_0x09dd('0xd6')]=function(_0x5bf0c7,_0x25989b){var _0x3ac78e={'raw':!![],'where':{}};var _0x871d80={};var _0x34df89={'count':0x0,'rows':[]};return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x5bf0c7[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x25989b,null))[_0x09dd('0x1c')](function(_0x18f82d){if(_0x18f82d){_0x871d80['model']=_[_0x09dd('0xc7')](db[_0x09dd('0xd7')][_0x09dd('0x2f')]);_0x871d80[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x5bf0c7[_0x09dd('0x3a')]);_0x871d80[_0x09dd('0xc9')]=_['intersection'](_0x871d80['model'],_0x871d80[_0x09dd('0x3a')]);_0x3ac78e[_0x09dd('0x3e')]=_[_0x09dd('0xca')](_0x871d80[_0x09dd('0xd2')],qs['fields'](_0x5bf0c7[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x3ac78e['attributes']=_0x3ac78e[_0x09dd('0x3e')][_0x09dd('0x42')]?_0x3ac78e[_0x09dd('0x3e')]:_0x871d80[_0x09dd('0xd2')];if(!_0x5bf0c7[_0x09dd('0x3a')][_0x09dd('0xc0')]('nolimit')){_0x3ac78e[_0x09dd('0x18')]=qs['limit'](_0x5bf0c7['query'][_0x09dd('0x18')]);_0x3ac78e[_0x09dd('0x16')]=qs['offset'](_0x5bf0c7[_0x09dd('0x3a')]['offset']);}_0x3ac78e[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x5bf0c7[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x3ac78e['where']=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x5bf0c7[_0x09dd('0x3a')],_0x871d80[_0x09dd('0xc9')]));_0x3ac78e['where'][_0x09dd('0xd8')]=_0x18f82d['id'];if(_0x5bf0c7[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x3ac78e[_0x09dd('0xce')]=_['merge'](_0x3ac78e[_0x09dd('0xce')],{'$or':_[_0x09dd('0x24')](_0x3ac78e[_0x09dd('0x3e')],function(_0x50debd){var _0x35604f={};_0x35604f[_0x50debd]={'$like':'%'+_0x5bf0c7[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x35604f;})});}_0x3ac78e=_[_0x09dd('0x4f')]({},_0x3ac78e,_0x5bf0c7[_0x09dd('0xd4')]);return db[_0x09dd('0xd7')][_0x09dd('0x17')]({'where':_0x3ac78e[_0x09dd('0xce')]})[_0x09dd('0x1c')](function(_0x306b91){_0x34df89[_0x09dd('0x17')]=_0x306b91;if(_0x5bf0c7[_0x09dd('0x3a')][_0x09dd('0x4d')]){_0x3ac78e[_0x09dd('0x3b')]=[{'all':!![]}];}return db[_0x09dd('0xd7')][_0x09dd('0x3f')](_0x3ac78e);})['then'](function(_0x118c6c){_0x34df89[_0x09dd('0x41')]=_0x118c6c;return _0x34df89;});}})[_0x09dd('0x1c')](respondWithFilteredResult(_0x25989b,_0x3ac78e))['catch'](handleError(_0x25989b,null));};exports[_0x09dd('0xd9')]=function(_0x2b9efa,_0x24146c){var _0x5884d3={'raw':!![],'where':{}};var _0x454772={};var _0x202da1={'count':0x0,'rows':[]};return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x2b9efa[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x24146c,null))[_0x09dd('0x1c')](function(_0x48979f){if(_0x48979f){_0x454772['model']=_[_0x09dd('0xc7')](db[_0x09dd('0xda')][_0x09dd('0x2f')]);_0x454772[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x2b9efa[_0x09dd('0x3a')]);_0x454772[_0x09dd('0xc9')]=_['intersection'](_0x454772[_0x09dd('0xd2')],_0x454772[_0x09dd('0x3a')]);_0x5884d3['attributes']=_[_0x09dd('0xca')](_0x454772['model'],qs[_0x09dd('0xcb')](_0x2b9efa['query']['fields']));_0x5884d3[_0x09dd('0x3e')]=_0x5884d3['attributes'][_0x09dd('0x42')]?_0x5884d3['attributes']:_0x454772[_0x09dd('0xd2')];if(!_0x2b9efa[_0x09dd('0x3a')][_0x09dd('0xc0')]('nolimit')){_0x5884d3[_0x09dd('0x18')]=qs['limit'](_0x2b9efa['query']['limit']);_0x5884d3[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x2b9efa[_0x09dd('0x3a')][_0x09dd('0x16')]);}_0x5884d3[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x2b9efa[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x5884d3[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_['pick'](_0x2b9efa[_0x09dd('0x3a')],_0x454772[_0x09dd('0xc9')]));_0x5884d3[_0x09dd('0xce')]['UserId']=_0x48979f['id'];if(_0x2b9efa[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x5884d3[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x5884d3[_0x09dd('0xce')],{'$or':_[_0x09dd('0x24')](_0x5884d3[_0x09dd('0x3e')],function(_0x481314){var _0x2a6d41={};_0x2a6d41[_0x481314]={'$like':'%'+_0x2b9efa[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x2a6d41;})});}_0x5884d3=_[_0x09dd('0x4f')]({},_0x5884d3,_0x2b9efa[_0x09dd('0xd4')]);return db[_0x09dd('0xda')][_0x09dd('0x17')]({'where':_0x5884d3[_0x09dd('0xce')]})['then'](function(_0x4795cf){_0x202da1['count']=_0x4795cf;if(_0x2b9efa['query'][_0x09dd('0x4d')]){_0x5884d3['include']=[{'all':!![]}];}return db[_0x09dd('0xda')][_0x09dd('0x3f')](_0x5884d3);})[_0x09dd('0x1c')](function(_0x4f1d00){_0x202da1[_0x09dd('0x41')]=_0x4f1d00;return _0x202da1;});}})[_0x09dd('0x1c')](respondWithFilteredResult(_0x24146c,_0x5884d3))['catch'](handleError(_0x24146c,null));};exports['getChatInteractions']=function(_0x2b11b0,_0x30c300){var _0x247e54={};var _0x351b8b={};var _0x4769cf;var _0x12c987;return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0x2b11b0[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x30c300,null))[_0x09dd('0x1c')](function(_0x4c0269){if(_0x4c0269){_0x4769cf=_0x4c0269;_0x351b8b[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xdb')][_0x09dd('0x2f')]);_0x351b8b[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x2b11b0[_0x09dd('0x3a')]);_0x351b8b['filters']=_[_0x09dd('0xca')](_0x351b8b[_0x09dd('0xd2')],_0x351b8b[_0x09dd('0x3a')]);_0x247e54['attributes']=_['intersection'](_0x351b8b[_0x09dd('0xd2')],qs['fields'](_0x2b11b0[_0x09dd('0x3a')]['fields']));_0x247e54[_0x09dd('0x3e')]=_0x247e54[_0x09dd('0x3e')][_0x09dd('0x42')]?_0x247e54['attributes']:_0x351b8b['model'];_0x247e54[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x2b11b0['query'][_0x09dd('0xcd')]);_0x247e54[_0x09dd('0xce')]=qs['filters'](_[_0x09dd('0xd3')](_0x2b11b0['query'],_0x351b8b[_0x09dd('0xc9')]));if(_0x2b11b0[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x247e54[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x247e54['where'],{'$or':_['map'](_0x247e54['attributes'],function(_0x154acc){var _0x32dc6b={};_0x32dc6b[_0x154acc]={'$like':'%'+_0x2b11b0['query']['filter']+'%'};return _0x32dc6b;})});}_0x247e54=_[_0x09dd('0x4f')]({},_0x247e54,_0x2b11b0['options']);return _0x4769cf[_0x09dd('0xdc')](_0x247e54);}})[_0x09dd('0x1c')](function(_0x32415c){if(_0x32415c){_0x12c987=_0x32415c[_0x09dd('0x42')];if(!_0x2b11b0['query'][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x247e54[_0x09dd('0x18')]=qs[_0x09dd('0x18')](_0x2b11b0['query'][_0x09dd('0x18')]);_0x247e54[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x2b11b0[_0x09dd('0x3a')][_0x09dd('0x16')]);}return _0x4769cf['getChatInteractions'](_0x247e54);}})[_0x09dd('0x1c')](function(_0x19c757){if(_0x19c757){return _0x19c757?{'count':_0x12c987,'rows':_0x19c757}:null;}})[_0x09dd('0x1c')](respondWithResult(_0x30c300,null))[_0x09dd('0x51')](handleError(_0x30c300,null));};exports['getOpenchannelInteractions']=function(_0x448ff4,_0x1a5482){var _0x3a0da5={};var _0x489725={};var _0x25d7e2;var _0x106ee6;return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x448ff4[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x1a5482,null))[_0x09dd('0x1c')](function(_0x3f35bc){if(_0x3f35bc){_0x25d7e2=_0x3f35bc;_0x489725[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xdd')][_0x09dd('0x2f')]);_0x489725[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x448ff4[_0x09dd('0x3a')]);_0x489725[_0x09dd('0xc9')]=_['intersection'](_0x489725[_0x09dd('0xd2')],_0x489725[_0x09dd('0x3a')]);_0x3a0da5['attributes']=_[_0x09dd('0xca')](_0x489725[_0x09dd('0xd2')],qs[_0x09dd('0xcb')](_0x448ff4[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x3a0da5[_0x09dd('0x3e')]=_0x3a0da5['attributes'][_0x09dd('0x42')]?_0x3a0da5['attributes']:_0x489725['model'];_0x3a0da5[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x448ff4['query'][_0x09dd('0xcd')]);_0x3a0da5[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x448ff4[_0x09dd('0x3a')],_0x489725[_0x09dd('0xc9')]));if(_0x448ff4[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x3a0da5[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x3a0da5[_0x09dd('0xce')],{'$or':_[_0x09dd('0x24')](_0x3a0da5[_0x09dd('0x3e')],function(_0x207579){var _0x3f85c0={};_0x3f85c0[_0x207579]={'$like':'%'+_0x448ff4[_0x09dd('0x3a')]['filter']+'%'};return _0x3f85c0;})});}_0x3a0da5=_[_0x09dd('0x4f')]({},_0x3a0da5,_0x448ff4[_0x09dd('0xd4')]);return _0x25d7e2[_0x09dd('0xde')](_0x3a0da5);}})[_0x09dd('0x1c')](function(_0x23ffeb){if(_0x23ffeb){_0x106ee6=_0x23ffeb[_0x09dd('0x42')];if(!_0x448ff4[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x3a0da5[_0x09dd('0x18')]=qs['limit'](_0x448ff4['query']['limit']);_0x3a0da5[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x448ff4[_0x09dd('0x3a')][_0x09dd('0x16')]);}return _0x25d7e2[_0x09dd('0xde')](_0x3a0da5);}})[_0x09dd('0x1c')](function(_0x184633){if(_0x184633){return _0x184633?{'count':_0x106ee6,'rows':_0x184633}:null;}})['then'](respondWithResult(_0x1a5482,null))[_0x09dd('0x51')](handleError(_0x1a5482,null));};exports[_0x09dd('0xdf')]=function(_0x95d5b8,_0x28ac2d){var _0x586025={'raw':!![],'where':{}};var _0x347511={};var _0x3934cb={'count':0x0,'rows':[]};return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0x95d5b8[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x28ac2d,null))['then'](function(_0xd7ceaf){if(_0xd7ceaf){_0x347511[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xe0')][_0x09dd('0x2f')]);_0x347511[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x95d5b8[_0x09dd('0x3a')]);_0x347511[_0x09dd('0xc9')]=_['intersection'](_0x347511[_0x09dd('0xd2')],_0x347511[_0x09dd('0x3a')]);_0x586025['attributes']=_['intersection'](_0x347511[_0x09dd('0xd2')],qs['fields'](_0x95d5b8[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x586025['attributes']=_0x586025[_0x09dd('0x3e')][_0x09dd('0x42')]?_0x586025[_0x09dd('0x3e')]:_0x347511[_0x09dd('0xd2')];if(!_0x95d5b8[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x586025['limit']=qs[_0x09dd('0x18')](_0x95d5b8['query'][_0x09dd('0x18')]);_0x586025[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x95d5b8[_0x09dd('0x3a')][_0x09dd('0x16')]);}_0x586025[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x95d5b8[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x586025['where']=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x95d5b8[_0x09dd('0x3a')],_0x347511['filters']));_0x586025['where']['UserId']=_0xd7ceaf['id'];if(_0x95d5b8[_0x09dd('0x3a')]['filter']){_0x586025['where']=_[_0x09dd('0x4f')](_0x586025['where'],{'$or':_[_0x09dd('0x24')](_0x586025[_0x09dd('0x3e')],function(_0x504334){var _0x4eaa24={};_0x4eaa24[_0x504334]={'$like':'%'+_0x95d5b8[_0x09dd('0x3a')]['filter']+'%'};return _0x4eaa24;})});}_0x586025=_[_0x09dd('0x4f')]({},_0x586025,_0x95d5b8['options']);return db[_0x09dd('0xe0')][_0x09dd('0x17')]({'where':_0x586025[_0x09dd('0xce')]})['then'](function(_0x330fb6){_0x3934cb[_0x09dd('0x17')]=_0x330fb6;if(_0x95d5b8[_0x09dd('0x3a')]['includeAll']){_0x586025[_0x09dd('0x3b')]=[{'all':!![]}];}return db[_0x09dd('0xe0')][_0x09dd('0x3f')](_0x586025);})[_0x09dd('0x1c')](function(_0x465893){_0x3934cb[_0x09dd('0x41')]=_0x465893;return _0x3934cb;});}})['then'](respondWithFilteredResult(_0x28ac2d,_0x586025))['catch'](handleError(_0x28ac2d,null));};exports[_0x09dd('0xe1')]=function(_0x564dd1,_0x42c7e8){var _0xc1e096={};var _0x536c86={};var _0x253b53;var _0x2f7e05;return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0x564dd1[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x42c7e8,null))['then'](function(_0x2fb8bd){if(_0x2fb8bd){_0x253b53=_0x2fb8bd;_0x536c86[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xe2')]['rawAttributes']);_0x536c86[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x564dd1[_0x09dd('0x3a')]);_0x536c86[_0x09dd('0xc9')]=_[_0x09dd('0xca')](_0x536c86[_0x09dd('0xd2')],_0x536c86[_0x09dd('0x3a')]);_0xc1e096[_0x09dd('0x3e')]=_[_0x09dd('0xca')](_0x536c86[_0x09dd('0xd2')],qs['fields'](_0x564dd1[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0xc1e096['attributes']=_0xc1e096[_0x09dd('0x3e')][_0x09dd('0x42')]?_0xc1e096[_0x09dd('0x3e')]:_0x536c86[_0x09dd('0xd2')];_0xc1e096[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x564dd1[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0xc1e096[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x564dd1[_0x09dd('0x3a')],_0x536c86['filters']));if(_0x564dd1[_0x09dd('0x3a')][_0x09dd('0x33')]){_0xc1e096[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0xc1e096[_0x09dd('0xce')],{'$or':_['map'](_0xc1e096[_0x09dd('0x3e')],function(_0x4085bf){var _0x51827e={};_0x51827e[_0x4085bf]={'$like':'%'+_0x564dd1['query'][_0x09dd('0x33')]+'%'};return _0x51827e;})});}_0xc1e096=_['merge']({},_0xc1e096,_0x564dd1[_0x09dd('0xd4')]);return _0x253b53[_0x09dd('0xe1')](_0xc1e096);}})['then'](function(_0x3a0966){if(_0x3a0966){_0x2f7e05=_0x3a0966['length'];if(!_0x564dd1[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0xc1e096[_0x09dd('0x18')]=qs[_0x09dd('0x18')](_0x564dd1[_0x09dd('0x3a')][_0x09dd('0x18')]);_0xc1e096[_0x09dd('0x16')]=qs['offset'](_0x564dd1[_0x09dd('0x3a')]['offset']);}return _0x253b53[_0x09dd('0xe1')](_0xc1e096);}})[_0x09dd('0x1c')](function(_0x1b893a){if(_0x1b893a){return _0x1b893a?{'count':_0x2f7e05,'rows':_0x1b893a}:null;}})[_0x09dd('0x1c')](respondWithResult(_0x42c7e8,null))[_0x09dd('0x51')](handleError(_0x42c7e8,null));};exports['getFaxInteractions']=function(_0x23cb0f,_0x573022){var _0xca8c54={};var _0x1d2b0a={};var _0x1d6596;var _0x60cc4a;return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0x23cb0f['params']['id']}})['then'](handleEntityNotFound(_0x573022,null))[_0x09dd('0x1c')](function(_0x18f697){if(_0x18f697){_0x1d6596=_0x18f697;_0x1d2b0a[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xe3')][_0x09dd('0x2f')]);_0x1d2b0a[_0x09dd('0x3a')]=_['keys'](_0x23cb0f['query']);_0x1d2b0a[_0x09dd('0xc9')]=_['intersection'](_0x1d2b0a[_0x09dd('0xd2')],_0x1d2b0a[_0x09dd('0x3a')]);_0xca8c54[_0x09dd('0x3e')]=_[_0x09dd('0xca')](_0x1d2b0a[_0x09dd('0xd2')],qs['fields'](_0x23cb0f['query'][_0x09dd('0xcb')]));_0xca8c54[_0x09dd('0x3e')]=_0xca8c54['attributes'][_0x09dd('0x42')]?_0xca8c54['attributes']:_0x1d2b0a[_0x09dd('0xd2')];_0xca8c54[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x23cb0f['query'][_0x09dd('0xcd')]);_0xca8c54[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x23cb0f[_0x09dd('0x3a')],_0x1d2b0a[_0x09dd('0xc9')]));if(_0x23cb0f[_0x09dd('0x3a')][_0x09dd('0x33')]){_0xca8c54[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0xca8c54[_0x09dd('0xce')],{'$or':_[_0x09dd('0x24')](_0xca8c54['attributes'],function(_0x477afe){var _0x318b52={};_0x318b52[_0x477afe]={'$like':'%'+_0x23cb0f[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x318b52;})});}_0xca8c54=_[_0x09dd('0x4f')]({},_0xca8c54,_0x23cb0f[_0x09dd('0xd4')]);return _0x1d6596['getFaxInteractions'](_0xca8c54);}})[_0x09dd('0x1c')](function(_0x28d8c3){if(_0x28d8c3){_0x60cc4a=_0x28d8c3[_0x09dd('0x42')];if(!_0x23cb0f[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0xca8c54[_0x09dd('0x18')]=qs[_0x09dd('0x18')](_0x23cb0f['query']['limit']);_0xca8c54[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x23cb0f['query'][_0x09dd('0x16')]);}return _0x1d6596[_0x09dd('0xe4')](_0xca8c54);}})['then'](function(_0x5123a5){if(_0x5123a5){return _0x5123a5?{'count':_0x60cc4a,'rows':_0x5123a5}:null;}})[_0x09dd('0x1c')](respondWithResult(_0x573022,null))[_0x09dd('0x51')](handleError(_0x573022,null));};exports[_0x09dd('0xe5')]=function(_0x2b1439,_0xcfcc34){var _0x5b9dfe={};var _0x1cf6ea={};var _0x41ede1;var _0x2f37c7;return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0x2b1439[_0x09dd('0x4c')]['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0xcfcc34,null))[_0x09dd('0x1c')](function(_0x35cd46){if(_0x35cd46){_0x41ede1=_0x35cd46;_0x1cf6ea[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xe6')][_0x09dd('0x2f')]);_0x1cf6ea[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0x2b1439[_0x09dd('0x3a')]);_0x1cf6ea[_0x09dd('0xc9')]=_[_0x09dd('0xca')](_0x1cf6ea[_0x09dd('0xd2')],_0x1cf6ea['query']);_0x5b9dfe['attributes']=_[_0x09dd('0xca')](_0x1cf6ea[_0x09dd('0xd2')],qs[_0x09dd('0xcb')](_0x2b1439[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x5b9dfe['attributes']=_0x5b9dfe['attributes'][_0x09dd('0x42')]?_0x5b9dfe[_0x09dd('0x3e')]:_0x1cf6ea[_0x09dd('0xd2')];_0x5b9dfe['order']=qs[_0x09dd('0xcd')](_0x2b1439[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x5b9dfe[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_['pick'](_0x2b1439[_0x09dd('0x3a')],_0x1cf6ea[_0x09dd('0xc9')]));if(_0x2b1439[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x5b9dfe[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x5b9dfe[_0x09dd('0xce')],{'$or':_[_0x09dd('0x24')](_0x5b9dfe[_0x09dd('0x3e')],function(_0x3755a1){var _0x17232a={};_0x17232a[_0x3755a1]={'$like':'%'+_0x2b1439[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x17232a;})});}_0x5b9dfe=_[_0x09dd('0x4f')]({},_0x5b9dfe,_0x2b1439['options']);return _0x41ede1['getWhatsappInteractions'](_0x5b9dfe);}})[_0x09dd('0x1c')](function(_0x313289){if(_0x313289){_0x2f37c7=_0x313289[_0x09dd('0x42')];if(!_0x2b1439[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x5b9dfe[_0x09dd('0x18')]=qs[_0x09dd('0x18')](_0x2b1439[_0x09dd('0x3a')][_0x09dd('0x18')]);_0x5b9dfe[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0x2b1439['query'][_0x09dd('0x16')]);}return _0x41ede1[_0x09dd('0xe5')](_0x5b9dfe);}})[_0x09dd('0x1c')](function(_0x725cdc){if(_0x725cdc){return _0x725cdc?{'count':_0x2f37c7,'rows':_0x725cdc}:null;}})['then'](respondWithResult(_0xcfcc34,null))[_0x09dd('0x51')](handleError(_0xcfcc34,null));};exports[_0x09dd('0xe7')]=function(_0xec393c,_0x24e3fd,_0xeead57){var _0x41915b;var _0x2dfe1a;var _0x173590;var _0x25d3fe=!_[_0x09dd('0x5c')](_0xec393c[_0x09dd('0x4c')]['id'])?_0xec393c[_0x09dd('0x4c')]['id']:!_[_0x09dd('0x5c')](_0xec393c['user']['id'])?_0xec393c['user']['id']:null;return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0x25d3fe,'role':{'$or':[_0x09dd('0x1e'),_0x09dd('0x1f'),_0x09dd('0x21')]}},'attributes':['id',_0x09dd('0x29'),_0x09dd('0xe8'),'mobile','role',_0x09dd('0x5d'),_0x09dd('0x92')]})['then'](function(_0x55e3d1){if(_0x55e3d1){if(_0x55e3d1[_0x09dd('0x27')]===_0x09dd('0x21')){_0x41915b=_0x55e3d1;if(_0xec393c[_0x09dd('0x55')][_0x09dd('0x94')]){_0x173590=util[_0x09dd('0xe9')](_0x09dd('0xea'),_0x41915b[_0xec393c[_0x09dd('0x55')][_0x09dd('0x94')]]);}else if(_0xec393c['body'][_0x09dd('0xeb')]){_0x173590=util[_0x09dd('0xe9')](_0x09dd('0x9f'),_0xec393c[_0x09dd('0x55')][_0x09dd('0xeb')]);}else{_0x173590=util[_0x09dd('0xe9')](_0x09dd('0x9f'),_0x41915b[_0x09dd('0x29')]);}socket['to'](util[_0x09dd('0xe9')]('user:%s',_0x41915b['name']))[_0x09dd('0x1a')](_0x09dd('0xec'),{'user':{'id':_0x41915b['id'],'name':_0x41915b[_0x09dd('0x29')]},'ip':_0xec393c[_0x09dd('0xed')][_0x09dd('0xee')]||_0xec393c[_0x09dd('0xef')][_0x09dd('0xf0')]||_0xec393c[_0x09dd('0xf1')][_0x09dd('0xf0')]||_0xec393c[_0x09dd('0xef')][_0x09dd('0xf1')]['remoteAddress']});return db[_0x09dd('0xa0')][_0x09dd('0x1b')]({'where':{'membername':_0x41915b[_0x09dd('0x29')]},'individualHooks':!![]});}}else{throw new db[(_0x09dd('0x85'))][(_0x09dd('0x86'))](_0x09dd('0xf2'));}})['then'](function(){if(_0x41915b){return _0x41915b[_0x09dd('0xf3')]({'raw':!![]});}})['then'](function(_0x47a83b){if(_0x41915b){if(_0x47a83b){_0x2dfe1a=_0x47a83b;if(_0x2dfe1a['length']){var _0x34b482=_0x2dfe1a['map'](function(_0x244c66){var _0x1dbed1={'membername':_0x41915b[_0x09dd('0x29')],'UserId':_0x41915b['id'],'queue_name':_0x244c66[_0x09dd('0x29')],'VoiceQueueId':_0x244c66['id'],'interface':_0x173590,'paused':_0x41915b[_0x09dd('0x92')]||![],'penalty':_0x244c66[_0x09dd('0xf4')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x1dbed1);});return Promise[_0x09dd('0x4a')](_0x34b482);}}}})[_0x09dd('0x1c')](function(){if(_0x41915b){return db[_0x09dd('0xf5')][_0x09dd('0x3f')]({'where':{'membername':_0x41915b['name'],'exitAt':null}});}})[_0x09dd('0x1c')](function(_0x48112b){if(_0x41915b){var _0x55d7d9=[];_0x48112b[_0x09dd('0xf6')](function(_0x5408aa){_0x55d7d9[_0x09dd('0x44')](_0x5408aa[_0x09dd('0x52')]({'exitAt':moment()[_0x09dd('0xe9')](_0x09dd('0xf7'))}));});return Promise['all'](_0x55d7d9);}})[_0x09dd('0x1c')](function(){if(_0x41915b){var _0x3c9940=[];var _0x362189=[];var _0x13634d=utils[_0x09dd('0xf8')]();var _0xd2a607={'membername':_0x41915b['name'],'interface':_0x173590,'enterAt':moment()[_0x09dd('0xe9')](_0x09dd('0xf7')),'role':_0x41915b[_0x09dd('0x27')],'internal':_0x41915b['internal']};_0x13634d[_0x09dd('0xf6')](function(_0x1ede6b){_0x3c9940[_0x09dd('0x44')](_[_0x09dd('0x4f')]({'channel':_0x1ede6b,'type':_0x09dd('0xf9'),'data1':_0xec393c[_0x09dd('0x55')][_0x09dd('0xfa')],'data2':_0x173590},_0xd2a607));if(_0x41915b[_0x09dd('0x92')]){_0x362189[_0x09dd('0x44')](_[_0x09dd('0x4f')]({'channel':_0x1ede6b,'type':_0x09dd('0xfb'),'data1':_0x09dd('0xfc')},_0xd2a607));}});return db[_0x09dd('0xf5')][_0x09dd('0x7d')](_0x3c9940[_0x09dd('0xbc')](_0x362189),{'individualHooks':!![]});}})[_0x09dd('0x1c')](function(){if(_0x41915b){return _0x41915b[_0x09dd('0x52')]({'online':!![],'lastLoginAt':moment()['format'](_0x09dd('0xf7')),'voicePause':_0x41915b['loginInPause']||![],'mailPause':_0x41915b[_0x09dd('0x92')]||![],'chatPause':_0x41915b[_0x09dd('0x92')]||![],'faxPause':_0x41915b[_0x09dd('0x92')]||![],'smsPause':_0x41915b['loginInPause']||![],'openchannelPause':_0x41915b[_0x09dd('0x92')]||![],'whatsappPause':_0x41915b['loginInPause']||![],'pauseType':_0x41915b[_0x09dd('0x92')]?_0x09dd('0xfc'):null,'interface':_0x173590,'lastPauseAt':moment()[_0x09dd('0xe9')](_0x09dd('0xf7'))});}})['then'](function(_0xb08cbc){if(_0xec393c[_0x09dd('0xfd')]){return _0xeead57();}else{return Promise[_0x09dd('0xfe')](_0xb08cbc)[_0x09dd('0x1c')](respondWithResult(_0x24e3fd,null));}})[_0x09dd('0x51')](handleError(_0x24e3fd,null));};exports[_0x09dd('0xff')]=function(_0x432017,_0x5ad61b){var _0x3d8bb0;return db['User']['find']({'where':{'id':_0x432017['params']['id'],'role':'agent'},'attributes':['id','name','role']})[_0x09dd('0x1c')](handleEntityNotFound(_0x5ad61b,null))[_0x09dd('0x1c')](function(_0x83ee35){if(_0x83ee35){_0x3d8bb0=_0x83ee35;return db[_0x09dd('0xa0')][_0x09dd('0x1b')]({'where':{'membername':_0x3d8bb0[_0x09dd('0x29')]},'individualHooks':!![]});}})[_0x09dd('0x1c')](function(){return db[_0x09dd('0xf5')][_0x09dd('0x3f')]({'where':{'membername':_0x3d8bb0['name'],'exitAt':null}});})[_0x09dd('0x1c')](function(_0x16e99c){var _0x62c546=[];_0x16e99c['forEach'](function(_0xceb419){_0x62c546[_0x09dd('0x44')](_0xceb419[_0x09dd('0x52')]({'exitAt':moment()[_0x09dd('0xe9')](_0x09dd('0xf7'))}));});return Promise[_0x09dd('0x4a')](_0x62c546);})[_0x09dd('0x1c')](function(){return _0x3d8bb0[_0x09dd('0x52')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x5ad61b,null))[_0x09dd('0x51')](handleError(_0x5ad61b,null));};exports['pause']=function(_0x413dc4,_0xe409d7){var _0x3d0ff4;return db[_0x09dd('0xa0')]['update']({'paused':0x1},{'where':{'UserId':_0x413dc4['params']['id']},'individualHooks':!![]})[_0x09dd('0x1c')](function(){return db['User'][_0x09dd('0x28')]({'where':{'id':_0x413dc4[_0x09dd('0x4c')]['id'],'role':'agent'},'attributes':['id',_0x09dd('0x29'),_0x09dd('0x27'),_0x09dd('0x5d'),'interface',_0x09dd('0x91')]});})[_0x09dd('0x1c')](handleEntityNotFound(_0xe409d7,null))['then'](function(_0x1352fc){if(_0x1352fc){_0x3d0ff4=_0x1352fc;return db[_0x09dd('0xf5')][_0x09dd('0x3f')]({'where':{'membername':_0x3d0ff4['name'],'type':'PAUSE','exitAt':null}});}})[_0x09dd('0x1c')](function(_0x3843e8){if(_0x3843e8[_0x09dd('0x42')]){var _0x37f1ed=moment()[_0x09dd('0xe9')](_0x09dd('0xf7'));for(var _0x1a4381=0x0,_0x2d9203=_0x3843e8[_0x09dd('0x42')];_0x1a4381<_0x2d9203;_0x1a4381++){_0x3843e8[_0x1a4381][_0x09dd('0x100')]({'exitAt':_0x37f1ed});}}})[_0x09dd('0x1c')](function(){var _0xc4da1b=[];var _0x389013=utils[_0x09dd('0xf8')]();_0x389013[_0x09dd('0xf6')](function(_0x5d9d7a){_0xc4da1b[_0x09dd('0x44')]({'channel':_0x5d9d7a,'membername':_0x3d0ff4['name'],'interface':_[_0x09dd('0x5c')](_0x3d0ff4[_0x09dd('0x94')])?util[_0x09dd('0xe9')]('SIP/%s',_0x3d0ff4[_0x09dd('0x29')]):_0x3d0ff4[_0x09dd('0x94')],'type':'PAUSE','enterAt':moment()[_0x09dd('0xe9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x413dc4[_0x09dd('0x55')][_0x09dd('0x31')]||_0x09dd('0x101'),'role':_0x3d0ff4[_0x09dd('0x27')],'internal':_0x3d0ff4['internal']});});return db['MemberReport']['bulkCreate'](_0xc4da1b,{'individualHooks':!![]});})[_0x09dd('0x1c')](function(){return _0x3d0ff4['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x413dc4['body'][_0x09dd('0x31')]||_0x09dd('0x101'),'lastPauseAt':moment()[_0x09dd('0xe9')](_0x09dd('0xf7'))});})[_0x09dd('0x1c')](respondWithResult(_0xe409d7,null))['catch'](handleError(_0xe409d7,null));};exports[_0x09dd('0x102')]=function(_0x3a9255,_0x35ec91){if(_0x3a9255[_0x09dd('0x55')][_0x09dd('0x90')]&&!utils[_0x09dd('0x95')](_0x3a9255[_0x09dd('0x55')]['channel'])){throw new APIBadRequestError(util[_0x09dd('0xe9')](_0x09dd('0x103'),_0x3a9255['body'][_0x09dd('0x90')]));}return db[_0x09dd('0x2e')][_0x09dd('0x28')]({'where':{'id':_0x3a9255[_0x09dd('0x4c')]['id']},'attributes':['id',_0x09dd('0x29'),_0x09dd('0x27'),_0x09dd('0x5d'),_0x09dd('0x94'),_0x09dd('0x91'),_0x09dd('0x93'),_0x09dd('0x104'),_0x09dd('0x105'),'faxPause',_0x09dd('0x106'),'smsPause','whatsappPause','pauseType',_0x09dd('0x107')]})['then'](function(_0x2ccd8f){if(!_0x2ccd8f){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3a9255[_0x09dd('0x4c')]['id']));}return _0x2ccd8f[_0x09dd('0x102')](_0x3a9255['body'][_0x09dd('0x90')]);})[_0x09dd('0x1c')](respondWithResult(_0x35ec91,null))['catch'](APIHandleError(_0x35ec91));};exports[_0x09dd('0x108')]=function(_0x4adf09,_0x396d8d){var _0x31d396={};var _0x44f684={};var _0x2b830c;var _0x30f42a;return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x4adf09['params']['id']}})['then'](handleEntityNotFound(_0x396d8d,null))[_0x09dd('0x1c')](function(_0x2a5823){if(_0x2a5823){_0x2b830c=_0x2a5823;_0x44f684[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0x109')][_0x09dd('0x2f')]);_0x44f684[_0x09dd('0x3a')]=_['keys'](_0x4adf09[_0x09dd('0x3a')]);_0x44f684[_0x09dd('0xc9')]=_['intersection'](_0x44f684['model'],_0x44f684[_0x09dd('0x3a')]);_0x31d396[_0x09dd('0x3e')]=_[_0x09dd('0xca')](_0x44f684[_0x09dd('0xd2')],qs[_0x09dd('0xcb')](_0x4adf09['query'][_0x09dd('0xcb')]));_0x31d396[_0x09dd('0x3e')]=_0x31d396['attributes'][_0x09dd('0x42')]?_0x31d396['attributes']:_0x44f684[_0x09dd('0xd2')];_0x31d396[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x4adf09[_0x09dd('0x3a')]['sort']);_0x31d396['where']=qs[_0x09dd('0xc9')](_['pick'](_0x4adf09[_0x09dd('0x3a')],_0x44f684[_0x09dd('0xc9')]));if(_0x4adf09[_0x09dd('0x3a')]['filter']){_0x31d396[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x31d396[_0x09dd('0xce')],{'$or':_['map'](_0x31d396[_0x09dd('0x3e')],function(_0x2974c4){var _0x202dc1={};_0x202dc1[_0x2974c4]={'$like':'%'+_0x4adf09[_0x09dd('0x3a')]['filter']+'%'};return _0x202dc1;})});}_0x31d396=_[_0x09dd('0x4f')]({},_0x31d396,_0x4adf09[_0x09dd('0xd4')]);return _0x2b830c[_0x09dd('0x108')](_0x31d396);}})[_0x09dd('0x1c')](function(_0x1d32fc){if(_0x1d32fc){_0x30f42a=_0x1d32fc[_0x09dd('0x42')];if(!_0x4adf09[_0x09dd('0x3a')][_0x09dd('0xc0')](_0x09dd('0xd0'))){_0x31d396['limit']=qs['limit'](_0x4adf09[_0x09dd('0x3a')][_0x09dd('0x18')]);_0x31d396['offset']=qs[_0x09dd('0x16')](_0x4adf09[_0x09dd('0x3a')][_0x09dd('0x16')]);}return _0x2b830c['getTeams'](_0x31d396);}})[_0x09dd('0x1c')](function(_0x357e89){if(_0x357e89){return _0x357e89?{'count':_0x30f42a,'rows':_0x357e89}:null;}})[_0x09dd('0x1c')](respondWithResult(_0x396d8d,null))[_0x09dd('0x51')](handleError(_0x396d8d,null));};exports[_0x09dd('0x10a')]=function(_0xcba893,_0x2bbcac){var _0x5af999=_0xcba893[_0x09dd('0x4c')]['id'];var _0x4319fb=_0xcba893[_0x09dd('0x55')]?_0xcba893[_0x09dd('0x55')][_0x09dd('0x56')]:null;var _0x361043=[];return Promise['resolve']()[_0x09dd('0x1c')](function(){if(!_0x4319fb)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x09dd('0x2e')][_0x09dd('0xbe')]({'where':{'id':_0x5af999}});})[_0x09dd('0x1c')](function(_0x215a42){if(!_0x215a42)throw new APINotFoundError(util[_0x09dd('0xe9')](_0x09dd('0xbf'),_0xcba893['params']['id']));return db[_0x09dd('0x10b')][_0x09dd('0x10c')](function(_0x46859d){return _0x215a42[_0x09dd('0x10a')](_0x4319fb,{'transaction':_0x46859d})[_0x09dd('0x1c')](function(){return db[_0x09dd('0x109')][_0x09dd('0x3f')]({'where':{'id':{'$in':_0x4319fb}}});})[_0x09dd('0x1c')](function(_0x4907cc){var _0x2789c1=_[_0x09dd('0x24')](_0x4907cc,function(_0xd7ce84){return _0xd7ce84['getAssociatedQueues']();});return Promise[_0x09dd('0x4a')](_0x2789c1);})[_0x09dd('0x1c')](function(_0xa0bc45){_0x361043=_['flattenDeep'](_0xa0bc45);var _0x5c4eb8=_['map'](_0x361043,function(_0x55cee2){return _0x55cee2['addAgent'](_0x215a42['id'],{'transaction':_0x46859d});});return Promise[_0x09dd('0x4a')](_0x5c4eb8);})['then'](function(){if(!_0x215a42[_0x09dd('0x91')])return;var _0x126405=_[_0x09dd('0x33')](_0x361043,function(_0x20520a){return _0x20520a[_0x09dd('0x10d')](_0x09dd('0x90'))===_0x09dd('0x10e');});var _0x33d9d2=_[_0x09dd('0x24')](_0x126405,function(_0x337268){return db['UserVoiceQueueRt'][_0x09dd('0xa1')]({'membername':_0x215a42[_0x09dd('0x29')],'UserId':_0x215a42['id'],'queue_name':_0x337268[_0x09dd('0x29')],'VoiceQueueId':_0x337268['id'],'interface':_[_0x09dd('0x5c')](_0x215a42[_0x09dd('0x94')])?util['format']('SIP/%s',_0x215a42[_0x09dd('0x29')]):_0x215a42[_0x09dd('0x94')],'paused':_0x215a42[_0x09dd('0x93')]||![],'penalty':_0x215a42['penalty']},{'transaction':_0x46859d});});return Promise['all'](_0x33d9d2);})[_0x09dd('0x1c')](function(){return db[_0x09dd('0x10f')][_0x09dd('0x3f')]({'where':{'teamId':{'$in':_0x4319fb}}});})[_0x09dd('0x1c')](function(_0x3ffeaf){var _0x1a7eb0=_[_0x09dd('0x24')](_0x3ffeaf,function(_0x53d0ff){return db['UserVoicePrefix'][_0x09dd('0x75')]({'UserId':_0x215a42['id'],'VoicePrefixId':_0x53d0ff[_0x09dd('0x110')]},{'transaction':_0x46859d});});return Promise[_0x09dd('0x4a')](_0x1a7eb0);});});})[_0x09dd('0x1c')](function(){for(var _0x1de9ac=0x0;_0x1de9ac<_0x361043['length'];_0x1de9ac++){var _0x3994d9=_0x361043[_0x1de9ac][_0x09dd('0x10d')]('channel');var _0x224cba=_0x3994d9+_0x09dd('0x9b');socket['emit'](_0x09dd('0x1f')+_0x3994d9+_0x09dd('0x9c'),{'UserId':_0x5af999,['queueField']:_0x361043[_0x1de9ac]['id']});}})[_0x09dd('0x1c')](respondWithStatusCode(_0x2bbcac,null))[_0x09dd('0x51')](APIHandleError(_0x2bbcac));};exports[_0x09dd('0x111')]=function(_0x4c1ec3,_0x3a7a4f){var _0x4385c7=_0x4c1ec3[_0x09dd('0x4c')]['id'];var _0x4fd638=null;if(_0x4c1ec3[_0x09dd('0x3a')]['ids']){_0x4fd638=_[_0x09dd('0xa5')](_0x4c1ec3[_0x09dd('0x3a')][_0x09dd('0x56')])?_0x4c1ec3[_0x09dd('0x3a')]['ids']:[_0x4c1ec3['query']['ids']];}var _0x274be0=[];return Promise[_0x09dd('0xfe')]()[_0x09dd('0x1c')](function(){if(!_0x4fd638)throw new APIBadRequestError(_0x09dd('0x112'));})[_0x09dd('0x1c')](function(){return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0x4385c7}});})[_0x09dd('0x1c')](function(_0xe0717b){if(!_0xe0717b)throw new APINotFoundError(util['format'](_0x09dd('0xbf'),_0x4c1ec3[_0x09dd('0x4c')]['id']));return db[_0x09dd('0x10b')]['transaction'](function(_0x560996){return _0xe0717b[_0x09dd('0x111')](_0x4fd638,{'transaction':_0x560996})[_0x09dd('0x1c')](function(){return db['Team'][_0x09dd('0x3f')]({'where':{'id':{'$in':_0x4fd638}}});})[_0x09dd('0x1c')](function(_0x53aafa){var _0x66ce64=_[_0x09dd('0x24')](_0x53aafa,function(_0x3efb7a){return _0x3efb7a[_0x09dd('0x113')]();});return Promise[_0x09dd('0x4a')](_0x66ce64);})[_0x09dd('0x1c')](function(_0x1d9af1){_0x274be0=_[_0x09dd('0x114')](_0x1d9af1);var _0x330b84=_['map'](_0x274be0,function(_0x18a2c5){return _0x18a2c5[_0x09dd('0x115')](_0xe0717b['id'],{'transaction':_0x560996});});return Promise[_0x09dd('0x4a')](_0x330b84);})[_0x09dd('0x1c')](function(){if(!_0xe0717b[_0x09dd('0x91')])return;var _0x1a0668=_[_0x09dd('0x33')](_0x274be0,function(_0xc41976){return _0xc41976[_0x09dd('0x10d')](_0x09dd('0x90'))===_0x09dd('0x10e');});var _0x302e20=_['map'](_0x1a0668,function(_0x181ad0){return db[_0x09dd('0xa0')][_0x09dd('0x1b')]({'where':{'VoiceQueueId':_0x181ad0['id'],'UserId':_0xe0717b['id']},'transaction':_0x560996});});return Promise[_0x09dd('0x4a')](_0x302e20);})['then'](function(){return db[_0x09dd('0x10f')][_0x09dd('0x3f')]({'where':{'teamId':{'$in':_0x4fd638}}});})[_0x09dd('0x1c')](function(_0x10229c){var _0x1847d7=_[_0x09dd('0x24')](_0x10229c,function(_0x35745a){return db[_0x09dd('0x116')][_0x09dd('0x1b')]({'where':{'UserId':_0xe0717b['id'],'VoicePrefixId':_0x35745a[_0x09dd('0x110')]}},{'transaction':_0x560996});});return Promise[_0x09dd('0x4a')](_0x1847d7);});});})[_0x09dd('0x1c')](function(){for(var _0x3ee2b9=0x0;_0x3ee2b9<_0x274be0[_0x09dd('0x42')];_0x3ee2b9++){var _0xf3a03b=_0x274be0[_0x3ee2b9][_0x09dd('0x10d')](_0x09dd('0x90'));var _0x471300=_0xf3a03b+'QueueId';socket[_0x09dd('0x1a')](_0x09dd('0x1f')+_0xf3a03b+'Queue:remove',{'UserId':_0x4385c7,['queueField']:_0x274be0[_0x3ee2b9]['id']});}})['then'](respondWithStatusCode(_0x3a7a4f,null))[_0x09dd('0x51')](APIHandleError(_0x3a7a4f));};exports['getLists']=function(_0xdce8d,_0x50790c){var _0x3eafc9={};var _0x1e94e6={};var _0x46f257;var _0x42d4eb;return db[_0x09dd('0x2e')]['findOne']({'where':{'id':_0xdce8d['params']['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x50790c,null))[_0x09dd('0x1c')](function(_0x4cf7a1){if(_0x4cf7a1){_0x46f257=_0x4cf7a1;_0x1e94e6[_0x09dd('0xd2')]=_[_0x09dd('0xc7')](db[_0x09dd('0xc1')][_0x09dd('0x2f')]);_0x1e94e6[_0x09dd('0x3a')]=_[_0x09dd('0xc7')](_0xdce8d[_0x09dd('0x3a')]);_0x1e94e6[_0x09dd('0xc9')]=_[_0x09dd('0xca')](_0x1e94e6[_0x09dd('0xd2')],_0x1e94e6['query']);_0x3eafc9[_0x09dd('0x3e')]=_['intersection'](_0x1e94e6[_0x09dd('0xd2')],qs['fields'](_0xdce8d['query']['fields']));_0x3eafc9[_0x09dd('0x3e')]=_0x3eafc9[_0x09dd('0x3e')]['length']?_0x3eafc9[_0x09dd('0x3e')]:_0x1e94e6[_0x09dd('0xd2')];_0x3eafc9['order']=qs[_0x09dd('0xcd')](_0xdce8d[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x3eafc9['where']=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0xdce8d['query'],_0x1e94e6[_0x09dd('0xc9')]));if(_0xdce8d[_0x09dd('0x3a')][_0x09dd('0x33')]){_0x3eafc9[_0x09dd('0xce')]=_['merge'](_0x3eafc9[_0x09dd('0xce')],{'$or':_['map'](_0x3eafc9[_0x09dd('0x3e')],function(_0x3e4f28){var _0x301fc6={};_0x301fc6[_0x3e4f28]={'$like':'%'+_0xdce8d[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x301fc6;})});}_0x3eafc9=_[_0x09dd('0x4f')]({},_0x3eafc9,_0xdce8d[_0x09dd('0xd4')]);return _0x46f257[_0x09dd('0x117')](_0x3eafc9);}})[_0x09dd('0x1c')](function(_0x1aa5f7){if(_0x1aa5f7){_0x42d4eb=_0x1aa5f7[_0x09dd('0x42')];if(!_0xdce8d[_0x09dd('0x3a')][_0x09dd('0xc0')]('nolimit')){_0x3eafc9[_0x09dd('0x18')]=qs[_0x09dd('0x18')](_0xdce8d[_0x09dd('0x3a')][_0x09dd('0x18')]);_0x3eafc9[_0x09dd('0x16')]=qs[_0x09dd('0x16')](_0xdce8d['query'][_0x09dd('0x16')]);}return _0x46f257[_0x09dd('0x117')](_0x3eafc9);}})[_0x09dd('0x1c')](function(_0x2b88fe){if(_0x2b88fe){return _0x2b88fe?{'count':_0x42d4eb,'rows':_0x2b88fe}:null;}})[_0x09dd('0x1c')](respondWithResult(_0x50790c,null))[_0x09dd('0x51')](handleError(_0x50790c,null));};exports[_0x09dd('0x118')]=function(_0x2eb5d3,_0x1304c0){var _0x43d4ed={};var _0xb3f5b2={};var _0x2f9fd1;return db['User'][_0x09dd('0xbe')]({'where':{'id':_0x2eb5d3['params']['id']}})[_0x09dd('0x1c')](handleEntityNotFound(_0x1304c0,null))['then'](function(_0xca489f){if(_0xca489f){_0x2f9fd1=_0xca489f;_0xb3f5b2['model']=_[_0x09dd('0xc7')](db[_0x09dd('0x2e')][_0x09dd('0x2f')]);_0xb3f5b2['query']=_[_0x09dd('0xc7')](_0x2eb5d3[_0x09dd('0x3a')]);_0xb3f5b2[_0x09dd('0xc9')]=_[_0x09dd('0xca')](_0xb3f5b2[_0x09dd('0xd2')],_0xb3f5b2[_0x09dd('0x3a')]);_0x43d4ed[_0x09dd('0x3e')]=_[_0x09dd('0xca')](_0xb3f5b2['model'],qs['fields'](_0x2eb5d3[_0x09dd('0x3a')][_0x09dd('0xcb')]));_0x43d4ed[_0x09dd('0x3e')]=_0x43d4ed[_0x09dd('0x3e')][_0x09dd('0x42')]?_0x43d4ed[_0x09dd('0x3e')]:_0xb3f5b2[_0x09dd('0xd2')];_0x43d4ed[_0x09dd('0xcc')]=qs[_0x09dd('0xcd')](_0x2eb5d3[_0x09dd('0x3a')][_0x09dd('0xcd')]);_0x43d4ed[_0x09dd('0xce')]=qs[_0x09dd('0xc9')](_[_0x09dd('0xd3')](_0x2eb5d3['query'],_0xb3f5b2['filters']));if(_0x2eb5d3['query'][_0x09dd('0x33')]){_0x43d4ed[_0x09dd('0xce')]=_[_0x09dd('0x4f')](_0x43d4ed[_0x09dd('0xce')],{'$or':_['map'](_0x43d4ed['attributes'],function(_0xc0116d){var _0x48a539={};_0x48a539[_0xc0116d]={'$like':'%'+_0x2eb5d3[_0x09dd('0x3a')][_0x09dd('0x33')]+'%'};return _0x48a539;})});}_0x43d4ed[_0x09dd('0xd2')]=db[_0x09dd('0x2e')];_0x43d4ed['as']=_0x09dd('0x20');_0x43d4ed=_[_0x09dd('0x4f')]({},_0x43d4ed,_0x2eb5d3[_0x09dd('0xd4')]);return _0x2f9fd1[_0x09dd('0xf3')]({'include':[_0x43d4ed]});}})['then'](function(_0x1f4c74){if(_0x1f4c74){var _0x288324={},_0x382a8d=[];for(var _0x51add2=0x0;_0x51add2<_0x1f4c74[_0x09dd('0x42')];_0x51add2+=0x1){for(var _0x32422b=0x0,_0x58c567;_0x32422b<_0x1f4c74[_0x51add2][_0x09dd('0x20')]['length'];_0x32422b+=0x1){_0x58c567=_0x1f4c74[_0x51add2][_0x09dd('0x20')][_0x32422b][_0x09dd('0x1d')]({'plain':!![]});_0x288324[_0x58c567['id']]=_0x58c567;}}_0x288324=_['values'](_0x288324);for(var _0x54b741=qs[_0x09dd('0x16')](_0x2eb5d3['query'][_0x09dd('0x16')]);_0x54b741<_0x288324['length']&&_0x382a8d['length']=_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')]=_0x4695bb[_0x2f10('0x4c')]){throw new Error(_0x2f10('0x4d'));}})['then'](function(){if(_0x2f7f43){return db[_0x2f10('0x44')]['destroy']({'where':{'membername':_0x2f7f43[_0x2f10('0x2e')]},'individualHooks':!![]});}})[_0x2f10('0x18')](function(){if(_0x2f7f43){return _0x2f7f43[_0x2f10('0x4e')]({'raw':!![]});}})[_0x2f10('0x18')](function(_0xd51d8b){if(_0x2f7f43){if(_0xd51d8b){var _0x32f17b=[];_0x54fa01=_0xd51d8b;if(_0x54fa01[_0x2f10('0x2a')]){for(var _0x2a94bb=0x0;_0x2a94bb<_0x54fa01[_0x2f10('0x2a')];_0x2a94bb++){_0x32f17b['push'](db['UserVoiceQueueRt'][_0x2f10('0x4f')]({'membername':_0x2f7f43[_0x2f10('0x2e')],'UserId':_0x2f7f43['id'],'queue_name':_0x54fa01[_0x2a94bb][_0x2f10('0x2e')],'VoiceQueueId':_0x54fa01[_0x2a94bb]['id'],'interface':_0x41c3f4,'paused':_0x2f7f43['loginInPause']||![],'penalty':_0x54fa01[_0x2a94bb][_0x2f10('0x50')]||0x0}));}return BPromise[_0x2f10('0x45')](_0x32f17b);}}}})['then'](function(){if(_0x2f7f43){return db[_0x2f10('0x28')][_0x2f10('0x10')]({'where':{'membername':_0x2f7f43[_0x2f10('0x2e')],'exitAt':null}});}})[_0x2f10('0x18')](function(_0x374110){if(_0x2f7f43){if(_0x374110&&_0x374110[_0x2f10('0x2a')]){var _0x2b0253=[];_0x374110['forEach'](function(_0x35d4c4){_0x2b0253['push'](_0x35d4c4[_0x2f10('0x27')]({'exitAt':moment()[_0x2f10('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x2f10('0x45')](_0x2b0253);}}})[_0x2f10('0x18')](function(){if(_0x2f7f43){var _0x41c78c=[];var _0x2ba4fd=[];var _0x8fc340=utils[_0x2f10('0x51')]();var _0x4ac004={'membername':_0x2f7f43[_0x2f10('0x2e')],'interface':_0x41c3f4,'enterAt':moment()[_0x2f10('0x26')](_0x2f10('0x2b')),'role':_0x2f7f43[_0x2f10('0x23')],'internal':_0x2f7f43[_0x2f10('0x24')]};_0x8fc340[_0x2f10('0x52')](function(_0x45345e){_0x41c78c[_0x2f10('0x2d')](_['merge']({'channel':_0x45345e,'type':_0x2f10('0x53'),'data1':_0x2f10('0x54'),'data2':_0x41c3f4},_0x4ac004));if(_0x2f7f43['loginInPause']){_0x2ba4fd['push'](_[_0x2f10('0x55')]({'channel':_0x45345e,'type':_0x2f10('0x29'),'data1':'LOGININPAUSE'},_0x4ac004));}});return db[_0x2f10('0x28')][_0x2f10('0x34')](_0x41c78c[_0x2f10('0x56')](_0x2ba4fd),{'individualHooks':!![]});}})[_0x2f10('0x18')](function(){if(_0x2f7f43){return _0x2f7f43['update']({'online':!![],'lastLoginAt':moment()[_0x2f10('0x26')](_0x2f10('0x2b')),'voicePause':_0x2f7f43['loginInPause']||![],'mailPause':_0x2f7f43[_0x2f10('0x48')]||![],'chatPause':_0x2f7f43[_0x2f10('0x48')]||![],'faxPause':_0x2f7f43[_0x2f10('0x48')]||![],'smsPause':_0x2f7f43['loginInPause']||![],'openchannelPause':_0x2f7f43[_0x2f10('0x48')]||![],'pauseType':_0x2f7f43[_0x2f10('0x48')]?_0x2f10('0x57'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x41c3f4});}})[_0x2f10('0x18')](function(_0x379863){_0x5b4971(_0x379863);})[_0x2f10('0x1b')](function(_0x3293ca){_0x4ae301(_0x169f04[_0x2f10('0x1c')](0x1f4,_0x3293ca[_0x2f10('0x1d')]));});});}; \ No newline at end of file +var _0x91bd=['updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','unpause','system','LogoutUser','UserVoiceQueueRt','all','LoginUser','mobile','phone','loginInPause','agent','agents','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','register','User','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','GetUser','stringify','catch','error','message','find','then','ShowUser','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','length'];(function(_0xf96d48,_0x31fca0){var _0xfa9c00=function(_0x5a9453){while(--_0x5a9453){_0xf96d48['push'](_0xf96d48['shift']());}};_0xfa9c00(++_0x31fca0);}(_0x91bd,0x82));var _0xd91b=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x91bd[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0xd91b('0x0'));var moment=require(_0xd91b('0x1'));var BPromise=require(_0xd91b('0x2'));var Redis=require('ioredis');var db=require(_0xd91b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd91b('0x4'))('rpc');var config=require(_0xd91b('0x5'));config['redis']=_[_0xd91b('0x6')](config[_0xd91b('0x7')],{'host':_0xd91b('0x8'),'port':0x18eb});var socket=require(_0xd91b('0x9'))(new Redis(config['redis']));require(_0xd91b('0xa'))[_0xd91b('0xb')](socket);exports['GetUser']=function(_0x3050a1){var _0x107800=this;return new Promise(function(_0x186de5,_0x54e0ca){return db[_0xd91b('0xc')][_0xd91b('0xd')]({'raw':_0x3050a1[_0xd91b('0xe')]?_0x3050a1[_0xd91b('0xe')][_0xd91b('0xf')]===undefined?!![]:![]:!![],'where':_0x3050a1[_0xd91b('0xe')]?_0x3050a1[_0xd91b('0xe')][_0xd91b('0x10')]||null:null,'attributes':_0x3050a1[_0xd91b('0xe')]?_0x3050a1[_0xd91b('0xe')][_0xd91b('0x11')]||null:null,'limit':_0x3050a1[_0xd91b('0xe')]?_0x3050a1[_0xd91b('0xe')][_0xd91b('0x12')]||null:null,'include':_0x3050a1['options']?_0x3050a1[_0xd91b('0xe')][_0xd91b('0x13')]?_[_0xd91b('0x14')](_0x3050a1[_0xd91b('0xe')][_0xd91b('0x13')],function(_0x1733c1){return{'model':db[_0x1733c1[_0xd91b('0x15')]],'as':_0x1733c1['as'],'attributes':_0x1733c1['attributes'],'include':_0x1733c1['include']?_[_0xd91b('0x14')](_0x1733c1['include'],function(_0x2c3a99){return{'model':db[_0x2c3a99[_0xd91b('0x15')]],'as':_0x2c3a99['as'],'attributes':_0x2c3a99[_0xd91b('0x11')],'include':_0x2c3a99[_0xd91b('0x13')]?_[_0xd91b('0x14')](_0x2c3a99[_0xd91b('0x13')],function(_0x3b3da2){return{'model':db[_0x3b3da2['model']],'as':_0x3b3da2['as'],'attributes':_0x3b3da2[_0xd91b('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16bb41){logger[_0xd91b('0x16')]('GetUser',_0x3050a1);logger[_0xd91b('0x17')](_0xd91b('0x18'),_0x3050a1,JSON[_0xd91b('0x19')](_0x16bb41));_0x186de5(_0x16bb41);})[_0xd91b('0x1a')](function(_0x44407c){logger[_0xd91b('0x1b')](_0xd91b('0x18'),_0x44407c[_0xd91b('0x1c')],_0x3050a1);_0x54e0ca(_0x107800[_0xd91b('0x1b')](0x1f4,_0x44407c[_0xd91b('0x1c')]));});});};exports['ShowUser']=function(_0x2ff80f){var _0x5bfc4e=this;return new Promise(function(_0x1e9447,_0x1ba04c){return db['User'][_0xd91b('0x1d')]({'raw':_0x2ff80f[_0xd91b('0xe')]?_0x2ff80f['options'][_0xd91b('0xf')]===undefined?!![]:![]:!![],'where':_0x2ff80f[_0xd91b('0xe')]?_0x2ff80f[_0xd91b('0xe')][_0xd91b('0x10')]||null:null,'attributes':_0x2ff80f[_0xd91b('0xe')]?_0x2ff80f[_0xd91b('0xe')][_0xd91b('0x11')]||null:null,'include':_0x2ff80f[_0xd91b('0xe')]?_0x2ff80f[_0xd91b('0xe')][_0xd91b('0x13')]?_[_0xd91b('0x14')](_0x2ff80f[_0xd91b('0xe')]['include'],function(_0x244d05){return{'model':db[_0x244d05[_0xd91b('0x15')]],'as':_0x244d05['as'],'attributes':_0x244d05[_0xd91b('0x11')],'include':_0x244d05[_0xd91b('0x13')]?_['map'](_0x244d05[_0xd91b('0x13')],function(_0x51ed22){return{'model':db[_0x51ed22[_0xd91b('0x15')]],'as':_0x51ed22['as'],'attributes':_0x51ed22[_0xd91b('0x11')],'include':_0x51ed22[_0xd91b('0x13')]?_[_0xd91b('0x14')](_0x51ed22[_0xd91b('0x13')],function(_0x1d5e18){return{'model':db[_0x1d5e18['model']],'as':_0x1d5e18['as'],'attributes':_0x1d5e18[_0xd91b('0x11')]};}):[]};}):[]};}):[]:[]})[_0xd91b('0x1e')](function(_0x7d83ed){logger['info'](_0xd91b('0x1f'),_0x2ff80f);logger[_0xd91b('0x17')]('ShowUser',_0x2ff80f,JSON['stringify'](_0x7d83ed));_0x1e9447(_0x7d83ed);})[_0xd91b('0x1a')](function(_0xc7dbda){logger[_0xd91b('0x1b')](_0xd91b('0x1f'),_0xc7dbda[_0xd91b('0x1c')],_0x2ff80f);_0x1ba04c(_0x5bfc4e['error'](0x1f4,_0xc7dbda[_0xd91b('0x1c')]));});});};exports[_0xd91b('0x20')]=function(_0x2b9fc8){var _0x31e611;return db['User']['find']({'where':_0x2b9fc8[_0xd91b('0xe')][_0xd91b('0x10')]||{},'attributes':['id',_0xd91b('0x21'),_0xd91b('0x22'),_0xd91b('0x23'),_0xd91b('0x24')]})['then'](function(_0x328feb){if(!_0x328feb){throw new Error(util[_0xd91b('0x25')](_0xd91b('0x26'),_0x2b9fc8[_0xd91b('0x27')]['id']));}_0x31e611=_0x328feb;return db['UserVoiceQueueRt'][_0xd91b('0x28')]({'paused':0x1},{'where':{'UserId':_0x31e611['id']},'individualHooks':!![]});})[_0xd91b('0x1e')](function(){return db[_0xd91b('0x29')]['findAll']({'where':{'membername':_0x31e611['name'],'type':_0xd91b('0x2a'),'exitAt':null}});})[_0xd91b('0x1e')](function(_0x400192){if(_0x400192&&_0x400192['length']){var _0x13c6ea=moment()[_0xd91b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x46b561=0x0,_0x5124dd=_0x400192[_0xd91b('0x2b')];_0x46b561<_0x5124dd;_0x46b561++){_0x400192[_0x46b561][_0xd91b('0x2c')]({'exitAt':_0x13c6ea});}}})['then'](function(){var _0x3f0a78=[];var _0x3a64ba=utils[_0xd91b('0x2d')]();_0x3a64ba[_0xd91b('0x2e')](function(_0x3699de){_0x3f0a78[_0xd91b('0x2f')]({'channel':_0x3699de,'membername':_0x31e611[_0xd91b('0x21')],'interface':_[_0xd91b('0x30')](_0x31e611[_0xd91b('0x24')])?util[_0xd91b('0x25')](_0xd91b('0x31'),_0x31e611[_0xd91b('0x21')]):_0x31e611['interface'],'type':_0xd91b('0x2a'),'enterAt':moment()[_0xd91b('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2b9fc8[_0xd91b('0x32')][_0xd91b('0x33')]||_0xd91b('0x34'),'role':_0x31e611[_0xd91b('0x22')],'internal':_0x31e611['internal'],'uniqueid':_0x2b9fc8['body'][_0xd91b('0x35')]||null});});return db[_0xd91b('0x29')][_0xd91b('0x36')](_0x3f0a78,{'individualHooks':!![]});})['then'](function(){return _0x31e611['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2b9fc8['body'][_0xd91b('0x33')]||_0xd91b('0x34'),'lastPauseAt':moment()[_0xd91b('0x25')](_0xd91b('0x37'))});})[_0xd91b('0x1a')](function(_0x58d5bd){throw _0x58d5bd;});};exports[_0xd91b('0x38')]=function(_0x4d27c7){return Promise[_0xd91b('0x39')]()[_0xd91b('0x1e')](function(){if(_0x4d27c7['body'][_0xd91b('0x3a')]&&!utils[_0xd91b('0x3b')](_0x4d27c7[_0xd91b('0x32')]['channel'])){throw new Error(util[_0xd91b('0x25')](_0xd91b('0x3c'),_0x4d27c7[_0xd91b('0x32')][_0xd91b('0x3a')]));}return db[_0xd91b('0xc')][_0xd91b('0x3d')]({'where':_0x4d27c7['options'][_0xd91b('0x10')]||{},'attributes':['id',_0xd91b('0x21'),_0xd91b('0x22'),_0xd91b('0x23'),_0xd91b('0x24'),_0xd91b('0x3e'),_0xd91b('0x3f'),'mailPause',_0xd91b('0x40'),'faxPause',_0xd91b('0x41'),_0xd91b('0x42'),_0xd91b('0x43'),'pauseType',_0xd91b('0x44')]});})['then'](function(_0x1a6382){if(!_0x1a6382){throw new Error(util['format'](_0xd91b('0x26'),_0x4d27c7[_0xd91b('0x27')]['id']));}return _0x1a6382[_0xd91b('0x45')](_0x4d27c7['body'][_0xd91b('0x3a')],_0xd91b('0x46'));})[_0xd91b('0x1a')](function(_0x2f04ca){throw _0x2f04ca;});};exports[_0xd91b('0x47')]=function(_0xdfdc5e){var _0x1f3de2=this;return new Promise(function(_0x3f70a5,_0x32730d){var _0x2da825;return db[_0xd91b('0xc')][_0xd91b('0x3d')]({'where':_0xdfdc5e['options'][_0xd91b('0x10')]||{},'attributes':['id',_0xd91b('0x21')]})['then'](function(_0x12b2d7){if(_0x12b2d7){_0x2da825=_0x12b2d7;return db[_0xd91b('0x48')]['destroy']({'where':{'membername':_0x2da825[_0xd91b('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x2da825){return db[_0xd91b('0x29')][_0xd91b('0xd')]({'where':{'membername':_0x2da825['name'],'exitAt':null}});}})[_0xd91b('0x1e')](function(_0x34baca){if(_0x2da825){if(_0x34baca&&_0x34baca['length']){var _0x25f596=[];_0x34baca[_0xd91b('0x2e')](function(_0x3f7e06){_0x25f596[_0xd91b('0x2f')](_0x3f7e06[_0xd91b('0x28')]({'exitAt':moment()[_0xd91b('0x25')](_0xd91b('0x37'))}));});return BPromise[_0xd91b('0x49')](_0x25f596);}}})[_0xd91b('0x1e')](function(){if(_0x2da825){return _0x2da825[_0xd91b('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd91b('0x1e')](function(_0x43d71c){_0x3f70a5(_0x43d71c);})[_0xd91b('0x1a')](function(_0x395591){_0x32730d(_0x1f3de2[_0xd91b('0x1b')](0x1f4,_0x395591['message']));});});};exports[_0xd91b('0x4a')]=function(_0x15d8db){var _0xaf12cb=this;return new Promise(function(_0x3a2db2,_0x491879){var _0x5c3623;var _0x185402;var _0x453ee3;var _0x54934a;return db[_0xd91b('0xc')][_0xd91b('0x3d')]({'where':_0x15d8db[_0xd91b('0xe')]['where']||{},'attributes':['id',_0xd91b('0x21'),'role',_0xd91b('0x4b'),_0xd91b('0x4c'),_0xd91b('0x23'),_0xd91b('0x4d'),'interface']})[_0xd91b('0x1e')](function(_0x25edf9){if(_0x25edf9){_0x5c3623=_0x25edf9;_0x54934a=_0x15d8db['body'][_0xd91b('0x24')]?_0x15d8db['body'][_0xd91b('0x24')]:util['format'](_0xd91b('0x31'),_0x5c3623[_0xd91b('0x21')]);return db[_0xd91b('0xc')]['count']({'where':{'role':_0xd91b('0x4e'),'online':!![],'id':{'$ne':_0x5c3623['id']}}});}})[_0xd91b('0x1e')](function(_0x5c4bf5){if(_0x5c4bf5){_0x453ee3=_0x5c4bf5;return require('../../config/license/util')['getLicense']();}})['then'](function(_0x5b4ca0){if(_0x5b4ca0&&_0x5b4ca0[_0xd91b('0x4f')]&&_0x453ee3>=_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 diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d048624..0ad528d 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 _0xa9ec=['user:','save','remove','update','emit','removeListener','register'];(function(_0x463867,_0xe878b7){var _0x4bef07=function(_0x15120f){while(--_0x15120f){_0x463867['push'](_0x463867['shift']());}};_0x4bef07(++_0xe878b7);}(_0xa9ec,0x94));var _0xca9e=function(_0x3c0ccd,_0x1e1335){_0x3c0ccd=_0x3c0ccd-0x0;var _0x23231c=_0xa9ec[_0x3c0ccd];return _0x23231c;};'use strict';var UserEvents=require('./user.events');var events=[_0xca9e('0x0'),_0xca9e('0x1'),_0xca9e('0x2')];function createListener(_0x138195,_0xe8996a){return function(_0x3e4df1){_0xe8996a[_0xca9e('0x3')](_0x138195,_0x3e4df1);};}function removeListener(_0x1947aa,_0x3cd9c2){return function(){UserEvents[_0xca9e('0x4')](_0x1947aa,_0x3cd9c2);};}exports[_0xca9e('0x5')]=function(_0x5e0bb7){for(var _0x1c0c7d=0x0,_0x1fc797=events['length'];_0x1c0c7d<_0x1fc797;_0x1c0c7d++){var _0x10f004=events[_0x1c0c7d];var _0xa3bb97=createListener(_0xca9e('0x6')+_0x10f004,_0x5e0bb7);UserEvents['on'](_0x10f004,_0xa3bb97);}}; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3a758fc..6c35cae 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3dc16d,_0x533e52){var _0x4655c3=function(_0x1a11f8){while(--_0x1a11f8){_0x3dc16d['push'](_0x3dc16d['shift']());}};_0x4655c3(++_0x533e52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 _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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 78ecc86..ab38a6a 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 _0x00b3=['sequelize'];(function(_0x76c613,_0xe052b5){var _0x4b95e5=function(_0x52784d){while(--_0x52784d){_0x76c613['push'](_0x76c613['shift']());}};_0x4b95e5(++_0xe052b5);}(_0x00b3,0x97));var _0x300b=function(_0x52ff96,_0x3c42fc){_0x52ff96=_0x52ff96-0x0;var _0x15094f=_0x00b3[_0x52ff96];return _0x15094f;};'use strict';var Sequelize=require(_0x300b('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0189d28..f33d3b8 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 _0xe3b9=['define','UserChatQueue','util','../../config/logger','moment','request-promise','path','rimraf','./userChatQueue.attributes','exports'];(function(_0x4fca73,_0x5cfb22){var _0x94e3cd=function(_0x1196c5){while(--_0x1196c5){_0x4fca73['push'](_0x4fca73['shift']());}};_0x94e3cd(++_0x5cfb22);}(_0xe3b9,0x11a));var _0x9e3b=function(_0x4d07a5,_0x3fb541){_0x4d07a5=_0x4d07a5-0x0;var _0x50a8c5=_0xe3b9[_0x4d07a5];return _0x50a8c5;};'use strict';var _=require('lodash');var util=require(_0x9e3b('0x0'));var logger=require(_0x9e3b('0x1'))('api');var moment=require(_0x9e3b('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e3b('0x3'));var fs=require('fs');var path=require(_0x9e3b('0x4'));var rimraf=require(_0x9e3b('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e3b('0x6'));module[_0x9e3b('0x7')]=function(_0x3b5b62,_0x146d40){return _0x3b5b62[_0x9e3b('0x8')](_0x9e3b('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 5c8cda1..0adbfd1 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 _0xb677=['http','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserChatQueue,\x20%s,\x20%s','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2d20b8,_0x3ac9fb){var _0x41e600=function(_0x3bde50){while(--_0x3bde50){_0x2d20b8['push'](_0x2d20b8['shift']());}};_0x41e600(++_0x3ac9fb);}(_0xb677,0x183));var _0x7b67=function(_0x4ce8aa,_0x5074ad){_0x4ce8aa=_0x4ce8aa-0x0;var _0x507920=_0xb677[_0x4ce8aa];return _0x507920;};'use strict';var _=require(_0x7b67('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b67('0x1'));var rs=require(_0x7b67('0x2'));var fs=require('fs');var Redis=require(_0x7b67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b67('0x4'));var logger=require(_0x7b67('0x5'))(_0x7b67('0x6'));var config=require('../../config/environment');var jayson=require(_0x7b67('0x7'));var client=jayson[_0x7b67('0x8')][_0x7b67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x163201,_0xe86dd4,_0x50bf7b){return new BPromise(function(_0x41a9c2,_0x28c84f){return client['request'](_0x163201,_0x50bf7b)[_0x7b67('0xa')](function(_0x593870){logger[_0x7b67('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xe86dd4,_0x7b67('0xc'));logger[_0x7b67('0xd')](_0x7b67('0xe'),_0xe86dd4,_0x7b67('0xc'),JSON[_0x7b67('0xf')](_0x593870));if(_0x593870[_0x7b67('0x10')]){if(_0x593870['error'][_0x7b67('0x11')]===0x1f4){logger[_0x7b67('0x10')]('UserChatQueue,\x20%s,\x20%s',_0xe86dd4,_0x593870[_0x7b67('0x10')][_0x7b67('0x12')]);return _0x28c84f(_0x593870[_0x7b67('0x10')][_0x7b67('0x12')]);}logger[_0x7b67('0x10')]('UserChatQueue,\x20%s,\x20%s',_0xe86dd4,_0x593870['error']['message']);return _0x41a9c2(_0x593870[_0x7b67('0x10')][_0x7b67('0x12')]);}else{logger[_0x7b67('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xe86dd4,'request\x20sent');_0x41a9c2(_0x593870[_0x7b67('0x13')][_0x7b67('0x12')]);}})[_0x7b67('0x14')](function(_0x1ee263){logger[_0x7b67('0x10')](_0x7b67('0x15'),_0xe86dd4,_0x1ee263);_0x28c84f(_0x1ee263);});});} \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 4aa6bab..64620c9 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5a501f,_0x49d4e9){var _0x42f5c8=function(_0x589372){while(--_0x589372){_0x5a501f['push'](_0x5a501f['shift']());}};_0x42f5c8(++_0x49d4e9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0xcb91[_0x20aadb];return _0x520018;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_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 diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ab089c2..a6eac52 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 _0x8883=['INTEGER','STRING'];(function(_0x5d2127,_0x4f7875){var _0x2794bb=function(_0x1e24f1){while(--_0x1e24f1){_0x5d2127['push'](_0x5d2127['shift']());}};_0x2794bb(++_0x4f7875);}(_0x8883,0x8c));var _0x3888=function(_0x4dd712,_0x418c7e){_0x4dd712=_0x4dd712-0x0;var _0xd949af=_0x8883[_0x4dd712];return _0xd949af;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3888('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3888('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0242725..f5ac4d1 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 _0x2412=['moment','bluebird','path','../../config/environment','exports','user_has_fax_queues','lodash','util','../../config/logger','api'];(function(_0x1f455a,_0xa0dbbb){var _0x3aa220=function(_0x33a93a){while(--_0x33a93a){_0x1f455a['push'](_0x1f455a['shift']());}};_0x3aa220(++_0xa0dbbb);}(_0x2412,0x6a));var _0x2241=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2412[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2241('0x0'));var util=require(_0x2241('0x1'));var logger=require(_0x2241('0x2'))(_0x2241('0x3'));var moment=require(_0x2241('0x4'));var BPromise=require(_0x2241('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2241('0x6'));var rimraf=require('rimraf');var config=require(_0x2241('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x2241('0x8')]=function(_0x2ff155,_0x3a1fa2){return _0x2ff155['define']('UserFaxQueue',attributes,{'tableName':_0x2241('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b3267a2..6bfa9a3 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 _0x7282=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0xe7eec8,_0x3d96ea){var _0x3ff523=function(_0x479361){while(--_0x479361){_0xe7eec8['push'](_0xe7eec8['shift']());}};_0x3ff523(++_0x3d96ea);}(_0x7282,0x135));var _0x2728=function(_0x31fb16,_0x262d15){_0x31fb16=_0x31fb16-0x0;var _0xc1998b=_0x7282[_0x31fb16];return _0xc1998b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2728('0x0'));var BPromise=require(_0x2728('0x1'));var rs=require(_0x2728('0x2'));var fs=require('fs');var Redis=require(_0x2728('0x3'));var db=require(_0x2728('0x4'))['db'];var utils=require(_0x2728('0x5'));var logger=require(_0x2728('0x6'))(_0x2728('0x7'));var config=require(_0x2728('0x8'));var jayson=require(_0x2728('0x9'));var client=jayson[_0x2728('0xa')][_0x2728('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b1e5b,_0x4cfac7,_0x2c062f){return new BPromise(function(_0x1b9fce,_0x4749dc){return client['request'](_0x5b1e5b,_0x2c062f)[_0x2728('0xc')](function(_0xafcd27){logger[_0x2728('0xd')](_0x2728('0xe'),_0x4cfac7,_0x2728('0xf'));logger[_0x2728('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4cfac7,_0x2728('0xf'),JSON[_0x2728('0x11')](_0xafcd27));if(_0xafcd27[_0x2728('0x12')]){if(_0xafcd27[_0x2728('0x12')][_0x2728('0x13')]===0x1f4){logger['error'](_0x2728('0xe'),_0x4cfac7,_0xafcd27[_0x2728('0x12')][_0x2728('0x14')]);return _0x4749dc(_0xafcd27[_0x2728('0x12')][_0x2728('0x14')]);}logger[_0x2728('0x12')](_0x2728('0xe'),_0x4cfac7,_0xafcd27[_0x2728('0x12')][_0x2728('0x14')]);return _0x1b9fce(_0xafcd27[_0x2728('0x12')][_0x2728('0x14')]);}else{logger[_0x2728('0xd')](_0x2728('0xe'),_0x4cfac7,_0x2728('0xf'));_0x1b9fce(_0xafcd27[_0x2728('0x15')]['message']);}})[_0x2728('0x16')](function(_0x3b18e7){logger[_0x2728('0x12')](_0x2728('0xe'),_0x4cfac7,_0x3b18e7);_0x4749dc(_0x3b18e7);});});} \ No newline at end of file +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 diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 53b2069..24a3db8 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4943f1,_0x8d3062){var _0x550608=function(_0x14d539){while(--_0x14d539){_0x4943f1['push'](_0x4943f1['shift']());}};_0x550608(++_0x8d3062);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0xcb91[_0x29bf80];return _0x932096;};'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(_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 diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d2f8262..9006424 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09d8=['INTEGER','exports'];(function(_0x2090e2,_0x3acb75){var _0x876db5=function(_0x2732e0){while(--_0x2732e0){_0x2090e2['push'](_0x2090e2['shift']());}};_0x876db5(++_0x3acb75);}(_0x09d8,0x91));var _0x809d=function(_0x144dba,_0xb5c8e1){_0x144dba=_0x144dba-0x0;var _0x45d653=_0x09d8[_0x144dba];return _0x45d653;};'use strict';var Sequelize=require('sequelize');module[_0x809d('0x0')]={'penalty':{'type':Sequelize[_0x809d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f86c6f4..2aee2f1 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 _0xf939=['rimraf','./userMailQueue.attributes','exports','UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x38fd87,_0x262802){var _0x1d694d=function(_0x5a3f8f){while(--_0x5a3f8f){_0x38fd87['push'](_0x38fd87['shift']());}};_0x1d694d(++_0x262802);}(_0xf939,0xeb));var _0x9f93=function(_0x3d1103,_0x4e2662){_0x3d1103=_0x3d1103-0x0;var _0x483955=_0xf939[_0x3d1103];return _0x483955;};'use strict';var _=require(_0x9f93('0x0'));var util=require(_0x9f93('0x1'));var logger=require(_0x9f93('0x2'))(_0x9f93('0x3'));var moment=require(_0x9f93('0x4'));var BPromise=require(_0x9f93('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f93('0x6'));var rimraf=require(_0x9f93('0x7'));var config=require('../../config/environment');var attributes=require(_0x9f93('0x8'));module[_0x9f93('0x9')]=function(_0x2baec8,_0x5a61fb){return _0x2baec8['define'](_0x9f93('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 0493d6a..c770ee2 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 _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(_0x42bd4f,_0x163027){var _0x3bd0e0=function(_0x4b5fb3){while(--_0x4b5fb3){_0x42bd4f['push'](_0x42bd4f['shift']());}};_0x3bd0e0(++_0x163027);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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 +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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index ad66421..1abbd7b 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 _0x3207=['connect-timeout','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','exports','path'];(function(_0x2de0ee,_0x575448){var _0x4bbb06=function(_0xa162ab){while(--_0xa162ab){_0x2de0ee['push'](_0x2de0ee['shift']());}};_0x4bbb06(++_0x575448);}(_0x3207,0x1c6));var _0x7320=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3207[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7320('0x0'));var timeout=require(_0x7320('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7320('0x2'));var config=require('../../config/environment');var controller=require(_0x7320('0x3'));router[_0x7320('0x4')]('/',auth[_0x7320('0x5')](),controller['sendUserNotification']);module[_0x7320('0x6')]=router; \ No newline at end of file +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 diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 12d3d67..62ec2bd 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 _0xabaf=['sequelize','exports','TEXT','BOOLEAN'];(function(_0x41a193,_0x298a45){var _0x56c29c=function(_0x2b5ea3){while(--_0x2b5ea3){_0x41a193['push'](_0x41a193['shift']());}};_0x56c29c(++_0x298a45);}(_0xabaf,0x84));var _0xfaba=function(_0x34a09c,_0x3af48c){_0x34a09c=_0x34a09c-0x0;var _0x551668=_0xabaf[_0x34a09c];return _0x551668;};'use strict';var Sequelize=require(_0xfaba('0x0'));module[_0xfaba('0x1')]={'body':{'type':Sequelize[_0xfaba('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xfaba('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xfaba('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 481bb33..1be1256 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 _0x492c=['model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','union','queue','replace','Queue','ids','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','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/logger','../../config/utils','../../config/environment','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Sequelize','faxqueue','mailqueue','smsqueue','voicequeue','team','user'];(function(_0x298b79,_0x38b705){var _0x2e6eac=function(_0xeab779){while(--_0xeab779){_0x298b79['push'](_0x298b79['shift']());}};_0x2e6eac(++_0x38b705);}(_0x492c,0x147));var _0xc492=function(_0x40edb1,_0x3a5d5c){_0x40edb1=_0x40edb1-0x0;var _0x349a6d=_0x492c[_0x40edb1];return _0x349a6d;};'use strict';var emlformat=require(_0xc492('0x0'));var rimraf=require(_0xc492('0x1'));var zipdir=require(_0xc492('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc492('0x3'));var moment=require('moment');var BPromise=require(_0xc492('0x4'));var Mustache=require(_0xc492('0x5'));var util=require(_0xc492('0x6'));var path=require(_0xc492('0x7'));var sox=require(_0xc492('0x8'));var csv=require(_0xc492('0x9'));var ejs=require(_0xc492('0xa'));var fs=require('fs');var fs_extra=require(_0xc492('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc492('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc492('0xd'));var toCsv=require(_0xc492('0x9'));var querystring=require(_0xc492('0xe'));var Papa=require(_0xc492('0xf'));var Redis=require(_0xc492('0x10'));var authService=require(_0xc492('0x11'));var qs=require(_0xc492('0x12'));var as=require(_0xc492('0x13'));var hardwareService=require(_0xc492('0x14'));var logger=require(_0xc492('0x15'))('api');var utils=require(_0xc492('0x16'));var config=require(_0xc492('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc492('0x18')](config['redis'],{'host':_0xc492('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc492('0x1a'))[_0xc492('0x1b')](socket);function respondWithStatusCode(_0x1d8241,_0x5c4d11){_0x5c4d11=_0x5c4d11||0xcc;return function(_0x2986e0){if(_0x2986e0){return _0x1d8241[_0xc492('0x1c')](_0x5c4d11);}return _0x1d8241[_0xc492('0x1d')](_0x5c4d11)[_0xc492('0x1e')]();};}function respondWithResult(_0x193bf1,_0xf8c431){_0xf8c431=_0xf8c431||0xc8;return function(_0x18c367){if(_0x18c367){return _0x193bf1['status'](_0xf8c431)[_0xc492('0x1f')](_0x18c367);}};}function respondWithFilteredResult(_0x1779a2,_0x490f49){return function(_0x3fe6a3){if(_0x3fe6a3){var _0x173efd=typeof _0x490f49[_0xc492('0x20')]==='undefined'&&typeof _0x490f49['limit']===_0xc492('0x21');var _0x2f31b2=_0x3fe6a3[_0xc492('0x22')];var _0x114e32=_0x173efd?0x0:_0x490f49[_0xc492('0x20')];var _0x1f17fd=_0x173efd?_0x3fe6a3[_0xc492('0x22')]:_0x490f49[_0xc492('0x20')]+_0x490f49[_0xc492('0x23')];var _0x57e695;if(_0x1f17fd>=_0x2f31b2){_0x1f17fd=_0x2f31b2;_0x57e695=0xc8;}else{_0x57e695=0xce;}_0x1779a2[_0xc492('0x1d')](_0x57e695);return _0x1779a2[_0xc492('0x24')](_0xc492('0x25'),_0x114e32+'-'+_0x1f17fd+'/'+_0x2f31b2)['json'](_0x3fe6a3);}return null;};}function patchUpdates(_0x1aff3e){return function(_0x1693bb){try{jsonpatch[_0xc492('0x26')](_0x1693bb,_0x1aff3e,!![]);}catch(_0x14bc72){return BPromise[_0xc492('0x27')](_0x14bc72);}return _0x1693bb[_0xc492('0x28')]();};}function saveUpdates(_0xf31262,_0x366d55){return function(_0x32fe33){if(_0x32fe33){return _0x32fe33[_0xc492('0x29')](_0xf31262)['then'](function(_0x277cd5){return _0x277cd5;});}return null;};}function removeEntity(_0x104b7e,_0xffab87){return function(_0x18c186){if(_0x18c186){return _0x18c186['destroy']()[_0xc492('0x2a')](function(){_0x104b7e[_0xc492('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xab53d7,_0x2f9e92){return function(_0x4bae21){if(!_0x4bae21){_0xab53d7['sendStatus'](0x194);}return _0x4bae21;};}function handleError(_0x1f2f03,_0x339d96){_0x339d96=_0x339d96||0x1f4;return function(_0x3ca86f){logger[_0xc492('0x2b')](_0x3ca86f['stack']);if(_0x3ca86f[_0xc492('0x2c')]){delete _0x3ca86f['name'];}_0x1f2f03[_0xc492('0x1d')](_0x339d96)[_0xc492('0x2d')](_0x3ca86f);};}exports[_0xc492('0x2e')]=function(_0x22a71b,_0x212a7a,_0x3089e3){if(!_0x22a71b[_0xc492('0x2f')]['hasOwnProperty'](_0xc492('0x30'))&&!_0x22a71b[_0xc492('0x2f')][_0xc492('0x31')](_0xc492('0x32'))){throw new db['Sequelize']['ValidationError'](_0xc492('0x33'));}else{if(_0x22a71b['body'][_0xc492('0x31')](_0xc492('0x32'))&&!_0x22a71b['body'][_0xc492('0x31')](_0xc492('0x34'))){throw new db['Sequelize']['ValidationError'](_0xc492('0x35'));}if(!_0x22a71b[_0xc492('0x2f')][_0xc492('0x31')]('recipients')){throw new db['Sequelize'][(_0xc492('0x36'))](_0xc492('0x37'));}else{try{var _0xb33f56=JSON[_0xc492('0x38')](_0x22a71b[_0xc492('0x2f')][_0xc492('0x39')]);}catch(_0x23849b){logger[_0xc492('0x2b')](_0x23849b);throw new db[(_0xc492('0x3a'))][(_0xc492('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x50026c=['chatqueue',_0xc492('0x3b'),_0xc492('0x3c'),'openchannelqueue',_0xc492('0x3d'),_0xc492('0x3e'),'whatsappqueue',_0xc492('0x3f'),_0xc492('0x40')];if(_['some'](_0xb33f56,function(_0x5551e8){return!_['includes'](_0x50026c,_0x5551e8[_0xc492('0x41')][_0xc492('0x42')]());})){throw new db[(_0xc492('0x3a'))][(_0xc492('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x259dcf={};_0x259dcf['senderName']=_0x22a71b[_0xc492('0x2f')]['hasOwnProperty'](_0xc492('0x43'))?_0x22a71b[_0xc492('0x2f')][_0xc492('0x43')]:_0x22a71b[_0xc492('0x40')][_0xc492('0x44')];_0x259dcf[_0xc492('0x45')]=_[_0xc492('0x46')](_0x22a71b[_0xc492('0x2f')][_0xc492('0x45')])?null:_0x22a71b[_0xc492('0x2f')][_0xc492('0x45')];_0x259dcf['beep']=_0x22a71b[_0xc492('0x2f')][_0xc492('0x47')]||![];_0x259dcf[_0xc492('0x48')]=_0x22a71b[_0xc492('0x40')]['id'];return getContent(_0x22a71b[_0xc492('0x2f')])[_0xc492('0x2a')](function(_0x1e36c0){_0x259dcf[_0xc492('0x2f')]=_0x1e36c0;return getRecipients(_0xb33f56);})[_0xc492('0x2a')](function(_0x45ba15){_0x259dcf[_0xc492('0x49')]=_[_0xc492('0x4a')](_0x45ba15)[_0xc492('0x4b')](',');return db[_0xc492('0x4c')][_0xc492('0x4d')](function(_0x3dc16a){return db[_0xc492('0x4e')][_0xc492('0x4f')](_0x259dcf,{'raw':!![],'transaction':_0x3dc16a})[_0xc492('0x2a')](function(_0x81c599){var _0x414f02={'sender':_0x259dcf[_0xc492('0x43')],'description':_0x259dcf[_0xc492('0x45')],'content':_0x259dcf[_0xc492('0x2f')],'beep':_0x259dcf[_0xc492('0x47')]};_0x45ba15[_0xc492('0x50')](function(_0x4c2632){_0x414f02[_0xc492('0x51')]=_0x4c2632;socket[_0xc492('0x52')]('userNotification:send',_0x414f02);});return _0x81c599;});});})[_0xc492('0x2a')](respondWithResult(_0x212a7a,0xc9))['catch'](handleError(_0x212a7a,null));};function getContent(_0x220801){return new BPromise(function(_0x39dac3,_0xe1390b){if(_0x220801[_0xc492('0x30')]){_0x39dac3(_0x220801[_0xc492('0x30')]);return;}return db[_0xc492('0x53')][_0xc492('0x54')]({'attributes':[_0xc492('0x55')],'where':{'id':_0x220801[_0xc492('0x32')]},'raw':!![]})[_0xc492('0x2a')](function(_0x1e5372){if(!_0x1e5372)throw new db[(_0xc492('0x3a'))][(_0xc492('0x36'))](_0xc492('0x56'));var _0x1526db=Mustache[_0xc492('0x57')](_0x1e5372['html'],_0x220801['view']);_0x39dac3(_0x1526db);})[_0xc492('0x58')](function(_0x3dc931){_0xe1390b(_0x3dc931);});});}function getRecipients(_0x651ff4){return new BPromise(function(_0x3fb220,_0x37b1ef){var _0x3eecb1=[];var _0x961bd4=[];_0x651ff4[_0xc492('0x50')](function(_0x5d4bd9){var _0x1dbaff=_['startCase'](_0x5d4bd9[_0xc492('0x41')]['toLowerCase']());if(_0x1dbaff==='User'){_0x3eecb1=_[_0xc492('0x59')](_0x3eecb1,_0x5d4bd9['ids']);}else{if(_['includes'](_0x1dbaff,_0xc492('0x5a')))_0x1dbaff=_0x1dbaff[_0xc492('0x5b')]('queue',_0xc492('0x5c'));_0x5d4bd9[_0xc492('0x5d')][_0xc492('0x50')](function(_0x3fc890){_0x961bd4[_0xc492('0x5e')](getAgents(_0x1dbaff,_0x3fc890));});}});return BPromise['all'](_0x961bd4)[_0xc492('0x2a')](function(_0x1adc20){_0x3eecb1=_[_0xc492('0x59')](_0x3eecb1,_[_0xc492('0x5f')](_0x1adc20));_0x3fb220(_0x3eecb1);})[_0xc492('0x58')](function(_0x291138){_0x37b1ef(_0x291138);});});}function getAgents(_0xe9c565,_0x296ec7){return new BPromise(function(_0x34cbc0,_0x543b00){return db[_0xe9c565][_0xc492('0x54')]({'where':{'id':_0x296ec7}})['then'](function(_0x2b56d6){return _0x2b56d6[_0xc492('0x60')]({'attributes':['id'],'raw':!![]})[_0xc492('0x2a')](function(_0x37e13d){var _0x4b27ee=_[_0xc492('0x61')](_0x37e13d,'id');_0x34cbc0(_0x4b27ee);});})['catch'](function(_0x4a97f2){_0x543b00(_0x4a97f2);});});} \ No newline at end of file +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 diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index cfd7f77..da61367 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 _0xd516=['exports','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xd516,0x1de));var _0x6d51=function(_0x23115c,_0x55a2d3){_0x23115c=_0x23115c-0x0;var _0x323bb1=_0xd516[_0x23115c];return _0x323bb1;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x6d51('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6d51('0x1')](0x0);var events={'afterCreate':_0x6d51('0x2'),'afterUpdate':_0x6d51('0x3'),'afterDestroy':_0x6d51('0x4')};function emitEvent(_0x347f42){return function(_0x1a1d29,_0x47c280,_0x32acce){UserNotificationEvents[_0x6d51('0x5')](_0x347f42+':'+_0x1a1d29['id'],_0x1a1d29);UserNotificationEvents[_0x6d51('0x5')](_0x347f42,_0x1a1d29);_0x32acce(null);};}for(var e in events){if(events[_0x6d51('0x6')](e)){var event=events[e];UserNotification[_0x6d51('0x7')](e,emitEvent(event));}}module[_0x6d51('0x8')]=UserNotificationEvents; \ No newline at end of file +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 diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 86320e8..1f319e0 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 _0xca21=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','lodash'];(function(_0x4e25eb,_0x350892){var _0x4d34ca=function(_0x5382ca){while(--_0x5382ca){_0x4e25eb['push'](_0x4e25eb['shift']());}};_0x4d34ca(++_0x350892);}(_0xca21,0xcf));var _0x1ca2=function(_0x24a74e,_0x1e6a5b){_0x24a74e=_0x24a74e-0x0;var _0x457b69=_0xca21[_0x24a74e];return _0x457b69;};'use strict';var _=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1ca2('0x2'));var BPromise=require(_0x1ca2('0x3'));var rp=require(_0x1ca2('0x4'));var fs=require('fs');var path=require(_0x1ca2('0x5'));var rimraf=require(_0x1ca2('0x6'));var config=require(_0x1ca2('0x7'));var attributes=require(_0x1ca2('0x8'));module[_0x1ca2('0x9')]=function(_0x51556b,_0x4f5d05){return _0x51556b[_0x1ca2('0xa')]('UserNotification',attributes,{'tableName':_0x1ca2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ca2('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 015b217..d89db23 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 _0xed3f=['request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userNotification.socket','register'];(function(_0xa4518e,_0x3b7572){var _0x438d3d=function(_0x35801d){while(--_0x35801d){_0xa4518e['push'](_0xa4518e['shift']());}};_0x438d3d(++_0x3b7572);}(_0xed3f,0x190));var _0xfed3=function(_0xfe26da,_0x5ac1b7){_0xfe26da=_0xfe26da-0x0;var _0x2abe6e=_0xed3f[_0xfe26da];return _0x2abe6e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfed3('0x0'));var BPromise=require('bluebird');var rs=require(_0xfed3('0x1'));var fs=require('fs');var Redis=require(_0xfed3('0x2'));var db=require(_0xfed3('0x3'))['db'];var utils=require(_0xfed3('0x4'));var logger=require(_0xfed3('0x5'))(_0xfed3('0x6'));var config=require(_0xfed3('0x7'));var jayson=require(_0xfed3('0x8'));var client=jayson[_0xfed3('0x9')][_0xfed3('0xa')]({'port':0x232a});config['redis']=_[_0xfed3('0xb')](config[_0xfed3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfed3('0xd'))(new Redis(config[_0xfed3('0xc')]));require(_0xfed3('0xe'))[_0xfed3('0xf')](socket);function respondWithRpcPromise(_0x330824,_0x50c828,_0x5589d8){return new BPromise(function(_0x29abda,_0x51ffce){return client[_0xfed3('0x10')](_0x330824,_0x5589d8)[_0xfed3('0x11')](function(_0x2eedcb){logger[_0xfed3('0x12')]('UserNotification,\x20%s,\x20%s',_0x50c828,_0xfed3('0x13'));logger[_0xfed3('0x14')](_0xfed3('0x15'),_0x50c828,_0xfed3('0x13'),JSON['stringify'](_0x2eedcb));if(_0x2eedcb[_0xfed3('0x16')]){if(_0x2eedcb[_0xfed3('0x16')][_0xfed3('0x17')]===0x1f4){logger[_0xfed3('0x16')](_0xfed3('0x18'),_0x50c828,_0x2eedcb[_0xfed3('0x16')][_0xfed3('0x19')]);return _0x51ffce(_0x2eedcb[_0xfed3('0x16')][_0xfed3('0x19')]);}logger[_0xfed3('0x16')](_0xfed3('0x18'),_0x50c828,_0x2eedcb[_0xfed3('0x16')][_0xfed3('0x19')]);return _0x29abda(_0x2eedcb[_0xfed3('0x16')][_0xfed3('0x19')]);}else{logger['info'](_0xfed3('0x18'),_0x50c828,_0xfed3('0x13'));_0x29abda(_0x2eedcb['result'][_0xfed3('0x19')]);}})['catch'](function(_0x12fa61){logger[_0xfed3('0x16')](_0xfed3('0x18'),_0x50c828,_0x12fa61);_0x51ffce(_0x12fa61);});});} \ No newline at end of file +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 diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 456711d..556bcb2 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 _0x7b7a=['emit','register','length','userNotification:','save','remove','update'];(function(_0x59e3f5,_0x37c210){var _0x2b102e=function(_0x21b464){while(--_0x21b464){_0x59e3f5['push'](_0x59e3f5['shift']());}};_0x2b102e(++_0x37c210);}(_0x7b7a,0xd6));var _0xa7b7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7b7a[_0x6c993a];return _0x27f547;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa7b7('0x0'),_0xa7b7('0x1'),_0xa7b7('0x2')];function createListener(_0x5665c3,_0x2f635a){return function(_0x4f7135){_0x2f635a[_0xa7b7('0x3')](_0x5665c3,_0x4f7135);};}function removeListener(_0x3fa332,_0x445c17){return function(){UserNotificationEvents['removeListener'](_0x3fa332,_0x445c17);};}exports[_0xa7b7('0x4')]=function(_0x351604){for(var _0x3d8176=0x0,_0x478073=events[_0xa7b7('0x5')];_0x3d8176<_0x478073;_0x3d8176++){var _0x58cec4=events[_0x3d8176];var _0x5228be=createListener(_0xa7b7('0x6')+_0x58cec4,_0x351604);UserNotificationEvents['on'](_0x58cec4,_0x5228be);}}; \ No newline at end of file +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 diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 05e14ad..e53ae9f 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xe4456a,_0x22b836){var _0x4aacf1=function(_0x25d90c){while(--_0x25d90c){_0xe4456a['push'](_0xe4456a['shift']());}};_0x4aacf1(++_0x22b836);}(_0x70e0,0x17b));var _0x070e=function(_0x2d4935,_0x1979bc){_0x2d4935=_0x2d4935-0x0;var _0x38695b=_0x70e0[_0x2d4935];return _0x38695b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9009239..48afcef 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 _0xd602=['exports','INTEGER','sequelize'];(function(_0x411d77,_0x3e154b){var _0x1ca775=function(_0x1a5c47){while(--_0x1a5c47){_0x411d77['push'](_0x411d77['shift']());}};_0x1ca775(++_0x3e154b);}(_0xd602,0x155));var _0x2d60=function(_0x504c8b,_0x498e23){_0x504c8b=_0x504c8b-0x0;var _0x19cae5=_0xd602[_0x504c8b];return _0x19cae5;};'use strict';var Sequelize=require(_0x2d60('0x0'));module[_0x2d60('0x1')]={'penalty':{'type':Sequelize[_0x2d60('0x2')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 90bbc40..f306f52 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 _0x648b=['rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x648b,0x6e));var _0xb648=function(_0x5ca4d6,_0x3d3616){_0x5ca4d6=_0x5ca4d6-0x0;var _0xc8d185=_0x648b[_0x5ca4d6];return _0xc8d185;};'use strict';var _=require('lodash');var util=require(_0xb648('0x0'));var logger=require(_0xb648('0x1'))(_0xb648('0x2'));var moment=require(_0xb648('0x3'));var BPromise=require(_0xb648('0x4'));var rp=require(_0xb648('0x5'));var fs=require('fs');var path=require(_0xb648('0x6'));var rimraf=require(_0xb648('0x7'));var config=require(_0xb648('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xb648('0x9')]=function(_0xc5be17,_0x346f77){return _0xc5be17[_0xb648('0xa')](_0xb648('0xb'),attributes,{'tableName':_0xb648('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index da43ff5..bcc7a69 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 _0x6f64=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6f64,0x1c4));var _0x46f6=function(_0x3256c6,_0x3166f8){_0x3256c6=_0x3256c6-0x0;var _0x19ae14=_0x6f64[_0x3256c6];return _0x19ae14;};'use strict';var _=require(_0x46f6('0x0'));var util=require(_0x46f6('0x1'));var moment=require('moment');var BPromise=require(_0x46f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f6('0x3'));var db=require(_0x46f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x46f6('0x5'))(_0x46f6('0x6'));var config=require(_0x46f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x46f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359411,_0x1a0ffe,_0x45e0be){return new BPromise(function(_0x4a6c80,_0x4cd2ce){return client['request'](_0x359411,_0x45e0be)['then'](function(_0x15a331){logger[_0x46f6('0x9')](_0x46f6('0xa'),_0x1a0ffe,_0x46f6('0xb'));logger[_0x46f6('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1a0ffe,_0x46f6('0xb'),JSON['stringify'](_0x15a331));if(_0x15a331['error']){if(_0x15a331[_0x46f6('0xd')][_0x46f6('0xe')]===0x1f4){logger[_0x46f6('0xd')](_0x46f6('0xa'),_0x1a0ffe,_0x15a331[_0x46f6('0xd')][_0x46f6('0xf')]);return _0x4cd2ce(_0x15a331[_0x46f6('0xd')]['message']);}logger[_0x46f6('0xd')](_0x46f6('0xa'),_0x1a0ffe,_0x15a331[_0x46f6('0xd')]['message']);return _0x4a6c80(_0x15a331['error'][_0x46f6('0xf')]);}else{logger['info'](_0x46f6('0xa'),_0x1a0ffe,_0x46f6('0xb'));_0x4a6c80(_0x15a331[_0x46f6('0x10')][_0x46f6('0xf')]);}})[_0x46f6('0x11')](function(_0x2b1f94){logger['error'](_0x46f6('0xa'),_0x1a0ffe,_0x2b1f94);_0x4cd2ce(_0x2b1f94);});});} \ No newline at end of file +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 diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index eb2893d..abfc302 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 _0x5be8=['addSections','addResources','put','delete','destroy','removeSections','removeResources','util','path','express','fs-extra','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/sections','/:id/resources','getResources','post','/:id/clone','clone'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5be8,0x17e));var _0x85be=function(_0x4e5b0a,_0x528dd4){_0x4e5b0a=_0x4e5b0a-0x0;var _0x1a018c=_0x5be8[_0x4e5b0a];return _0x1a018c;};'use strict';var multer=require('multer');var util=require(_0x85be('0x0'));var path=require(_0x85be('0x1'));var timeout=require('connect-timeout');var express=require(_0x85be('0x2'));var router=express['Router']();var fs_extra=require(_0x85be('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85be('0x4'));var controller=require(_0x85be('0x5'));router['get']('/',auth[_0x85be('0x6')](),controller[_0x85be('0x7')]);router['get'](_0x85be('0x8'),auth[_0x85be('0x6')](),controller['describe']);router[_0x85be('0x9')](_0x85be('0xa'),auth[_0x85be('0x6')](),controller[_0x85be('0xb')]);router[_0x85be('0x9')](_0x85be('0xc'),auth[_0x85be('0x6')](),controller['getSections']);router[_0x85be('0x9')](_0x85be('0xd'),auth[_0x85be('0x6')](),controller[_0x85be('0xe')]);router[_0x85be('0xf')]('/',auth[_0x85be('0x6')](),controller['create']);router[_0x85be('0xf')](_0x85be('0x10'),auth[_0x85be('0x6')](),controller[_0x85be('0x11')]);router[_0x85be('0xf')]('/:id/sections',auth[_0x85be('0x6')](),controller[_0x85be('0x12')]);router[_0x85be('0xf')](_0x85be('0xd'),auth[_0x85be('0x6')](),controller[_0x85be('0x13')]);router[_0x85be('0x14')](_0x85be('0xa'),auth[_0x85be('0x6')](),controller['update']);router[_0x85be('0x15')](_0x85be('0xa'),auth['isAuthenticated'](),controller[_0x85be('0x16')]);router[_0x85be('0x15')](_0x85be('0xc'),auth[_0x85be('0x6')](),controller[_0x85be('0x17')]);router[_0x85be('0x15')](_0x85be('0xd'),auth['isAuthenticated'](),controller[_0x85be('0x18')]);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 52e9803..bd50956 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 _0x7315=['sequelize','exports','name','setDataValue','crudPermissions','join','split','BOOLEAN'];(function(_0x58c9fd,_0x34100c){var _0x4284f9=function(_0xd0d1b7){while(--_0xd0d1b7){_0x58c9fd['push'](_0x58c9fd['shift']());}};_0x4284f9(++_0x34100c);}(_0x7315,0x140));var _0x5731=function(_0x389c69,_0x4ed7b5){_0x389c69=_0x389c69-0x0;var _0x12c459=_0x7315[_0x389c69];return _0x12c459;};'use strict';var Sequelize=require(_0x5731('0x0'));module[_0x5731('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5731('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x320ad9){this[_0x5731('0x3')](_0x5731('0x4'),_0x320ad9?_0x320ad9[_0x5731('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x5731('0x4'))?this['getDataValue'](_0x5731('0x4'))[_0x5731('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5731('0x7')],'defaultValue':!![]}}; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 724b6b3..9658da1 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 _0xdd89=['removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','count','apply','update','then','end','error','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','destroy','describe','addSections','UserProfileResource','removeSections','ids','getSections','includes','subsections','enabled','concat','findOne','forEach','push','resourceId','Plugin','addResources','bulkCreate'];(function(_0x1c79d5,_0x1f6da2){var _0x4c868f=function(_0x1855e1){while(--_0x1855e1){_0x1c79d5['push'](_0x1c79d5['shift']());}};_0x4c868f(++_0x1f6da2);}(_0xdd89,0x1cc));var _0x9dd8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xdd89[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0x9dd8('0x0'));var rimraf=require(_0x9dd8('0x1'));var zipdir=require(_0x9dd8('0x2'));var jsonpatch=require(_0x9dd8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9dd8('0x4'));var Mustache=require(_0x9dd8('0x5'));var util=require(_0x9dd8('0x6'));var path=require(_0x9dd8('0x7'));var sox=require(_0x9dd8('0x8'));var csv=require(_0x9dd8('0x9'));var ejs=require(_0x9dd8('0xa'));var fs=require('fs');var fs_extra=require(_0x9dd8('0xb'));var _=require(_0x9dd8('0xc'));var squel=require(_0x9dd8('0xd'));var crypto=require(_0x9dd8('0xe'));var jsforce=require(_0x9dd8('0xf'));var deskjs=require(_0x9dd8('0x10'));var toCsv=require(_0x9dd8('0x9'));var querystring=require(_0x9dd8('0x11'));var Papa=require(_0x9dd8('0x12'));var Redis=require(_0x9dd8('0x13'));var authService=require(_0x9dd8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9dd8('0x15'));var hardwareService=require(_0x9dd8('0x16'));var logger=require(_0x9dd8('0x17'))(_0x9dd8('0x18'));var utils=require('../../config/utils');var config=require(_0x9dd8('0x19'));var licenseUtil=require(_0x9dd8('0x1a'));var db=require(_0x9dd8('0x1b'))['db'];config[_0x9dd8('0x1c')]=_['defaults'](config[_0x9dd8('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x9dd8('0x1d'))(new Redis(config[_0x9dd8('0x1c')]));require(_0x9dd8('0x1e'))[_0x9dd8('0x1f')](socket);function respondWithStatusCode(_0x1615a5,_0x4a6bf0){_0x4a6bf0=_0x4a6bf0||0xcc;return function(_0x461b2c){if(_0x461b2c){return _0x1615a5[_0x9dd8('0x20')](_0x4a6bf0);}return _0x1615a5[_0x9dd8('0x21')](_0x4a6bf0)['end']();};}function respondWithResult(_0x274f15,_0x3634ee){_0x3634ee=_0x3634ee||0xc8;return function(_0xf37fc9){if(_0xf37fc9){return _0x274f15['status'](_0x3634ee)[_0x9dd8('0x22')](_0xf37fc9);}};}function respondWithFilteredResult(_0x2f3043,_0x3f5185){return function(_0x192f28){if(_0x192f28){var _0x110443=typeof _0x3f5185[_0x9dd8('0x23')]===_0x9dd8('0x24')&&typeof _0x3f5185[_0x9dd8('0x25')]===_0x9dd8('0x24');var _0x355b77=_0x192f28[_0x9dd8('0x26')];var _0x2c267a=_0x110443?0x0:_0x3f5185[_0x9dd8('0x23')];var _0x1ebf00=_0x110443?_0x192f28[_0x9dd8('0x26')]:_0x3f5185['offset']+_0x3f5185[_0x9dd8('0x25')];var _0x10f2ca;if(_0x1ebf00>=_0x355b77){_0x1ebf00=_0x355b77;_0x10f2ca=0xc8;}else{_0x10f2ca=0xce;}_0x2f3043[_0x9dd8('0x21')](_0x10f2ca);return _0x2f3043['set']('Content-Range',_0x2c267a+'-'+_0x1ebf00+'/'+_0x355b77)[_0x9dd8('0x22')](_0x192f28);}return null;};}function patchUpdates(_0x58357a){return function(_0x57d46b){try{jsonpatch[_0x9dd8('0x27')](_0x57d46b,_0x58357a,!![]);}catch(_0x2080c0){return BPromise['reject'](_0x2080c0);}return _0x57d46b['save']();};}function saveUpdates(_0x579b24,_0xf11aad){return function(_0x5c581c){if(_0x5c581c){return _0x5c581c[_0x9dd8('0x28')](_0x579b24)[_0x9dd8('0x29')](function(_0x3fa436){return _0x3fa436;});}return null;};}function removeEntity(_0x1cad1a,_0x4fc792){return function(_0x1f7ad6){if(_0x1f7ad6){return _0x1f7ad6['destroy']()[_0x9dd8('0x29')](function(){_0x1cad1a[_0x9dd8('0x21')](0xcc)[_0x9dd8('0x2a')]();});}};}function handleEntityNotFound(_0x2a8b0c,_0xc85e99){return function(_0x2df8dd){if(!_0x2df8dd){_0x2a8b0c['sendStatus'](0x194);}return _0x2df8dd;};}function handleError(_0x3fae6b,_0x35f346){_0x35f346=_0x35f346||0x1f4;return function(_0x48c9bc){logger[_0x9dd8('0x2b')](_0x48c9bc['stack']);if(_0x48c9bc['name']){delete _0x48c9bc[_0x9dd8('0x2c')];}_0x3fae6b['status'](_0x35f346)[_0x9dd8('0x2d')](_0x48c9bc);};}exports[_0x9dd8('0x2e')]=function(_0x95bc02,_0xf10699){var _0xe5be6b={},_0x39c5d9={},_0x3741cd={'count':0x0,'rows':[]};var _0x4ee28e=_[_0x9dd8('0x2f')](db[_0x9dd8('0x30')][_0x9dd8('0x31')],function(_0x51bde6){return{'name':_0x51bde6['fieldName'],'type':_0x51bde6[_0x9dd8('0x32')][_0x9dd8('0x33')]};});_0x39c5d9[_0x9dd8('0x34')]=_[_0x9dd8('0x2f')](_0x4ee28e,_0x9dd8('0x2c'));_0x39c5d9[_0x9dd8('0x35')]=_[_0x9dd8('0x36')](_0x95bc02[_0x9dd8('0x35')]);_0x39c5d9['filters']=_[_0x9dd8('0x37')](_0x39c5d9['model'],_0x39c5d9[_0x9dd8('0x35')]);_0xe5be6b['attributes']=_[_0x9dd8('0x37')](_0x39c5d9['model'],qs[_0x9dd8('0x38')](_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x38')]));_0xe5be6b[_0x9dd8('0x39')]=_0xe5be6b[_0x9dd8('0x39')][_0x9dd8('0x3a')]?_0xe5be6b[_0x9dd8('0x39')]:_0x39c5d9[_0x9dd8('0x34')];if(!_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x3b')](_0x9dd8('0x3c'))){_0xe5be6b[_0x9dd8('0x25')]=qs[_0x9dd8('0x25')](_0x95bc02[_0x9dd8('0x35')]['limit']);_0xe5be6b['offset']=qs[_0x9dd8('0x23')](_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x23')]);}_0xe5be6b[_0x9dd8('0x3d')]=qs[_0x9dd8('0x3e')](_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x3e')]);_0xe5be6b[_0x9dd8('0x3f')]=qs[_0x9dd8('0x40')](_['pick'](_0x95bc02[_0x9dd8('0x35')],_0x39c5d9[_0x9dd8('0x40')]),_0x4ee28e);if(_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x41')]){_0xe5be6b['where']=_[_0x9dd8('0x42')](_0xe5be6b[_0x9dd8('0x3f')],{'$or':_[_0x9dd8('0x2f')](_0x4ee28e,function(_0x1dd76d){if(_0x1dd76d[_0x9dd8('0x32')]!==_0x9dd8('0x43')){var _0x53574e={};_0x53574e[_0x1dd76d[_0x9dd8('0x2c')]]={'$like':'%'+_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x41')]+'%'};return _0x53574e;}})});}_0xe5be6b=_[_0x9dd8('0x42')]({},_0xe5be6b,_0x95bc02['options']);var _0x531e8c={'where':_0xe5be6b[_0x9dd8('0x3f')]};return db['UserProfile'][_0x9dd8('0x26')](_0x531e8c)[_0x9dd8('0x29')](function(_0x3e7e79){_0x3741cd['count']=_0x3e7e79;if(_0x95bc02[_0x9dd8('0x35')][_0x9dd8('0x44')]){_0xe5be6b[_0x9dd8('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x9dd8('0x46')](_0xe5be6b);})[_0x9dd8('0x29')](function(_0x269b26){_0x3741cd[_0x9dd8('0x47')]=_0x269b26;return _0x3741cd;})[_0x9dd8('0x29')](respondWithFilteredResult(_0xf10699,_0xe5be6b))[_0x9dd8('0x48')](handleError(_0xf10699,null));};exports[_0x9dd8('0x49')]=function(_0x21a361,_0x3d72e2){var _0x2590aa={'raw':![],'where':{'id':_0x21a361[_0x9dd8('0x4a')]['id']}},_0x38ac97={};_0x38ac97['model']=_[_0x9dd8('0x36')](db[_0x9dd8('0x30')][_0x9dd8('0x31')]);_0x38ac97[_0x9dd8('0x35')]=_[_0x9dd8('0x36')](_0x21a361['query']);_0x38ac97[_0x9dd8('0x40')]=_[_0x9dd8('0x37')](_0x38ac97[_0x9dd8('0x34')],_0x38ac97[_0x9dd8('0x35')]);_0x2590aa[_0x9dd8('0x39')]=_[_0x9dd8('0x37')](_0x38ac97[_0x9dd8('0x34')],qs['fields'](_0x21a361[_0x9dd8('0x35')][_0x9dd8('0x38')]));_0x2590aa[_0x9dd8('0x39')]=_0x2590aa[_0x9dd8('0x39')][_0x9dd8('0x3a')]?_0x2590aa[_0x9dd8('0x39')]:_0x38ac97[_0x9dd8('0x34')];if(_0x21a361['query'][_0x9dd8('0x44')]){_0x2590aa[_0x9dd8('0x45')]=[{'all':!![]}];}_0x2590aa=_[_0x9dd8('0x42')]({},_0x2590aa,_0x21a361['options']);return db[_0x9dd8('0x30')][_0x9dd8('0x4b')](_0x2590aa)[_0x9dd8('0x29')](handleEntityNotFound(_0x3d72e2,null))['then'](respondWithResult(_0x3d72e2,null))['catch'](handleError(_0x3d72e2,null));};exports[_0x9dd8('0x4c')]=function(_0x129b0d,_0x4e58dc){return db['UserProfile'][_0x9dd8('0x4c')](_0x129b0d[_0x9dd8('0x4d')],{})['then'](respondWithResult(_0x4e58dc,0xc9))[_0x9dd8('0x48')](handleError(_0x4e58dc,null));};exports[_0x9dd8('0x4e')]=function(_0xa44efb,_0x3f6d3a){var _0xb19e6e={'where':{'id':_0xa44efb[_0x9dd8('0x4a')]['id']}},_0x82dbaa={};_0x82dbaa['model']=_[_0x9dd8('0x36')](db[_0x9dd8('0x30')][_0x9dd8('0x31')]);_0xb19e6e['attributes']=_[_0x9dd8('0x37')](_0x82dbaa[_0x9dd8('0x34')],qs[_0x9dd8('0x38')](_0xa44efb[_0x9dd8('0x35')][_0x9dd8('0x38')]));_0xb19e6e[_0x9dd8('0x39')]=_0xb19e6e[_0x9dd8('0x39')][_0x9dd8('0x3a')]?_0xb19e6e[_0x9dd8('0x39')]:_0x82dbaa['model'];if(_0xa44efb[_0x9dd8('0x35')]['includeAll']){_0xb19e6e['include']=[{'all':!![]}];}_0xb19e6e=_[_0x9dd8('0x42')]({},_0xb19e6e,_0xa44efb['options']);return db[_0x9dd8('0x30')]['find'](_0xb19e6e)[_0x9dd8('0x29')](handleEntityNotFound(_0x3f6d3a,null))[_0x9dd8('0x29')](function(_0x514728){if(_0x514728){var _0x3059be=_0x514728['get']({'plain':!![]});_0x3059be=qs['omit'](_0x3059be,['id',_0x9dd8('0x4f'),_0x9dd8('0x50'),_0x9dd8('0x51')]);_0xa44efb[_0x9dd8('0x4d')]=_[_0x9dd8('0x52')](_0xa44efb['body'],['id',_0x9dd8('0x4f'),'updatedAt']);return db[_0x9dd8('0x53')][_0x9dd8('0x54')](function(_0x2dadb0){return db['UserProfile'][_0x9dd8('0x4c')](_[_0x9dd8('0x42')](_0x3059be,_0xa44efb[_0x9dd8('0x4d')]),{'include':_0xa44efb[_0x9dd8('0x35')][_0x9dd8('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x2dadb0})[_0x9dd8('0x29')](function(_0x17b9a6){var _0x3b4e92=_0x17b9a6[_0x9dd8('0x55')]({'plain':!![]});return db[_0x9dd8('0x56')][_0x9dd8('0x46')]({'where':{'userProfileId':_0xa44efb['params']['id']},'raw':!![]})['then'](function(_0x3ab600){if(_0x3ab600){return BPromise[_0x9dd8('0x57')](_0x3ab600,function(_0x3332a6){return new BPromise(function(_0x5f1695,_0x1ed3c8){if(_0x3332a6[_0x9dd8('0x58')]===null||_0x3332a6['autoAssociation']===0x1)_0x5f1695(null);return db['UserProfileResource'][_0x9dd8('0x46')]({'where':{'sectionId':_0x3332a6['id']},'raw':!![]})['then'](function(_0x54607d){var _0x5556e5=_[_0x9dd8('0x2f')](_0x54607d,function(_0x1716bf){return qs[_0x9dd8('0x52')](_0x1716bf,['id',_0x9dd8('0x4f'),_0x9dd8('0x50'),_0x9dd8('0x59')]);});_0x5f1695(_0x5556e5);})[_0x9dd8('0x48')](function(_0x71c983){_0x1ed3c8(_0x71c983);});})['then'](function(_0x1c022b){var _0x536d8f=qs[_0x9dd8('0x52')](_0x3332a6,['id','createdAt','updatedAt']);_0x536d8f[_0x9dd8('0x5a')]=_0x3b4e92['id'];if(_0x1c022b)_0x536d8f[_0x9dd8('0x5b')]=_0x1c022b;return _0x536d8f;})[_0x9dd8('0x29')](function(_0x37d7c4){return db['UserProfileSection']['create'](_0x37d7c4,{'include':[{'model':db['UserProfileResource'],'as':_0x9dd8('0x5b')}],'raw':!![],'transaction':_0x2dadb0});});})[_0x9dd8('0x29')](function(){return _0x3b4e92;});}});});});}})[_0x9dd8('0x29')](respondWithResult(_0x3f6d3a,0xc9))[_0x9dd8('0x48')](handleError(_0x3f6d3a,null));};exports[_0x9dd8('0x28')]=function(_0x506bbd,_0x8e1aa9){if(_0x506bbd['body']['id']){delete _0x506bbd['body']['id'];}return db[_0x9dd8('0x30')]['find']({'where':{'id':_0x506bbd[_0x9dd8('0x4a')]['id']}})[_0x9dd8('0x29')](handleEntityNotFound(_0x8e1aa9,null))[_0x9dd8('0x29')](saveUpdates(_0x506bbd[_0x9dd8('0x4d')],null))[_0x9dd8('0x29')](respondWithResult(_0x8e1aa9,null))['catch'](handleError(_0x8e1aa9,null));};exports[_0x9dd8('0x5c')]=function(_0x21dbca,_0x560f83){return db['UserProfile'][_0x9dd8('0x4b')]({'where':{'id':_0x21dbca['params']['id']}})[_0x9dd8('0x29')](handleEntityNotFound(_0x560f83,null))['then'](removeEntity(_0x560f83,null))['catch'](handleError(_0x560f83,null));};exports[_0x9dd8('0x5d')]=function(_0x452107,_0x2f5566){return db[_0x9dd8('0x30')][_0x9dd8('0x5d')]()[_0x9dd8('0x29')](respondWithResult(_0x2f5566,null))[_0x9dd8('0x48')](handleError(_0x2f5566,null));};exports[_0x9dd8('0x5e')]=function(_0x2d3b71,_0x182280){var _0x140137=_0x2d3b71[_0x9dd8('0x4d')];return db['UserProfile']['find']({'where':{'id':_0x2d3b71[_0x9dd8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x182280,null))['then'](function(_0x2bae0a){if(_0x2bae0a){return db[_0x9dd8('0x53')]['transaction'](function(_0x507d30){return db['UserProfileSection'][_0x9dd8('0x5c')]({'where':{'userProfileId':_0x2d3b71[_0x9dd8('0x4a')]['id'],'sectionId':_[_0x9dd8('0x2f')](_0x140137,function(_0xc34d9e){return _0xc34d9e['sectionId'];})},'transaction':_0x507d30})[_0x9dd8('0x29')](function(){var _0x1ffbd2=_[_0x9dd8('0x2f')](_0x140137,function(_0x52fb48){_0x52fb48[_0x9dd8('0x5a')]=_0x2d3b71[_0x9dd8('0x4a')]['id'];return _0x52fb48;});var _0x10e602=[];return BPromise[_0x9dd8('0x57')](_0x1ffbd2,function(_0x5bbf57){return db['UserProfileSection'][_0x9dd8('0x4c')](_0x5bbf57,{'include':[{'model':db[_0x9dd8('0x5f')],'as':_0x9dd8('0x5b')}],'raw':!![],'transaction':_0x507d30})[_0x9dd8('0x29')](function(_0x13adc9){_0x10e602['push'](_0x13adc9[_0x9dd8('0x55')]({'plain':!![]}));});})[_0x9dd8('0x29')](function(){return _0x10e602;});});});}})['then'](function(_0x5f02da){return _0x5f02da;})['then'](respondWithResult(_0x182280,null))[_0x9dd8('0x48')](handleError(_0x182280,null));};exports[_0x9dd8('0x60')]=function(_0x49be4f,_0x568f82){var _0x119858;return db[_0x9dd8('0x30')][_0x9dd8('0x4b')]({'where':{'id':_0x49be4f[_0x9dd8('0x4a')]['id']},'attributes':['id',_0x9dd8('0x2c')]})[_0x9dd8('0x29')](handleEntityNotFound(_0x568f82,null))[_0x9dd8('0x29')](function(_0x50bcd3){if(_0x50bcd3){_0x119858=_0x50bcd3;return db[_0x9dd8('0x56')]['destroy']({'where':{'userProfileId':_0x49be4f[_0x9dd8('0x4a')]['id'],'sectionId':_0x49be4f[_0x9dd8('0x35')][_0x9dd8('0x61')]}});}})[_0x9dd8('0x29')](function(){return _0x119858;})[_0x9dd8('0x29')](respondWithStatusCode(_0x568f82,null))['catch'](handleError(_0x568f82,null));};exports[_0x9dd8('0x62')]=function(_0x34feea,_0x2753a6){var _0x1300fb=[];var _0x266155=[];return db[_0x9dd8('0x56')][_0x9dd8('0x46')]({'where':{'userProfileId':_0x34feea[_0x9dd8('0x4a')]['id']},'raw':!![]})['then'](function(_0x114653){_0x1300fb=_['filter'](_0x114653,function(_0x5d433d){return _0x5d433d['enabled']===0x1||_[_0x9dd8('0x63')]([0x3eb,0x709],_0x5d433d[_0x9dd8('0x59')]);});if(!_['isEmpty'](_0x1300fb)){return _[_0x9dd8('0x2f')](_0x1300fb,function(_0x124274){return _0x124274[_0x9dd8('0x59')];});}else{return;}})[_0x9dd8('0x29')](function(_0x3be28b){if(_0x3be28b)_0x266155=_0x3be28b;if(_[_0x9dd8('0x63')](_0x266155,0x64)){var _0x3ae64d=_[_0x9dd8('0x4b')](_0x1300fb,{'sectionId':0x64});return hasDefaultDashboard(_0x3ae64d)[_0x9dd8('0x29')](function(_0x3eae35){return _[_0x9dd8('0x2f')](_0x1300fb,function(_0x544a9d){if(_0x544a9d['sectionId']===0x64){_0x544a9d[_0x9dd8('0x64')]=_0x3eae35;}return _0x544a9d;});});}else{return;}})['then'](function(_0x31108e){if(_0x31108e)_0x1300fb=_0x31108e;if(_[_0x9dd8('0x63')](_0x266155,0x3eb)){var _0x25f49e=_['find'](_0x1300fb,{'sectionId':0x3eb});return getCustomDashboards(_0x25f49e)[_0x9dd8('0x29')](function(_0x15b6e5){return _[_0x9dd8('0x2f')](_0x1300fb,function(_0x12e757){if(_0x25f49e[_0x9dd8('0x65')]){if(_0x12e757[_0x9dd8('0x59')]===0x3eb){_0x12e757[_0x9dd8('0x64')]=_0x15b6e5;}}else{if(_0x12e757['sectionId']===0x64){if(!_0x12e757[_0x9dd8('0x64')]){_0x12e757[_0x9dd8('0x64')]=[];}_0x12e757['subsections']=_0x12e757[_0x9dd8('0x64')][_0x9dd8('0x66')](_0x15b6e5);}}return _0x12e757;});});}else{return;}})[_0x9dd8('0x29')](function(_0x2f5bc1){if(_0x2f5bc1)_0x1300fb=_0x2f5bc1;if(_[_0x9dd8('0x63')](_0x266155,0x709)){var _0xb3c0e0=_[_0x9dd8('0x4b')](_0x1300fb,{'sectionId':0x709});return getPlugins(_0xb3c0e0)[_0x9dd8('0x29')](function(_0x442992){if(_0xb3c0e0[_0x9dd8('0x65')]){return _['map'](_0x1300fb,function(_0x3a7146){if(_0x3a7146['sectionId']===0x709){_0x3a7146[_0x9dd8('0x64')]=_0x442992;}return _0x3a7146;});}else{var _0x4ebfdf={'sectionId':0x76c,'enabled':0x1,'subsections':_0x442992};var _0x215ae1=_[_0x9dd8('0x2f')](_0x1300fb);_0x215ae1['push'](_0x4ebfdf);return _0x215ae1;}});}else{return;}})['then'](function(_0x142a23){if(_0x142a23)_0x1300fb=_0x142a23;return _['filter'](_0x1300fb,[_0x9dd8('0x65'),0x1]);})[_0x9dd8('0x29')](respondWithResult(_0x2753a6,null))[_0x9dd8('0x48')](handleError(_0x2753a6,null));};function hasDefaultDashboard(_0x45a98e){var _0x3e70f2=[0x65];return new BPromise(function(_0x16679d,_0x40d7f1){try{if(_0x45a98e[_0x9dd8('0x58')]){_0x16679d(_0x3e70f2);}else{return db['UserProfileResource'][_0x9dd8('0x67')]({'where':{'sectionId':_0x45a98e['id']},'raw':!![]})[_0x9dd8('0x29')](function(_0xd08493){_0xd08493?_0x16679d(_0x3e70f2):_0x16679d();});}}catch(_0x11c178){_0x40d7f1(_0x11c178);}});}function getCustomDashboards(_0x5730c0){var _0x498d76=[];return new BPromise(function(_0x51a46f,_0x503417){try{if(_0x5730c0['autoAssociation']){return db['Dashboard'][_0x9dd8('0x46')]({'raw':!![]})[_0x9dd8('0x29')](function(_0x2791a6){_0x2791a6[_0x9dd8('0x68')](function(_0x1e5089){_0x498d76[_0x9dd8('0x69')](_0x1e5089['id']+0x1869f);});_0x51a46f(_0x498d76);});}else{return db[_0x9dd8('0x5f')][_0x9dd8('0x46')]({'where':{'sectionId':_0x5730c0['id']},'raw':!![]})[_0x9dd8('0x29')](function(_0x5eb05c){_0x5eb05c['forEach'](function(_0x4148aa){_0x498d76[_0x9dd8('0x69')](_0x4148aa[_0x9dd8('0x6a')]+0x1869f);});_0x51a46f(_0x498d76);});}}catch(_0x53019d){_0x503417(_0x53019d);}});}function getPlugins(_0x13cdaa){var _0x4038b5=[];return new BPromise(function(_0x52f745,_0x104ff3){try{if(_0x13cdaa[_0x9dd8('0x58')]){return db[_0x9dd8('0x6b')][_0x9dd8('0x46')]({'raw':!![]})[_0x9dd8('0x29')](function(_0x35c6c3){_0x35c6c3['forEach'](function(_0x1f6301){_0x4038b5[_0x9dd8('0x69')](_0x1f6301['id']+0x15b38);});_0x52f745(_0x4038b5);});}else{return db[_0x9dd8('0x5f')][_0x9dd8('0x46')]({'where':{'sectionId':_0x13cdaa['id']},'raw':!![]})[_0x9dd8('0x29')](function(_0x221359){_0x221359[_0x9dd8('0x68')](function(_0x195617){_0x4038b5[_0x9dd8('0x69')](_0x195617[_0x9dd8('0x6a')]+0x15b38);});_0x52f745(_0x4038b5);});}}catch(_0x3fffd7){_0x104ff3(_0x3fffd7);}});}exports[_0x9dd8('0x6c')]=function(_0x2febde,_0x5dc786){return db[_0x9dd8('0x30')][_0x9dd8('0x4b')]({'where':{'id':_0x2febde[_0x9dd8('0x4a')]['id']}})[_0x9dd8('0x29')](handleEntityNotFound(_0x5dc786,null))[_0x9dd8('0x29')](function(_0x5d611e){if(_0x5d611e){return db[_0x9dd8('0x53')]['transaction'](function(_0x5888c0){return db[_0x9dd8('0x56')][_0x9dd8('0x46')]({'where':{'userProfileId':_0x2febde[_0x9dd8('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x9dd8('0x29')](function(_0x3ff4ad){if(_0x3ff4ad){return db['UserProfileSection'][_0x9dd8('0x5c')]({'where':{'userProfileId':_0x2febde[_0x9dd8('0x4a')]['id'],'id':_[_0x9dd8('0x2f')](_0x3ff4ad,function(_0x5d4d23){return _0x5d4d23['id'];})},'transaction':_0x5888c0});}})[_0x9dd8('0x29')](function(_0x2e23e6){var _0x4c8520=_[_0x9dd8('0x2f')](_0x2febde[_0x9dd8('0x4d')],function(_0x4a047d){_0x4a047d[_0x9dd8('0x5a')]=_0x2febde[_0x9dd8('0x4a')]['id'];return _0x4a047d;});return db['UserProfileSection'][_0x9dd8('0x6d')](_0x4c8520,{'raw':!![],'transaction':_0x5888c0});})[_0x9dd8('0x29')](function(_0x287cf0){var _0x4c6712=_[_0x9dd8('0x41')](_['map'](_0x287cf0,function(_0x5ec2f1){return _0x5ec2f1[_0x9dd8('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x4c6712){return db['UserProfileSection'][_0x9dd8('0x46')]({'where':{'userProfileId':_0x2febde['params']['id'],'sectionId':_[_0x9dd8('0x2f')](_0x4c6712,function(_0xae857){return _0xae857[_0x9dd8('0x59')];})},'attributes':['id',_0x9dd8('0x59')],'raw':!![]})[_0x9dd8('0x29')](function(_0x317d4c){var _0x10e9bb=_[_0x9dd8('0x2f')](_0x2febde[_0x9dd8('0x4d')],function(_0x599b31){_0x599b31[_0x9dd8('0x5a')]=_0x2febde[_0x9dd8('0x4a')]['id'];return _0x599b31;});return db[_0x9dd8('0x5f')][_0x9dd8('0x6d')](_0x10e9bb,{'raw':!![],'transaction':_0x5888c0});});}})[_0x9dd8('0x48')](handleError(_0x5dc786,null));});}})['then'](function(_0xef08f2){var _0x130a60=_['map'](_0xef08f2,function(_0x5d1fc8){return _0x5d1fc8[_0x9dd8('0x55')]({'plain':!![]});});})[_0x9dd8('0x29')](respondWithResult(_0x5dc786,null))[_0x9dd8('0x48')](handleError(_0x5dc786,null));};exports[_0x9dd8('0x6e')]=function(_0x4077bb,_0x2ea2cd,_0x49efe8){return db[_0x9dd8('0x30')][_0x9dd8('0x4b')]({'where':{'id':_0x4077bb[_0x9dd8('0x4a')]['id']}})[_0x9dd8('0x29')](handleEntityNotFound(_0x2ea2cd,null))[_0x9dd8('0x29')](function(_0x1b0321){if(_0x1b0321){return _0x1b0321['removeResources'](_0x4077bb['query'][_0x9dd8('0x61')]);}})[_0x9dd8('0x29')](respondWithStatusCode(_0x2ea2cd,null))[_0x9dd8('0x48')](handleError(_0x2ea2cd,null));};exports[_0x9dd8('0x6f')]=function(_0x25980f,_0x416116){var _0xd318d={};if(!_0x25980f[_0x9dd8('0x35')][_0x9dd8('0x70')])throw new Error(_0x9dd8('0x71'));if(!_0x25980f[_0x9dd8('0x35')]['hasOwnProperty'](_0x9dd8('0x3c'))){_0xd318d['limit']=qs['limit'](_0x25980f[_0x9dd8('0x35')][_0x9dd8('0x25')]);_0xd318d[_0x9dd8('0x23')]=qs[_0x9dd8('0x23')](_0x25980f[_0x9dd8('0x35')][_0x9dd8('0x23')]);}return db[_0x9dd8('0x30')][_0x9dd8('0x4b')]({'where':{'id':_0x25980f[_0x9dd8('0x4a')]['id']}})[_0x9dd8('0x29')](function(_0xe11f1d){if(!_0xe11f1d)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x25980f[_0x9dd8('0x4a')]['id']);return db[_0x9dd8('0x30')]['getResources'](_0x25980f);})[_0x9dd8('0x29')](respondWithFilteredResult(_0x416116,_0xd318d))[_0x9dd8('0x48')](handleError(_0x416116,null));}; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 0b248a8..c992e37 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 _0x49c1=['UserProfile','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x49c1,0xef));var _0x149c=function(_0x91384,_0x2d56fc){_0x91384=_0x91384-0x0;var _0xeed03=_0x49c1[_0x91384];return _0xeed03;};'use strict';var EventEmitter=require(_0x149c('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x149c('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x149c('0x2')](0x0);var events={'afterCreate':_0x149c('0x3'),'afterUpdate':'update','afterDestroy':_0x149c('0x4')};function emitEvent(_0x2297bf){return function(_0x4c3294,_0xdb4fdf,_0x8c3ab2){UserProfileEvents['emit'](_0x2297bf+':'+_0x4c3294['id'],_0x4c3294);UserProfileEvents[_0x149c('0x5')](_0x2297bf,_0x4c3294);_0x8c3ab2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x149c('0x6')](e,emitEvent(event));}}module[_0x149c('0x7')]=UserProfileEvents; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 619a75b..08fa79b 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 _0x2dce=['customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','tags','Tag','templates','triggers','trunks','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','charAt','toUpperCase','Sequelize','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','user_profiles','../../components/parsers/qs','raw','section','length','push','find','params','all','isEmpty','union','ignore','autoAssociation','model','rawAttributes','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','filters','merge','key','foreignKey','includeAll','include','forEach','reportType','default','reportId','CustomReports','count','rows','ids','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','chat','sms','fax','dataValues','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','map','catch','associatedResources','resolve','then','resourceId','type','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','childModel','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','chatqueues','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','name','membername','User','role','agent','Telephones','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','voicequeues','VoiceQueues','users','agents','telephones','Users','admin','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0x2dce,0x10a));var _0xe2dc=function(_0x396ee4,_0x149826){_0x396ee4=_0x396ee4-0x0;var _0xf852b5=_0x2dce[_0x396ee4];return _0xf852b5;};'use strict';var _=require('lodash');var attributes=require(_0xe2dc('0x0'));var squel=require(_0xe2dc('0x1'));module[_0xe2dc('0x2')]=function(_0x9b3ec3){var _0x5b0a32=_0x9b3ec3[_0xe2dc('0x3')];function _0x50c372(_0x6ba5fe,_0x3de84a){return new Promise(function(_0x5af6de,_0x5877ac){if(!_0x3de84a)return _0x5af6de(null);var _0x5128da=_0x3de84a['filter']?{[_0x3de84a[_0xe2dc('0x4')][_0xe2dc('0x5')]]:_0x3de84a[_0xe2dc('0x4')][_0xe2dc('0x6')]}:undefined;return _0x5b0a32[_0x6ba5fe][_0xe2dc('0x7')]({'where':_0x5128da,'raw':!![]})['then'](function(_0x2b9c87){_0x3de84a['associatedResources']=_[_0xe2dc('0x8')](_0x2b9c87,'id');_0x5af6de(_0x3de84a);})[_0xe2dc('0x9')](function(_0x49ef33){_0x5877ac(_0x49ef33);});});}function _0x5cba92(_0x4baddd,_0x4f9a9a){return new Promise(function(_0x22ac67,_0x292390){var _0xa8122e=_0x4baddd[_0xe2dc('0x4')]?{[_0x4baddd[_0xe2dc('0x4')]['field']]:_0x4baddd[_0xe2dc('0x4')][_0xe2dc('0x6')]}:undefined;return _0x5b0a32[_0x4baddd['model']]['findAll']({'where':_0xa8122e,'raw':!![]})['then'](function(_0x348826){_0x4f9a9a[_0xe2dc('0xa')]=_[_0xe2dc('0x8')](_0x348826,function(_0x451c03){return _0x451c03['name'];});_0x22ac67(_0x4f9a9a);})[_0xe2dc('0x9')](function(_0xd0d401){_0x292390(_0xd0d401);});});}function _0x216cd7(_0x459d87,_0x2c0849,_0x29f97c){if(!_0x2c0849)return Promise[_0xe2dc('0xb')](null);return new Promise(function(_0x26e646,_0x1ef09e){return _0x5b0a32['UserProfileResource'][_0xe2dc('0x7')]({'where':{'sectionId':_0x2c0849['id']},'raw':!![]})[_0xe2dc('0xc')](function(_0x5de588){if(_0x459d87[_0xe2dc('0x5')]&&_0x459d87[_0xe2dc('0x5')]!=='id'){_0x2c0849[_0xe2dc('0xa')]=_[_0xe2dc('0x8')](_0x5de588,function(_0x3a3215){return _0x3a3215[_0x459d87[_0xe2dc('0x5')]];});}else{if(_0x29f97c==='AnalyticExtractedReport'){_0x2c0849['associatedResources']=_[_0xe2dc('0x8')](_0x5de588,function(_0x15292c){return{'id':_0x15292c[_0xe2dc('0xd')],'type':_0x15292c[_0xe2dc('0xe')]};});}else{_0x2c0849[_0xe2dc('0xa')]=_[_0xe2dc('0x8')](_0x5de588,function(_0x2311cd){return _0x2311cd[_0xe2dc('0xd')];});}}_0x26e646(_0x2c0849);})[_0xe2dc('0x9')](function(_0x231106){_0x1ef09e(_0x231106);});});}function _0xa4e671(_0xc0c4ac,_0x1c5d00){var _0x172cb2={'parentSections':[]};switch(_0xc0c4ac['toLowerCase']()){case _0xe2dc('0xf'):_0x172cb2['childModel']=_0xe2dc('0x10');break;case _0xe2dc('0x11'):_0x172cb2['childModel']=_0xe2dc('0x12');break;case _0xe2dc('0x13'):_0x172cb2[_0xe2dc('0x14')]='SquareRecording';_0x172cb2[_0xe2dc('0x15')]=[{'name':_0xe2dc('0x16'),'field':'name','foreignKey':_0xe2dc('0x17')}];break;case _0xe2dc('0x18'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x19');break;case _0xe2dc('0x1a'):_0x172cb2['childModel']=_0xe2dc('0x1b');_0x172cb2[_0xe2dc('0x15')]=[{'name':_0xe2dc('0x1c'),'field':'id','foreignKey':_0xe2dc('0x1d')}];break;case _0xe2dc('0x1e'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x1f');break;case _0xe2dc('0x20'):_0x172cb2['childModel']=_0xe2dc('0x21');break;case'globalcustomfields':_0x172cb2[_0xe2dc('0x14')]='CmCustomField';break;case _0xe2dc('0x22'):_0x172cb2[_0xe2dc('0x14')]='ChatQueue';break;case'chatwebsites':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x23');break;case'faxqueues':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x24');break;case'faxaccounts':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x25');break;case _0xe2dc('0x26'):case'internalroutes':case _0xe2dc('0x27'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x28');break;case _0xe2dc('0x29'):_0x172cb2[_0xe2dc('0x14')]='VoiceContext';break;case _0xe2dc('0x2a'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x2b');break;case _0xe2dc('0x2c'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x2d');_0x172cb2[_0xe2dc('0x15')]=[{'name':_0xe2dc('0x2e'),'field':_0xe2dc('0x2f'),'foreignKey':_0xe2dc('0x30'),'model':_0xe2dc('0x31'),'filter':{'field':_0xe2dc('0x32'),'value':[_0xe2dc('0x33')]}},{'name':_0xe2dc('0x34'),'field':_0xe2dc('0x2f'),'foreignKey':'membername','model':_0xe2dc('0x31'),'filter':{'field':_0xe2dc('0x32'),'value':['telephone']}},{'name':'VoiceQueues','field':_0xe2dc('0x2f'),'foreignKey':_0xe2dc('0x35'),'model':_0xe2dc('0x36'),'filter':{'field':_0xe2dc('0xe'),'value':[_0xe2dc('0x37')]}},{'name':_0xe2dc('0x38'),'field':_0xe2dc('0x2f'),'foreignKey':'queue','model':_0xe2dc('0x36'),'filter':{'field':_0xe2dc('0xe'),'value':[_0xe2dc('0x39')]}}];break;case _0xe2dc('0x3a'):_0x172cb2['childModel']=_0xe2dc('0x3b');break;case _0xe2dc('0x3c'):_0x172cb2[_0xe2dc('0x14')]='VoiceChanSpy';break;case _0xe2dc('0x3d'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x3e');break;case _0xe2dc('0x3f'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x40');break;case'mailqueues':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x41');break;case'mailaccounts':_0x172cb2['childModel']=_0xe2dc('0x42');break;case _0xe2dc('0x43'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x44');break;case _0xe2dc('0x45'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x46');break;case _0xe2dc('0x47'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x48');break;case _0xe2dc('0x49'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x4a');break;case _0xe2dc('0x4b'):_0x172cb2[_0xe2dc('0x14')]='SmsAccount';break;case _0xe2dc('0x4c'):_0x172cb2[_0xe2dc('0x14')]='WhatsappQueue';break;case _0xe2dc('0x4d'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x4e');break;case'teams':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x4f');break;case _0xe2dc('0x50'):case'queuecampaigns':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x36');if(_0x1c5d00){_0x172cb2[_0xe2dc('0x15')]=[{'name':_0xe2dc('0x51')},{'name':_0xe2dc('0x38')}];}break;case _0xe2dc('0x52'):case _0xe2dc('0x53'):case _0xe2dc('0x54'):_0x172cb2['childModel']=_0xe2dc('0x31');if(_0x1c5d00){_0x172cb2[_0xe2dc('0x15')]=[{'name':_0xe2dc('0x55'),'filter':{'field':_0xe2dc('0x32'),'value':[_0xe2dc('0x56'),'user']},'ignore':!![]},{'name':_0xe2dc('0x2e')},{'name':_0xe2dc('0x34')}];}break;case'zendeskaccounts':_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x57');break;case _0xe2dc('0x58'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x59');break;case'freshdeskaccounts':_0x172cb2['childModel']='FreshdeskAccount';break;case _0xe2dc('0x5a'):_0x172cb2[_0xe2dc('0x14')]='SugarcrmAccount';break;case _0xe2dc('0x5b'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x5c');break;case _0xe2dc('0x5d'):_0x172cb2[_0xe2dc('0x14')]='ZohoAccount';break;case _0xe2dc('0x5e'):_0x172cb2[_0xe2dc('0x14')]='User';break;case _0xe2dc('0x5f'):_0x172cb2['childModel']=_0xe2dc('0x60');break;case _0xe2dc('0x61'):_0x172cb2['childModel']='Disposition';break;case _0xe2dc('0x62'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x63');break;case _0xe2dc('0x64'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x65');break;case _0xe2dc('0x66'):_0x172cb2['childModel']='Pause';break;case _0xe2dc('0x67'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x68');break;case'sounds':_0x172cb2['childModel']='Sound';break;case _0xe2dc('0x69'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x6a');break;case _0xe2dc('0x6b'):_0x172cb2['childModel']='Template';break;case _0xe2dc('0x6c'):_0x172cb2[_0xe2dc('0x14')]='Trigger';break;case _0xe2dc('0x6d'):_0x172cb2[_0xe2dc('0x14')]='Trunk';break;case _0xe2dc('0x6e'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x6f');break;case _0xe2dc('0x70'):_0x172cb2[_0xe2dc('0x14')]=_0xe2dc('0x71');break;case _0xe2dc('0x72'):_0x172cb2['childModel']=_0xe2dc('0x73');_0x172cb2[_0xe2dc('0x15')]=[{'name':_0xe2dc('0x74'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x172cb2[_0xe2dc('0x14')]='AnalyticMetric';break;}return _0x172cb2;}function _0x3cf8bb(_0x1bcc95,_0x1b83b2){var _0xdcbca2=_0x1bcc95[_0xe2dc('0x75')](0x0)[_0xe2dc('0x76')]()+_0x1bcc95['slice'](0x1);var _0x4dac5d={'type':_0x5b0a32[_0xe2dc('0x77')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x2e76b8,_0xf5ca42){var _0x421451=squel['select']()[_0xe2dc('0x5')](_0xe2dc('0x78')+_0xdcbca2+_0xe2dc('0x79'),'id')['field'](_0xe2dc('0x7a'))[_0xe2dc('0x7b')]('user_has_'+_0x1bcc95+_0xe2dc('0x7c'),'ui')[_0xe2dc('0x7d')](_0xe2dc('0x7e'),_0x1b83b2['id']);return _0x5b0a32[_0xe2dc('0x7f')][_0xe2dc('0x80')](_0x421451[_0xe2dc('0x81')](),_0x4dac5d)[_0xe2dc('0xc')](function(_0x531a16){_0x1b83b2[_0xdcbca2+_0xe2dc('0x82')]=_0x531a16;_0x2e76b8(_0x531a16);})[_0xe2dc('0x9')](function(_0x458174){_0xf5ca42(_0x458174);});});}return _0x9b3ec3['define']('UserProfile',attributes,{'tableName':_0xe2dc('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x43057b){var _0x35a071=require(_0xe2dc('0x84'));var _0x4b6549={'raw':_0x43057b[_0xe2dc('0x80')][_0xe2dc('0x85')],'where':{}};var _0x31bd7c={};var _0x6e39f0={'count':0x0,'rows':[]};var _0x1e8153=_0x43057b[_0xe2dc('0x80')][_0xe2dc('0x86')];var _0x3a5ea4=_0x43057b[_0xe2dc('0x80')]['mergeResources']||![];var _0x35848d=_0xa4e671(_0x1e8153,_0x3a5ea4);if(!_0x35848d[_0xe2dc('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x1e8153+'\x27');var _0x207551=[{'name':_0x1e8153}];if(!_['isEmpty'](_0x35848d[_0xe2dc('0x15')]))_0x207551=_0x35848d[_0xe2dc('0x15')];var _0x57b5ae=[];for(var _0x12c961=0x0;_0x12c961<_0x207551[_0xe2dc('0x87')];_0x12c961++){_0x57b5ae[_0xe2dc('0x88')](_0x5b0a32['UserProfileSection'][_0xe2dc('0x89')]({'where':{'userProfileId':_0x43057b[_0xe2dc('0x8a')]['id'],'name':_0x207551[_0x12c961][_0xe2dc('0x2f')]},'raw':!![]}));}return Promise[_0xe2dc('0x8b')](_0x57b5ae)[_0xe2dc('0xc')](function(_0x3e5111){var _0x346812=_[_0xe2dc('0x4')](_0x3e5111,function(_0x12fb71){return _0x12fb71?_0x12fb71:undefined;});var _0x4ecaed=_['filter'](_0x207551,['ignore',!![]]);var _0x2a93fb=_[_0xe2dc('0x8c')](_0x346812)&&_[_0xe2dc('0x8c')](_0x4ecaed)?null:_[_0xe2dc('0x8d')](_0x4ecaed,_0x346812);if(!_0x2a93fb)return null;var _0x4b983d=[];for(var _0x1f16e5=0x0;_0x1f16e5<_0x2a93fb[_0xe2dc('0x87')];_0x1f16e5++){var _0x4b7c41=_['find'](_0x207551,function(_0x184661){return _0x2a93fb[_0x1f16e5]?_0x184661['name']===_0x2a93fb[_0x1f16e5][_0xe2dc('0x2f')]:null;});if(_0x4b7c41){if(_0x2a93fb[_0x1f16e5][_0xe2dc('0x8e')]){_0x4b983d['push'](_0x50c372(_0x35848d[_0xe2dc('0x14')],_0x2a93fb[_0x1f16e5]));}else{if(!_0x2a93fb[_0x1f16e5][_0xe2dc('0x8f')]){_0x4b983d[_0xe2dc('0x88')](_0x216cd7(_0x4b7c41,_0x2a93fb[_0x1f16e5],_0x35848d[_0xe2dc('0x14')]));}else{if(_0x4b7c41[_0xe2dc('0x90')]){_0x4b983d[_0xe2dc('0x88')](_0x5cba92(_0x4b7c41,_0x2a93fb[_0x1f16e5]));}}}}}return Promise[_0xe2dc('0x8b')](_0x4b983d);})['then'](function(_0x535af1){var _0x2d1837=_0x535af1;var _0x70bfc=null;if(_0x2d1837){_0x70bfc=_0x2d1837[_0xe2dc('0x87')]===0x1?_0x2d1837[0x0]:null;}if(!_0x70bfc&&!_0x2d1837)return _0x6e39f0;var _0x5e4f9a=_0x5b0a32[_0x35848d['childModel']][_0xe2dc('0x91')];_0x31bd7c[_0xe2dc('0x90')]=_[_0xe2dc('0x92')](_0x5e4f9a);_0x31bd7c[_0xe2dc('0x80')]=_[_0xe2dc('0x92')](_0x43057b[_0xe2dc('0x80')]);_0x31bd7c['filters']=_[_0xe2dc('0x93')](_0x31bd7c[_0xe2dc('0x90')],_0x31bd7c['query']);_0x4b6549['attributes']=_[_0xe2dc('0x93')](_0x31bd7c['model'],_0x35a071[_0xe2dc('0x94')](_0x43057b[_0xe2dc('0x80')]['fields']));_0x4b6549[_0xe2dc('0x95')]=_0x4b6549['attributes']['length']?_0x4b6549[_0xe2dc('0x95')]:_0x31bd7c[_0xe2dc('0x90')];if(!_0x43057b[_0xe2dc('0x80')][_0xe2dc('0x96')](_0xe2dc('0x97'))){_0x4b6549[_0xe2dc('0x98')]=_0x35a071[_0xe2dc('0x98')](_0x43057b['query'][_0xe2dc('0x98')]);_0x4b6549[_0xe2dc('0x99')]=_0x35a071['offset'](_0x43057b[_0xe2dc('0x80')][_0xe2dc('0x99')]);}_0x4b6549[_0xe2dc('0x9a')]=_0x35a071[_0xe2dc('0x9b')](_0x43057b['query'][_0xe2dc('0x9b')]);_0x4b6549[_0xe2dc('0x7d')]=_0x35a071[_0xe2dc('0x9c')](_['pick'](_0x43057b['query'],_0x31bd7c[_0xe2dc('0x9c')]));if(_0x43057b[_0xe2dc('0x80')][_0xe2dc('0x4')]){_0x4b6549[_0xe2dc('0x7d')]=_[_0xe2dc('0x9d')](_0x4b6549['where'],{'$or':_['map'](_0x5e4f9a,function(_0x4d03be){if(_0x4d03be[_0xe2dc('0xe')][_0xe2dc('0x9e')]!=='VIRTUAL'){var _0x29b1eb={};_0x29b1eb[_0x4d03be[_0xe2dc('0x5')]]={'$like':'%'+_0x43057b[_0xe2dc('0x80')][_0xe2dc('0x4')]+'%'};return _0x29b1eb;}})});}var _0x44b8c0=[];var _0x1e1162=null;var _0x3b9273={};if(_0x70bfc){_0x1e1162=_[_0xe2dc('0x89')](_0x207551,['name',_0x70bfc['name']]);if(_0x1e1162['field']){_0x3b9273={};if(_0x35848d[_0xe2dc('0x14')]===_0xe2dc('0x73')){_0x3b9273[_0x1e1162[_0xe2dc('0x9f')]]=_['map'](_0x70bfc[_0xe2dc('0xa')],'id');}else{_0x3b9273[_0x1e1162['foreignKey']]=_0x70bfc[_0xe2dc('0xa')];}_0x44b8c0[_0xe2dc('0x88')](_0x3b9273);}else{_0x4b6549[_0xe2dc('0x7d')]['id']=_0x70bfc[_0xe2dc('0xa')];}}else{for(var _0x5afba5=0x0;_0x5afba5<_0x2d1837[_0xe2dc('0x87')];_0x5afba5++){_0x1e1162=_[_0xe2dc('0x89')](_0x207551,[_0xe2dc('0x2f'),_0x2d1837[_0x5afba5][_0xe2dc('0x2f')]]);if(_0x1e1162['field']){_0x3b9273={};_0x3b9273[_0x1e1162[_0xe2dc('0x9f')]]=_0x2d1837[_0x5afba5][_0xe2dc('0xa')];_0x44b8c0[_0xe2dc('0x88')](_0x3b9273);}else{if(!_0x4b6549[_0xe2dc('0x7d')]['id'])_0x4b6549[_0xe2dc('0x7d')]['id']=[];_0x2d1837[_0x5afba5]['associatedResources']['forEach'](function(_0x5b3406){_0x4b6549[_0xe2dc('0x7d')]['id'][_0xe2dc('0x88')](_0x5b3406);});}}}if(!_['isEmpty'](_0x44b8c0)){_0x4b6549['where']=_[_0xe2dc('0x9d')](_0x4b6549[_0xe2dc('0x7d')],{'$and':{'$or':_0x44b8c0}});}_0x4b6549=_[_0xe2dc('0x9d')]({},_0x4b6549,_0x43057b['options']);if(_0x70bfc&&!_0x70bfc['autoAssociation']&&_0x35848d[_0xe2dc('0x14')]==='AnalyticExtractedReport'){if(_0x43057b['query'][_0xe2dc('0xa0')]){_0x4b6549[_0xe2dc('0xa1')]=[{'all':!![]}];}return _0x5b0a32[_0x35848d['childModel']][_0xe2dc('0x7')](_0x4b6549)['then'](function(_0x21e959){var _0x23d65a=[];_0x21e959[_0xe2dc('0xa2')](function(_0x3f818a){var _0x1b51d7;switch(_0x3f818a[_0xe2dc('0xa3')]){case _0xe2dc('0xa4'):_0x1b51d7=_['find'](_0x70bfc[_0xe2dc('0xa')],function(_0x261138){return _0x261138['id']===_0x3f818a[_0xe2dc('0xa5')]&&_0x261138[_0xe2dc('0xe')]==='DefaultReports';});break;case'custom':_0x1b51d7=_[_0xe2dc('0x89')](_0x70bfc[_0xe2dc('0xa')],function(_0x2d9218){return _0x2d9218['id']===_0x3f818a[_0xe2dc('0xa5')]&&_0x2d9218['type']===_0xe2dc('0xa6');});break;}if(_0x1b51d7)_0x23d65a[_0xe2dc('0x88')](_0x3f818a);});_0x6e39f0[_0xe2dc('0xa7')]=_0x23d65a[_0xe2dc('0x87')];_0x6e39f0[_0xe2dc('0xa8')]=_0x23d65a;return _0x6e39f0;});}else{if(!_['isEmpty'](_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xa9')])){_0x4b6549[_0xe2dc('0x7d')]['id']=_0x4b6549[_0xe2dc('0x7d')]['id']?_[_0xe2dc('0x93')](_0x4b6549[_0xe2dc('0x7d')]['id'],_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xa9')]):_0x43057b[_0xe2dc('0x80')]['ids'];if(_0x43057b[_0xe2dc('0x80')]['customSorting']){_0x4b6549['order']=_0x43057b['query']['customSorting'];}}if(_0x43057b[_0xe2dc('0x80')]['extraQueryConditions']){_0x4b6549[_0xe2dc('0x7d')]=_[_0xe2dc('0x9d')](_0x4b6549[_0xe2dc('0x7d')],{'$and':_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xaa')]});}return _0x5b0a32[_0x35848d[_0xe2dc('0x14')]][_0xe2dc('0xa7')]({'where':_0x4b6549[_0xe2dc('0x7d')]})['then'](function(_0x4fb108){_0x6e39f0[_0xe2dc('0xa7')]=_0x4fb108;if(_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xa0')]){if(_0x35848d['childModel']==='CmContact'){_0x4b6549[_0xe2dc('0xa1')]=[{'model':_0x5b0a32[_0xe2dc('0x6a')],'as':_0xe2dc('0xab'),'attributes':['id','name',_0xe2dc('0xac')],'required':_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xad')]?!![]:![]},{'model':_0x5b0a32[_0xe2dc('0x6a')],'as':_0xe2dc('0xae'),'attributes':['id',_0xe2dc('0x2f'),'color'],'through':_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xad')]?{'attributes':[],'where':{'TagId':_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xad')]||undefined}}:{},'required':_0x43057b[_0xe2dc('0x80')][_0xe2dc('0xad')]?!![]:![]}];}else{_0x4b6549[_0xe2dc('0xa1')]=[{'all':!![]}];}}return _0x5b0a32[_0x35848d[_0xe2dc('0x14')]][_0xe2dc('0x7')](_0x4b6549);})[_0xe2dc('0xc')](function(_0x50b876){_0x6e39f0[_0xe2dc('0xa8')]=_0x50b876;if(_0x1e8153===_0xe2dc('0x2e')&&_0x43057b['query'][_0xe2dc('0xaf')]===_0xe2dc('0xb0')){var _0x192c13=[];for(var _0x274a2d=0x0;_0x274a2d<_0x6e39f0[_0xe2dc('0xa8')][_0xe2dc('0x87')];_0x274a2d++){_0x192c13[_0xe2dc('0x88')](_0x3cf8bb(_0xe2dc('0xb1'),_0x6e39f0[_0xe2dc('0xa8')][_0x274a2d]['dataValues']));_0x192c13[_0xe2dc('0x88')](_0x3cf8bb(_0xe2dc('0xb2'),_0x6e39f0[_0xe2dc('0xa8')][_0x274a2d]['dataValues']));_0x192c13['push'](_0x3cf8bb(_0xe2dc('0xb3'),_0x6e39f0[_0xe2dc('0xa8')][_0x274a2d][_0xe2dc('0xb4')]));_0x192c13[_0xe2dc('0x88')](_0x3cf8bb('mail',_0x6e39f0[_0xe2dc('0xa8')][_0x274a2d][_0xe2dc('0xb4')]));_0x192c13[_0xe2dc('0x88')](_0x3cf8bb(_0xe2dc('0xb5'),_0x6e39f0[_0xe2dc('0xa8')][_0x274a2d][_0xe2dc('0xb4')]));_0x192c13[_0xe2dc('0x88')](_0x3cf8bb('whatsapp',_0x6e39f0['rows'][_0x274a2d][_0xe2dc('0xb4')]));}return Promise[_0xe2dc('0x8b')](_0x192c13)[_0xe2dc('0xc')](function(){return _0x6e39f0;});}return _0x6e39f0;});}});}}});}; \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 623d932..96d0fa3 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 _0x22da=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0x52c6cd,_0x24f670){var _0x361437=function(_0x2f7131){while(--_0x2f7131){_0x52c6cd['push'](_0x52c6cd['shift']());}};_0x361437(++_0x24f670);}(_0x22da,0x80));var _0xa22d=function(_0x471fe3,_0x276d54){_0x471fe3=_0x471fe3-0x0;var _0x578441=_0x22da[_0x471fe3];return _0x578441;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa22d('0x0'));var BPromise=require(_0xa22d('0x1'));var rs=require(_0xa22d('0x2'));var fs=require('fs');var Redis=require(_0xa22d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa22d('0x4'));var logger=require(_0xa22d('0x5'))(_0xa22d('0x6'));var config=require(_0xa22d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa22d('0x8')][_0xa22d('0x9')]({'port':0x232a});config['redis']=_[_0xa22d('0xa')](config[_0xa22d('0xb')],{'host':_0xa22d('0xc'),'port':0x18eb});var socket=require(_0xa22d('0xd'))(new Redis(config['redis']));require('./userProfile.socket')[_0xa22d('0xe')](socket);function respondWithRpcPromise(_0x122102,_0x4dfff8,_0x312520){return new BPromise(function(_0xc742bb,_0x471738){return client[_0xa22d('0xf')](_0x122102,_0x312520)['then'](function(_0x5d25b1){logger[_0xa22d('0x10')](_0xa22d('0x11'),_0x4dfff8,'request\x20sent');logger[_0xa22d('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4dfff8,_0xa22d('0x13'),JSON[_0xa22d('0x14')](_0x5d25b1));if(_0x5d25b1[_0xa22d('0x15')]){if(_0x5d25b1['error'][_0xa22d('0x16')]===0x1f4){logger[_0xa22d('0x15')](_0xa22d('0x11'),_0x4dfff8,_0x5d25b1[_0xa22d('0x15')][_0xa22d('0x17')]);return _0x471738(_0x5d25b1['error'][_0xa22d('0x17')]);}logger[_0xa22d('0x15')](_0xa22d('0x11'),_0x4dfff8,_0x5d25b1[_0xa22d('0x15')][_0xa22d('0x17')]);return _0xc742bb(_0x5d25b1[_0xa22d('0x15')][_0xa22d('0x17')]);}else{logger[_0xa22d('0x10')](_0xa22d('0x11'),_0x4dfff8,_0xa22d('0x13'));_0xc742bb(_0x5d25b1[_0xa22d('0x18')][_0xa22d('0x17')]);}})[_0xa22d('0x19')](function(_0x256ba0){logger[_0xa22d('0x15')](_0xa22d('0x11'),_0x4dfff8,_0x256ba0);_0x471738(_0x256ba0);});});} \ No newline at end of file +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 diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1974cc4..1e9803a 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 _0x2d90=['register','length','userProfile:','remove','update','removeListener'];(function(_0x1474fd,_0x30b9aa){var _0x1b76e3=function(_0x380cd9){while(--_0x380cd9){_0x1474fd['push'](_0x1474fd['shift']());}};_0x1b76e3(++_0x30b9aa);}(_0x2d90,0x177));var _0x02d9=function(_0x5da689,_0x5071c1){_0x5da689=_0x5da689-0x0;var _0x25669c=_0x2d90[_0x5da689];return _0x25669c;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x02d9('0x0'),_0x02d9('0x1')];function createListener(_0x37bb00,_0x499a0e){return function(_0x544ce2){_0x499a0e['emit'](_0x37bb00,_0x544ce2);};}function removeListener(_0x3bee53,_0x438ca7){return function(){UserProfileEvents[_0x02d9('0x2')](_0x3bee53,_0x438ca7);};}exports[_0x02d9('0x3')]=function(_0x147c6d){for(var _0x3b35c3=0x0,_0x818233=events[_0x02d9('0x4')];_0x3b35c3<_0x818233;_0x3b35c3++){var _0x287afd=events[_0x3b35c3];var _0x34b2de=createListener(_0x02d9('0x5')+_0x287afd,_0x147c6d);UserProfileEvents['on'](_0x287afd,_0x34b2de);}}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1c4a893..12892d1 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 _0xabc5=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','describe','/:id','create','put','update'];(function(_0x1bbd58,_0x3015e6){var _0x50fd62=function(_0x376108){while(--_0x376108){_0x1bbd58['push'](_0x1bbd58['shift']());}};_0x50fd62(++_0x3015e6);}(_0xabc5,0x17d));var _0x5abc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xabc5[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x5abc('0x0'));var util=require(_0x5abc('0x1'));var path=require(_0x5abc('0x2'));var timeout=require(_0x5abc('0x3'));var express=require(_0x5abc('0x4'));var router=express[_0x5abc('0x5')]();var fs_extra=require(_0x5abc('0x6'));var auth=require(_0x5abc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5abc('0x8'));var controller=require(_0x5abc('0x9'));router['get']('/',auth[_0x5abc('0xa')](),controller['index']);router[_0x5abc('0xb')](_0x5abc('0xc'),auth[_0x5abc('0xa')](),controller[_0x5abc('0xd')]);router[_0x5abc('0xb')](_0x5abc('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5abc('0xa')](),controller[_0x5abc('0xf')]);router[_0x5abc('0x10')](_0x5abc('0xe'),auth[_0x5abc('0xa')](),controller[_0x5abc('0x11')]);router[_0x5abc('0x12')]('/:id',auth[_0x5abc('0xa')](),controller[_0x5abc('0x13')]);module[_0x5abc('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c6d83a7..1b15607 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 _0xd44e=['STRING','INTEGER','sequelize','exports'];(function(_0x2f5cee,_0x3543df){var _0x279763=function(_0x172236){while(--_0x172236){_0x2f5cee['push'](_0x2f5cee['shift']());}};_0x279763(++_0x3543df);}(_0xd44e,0x96));var _0xed44=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd44e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xed44('0x0'));module[_0xed44('0x1')]={'name':{'type':Sequelize[_0xed44('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xed44('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index dc14268..94cbecd 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 _0x1623=['filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','UserProfileResource','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1623,0xab));var _0x3162=function(_0x389d0d,_0x43182f){_0x389d0d=_0x389d0d-0x0;var _0x9f1a6c=_0x1623[_0x389d0d];return _0x9f1a6c;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['UserProfileResource'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));};exports[_0x3162('0x49')]=function(_0x554a03,_0x48b81d){return db['UserProfileResource'][_0x3162('0x49')]()[_0x3162('0x24')](respondWithResult(_0x48b81d,null))[_0x3162('0x42')](handleError(_0x48b81d,null));}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6cd116f..c1c9a59 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 _0x0b10=['compositeIndex','resourceId','sectionId','lodash','util','bluebird','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x57e087,_0x5b500b){var _0x41eb12=function(_0x250adc){while(--_0x250adc){_0x57e087['push'](_0x57e087['shift']());}};_0x41eb12(++_0x5b500b);}(_0x0b10,0x114));var _0x00b1=function(_0x307559,_0x133292){_0x307559=_0x307559-0x0;var _0x395679=_0x0b10[_0x307559];return _0x395679;};'use strict';var _=require(_0x00b1('0x0'));var util=require(_0x00b1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x00b1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00b1('0x3'));var rimraf=require('rimraf');var config=require(_0x00b1('0x4'));var attributes=require(_0x00b1('0x5'));module[_0x00b1('0x6')]=function(_0x3a9437,_0x26cef0){return _0x3a9437[_0x00b1('0x7')](_0x00b1('0x8'),attributes,{'tableName':_0x00b1('0x9'),'paranoid':![],'indexes':[{'name':_0x00b1('0xa'),'fields':[_0x00b1('0xb'),_0x00b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5f1199f..330cdb5 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 _0x1b42=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x5a834a,_0x4b0f8a){var _0x540933=function(_0x460627){while(--_0x460627){_0x5a834a['push'](_0x5a834a['shift']());}};_0x540933(++_0x4b0f8a);}(_0x1b42,0x12d));var _0x21b4=function(_0x16ca11,_0x5c8f1e){_0x16ca11=_0x16ca11-0x0;var _0x3c8f7e=_0x1b42[_0x16ca11];return _0x3c8f7e;};'use strict';var _=require(_0x21b4('0x0'));var util=require('util');var moment=require(_0x21b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x21b4('0x2'));var fs=require('fs');var Redis=require(_0x21b4('0x3'));var db=require(_0x21b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x21b4('0x5'))('rpc');var config=require(_0x21b4('0x6'));var jayson=require(_0x21b4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x559b5d,_0x260fda,_0x44d499){return new BPromise(function(_0x28e258,_0xd7b6a1){return client[_0x21b4('0x8')](_0x559b5d,_0x44d499)[_0x21b4('0x9')](function(_0x42bbfa){logger[_0x21b4('0xa')](_0x21b4('0xb'),_0x260fda,'request\x20sent');logger[_0x21b4('0xc')](_0x21b4('0xd'),_0x260fda,_0x21b4('0xe'),JSON[_0x21b4('0xf')](_0x42bbfa));if(_0x42bbfa['error']){if(_0x42bbfa[_0x21b4('0x10')][_0x21b4('0x11')]===0x1f4){logger[_0x21b4('0x10')](_0x21b4('0xb'),_0x260fda,_0x42bbfa[_0x21b4('0x10')][_0x21b4('0x12')]);return _0xd7b6a1(_0x42bbfa['error'][_0x21b4('0x12')]);}logger['error'](_0x21b4('0xb'),_0x260fda,_0x42bbfa['error']['message']);return _0x28e258(_0x42bbfa['error'][_0x21b4('0x12')]);}else{logger[_0x21b4('0xa')](_0x21b4('0xb'),_0x260fda,_0x21b4('0xe'));_0x28e258(_0x42bbfa[_0x21b4('0x13')][_0x21b4('0x12')]);}})[_0x21b4('0x14')](function(_0x57fe81){logger[_0x21b4('0x10')](_0x21b4('0xb'),_0x260fda,_0x57fe81);_0xd7b6a1(_0x57fe81);});});} \ No newline at end of file +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 diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 4386fb1..0c9f3d2 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 _0x8f67=['Router','fs-extra','get','isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x8f67,0x163));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x78f6('0x0'));var util=require(_0x78f6('0x1'));var path=require(_0x78f6('0x2'));var timeout=require(_0x78f6('0x3'));var express=require(_0x78f6('0x4'));var router=express[_0x78f6('0x5')]();var fs_extra=require(_0x78f6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x78f6('0x7')]('/',auth[_0x78f6('0x8')](),controller[_0x78f6('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x78f6('0xa')]);router['get'](_0x78f6('0xb'),auth[_0x78f6('0x8')](),controller[_0x78f6('0xc')]);router['post']('/',auth[_0x78f6('0x8')](),controller[_0x78f6('0xd')]);router['put']('/:id',auth[_0x78f6('0x8')](),controller[_0x78f6('0xe')]);router[_0x78f6('0xf')](_0x78f6('0xb'),auth[_0x78f6('0x8')](),controller[_0x78f6('0x10')]);module[_0x78f6('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7893111..d848030 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 _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0xb10b,0x12a));var _0xbb10=function(_0x1569bd,_0x1a1461){_0x1569bd=_0x1569bd-0x0;var _0x40e370=_0xb10b[_0x1569bd];return _0x40e370;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb10('0x1')],'set':function(_0x460981){this[_0xbb10('0x4')](_0xbb10('0x5'),_0x460981?_0x460981[_0xbb10('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xbb10('0x5'))?this[_0xbb10('0x7')]('crudPermissions')[_0xbb10('0x8')](''):[];}}}; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 592feec..07fa02f 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 _0xc5ff=['end','json','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','offset','sort','where','pick','filter','merge','findAll','rows','show','params','length','include','options','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x10a2ee,_0x314b2c){var _0x28e11b=function(_0x22913f){while(--_0x22913f){_0x10a2ee['push'](_0x10a2ee['shift']());}};_0x28e11b(++_0x314b2c);}(_0xc5ff,0x78));var _0xfc5f=function(_0x335a72,_0x4941b8){_0x335a72=_0x335a72-0x0;var _0x5bd54e=_0xc5ff[_0x335a72];return _0x5bd54e;};'use strict';var emlformat=require(_0xfc5f('0x0'));var rimraf=require(_0xfc5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc5f('0x2'));var rp=require(_0xfc5f('0x3'));var moment=require(_0xfc5f('0x4'));var BPromise=require(_0xfc5f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfc5f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc5f('0x7'));var _=require(_0xfc5f('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc5f('0x9'));var deskjs=require(_0xfc5f('0xa'));var toCsv=require(_0xfc5f('0x6'));var querystring=require(_0xfc5f('0xb'));var Papa=require(_0xfc5f('0xc'));var Redis=require(_0xfc5f('0xd'));var authService=require(_0xfc5f('0xe'));var qs=require(_0xfc5f('0xf'));var as=require(_0xfc5f('0x10'));var hardwareService=require(_0xfc5f('0x11'));var logger=require('../../config/logger')(_0xfc5f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfc5f('0x13'))['db'];function respondWithStatusCode(_0xad4858,_0x3d3ea3){_0x3d3ea3=_0x3d3ea3||0xcc;return function(_0x59d1c5){if(_0x59d1c5){return _0xad4858[_0xfc5f('0x14')](_0x3d3ea3);}return _0xad4858[_0xfc5f('0x15')](_0x3d3ea3)[_0xfc5f('0x16')]();};}function respondWithResult(_0x41807f,_0x5694a1){_0x5694a1=_0x5694a1||0xc8;return function(_0x3a5608){if(_0x3a5608){return _0x41807f[_0xfc5f('0x15')](_0x5694a1)[_0xfc5f('0x17')](_0x3a5608);}};}function respondWithFilteredResult(_0x4fa145,_0x1fd0f5){return function(_0xa2eff8){if(_0xa2eff8){var _0x53ebee=typeof _0x1fd0f5['offset']==='undefined'&&typeof _0x1fd0f5[_0xfc5f('0x18')]===_0xfc5f('0x19');var _0x342d19=_0xa2eff8[_0xfc5f('0x1a')];var _0xcb11a3=_0x53ebee?0x0:_0x1fd0f5['offset'];var _0x499a19=_0x53ebee?_0xa2eff8[_0xfc5f('0x1a')]:_0x1fd0f5['offset']+_0x1fd0f5['limit'];var _0x210b86;if(_0x499a19>=_0x342d19){_0x499a19=_0x342d19;_0x210b86=0xc8;}else{_0x210b86=0xce;}_0x4fa145[_0xfc5f('0x15')](_0x210b86);return _0x4fa145[_0xfc5f('0x1b')](_0xfc5f('0x1c'),_0xcb11a3+'-'+_0x499a19+'/'+_0x342d19)[_0xfc5f('0x17')](_0xa2eff8);}return null;};}function patchUpdates(_0x2d3114){return function(_0x3bf3cd){try{jsonpatch[_0xfc5f('0x1d')](_0x3bf3cd,_0x2d3114,!![]);}catch(_0x299756){return BPromise[_0xfc5f('0x1e')](_0x299756);}return _0x3bf3cd[_0xfc5f('0x1f')]();};}function saveUpdates(_0x361410,_0x2a046e){return function(_0x493ecc){if(_0x493ecc){return _0x493ecc['update'](_0x361410)[_0xfc5f('0x20')](function(_0x71d123){return _0x71d123;});}return null;};}function removeEntity(_0x2f890c,_0x4e7cb8){return function(_0x42fc1a){if(_0x42fc1a){return _0x42fc1a[_0xfc5f('0x21')]()[_0xfc5f('0x20')](function(){_0x2f890c[_0xfc5f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd933b3,_0x478a52){return function(_0x4559c0){if(!_0x4559c0){_0xd933b3[_0xfc5f('0x14')](0x194);}return _0x4559c0;};}function handleError(_0x53ed2f,_0x120333){_0x120333=_0x120333||0x1f4;return function(_0x5e6a6c){logger[_0xfc5f('0x22')](_0x5e6a6c[_0xfc5f('0x23')]);if(_0x5e6a6c[_0xfc5f('0x24')]){delete _0x5e6a6c['name'];}_0x53ed2f[_0xfc5f('0x15')](_0x120333)[_0xfc5f('0x25')](_0x5e6a6c);};}exports['index']=function(_0x5bb650,_0x5be30d){var _0xae7d10={},_0x59fdda={},_0x271e72={'count':0x0,'rows':[]};var _0x51fe11=_[_0xfc5f('0x26')](db[_0xfc5f('0x27')][_0xfc5f('0x28')],function(_0x24d4bc){return{'name':_0x24d4bc[_0xfc5f('0x29')],'type':_0x24d4bc[_0xfc5f('0x2a')][_0xfc5f('0x2b')]};});_0x59fdda[_0xfc5f('0x2c')]=_[_0xfc5f('0x26')](_0x51fe11,_0xfc5f('0x24'));_0x59fdda[_0xfc5f('0x2d')]=_[_0xfc5f('0x2e')](_0x5bb650[_0xfc5f('0x2d')]);_0x59fdda[_0xfc5f('0x2f')]=_[_0xfc5f('0x30')](_0x59fdda[_0xfc5f('0x2c')],_0x59fdda[_0xfc5f('0x2d')]);_0xae7d10[_0xfc5f('0x31')]=_[_0xfc5f('0x30')](_0x59fdda[_0xfc5f('0x2c')],qs[_0xfc5f('0x32')](_0x5bb650[_0xfc5f('0x2d')]['fields']));_0xae7d10['attributes']=_0xae7d10[_0xfc5f('0x31')]['length']?_0xae7d10[_0xfc5f('0x31')]:_0x59fdda[_0xfc5f('0x2c')];if(!_0x5bb650['query'][_0xfc5f('0x33')]('nolimit')){_0xae7d10['limit']=qs[_0xfc5f('0x18')](_0x5bb650[_0xfc5f('0x2d')][_0xfc5f('0x18')]);_0xae7d10[_0xfc5f('0x34')]=qs['offset'](_0x5bb650[_0xfc5f('0x2d')][_0xfc5f('0x34')]);}_0xae7d10['order']=qs['sort'](_0x5bb650[_0xfc5f('0x2d')][_0xfc5f('0x35')]);_0xae7d10[_0xfc5f('0x36')]=qs['filters'](_[_0xfc5f('0x37')](_0x5bb650[_0xfc5f('0x2d')],_0x59fdda[_0xfc5f('0x2f')]),_0x51fe11);if(_0x5bb650[_0xfc5f('0x2d')][_0xfc5f('0x38')]){_0xae7d10['where']=_[_0xfc5f('0x39')](_0xae7d10[_0xfc5f('0x36')],{'$or':_[_0xfc5f('0x26')](_0x51fe11,function(_0x4f8a02){if(_0x4f8a02[_0xfc5f('0x2a')]!=='VIRTUAL'){var _0x1e6df1={};_0x1e6df1[_0x4f8a02[_0xfc5f('0x24')]]={'$like':'%'+_0x5bb650[_0xfc5f('0x2d')][_0xfc5f('0x38')]+'%'};return _0x1e6df1;}})});}_0xae7d10=_[_0xfc5f('0x39')]({},_0xae7d10,_0x5bb650['options']);var _0x3ce015={'where':_0xae7d10[_0xfc5f('0x36')]};return db[_0xfc5f('0x27')][_0xfc5f('0x1a')](_0x3ce015)[_0xfc5f('0x20')](function(_0x5e9f99){_0x271e72['count']=_0x5e9f99;if(_0x5bb650[_0xfc5f('0x2d')]['includeAll']){_0xae7d10['include']=[{'all':!![]}];}return db[_0xfc5f('0x27')][_0xfc5f('0x3a')](_0xae7d10);})[_0xfc5f('0x20')](function(_0x5cd5c0){_0x271e72[_0xfc5f('0x3b')]=_0x5cd5c0;return _0x271e72;})[_0xfc5f('0x20')](respondWithFilteredResult(_0x5be30d,_0xae7d10))['catch'](handleError(_0x5be30d,null));};exports[_0xfc5f('0x3c')]=function(_0x337e09,_0x2a2d89){var _0x489992={'raw':![],'where':{'id':_0x337e09[_0xfc5f('0x3d')]['id']}},_0x2f7c2b={};_0x2f7c2b[_0xfc5f('0x2c')]=_[_0xfc5f('0x2e')](db[_0xfc5f('0x27')][_0xfc5f('0x28')]);_0x2f7c2b['query']=_[_0xfc5f('0x2e')](_0x337e09[_0xfc5f('0x2d')]);_0x2f7c2b[_0xfc5f('0x2f')]=_['intersection'](_0x2f7c2b[_0xfc5f('0x2c')],_0x2f7c2b[_0xfc5f('0x2d')]);_0x489992[_0xfc5f('0x31')]=_[_0xfc5f('0x30')](_0x2f7c2b['model'],qs[_0xfc5f('0x32')](_0x337e09[_0xfc5f('0x2d')][_0xfc5f('0x32')]));_0x489992[_0xfc5f('0x31')]=_0x489992[_0xfc5f('0x31')][_0xfc5f('0x3e')]?_0x489992[_0xfc5f('0x31')]:_0x2f7c2b[_0xfc5f('0x2c')];if(_0x337e09[_0xfc5f('0x2d')]['includeAll']){_0x489992[_0xfc5f('0x3f')]=[{'all':!![]}];}_0x489992=_[_0xfc5f('0x39')]({},_0x489992,_0x337e09[_0xfc5f('0x40')]);return db[_0xfc5f('0x27')][_0xfc5f('0x41')](_0x489992)['then'](handleEntityNotFound(_0x2a2d89,null))[_0xfc5f('0x20')](respondWithResult(_0x2a2d89,null))[_0xfc5f('0x42')](handleError(_0x2a2d89,null));};exports[_0xfc5f('0x43')]=function(_0x4e5710,_0x334c6d){return db['UserProfileSection'][_0xfc5f('0x43')](_0x4e5710[_0xfc5f('0x44')],{})[_0xfc5f('0x20')](respondWithResult(_0x334c6d,0xc9))[_0xfc5f('0x42')](handleError(_0x334c6d,null));};exports[_0xfc5f('0x45')]=function(_0x3fbfda,_0x32f03e){if(_0x3fbfda[_0xfc5f('0x44')]['id']){delete _0x3fbfda[_0xfc5f('0x44')]['id'];}return db['UserProfileSection'][_0xfc5f('0x41')]({'where':{'id':_0x3fbfda[_0xfc5f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x32f03e,null))[_0xfc5f('0x20')](saveUpdates(_0x3fbfda[_0xfc5f('0x44')],null))[_0xfc5f('0x20')](respondWithResult(_0x32f03e,null))[_0xfc5f('0x42')](handleError(_0x32f03e,null));};exports['destroy']=function(_0x343743,_0x2384ea){return db[_0xfc5f('0x27')][_0xfc5f('0x41')]({'where':{'id':_0x343743[_0xfc5f('0x3d')]['id']}})[_0xfc5f('0x20')](handleEntityNotFound(_0x2384ea,null))[_0xfc5f('0x20')](removeEntity(_0x2384ea,null))[_0xfc5f('0x42')](handleError(_0x2384ea,null));};exports['describe']=function(_0xef0708,_0x271a54){return db[_0xfc5f('0x27')][_0xfc5f('0x46')]()['then'](respondWithResult(_0x271a54,null))[_0xfc5f('0x42')](handleError(_0x271a54,null));}; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 5ab5f29..dbb5dd8 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 _0xb7ad=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_profile_has_sections','sectionId','userProfileId','lodash'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xb7ad,0x11d));var _0xdb7a=function(_0xcacc93,_0xba3c4f){_0xcacc93=_0xcacc93-0x0;var _0x4b0ac4=_0xb7ad[_0xcacc93];return _0x4b0ac4;};'use strict';var _=require(_0xdb7a('0x0'));var util=require('util');var logger=require(_0xdb7a('0x1'))(_0xdb7a('0x2'));var moment=require(_0xdb7a('0x3'));var BPromise=require(_0xdb7a('0x4'));var rp=require(_0xdb7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb7a('0x6'));var config=require(_0xdb7a('0x7'));var attributes=require('./userProfileSection.attributes');module[_0xdb7a('0x8')]=function(_0x24b530,_0x2cbe61){return _0x24b530[_0xdb7a('0x9')]('UserProfileSection',attributes,{'tableName':_0xdb7a('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xdb7a('0xb'),_0xdb7a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e8718e9..dd7af45 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 _0x3805=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x3805,0x111));var _0x5380=function(_0x4fdd64,_0x4ec5d4){_0x4fdd64=_0x4fdd64-0x0;var _0x1e9ae1=_0x3805[_0x4fdd64];return _0x1e9ae1;};'use strict';var _=require(_0x5380('0x0'));var util=require(_0x5380('0x1'));var moment=require(_0x5380('0x2'));var BPromise=require(_0x5380('0x3'));var rs=require(_0x5380('0x4'));var fs=require('fs');var Redis=require(_0x5380('0x5'));var db=require(_0x5380('0x6'))['db'];var utils=require(_0x5380('0x7'));var logger=require(_0x5380('0x8'))(_0x5380('0x9'));var config=require(_0x5380('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5380('0xb')][_0x5380('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302f57,_0x238be8,_0x97466a){return new BPromise(function(_0xdb98c0,_0x5087c2){return client[_0x5380('0xd')](_0x302f57,_0x97466a)[_0x5380('0xe')](function(_0x221881){logger[_0x5380('0xf')](_0x5380('0x10'),_0x238be8,'request\x20sent');logger[_0x5380('0x11')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x238be8,_0x5380('0x12'),JSON['stringify'](_0x221881));if(_0x221881[_0x5380('0x13')]){if(_0x221881['error'][_0x5380('0x14')]===0x1f4){logger[_0x5380('0x13')](_0x5380('0x10'),_0x238be8,_0x221881[_0x5380('0x13')][_0x5380('0x15')]);return _0x5087c2(_0x221881['error'][_0x5380('0x15')]);}logger[_0x5380('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x238be8,_0x221881['error'][_0x5380('0x15')]);return _0xdb98c0(_0x221881[_0x5380('0x13')]['message']);}else{logger[_0x5380('0xf')](_0x5380('0x10'),_0x238be8,_0x5380('0x12'));_0xdb98c0(_0x221881[_0x5380('0x16')][_0x5380('0x15')]);}})['catch'](function(_0x4e884d){logger[_0x5380('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x238be8,_0x4e884d);_0x5087c2(_0x4e884d);});});} \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 6527f5c..8683ed7 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x54ebfe,_0x40b894){var _0x4f5bfd=function(_0x503b67){while(--_0x503b67){_0x54ebfe['push'](_0x54ebfe['shift']());}};_0x4f5bfd(++_0x40b894);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xcb91[_0x3ba924];return _0x4cc1df;};'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 _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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 3a1b43c..46c2178 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 _0x992a=['exports','INTEGER','sequelize'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x992a,0x1e8));var _0xa992=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x992a[_0x22eb96];return _0x5e1adf;};'use strict';var Sequelize=require(_0xa992('0x0'));module[_0xa992('0x1')]={'penalty':{'type':Sequelize[_0xa992('0x2')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4c6dd15..bb06eb9 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 _0xaa3f=['rimraf','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x259b3a,_0x44a62d){var _0x5642ea=function(_0x3d9e31){while(--_0x3d9e31){_0x259b3a['push'](_0x259b3a['shift']());}};_0x5642ea(++_0x44a62d);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x149b9,_0x85803e){_0x149b9=_0x149b9-0x0;var _0x111a7e=_0xaa3f[_0x149b9];return _0x111a7e;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 5f312ca..d107870 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 _0xc253=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0xd4470d,_0x47318d){var _0x5544c5=function(_0x3486cb){while(--_0x3486cb){_0xd4470d['push'](_0xd4470d['shift']());}};_0x5544c5(++_0x47318d);}(_0xc253,0x151));var _0x3c25=function(_0x89bddd,_0x5c50e8){_0x89bddd=_0x89bddd-0x0;var _0x3a10e6=_0xc253[_0x89bddd];return _0x3a10e6;};'use strict';var _=require(_0x3c25('0x0'));var util=require(_0x3c25('0x1'));var moment=require('moment');var BPromise=require(_0x3c25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c25('0x3'));var db=require(_0x3c25('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c25('0x5'));var config=require('../../config/environment');var jayson=require(_0x3c25('0x6'));var client=jayson[_0x3c25('0x7')][_0x3c25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48fe84,_0x3e3a31,_0x1e57fd){return new BPromise(function(_0x33df4b,_0x467c65){return client['request'](_0x48fe84,_0x1e57fd)[_0x3c25('0x9')](function(_0x36db88){logger[_0x3c25('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x3e3a31,_0x3c25('0xb'));logger[_0x3c25('0xc')](_0x3c25('0xd'),_0x3e3a31,_0x3c25('0xb'),JSON['stringify'](_0x36db88));if(_0x36db88[_0x3c25('0xe')]){if(_0x36db88[_0x3c25('0xe')][_0x3c25('0xf')]===0x1f4){logger[_0x3c25('0xe')](_0x3c25('0x10'),_0x3e3a31,_0x36db88[_0x3c25('0xe')][_0x3c25('0x11')]);return _0x467c65(_0x36db88[_0x3c25('0xe')][_0x3c25('0x11')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x3e3a31,_0x36db88[_0x3c25('0xe')][_0x3c25('0x11')]);return _0x33df4b(_0x36db88['error'][_0x3c25('0x11')]);}else{logger[_0x3c25('0xa')](_0x3c25('0x10'),_0x3e3a31,_0x3c25('0xb'));_0x33df4b(_0x36db88[_0x3c25('0x12')][_0x3c25('0x11')]);}})[_0x3c25('0x13')](function(_0x505319){logger[_0x3c25('0xe')](_0x3c25('0x10'),_0x3e3a31,_0x505319);_0x467c65(_0x505319);});});} \ No newline at end of file +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 diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 346de69..d62038d 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 _0x5977=['sequelize','INTEGER'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5977,0xc4));var _0x7597=function(_0xb6e150,_0x3b528d){_0xb6e150=_0xb6e150-0x0;var _0x394a0a=_0x5977[_0xb6e150];return _0x394a0a;};'use strict';var Sequelize=require(_0x7597('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x7597('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7597('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 7d41cf3..f50f5de 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(_0x1fd6b4,_0x4fd7d3){var _0x4bafb9=function(_0x4da81d){while(--_0x4da81d){_0x1fd6b4['push'](_0x1fd6b4['shift']());}};_0x4bafb9(++_0x4fd7d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_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 diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 3071fa5..cb8307a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2004f3,_0x56edab){var _0x5810c8=function(_0x2ec2e9){while(--_0x2ec2e9){_0x2004f3['push'](_0x2004f3['shift']());}};_0x5810c8(++_0x56edab);}(_0xe706,0xa3));var _0x6e70=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0xe706[_0x32a767];return _0x2b4e6d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6fdef15..1e15deb 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 _0x877f=['INTEGER','sequelize','exports'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x877f,0x12d));var _0xf877=function(_0x3be77b,_0x2b1345){_0x3be77b=_0x3be77b-0x0;var _0x2d9841=_0x877f[_0x3be77b];return _0x2d9841;};'use strict';var Sequelize=require(_0xf877('0x0'));module[_0xf877('0x1')]={'penalty':{'type':Sequelize[_0xf877('0x2')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0ab950a..3eb0461 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 _0x0a7a=['./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','moment','path','rimraf','../../config/environment'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x0a7a,0x68));var _0xa0a7=function(_0x6af117,_0x7d6329){_0x6af117=_0x6af117-0x0;var _0xe616a1=_0x0a7a[_0x6af117];return _0xe616a1;};'use strict';var _=require(_0xa0a7('0x0'));var util=require(_0xa0a7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0a7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0a7('0x3'));var rimraf=require(_0xa0a7('0x4'));var config=require(_0xa0a7('0x5'));var attributes=require(_0xa0a7('0x6'));module[_0xa0a7('0x7')]=function(_0x3e796c,_0x361e8e){return _0x3e796c[_0xa0a7('0x8')](_0xa0a7('0x9'),attributes,{'tableName':_0xa0a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8be6b6b..f0fc155 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 _0xa584=['request\x20sent','debug','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x5cdd77,_0x5a06d4){var _0x1dee7b=function(_0x2e4980){while(--_0x2e4980){_0x5cdd77['push'](_0x5cdd77['shift']());}};_0x1dee7b(++_0x5a06d4);}(_0xa584,0x7a));var _0x4a58=function(_0x5756e1,_0x1bb757){_0x5756e1=_0x5756e1-0x0;var _0x1c7822=_0xa584[_0x5756e1];return _0x1c7822;};'use strict';var _=require(_0x4a58('0x0'));var util=require(_0x4a58('0x1'));var moment=require(_0x4a58('0x2'));var BPromise=require(_0x4a58('0x3'));var rs=require(_0x4a58('0x4'));var fs=require('fs');var Redis=require(_0x4a58('0x5'));var db=require(_0x4a58('0x6'))['db'];var utils=require(_0x4a58('0x7'));var logger=require(_0x4a58('0x8'))(_0x4a58('0x9'));var config=require(_0x4a58('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4a58('0xb')][_0x4a58('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29c366,_0x2fc952,_0x48e223){return new BPromise(function(_0x2ef575,_0x3aa977){return client[_0x4a58('0xd')](_0x29c366,_0x48e223)[_0x4a58('0xe')](function(_0x39e6d4){logger['info'](_0x4a58('0xf'),_0x2fc952,_0x4a58('0x10'));logger[_0x4a58('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2fc952,_0x4a58('0x10'),JSON['stringify'](_0x39e6d4));if(_0x39e6d4[_0x4a58('0x12')]){if(_0x39e6d4[_0x4a58('0x12')][_0x4a58('0x13')]===0x1f4){logger[_0x4a58('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2fc952,_0x39e6d4[_0x4a58('0x12')]['message']);return _0x3aa977(_0x39e6d4[_0x4a58('0x12')][_0x4a58('0x14')]);}logger[_0x4a58('0x12')](_0x4a58('0xf'),_0x2fc952,_0x39e6d4[_0x4a58('0x12')][_0x4a58('0x14')]);return _0x2ef575(_0x39e6d4['error'][_0x4a58('0x14')]);}else{logger[_0x4a58('0x15')]('UserVoiceQueue,\x20%s,\x20%s',_0x2fc952,_0x4a58('0x10'));_0x2ef575(_0x39e6d4['result']['message']);}})[_0x4a58('0x16')](function(_0x3f2045){logger[_0x4a58('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2fc952,_0x3f2045);_0x3aa977(_0x3f2045);});});} \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9436868..668549b 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(_0x2ca0a1,_0x59d9e7){var _0x406969=function(_0x57dc8e){while(--_0x57dc8e){_0x2ca0a1['push'](_0x2ca0a1['shift']());}};_0x406969(++_0x59d9e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 929188e..d2d66e8 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 _0xa115=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x213fdc,_0x5228fd){var _0x107e7a=function(_0x5b53da){while(--_0x5b53da){_0x213fdc['push'](_0x213fdc['shift']());}};_0x107e7a(++_0x5228fd);}(_0xa115,0x81));var _0x5a11=function(_0x2dbb14,_0x15aa5b){_0x2dbb14=_0x2dbb14-0x0;var _0x56b489=_0xa115[_0x2dbb14];return _0x56b489;};'use strict';var Sequelize=require(_0x5a11('0x0'));module[_0x5a11('0x1')]={'uniqueid':{'type':Sequelize[_0x5a11('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5a11('0x3')},'membername':{'type':Sequelize[_0x5a11('0x4')],'allowNull':![],'comment':_0x5a11('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5a11('0x4')],'allowNull':![],'unique':_0x5a11('0x5'),'comment':_0x5a11('0x3')},'VoiceQueueId':{'type':Sequelize[_0x5a11('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x5a11('0x4')],'allowNull':![],'unique':_0x5a11('0x5'),'comment':_0x5a11('0x3')},'penalty':{'type':Sequelize[_0x5a11('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x5a11('0x2')](0xb),'defaultValue':0x0,'comment':_0x5a11('0x3')}}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6d05c39..7a6d8da 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 _0x6b91=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6b91,0x18f));var _0x16b9=function(_0x811cb,_0x30e889){_0x811cb=_0x811cb-0x0;var _0x16ba85=_0x6b91[_0x811cb];return _0x16ba85;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x16b9('0x0')](0x0);var events={'afterCreate':_0x16b9('0x1'),'afterUpdate':_0x16b9('0x2'),'afterDestroy':_0x16b9('0x3')};function emitEvent(_0x10a7a2){return function(_0x5a3541,_0x4f18e9,_0x5cf4e1){UserVoiceQueueRtEvents[_0x16b9('0x4')](_0x10a7a2+':'+_0x5a3541['id'],_0x5a3541);UserVoiceQueueRtEvents[_0x16b9('0x4')](_0x10a7a2,_0x5a3541);_0x5cf4e1(null);};}for(var e in events){if(events[_0x16b9('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x16b9('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8181780..0698fd2 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 _0x1b23=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x109203,_0x54d848){var _0x455bac=function(_0xca7ac3){while(--_0xca7ac3){_0x109203['push'](_0x109203['shift']());}};_0x455bac(++_0x54d848);}(_0x1b23,0x1ca));var _0x31b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1b23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x31b2('0x0'));var util=require('util');var logger=require(_0x31b2('0x1'))(_0x31b2('0x2'));var moment=require(_0x31b2('0x3'));var BPromise=require(_0x31b2('0x4'));var rp=require(_0x31b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31b2('0x6'));var config=require(_0x31b2('0x7'));var attributes=require(_0x31b2('0x8'));module['exports']=function(_0x333a94,_0x52d361){return _0x333a94[_0x31b2('0x9')](_0x31b2('0xa'),attributes,{'tableName':_0x31b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index d0cbf53..bc64ed4 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 _0x93d7=['request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','request\x20sent','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userVoiceQueueRt.socket'];(function(_0xce12d7,_0x33a261){var _0x4d02c6=function(_0x381289){while(--_0x381289){_0xce12d7['push'](_0xce12d7['shift']());}};_0x4d02c6(++_0x33a261);}(_0x93d7,0x68));var _0x793d=function(_0x477286,_0x1486a8){_0x477286=_0x477286-0x0;var _0x4688bc=_0x93d7[_0x477286];return _0x4688bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x793d('0x0'));var BPromise=require(_0x793d('0x1'));var rs=require(_0x793d('0x2'));var fs=require('fs');var Redis=require(_0x793d('0x3'));var db=require(_0x793d('0x4'))['db'];var utils=require(_0x793d('0x5'));var logger=require(_0x793d('0x6'))(_0x793d('0x7'));var config=require(_0x793d('0x8'));var jayson=require(_0x793d('0x9'));var client=jayson[_0x793d('0xa')][_0x793d('0xb')]({'port':0x232a});config[_0x793d('0xc')]=_[_0x793d('0xd')](config[_0x793d('0xc')],{'host':_0x793d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x793d('0xc')]));require(_0x793d('0xf'))['register'](socket);function respondWithRpcPromise(_0x1df789,_0x560c6a,_0x5a213f){return new BPromise(function(_0xab1a6e,_0x634fa9){return client[_0x793d('0x10')](_0x1df789,_0x5a213f)[_0x793d('0x11')](function(_0x1ed657){logger[_0x793d('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x560c6a,'request\x20sent');logger[_0x793d('0x13')](_0x793d('0x14'),_0x560c6a,'request\x20sent',JSON[_0x793d('0x15')](_0x1ed657));if(_0x1ed657['error']){if(_0x1ed657[_0x793d('0x16')][_0x793d('0x17')]===0x1f4){logger[_0x793d('0x16')](_0x793d('0x18'),_0x560c6a,_0x1ed657[_0x793d('0x16')]['message']);return _0x634fa9(_0x1ed657['error'][_0x793d('0x19')]);}logger[_0x793d('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x560c6a,_0x1ed657['error'][_0x793d('0x19')]);return _0xab1a6e(_0x1ed657[_0x793d('0x16')][_0x793d('0x19')]);}else{logger[_0x793d('0x12')](_0x793d('0x18'),_0x560c6a,_0x793d('0x1a'));_0xab1a6e(_0x1ed657[_0x793d('0x1b')][_0x793d('0x19')]);}})[_0x793d('0x1c')](function(_0x47e8ff){logger[_0x793d('0x16')](_0x793d('0x18'),_0x560c6a,_0x47e8ff);_0x634fa9(_0x47e8ff);});});}exports['GetVoiceQueueRtPauses']=function(_0x566aec){var _0x208498=this;return new Promise(function(_0x233525,_0x42cca3){return db[_0x793d('0x1d')][_0x793d('0x1e')]({'raw':_0x566aec['options']?_0x566aec[_0x793d('0x1f')][_0x793d('0x20')]===undefined?!![]:![]:!![],'where':_0x566aec[_0x793d('0x1f')]?_0x566aec[_0x793d('0x1f')][_0x793d('0x21')]||null:null,'attributes':[[db[_0x793d('0x22')]['fn'](_0x793d('0x23'),db['sequelize']['fn']('IF',db[_0x793d('0x22')][_0x793d('0x24')](_0x793d('0x25')))),_0x793d('0x26')]]})[_0x793d('0x11')](function(_0x130e5e){logger['info'](_0x793d('0x27'),_0x566aec);logger['debug']('GetVoiceQueueRtPauses',_0x566aec,JSON['stringify'](_0x130e5e));_0x233525(_0x130e5e);})['catch'](function(_0x39dd09){logger[_0x793d('0x16')](_0x793d('0x27'),_0x39dd09[_0x793d('0x19')],_0x566aec);_0x42cca3(_0x208498[_0x793d('0x16')](0x1f4,_0x39dd09['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d480cd4..2e79f57 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 _0xbac8=['./userVoiceQueueRt.events','save','length','userVoiceQueueRt:'];(function(_0x4eb926,_0x1a4b89){var _0x273a87=function(_0x3ba51b){while(--_0x3ba51b){_0x4eb926['push'](_0x4eb926['shift']());}};_0x273a87(++_0x1a4b89);}(_0xbac8,0x140));var _0x8bac=function(_0x2d0099,_0x199465){_0x2d0099=_0x2d0099-0x0;var _0x3a784b=_0xbac8[_0x2d0099];return _0x3a784b;};'use strict';var UserVoiceQueueRtEvents=require(_0x8bac('0x0'));var events=[_0x8bac('0x1'),'remove','update'];function createListener(_0x9c72e9,_0x1bc048){return function(_0x333437){_0x1bc048['emit'](_0x9c72e9,_0x333437);};}function removeListener(_0x3f0076,_0x10229f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3f0076,_0x10229f);};}exports['register']=function(_0x28b1d1){for(var _0x36f5b4=0x0,_0x3e95bb=events[_0x8bac('0x2')];_0x36f5b4<_0x3e95bb;_0x36f5b4++){var _0x2e6c33=events[_0x36f5b4];var _0x3a315c=createListener(_0x8bac('0x3')+_0x2e6c33,_0x28b1d1);UserVoiceQueueRtEvents['on'](_0x2e6c33,_0x3a315c);}}; \ No newline at end of file +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 diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6eb735d..7526626 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3a02d7,_0x497199){var _0x3812de=function(_0x38a68e){while(--_0x38a68e){_0x3a02d7['push'](_0x3a02d7['shift']());}};_0x3812de(++_0x497199);}(_0x70e0,0x17b));var _0x070e=function(_0x51605f,_0x322ce6){_0x51605f=_0x51605f-0x0;var _0x50277a=_0x70e0[_0x51605f];return _0x50277a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5d5e16c..10d864a 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 _0x7089=['sequelize','INTEGER'];(function(_0x2abc13,_0x29d4b7){var _0x9117d8=function(_0x350acb){while(--_0x350acb){_0x2abc13['push'](_0x2abc13['shift']());}};_0x9117d8(++_0x29d4b7);}(_0x7089,0xd8));var _0x9708=function(_0xaaafaf,_0x4f0c79){_0xaaafaf=_0xaaafaf-0x0;var _0x2ad2e9=_0x7089[_0xaaafaf];return _0x2ad2e9;};'use strict';var Sequelize=require(_0x9708('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9708('0x1')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b539b2f..31e580f 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 _0x8ec0=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8ec0,0x84));var _0x08ec=function(_0x2e2bb6,_0x347574){_0x2e2bb6=_0x2e2bb6-0x0;var _0x4f9a76=_0x8ec0[_0x2e2bb6];return _0x4f9a76;};'use strict';var _=require('lodash');var util=require(_0x08ec('0x0'));var logger=require(_0x08ec('0x1'))(_0x08ec('0x2'));var moment=require(_0x08ec('0x3'));var BPromise=require(_0x08ec('0x4'));var rp=require(_0x08ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08ec('0x6'));var config=require(_0x08ec('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x08ec('0x8')]=function(_0x1f142c,_0x21ac87){return _0x1f142c['define'](_0x08ec('0x9'),attributes,{'tableName':_0x08ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 8479eef..c047f9d 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 _0x4145=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x4145,0x1d8));var _0x5414=function(_0x104377,_0x3f0ddf){_0x104377=_0x104377-0x0;var _0x3000cf=_0x4145[_0x104377];return _0x3000cf;};'use strict';var _=require(_0x5414('0x0'));var util=require(_0x5414('0x1'));var moment=require(_0x5414('0x2'));var BPromise=require(_0x5414('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5414('0x4'))['db'];var utils=require(_0x5414('0x5'));var logger=require(_0x5414('0x6'))('rpc');var config=require(_0x5414('0x7'));var jayson=require(_0x5414('0x8'));var client=jayson[_0x5414('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4020c2,_0x41931d,_0x1cc310){return new BPromise(function(_0x3402a4,_0x3eba4d){return client[_0x5414('0xa')](_0x4020c2,_0x1cc310)[_0x5414('0xb')](function(_0x5754bf){logger['info'](_0x5414('0xc'),_0x41931d,_0x5414('0xd'));logger['debug'](_0x5414('0xe'),_0x41931d,_0x5414('0xd'),JSON[_0x5414('0xf')](_0x5754bf));if(_0x5754bf[_0x5414('0x10')]){if(_0x5754bf[_0x5414('0x10')][_0x5414('0x11')]===0x1f4){logger[_0x5414('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x41931d,_0x5754bf['error'][_0x5414('0x12')]);return _0x3eba4d(_0x5754bf['error']['message']);}logger[_0x5414('0x10')](_0x5414('0xc'),_0x41931d,_0x5754bf[_0x5414('0x10')][_0x5414('0x12')]);return _0x3402a4(_0x5754bf[_0x5414('0x10')][_0x5414('0x12')]);}else{logger[_0x5414('0x13')](_0x5414('0xc'),_0x41931d,_0x5414('0xd'));_0x3402a4(_0x5754bf[_0x5414('0x14')]['message']);}})[_0x5414('0x15')](function(_0x2d5c6e){logger[_0x5414('0x10')](_0x5414('0xc'),_0x41931d,_0x2d5c6e);_0x3eba4d(_0x2d5c6e);});});} \ No newline at end of file +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 diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 04216c7..81ee9e3 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 _0x6732=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2673('0x0'));var util=require(_0x2673('0x1'));var path=require(_0x2673('0x2'));var timeout=require(_0x2673('0x3'));var express=require('express');var router=express[_0x2673('0x4')]();var fs_extra=require(_0x2673('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2673('0x6'));var config=require(_0x2673('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0x2673('0x8')](),controller[_0x2673('0x9')]);router[_0x2673('0xa')](_0x2673('0xb'),auth[_0x2673('0x8')](),controller[_0x2673('0xc')]);router[_0x2673('0xd')]('/',auth[_0x2673('0x8')](),controller[_0x2673('0xe')]);router[_0x2673('0xf')](_0x2673('0xb'),auth[_0x2673('0x8')](),controller[_0x2673('0x10')]);router[_0x2673('0x11')](_0x2673('0xb'),auth[_0x2673('0x8')](),controller[_0x2673('0x12')]);module[_0x2673('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d2fb7f9..f208775 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 _0x9a0b=['name','STRING'];(function(_0x58bd6d,_0x56b747){var _0x4811d9=function(_0x1717a4){while(--_0x1717a4){_0x58bd6d['push'](_0x58bd6d['shift']());}};_0x4811d9(++_0x56b747);}(_0x9a0b,0xff));var _0xb9a0=function(_0x2a90b8,_0x50a794){_0x2a90b8=_0x2a90b8-0x0;var _0xf67946=_0x9a0b[_0x2a90b8];return _0xf67946;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb9a0('0x0')],'unique':_0xb9a0('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 67c1f0f..b9a9a23 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 _0xa073=['then','destroy','Variables','UserProfileResource','end','error','name','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','options','Variable','include','findAll','rows','catch','show','params','keys','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa073,0x7c));var _0x3a07=function(_0x2c2cc3,_0x33db16){_0x2c2cc3=_0x2c2cc3-0x0;var _0x13e65b=_0xa073[_0x2c2cc3];return _0x13e65b;};'use strict';var emlformat=require(_0x3a07('0x0'));var rimraf=require(_0x3a07('0x1'));var zipdir=require(_0x3a07('0x2'));var jsonpatch=require(_0x3a07('0x3'));var rp=require(_0x3a07('0x4'));var moment=require(_0x3a07('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a07('0x6'));var util=require(_0x3a07('0x7'));var path=require(_0x3a07('0x8'));var sox=require('sox');var csv=require(_0x3a07('0x9'));var ejs=require(_0x3a07('0xa'));var fs=require('fs');var fs_extra=require(_0x3a07('0xb'));var _=require(_0x3a07('0xc'));var squel=require(_0x3a07('0xd'));var crypto=require('crypto');var jsforce=require(_0x3a07('0xe'));var deskjs=require(_0x3a07('0xf'));var toCsv=require(_0x3a07('0x9'));var querystring=require(_0x3a07('0x10'));var Papa=require('papaparse');var Redis=require(_0x3a07('0x11'));var authService=require(_0x3a07('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3a07('0x13'));var hardwareService=require(_0x3a07('0x14'));var logger=require(_0x3a07('0x15'))(_0x3a07('0x16'));var utils=require(_0x3a07('0x17'));var config=require(_0x3a07('0x18'));var licenseUtil=require(_0x3a07('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd492,_0x101d38){_0x101d38=_0x101d38||0xcc;return function(_0x300e6b){if(_0x300e6b){return _0x4dd492[_0x3a07('0x1a')](_0x101d38);}return _0x4dd492[_0x3a07('0x1b')](_0x101d38)['end']();};}function respondWithResult(_0x5144d4,_0x506ec2){_0x506ec2=_0x506ec2||0xc8;return function(_0x59fea2){if(_0x59fea2){return _0x5144d4[_0x3a07('0x1b')](_0x506ec2)[_0x3a07('0x1c')](_0x59fea2);}};}function respondWithFilteredResult(_0x2c1c35,_0x14c203){return function(_0x3fbaa7){if(_0x3fbaa7){var _0x181b99=typeof _0x14c203['offset']===_0x3a07('0x1d')&&typeof _0x14c203[_0x3a07('0x1e')]===_0x3a07('0x1d');var _0x16391a=_0x3fbaa7[_0x3a07('0x1f')];var _0x59f063=_0x181b99?0x0:_0x14c203['offset'];var _0x36f1f1=_0x181b99?_0x3fbaa7[_0x3a07('0x1f')]:_0x14c203[_0x3a07('0x20')]+_0x14c203[_0x3a07('0x1e')];var _0x75a0e7;if(_0x36f1f1>=_0x16391a){_0x36f1f1=_0x16391a;_0x75a0e7=0xc8;}else{_0x75a0e7=0xce;}_0x2c1c35[_0x3a07('0x1b')](_0x75a0e7);return _0x2c1c35[_0x3a07('0x21')]('Content-Range',_0x59f063+'-'+_0x36f1f1+'/'+_0x16391a)[_0x3a07('0x1c')](_0x3fbaa7);}return null;};}function patchUpdates(_0x26389d){return function(_0x157c8d){try{jsonpatch[_0x3a07('0x22')](_0x157c8d,_0x26389d,!![]);}catch(_0x36253a){return BPromise[_0x3a07('0x23')](_0x36253a);}return _0x157c8d['save']();};}function saveUpdates(_0x10892a,_0xf9b0ff){return function(_0x382bed){if(_0x382bed){return _0x382bed['update'](_0x10892a)[_0x3a07('0x24')](function(_0x1820d8){return _0x1820d8;});}return null;};}function removeEntity(_0x388d28,_0x5f4eeb){return function(_0x54d774){if(_0x54d774){return _0x54d774[_0x3a07('0x25')]()[_0x3a07('0x24')](function(){var _0x39bd88=_0x54d774['get']({'plain':!![]});var _0x111bdd=_0x3a07('0x26');return db[_0x3a07('0x27')][_0x3a07('0x25')]({'where':{'type':_0x111bdd,'resourceId':_0x39bd88['id']}})[_0x3a07('0x24')](function(){return _0x54d774;});})[_0x3a07('0x24')](function(){_0x388d28['status'](0xcc)[_0x3a07('0x28')]();});}};}function handleEntityNotFound(_0x59f29d,_0x5288e6){return function(_0x1b0746){if(!_0x1b0746){_0x59f29d['sendStatus'](0x194);}return _0x1b0746;};}function handleError(_0x2ec9fc,_0x150d88){_0x150d88=_0x150d88||0x1f4;return function(_0x559c77){logger[_0x3a07('0x29')](_0x559c77['stack']);if(_0x559c77[_0x3a07('0x2a')]){delete _0x559c77[_0x3a07('0x2a')];}_0x2ec9fc['status'](_0x150d88)['send'](_0x559c77);};}exports[_0x3a07('0x2b')]=function(_0x12890b,_0x312f80){var _0x46f6d9={},_0x3e34f1={},_0x216732={'count':0x0,'rows':[]};var _0x335fde=_[_0x3a07('0x2c')](db['Variable'][_0x3a07('0x2d')],function(_0x561ae4){return{'name':_0x561ae4['fieldName'],'type':_0x561ae4[_0x3a07('0x2e')]['key']};});_0x3e34f1['model']=_[_0x3a07('0x2c')](_0x335fde,_0x3a07('0x2a'));_0x3e34f1[_0x3a07('0x2f')]=_['keys'](_0x12890b[_0x3a07('0x2f')]);_0x3e34f1[_0x3a07('0x30')]=_[_0x3a07('0x31')](_0x3e34f1[_0x3a07('0x32')],_0x3e34f1[_0x3a07('0x2f')]);_0x46f6d9[_0x3a07('0x33')]=_[_0x3a07('0x31')](_0x3e34f1['model'],qs[_0x3a07('0x34')](_0x12890b['query'][_0x3a07('0x34')]));_0x46f6d9['attributes']=_0x46f6d9[_0x3a07('0x33')][_0x3a07('0x35')]?_0x46f6d9['attributes']:_0x3e34f1[_0x3a07('0x32')];if(!_0x12890b[_0x3a07('0x2f')]['hasOwnProperty']('nolimit')){_0x46f6d9[_0x3a07('0x1e')]=qs[_0x3a07('0x1e')](_0x12890b[_0x3a07('0x2f')][_0x3a07('0x1e')]);_0x46f6d9[_0x3a07('0x20')]=qs[_0x3a07('0x20')](_0x12890b[_0x3a07('0x2f')][_0x3a07('0x20')]);}_0x46f6d9[_0x3a07('0x36')]=qs[_0x3a07('0x37')](_0x12890b[_0x3a07('0x2f')][_0x3a07('0x37')]);_0x46f6d9[_0x3a07('0x38')]=qs[_0x3a07('0x30')](_[_0x3a07('0x39')](_0x12890b[_0x3a07('0x2f')],_0x3e34f1[_0x3a07('0x30')]),_0x335fde);if(_0x12890b[_0x3a07('0x2f')][_0x3a07('0x3a')]){_0x46f6d9[_0x3a07('0x38')]=_[_0x3a07('0x3b')](_0x46f6d9[_0x3a07('0x38')],{'$or':_[_0x3a07('0x2c')](_0x335fde,function(_0xc018d7){if(_0xc018d7[_0x3a07('0x2e')]!=='VIRTUAL'){var _0x1e48b9={};_0x1e48b9[_0xc018d7['name']]={'$like':'%'+_0x12890b[_0x3a07('0x2f')][_0x3a07('0x3a')]+'%'};return _0x1e48b9;}})});}_0x46f6d9=_['merge']({},_0x46f6d9,_0x12890b[_0x3a07('0x3c')]);var _0x108370={'where':_0x46f6d9[_0x3a07('0x38')]};return db[_0x3a07('0x3d')][_0x3a07('0x1f')](_0x108370)[_0x3a07('0x24')](function(_0x4061a2){_0x216732[_0x3a07('0x1f')]=_0x4061a2;if(_0x12890b[_0x3a07('0x2f')]['includeAll']){_0x46f6d9[_0x3a07('0x3e')]=[{'all':!![]}];}return db[_0x3a07('0x3d')][_0x3a07('0x3f')](_0x46f6d9);})[_0x3a07('0x24')](function(_0x20ac80){_0x216732[_0x3a07('0x40')]=_0x20ac80;return _0x216732;})[_0x3a07('0x24')](respondWithFilteredResult(_0x312f80,_0x46f6d9))[_0x3a07('0x41')](handleError(_0x312f80,null));};exports[_0x3a07('0x42')]=function(_0x33454f,_0x26a91b){var _0x3188bf={'raw':!![],'where':{'id':_0x33454f[_0x3a07('0x43')]['id']}},_0x364a44={};_0x364a44[_0x3a07('0x32')]=_['keys'](db[_0x3a07('0x3d')]['rawAttributes']);_0x364a44['query']=_[_0x3a07('0x44')](_0x33454f[_0x3a07('0x2f')]);_0x364a44['filters']=_[_0x3a07('0x31')](_0x364a44[_0x3a07('0x32')],_0x364a44[_0x3a07('0x2f')]);_0x3188bf[_0x3a07('0x33')]=_['intersection'](_0x364a44[_0x3a07('0x32')],qs[_0x3a07('0x34')](_0x33454f[_0x3a07('0x2f')][_0x3a07('0x34')]));_0x3188bf[_0x3a07('0x33')]=_0x3188bf[_0x3a07('0x33')][_0x3a07('0x35')]?_0x3188bf[_0x3a07('0x33')]:_0x364a44[_0x3a07('0x32')];if(_0x33454f['query']['includeAll']){_0x3188bf[_0x3a07('0x3e')]=[{'all':!![]}];}_0x3188bf=_['merge']({},_0x3188bf,_0x33454f[_0x3a07('0x3c')]);return db[_0x3a07('0x3d')]['find'](_0x3188bf)['then'](handleEntityNotFound(_0x26a91b,null))[_0x3a07('0x24')](respondWithResult(_0x26a91b,null))['catch'](handleError(_0x26a91b,null));};exports['create']=function(_0x80b833,_0x27fb69){return db[_0x3a07('0x3d')][_0x3a07('0x45')](_0x80b833[_0x3a07('0x46')],{})[_0x3a07('0x24')](function(_0x5cc88f){var _0x1732c3=_0x80b833['user'][_0x3a07('0x47')]({'plain':!![]});if(!_0x1732c3)throw new Error(_0x3a07('0x48'));if(_0x1732c3[_0x3a07('0x49')]===_0x3a07('0x4a')){var _0x2e23be=_0x5cc88f[_0x3a07('0x47')]({'plain':!![]});var _0x30415f=_0x3a07('0x26');return db[_0x3a07('0x4b')][_0x3a07('0x4c')]({'where':{'name':_0x30415f,'userProfileId':_0x1732c3[_0x3a07('0x4d')]},'raw':!![]})[_0x3a07('0x24')](function(_0x3457e1){if(_0x3457e1&&_0x3457e1[_0x3a07('0x4e')]===0x0){return db[_0x3a07('0x27')][_0x3a07('0x45')]({'name':_0x2e23be[_0x3a07('0x2a')],'resourceId':_0x2e23be['id'],'type':_0x3457e1[_0x3a07('0x2a')],'sectionId':_0x3457e1['id']},{})['then'](function(){return _0x5cc88f;});}else{return _0x5cc88f;}})[_0x3a07('0x41')](function(_0x38fbb8){logger[_0x3a07('0x29')](_0x3a07('0x4f'),_0x38fbb8);throw _0x38fbb8;});}return _0x5cc88f;})['then'](respondWithResult(_0x27fb69,0xc9))['catch'](handleError(_0x27fb69,null));};exports['update']=function(_0x1f19a4,_0x4b363f){if(_0x1f19a4['body']['id']){delete _0x1f19a4[_0x3a07('0x46')]['id'];}return db[_0x3a07('0x3d')]['find']({'where':{'id':_0x1f19a4['params']['id']}})[_0x3a07('0x24')](handleEntityNotFound(_0x4b363f,null))[_0x3a07('0x24')](saveUpdates(_0x1f19a4['body'],null))['then'](respondWithResult(_0x4b363f,null))[_0x3a07('0x41')](handleError(_0x4b363f,null));};exports[_0x3a07('0x25')]=function(_0x3f48b7,_0x258868){return db['Variable'][_0x3a07('0x4c')]({'where':{'id':_0x3f48b7['params']['id']}})[_0x3a07('0x24')](handleEntityNotFound(_0x258868,null))[_0x3a07('0x24')](removeEntity(_0x258868,null))[_0x3a07('0x41')](handleError(_0x258868,null));}; \ No newline at end of file +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 diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2581b7c..b47a18c 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 _0xe4be=['bluebird','request-promise','rimraf','./variable.attributes','define','Variable','lodash','util','../../config/logger','api'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0xe4be,0x1a0));var _0xee4b=function(_0x293cf7,_0x173d4b){_0x293cf7=_0x293cf7-0x0;var _0x565f6b=_0xe4be[_0x293cf7];return _0x565f6b;};'use strict';var _=require(_0xee4b('0x0'));var util=require(_0xee4b('0x1'));var logger=require(_0xee4b('0x2'))(_0xee4b('0x3'));var moment=require('moment');var BPromise=require(_0xee4b('0x4'));var rp=require(_0xee4b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee4b('0x6'));var config=require('../../config/environment');var attributes=require(_0xee4b('0x7'));module['exports']=function(_0x122131,_0x20ccb8){return _0x122131[_0xee4b('0x8')](_0xee4b('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 45bd5c6..6981cda 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x326f,0xd1));var _0xf326=function(_0x1ea9a8,_0x486ece){_0x1ea9a8=_0x1ea9a8-0x0;var _0x594078=_0x326f[_0x1ea9a8];return _0x594078;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 26cf1bf..5c0b9c1 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 _0xe684=['isAuthenticated','fetch','canUpdate','reset','/pull','pull','/migrations','express','Router','../../components/auth/service','./version.controller','index','get','/fetch'];(function(_0x44b346,_0xeb097d){var _0x1c2f2b=function(_0x4e1f23){while(--_0x4e1f23){_0x44b346['push'](_0x44b346['shift']());}};_0x1c2f2b(++_0xeb097d);}(_0xe684,0x111));var _0x4e68=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xe684[_0x243b2f];return _0xcb3c2d;};'use strict';var express=require(_0x4e68('0x0'));var router=express[_0x4e68('0x1')]();var auth=require(_0x4e68('0x2'));var controller=require(_0x4e68('0x3'));router['get']('/',controller[_0x4e68('0x4')]);router[_0x4e68('0x5')](_0x4e68('0x6'),auth[_0x4e68('0x7')](),auth['canUpdate'](),controller[_0x4e68('0x8')]);router[_0x4e68('0x5')]('/reset',auth[_0x4e68('0x7')](),auth[_0x4e68('0x9')](),controller[_0x4e68('0xa')]);router['get'](_0x4e68('0xb'),auth[_0x4e68('0x7')](),auth[_0x4e68('0x9')](),controller[_0x4e68('0xc')]);router['get']('/restart',auth[_0x4e68('0x7')](),controller['restart']);router[_0x4e68('0x5')](_0x4e68('0xd'),controller['migrations']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 2d632f1..b9034c6 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 _0x155e=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','version','push','sort','sequelize','Migration','getQueryInterface','constructor','map','.js','then','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','info'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0x155e,0xf0));var _0xe155=function(_0x13c61b,_0x8641a0){_0x13c61b=_0x13c61b-0x0;var _0x5afdd4=_0x155e[_0x13c61b];return _0x5afdd4;};'use strict';var Umzug=require(_0xe155('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xe155('0x1'));var pkginfo=require(_0xe155('0x2'))(module,'version');var compareVersions=require(_0xe155('0x3'));var exec=require(_0xe155('0x4'))[_0xe155('0x5')];var db=require(_0xe155('0x6'))['db'];var config=require(_0xe155('0x7'));var pm2=require(_0xe155('0x8'));var logger=require(_0xe155('0x9'))(_0xe155('0xa'));var git=require(_0xe155('0xb'))(config[_0xe155('0xc')]);exports[_0xe155('0xd')]=function(_0x4eb119,_0x17b61e){var _0x4586d8={'current':module[_0xe155('0xe')]['version'],'phonebar':0x2};if(_0x4eb119[_0xe155('0xf')]&&_0x4eb119[_0xe155('0xf')][_0xe155('0x10')]){return git[_0xe155('0x11')]()[_0xe155('0x12')](function(_0x52a947,_0x684a0c){_0x4586d8[_0xe155('0x10')]=(_0x52a947?module[_0xe155('0xe')]['version']:_0x684a0c['latest'])||_0xe155('0x13');return _0x17b61e[_0xe155('0x14')](0xc8)[_0xe155('0x15')](_0x4586d8);});}else{return _0x17b61e[_0xe155('0x14')](0xc8)[_0xe155('0x15')](_0x4586d8);}};exports[_0xe155('0x11')]=function(_0x4c7a53,_0x8f4555){return git[_0xe155('0x11')](['origin',_0xe155('0x16')],function(_0x54a57d){if(_0x54a57d){logger[_0xe155('0x17')](_0x54a57d);return _0x8f4555[_0xe155('0x14')](0x1f4)['json'](_0x54a57d);}logger[_0xe155('0x18')](_0xe155('0x19'));return _0x8f4555[_0xe155('0x14')](0xc8)[_0xe155('0x15')]({'output':_0xe155('0x1a')});});};exports[_0xe155('0x1b')]=function(_0x4a38b0,_0x44e885){return git['reset']([_0xe155('0x1c'),'FETCH_HEAD'],function(_0x17b08d){if(_0x17b08d){logger[_0xe155('0x17')](_0x17b08d);return _0x44e885[_0xe155('0x14')](0x1f4)[_0xe155('0x15')](_0x17b08d);}logger[_0xe155('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x44e885[_0xe155('0x14')](0xc8)[_0xe155('0x15')]({'output':_0xe155('0x1d')});});};exports[_0xe155('0x1e')]=function(_0x442466,_0x1863c2){exec(_0xe155('0x1f'),function(_0x3f3c72,_0x55dc80,_0x39aea1){logger[_0xe155('0x18')](_0x55dc80);logger['info'](_0x39aea1);if(_0x3f3c72){logger[_0xe155('0x17')](_0x3f3c72);return _0x1863c2[_0xe155('0x14')](0x1f4)[_0xe155('0x15')](_0x3f3c72);}return _0x1863c2[_0xe155('0x14')](0xc8)['json']({'output':_0x55dc80});});};exports[_0xe155('0x20')]=function(_0x1c69a7,_0x5ed545){return pm2[_0xe155('0x20')]('motion2')['then'](function(_0x4e3c3a){logger[_0xe155('0x18')](_0xe155('0x21'),_0x4e3c3a);return _0x5ed545[_0xe155('0x14')](0xc8)[_0xe155('0x15')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xe155('0x22')](function(_0x4130cd){logger['error'](_0x4130cd);return _0x5ed545['status'](0x1f4)[_0xe155('0x15')](_0x4130cd);});};exports[_0xe155('0x23')]=function(_0x5106a8,_0x60f7fe){var _0x38c5a2=fs[_0xe155('0x24')](path[_0xe155('0x25')](config[_0xe155('0xc')],_0xe155('0x26'),_0xe155('0x23')));var _0x438551=[];for(var _0x4aa802=0x0;_0x4aa802<_0x38c5a2[_0xe155('0x27')];_0x4aa802++){var _0x470bd4=_0x38c5a2[_0x4aa802]['replace']('.js','');if(compareVersions(module['exports'][_0xe155('0x28')],_0x470bd4)===-0x1){_0x438551[_0xe155('0x29')](_0x470bd4);}}if(_0x438551['length']){var _0x8cbdeb=_0x438551[_0xe155('0x2a')](compareVersions);var _0xa4030a=new Umzug({'storage':_0xe155('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0xe155('0x2c'),'columnName':_0xe155('0x28')},'migrations':{'params':[db['sequelize'][_0xe155('0x2d')](),db[_0xe155('0x2b')][_0xe155('0x2e')],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[_0xe155('0xc')],_0xe155('0x26'),_0xe155('0x23')),'pattern':/\.js$/}});_0xa4030a['up']({'migrations':_[_0xe155('0x2f')](_0x8cbdeb,function(_0x1e3687){return _0x1e3687+_0xe155('0x30');})})[_0xe155('0x31')](function(){return _0x60f7fe[_0xe155('0x14')](0xc8)[_0xe155('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xe155('0xe')][_0xe155('0x28')]+_0xe155('0x32')+_[_0xe155('0x33')](_0x8cbdeb),'migrations':_[_0xe155('0x25')](_0x8cbdeb)});})[_0xe155('0x22')](function(_0x52ffbc){if(_0x52ffbc instanceof db[_0xe155('0x2b')]['UniqueConstraintError']){return _0x60f7fe['status'](0xc8)[_0xe155('0x15')]({'output':_0xe155('0x34')});}else{return _0x60f7fe[_0xe155('0x14')](0x1f4)[_0xe155('0x15')](_0x52ffbc);}});}else{return _0x60f7fe['status'](0xc8)['json']({'output':_0xe155('0x34')});}}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 93b7013..db438c1 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 _0x8bc6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra'];(function(_0x18d707,_0x351dfe){var _0x506c8e=function(_0x2c8497){while(--_0x2c8497){_0x18d707['push'](_0x18d707['shift']());}};_0x506c8e(++_0x351dfe);}(_0x8bc6,0x137));var _0x68bc=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x8bc6[_0xd336fa];return _0x3370b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x68bc('0x0'));var express=require(_0x68bc('0x1'));var router=express[_0x68bc('0x2')]();var fs_extra=require(_0x68bc('0x3'));var auth=require(_0x68bc('0x4'));var interaction=require(_0x68bc('0x5'));var config=require(_0x68bc('0x6'));var controller=require(_0x68bc('0x7'));router[_0x68bc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68bc('0x8')](_0x68bc('0x9'),auth[_0x68bc('0xa')](),controller[_0x68bc('0xb')]);router[_0x68bc('0x8')](_0x68bc('0xc'),auth['isAuthenticated'](),controller[_0x68bc('0xd')]);router[_0x68bc('0xe')]('/',auth[_0x68bc('0xa')](),controller[_0x68bc('0xf')]);router[_0x68bc('0x10')](_0x68bc('0xc'),auth[_0x68bc('0xa')](),controller[_0x68bc('0x11')]);router[_0x68bc('0x12')](_0x68bc('0xc'),auth[_0x68bc('0xa')](),controller[_0x68bc('0x13')]);module[_0x68bc('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index dfb58a2..5b10d77 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 _0x253d=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0x253d,0x1b3));var _0xd253=function(_0x5c51fd,_0x23a7ed){_0x5c51fd=_0x5c51fd-0x0;var _0x490951=_0x253d[_0x5c51fd];return _0x490951;};'use strict';var Sequelize=require(_0xd253('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd253('0x1')]},'queue':{'type':Sequelize[_0xd253('0x1')]},'interface':{'type':Sequelize[_0xd253('0x1')]},'membername':{'type':Sequelize[_0xd253('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd253('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xd253('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd253('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd253('0x2')]},'holdtime':{'type':Sequelize[_0xd253('0x3')]},'agentcomplete':{'type':Sequelize[_0xd253('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd253('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd253('0x3')]},'agentacw':{'type':Sequelize[_0xd253('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd253('0x3')]},'reason':{'type':Sequelize[_0xd253('0x1')]},'lastevent':{'type':Sequelize[_0xd253('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd253('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd253('0x1')]},'language':{'type':Sequelize[_0xd253('0x1')]},'accountcode':{'type':Sequelize[_0xd253('0x1')]},'context':{'type':Sequelize[_0xd253('0x1')]},'exten':{'type':Sequelize[_0xd253('0x1')]},'priority':{'type':Sequelize[_0xd253('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd253('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd253('0x1')]},'destcalleridname':{'type':Sequelize[_0xd253('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd253('0x1')]},'destaccountcode':{'type':Sequelize[_0xd253('0x1')]},'destcontext':{'type':Sequelize[_0xd253('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd253('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd253('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd253('0x1')]},'transfer':{'type':Sequelize[_0xd253('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd253('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd253('0x1')]},'agententerreason':{'type':Sequelize[_0xd253('0x3')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 334d8d5..2e70d17 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(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 21d8c09..cbed8ac 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 _0xeb0d=['../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','lodash','moment','bluebird','path','rimraf'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x3b4493,_0x106e71){_0x3b4493=_0x3b4493-0x0;var _0x28fc72=_0xeb0d[_0x3b4493];return _0x28fc72;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdeb0('0x1'));var BPromise=require(_0xdeb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb0('0x3'));var rimraf=require(_0xdeb0('0x4'));var config=require(_0xdeb0('0x5'));var attributes=require(_0xdeb0('0x6'));module[_0xdeb0('0x7')]=function(_0x13d486,_0xc48108){return _0x13d486[_0xdeb0('0x8')]('VoiceAgentReport',attributes,{'tableName':_0xdeb0('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdeb0('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6a64ea9..c03d253 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 _0x896c=['rpc','../../config/environment','jayson/promise','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateVoiceAgentReport','body','options','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','raw','attributes','limit','lodash','util','moment','../../config/logger'];(function(_0x5c66de,_0x4e30da){var _0x21e9a3=function(_0x4e8249){while(--_0x4e8249){_0x5c66de['push'](_0x5c66de['shift']());}};_0x21e9a3(++_0x4e30da);}(_0x896c,0x176));var _0xc896=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0x896c[_0x1c7889];return _0x2f14e5;};'use strict';var _=require(_0xc896('0x0'));var util=require(_0xc896('0x1'));var moment=require(_0xc896('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('../../config/utils');var logger=require(_0xc896('0x3'))(_0xc896('0x4'));var config=require(_0xc896('0x5'));var jayson=require(_0xc896('0x6'));var client=jayson[_0xc896('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0785,_0x464a3e,_0x1b2494){return new BPromise(function(_0x59295e,_0x267d42){return client['request'](_0x1a0785,_0x1b2494)[_0xc896('0x8')](function(_0x5cb79a){logger[_0xc896('0x9')](_0xc896('0xa'),_0x464a3e,_0xc896('0xb'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x464a3e,'request\x20sent',JSON[_0xc896('0xc')](_0x5cb79a));if(_0x5cb79a[_0xc896('0xd')]){if(_0x5cb79a['error'][_0xc896('0xe')]===0x1f4){logger[_0xc896('0xd')](_0xc896('0xa'),_0x464a3e,_0x5cb79a[_0xc896('0xd')]['message']);return _0x267d42(_0x5cb79a[_0xc896('0xd')]['message']);}logger['error'](_0xc896('0xa'),_0x464a3e,_0x5cb79a['error']['message']);return _0x59295e(_0x5cb79a[_0xc896('0xd')][_0xc896('0xf')]);}else{logger[_0xc896('0x9')](_0xc896('0xa'),_0x464a3e,_0xc896('0xb'));_0x59295e(_0x5cb79a['result'][_0xc896('0xf')]);}})[_0xc896('0x10')](function(_0x5b966b){logger[_0xc896('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x464a3e,_0x5b966b);_0x267d42(_0x5b966b);});});}exports[_0xc896('0x11')]=function(_0x4acbc1){var _0x391884=this;return new Promise(function(_0x43ad29,_0x267aea){return db['VoiceAgentReport']['create'](_0x4acbc1[_0xc896('0x12')],{'raw':_0x4acbc1[_0xc896('0x13')]?_0x4acbc1[_0xc896('0x13')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51876c){logger[_0xc896('0x9')](_0xc896('0x11'),_0x4acbc1);logger[_0xc896('0x14')]('CreateVoiceAgentReport',_0x4acbc1,JSON[_0xc896('0xc')](_0x51876c));_0x43ad29(_0x51876c);})[_0xc896('0x10')](function(_0xf33b3d){logger['error']('CreateVoiceAgentReport',_0xf33b3d[_0xc896('0xf')],_0x4acbc1);_0x267aea(_0x391884['error'](0x1f4,_0xf33b3d[_0xc896('0xf')]));});});};exports[_0xc896('0x15')]=function(_0x1744aa){var _0x1d5b93=this;return new Promise(function(_0x4be695,_0x3673ec){return db[_0xc896('0x16')][_0xc896('0x17')](_0x1744aa['body'],{'raw':_0x1744aa[_0xc896('0x13')]?_0x1744aa['options'][_0xc896('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1744aa['options']?_0x1744aa[_0xc896('0x13')]['where']||null:null,'attributes':_0x1744aa[_0xc896('0x13')]?_0x1744aa[_0xc896('0x13')][_0xc896('0x19')]||null:null,'limit':_0x1744aa['options']?_0x1744aa[_0xc896('0x13')][_0xc896('0x1a')]||null:null})[_0xc896('0x8')](function(_0x237058){logger[_0xc896('0x9')](_0xc896('0x15'),_0x1744aa);logger[_0xc896('0x14')]('UpdateVoiceAgentReport',_0x1744aa,JSON['stringify'](_0x237058));_0x4be695(_0x237058);})[_0xc896('0x10')](function(_0xb56b4e){logger['error'](_0xc896('0x15'),_0xb56b4e['message'],_0x1744aa);_0x3673ec(_0x1d5b93[_0xc896('0xd')](0x1f4,_0xb56b4e[_0xc896('0xf')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 645e6a4..f654be4 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 _0xf873=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x400df5,_0x5af16d){var _0x5c79f1=function(_0x2f767f){while(--_0x2f767f){_0x400df5['push'](_0x400df5['shift']());}};_0x5c79f1(++_0x5af16d);}(_0xf873,0xb2));var _0x3f87=function(_0x130e7c,_0x1b8ece){_0x130e7c=_0x130e7c-0x0;var _0x3e4579=_0xf873[_0x130e7c];return _0x3e4579;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./voiceCallReport.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller['show']);router[_0x3f87('0xf')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0x10')]);router[_0x3f87('0x11')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x12')]);router[_0x3f87('0x13')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x14')]);module[_0x3f87('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 78f232d..6d3f12f 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 _0x99d1=['internal','outbound','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound'];(function(_0x158e29,_0x4d0349){var _0x45b00d=function(_0x5e05e9){while(--_0x5e05e9){_0x158e29['push'](_0x158e29['shift']());}};_0x45b00d(++_0x4d0349);}(_0x99d1,0x104));var _0x199d=function(_0xdef5f7,_0x9ab2b1){_0xdef5f7=_0xdef5f7-0x0;var _0x130d95=_0x99d1[_0xdef5f7];return _0x130d95;};'use strict';var Sequelize=require(_0x199d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x199d('0x1')]},'type':{'type':Sequelize[_0x199d('0x2')](_0x199d('0x3'),_0x199d('0x4'),_0x199d('0x5'),'inbound-fax',_0x199d('0x6'),_0x199d('0x7'))},'tag':{'type':Sequelize[_0x199d('0x1')]},'accountcode':{'type':Sequelize[_0x199d('0x1')]},'source':{'type':Sequelize[_0x199d('0x1')]},'destination':{'type':Sequelize[_0x199d('0x1')]},'destinationcontext':{'type':Sequelize[_0x199d('0x1')]},'callerid':{'type':Sequelize[_0x199d('0x1')]},'channel':{'type':Sequelize[_0x199d('0x1')]},'destinationchannel':{'type':Sequelize[_0x199d('0x1')]},'lastapplication':{'type':Sequelize[_0x199d('0x1')]},'lastdata':{'type':Sequelize[_0x199d('0x8')]},'starttime':{'type':Sequelize[_0x199d('0x9')]},'systemanswertime':{'type':Sequelize[_0x199d('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x199d('0x9')]},'duration':{'type':Sequelize[_0x199d('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x199d('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x199d('0x1')]},'amaflags':{'type':Sequelize[_0x199d('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x199d('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x199d('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x199d('0x1')]},'routeid':{'type':Sequelize[_0x199d('0xa')]},'sipcallid':{'type':Sequelize[_0x199d('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2a1d1f3..e6ac8ca 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xadb5,0xad));var _0x5adb=function(_0x48f19e,_0x278146){_0x48f19e=_0x48f19e-0x0;var _0x557770=_0xadb5[_0x48f19e];return _0x557770;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4385011..54ec68a 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 _0xbc2f=['exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc2f,0x157));var _0xfbc2=function(_0xb706f4,_0x52e0f9){_0xb706f4=_0xb706f4-0x0;var _0x4c685f=_0xbc2f[_0xb706f4];return _0x4c685f;};'use strict';var _=require('lodash');var util=require(_0xfbc2('0x0'));var logger=require(_0xfbc2('0x1'))('api');var moment=require(_0xfbc2('0x2'));var BPromise=require(_0xfbc2('0x3'));var rp=require(_0xfbc2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbc2('0x5'));var config=require(_0xfbc2('0x6'));var attributes=require(_0xfbc2('0x7'));module[_0xfbc2('0x8')]=function(_0x2821f9,_0x408481){return _0x2821f9[_0xfbc2('0x9')](_0xfbc2('0xa'),attributes,{'tableName':_0xfbc2('0xb'),'paranoid':![],'indexes':[{'fields':[_0xfbc2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 942a1e4..fb5c027 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 _0x27dc=['../../config/logger','../../config/environment','then','info','debug','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x54b958,_0x20751d){var _0x553934=function(_0x511ef7){while(--_0x511ef7){_0x54b958['push'](_0x54b958['shift']());}};_0x553934(++_0x20751d);}(_0x27dc,0x103));var _0xc27d=function(_0x4c781f,_0x2d043f){_0x4c781f=_0x4c781f-0x0;var _0x50ee7a=_0x27dc[_0x4c781f];return _0x50ee7a;};'use strict';var _=require(_0xc27d('0x0'));var util=require(_0xc27d('0x1'));var moment=require(_0xc27d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc27d('0x3'));var db=require(_0xc27d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc27d('0x5'))('rpc');var config=require(_0xc27d('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x372e87,_0xb698d2,_0x3833ed){return new BPromise(function(_0x1b01f4,_0x1802fd){return client['request'](_0x372e87,_0x3833ed)[_0xc27d('0x7')](function(_0x39065d){logger[_0xc27d('0x8')]('VoiceCallReport,\x20%s,\x20%s',_0xb698d2,'request\x20sent');logger[_0xc27d('0x9')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xb698d2,_0xc27d('0xa'),JSON[_0xc27d('0xb')](_0x39065d));if(_0x39065d[_0xc27d('0xc')]){if(_0x39065d['error'][_0xc27d('0xd')]===0x1f4){logger[_0xc27d('0xc')](_0xc27d('0xe'),_0xb698d2,_0x39065d[_0xc27d('0xc')][_0xc27d('0xf')]);return _0x1802fd(_0x39065d[_0xc27d('0xc')][_0xc27d('0xf')]);}logger[_0xc27d('0xc')](_0xc27d('0xe'),_0xb698d2,_0x39065d['error'][_0xc27d('0xf')]);return _0x1b01f4(_0x39065d[_0xc27d('0xc')][_0xc27d('0xf')]);}else{logger[_0xc27d('0x8')](_0xc27d('0xe'),_0xb698d2,_0xc27d('0xa'));_0x1b01f4(_0x39065d[_0xc27d('0x10')]['message']);}})[_0xc27d('0x11')](function(_0x20f7e8){logger['error'](_0xc27d('0xe'),_0xb698d2,_0x20f7e8);_0x1802fd(_0x20f7e8);});});}exports[_0xc27d('0x12')]=function(_0x1b14cf){var _0x456206=this;return new Promise(function(_0x532997,_0x6521d3){return db['VoiceCallReport']['findAll']({'raw':_0x1b14cf[_0xc27d('0x13')]?_0x1b14cf[_0xc27d('0x13')][_0xc27d('0x14')]===undefined?!![]:![]:!![],'where':_0x1b14cf[_0xc27d('0x13')]?_0x1b14cf[_0xc27d('0x13')][_0xc27d('0x15')]||null:null,'attributes':_0x1b14cf['options']?_0x1b14cf['options'][_0xc27d('0x16')]||null:null,'limit':_0x1b14cf[_0xc27d('0x13')]?_0x1b14cf[_0xc27d('0x13')][_0xc27d('0x17')]||null:null,'include':_0x1b14cf['options']?_0x1b14cf[_0xc27d('0x13')][_0xc27d('0x18')]?_[_0xc27d('0x19')](_0x1b14cf[_0xc27d('0x13')][_0xc27d('0x18')],function(_0x2c907f){return{'model':db[_0x2c907f['model']],'as':_0x2c907f['as'],'attributes':_0x2c907f['attributes'],'include':_0x2c907f[_0xc27d('0x18')]?_[_0xc27d('0x19')](_0x2c907f['include'],function(_0x37f39b){return{'model':db[_0x37f39b['model']],'as':_0x37f39b['as'],'attributes':_0x37f39b['attributes'],'include':_0x37f39b[_0xc27d('0x18')]?_[_0xc27d('0x19')](_0x37f39b['include'],function(_0x34d5db){return{'model':db[_0x34d5db[_0xc27d('0x1a')]],'as':_0x34d5db['as'],'attributes':_0x34d5db[_0xc27d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc27d('0x7')](function(_0x5aa391){logger[_0xc27d('0x8')]('GetVoiceCallReport',_0x1b14cf);logger[_0xc27d('0x9')](_0xc27d('0x12'),_0x1b14cf,JSON[_0xc27d('0xb')](_0x5aa391));_0x532997(_0x5aa391);})[_0xc27d('0x11')](function(_0x1c329b){logger[_0xc27d('0xc')](_0xc27d('0x12'),_0x1c329b[_0xc27d('0xf')],_0x1b14cf);_0x6521d3(_0x456206[_0xc27d('0xc')](0x1f4,_0x1c329b[_0xc27d('0xf')]));});});};exports[_0xc27d('0x1b')]=function(_0x3e1490){var _0xa112ec=this;return new Promise(function(_0x259e32,_0x4bb1ab){return db[_0xc27d('0x1c')][_0xc27d('0x1d')](_0x3e1490['body'],{'raw':_0x3e1490[_0xc27d('0x13')]?_0x3e1490[_0xc27d('0x13')][_0xc27d('0x14')]===undefined?!![]:![]:!![]})[_0xc27d('0x7')](function(_0x2a9028){logger[_0xc27d('0x8')](_0xc27d('0x1b'),_0x3e1490);logger[_0xc27d('0x9')]('CreateVoiceCallReport',_0x3e1490,JSON[_0xc27d('0xb')](_0x2a9028));_0x259e32(_0x2a9028);})[_0xc27d('0x11')](function(_0xfc713c){logger['error'](_0xc27d('0x1b'),_0xfc713c[_0xc27d('0xf')],_0x3e1490);_0x4bb1ab(_0xa112ec['error'](0x1f4,_0xfc713c[_0xc27d('0xf')]));});});};exports[_0xc27d('0x1e')]=function(_0x27f94c){var _0x379f79=this;return new Promise(function(_0x2353d,_0x45cc72){return db[_0xc27d('0x1c')][_0xc27d('0x1f')](_0x27f94c[_0xc27d('0x20')],{'raw':_0x27f94c[_0xc27d('0x13')]?_0x27f94c['options'][_0xc27d('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f94c[_0xc27d('0x13')]?_0x27f94c[_0xc27d('0x13')][_0xc27d('0x15')]||null:null,'attributes':_0x27f94c[_0xc27d('0x13')]?_0x27f94c[_0xc27d('0x13')]['attributes']||null:null,'limit':_0x27f94c[_0xc27d('0x13')]?_0x27f94c[_0xc27d('0x13')]['limit']||null:null})[_0xc27d('0x7')](function(_0x60b523){logger[_0xc27d('0x8')](_0xc27d('0x1e'),_0x27f94c);logger[_0xc27d('0x9')](_0xc27d('0x1e'),_0x27f94c,JSON['stringify'](_0x60b523));_0x2353d(_0x60b523);})['catch'](function(_0x5f2011){logger[_0xc27d('0xc')](_0xc27d('0x1e'),_0x5f2011['message'],_0x27f94c);_0x45cc72(_0x379f79['error'](0x1f4,_0x5f2011[_0xc27d('0xf')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 47b7192..7285b00 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 _0x4562=['./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3e42d3,_0x85e8ee){var _0x17e208=function(_0x3376f3){while(--_0x3376f3){_0x3e42d3['push'](_0x3e42d3['shift']());}};_0x17e208(++_0x85e8ee);}(_0x4562,0x102));var _0x2456=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4562[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2456('0x0'));var util=require(_0x2456('0x1'));var path=require('path');var timeout=require(_0x2456('0x2'));var express=require(_0x2456('0x3'));var router=express['Router']();var fs_extra=require(_0x2456('0x4'));var auth=require(_0x2456('0x5'));var interaction=require(_0x2456('0x6'));var config=require(_0x2456('0x7'));var controller=require(_0x2456('0x8'));router['get']('/',auth[_0x2456('0x9')](),controller[_0x2456('0xa')]);router[_0x2456('0xb')](_0x2456('0xc'),auth[_0x2456('0x9')](),controller[_0x2456('0xd')]);router[_0x2456('0xe')]('/',auth[_0x2456('0x9')](),controller['create']);router[_0x2456('0xf')](_0x2456('0xc'),auth[_0x2456('0x9')](),controller['update']);router[_0x2456('0x10')](_0x2456('0xc'),auth[_0x2456('0x9')](),controller[_0x2456('0x11')]);module[_0x2456('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4c19db7..e79b6c1 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 _0x0e27=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x0e27,0x1a5));var _0x70e2=function(_0x1b3d16,_0x298459){_0x1b3d16=_0x1b3d16-0x0;var _0x4ab7c5=_0x0e27[_0x1b3d16];return _0x4ab7c5;};'use strict';var Sequelize=require('sequelize');module[_0x70e2('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x70e2('0x1')],'unique':_0x70e2('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x70e2('0x1')],'set':function(_0x2efed2){this[_0x70e2('0x3')](_0x70e2('0x4'),_0x2efed2?_0x2efed2[_0x70e2('0x5')](''):[]);},'get':function(){return this[_0x70e2('0x6')](_0x70e2('0x4'))?this['getDataValue'](_0x70e2('0x4'))[_0x70e2('0x7')](''):[];}},'auth':{'type':Sequelize[_0x70e2('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x70e2('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b2ec9ad..2a8647b 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 _0x4d9e=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','ChanSpies','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x4d9e,0x18c));var _0xe4d9=function(_0xcb4a3,_0x37cb34){_0xcb4a3=_0xcb4a3-0x0;var _0x5c4f8d=_0x4d9e[_0xcb4a3];return _0x5c4f8d;};'use strict';var emlformat=require(_0xe4d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe4d9('0x1'));var rp=require('request-promise');var moment=require(_0xe4d9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe4d9('0x3'));var util=require(_0xe4d9('0x4'));var path=require('path');var sox=require(_0xe4d9('0x5'));var csv=require(_0xe4d9('0x6'));var ejs=require(_0xe4d9('0x7'));var fs=require('fs');var fs_extra=require(_0xe4d9('0x8'));var _=require(_0xe4d9('0x9'));var squel=require(_0xe4d9('0xa'));var crypto=require('crypto');var jsforce=require(_0xe4d9('0xb'));var deskjs=require(_0xe4d9('0xc'));var toCsv=require(_0xe4d9('0x6'));var querystring=require(_0xe4d9('0xd'));var Papa=require(_0xe4d9('0xe'));var Redis=require(_0xe4d9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe4d9('0x10'));var as=require(_0xe4d9('0x11'));var hardwareService=require(_0xe4d9('0x12'));var logger=require(_0xe4d9('0x13'))(_0xe4d9('0x14'));var utils=require(_0xe4d9('0x15'));var config=require(_0xe4d9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x580c50,_0x4e0d15){_0x4e0d15=_0x4e0d15||0xcc;return function(_0x564383){if(_0x564383){return _0x580c50['sendStatus'](_0x4e0d15);}return _0x580c50['status'](_0x4e0d15)['end']();};}function respondWithResult(_0x15c0eb,_0x3238d4){_0x3238d4=_0x3238d4||0xc8;return function(_0x3f884c){if(_0x3f884c){return _0x15c0eb['status'](_0x3238d4)[_0xe4d9('0x17')](_0x3f884c);}};}function respondWithFilteredResult(_0x3f6ce4,_0xe4f133){return function(_0x4283f7){if(_0x4283f7){var _0x58d0cf=typeof _0xe4f133[_0xe4d9('0x18')]===_0xe4d9('0x19')&&typeof _0xe4f133[_0xe4d9('0x1a')]==='undefined';var _0x4d2afd=_0x4283f7[_0xe4d9('0x1b')];var _0x112315=_0x58d0cf?0x0:_0xe4f133['offset'];var _0x2e1490=_0x58d0cf?_0x4283f7['count']:_0xe4f133[_0xe4d9('0x18')]+_0xe4f133[_0xe4d9('0x1a')];var _0x1ea096;if(_0x2e1490>=_0x4d2afd){_0x2e1490=_0x4d2afd;_0x1ea096=0xc8;}else{_0x1ea096=0xce;}_0x3f6ce4[_0xe4d9('0x1c')](_0x1ea096);return _0x3f6ce4['set'](_0xe4d9('0x1d'),_0x112315+'-'+_0x2e1490+'/'+_0x4d2afd)[_0xe4d9('0x17')](_0x4283f7);}return null;};}function patchUpdates(_0x151220){return function(_0x171224){try{jsonpatch[_0xe4d9('0x1e')](_0x171224,_0x151220,!![]);}catch(_0x1146fc){return BPromise[_0xe4d9('0x1f')](_0x1146fc);}return _0x171224[_0xe4d9('0x20')]();};}function saveUpdates(_0x562bab,_0x4fed7f){return function(_0x44f1aa){if(_0x44f1aa){return _0x44f1aa[_0xe4d9('0x21')](_0x562bab)['then'](function(_0x189dad){return _0x189dad;});}return null;};}function removeEntity(_0x50d377,_0x14f3d7){return function(_0x125320){if(_0x125320){return _0x125320['destroy']()[_0xe4d9('0x22')](function(){var _0x32e7da=_0x125320['get']({'plain':!![]});var _0xc5be1b=_0xe4d9('0x23');return db[_0xe4d9('0x24')]['destroy']({'where':{'type':_0xc5be1b,'resourceId':_0x32e7da['id']}})['then'](function(){return _0x125320;});})[_0xe4d9('0x22')](function(){_0x50d377[_0xe4d9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dddd2,_0x4954b5){return function(_0x529e2b){if(!_0x529e2b){_0x5dddd2[_0xe4d9('0x25')](0x194);}return _0x529e2b;};}function handleError(_0x48d481,_0x40ffd0){_0x40ffd0=_0x40ffd0||0x1f4;return function(_0x1f3d90){logger[_0xe4d9('0x26')](_0x1f3d90['stack']);if(_0x1f3d90[_0xe4d9('0x27')]){delete _0x1f3d90[_0xe4d9('0x27')];}_0x48d481[_0xe4d9('0x1c')](_0x40ffd0)[_0xe4d9('0x28')](_0x1f3d90);};}exports[_0xe4d9('0x29')]=function(_0x1904d1,_0x21b7a9){var _0x449cb8={},_0x1fb637={},_0x3e6ea7={'count':0x0,'rows':[]};var _0x519c18=_[_0xe4d9('0x2a')](db['VoiceChanSpy'][_0xe4d9('0x2b')],function(_0x349be3){return{'name':_0x349be3[_0xe4d9('0x2c')],'type':_0x349be3[_0xe4d9('0x2d')][_0xe4d9('0x2e')]};});_0x1fb637[_0xe4d9('0x2f')]=_['map'](_0x519c18,'name');_0x1fb637['query']=_[_0xe4d9('0x30')](_0x1904d1[_0xe4d9('0x31')]);_0x1fb637[_0xe4d9('0x32')]=_['intersection'](_0x1fb637['model'],_0x1fb637['query']);_0x449cb8['attributes']=_[_0xe4d9('0x33')](_0x1fb637[_0xe4d9('0x2f')],qs['fields'](_0x1904d1[_0xe4d9('0x31')][_0xe4d9('0x34')]));_0x449cb8['attributes']=_0x449cb8[_0xe4d9('0x35')][_0xe4d9('0x36')]?_0x449cb8[_0xe4d9('0x35')]:_0x1fb637[_0xe4d9('0x2f')];if(!_0x1904d1[_0xe4d9('0x31')][_0xe4d9('0x37')](_0xe4d9('0x38'))){_0x449cb8[_0xe4d9('0x1a')]=qs[_0xe4d9('0x1a')](_0x1904d1[_0xe4d9('0x31')][_0xe4d9('0x1a')]);_0x449cb8[_0xe4d9('0x18')]=qs[_0xe4d9('0x18')](_0x1904d1[_0xe4d9('0x31')]['offset']);}_0x449cb8[_0xe4d9('0x39')]=qs[_0xe4d9('0x3a')](_0x1904d1[_0xe4d9('0x31')][_0xe4d9('0x3a')]);_0x449cb8[_0xe4d9('0x3b')]=qs[_0xe4d9('0x32')](_[_0xe4d9('0x3c')](_0x1904d1[_0xe4d9('0x31')],_0x1fb637[_0xe4d9('0x32')]),_0x519c18);if(_0x1904d1['query']['filter']){_0x449cb8['where']=_[_0xe4d9('0x3d')](_0x449cb8[_0xe4d9('0x3b')],{'$or':_[_0xe4d9('0x2a')](_0x519c18,function(_0x2770a2){if(_0x2770a2[_0xe4d9('0x2d')]!==_0xe4d9('0x3e')){var _0x392cdd={};_0x392cdd[_0x2770a2['name']]={'$like':'%'+_0x1904d1['query']['filter']+'%'};return _0x392cdd;}})});}_0x449cb8=_[_0xe4d9('0x3d')]({},_0x449cb8,_0x1904d1[_0xe4d9('0x3f')]);var _0x5a908b={'where':_0x449cb8[_0xe4d9('0x3b')]};return db[_0xe4d9('0x40')][_0xe4d9('0x1b')](_0x5a908b)[_0xe4d9('0x22')](function(_0x5d0476){_0x3e6ea7[_0xe4d9('0x1b')]=_0x5d0476;if(_0x1904d1[_0xe4d9('0x31')][_0xe4d9('0x41')]){_0x449cb8[_0xe4d9('0x42')]=[{'all':!![]}];}return db[_0xe4d9('0x40')][_0xe4d9('0x43')](_0x449cb8);})[_0xe4d9('0x22')](function(_0x3e9653){_0x3e6ea7[_0xe4d9('0x44')]=_0x3e9653;return _0x3e6ea7;})[_0xe4d9('0x22')](respondWithFilteredResult(_0x21b7a9,_0x449cb8))[_0xe4d9('0x45')](handleError(_0x21b7a9,null));};exports['show']=function(_0x429be,_0x449230){var _0x4857fe={'raw':![],'where':{'id':_0x429be[_0xe4d9('0x46')]['id']}},_0x2b7e25={};_0x2b7e25['model']=_[_0xe4d9('0x30')](db[_0xe4d9('0x40')][_0xe4d9('0x2b')]);_0x2b7e25[_0xe4d9('0x31')]=_[_0xe4d9('0x30')](_0x429be[_0xe4d9('0x31')]);_0x2b7e25[_0xe4d9('0x32')]=_[_0xe4d9('0x33')](_0x2b7e25[_0xe4d9('0x2f')],_0x2b7e25[_0xe4d9('0x31')]);_0x4857fe['attributes']=_[_0xe4d9('0x33')](_0x2b7e25[_0xe4d9('0x2f')],qs[_0xe4d9('0x34')](_0x429be['query'][_0xe4d9('0x34')]));_0x4857fe[_0xe4d9('0x35')]=_0x4857fe[_0xe4d9('0x35')][_0xe4d9('0x36')]?_0x4857fe[_0xe4d9('0x35')]:_0x2b7e25[_0xe4d9('0x2f')];if(_0x429be[_0xe4d9('0x31')]['includeAll']){_0x4857fe[_0xe4d9('0x42')]=[{'all':!![]}];}_0x4857fe=_[_0xe4d9('0x3d')]({},_0x4857fe,_0x429be[_0xe4d9('0x3f')]);return db[_0xe4d9('0x40')][_0xe4d9('0x47')](_0x4857fe)[_0xe4d9('0x22')](handleEntityNotFound(_0x449230,null))['then'](respondWithResult(_0x449230,null))[_0xe4d9('0x45')](handleError(_0x449230,null));};exports[_0xe4d9('0x48')]=function(_0x87f230,_0x38468c){return db[_0xe4d9('0x40')][_0xe4d9('0x48')](_0x87f230['body'],{})[_0xe4d9('0x22')](function(_0x29e038){var _0x53e7c4=_0x87f230[_0xe4d9('0x49')]['get']({'plain':!![]});if(!_0x53e7c4)throw new Error(_0xe4d9('0x4a'));if(_0x53e7c4[_0xe4d9('0x4b')]==='user'){var _0x657961=_0x29e038['get']({'plain':!![]});var _0x27a5e4=_0xe4d9('0x23');return db[_0xe4d9('0x4c')]['find']({'where':{'name':_0x27a5e4,'userProfileId':_0x53e7c4[_0xe4d9('0x4d')]},'raw':!![]})[_0xe4d9('0x22')](function(_0x4d5ff9){if(_0x4d5ff9&&_0x4d5ff9[_0xe4d9('0x4e')]===0x0){return db[_0xe4d9('0x24')][_0xe4d9('0x48')]({'name':_0x657961[_0xe4d9('0x27')],'resourceId':_0x657961['id'],'type':_0x4d5ff9['name'],'sectionId':_0x4d5ff9['id']},{})['then'](function(){return _0x29e038;});}else{return _0x29e038;}})[_0xe4d9('0x45')](function(_0x40674d){logger[_0xe4d9('0x26')](_0xe4d9('0x4f'),_0x40674d);throw _0x40674d;});}return _0x29e038;})[_0xe4d9('0x22')](respondWithResult(_0x38468c,0xc9))[_0xe4d9('0x45')](handleError(_0x38468c,null));};exports['update']=function(_0x5a57ad,_0x2c5500){if(_0x5a57ad[_0xe4d9('0x50')]['id']){delete _0x5a57ad[_0xe4d9('0x50')]['id'];}return db[_0xe4d9('0x40')][_0xe4d9('0x47')]({'where':{'id':_0x5a57ad[_0xe4d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c5500,null))[_0xe4d9('0x22')](saveUpdates(_0x5a57ad[_0xe4d9('0x50')],null))[_0xe4d9('0x22')](respondWithResult(_0x2c5500,null))['catch'](handleError(_0x2c5500,null));};exports[_0xe4d9('0x51')]=function(_0x2b6d70,_0x281fda){return db['VoiceChanSpy'][_0xe4d9('0x47')]({'where':{'id':_0x2b6d70['params']['id']}})[_0xe4d9('0x22')](handleEntityNotFound(_0x281fda,null))[_0xe4d9('0x22')](removeEntity(_0x281fda,null))[_0xe4d9('0x45')](handleError(_0x281fda,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d917ed6..203f0b1 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 _0x1b76=['then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','format','system','push','merge','Set','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','agent'];(function(_0x1ea230,_0x4258d6){var _0xdd7f44=function(_0x4fca65){while(--_0x4fca65){_0x1ea230['push'](_0x1ea230['shift']());}};_0xdd7f44(++_0x4258d6);}(_0x1b76,0xdc));var _0x61b7=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x1b76[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x61b7('0x0'));var util=require(_0x61b7('0x1'));var BPromise=require(_0x61b7('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x15967d,_0x3b4c32,_0x2ceca4){var _0x59e79d=0x1;var _0x23516b=[];var _0x5be60d={'context':_0x3b4c32['context']||'from-sip','exten':util[_0x61b7('0x3')]('%s%s',_0x15967d['prefix'],_0x2ceca4),'type':_0x61b7('0x4'),'isApp':![],'ChanSpyId':_0x15967d['id'],'UserId':_0x3b4c32['id']};_0x23516b[_0x61b7('0x5')](_[_0x61b7('0x6')]({'app':_0x61b7('0x7'),'appdata':util[_0x61b7('0x3')]('CDR(type)=%s',_0x61b7('0x8')),'priority':_0x59e79d++},_0x5be60d));if(_0x15967d[_0x61b7('0x9')]){_0x23516b[_0x61b7('0x5')](_[_0x61b7('0x6')]({'app':_0x61b7('0xa'),'appdata':util[_0x61b7('0x3')](_0x61b7('0xb'),_0x15967d[_0x61b7('0xc')]),'priority':_0x59e79d++},_0x5be60d));}if(_0x15967d['auth']){_0x23516b[_0x61b7('0x5')](_[_0x61b7('0x6')]({'app':_0x61b7('0xd'),'appdata':_0x15967d[_0x61b7('0xe')],'priority':_0x59e79d++},_0x5be60d));}_0x23516b['push'](_['merge']({'app':_0x61b7('0xf'),'appdata':util[_0x61b7('0x3')](_0x61b7('0x10'),_0x3b4c32[_0x61b7('0x11')],_0x15967d[_0x61b7('0x12')]?_0x15967d[_0x61b7('0x12')][_0x61b7('0x13')](''):''),'priority':_0x59e79d++},_0x5be60d));if(_0x15967d[_0x61b7('0x9')]){_0x23516b[_0x61b7('0x5')](_[_0x61b7('0x6')]({'app':_0x61b7('0x14'),'priority':_0x59e79d++},_0x5be60d));}return _0x23516b;};var getChanSpyApplications=function(_0x1b300d,_0x1285cb){var _0x35138c=[];for(var _0x2605c0=0x0,_0x5e4942=0x1;_0x2605c0<_0x1285cb[_0x61b7('0x15')];_0x2605c0++,_0x5e4942=0x1){_0x35138c=_0x35138c[_0x61b7('0x16')](getUserApplications(_0x1b300d,_0x1285cb[_0x2605c0],_0x1285cb[_0x2605c0][_0x61b7('0x17')]));if(_0x1285cb[_0x2605c0]['internal']!=_0x1285cb[_0x2605c0][_0x61b7('0x11')]){_0x35138c=_0x35138c['concat'](getUserApplications(_0x1b300d,_0x1285cb[_0x2605c0],_0x1285cb[_0x2605c0][_0x61b7('0x11')]));}}return _0x35138c;};var getChanSpyPromise=function(_0x2a722d,_0x2d661f){return new BPromise(function(_0xf9eee6,_0x5f471c){return _0x2a722d['User']['findAll']({'attributes':['id',_0x61b7('0x11'),_0x61b7('0x17')],'where':{'role':_0x61b7('0x18'),'chanspy':!![]},'raw':!![]})[_0x61b7('0x19')](function(_0x74e1d0){if(_0x74e1d0){return _0xf9eee6(getChanSpyApplications(_0x2d661f,_0x74e1d0));}return _0xf9eee6([]);})['catch'](function(_0x7d9cd1){_0x5f471c(_0x7d9cd1);});});};module[_0x61b7('0x1a')]=function(_0x48a77c,_0x4d9e15){var _0x3847c2=_0x48a77c[_0x61b7('0x1b')];return _0x48a77c[_0x61b7('0x1c')](_0x61b7('0x1d'),attributes,{'tableName':_0x61b7('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d8b2b,_0x139536,_0x1da8a9){return getChanSpyPromise(_0x3847c2,_0x3d8b2b)[_0x61b7('0x19')](function(_0x44ea74){if(_0x44ea74&&_0x44ea74[_0x61b7('0x15')]){return _0x3847c2[_0x61b7('0x1f')][_0x61b7('0x20')](_0x44ea74);}})['then'](function(){_0x1da8a9();})[_0x61b7('0x21')](function(_0x5368a4){_0x1da8a9(_0x5368a4);});},'afterUpdate':function(_0x24b00a,_0x5bff58,_0x1b20ff){return _0x3847c2['VoiceExtension'][_0x61b7('0x22')]({'where':{'ChanSpyId':_0x24b00a['id']}})['then'](function(){return getChanSpyPromise(_0x3847c2,_0x24b00a);})[_0x61b7('0x19')](function(_0x126716){if(_0x126716&&_0x126716[_0x61b7('0x15')]){return _0x3847c2['VoiceExtension'][_0x61b7('0x20')](_0x126716);}})[_0x61b7('0x19')](function(){_0x1b20ff();})[_0x61b7('0x21')](function(_0x4a3348){_0x1b20ff(_0x4a3348);});},'afterDestroy':function(_0x2c1cc8,_0x35a84d,_0x5af702){return _0x3847c2[_0x61b7('0x1f')][_0x61b7('0x22')]({'where':{'ChanSpyId':_0x2c1cc8['id']}})['then'](function(){_0x5af702();})[_0x61b7('0x21')](function(_0x106df7){_0x5af702(_0x106df7);});}}});}; \ No newline at end of file +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 diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7116c3d..f948f45 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 _0xaaa2=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x21dcb2,_0x19f3d4){var _0x5173bd=function(_0x363747){while(--_0x363747){_0x21dcb2['push'](_0x21dcb2['shift']());}};_0x5173bd(++_0x19f3d4);}(_0xaaa2,0xac));var _0x2aaa=function(_0xfafd3f,_0x32cae3){_0xfafd3f=_0xfafd3f-0x0;var _0x52e0f4=_0xaaa2[_0xfafd3f];return _0x52e0f4;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x106af9,_0x4f51e6,_0x2f16d7){return new BPromise(function(_0x514c32,_0x505fe8){return client[_0x2aaa('0xc')](_0x106af9,_0x2f16d7)['then'](function(_0x1ad6e9){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));logger[_0x2aaa('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'),JSON[_0x2aaa('0xf')](_0x1ad6e9));if(_0x1ad6e9[_0x2aaa('0x10')]){if(_0x1ad6e9['error'][_0x2aaa('0x11')]===0x1f4){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x505fe8(_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);}logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x1ad6e9[_0x2aaa('0x10')][_0x2aaa('0x13')]);return _0x514c32(_0x1ad6e9[_0x2aaa('0x10')]['message']);}else{logger[_0x2aaa('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f51e6,_0x2aaa('0xd'));_0x514c32(_0x1ad6e9[_0x2aaa('0x15')]['message']);}})['catch'](function(_0x50a767){logger[_0x2aaa('0x10')](_0x2aaa('0x12'),_0x4f51e6,_0x50a767);_0x505fe8(_0x50a767);});});} \ No newline at end of file +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 diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 131ff08..4759cd1 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 _0x1bd0=['./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5e929d,_0x4e6a51){var _0x4ff68e=function(_0xc3bc81){while(--_0xc3bc81){_0x5e929d['push'](_0x5e929d['shift']());}};_0x4ff68e(++_0x4e6a51);}(_0x1bd0,0x1e7));var _0x01bd=function(_0x4cba4f,_0x1874b3){_0x4cba4f=_0x4cba4f-0x0;var _0x134819=_0x1bd0[_0x4cba4f];return _0x134819;};'use strict';var multer=require(_0x01bd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x01bd('0x1'));var router=express[_0x01bd('0x2')]();var fs_extra=require(_0x01bd('0x3'));var auth=require(_0x01bd('0x4'));var interaction=require(_0x01bd('0x5'));var config=require(_0x01bd('0x6'));var controller=require(_0x01bd('0x7'));router[_0x01bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x01bd('0x9')]);router[_0x01bd('0x8')](_0x01bd('0xa'),auth[_0x01bd('0xb')](),controller[_0x01bd('0xc')]);router[_0x01bd('0xd')]('/',auth[_0x01bd('0xb')](),controller[_0x01bd('0xe')]);router[_0x01bd('0xf')](_0x01bd('0xa'),auth[_0x01bd('0xb')](),controller['update']);router[_0x01bd('0x10')](_0x01bd('0xa'),auth[_0x01bd('0xb')](),controller[_0x01bd('0x11')]);module[_0x01bd('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4d0eb88..a452f82 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 _0x470d=['name','BOOLEAN','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x470d,0x96));var _0xd470=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x470d[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xd470('0x0'));module[_0xd470('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd470('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd470('0x3')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 8f995f8..f890004 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 _0xcf1c=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/context.ejs','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','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','limit','undefined','count','apply','reject','save','update','then','destroy','Contexts','stack','name','index','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf1c,0x131));var _0xccf1=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xcf1c[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccf1('0x0'));var zipdir=require(_0xccf1('0x1'));var jsonpatch=require(_0xccf1('0x2'));var rp=require('request-promise');var moment=require(_0xccf1('0x3'));var BPromise=require(_0xccf1('0x4'));var Mustache=require(_0xccf1('0x5'));var util=require(_0xccf1('0x6'));var path=require('path');var sox=require(_0xccf1('0x7'));var csv=require(_0xccf1('0x8'));var ejs=require(_0xccf1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xccf1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccf1('0x8'));var querystring=require('querystring');var Papa=require(_0xccf1('0xb'));var Redis=require(_0xccf1('0xc'));var authService=require(_0xccf1('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xccf1('0xe'));var hardwareService=require(_0xccf1('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xccf1('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xccf1('0x11'));var db=require(_0xccf1('0x12'))['db'];var jayson=require(_0xccf1('0x13'));var client=jayson[_0xccf1('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa8fb,_0x2fd0ec,_0x3a23c3,_0x50fd2e){return new BPromise(function(_0x22d855,_0x47c32c){var _0x1ccced=_0x50fd2e||client;return _0x1ccced['request'](_0x5aa8fb,_0x3a23c3)['then'](function(_0xb5db8c){logger['info'](_0xccf1('0x15'),_0x2fd0ec,_0xccf1('0x16'));logger[_0xccf1('0x17')](_0xccf1('0x18'),_0x2fd0ec,_0xccf1('0x16'),JSON[_0xccf1('0x19')](_0xb5db8c));if(_0xb5db8c[_0xccf1('0x1a')]){if(_0xb5db8c[_0xccf1('0x1a')][_0xccf1('0x1b')]===0x1f4){logger[_0xccf1('0x1a')](_0xccf1('0x15'),_0x2fd0ec,_0xb5db8c[_0xccf1('0x1a')]['message']);return _0x47c32c(_0xb5db8c[_0xccf1('0x1a')]['message']);}logger[_0xccf1('0x1a')](_0xccf1('0x15'),_0x2fd0ec,_0xb5db8c[_0xccf1('0x1a')]['message']);return _0x22d855(_0xb5db8c[_0xccf1('0x1a')][_0xccf1('0x1c')]);}else{logger[_0xccf1('0x1d')](_0xccf1('0x15'),_0x2fd0ec,_0xccf1('0x16'));_0x22d855(_0xb5db8c[_0xccf1('0x1e')]['message']);}})[_0xccf1('0x1f')](function(_0x2ea746){logger[_0xccf1('0x1a')](_0xccf1('0x15'),_0x2fd0ec,_0x2ea746);_0x47c32c(_0x2ea746);});});}function respondWithStatusCode(_0x4e0841,_0x1c6917){_0x1c6917=_0x1c6917||0xcc;return function(_0x40db77){if(_0x40db77){return _0x4e0841[_0xccf1('0x20')](_0x1c6917);}return _0x4e0841[_0xccf1('0x21')](_0x1c6917)[_0xccf1('0x22')]();};}function respondWithResult(_0x2c452e,_0x1e6e7a){_0x1e6e7a=_0x1e6e7a||0xc8;return function(_0x23fa92){if(_0x23fa92){return _0x2c452e['status'](_0x1e6e7a)[_0xccf1('0x23')](_0x23fa92);}};}function respondWithFilteredResult(_0x1545c4,_0x2b6e7b){return function(_0x370724){if(_0x370724){var _0x5f18e6=typeof _0x2b6e7b[_0xccf1('0x24')]==='undefined'&&typeof _0x2b6e7b[_0xccf1('0x25')]===_0xccf1('0x26');var _0x56d18b=_0x370724[_0xccf1('0x27')];var _0x4a4833=_0x5f18e6?0x0:_0x2b6e7b[_0xccf1('0x24')];var _0x4d05c1=_0x5f18e6?_0x370724[_0xccf1('0x27')]:_0x2b6e7b[_0xccf1('0x24')]+_0x2b6e7b['limit'];var _0x482aa3;if(_0x4d05c1>=_0x56d18b){_0x4d05c1=_0x56d18b;_0x482aa3=0xc8;}else{_0x482aa3=0xce;}_0x1545c4[_0xccf1('0x21')](_0x482aa3);return _0x1545c4['set']('Content-Range',_0x4a4833+'-'+_0x4d05c1+'/'+_0x56d18b)[_0xccf1('0x23')](_0x370724);}return null;};}function patchUpdates(_0x4bf667){return function(_0x5d821b){try{jsonpatch[_0xccf1('0x28')](_0x5d821b,_0x4bf667,!![]);}catch(_0x134ea6){return BPromise[_0xccf1('0x29')](_0x134ea6);}return _0x5d821b[_0xccf1('0x2a')]();};}function saveUpdates(_0x54b819,_0x40fb4c){return function(_0x5473d){if(_0x5473d){return _0x5473d[_0xccf1('0x2b')](_0x54b819)[_0xccf1('0x2c')](function(_0x23c81a){return _0x23c81a;});}return null;};}function removeEntity(_0xc4b8e,_0x256383){return function(_0x3cadb1){if(_0x3cadb1){return _0x3cadb1[_0xccf1('0x2d')]()[_0xccf1('0x2c')](function(){var _0x5721fb=_0x3cadb1['get']({'plain':!![]});var _0x31e1b5=_0xccf1('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x31e1b5,'resourceId':_0x5721fb['id']}})[_0xccf1('0x2c')](function(){return _0x3cadb1;});})[_0xccf1('0x2c')](function(){_0xc4b8e[_0xccf1('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c1dd,_0x8ea107){return function(_0x5c19aa){if(!_0x5c19aa){_0x26c1dd['sendStatus'](0x194);}return _0x5c19aa;};}function handleError(_0x401860,_0xa462b2){_0xa462b2=_0xa462b2||0x1f4;return function(_0xc71e74){logger[_0xccf1('0x1a')](_0xc71e74[_0xccf1('0x2f')]);if(_0xc71e74[_0xccf1('0x30')]){delete _0xc71e74['name'];}_0x401860[_0xccf1('0x21')](_0xa462b2)['send'](_0xc71e74);};}exports[_0xccf1('0x31')]=function(_0x2c442e,_0x447903){var _0x40c410={},_0x4e7558={},_0x31b8fe={'count':0x0,'rows':[]};var _0x90590d=_['map'](db['VoiceContext']['rawAttributes'],function(_0x644e87){return{'name':_0x644e87[_0xccf1('0x32')],'type':_0x644e87[_0xccf1('0x33')][_0xccf1('0x34')]};});_0x4e7558['model']=_['map'](_0x90590d,_0xccf1('0x30'));_0x4e7558[_0xccf1('0x35')]=_[_0xccf1('0x36')](_0x2c442e[_0xccf1('0x35')]);_0x4e7558[_0xccf1('0x37')]=_[_0xccf1('0x38')](_0x4e7558[_0xccf1('0x39')],_0x4e7558['query']);_0x40c410[_0xccf1('0x3a')]=_[_0xccf1('0x38')](_0x4e7558[_0xccf1('0x39')],qs[_0xccf1('0x3b')](_0x2c442e['query']['fields']));_0x40c410['attributes']=_0x40c410['attributes']['length']?_0x40c410[_0xccf1('0x3a')]:_0x4e7558[_0xccf1('0x39')];if(!_0x2c442e[_0xccf1('0x35')][_0xccf1('0x3c')](_0xccf1('0x3d'))){_0x40c410[_0xccf1('0x25')]=qs['limit'](_0x2c442e[_0xccf1('0x35')][_0xccf1('0x25')]);_0x40c410[_0xccf1('0x24')]=qs['offset'](_0x2c442e[_0xccf1('0x35')][_0xccf1('0x24')]);}_0x40c410[_0xccf1('0x3e')]=qs[_0xccf1('0x3f')](_0x2c442e['query']['sort']);_0x40c410[_0xccf1('0x40')]=qs[_0xccf1('0x37')](_[_0xccf1('0x41')](_0x2c442e[_0xccf1('0x35')],_0x4e7558['filters']),_0x90590d);if(_0x2c442e['query'][_0xccf1('0x42')]){_0x40c410[_0xccf1('0x40')]=_[_0xccf1('0x43')](_0x40c410[_0xccf1('0x40')],{'$or':_[_0xccf1('0x44')](_0x90590d,function(_0x5b636e){if(_0x5b636e[_0xccf1('0x33')]!==_0xccf1('0x45')){var _0x1fe231={};_0x1fe231[_0x5b636e[_0xccf1('0x30')]]={'$like':'%'+_0x2c442e[_0xccf1('0x35')][_0xccf1('0x42')]+'%'};return _0x1fe231;}})});}_0x40c410=_[_0xccf1('0x43')]({},_0x40c410,_0x2c442e[_0xccf1('0x46')]);var _0x5b236b={'where':_0x40c410[_0xccf1('0x40')]};return db[_0xccf1('0x47')][_0xccf1('0x27')](_0x5b236b)[_0xccf1('0x2c')](function(_0x162863){_0x31b8fe[_0xccf1('0x27')]=_0x162863;if(_0x2c442e['query'][_0xccf1('0x48')]){_0x40c410[_0xccf1('0x49')]=[{'all':!![]}];}return db[_0xccf1('0x47')][_0xccf1('0x4a')](_0x40c410);})[_0xccf1('0x2c')](function(_0x344162){_0x31b8fe[_0xccf1('0x4b')]=_0x344162;return _0x31b8fe;})[_0xccf1('0x2c')](respondWithFilteredResult(_0x447903,_0x40c410))[_0xccf1('0x1f')](handleError(_0x447903,null));};exports['show']=function(_0x2ba9b3,_0x2a9877){var _0x3e3a2c={'raw':![],'where':{'id':_0x2ba9b3[_0xccf1('0x4c')]['id']}},_0x406f48={};_0x406f48[_0xccf1('0x39')]=_['keys'](db['VoiceContext'][_0xccf1('0x4d')]);_0x406f48['query']=_[_0xccf1('0x36')](_0x2ba9b3[_0xccf1('0x35')]);_0x406f48[_0xccf1('0x37')]=_['intersection'](_0x406f48['model'],_0x406f48[_0xccf1('0x35')]);_0x3e3a2c['attributes']=_[_0xccf1('0x38')](_0x406f48[_0xccf1('0x39')],qs[_0xccf1('0x3b')](_0x2ba9b3[_0xccf1('0x35')][_0xccf1('0x3b')]));_0x3e3a2c[_0xccf1('0x3a')]=_0x3e3a2c['attributes']['length']?_0x3e3a2c[_0xccf1('0x3a')]:_0x406f48[_0xccf1('0x39')];if(_0x2ba9b3[_0xccf1('0x35')][_0xccf1('0x48')]){_0x3e3a2c[_0xccf1('0x49')]=[{'all':!![]}];}_0x3e3a2c=_['merge']({},_0x3e3a2c,_0x2ba9b3['options']);return db['VoiceContext'][_0xccf1('0x4e')](_0x3e3a2c)['then'](handleEntityNotFound(_0x2a9877,null))[_0xccf1('0x2c')](respondWithResult(_0x2a9877,null))[_0xccf1('0x1f')](handleError(_0x2a9877,null));};exports[_0xccf1('0x4f')]=function(_0x44bab0,_0xa102f3,_0x21d241){var _0xc2bcc8;return db[_0xccf1('0x47')][_0xccf1('0x4f')](_0x44bab0[_0xccf1('0x50')],{'raw':!![]})[_0xccf1('0x2c')](function(_0x1e3372){_0xc2bcc8=_0x1e3372;return db[_0xccf1('0x47')]['findAll']({'raw':!![]});})['then'](function(_0x5d62b3){var _0xa570e6=fs[_0xccf1('0x51')](path[_0xccf1('0x52')](config['root'],'server/files/templates/context.ejs'),_0xccf1('0x53'));var _0x7ef1d6=ejs[_0xccf1('0x54')](_0xa570e6,{'contexts':_0x5d62b3||[]});fs[_0xccf1('0x55')](_0xccf1('0x56'),_0x7ef1d6);})[_0xccf1('0x2c')](function(){return respondWithRpcPromise(_0xccf1('0x57'),_0xccf1('0x4f'),{'module':_0xccf1('0x58')});})['then'](function(){var _0x426b4f=_0x44bab0[_0xccf1('0x59')][_0xccf1('0x5a')]({'plain':!![]});if(!_0x426b4f)throw new Error(_0xccf1('0x5b'));if(_0x426b4f[_0xccf1('0x5c')]===_0xccf1('0x59')){var _0x44a985=_0xc2bcc8[_0xccf1('0x5a')]({'plain':!![]});return db[_0xccf1('0x5d')][_0xccf1('0x4e')]({'where':{'name':_0xccf1('0x2e'),'userProfileId':_0x426b4f[_0xccf1('0x5e')]},'raw':!![]})['then'](function(_0x2a373a){if(_0x2a373a&&_0x2a373a[_0xccf1('0x5f')]===0x0){return db['UserProfileResource'][_0xccf1('0x4f')]({'name':_0x44a985[_0xccf1('0x30')],'resourceId':_0x44a985['id'],'type':_0x2a373a[_0xccf1('0x30')],'sectionId':_0x2a373a['id']},{})['then'](function(){return _0xc2bcc8;});}else{return _0xc2bcc8;}})[_0xccf1('0x1f')](function(_0x4d6f55){logger[_0xccf1('0x1a')](_0xccf1('0x60'),_0x4d6f55);throw _0x4d6f55;});}return _0xc2bcc8;})[_0xccf1('0x2c')](respondWithResult(_0xa102f3,0xc9))['catch'](handleError(_0xa102f3,null));};exports[_0xccf1('0x2b')]=function(_0x117bdf,_0x4cee8b,_0x1f0f37){var _0x4cfda6;return db[_0xccf1('0x47')][_0xccf1('0x4e')]({'where':{'id':_0x117bdf['params']['id']}})[_0xccf1('0x2c')](handleEntityNotFound(_0x4cee8b,null))['then'](saveUpdates(_0x117bdf[_0xccf1('0x50')],null))[_0xccf1('0x2c')](function(_0x15c909){if(_0x15c909){_0x4cfda6=_0x15c909;return db[_0xccf1('0x47')][_0xccf1('0x4a')]({'raw':!![]});}})[_0xccf1('0x2c')](function(_0xbab92b){var _0x384578=fs[_0xccf1('0x51')](path[_0xccf1('0x52')](config[_0xccf1('0x61')],_0xccf1('0x62')),_0xccf1('0x53'));var _0x2406f3=ejs[_0xccf1('0x54')](_0x384578,{'contexts':_0xbab92b||[]});fs[_0xccf1('0x55')](_0xccf1('0x56'),_0x2406f3);})['then'](function(){return respondWithRpcPromise(_0xccf1('0x57'),'update',{'module':'chan_sip.so'});})[_0xccf1('0x2c')](function(){return _0x4cfda6;})[_0xccf1('0x2c')](respondWithResult(_0x4cee8b,null))[_0xccf1('0x1f')](handleError(_0x4cee8b,null));};exports[_0xccf1('0x2d')]=function(_0x3dcec6,_0x4827fe,_0x57a576){var _0x5188ee;return db['VoiceContext'][_0xccf1('0x4e')]({'where':{'id':_0x3dcec6[_0xccf1('0x4c')]['id']}})[_0xccf1('0x2c')](handleEntityNotFound(_0x4827fe,null))[_0xccf1('0x2c')](removeEntity(_0x4827fe,null))[_0xccf1('0x2c')](function(){return db[_0xccf1('0x47')]['findAll']({'raw':!![]});})[_0xccf1('0x2c')](function(_0x3075a2){var _0x2a47d7=fs[_0xccf1('0x51')](path[_0xccf1('0x52')](config['root'],_0xccf1('0x62')),_0xccf1('0x53'));var _0x5c615c=ejs[_0xccf1('0x54')](_0x2a47d7,{'contexts':_0x3075a2});fs[_0xccf1('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5c615c);return respondWithRpcPromise(_0xccf1('0x57'),_0xccf1('0x2d'),{'module':'chan_sip.so'});})['catch'](handleError(_0x4827fe,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e208c15..4514482 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 _0xbc6b=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4b54bf,_0xefb6c1){var _0x955030=function(_0x132ae9){while(--_0x132ae9){_0x4b54bf['push'](_0x4b54bf['shift']());}};_0x955030(++_0xefb6c1);}(_0xbc6b,0xd4));var _0xbbc6=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xbc6b[_0x114d1f];return _0x5b91d4;};'use strict';var _=require(_0xbbc6('0x0'));var util=require(_0xbbc6('0x1'));var logger=require(_0xbbc6('0x2'))(_0xbbc6('0x3'));var moment=require(_0xbbc6('0x4'));var BPromise=require(_0xbbc6('0x5'));var rp=require(_0xbbc6('0x6'));var fs=require('fs');var path=require(_0xbbc6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xbbc6('0x8')]=function(_0x2af60f,_0x2b86a0){return _0x2af60f[_0xbbc6('0x9')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 7110c1d..4e7f04a 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 _0x6719=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6719,0xf6));var _0x9671=function(_0x4c974e,_0x513d9e){_0x4c974e=_0x4c974e-0x0;var _0x31327b=_0x6719[_0x4c974e];return _0x31327b;};'use strict';var _=require(_0x9671('0x0'));var util=require(_0x9671('0x1'));var moment=require(_0x9671('0x2'));var BPromise=require(_0x9671('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9671('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9671('0x5'))(_0x9671('0x6'));var config=require(_0x9671('0x7'));var jayson=require(_0x9671('0x8'));var client=jayson[_0x9671('0x9')][_0x9671('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3674c2,_0x57bb95,_0x14ef8c){return new BPromise(function(_0x9054ed,_0x5388d3){return client[_0x9671('0xb')](_0x3674c2,_0x14ef8c)['then'](function(_0x3c2c0c){logger[_0x9671('0xc')](_0x9671('0xd'),_0x57bb95,_0x9671('0xe'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x57bb95,'request\x20sent',JSON[_0x9671('0xf')](_0x3c2c0c));if(_0x3c2c0c[_0x9671('0x10')]){if(_0x3c2c0c[_0x9671('0x10')][_0x9671('0x11')]===0x1f4){logger[_0x9671('0x10')](_0x9671('0xd'),_0x57bb95,_0x3c2c0c[_0x9671('0x10')][_0x9671('0x12')]);return _0x5388d3(_0x3c2c0c[_0x9671('0x10')][_0x9671('0x12')]);}logger[_0x9671('0x10')](_0x9671('0xd'),_0x57bb95,_0x3c2c0c[_0x9671('0x10')]['message']);return _0x9054ed(_0x3c2c0c[_0x9671('0x10')][_0x9671('0x12')]);}else{logger[_0x9671('0xc')]('VoiceContext,\x20%s,\x20%s',_0x57bb95,_0x9671('0xe'));_0x9054ed(_0x3c2c0c[_0x9671('0x13')][_0x9671('0x12')]);}})[_0x9671('0x14')](function(_0x3dbf37){logger[_0x9671('0x10')]('VoiceContext,\x20%s,\x20%s',_0x57bb95,_0x3dbf37);_0x5388d3(_0x3dbf37);});});} \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c964cb4..9d7ccd7 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 _0x90ef=['/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x90ef,0x8f));var _0xf90e=function(_0x4c4158,_0x2fbbc4){_0x4c4158=_0x4c4158-0x0;var _0x1fa652=_0x90ef[_0x4c4158];return _0x1fa652;};'use strict';var multer=require(_0xf90e('0x0'));var util=require('util');var path=require(_0xf90e('0x1'));var timeout=require(_0xf90e('0x2'));var express=require(_0xf90e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf90e('0x4'));var controller=require(_0xf90e('0x5'));router[_0xf90e('0x6')]('/',auth['isAuthenticated'](),controller[_0xf90e('0x7')]);router['get']('/describe',auth[_0xf90e('0x8')](),controller[_0xf90e('0x9')]);router[_0xf90e('0x6')](_0xf90e('0xa'),auth[_0xf90e('0x8')](),controller[_0xf90e('0xb')]);router[_0xf90e('0xc')]('/',auth[_0xf90e('0x8')](),controller[_0xf90e('0xd')]);router[_0xf90e('0xe')](_0xf90e('0xa'),auth[_0xf90e('0x8')](),controller['update']);router[_0xf90e('0xf')]('/:id',auth[_0xf90e('0x8')](),controller['destroy']);module[_0xf90e('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ad74c4b..ea5fb38 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 _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x33bf38,_0x1c9871){var _0x547ed1=function(_0x399861){while(--_0x399861){_0x33bf38['push'](_0x33bf38['shift']());}};_0x547ed1(++_0x1c9871);}(_0xedd9,0xfc));var _0x9edd=function(_0x4cb720,_0x47dac0){_0x4cb720=_0x4cb720-0x0;var _0x30c098=_0xedd9[_0x4cb720];return _0x30c098;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index a84a1a9..91e091f 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 _0x0a84=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','type','VIRTUAL','merge','includeAll','rows','catch','show','include','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','map','keys','query'];(function(_0x6b4cd4,_0x57c9da){var _0xf931e2=function(_0x2b1322){while(--_0x2b1322){_0x6b4cd4['push'](_0x6b4cd4['shift']());}};_0xf931e2(++_0x57c9da);}(_0x0a84,0x103));var _0x40a8=function(_0x305666,_0x5b740e){_0x305666=_0x305666-0x0;var _0x4fa3e7=_0x0a84[_0x305666];return _0x4fa3e7;};'use strict';var emlformat=require(_0x40a8('0x0'));var rimraf=require(_0x40a8('0x1'));var zipdir=require(_0x40a8('0x2'));var jsonpatch=require(_0x40a8('0x3'));var rp=require(_0x40a8('0x4'));var moment=require(_0x40a8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40a8('0x6'));var util=require(_0x40a8('0x7'));var path=require(_0x40a8('0x8'));var sox=require(_0x40a8('0x9'));var csv=require(_0x40a8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40a8('0xb'));var _=require(_0x40a8('0xc'));var squel=require(_0x40a8('0xd'));var crypto=require(_0x40a8('0xe'));var jsforce=require(_0x40a8('0xf'));var deskjs=require(_0x40a8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x40a8('0x11'));var authService=require(_0x40a8('0x12'));var qs=require(_0x40a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40a8('0x14'));var logger=require(_0x40a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x40a8('0x16'));var licenseUtil=require(_0x40a8('0x17'));var db=require(_0x40a8('0x18'))['db'];function respondWithStatusCode(_0x4d9e8f,_0x1b30f3){_0x1b30f3=_0x1b30f3||0xcc;return function(_0x5344b0){if(_0x5344b0){return _0x4d9e8f['sendStatus'](_0x1b30f3);}return _0x4d9e8f['status'](_0x1b30f3)[_0x40a8('0x19')]();};}function respondWithResult(_0x351c15,_0xbda570){_0xbda570=_0xbda570||0xc8;return function(_0x5acf01){if(_0x5acf01){return _0x351c15[_0x40a8('0x1a')](_0xbda570)[_0x40a8('0x1b')](_0x5acf01);}};}function respondWithFilteredResult(_0x275e7f,_0x1c7d43){return function(_0x333c56){if(_0x333c56){var _0xa31272=typeof _0x1c7d43[_0x40a8('0x1c')]==='undefined'&&typeof _0x1c7d43[_0x40a8('0x1d')]==='undefined';var _0x40808c=_0x333c56[_0x40a8('0x1e')];var _0x1a1fa6=_0xa31272?0x0:_0x1c7d43[_0x40a8('0x1c')];var _0x1f93d8=_0xa31272?_0x333c56[_0x40a8('0x1e')]:_0x1c7d43[_0x40a8('0x1c')]+_0x1c7d43['limit'];var _0xa58de8;if(_0x1f93d8>=_0x40808c){_0x1f93d8=_0x40808c;_0xa58de8=0xc8;}else{_0xa58de8=0xce;}_0x275e7f[_0x40a8('0x1a')](_0xa58de8);return _0x275e7f[_0x40a8('0x1f')](_0x40a8('0x20'),_0x1a1fa6+'-'+_0x1f93d8+'/'+_0x40808c)[_0x40a8('0x1b')](_0x333c56);}return null;};}function patchUpdates(_0x149fbe){return function(_0x1870b5){try{jsonpatch['apply'](_0x1870b5,_0x149fbe,!![]);}catch(_0x58c23c){return BPromise['reject'](_0x58c23c);}return _0x1870b5[_0x40a8('0x21')]();};}function saveUpdates(_0x46f3f5,_0x1fc684){return function(_0x8ce1d8){if(_0x8ce1d8){return _0x8ce1d8['update'](_0x46f3f5)[_0x40a8('0x22')](function(_0x380b7a){return _0x380b7a;});}return null;};}function removeEntity(_0x2b5e0e,_0x44cccf){return function(_0x54e491){if(_0x54e491){return _0x54e491[_0x40a8('0x23')]()['then'](function(){_0x2b5e0e[_0x40a8('0x1a')](0xcc)[_0x40a8('0x19')]();});}};}function handleEntityNotFound(_0x3e6b5b,_0x3fb055){return function(_0x315801){if(!_0x315801){_0x3e6b5b[_0x40a8('0x24')](0x194);}return _0x315801;};}function handleError(_0x51e27b,_0x73afdc){_0x73afdc=_0x73afdc||0x1f4;return function(_0x4f9889){logger[_0x40a8('0x25')](_0x4f9889[_0x40a8('0x26')]);if(_0x4f9889['name']){delete _0x4f9889[_0x40a8('0x27')];}_0x51e27b[_0x40a8('0x1a')](_0x73afdc)[_0x40a8('0x28')](_0x4f9889);};}exports[_0x40a8('0x29')]=function(_0x193026,_0xd3c448){var _0x147603={},_0x309008={},_0x42fdb9={'count':0x0,'rows':[]};var _0x321774=_['map'](db[_0x40a8('0x2a')][_0x40a8('0x2b')],function(_0x253ace){return{'name':_0x253ace[_0x40a8('0x2c')],'type':_0x253ace['type'][_0x40a8('0x2d')]};});_0x309008['model']=_[_0x40a8('0x2e')](_0x321774,_0x40a8('0x27'));_0x309008['query']=_[_0x40a8('0x2f')](_0x193026[_0x40a8('0x30')]);_0x309008['filters']=_[_0x40a8('0x31')](_0x309008[_0x40a8('0x32')],_0x309008['query']);_0x147603[_0x40a8('0x33')]=_['intersection'](_0x309008[_0x40a8('0x32')],qs[_0x40a8('0x34')](_0x193026[_0x40a8('0x30')]['fields']));_0x147603['attributes']=_0x147603['attributes'][_0x40a8('0x35')]?_0x147603[_0x40a8('0x33')]:_0x309008[_0x40a8('0x32')];if(!_0x193026['query'][_0x40a8('0x36')](_0x40a8('0x37'))){_0x147603[_0x40a8('0x1d')]=qs[_0x40a8('0x1d')](_0x193026['query'][_0x40a8('0x1d')]);_0x147603[_0x40a8('0x1c')]=qs[_0x40a8('0x1c')](_0x193026['query'][_0x40a8('0x1c')]);}_0x147603[_0x40a8('0x38')]=qs['sort'](_0x193026[_0x40a8('0x30')][_0x40a8('0x39')]);_0x147603['where']=qs['filters'](_[_0x40a8('0x3a')](_0x193026[_0x40a8('0x30')],_0x309008[_0x40a8('0x3b')]),_0x321774);if(_0x193026[_0x40a8('0x30')][_0x40a8('0x3c')]){_0x147603[_0x40a8('0x3d')]=_['merge'](_0x147603['where'],{'$or':_[_0x40a8('0x2e')](_0x321774,function(_0x460907){if(_0x460907[_0x40a8('0x3e')]!==_0x40a8('0x3f')){var _0x3434c3={};_0x3434c3[_0x460907['name']]={'$like':'%'+_0x193026['query'][_0x40a8('0x3c')]+'%'};return _0x3434c3;}})});}_0x147603=_[_0x40a8('0x40')]({},_0x147603,_0x193026['options']);var _0x1f78b0={'where':_0x147603['where']};return db[_0x40a8('0x2a')]['count'](_0x1f78b0)['then'](function(_0x578609){_0x42fdb9[_0x40a8('0x1e')]=_0x578609;if(_0x193026[_0x40a8('0x30')][_0x40a8('0x41')]){_0x147603['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x147603);})['then'](function(_0x1fc873){_0x42fdb9[_0x40a8('0x42')]=_0x1fc873;return _0x42fdb9;})[_0x40a8('0x22')](respondWithFilteredResult(_0xd3c448,_0x147603))[_0x40a8('0x43')](handleError(_0xd3c448,null));};exports[_0x40a8('0x44')]=function(_0x545206,_0x3740ac){var _0x109d09={'raw':!![],'where':{'id':_0x545206['params']['id']}},_0x34448c={};_0x34448c['model']=_[_0x40a8('0x2f')](db[_0x40a8('0x2a')][_0x40a8('0x2b')]);_0x34448c[_0x40a8('0x30')]=_[_0x40a8('0x2f')](_0x545206['query']);_0x34448c[_0x40a8('0x3b')]=_[_0x40a8('0x31')](_0x34448c[_0x40a8('0x32')],_0x34448c[_0x40a8('0x30')]);_0x109d09[_0x40a8('0x33')]=_[_0x40a8('0x31')](_0x34448c['model'],qs[_0x40a8('0x34')](_0x545206[_0x40a8('0x30')][_0x40a8('0x34')]));_0x109d09[_0x40a8('0x33')]=_0x109d09[_0x40a8('0x33')]['length']?_0x109d09[_0x40a8('0x33')]:_0x34448c[_0x40a8('0x32')];if(_0x545206[_0x40a8('0x30')]['includeAll']){_0x109d09[_0x40a8('0x45')]=[{'all':!![]}];}_0x109d09=_[_0x40a8('0x40')]({},_0x109d09,_0x545206[_0x40a8('0x46')]);return db[_0x40a8('0x2a')][_0x40a8('0x47')](_0x109d09)[_0x40a8('0x22')](handleEntityNotFound(_0x3740ac,null))[_0x40a8('0x22')](respondWithResult(_0x3740ac,null))[_0x40a8('0x43')](handleError(_0x3740ac,null));};exports[_0x40a8('0x48')]=function(_0x47071b,_0x546f4e){return db['VoiceDialReport'][_0x40a8('0x48')](_0x47071b[_0x40a8('0x49')],{})[_0x40a8('0x22')](respondWithResult(_0x546f4e,0xc9))[_0x40a8('0x43')](handleError(_0x546f4e,null));};exports[_0x40a8('0x4a')]=function(_0x424532,_0x407ae2){if(_0x424532[_0x40a8('0x49')]['id']){delete _0x424532[_0x40a8('0x49')]['id'];}return db[_0x40a8('0x2a')][_0x40a8('0x47')]({'where':{'id':_0x424532[_0x40a8('0x4b')]['id']}})[_0x40a8('0x22')](handleEntityNotFound(_0x407ae2,null))[_0x40a8('0x22')](saveUpdates(_0x424532[_0x40a8('0x49')],null))['then'](respondWithResult(_0x407ae2,null))['catch'](handleError(_0x407ae2,null));};exports[_0x40a8('0x23')]=function(_0x407239,_0x3f3ccc){return db[_0x40a8('0x2a')][_0x40a8('0x47')]({'where':{'id':_0x407239[_0x40a8('0x4b')]['id']}})[_0x40a8('0x22')](handleEntityNotFound(_0x3f3ccc,null))[_0x40a8('0x22')](removeEntity(_0x3f3ccc,null))[_0x40a8('0x43')](handleError(_0x3f3ccc,null));};exports[_0x40a8('0x4c')]=function(_0x1b7c05,_0x3c4822){return db[_0x40a8('0x2a')][_0x40a8('0x4c')]()[_0x40a8('0x22')](respondWithResult(_0x3c4822,null))[_0x40a8('0x43')](handleError(_0x3c4822,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 84210f1..ea981a6 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 _0x7a55=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','lodash'];(function(_0x102e31,_0x47d444){var _0x13a04a=function(_0x485b44){while(--_0x485b44){_0x102e31['push'](_0x102e31['shift']());}};_0x13a04a(++_0x47d444);}(_0x7a55,0x173));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57a5('0x0'));var util=require(_0x57a5('0x1'));var logger=require('../../config/logger')(_0x57a5('0x2'));var moment=require('moment');var BPromise=require(_0x57a5('0x3'));var rp=require(_0x57a5('0x4'));var fs=require('fs');var path=require(_0x57a5('0x5'));var rimraf=require(_0x57a5('0x6'));var config=require(_0x57a5('0x7'));var attributes=require(_0x57a5('0x8'));module[_0x57a5('0x9')]=function(_0x4fbccf,_0x266e51){return _0x4fbccf[_0x57a5('0xa')]('VoiceDialReport',attributes,{'tableName':_0x57a5('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a231bf7..99dc93d 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 _0x876d=['http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceDialReport,\x20%s,\x20%s','catch','CreateVoiceDialReport','options','raw','VoiceDialReport','update','body','where','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client'];(function(_0x187f4b,_0x12fd52){var _0x132087=function(_0x2b68ef){while(--_0x2b68ef){_0x187f4b['push'](_0x187f4b['shift']());}};_0x132087(++_0x12fd52);}(_0x876d,0x18e));var _0xd876=function(_0x5b7afd,_0x44b5ec){_0x5b7afd=_0x5b7afd-0x0;var _0x233149=_0x876d[_0x5b7afd];return _0x233149;};'use strict';var _=require('lodash');var util=require(_0xd876('0x0'));var moment=require(_0xd876('0x1'));var BPromise=require(_0xd876('0x2'));var rs=require(_0xd876('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd876('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd876('0x5'));var config=require('../../config/environment');var jayson=require(_0xd876('0x6'));var client=jayson[_0xd876('0x7')][_0xd876('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x301f7e,_0x1e02bb,_0x16585a){return new BPromise(function(_0x438fe9,_0x580f68){return client[_0xd876('0x9')](_0x301f7e,_0x16585a)[_0xd876('0xa')](function(_0xd3f26b){logger[_0xd876('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x1e02bb,_0xd876('0xc'));logger[_0xd876('0xd')](_0xd876('0xe'),_0x1e02bb,'request\x20sent',JSON[_0xd876('0xf')](_0xd3f26b));if(_0xd3f26b[_0xd876('0x10')]){if(_0xd3f26b['error']['code']===0x1f4){logger[_0xd876('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x1e02bb,_0xd3f26b[_0xd876('0x10')][_0xd876('0x11')]);return _0x580f68(_0xd3f26b[_0xd876('0x10')][_0xd876('0x11')]);}logger[_0xd876('0x10')](_0xd876('0x12'),_0x1e02bb,_0xd3f26b[_0xd876('0x10')]['message']);return _0x438fe9(_0xd3f26b['error'][_0xd876('0x11')]);}else{logger[_0xd876('0xb')](_0xd876('0x12'),_0x1e02bb,'request\x20sent');_0x438fe9(_0xd3f26b['result'][_0xd876('0x11')]);}})[_0xd876('0x13')](function(_0x55bdb4){logger[_0xd876('0x10')](_0xd876('0x12'),_0x1e02bb,_0x55bdb4);_0x580f68(_0x55bdb4);});});}exports[_0xd876('0x14')]=function(_0x26cef8){var _0x42a174=this;return new Promise(function(_0x1bf7be,_0x326256){return db['VoiceDialReport']['create'](_0x26cef8['body'],{'raw':_0x26cef8[_0xd876('0x15')]?_0x26cef8['options'][_0xd876('0x16')]===undefined?!![]:![]:!![]})[_0xd876('0xa')](function(_0x2a30f3){logger[_0xd876('0xb')](_0xd876('0x14'),_0x26cef8);logger[_0xd876('0xd')](_0xd876('0x14'),_0x26cef8,JSON[_0xd876('0xf')](_0x2a30f3));_0x1bf7be(_0x2a30f3);})[_0xd876('0x13')](function(_0x110d94){logger[_0xd876('0x10')](_0xd876('0x14'),_0x110d94['message'],_0x26cef8);_0x326256(_0x42a174[_0xd876('0x10')](0x1f4,_0x110d94[_0xd876('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x3c68c4){var _0x16b839=this;return new Promise(function(_0x289999,_0x29f2be){return db[_0xd876('0x17')][_0xd876('0x18')](_0x3c68c4[_0xd876('0x19')],{'raw':_0x3c68c4['options']?_0x3c68c4['options'][_0xd876('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c68c4[_0xd876('0x15')]?_0x3c68c4[_0xd876('0x15')][_0xd876('0x1a')]||null:null,'attributes':_0x3c68c4['options']?_0x3c68c4['options']['attributes']||null:null,'limit':_0x3c68c4[_0xd876('0x15')]?_0x3c68c4[_0xd876('0x15')][_0xd876('0x1b')]||null:null})['then'](function(_0x8ad9d2){logger[_0xd876('0xb')](_0xd876('0x1c'),_0x3c68c4);logger['debug'](_0xd876('0x1c'),_0x3c68c4,JSON[_0xd876('0xf')](_0x8ad9d2));_0x289999(_0x8ad9d2);})[_0xd876('0x13')](function(_0x571ae6){logger[_0xd876('0x10')](_0xd876('0x1c'),_0x571ae6['message'],_0x3c68c4);_0x29f2be(_0x16b839[_0xd876('0x10')](0x1f4,_0x571ae6['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 531636b..1d16f86 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 _0xfea4=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','addApplications','update','destroy','exports','multer'];(function(_0x548c0a,_0x15e6e7){var _0x114592=function(_0xfda9c6){while(--_0xfda9c6){_0x548c0a['push'](_0x548c0a['shift']());}};_0x114592(++_0x15e6e7);}(_0xfea4,0x197));var _0x4fea=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xfea4[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x4fea('0x0'));var util=require(_0x4fea('0x1'));var path=require(_0x4fea('0x2'));var timeout=require(_0x4fea('0x3'));var express=require('express');var router=express[_0x4fea('0x4')]();var fs_extra=require(_0x4fea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4fea('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x4fea('0x7')]('/',auth[_0x4fea('0x8')](),controller[_0x4fea('0x9')]);router['get'](_0x4fea('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x4fea('0xb')]('/',auth[_0x4fea('0x8')](),controller[_0x4fea('0xc')]);router['post']('/:id/applications',auth[_0x4fea('0x8')](),controller[_0x4fea('0xd')]);router['put'](_0x4fea('0xa'),auth[_0x4fea('0x8')](),controller[_0x4fea('0xe')]);router['delete']('/:id',auth[_0x4fea('0x8')](),controller[_0x4fea('0xf')]);module[_0x4fea('0x10')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 5344d49..a9e2324 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 _0xa8cc=['compositeIndex','STRING','NoOp','ENUM','inbound','outbound','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports'];(function(_0x47f4b6,_0x3f6374){var _0x2210a0=function(_0xf968f5){while(--_0xf968f5){_0x47f4b6['push'](_0x47f4b6['shift']());}};_0x2210a0(++_0x3f6374);}(_0xa8cc,0x1c9));var _0xca8c=function(_0xa1200c,_0x4bf4cd){_0xa1200c=_0xa1200c-0x0;var _0x285bae=_0xa8cc[_0xa1200c];return _0x285bae;};'use strict';var Sequelize=require(_0xca8c('0x0'));module[_0xca8c('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xca8c('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xca8c('0x2')},'priority':{'type':Sequelize[_0xca8c('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xca8c('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xca8c('0x3')],'allowNull':![],'defaultValue':_0xca8c('0x4')},'appdata':{'type':Sequelize[_0xca8c('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xca8c('0x5')](_0xca8c('0x6'),_0xca8c('0x7'),'internal','inbound-fax',_0xca8c('0x8'),'system',_0xca8c('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xca8c('0x3')]},'interval':{'type':Sequelize[_0xca8c('0x3')],'allowNull':![],'defaultValue':_0xca8c('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xca8c('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xca8c('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xca8c('0xc')]},'recordingFormat':{'type':Sequelize[_0xca8c('0x3')],'defaultValue':_0xca8c('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xca8c('0xe')],'get':function(_0x5e2f07){return this[_0xca8c('0xf')](_0xca8c('0x10'));}},'alias':{'type':Sequelize[_0xca8c('0x3')],'allowNull':!![]}}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e109d46..61dd9fa 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 _0x3b77=['keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','include','params','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','finally','json','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','type','find','value','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query'];(function(_0x5a2626,_0x3020cd){var _0x23ea1c=function(_0x242a3b){while(--_0x242a3b){_0x5a2626['push'](_0x5a2626['shift']());}};_0x23ea1c(++_0x3020cd);}(_0x3b77,0x8a));var _0x73b7=function(_0x31860d,_0xe65a35){_0x31860d=_0x31860d-0x0;var _0xbb26db=_0x3b77[_0x31860d];return _0xbb26db;};'use strict';var _=require(_0x73b7('0x0'));var Redis=require(_0x73b7('0x1'));var qs=require(_0x73b7('0x2'));var logger=require(_0x73b7('0x3'))('api');var config=require(_0x73b7('0x4'));var db=require(_0x73b7('0x5'))['db'];config[_0x73b7('0x6')]=_[_0x73b7('0x7')](config[_0x73b7('0x6')],{'host':_0x73b7('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73b7('0x6')]));require(_0x73b7('0x9'))[_0x73b7('0xa')](socket);function respondWithStatusCode(_0x1daffe,_0x5d1a57){_0x5d1a57=_0x5d1a57||0xcc;return function(_0xf728d3){if(_0xf728d3){return _0x1daffe[_0x73b7('0xb')](_0x5d1a57);}return _0x1daffe[_0x73b7('0xc')](_0x5d1a57)[_0x73b7('0xd')]();};}function respondWithResult(_0x4e3106,_0x43e196){_0x43e196=_0x43e196||0xc8;return function(_0x20672c){if(_0x20672c){return _0x4e3106[_0x73b7('0xc')](_0x43e196)['json'](_0x20672c);}};}function respondWithFilteredResult(_0x23b0bb,_0x5decf2){return function(_0x29fe66){if(_0x29fe66){var _0x546ed1=typeof _0x5decf2[_0x73b7('0xe')]===_0x73b7('0xf')&&typeof _0x5decf2['limit']===_0x73b7('0xf');var _0x3ce7be=_0x29fe66[_0x73b7('0x10')];var _0x398f78=_0x546ed1?0x0:_0x5decf2['offset'];var _0x3ab451=_0x546ed1?_0x29fe66[_0x73b7('0x10')]:_0x5decf2[_0x73b7('0xe')]+_0x5decf2[_0x73b7('0x11')];var _0x3bd17b;if(_0x3ab451>=_0x3ce7be){_0x3ab451=_0x3ce7be;_0x3bd17b=0xc8;}else{_0x3bd17b=0xce;}_0x23b0bb[_0x73b7('0xc')](_0x3bd17b);return _0x23b0bb[_0x73b7('0x12')](_0x73b7('0x13'),_0x398f78+'-'+_0x3ab451+'/'+_0x3ce7be)['json'](_0x29fe66);}return null;};}function removeEntity(_0x1f9572){return function(_0x123d24){if(_0x123d24){return _0x123d24[_0x73b7('0x14')]()[_0x73b7('0x15')](function(){var _0x43d5e8=_0x123d24[_0x73b7('0x16')]({'plain':!![]});var _0x19bfcc=[{'name':'InboundRoutes','value':_0x73b7('0x17'),'ignore':![]},{'name':_0x73b7('0x18'),'value':_0x73b7('0x19'),'ignore':![]},{'name':_0x73b7('0x1a'),'value':'internal','ignore':![]}];var _0x810013=_(_0x19bfcc)[_0x73b7('0x1b')](_0x73b7('0x1c'))[_0x73b7('0x1d')]('value')['value']();if(_['includes'](_0x810013,_0x43d5e8[_0x73b7('0x1e')])){return;}var _0x1bc135=_[_0x73b7('0x1f')](_0x19bfcc,[_0x73b7('0x20'),_0x43d5e8[_0x73b7('0x1e')]])[_0x73b7('0x21')];return db[_0x73b7('0x22')]['destroy']({'where':{'type':_0x1bc135,'resourceId':_0x43d5e8['id']}})[_0x73b7('0x15')](function(){return _0x123d24;});})[_0x73b7('0x15')](function(){_0x1f9572['status'](0xcc)[_0x73b7('0xd')]();});}};}function handleEntityNotFound(_0x45d60a){return function(_0x513c1b){if(!_0x513c1b){_0x45d60a['sendStatus'](0x194);}return _0x513c1b;};}function handleError(_0x38b611,_0x333441){_0x333441=_0x333441||0x1f4;return function(_0x229f77){logger[_0x73b7('0x23')](_0x229f77[_0x73b7('0x24')]);if(_0x229f77[_0x73b7('0x21')]){delete _0x229f77[_0x73b7('0x21')];}_0x38b611[_0x73b7('0xc')](_0x333441)[_0x73b7('0x25')](_0x229f77);};}exports[_0x73b7('0x26')]=function(_0x4564d7,_0x1fb5bb){var _0x371c53={},_0x288356={},_0x407e3a={'count':0x0,'rows':[]};var _0x769295=_['map'](db[_0x73b7('0x27')][_0x73b7('0x28')],function(_0x4031cd){return{'name':_0x4031cd[_0x73b7('0x29')],'type':_0x4031cd['type']['key']};});_0x288356[_0x73b7('0x2a')]=_['map'](_0x769295,_0x73b7('0x21'));_0x288356[_0x73b7('0x2b')]=_[_0x73b7('0x2c')](_0x4564d7[_0x73b7('0x2b')]);_0x288356[_0x73b7('0x2d')]=_[_0x73b7('0x2e')](_0x288356[_0x73b7('0x2a')],_0x288356[_0x73b7('0x2b')]);_0x371c53[_0x73b7('0x2f')]=_[_0x73b7('0x2e')](_0x288356['model'],qs[_0x73b7('0x30')](_0x4564d7['query'][_0x73b7('0x30')]));_0x371c53['attributes']=_0x371c53[_0x73b7('0x2f')]['length']?_0x371c53['attributes']:_0x288356[_0x73b7('0x2a')];if(!_0x4564d7[_0x73b7('0x2b')]['hasOwnProperty'](_0x73b7('0x31'))){_0x371c53[_0x73b7('0x11')]=qs[_0x73b7('0x11')](_0x4564d7[_0x73b7('0x2b')]['limit']);_0x371c53[_0x73b7('0xe')]=qs['offset'](_0x4564d7[_0x73b7('0x2b')][_0x73b7('0xe')]);}_0x371c53[_0x73b7('0x32')]=qs['sort'](_0x4564d7['query'][_0x73b7('0x33')]);_0x371c53[_0x73b7('0x34')]=qs['filters'](_[_0x73b7('0x35')](_0x4564d7[_0x73b7('0x2b')],_0x288356[_0x73b7('0x2d')]),_0x769295);if(_0x4564d7['query']['filter']){_0x371c53[_0x73b7('0x34')]=_[_0x73b7('0x36')](_0x371c53['where'],{'$or':_['map'](_0x769295,function(_0x620034){if(_0x620034['type']!==_0x73b7('0x37')){var _0x2f12fa={};_0x2f12fa[_0x620034[_0x73b7('0x21')]]={'$like':'%'+_0x4564d7[_0x73b7('0x2b')][_0x73b7('0x1b')]+'%'};return _0x2f12fa;}})});}_0x371c53=_[_0x73b7('0x36')]({},_0x371c53,_0x4564d7[_0x73b7('0x38')]);var _0x5ed6b0={'where':_0x371c53[_0x73b7('0x34')]};return db[_0x73b7('0x27')][_0x73b7('0x10')](_0x5ed6b0)[_0x73b7('0x15')](function(_0x56da61){_0x407e3a[_0x73b7('0x10')]=_0x56da61;if(_0x4564d7['query'][_0x73b7('0x39')]){_0x371c53['include']=[{'all':!![]}];}return db[_0x73b7('0x27')]['findAll'](_0x371c53);})[_0x73b7('0x15')](function(_0x5bd838){_0x407e3a[_0x73b7('0x3a')]=_0x5bd838;return _0x407e3a;})[_0x73b7('0x15')](respondWithFilteredResult(_0x1fb5bb,_0x371c53))[_0x73b7('0x3b')](handleError(_0x1fb5bb,null));};exports[_0x73b7('0x3c')]=function(_0x56d52e,_0x62b830){var _0x53a419={'raw':![],'where':{'id':_0x56d52e['params']['id']}},_0x4e9f62={};_0x4e9f62['model']=_[_0x73b7('0x2c')](db[_0x73b7('0x27')]['rawAttributes']);_0x4e9f62[_0x73b7('0x2b')]=_[_0x73b7('0x2c')](_0x56d52e[_0x73b7('0x2b')]);_0x4e9f62[_0x73b7('0x2d')]=_[_0x73b7('0x2e')](_0x4e9f62[_0x73b7('0x2a')],_0x4e9f62[_0x73b7('0x2b')]);_0x53a419[_0x73b7('0x2f')]=_[_0x73b7('0x2e')](_0x4e9f62[_0x73b7('0x2a')],qs[_0x73b7('0x30')](_0x56d52e[_0x73b7('0x2b')][_0x73b7('0x30')]));_0x53a419['attributes']=_0x53a419[_0x73b7('0x2f')]['length']?_0x53a419[_0x73b7('0x2f')]:_0x4e9f62[_0x73b7('0x2a')];if(_0x56d52e['query'][_0x73b7('0x39')]){_0x53a419[_0x73b7('0x3d')]=[{'all':!![]}];}_0x53a419=_[_0x73b7('0x36')]({},_0x53a419,_0x56d52e[_0x73b7('0x38')]);return db[_0x73b7('0x27')][_0x73b7('0x1f')](_0x53a419)['then'](handleEntityNotFound(_0x62b830,null))[_0x73b7('0x15')](respondWithResult(_0x62b830,null))['catch'](handleError(_0x62b830,null));};exports[_0x73b7('0x14')]=function(_0x123952,_0x2e7d92){return db['VoiceExtension']['find']({'where':{'id':_0x123952[_0x73b7('0x3e')]['id']}})[_0x73b7('0x15')](handleEntityNotFound(_0x2e7d92,null))[_0x73b7('0x15')](removeEntity(_0x2e7d92,null))[_0x73b7('0x3b')](handleError(_0x2e7d92,null));};exports[_0x73b7('0x3f')]=function(_0x46b676,_0x514f90){if(_0x46b676['body']['type']===_0x73b7('0x19')&&!_['startsWith'](_0x46b676[_0x73b7('0x40')]['exten'],'_')){_0x46b676['body'][_0x73b7('0x41')]='_'[_0x73b7('0x42')](_0x46b676[_0x73b7('0x40')][_0x73b7('0x41')]);}return db['VoiceExtension']['create'](_0x46b676[_0x73b7('0x40')],{'raw':![]})[_0x73b7('0x15')](function(_0x1e06ea){var _0x1861f7=_0x46b676[_0x73b7('0x43')][_0x73b7('0x16')]({'plain':!![]});if(!_0x1861f7)throw new Error(_0x73b7('0x44'));if(_0x1861f7[_0x73b7('0x45')]===_0x73b7('0x43')){var _0x4deb5a=_0x1e06ea['get']({'plain':!![]});var _0x32df2e=[{'name':_0x73b7('0x46'),'value':_0x73b7('0x17')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x73b7('0x1a'),'value':'internal'}];var _0x2dc006=_['find'](_0x32df2e,['value',_0x4deb5a[_0x73b7('0x1e')]])[_0x73b7('0x21')];return db[_0x73b7('0x47')][_0x73b7('0x1f')]({'where':{'name':_0x2dc006,'userProfileId':_0x1861f7[_0x73b7('0x48')]},'raw':!![]})[_0x73b7('0x15')](function(_0x1aabf9){if(_0x1aabf9&&_0x1aabf9[_0x73b7('0x49')]===0x0){return db[_0x73b7('0x22')][_0x73b7('0x3f')]({'name':_0x4deb5a[_0x73b7('0x21')],'resourceId':_0x4deb5a['id'],'type':_0x1aabf9['name'],'sectionId':_0x1aabf9['id']},{})[_0x73b7('0x15')](function(){return _0x1e06ea;});}else{return _0x1e06ea;}})[_0x73b7('0x3b')](function(_0x1e4096){logger[_0x73b7('0x23')](_0x73b7('0x4a'),_0x1e4096);throw _0x1e4096;});}return _0x1e06ea;})[_0x73b7('0x15')](respondWithResult(_0x514f90,0xc9))[_0x73b7('0x3b')](handleError(_0x514f90,null));};exports['update']=function(_0x4f951c,_0x1d3759){if(_0x4f951c[_0x73b7('0x40')]['id']){delete _0x4f951c[_0x73b7('0x40')]['id'];}return db[_0x73b7('0x27')][_0x73b7('0x1f')]({'where':{'id':_0x4f951c[_0x73b7('0x3e')]['id']}})[_0x73b7('0x15')](handleEntityNotFound(_0x1d3759,null))[_0x73b7('0x15')](function(_0x55a2a5){if(_0x55a2a5){return db[_0x73b7('0x27')][_0x73b7('0x4b')](_[_0x73b7('0x35')](_0x4f951c['body'],[_0x73b7('0x41'),_0x73b7('0x4c'),'description',_0x73b7('0x4d'),_0x73b7('0x4e'),_0x73b7('0x4f'),_0x73b7('0x50')]),{'where':{'context':_0x55a2a5[_0x73b7('0x4c')],'exten':_0x55a2a5[_0x73b7('0x41')]},'individualHooks':!![]})[_0x73b7('0x15')](function(_0x1bb978){return _0x1bb978;});}return null;})[_0x73b7('0x15')](respondWithStatusCode(_0x1d3759,null))[_0x73b7('0x3b')](handleError(_0x1d3759,null));};exports[_0x73b7('0x51')]=function(_0x36fe36,_0x3fd881){var _0x3f196b=_0x36fe36['params']['id'];var _0x2ea75d=_0x36fe36[_0x73b7('0x40')];var _0x565b98=0xc8;var _0x416bf8=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x73b7('0x52')][_0x73b7('0x53')]['ISOLATION_LEVELS'][_0x73b7('0x54')]},function(_0x43cc25){return db[_0x73b7('0x27')][_0x73b7('0x55')]({'where':{'id':_0x3f196b},'transaction':_0x43cc25})['then'](function(_0x3fd2a7){if(_0x3fd2a7){return db[_0x73b7('0x27')][_0x73b7('0x14')]({'where':{'VoiceExtensionId':_0x3f196b},'transaction':_0x43cc25})[_0x73b7('0x15')](function(){var _0xce839b=_[_0x73b7('0x1d')](_0x2ea75d,function(_0x36abb6){_0x36abb6['VoiceExtensionId']=_0x3f196b;_0x36abb6[_0x73b7('0x56')]=!![];return _0x36abb6;});return _0x3fd2a7['createRouting'](_0xce839b);})[_0x73b7('0x15')](function(_0x266ff0){return db['VoiceExtension'][_0x73b7('0x57')](_0x266ff0,{'transaction':_0x43cc25});});}else{_0x565b98=0x194;_0x416bf8=[];}});})['then'](function(){if(_0x565b98!==0x194){return db[_0x73b7('0x27')][_0x73b7('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3f196b},'order':'cast(priority\x20as\x20unsigned)'})[_0x73b7('0x15')](function(_0x359666){_0x416bf8=_0x359666;});}})[_0x73b7('0x3b')](function(_0x3f4526){_0x565b98=0x1f4;logger[_0x73b7('0x23')](_0x3f4526[_0x73b7('0x24')]);if(_0x3f4526[_0x73b7('0x21')]){delete _0x3f4526[_0x73b7('0x21')];}_0x416bf8=_0x3f4526;})[_0x73b7('0x59')](function(){if(_0x416bf8===null){_0x3fd881[_0x73b7('0xb')](_0x565b98);}else{if(_0x565b98===0x1f4){_0x3fd881[_0x73b7('0xc')](_0x565b98)['send'](_0x416bf8);}else{_0x3fd881[_0x73b7('0xc')](_0x565b98)[_0x73b7('0x5a')](_0x416bf8);}}});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6867c82..723dc1c 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 _0xd224=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2bb0d9,_0x1fa51c){var _0x43fe14=function(_0x3c7111){while(--_0x3c7111){_0x2bb0d9['push'](_0x2bb0d9['shift']());}};_0x43fe14(++_0x1fa51c);}(_0xd224,0xc7));var _0x4d22=function(_0x20d16f,_0x29f310){_0x20d16f=_0x20d16f-0x0;var _0x1fe31a=_0xd224[_0x20d16f];return _0x1fe31a;};'use strict';var EventEmitter=require(_0x4d22('0x0'));var VoiceExtension=require(_0x4d22('0x1'))['db'][_0x4d22('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4d22('0x3')](0x0);var events={'afterCreate':_0x4d22('0x4'),'afterUpdate':_0x4d22('0x5'),'afterDestroy':_0x4d22('0x6')};function emitEvent(_0x49e130){return function(_0x7c5cfc,_0xddc5c4,_0x5f0c1c){VoiceExtensionEvents[_0x4d22('0x7')](_0x49e130+':'+_0x7c5cfc['id'],_0x7c5cfc);VoiceExtensionEvents[_0x4d22('0x7')](_0x49e130,_0x7c5cfc);_0x5f0c1c(null);};}for(var e in events){if(events[_0x4d22('0x8')](e)){var event=events[e];VoiceExtension[_0x4d22('0x9')](e,emitEvent(event));}}module[_0x4d22('0xa')]=VoiceExtensionEvents; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index bdfc812..ae09d54 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 _0xe023=['CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','NoOp','CDR(destination)=','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outbound','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','options','length','name','trunk','split','phone','param','prefix','${EXTEN}','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','appType','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','type','context','alias','No\x20alias\x20set','exten','inbound','push'];(function(_0x37ee67,_0x4b7519){var _0x2e9588=function(_0x36a39f){while(--_0x36a39f){_0x37ee67['push'](_0x37ee67['shift']());}};_0x2e9588(++_0x4b7519);}(_0xe023,0x1da));var _0x3e02=function(_0x5d91ba,_0x25fcb0){_0x5d91ba=_0x5d91ba-0x0;var _0x22d5a4=_0xe023[_0x5d91ba];return _0x22d5a4;};'use strict';var _=require(_0x3e02('0x0'));var attributes=require(_0x3e02('0x1'));module['exports']=function(_0x4edfcf){var _0x2ea7ac=_0x4edfcf[_0x3e02('0x2')];function _0x31d716(_0x38a112){var _0x5cb7f2=0x2;var _0x5540e7=[{'type':_0x38a112['type'],'app':_0x3e02('0x3'),'appdata':_0x3e02('0x4')+_0x38a112[_0x3e02('0x5')],'context':_0x38a112[_0x3e02('0x6')],'exten':_0x38a112['exten'],'priority':_0x5cb7f2++,'VoiceExtensionId':_0x38a112['id']},{'type':_0x38a112[_0x3e02('0x5')],'app':_0x38a112['alias']?_0x3e02('0x3'):'NoOp','appdata':_0x38a112['alias']?'CDR(routeAlias)='+_0x38a112[_0x3e02('0x7')]:_0x3e02('0x8'),'context':_0x38a112[_0x3e02('0x6')],'exten':_0x38a112[_0x3e02('0x9')],'priority':_0x5cb7f2++,'VoiceExtensionId':_0x38a112['id']}];if(_0x38a112[_0x3e02('0x5')]===_0x3e02('0xa')){_0x5540e7[_0x3e02('0xb')]({'type':_0x3e02('0xa'),'app':_0x3e02('0x3'),'appdata':_0x3e02('0xc')+_0x38a112['id'],'context':_0x38a112[_0x3e02('0x6')],'exten':_0x38a112[_0x3e02('0x9')],'priority':_0x5cb7f2++,'VoiceExtensionId':_0x38a112['id']});}_0x5540e7[_0x3e02('0xb')]({'type':_0x38a112[_0x3e02('0x5')],'app':_0x3e02('0x3'),'appdata':_0x3e02('0xd'),'context':_0x38a112[_0x3e02('0x6')],'exten':_0x38a112[_0x3e02('0x9')],'priority':_0x5cb7f2++,'VoiceExtensionId':_0x38a112['id']},{'type':_0x38a112[_0x3e02('0x5')],'app':_0x3e02('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x38a112[_0x3e02('0x6')],'exten':_0x38a112['exten'],'priority':_0x5cb7f2++,'VoiceExtensionId':_0x38a112['id']},{'type':_0x38a112[_0x3e02('0x5')],'app':_0x3e02('0x3'),'appdata':_0x3e02('0xe'),'context':_0x38a112[_0x3e02('0x6')],'exten':_0x38a112['exten'],'priority':_0x5cb7f2++,'VoiceExtensionId':_0x38a112['id']});return _0x5540e7;}function _0x593ce8(_0x408010){var _0x4ef092=0x2;var _0x5690a3=[{'type':'outbound','app':_0x3e02('0x3'),'appdata':'CDR(type)=outbound','context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':'outbound','app':_0x408010[_0x3e02('0x7')]?_0x3e02('0x3'):_0x3e02('0xf'),'appdata':_0x408010[_0x3e02('0x7')]?'CDR(routeAlias)='+_0x408010[_0x3e02('0x7')]:_0x3e02('0x8'),'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010['exten'],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':'outbound','app':_0x3e02('0x3'),'appdata':_0x3e02('0x10')+(_0x408010['cutdigits']?_0x3e02('0x11')+_0x408010[_0x3e02('0x12')]+'}':'${EXTEN}'),'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':'outbound','app':_0x3e02('0x3'),'appdata':_0x3e02('0xc')+_0x408010['id'],'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':'outbound','app':'ExecIf','appdata':_0x3e02('0x13')+(_0x4ef092+0x2)+'):Goto('+(_0x4ef092+0x1)+')','context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':_0x3e02('0x14'),'app':'Set','appdata':_0x408010['cutdigits']?_0x3e02('0x15')+_0x408010[_0x3e02('0x12')]+'}':_0x3e02('0x16'),'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010['exten'],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':_0x3e02('0x14'),'app':_0x3e02('0x3'),'appdata':_0x3e02('0xd'),'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':_0x3e02('0x14'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':'outbound','app':_0x3e02('0x3'),'appdata':_0x3e02('0xe'),'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':_0x3e02('0x14'),'app':'Set','appdata':_0x3e02('0x17')+_0x408010['id'],'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010['exten'],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']}];if(_0x408010[_0x3e02('0x18')](_0x3e02('0x19'))&&_0x408010['recordingFormat']!=='none'){_0x5690a3[_0x3e02('0xb')]({'type':_0x3e02('0x14'),'app':_0x3e02('0x3'),'appdata':_0x3e02('0x1a'),'context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']},{'type':_0x3e02('0x14'),'app':_0x3e02('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x408010[_0x3e02('0x19')]||'wav','context':_0x408010[_0x3e02('0x6')],'exten':_0x408010[_0x3e02('0x9')],'priority':_0x4ef092++,'VoiceExtensionId':_0x408010['id']});}return _0x5690a3;}function _0x5384b0(_0x3ef424,_0x5d611b){var _0x4021c0=[{'name':'trunk','param':0x0},{'name':_0x3e02('0x1b'),'param':0x1},{'name':_0x3e02('0x1c'),'param':0x2},{'name':'url','param':0x3}];var _0x1993d7={};var _0x2a00a8=_0x5d611b['split'](',');var _0x5691f0=[];for(var _0x21711c=0x0;_0x21711c<_0x4021c0[_0x3e02('0x1d')];_0x21711c++){switch(_0x4021c0[_0x21711c][_0x3e02('0x1e')]){case _0x3e02('0x1f'):_0x1993d7['trunk']=_0x2a00a8[_0x4021c0[_0x21711c]['param']][_0x3e02('0x20')]('/')[0x1];_0x1993d7[_0x3e02('0x21')]=_0x2a00a8[_0x4021c0[_0x21711c][_0x3e02('0x22')]][_0x3e02('0x20')]('/')[0x2];_0x1993d7[_0x3e02('0x23')]=_0x1993d7[_0x3e02('0x21')]?_0x1993d7[_0x3e02('0x21')]['split']('$')[0x0]:undefined;_0x1993d7['phone']=_0x3ef424['cutdigits']?(_0x1993d7[_0x3e02('0x23')]||'')+_0x3e02('0x11')+_0x3ef424[_0x3e02('0x12')]+'}':(_0x1993d7['prefix']||'')+_0x3e02('0x24');_0x5691f0[_0x4021c0[_0x21711c][_0x3e02('0x22')]]=[_0x3e02('0x25'),_0x1993d7[_0x3e02('0x1f')],_0x1993d7[_0x3e02('0x21')]]['join']('/');break;case _0x3e02('0x1c'):_0x1993d7[_0x3e02('0x1c')]=_0x2a00a8[_0x4021c0[_0x21711c][_0x3e02('0x22')]];if(_0x3ef424[_0x3e02('0x19')]!==_0x3e02('0x26')){if(_0x1993d7[_0x3e02('0x1c')][_0x3e02('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x1993d7['options']+=_0x3e02('0x28');}}else{_0x1993d7[_0x3e02('0x1c')]=_0x1993d7['options'][_0x3e02('0x29')](_0x3e02('0x28'),'');}_0x5691f0[_0x4021c0[_0x21711c]['param']]=_0x1993d7[_0x3e02('0x1c')];break;default:_0x5691f0[_0x4021c0[_0x21711c]['param']]=_0x2a00a8[_0x4021c0[_0x21711c][_0x3e02('0x22')]];}}return _0x5691f0[_0x3e02('0x2a')](',');}function _0x3022ba(_0x17b61e,_0x8bf27e,_0x4b5b10){return new Promise(function(_0x1a9582,_0x18e07d){var _0x498633=[];if(_[_0x3e02('0x2b')](_0x8bf27e))return _0x1a9582(_0x498633);_0x2ea7ac['Interval'][_0x3e02('0x2c')]({'attributes':['id',_0x3e02('0x2d'),_0x3e02('0x2e')],'raw':!![]})[_0x3e02('0x2f')](function(_0x467843){for(var _0x43d9e5=0x0,_0x2e7392=0x0;_0x43d9e5<_0x8bf27e[_0x3e02('0x1d')];_0x43d9e5++,_0x2e7392=0x0){var _0x270d26=_0x8bf27e[_0x43d9e5];var _0x3fc1ff=[];var _0x5eaad8=[];delete _0x270d26['id'];if(_0x270d26[_0x3e02('0x2d')]!==_0x3e02('0x30')){_0x270d26[_0x3e02('0x31')]=[_0x270d26[_0x3e02('0x2d')]];}else{_0x270d26[_0x3e02('0x31')]=_0x270d26['IntervalId']?_[_0x3e02('0x32')](_['filter'](_0x467843,{'IntervalId':_0x270d26['IntervalId']}),_0x3e02('0x2d')):[];}_0x270d26['context']=_0x17b61e[_0x3e02('0x6')];_0x270d26['exten']=_0x17b61e[_0x3e02('0x9')];if(_0x270d26[_0x3e02('0x5')])_0x270d26[_0x3e02('0x5')]=_0x270d26[_0x3e02('0x5')][_0x3e02('0x33')]();if(_0x17b61e[_0x3e02('0x5')]===_0x3e02('0x14')){if(_0x270d26[_0x3e02('0x18')](_0x3e02('0x34'))&&_0x270d26[_0x3e02('0x34')]&&_0x270d26[_0x3e02('0x34')]!=='--'){_0x3fc1ff[_0x3e02('0xb')]({'type':_0x270d26['type']['toLowerCase'](),'app':_0x3e02('0x3'),'appdata':'CDR(tag)='+_0x270d26[_0x3e02('0x34')],'context':_0x17b61e[_0x3e02('0x6')],'exten':_0x17b61e[_0x3e02('0x9')],'priority':_0x270d26[_0x3e02('0x31')][_0x3e02('0x1d')]+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});}_0x3fc1ff['push']({'type':_0x270d26[_0x3e02('0x5')]['toLowerCase'](),'app':_0x3e02('0x35'),'appdata':_0x3e02('0x36')+(_0x270d26[_0x3e02('0x37')]?_0x3e02('0x38')+_0x270d26['callerID']+')':_0x3e02('0x39')),'context':_0x17b61e[_0x3e02('0x6')],'exten':_0x17b61e[_0x3e02('0x9')],'priority':_0x270d26['intervals'][_0x3e02('0x1d')]+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});}else{if(_0x270d26[_0x3e02('0x18')]('answer')){if(['queue',_0x3e02('0x3a')][_0x3e02('0x3b')](_0x270d26[_0x3e02('0x3c')][_0x3e02('0x33')]())&&_0x270d26['appType']!==_0x3e02('0x3d')){if(_0x270d26['answer']){_0x3fc1ff['push']({'type':_0x270d26[_0x3e02('0x5')][_0x3e02('0x33')](),'app':_0x3e02('0x35'),'appdata':_0x3e02('0x3e'),'context':_0x17b61e[_0x3e02('0x6')],'exten':_0x17b61e[_0x3e02('0x9')],'priority':_0x270d26['intervals'][_0x3e02('0x1d')]+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});_0x3fc1ff[_0x3e02('0xb')]({'type':_0x270d26[_0x3e02('0x5')][_0x3e02('0x33')](),'app':_0x3e02('0x3'),'appdata':_0x3e02('0x3f'),'context':_0x17b61e['context'],'exten':_0x17b61e['exten'],'priority':_0x270d26[_0x3e02('0x31')][_0x3e02('0x1d')]+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});}else{_0x3fc1ff['push']({'type':_0x270d26[_0x3e02('0x5')][_0x3e02('0x33')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x17b61e['context'],'exten':_0x17b61e[_0x3e02('0x9')],'priority':_0x270d26[_0x3e02('0x31')]['length']+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});_0x3fc1ff['push']({'type':_0x270d26[_0x3e02('0x5')][_0x3e02('0x33')](),'app':_0x3e02('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x17b61e[_0x3e02('0x6')],'exten':_0x17b61e[_0x3e02('0x9')],'priority':_0x270d26[_0x3e02('0x31')][_0x3e02('0x1d')]+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});}}}}for(var _0x58f920=0x0;_0x58f920<_0x270d26[_0x3e02('0x31')][_0x3e02('0x1d')];_0x58f920++){var _0xa67adf=_0x4b5b10+_0x270d26[_0x3e02('0x31')]['length'];var _0x6e32ca=_0x58f920===_0x270d26[_0x3e02('0x31')][_0x3e02('0x1d')]-0x1?_0x4b5b10+_0x3fc1ff[_0x3e02('0x1d')]+_0x5eaad8[_0x3e02('0x1d')]+0x2:_0x4b5b10+_0x58f920+0x1;_0x3fc1ff[_0x3e02('0x40')](_0x58f920,0x0,{'type':_0x17b61e[_0x3e02('0x5')],'app':_0x3e02('0x41'),'appdata':_0x270d26['intervals'][_0x58f920]+'?'+_0x17b61e[_0x3e02('0x6')]+',${EXTEN},'+_0xa67adf+':'+_0x17b61e[_0x3e02('0x6')]+_0x3e02('0x42')+_0x6e32ca,'exten':_0x17b61e[_0x3e02('0x9')],'context':_0x17b61e['context'],'priority':_0x4b5b10+_0x58f920,'VoiceExtensionId':_0x17b61e['id']});}if(_0x270d26['appType']===_0x3e02('0x43')){_0x270d26[_0x3e02('0x44')]=_0x5384b0(_0x17b61e,_0x270d26[_0x3e02('0x44')]);}if(_0x270d26[_0x3e02('0x45')]===_0x3e02('0x46')){_0x3fc1ff[_0x3e02('0xb')]({'type':_0x270d26[_0x3e02('0x5')]['toLowerCase'](),'app':_0x3e02('0x3'),'appdata':_0x3e02('0x47'),'context':_0x17b61e[_0x3e02('0x6')],'exten':_0x17b61e[_0x3e02('0x9')],'priority':_0x270d26[_0x3e02('0x31')]['length']+_0x4b5b10+_0x2e7392++,'VoiceExtensionId':_0x17b61e['id']});}_0x270d26['priority']=_0x3fc1ff[_0x3e02('0x1d')]?_[_0x3e02('0x48')](_0x3fc1ff)[_0x3e02('0x49')]+0x1:_0x4b5b10;_0x498633=_[_0x3e02('0x4a')](_0x498633,_0x3fc1ff,[_0x270d26],_0x5eaad8);_0x4b5b10=_['last'](_0x498633)[_0x3e02('0x49')]+0x1;}return _0x1a9582(_0x498633);})[_0x3e02('0x4b')](function(_0x498568){_0x18e07d(_0x498568);});});}return _0x4edfcf[_0x3e02('0x4c')](_0x3e02('0x4d'),attributes,{'tableName':_0x3e02('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x41d5da){var _0x4cc07e=this[_0x3e02('0x4f')]({'plain':!![]});var _0x118209=_0x4cc07e[_0x3e02('0x5')]===_0x3e02('0x14')?_0x593ce8(_0x4cc07e):_0x31d716(_0x4cc07e);return _0x3022ba(_0x4cc07e,_0x41d5da,_['last'](_0x118209)[_0x3e02('0x49')]+0x1)[_0x3e02('0x2f')](function(_0xfcf84f){var _0x3e349f=_[_0x3e02('0x4a')](_0x118209,_0xfcf84f);_0x3e349f[_0x3e02('0xb')]({'type':_0x4cc07e[_0x3e02('0x5')],'app':_0x3e02('0x50'),'exten':_0x4cc07e[_0x3e02('0x9')],'context':_0x4cc07e[_0x3e02('0x6')],'priority':_['last'](_0x3e349f)[_0x3e02('0x49')]+0x1,'VoiceExtensionId':_0x4cc07e['id']});return _0x3e349f;});}}});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index bd80d44..8034290 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 _0xa630=['findAll','options','raw','attributes','limit','include','map','model','GetVoiceExtension','stringify','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa630,0xbe));var _0x0a63=function(_0x2c092f,_0x16aaf1){_0x2c092f=_0x2c092f-0x0;var _0x37e203=_0xa630[_0x2c092f];return _0x37e203;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a63('0x4'))(_0x0a63('0x5'));var config=require(_0x0a63('0x6'));var jayson=require(_0x0a63('0x7'));var client=jayson[_0x0a63('0x8')]['http']({'port':0x232a});config[_0x0a63('0x9')]=_[_0x0a63('0xa')](config[_0x0a63('0x9')],{'host':_0x0a63('0xb'),'port':0x18eb});var socket=require(_0x0a63('0xc'))(new Redis(config[_0x0a63('0x9')]));require('./voiceExtension.socket')[_0x0a63('0xd')](socket);function respondWithRpcPromise(_0xb714c7,_0x2dcbda,_0x218142){return new BPromise(function(_0x327bb0,_0x1cccac){return client[_0x0a63('0xe')](_0xb714c7,_0x218142)[_0x0a63('0xf')](function(_0x258511){logger[_0x0a63('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x2dcbda,_0x0a63('0x11'));logger[_0x0a63('0x12')](_0x0a63('0x13'),_0x2dcbda,_0x0a63('0x11'),JSON['stringify'](_0x258511));if(_0x258511[_0x0a63('0x14')]){if(_0x258511['error'][_0x0a63('0x15')]===0x1f4){logger[_0x0a63('0x14')](_0x0a63('0x16'),_0x2dcbda,_0x258511[_0x0a63('0x14')][_0x0a63('0x17')]);return _0x1cccac(_0x258511[_0x0a63('0x14')][_0x0a63('0x17')]);}logger[_0x0a63('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x2dcbda,_0x258511[_0x0a63('0x14')]['message']);return _0x327bb0(_0x258511[_0x0a63('0x14')][_0x0a63('0x17')]);}else{logger[_0x0a63('0x10')](_0x0a63('0x16'),_0x2dcbda,_0x0a63('0x11'));_0x327bb0(_0x258511[_0x0a63('0x18')][_0x0a63('0x17')]);}})[_0x0a63('0x19')](function(_0x2fd06c){logger[_0x0a63('0x14')](_0x0a63('0x16'),_0x2dcbda,_0x2fd06c);_0x1cccac(_0x2fd06c);});});}exports['GetVoiceExtension']=function(_0x550568){var _0x7b2ccd=this;return new Promise(function(_0x586190,_0x2fc87c){return db['VoiceExtension'][_0x0a63('0x1a')]({'raw':_0x550568[_0x0a63('0x1b')]?_0x550568[_0x0a63('0x1b')][_0x0a63('0x1c')]===undefined?!![]:![]:!![],'where':_0x550568['options']?_0x550568[_0x0a63('0x1b')]['where']||null:null,'attributes':_0x550568[_0x0a63('0x1b')]?_0x550568[_0x0a63('0x1b')][_0x0a63('0x1d')]||null:null,'limit':_0x550568[_0x0a63('0x1b')]?_0x550568[_0x0a63('0x1b')][_0x0a63('0x1e')]||null:null,'include':_0x550568[_0x0a63('0x1b')]?_0x550568[_0x0a63('0x1b')]['include']?_['map'](_0x550568['options']['include'],function(_0xeacfc9){return{'model':db[_0xeacfc9['model']],'as':_0xeacfc9['as'],'attributes':_0xeacfc9['attributes'],'include':_0xeacfc9[_0x0a63('0x1f')]?_[_0x0a63('0x20')](_0xeacfc9[_0x0a63('0x1f')],function(_0x2e2526){return{'model':db[_0x2e2526['model']],'as':_0x2e2526['as'],'attributes':_0x2e2526[_0x0a63('0x1d')],'include':_0x2e2526[_0x0a63('0x1f')]?_[_0x0a63('0x20')](_0x2e2526['include'],function(_0x34239b){return{'model':db[_0x34239b[_0x0a63('0x21')]],'as':_0x34239b['as'],'attributes':_0x34239b[_0x0a63('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0a63('0xf')](function(_0x32a52b){logger[_0x0a63('0x10')](_0x0a63('0x22'),_0x550568);logger[_0x0a63('0x12')]('GetVoiceExtension',_0x550568,JSON[_0x0a63('0x23')](_0x32a52b));_0x586190(_0x32a52b);})['catch'](function(_0x151cb6){logger[_0x0a63('0x14')](_0x0a63('0x22'),_0x151cb6[_0x0a63('0x17')],_0x550568);_0x2fc87c(_0x7b2ccd[_0x0a63('0x14')](0x1f4,_0x151cb6['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index bc91e75..4d5afb3 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 _0x7fbe=['length','voiceExtension:','remove','update','emit','removeListener','register'];(function(_0x113d3f,_0xb5886){var _0x3adbfb=function(_0x426faf){while(--_0x426faf){_0x113d3f['push'](_0x113d3f['shift']());}};_0x3adbfb(++_0xb5886);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x35644c,_0x3c80a0){_0x35644c=_0x35644c-0x0;var _0xc2e514=_0x7fbe[_0x35644c];return _0xc2e514;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xe7fb('0x0'),_0xe7fb('0x1')];function createListener(_0x294c21,_0x1703d5){return function(_0x517d3a){_0x1703d5[_0xe7fb('0x2')](_0x294c21,_0x517d3a);};}function removeListener(_0x11d2c4,_0x4524ff){return function(){VoiceExtensionEvents[_0xe7fb('0x3')](_0x11d2c4,_0x4524ff);};}exports[_0xe7fb('0x4')]=function(_0x290172){for(var _0x12d1b0=0x0,_0x24cd67=events[_0xe7fb('0x5')];_0x12d1b0<_0x24cd67;_0x12d1b0++){var _0x5ad75b=events[_0x12d1b0];var _0x213ebc=createListener(_0xe7fb('0x6')+_0x5ad75b,_0x290172);VoiceExtensionEvents['on'](_0x5ad75b,_0x213ebc);}}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ae854f3..07ba94f 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 _0x5430=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x5430,0x10c));var _0x0543=function(_0x3f6721,_0x3ab44c){_0x3f6721=_0x3f6721-0x0;var _0x3cd8eb=_0x5430[_0x3f6721];return _0x3cd8eb;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')]('/',auth['isAuthenticated'](),controller[_0x0543('0xf')]);router[_0x0543('0x10')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x11')]);router[_0x0543('0x12')](_0x0543('0xa'),auth[_0x0543('0x8')](),controller[_0x0543('0x13')]);module[_0x0543('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 12f5050..fdd7091 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 _0x2453=['ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes'];(function(_0x5b045f,_0x1ddfda){var _0x1f70d5=function(_0xc21fb3){while(--_0xc21fb3){_0x5b045f['push'](_0x5b045f['shift']());}};_0x1f70d5(++_0x1ddfda);}(_0x2453,0x185));var _0x3245=function(_0xbe372f,_0x57945e){_0xbe372f=_0xbe372f-0x0;var _0x515e98=_0x2453[_0xbe372f];return _0x515e98;};'use strict';var Sequelize=require('sequelize');module[_0x3245('0x0')]={'customer_id':{'type':Sequelize[_0x3245('0x1')]},'context':{'type':Sequelize[_0x3245('0x1')],'defaultValue':_0x3245('0x2'),'unique':_0x3245('0x3')},'mailbox':{'type':Sequelize[_0x3245('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3245('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3245('0x1')],'validate':{'isEmail':!![]},'set':function(_0x42b2ac){this[_0x3245('0x4')](_0x3245('0x5'),typeof _0x42b2ac===_0x3245('0x6')&&_0x42b2ac[_0x3245('0x7')]()?_0x42b2ac[_0x3245('0x7')]():null);}},'pager':{'type':Sequelize[_0x3245('0x1')]},'tz':{'type':Sequelize[_0x3245('0x1')],'defaultValue':_0x3245('0x8')},'attach':{'type':Sequelize['ENUM'](_0x3245('0x9'),'no'),'defaultValue':_0x3245('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x3245('0x1')]},'callback':{'type':Sequelize[_0x3245('0x1')]},'review':{'type':Sequelize[_0x3245('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3245('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x3245('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x3245('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3245('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3245('0xa')](_0x3245('0x9'),'no'),'defaultValue':_0x3245('0x9'),'allowNull':![]},'stamp':{'type':_0x3245('0xc')},'emailsubject':{'type':Sequelize[_0x3245('0x1')]},'emailbody':{'type':Sequelize[_0x3245('0x1')]},'maxsecs':{'type':Sequelize[_0x3245('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3245('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3245('0xe')],'get':function(){return this[_0x3245('0xf')](_0x3245('0x10'))+_0x3245('0x11')+this[_0x3245('0xf')](_0x3245('0x12'));}}}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4a189e8..0fcfcfd 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 _0xeffd=['create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','nolimit','order','pick','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','type','merge','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find'];(function(_0x488221,_0x702522){var _0x3eb0a6=function(_0x6cf9da){while(--_0x6cf9da){_0x488221['push'](_0x488221['shift']());}};_0x3eb0a6(++_0x702522);}(_0xeffd,0x6b));var _0xdeff=function(_0x42d539,_0x2227dc){_0x42d539=_0x42d539-0x0;var _0x4814b8=_0xeffd[_0x42d539];return _0x4814b8;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){var _0x32add9=_0x15c425['get']({'plain':!![]});var _0xb08f19=_0xdeff('0x29');return db[_0xdeff('0x2a')][_0xdeff('0x28')]({'where':{'type':_0xb08f19,'resourceId':_0x32add9['id']}})[_0xdeff('0x27')](function(){return _0x15c425;});})[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bb72,_0x1a546c){return function(_0x53b168){if(!_0x53b168){_0x31bb72['sendStatus'](0x194);}return _0x53b168;};}function handleError(_0x830be4,_0x2ea8e9){_0x2ea8e9=_0x2ea8e9||0x1f4;return function(_0x16b2d0){logger[_0xdeff('0x2b')](_0x16b2d0[_0xdeff('0x2c')]);if(_0x16b2d0[_0xdeff('0x2d')]){delete _0x16b2d0[_0xdeff('0x2d')];}_0x830be4['status'](_0x2ea8e9)[_0xdeff('0x2e')](_0x16b2d0);};}exports[_0xdeff('0x2f')]=function(_0x34e258,_0x5045b8){var _0x59f7a0={},_0x346743={},_0x505e3f={'count':0x0,'rows':[]};var _0x69842a=_[_0xdeff('0x30')](db[_0xdeff('0x31')]['rawAttributes'],function(_0x189a51){return{'name':_0x189a51['fieldName'],'type':_0x189a51['type'][_0xdeff('0x32')]};});_0x346743[_0xdeff('0x33')]=_[_0xdeff('0x30')](_0x69842a,_0xdeff('0x2d'));_0x346743['query']=_[_0xdeff('0x34')](_0x34e258[_0xdeff('0x35')]);_0x346743[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x346743[_0xdeff('0x33')],_0x346743[_0xdeff('0x35')]);_0x59f7a0[_0xdeff('0x38')]=_['intersection'](_0x346743[_0xdeff('0x33')],qs['fields'](_0x34e258[_0xdeff('0x35')][_0xdeff('0x39')]));_0x59f7a0[_0xdeff('0x38')]=_0x59f7a0[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x59f7a0[_0xdeff('0x38')]:_0x346743['model'];if(!_0x34e258[_0xdeff('0x35')][_0xdeff('0x3b')]('nolimit')){_0x59f7a0[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x34e258[_0xdeff('0x35')][_0xdeff('0x21')]);_0x59f7a0[_0xdeff('0x1f')]=qs[_0xdeff('0x1f')](_0x34e258[_0xdeff('0x35')][_0xdeff('0x1f')]);}_0x59f7a0['order']=qs[_0xdeff('0x3c')](_0x34e258['query'][_0xdeff('0x3c')]);_0x59f7a0[_0xdeff('0x3d')]=qs[_0xdeff('0x36')](_['pick'](_0x34e258[_0xdeff('0x35')],_0x346743[_0xdeff('0x36')]),_0x69842a);if(_0x34e258[_0xdeff('0x35')][_0xdeff('0x3e')]){_0x59f7a0[_0xdeff('0x3d')]=_['merge'](_0x59f7a0[_0xdeff('0x3d')],{'$or':_['map'](_0x69842a,function(_0x393d75){if(_0x393d75[_0xdeff('0x3f')]!=='VIRTUAL'){var _0x30609b={};_0x30609b[_0x393d75[_0xdeff('0x2d')]]={'$like':'%'+_0x34e258[_0xdeff('0x35')][_0xdeff('0x3e')]+'%'};return _0x30609b;}})});}_0x59f7a0=_[_0xdeff('0x40')]({},_0x59f7a0,_0x34e258['options']);var _0x3d8a33={'where':_0x59f7a0[_0xdeff('0x3d')]};return db[_0xdeff('0x31')][_0xdeff('0x41')](_0x3d8a33)[_0xdeff('0x27')](function(_0x5dfbb3){_0x505e3f['count']=_0x5dfbb3;if(_0x34e258[_0xdeff('0x35')][_0xdeff('0x42')]){_0x59f7a0[_0xdeff('0x43')]=[{'all':!![]}];}return db[_0xdeff('0x31')][_0xdeff('0x44')](_0x59f7a0);})[_0xdeff('0x27')](function(_0x2cd68a){_0x505e3f['rows']=_0x2cd68a;return _0x505e3f;})[_0xdeff('0x27')](respondWithFilteredResult(_0x5045b8,_0x59f7a0))[_0xdeff('0x45')](handleError(_0x5045b8,null));};exports[_0xdeff('0x46')]=function(_0x54fa5b,_0x1c3532){var _0x2c5eee={'raw':!![],'where':{'id':_0x54fa5b[_0xdeff('0x47')]['id']}},_0x14dc7b={};_0x14dc7b['model']=_[_0xdeff('0x34')](db[_0xdeff('0x31')][_0xdeff('0x48')]);_0x14dc7b[_0xdeff('0x35')]=_[_0xdeff('0x34')](_0x54fa5b[_0xdeff('0x35')]);_0x14dc7b[_0xdeff('0x36')]=_[_0xdeff('0x37')](_0x14dc7b['model'],_0x14dc7b[_0xdeff('0x35')]);_0x2c5eee[_0xdeff('0x38')]=_[_0xdeff('0x37')](_0x14dc7b[_0xdeff('0x33')],qs[_0xdeff('0x39')](_0x54fa5b['query'][_0xdeff('0x39')]));_0x2c5eee[_0xdeff('0x38')]=_0x2c5eee[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x2c5eee[_0xdeff('0x38')]:_0x14dc7b['model'];if(_0x54fa5b[_0xdeff('0x35')]['includeAll']){_0x2c5eee[_0xdeff('0x43')]=[{'all':!![]}];}_0x2c5eee=_[_0xdeff('0x40')]({},_0x2c5eee,_0x54fa5b[_0xdeff('0x49')]);return db[_0xdeff('0x31')][_0xdeff('0x4a')](_0x2c5eee)[_0xdeff('0x27')](handleEntityNotFound(_0x1c3532,null))['then'](respondWithResult(_0x1c3532,null))['catch'](handleError(_0x1c3532,null));};exports[_0xdeff('0x4b')]=function(_0xf91a72,_0x3dc206){return db['VoiceMail']['create'](_0xf91a72[_0xdeff('0x4c')],{})[_0xdeff('0x27')](function(_0x497d9f){var _0x23f17d=_0xf91a72[_0xdeff('0x4d')][_0xdeff('0x4e')]({'plain':!![]});if(!_0x23f17d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23f17d[_0xdeff('0x4f')]===_0xdeff('0x4d')){var _0x1ca376=_0x497d9f['get']({'plain':!![]});var _0xce8379=_0xdeff('0x29');return db[_0xdeff('0x50')][_0xdeff('0x4a')]({'where':{'name':_0xce8379,'userProfileId':_0x23f17d[_0xdeff('0x51')]},'raw':!![]})[_0xdeff('0x27')](function(_0x2c7fa4){if(_0x2c7fa4&&_0x2c7fa4['autoAssociation']===0x0){return db[_0xdeff('0x2a')][_0xdeff('0x4b')]({'name':_0x1ca376['name'],'resourceId':_0x1ca376['id'],'type':_0x2c7fa4[_0xdeff('0x2d')],'sectionId':_0x2c7fa4['id']},{})[_0xdeff('0x27')](function(){return _0x497d9f;});}else{return _0x497d9f;}})[_0xdeff('0x45')](function(_0x33482b){logger[_0xdeff('0x2b')](_0xdeff('0x52'),_0x33482b);throw _0x33482b;});}return _0x497d9f;})[_0xdeff('0x27')](respondWithResult(_0x3dc206,0xc9))[_0xdeff('0x45')](handleError(_0x3dc206,null));};exports['update']=function(_0x1b7eb3,_0x3a518d){if(_0x1b7eb3[_0xdeff('0x4c')]['id']){delete _0x1b7eb3['body']['id'];}return db['VoiceMail'][_0xdeff('0x4a')]({'where':{'id':_0x1b7eb3[_0xdeff('0x47')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x3a518d,null))[_0xdeff('0x27')](saveUpdates(_0x1b7eb3[_0xdeff('0x4c')],null))[_0xdeff('0x27')](respondWithResult(_0x3a518d,null))['catch'](handleError(_0x3a518d,null));};exports['destroy']=function(_0x38338b,_0x1cc2c1){return db['VoiceMail']['find']({'where':{'id':_0x38338b[_0xdeff('0x47')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x1cc2c1,null))['then'](removeEntity(_0x1cc2c1,null))[_0xdeff('0x45')](handleError(_0x1cc2c1,null));};exports[_0xdeff('0x53')]=function(_0x577fa8,_0x14fa7f,_0xe731d8){return db['VoiceMail'][_0xdeff('0x54')]({'where':{'id':_0x577fa8[_0xdeff('0x47')]['id']}})['then'](handleEntityNotFound(_0x14fa7f,null))[_0xdeff('0x27')](function(_0x152187){var _0x2a83ac;var _0x592ea6={},_0x47e86d={};_0x47e86d[_0xdeff('0x33')]=_['keys'](db[_0xdeff('0x55')][_0xdeff('0x48')]);_0x47e86d[_0xdeff('0x35')]=_[_0xdeff('0x34')](_0x577fa8[_0xdeff('0x35')]);_0x47e86d['filters']=_['intersection'](_0x47e86d[_0xdeff('0x33')],_0x47e86d[_0xdeff('0x35')]);_0x592ea6[_0xdeff('0x38')]=_[_0xdeff('0x37')](_0x47e86d[_0xdeff('0x33')],qs[_0xdeff('0x39')](_0x577fa8['query'][_0xdeff('0x39')]));_0x592ea6['attributes']=_0x592ea6[_0xdeff('0x38')][_0xdeff('0x3a')]?_0x592ea6[_0xdeff('0x38')]:_0x47e86d[_0xdeff('0x33')];if(!_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3b')](_0xdeff('0x56'))){_0x592ea6[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x577fa8['query'][_0xdeff('0x21')]);_0x592ea6['offset']=qs[_0xdeff('0x1f')](_0x577fa8[_0xdeff('0x35')]['offset']);}_0x592ea6[_0xdeff('0x57')]=qs['sort'](_0x577fa8[_0xdeff('0x35')]['sort']);_0x592ea6['where']=qs[_0xdeff('0x36')](_[_0xdeff('0x58')](_0x577fa8['query'],_0x47e86d[_0xdeff('0x36')]));if(_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3e')]){_0x592ea6[_0xdeff('0x3d')]=_[_0xdeff('0x40')](_0x592ea6[_0xdeff('0x3d')],{'$or':_[_0xdeff('0x30')](_0x592ea6[_0xdeff('0x38')],function(_0x46046a){var _0x517ca7={};_0x517ca7[_0x46046a]={'$like':'%'+_0x577fa8[_0xdeff('0x35')][_0xdeff('0x3e')]+'%'};return _0x517ca7;})});}_0x592ea6['where']=_['merge'](_0x592ea6[_0xdeff('0x3d')],{'mailboxuser':_0x152187[_0xdeff('0x59')]});_0x592ea6=_['merge']({},_0x592ea6,_0x577fa8[_0xdeff('0x49')]);return db[_0xdeff('0x55')][_0xdeff('0x5a')](_0x592ea6)[_0xdeff('0x27')](respondWithFilteredResult(_0x14fa7f,_0x592ea6));})[_0xdeff('0x45')](handleError(_0x14fa7f,null));}; \ No newline at end of file +var _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_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 diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9325b61..3d3a549 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 _0x0528=['api','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','context','util','../../config/logger'];(function(_0x327a9b,_0xe77fbe){var _0x11a515=function(_0x2ea23c){while(--_0x2ea23c){_0x327a9b['push'](_0x327a9b['shift']());}};_0x11a515(++_0xe77fbe);}(_0x0528,0x172));var _0x8052=function(_0x349173,_0x41f02d){_0x349173=_0x349173-0x0;var _0x237f08=_0x0528[_0x349173];return _0x237f08;};'use strict';var _=require('lodash');var util=require(_0x8052('0x0'));var logger=require(_0x8052('0x1'))(_0x8052('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8052('0x3'));var fs=require('fs');var path=require(_0x8052('0x4'));var rimraf=require('rimraf');var config=require(_0x8052('0x5'));var attributes=require(_0x8052('0x6'));module[_0x8052('0x7')]=function(_0x545967,_0x5b1155){return _0x545967[_0x8052('0x8')]('VoiceMail',attributes,{'tableName':_0x8052('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8052('0xa'),_0x8052('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 21f013d..5f9352c 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 _0x02da=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x4be6a4,_0x17e738){var _0x2c07bc=function(_0x36b73c){while(--_0x36b73c){_0x4be6a4['push'](_0x4be6a4['shift']());}};_0x2c07bc(++_0x17e738);}(_0x02da,0x158));var _0xa02d=function(_0x284b01,_0x56c566){_0x284b01=_0x284b01-0x0;var _0x1ba2ab=_0x02da[_0x284b01];return _0x1ba2ab;};'use strict';var _=require('lodash');var util=require(_0xa02d('0x0'));var moment=require(_0xa02d('0x1'));var BPromise=require(_0xa02d('0x2'));var rs=require(_0xa02d('0x3'));var fs=require('fs');var Redis=require(_0xa02d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa02d('0x5'));var logger=require(_0xa02d('0x6'))(_0xa02d('0x7'));var config=require(_0xa02d('0x8'));var jayson=require(_0xa02d('0x9'));var client=jayson[_0xa02d('0xa')][_0xa02d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42eeb0,_0x55b727,_0x4da783){return new BPromise(function(_0x4b2907,_0x3431f0){return client['request'](_0x42eeb0,_0x4da783)[_0xa02d('0xc')](function(_0x1ba012){logger[_0xa02d('0xd')](_0xa02d('0xe'),_0x55b727,_0xa02d('0xf'));logger[_0xa02d('0x10')](_0xa02d('0x11'),_0x55b727,_0xa02d('0xf'),JSON[_0xa02d('0x12')](_0x1ba012));if(_0x1ba012[_0xa02d('0x13')]){if(_0x1ba012['error'][_0xa02d('0x14')]===0x1f4){logger[_0xa02d('0x13')]('VoiceMail,\x20%s,\x20%s',_0x55b727,_0x1ba012[_0xa02d('0x13')][_0xa02d('0x15')]);return _0x3431f0(_0x1ba012['error'][_0xa02d('0x15')]);}logger[_0xa02d('0x13')](_0xa02d('0xe'),_0x55b727,_0x1ba012[_0xa02d('0x13')][_0xa02d('0x15')]);return _0x4b2907(_0x1ba012[_0xa02d('0x13')][_0xa02d('0x15')]);}else{logger['info'](_0xa02d('0xe'),_0x55b727,'request\x20sent');_0x4b2907(_0x1ba012['result'][_0xa02d('0x15')]);}})[_0xa02d('0x16')](function(_0x11f200){logger[_0xa02d('0x13')](_0xa02d('0xe'),_0x55b727,_0x11f200);_0x3431f0(_0x11f200);});});} \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index dcb3e38..3f73cbf 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 _0x9152=['./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1f98f5,_0x517b7a){var _0xbac86b=function(_0x1ae92f){while(--_0x1ae92f){_0x1f98f5['push'](_0x1f98f5['shift']());}};_0xbac86b(++_0x517b7a);}(_0x9152,0x1f0));var _0x2915=function(_0x2bfbc3,_0x4d7905){_0x2bfbc3=_0x2bfbc3-0x0;var _0x52293d=_0x9152[_0x2bfbc3];return _0x52293d;};'use strict';var multer=require(_0x2915('0x0'));var util=require('util');var path=require(_0x2915('0x1'));var timeout=require(_0x2915('0x2'));var express=require(_0x2915('0x3'));var router=express[_0x2915('0x4')]();var fs_extra=require(_0x2915('0x5'));var auth=require(_0x2915('0x6'));var interaction=require(_0x2915('0x7'));var config=require('../../config/environment');var controller=require(_0x2915('0x8'));router[_0x2915('0x9')]('/',auth[_0x2915('0xa')](),controller['index']);router['get'](_0x2915('0xb'),auth[_0x2915('0xa')](),controller[_0x2915('0xc')]);router['get'](_0x2915('0xd'),auth[_0x2915('0xa')](),controller[_0x2915('0xe')]);router['post']('/',auth[_0x2915('0xa')](),controller[_0x2915('0xf')]);router[_0x2915('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2915('0x11')]);router[_0x2915('0x12')](_0x2915('0xb'),auth['isAuthenticated'](),controller[_0x2915('0x13')]);module[_0x2915('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index d32392d..cdac58f 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 _0x4eca=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','exports'];(function(_0x93e6a1,_0x11e83d){var _0x37a194=function(_0x40144b){while(--_0x40144b){_0x93e6a1['push'](_0x93e6a1['shift']());}};_0x37a194(++_0x11e83d);}(_0x4eca,0x1d7));var _0xa4ec=function(_0x4a44cf,_0x3de8b2){_0x4a44cf=_0x4a44cf-0x0;var _0x2f3acf=_0x4eca[_0x4a44cf];return _0x2f3acf;};'use strict';var Sequelize=require('sequelize');module[_0xa4ec('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x310c71){return this[_0xa4ec('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xa4ec('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xa4ec('0x4')](_0xa4ec('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xa4ec('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xa4ec('0x6'),'defaultValue':Sequelize[_0xa4ec('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index df7768d..639399a 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 _0x9461=['download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','send','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','index','map','VoiceMailMessage','rawAttributes','key','model','differenceBy','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','include','create','body','find'];(function(_0x3dd782,_0x1356a7){var _0x278423=function(_0x2082f1){while(--_0x2082f1){_0x3dd782['push'](_0x3dd782['shift']());}};_0x278423(++_0x1356a7);}(_0x9461,0x10f));var _0x1946=function(_0x17215f,_0x1c78b2){_0x17215f=_0x17215f-0x0;var _0x3c44a9=_0x9461[_0x17215f];return _0x3c44a9;};'use strict';var emlformat=require(_0x1946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1946('0x2'));var moment=require(_0x1946('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1946('0x4'));var util=require(_0x1946('0x5'));var path=require(_0x1946('0x6'));var sox=require(_0x1946('0x7'));var csv=require(_0x1946('0x8'));var ejs=require(_0x1946('0x9'));var fs=require('fs');var fs_extra=require(_0x1946('0xa'));var _=require(_0x1946('0xb'));var squel=require(_0x1946('0xc'));var crypto=require(_0x1946('0xd'));var jsforce=require(_0x1946('0xe'));var deskjs=require(_0x1946('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1946('0x10'));var Papa=require(_0x1946('0x11'));var Redis=require('ioredis');var authService=require(_0x1946('0x12'));var qs=require(_0x1946('0x13'));var as=require(_0x1946('0x14'));var hardwareService=require(_0x1946('0x15'));var logger=require(_0x1946('0x16'))(_0x1946('0x17'));var utils=require(_0x1946('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e46f8,_0x419085){_0x419085=_0x419085||0xcc;return function(_0x2755fb){if(_0x2755fb){return _0x2e46f8[_0x1946('0x19')](_0x419085);}return _0x2e46f8[_0x1946('0x1a')](_0x419085)[_0x1946('0x1b')]();};}function respondWithResult(_0x596ae6,_0xbe11e6){_0xbe11e6=_0xbe11e6||0xc8;return function(_0x4d5c2e){if(_0x4d5c2e){return _0x596ae6[_0x1946('0x1a')](_0xbe11e6)[_0x1946('0x1c')](_0x4d5c2e);}};}function respondWithFilteredResult(_0x206605,_0x28b81e){return function(_0x41b7bd){if(_0x41b7bd){var _0xf9d66a=typeof _0x28b81e['offset']==='undefined'&&typeof _0x28b81e[_0x1946('0x1d')]===_0x1946('0x1e');var _0x467d91=_0x41b7bd[_0x1946('0x1f')];var _0x282c5f=_0xf9d66a?0x0:_0x28b81e[_0x1946('0x20')];var _0x4a8b06=_0xf9d66a?_0x41b7bd[_0x1946('0x1f')]:_0x28b81e[_0x1946('0x20')]+_0x28b81e[_0x1946('0x1d')];var _0x47f3fb;if(_0x4a8b06>=_0x467d91){_0x4a8b06=_0x467d91;_0x47f3fb=0xc8;}else{_0x47f3fb=0xce;}_0x206605[_0x1946('0x1a')](_0x47f3fb);return _0x206605[_0x1946('0x21')](_0x1946('0x22'),_0x282c5f+'-'+_0x4a8b06+'/'+_0x467d91)[_0x1946('0x1c')](_0x41b7bd);}return null;};}function patchUpdates(_0x4c7685){return function(_0x3e2afd){try{jsonpatch[_0x1946('0x23')](_0x3e2afd,_0x4c7685,!![]);}catch(_0xc810fb){return BPromise[_0x1946('0x24')](_0xc810fb);}return _0x3e2afd['save']();};}function saveUpdates(_0x2eca33,_0xa80f6f){return function(_0xe6185d){if(_0xe6185d){return _0xe6185d[_0x1946('0x25')](_0x2eca33)['then'](function(_0x2056e4){return _0x2056e4;});}return null;};}function removeEntity(_0x57797d,_0x40f84e){return function(_0x15872a){if(_0x15872a){return _0x15872a[_0x1946('0x26')]()[_0x1946('0x27')](function(){_0x57797d['status'](0xcc)[_0x1946('0x1b')]();});}};}function handleEntityNotFound(_0x2413de,_0x148392){return function(_0x39820c){if(!_0x39820c){_0x2413de[_0x1946('0x19')](0x194);}return _0x39820c;};}function handleError(_0x521282,_0x4542e1){_0x4542e1=_0x4542e1||0x1f4;return function(_0x5b829b){logger[_0x1946('0x28')](_0x5b829b[_0x1946('0x29')]);if(_0x5b829b['name']){delete _0x5b829b['name'];}_0x521282['status'](_0x4542e1)['send'](_0x5b829b);};}exports[_0x1946('0x2a')]=function(_0x25b390,_0x18598d){var _0x189d5b={},_0x1e95ac={},_0x5e95dc={'count':0x0,'rows':[]};var _0x202064=_[_0x1946('0x2b')](db[_0x1946('0x2c')][_0x1946('0x2d')],function(_0x18d99e){return{'name':_0x18d99e['fieldName'],'type':_0x18d99e['type'][_0x1946('0x2e')]};});_0x1e95ac[_0x1946('0x2f')]=_[_0x1946('0x30')](_['map'](_0x202064,_0x1946('0x31')),[_0x1946('0x31')]);_0x1e95ac[_0x1946('0x32')]=_[_0x1946('0x33')](_0x25b390[_0x1946('0x32')]);_0x1e95ac[_0x1946('0x34')]=_[_0x1946('0x35')](_0x1e95ac[_0x1946('0x2f')],_0x1e95ac[_0x1946('0x32')]);_0x189d5b[_0x1946('0x36')]=_[_0x1946('0x35')](_0x1e95ac['model'],qs[_0x1946('0x37')](_0x25b390[_0x1946('0x32')][_0x1946('0x37')]));_0x189d5b['attributes']=_0x189d5b[_0x1946('0x36')][_0x1946('0x38')]?_0x189d5b['attributes']:_0x1e95ac[_0x1946('0x2f')];if(!_0x25b390[_0x1946('0x32')][_0x1946('0x39')](_0x1946('0x3a'))){_0x189d5b[_0x1946('0x1d')]=qs[_0x1946('0x1d')](_0x25b390[_0x1946('0x32')]['limit']);_0x189d5b[_0x1946('0x20')]=qs[_0x1946('0x20')](_0x25b390[_0x1946('0x32')][_0x1946('0x20')]);}_0x189d5b[_0x1946('0x3b')]=qs[_0x1946('0x3c')](_0x25b390[_0x1946('0x32')]['sort']);_0x189d5b[_0x1946('0x3d')]=qs[_0x1946('0x34')](_[_0x1946('0x3e')](_0x25b390[_0x1946('0x32')],_0x1e95ac[_0x1946('0x34')]),_0x202064);if(_0x25b390[_0x1946('0x32')]['filter']){_0x189d5b[_0x1946('0x3d')]=_['merge'](_0x189d5b[_0x1946('0x3d')],{'$or':_['map'](_0x202064,function(_0x5add29){if(_0x5add29[_0x1946('0x3f')]!==_0x1946('0x40')){var _0x47dbd8={};_0x47dbd8[_0x5add29[_0x1946('0x31')]]={'$like':'%'+_0x25b390[_0x1946('0x32')][_0x1946('0x41')]+'%'};return _0x47dbd8;}})});}_0x189d5b=_[_0x1946('0x42')]({},_0x189d5b,_0x25b390[_0x1946('0x43')]);var _0x3249cf={'where':_0x189d5b[_0x1946('0x3d')]};return db[_0x1946('0x2c')][_0x1946('0x1f')](_0x3249cf)[_0x1946('0x27')](function(_0x54102e){_0x5e95dc[_0x1946('0x1f')]=_0x54102e;if(_0x25b390[_0x1946('0x32')][_0x1946('0x44')]){_0x189d5b['include']=[{'all':!![]}];}return db[_0x1946('0x2c')][_0x1946('0x45')](_0x189d5b);})['then'](function(_0x2b98e4){_0x5e95dc['rows']=_0x2b98e4;return _0x5e95dc;})[_0x1946('0x27')](respondWithFilteredResult(_0x18598d,_0x189d5b))[_0x1946('0x46')](handleError(_0x18598d,null));};exports[_0x1946('0x47')]=function(_0xf6c20e,_0x320e5f){var _0x5125df={'raw':!![],'where':{'id':_0xf6c20e[_0x1946('0x48')]['id']}},_0x1789fe={};_0x1789fe['model']=_[_0x1946('0x33')](db[_0x1946('0x2c')]['rawAttributes']);_0x1789fe[_0x1946('0x32')]=_[_0x1946('0x33')](_0xf6c20e['query']);_0x1789fe[_0x1946('0x34')]=_[_0x1946('0x35')](_0x1789fe[_0x1946('0x2f')],_0x1789fe[_0x1946('0x32')]);_0x5125df[_0x1946('0x36')]=_['intersection'](_0x1789fe[_0x1946('0x2f')],qs['fields'](_0xf6c20e[_0x1946('0x32')]['fields']));_0x5125df['attributes']=_0x5125df['attributes'][_0x1946('0x38')]?_0x5125df[_0x1946('0x36')]:_0x1789fe[_0x1946('0x2f')];if(_0xf6c20e[_0x1946('0x32')]['includeAll']){_0x5125df[_0x1946('0x49')]=[{'all':!![]}];}_0x5125df=_[_0x1946('0x42')]({},_0x5125df,_0xf6c20e[_0x1946('0x43')]);return db[_0x1946('0x2c')]['find'](_0x5125df)[_0x1946('0x27')](handleEntityNotFound(_0x320e5f,null))[_0x1946('0x27')](respondWithResult(_0x320e5f,null))[_0x1946('0x46')](handleError(_0x320e5f,null));};exports[_0x1946('0x4a')]=function(_0x5d9dfd,_0x39f25f){return db[_0x1946('0x2c')][_0x1946('0x4a')](_0x5d9dfd['body'],{})[_0x1946('0x27')](respondWithResult(_0x39f25f,0xc9))['catch'](handleError(_0x39f25f,null));};exports[_0x1946('0x25')]=function(_0x2ca64e,_0x3e456f){if(_0x2ca64e[_0x1946('0x4b')]['id']){delete _0x2ca64e['body']['id'];}return db['VoiceMailMessage'][_0x1946('0x4c')]({'where':{'id':_0x2ca64e[_0x1946('0x48')]['id']}})[_0x1946('0x27')](handleEntityNotFound(_0x3e456f,null))['then'](saveUpdates(_0x2ca64e['body'],null))['then'](respondWithResult(_0x3e456f,null))[_0x1946('0x46')](handleError(_0x3e456f,null));};exports['destroy']=function(_0x53ce91,_0x4a484a){return db['VoiceMailMessage'][_0x1946('0x4c')]({'where':{'id':_0x53ce91[_0x1946('0x48')]['id']}})[_0x1946('0x27')](handleEntityNotFound(_0x4a484a,null))['then'](removeEntity(_0x4a484a,null))[_0x1946('0x46')](handleError(_0x4a484a,null));};exports[_0x1946('0x4d')]=function(_0x3bea5c,_0x12e010,_0x42e599){return db[_0x1946('0x2c')]['find']({'where':{'id':_0x3bea5c[_0x1946('0x48')]['id']},'attributes':['id',_0x1946('0x4e'),_0x1946('0x4f')]})['then'](handleEntityNotFound(_0x12e010,null))[_0x1946('0x27')](function(_0x2e8b8e){if(_0x2e8b8e){if(!_0x2e8b8e[_0x1946('0x4e')]){throw new db['Sequelize'][(_0x1946('0x50'))](_0x1946('0x51'));}var _0x3fed9b={'Content-Type':_0x1946('0x52'),'Content-Disposition':_0x1946('0x53')};if(_0x2e8b8e[_0x1946('0x4f')]){_0x3fed9b[_0x1946('0x54')]='attachment;\x20filename=\x22'+_0x2e8b8e[_0x1946('0x4f')]+_0x1946('0x55');}_0x12e010[_0x1946('0x21')](_0x3fed9b);return _0x12e010[_0x1946('0x56')](new Buffer(_0x2e8b8e[_0x1946('0x4e')]));}})['catch'](handleError(_0x12e010,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3343c74..65b75df 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 _0x0bc4=['moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages','dir','lodash','util','../../config/logger'];(function(_0x6be190,_0x25e8dd){var _0x3867df=function(_0x204898){while(--_0x204898){_0x6be190['push'](_0x6be190['shift']());}};_0x3867df(++_0x25e8dd);}(_0x0bc4,0x1a1));var _0x40bc=function(_0x1be6fd,_0x2bd2f2){_0x1be6fd=_0x1be6fd-0x0;var _0x4ac5be=_0x0bc4[_0x1be6fd];return _0x4ac5be;};'use strict';var _=require(_0x40bc('0x0'));var util=require(_0x40bc('0x1'));var logger=require(_0x40bc('0x2'))('api');var moment=require(_0x40bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x40bc('0x4'));var fs=require('fs');var path=require(_0x40bc('0x5'));var rimraf=require(_0x40bc('0x6'));var config=require(_0x40bc('0x7'));var attributes=require(_0x40bc('0x8'));module[_0x40bc('0x9')]=function(_0x55925d,_0x4732bc){return _0x55925d['define']('VoiceMailMessage',attributes,{'tableName':_0x40bc('0xa'),'paranoid':![],'indexes':[{'name':_0x40bc('0xb'),'fields':[_0x40bc('0xb')]}],'timestamps':![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a0ca68f..201d860 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 _0xd084=['stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','http','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3fdf8f,_0x437193){var _0x3852a7=function(_0x4012e6){while(--_0x4012e6){_0x3fdf8f['push'](_0x3fdf8f['shift']());}};_0x3852a7(++_0x437193);}(_0xd084,0xc1));var _0x4d08=function(_0x100adf,_0x224ddd){_0x100adf=_0x100adf-0x0;var _0x33de0d=_0xd084[_0x100adf];return _0x33de0d;};'use strict';var _=require(_0x4d08('0x0'));var util=require('util');var moment=require(_0x4d08('0x1'));var BPromise=require(_0x4d08('0x2'));var rs=require(_0x4d08('0x3'));var fs=require('fs');var Redis=require(_0x4d08('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4d08('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4d08('0x6'));var client=jayson['client'][_0x4d08('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28ed3b,_0x46ece6,_0x49903b){return new BPromise(function(_0x30a652,_0xbdafc6){return client['request'](_0x28ed3b,_0x49903b)['then'](function(_0x380968){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x46ece6,_0x4d08('0x8'));logger[_0x4d08('0x9')](_0x4d08('0xa'),_0x46ece6,_0x4d08('0x8'),JSON[_0x4d08('0xb')](_0x380968));if(_0x380968[_0x4d08('0xc')]){if(_0x380968[_0x4d08('0xc')]['code']===0x1f4){logger[_0x4d08('0xc')](_0x4d08('0xd'),_0x46ece6,_0x380968[_0x4d08('0xc')][_0x4d08('0xe')]);return _0xbdafc6(_0x380968['error'][_0x4d08('0xe')]);}logger[_0x4d08('0xc')](_0x4d08('0xd'),_0x46ece6,_0x380968['error'][_0x4d08('0xe')]);return _0x30a652(_0x380968['error']['message']);}else{logger[_0x4d08('0xf')](_0x4d08('0xd'),_0x46ece6,'request\x20sent');_0x30a652(_0x380968['result'][_0x4d08('0xe')]);}})[_0x4d08('0x10')](function(_0x24130a){logger[_0x4d08('0xc')](_0x4d08('0xd'),_0x46ece6,_0x24130a);_0xbdafc6(_0x24130a);});});} \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 2d9ad6a..c6a5765 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 _0x8df7=['/:id','isAuthenticated','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','exports','util','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x8df7,0xdd));var _0x78df=function(_0x581a2e,_0xbf0cac){_0x581a2e=_0x581a2e-0x0;var _0x4c0576=_0x8df7[_0x581a2e];return _0x4c0576;};'use strict';var multer=require('multer');var util=require(_0x78df('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x78df('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x78df('0x2'));var config=require(_0x78df('0x3'));var controller=require(_0x78df('0x4'));router[_0x78df('0x5')]('/',auth['isAuthenticated'](),controller[_0x78df('0x6')]);router[_0x78df('0x5')](_0x78df('0x7'),auth[_0x78df('0x8')](),controller[_0x78df('0x9')]);router[_0x78df('0x5')](_0x78df('0xa'),auth[_0x78df('0x8')](),controller[_0x78df('0xb')]);router[_0x78df('0xc')]('/',auth[_0x78df('0x8')](),controller['create']);router[_0x78df('0xc')](_0x78df('0xa'),auth[_0x78df('0x8')](),controller[_0x78df('0xd')]);router[_0x78df('0xe')]('/:id',auth[_0x78df('0x8')](),controller[_0x78df('0xf')]);router[_0x78df('0x10')](_0x78df('0x7'),auth[_0x78df('0x8')](),controller[_0x78df('0x11')]);router[_0x78df('0x10')]('/:id/sounds/:id2',auth[_0x78df('0x8')](),controller['removeSound']);module[_0x78df('0x12')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index dfe20f1..eb5ef15 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 _0x9d05=['name','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9d05,0x13c));var _0x59d0=function(_0x4708f8,_0x250166){_0x4708f8=_0x4708f8-0x0;var _0x18932d=_0x9d05[_0x4708f8];return _0x18932d;};'use strict';var Sequelize=require(_0x59d0('0x0'));module[_0x59d0('0x1')]={'name':{'type':Sequelize[_0x59d0('0x2')],'allowNull':![],'unique':_0x59d0('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x59d0('0x4'),'mp3nb',_0x59d0('0x5'),_0x59d0('0x6'),_0x59d0('0x7')),'allowNull':!![],'defaultValue':_0x59d0('0x4')},'directory':{'type':Sequelize[_0x59d0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x59d0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x59d0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x59d0('0x2')],'allowNull':!![],'defaultValue':_0x59d0('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x59d0('0x9')},'defaultEntry':{'type':Sequelize[_0x59d0('0xa')],'defaultValue':0x0}}; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 2aea218..33b383e 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 _0x8f14=['MusicOnHolds','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','unlinkSync','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','extname','join','format','Sequelize','removeSound','id2','options','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','show','include','catch','body','find','params','create','transaction','mode','files','directory','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x35bb5a,_0x7fdef3){var _0xf5483a=function(_0x29f7fc){while(--_0x29f7fc){_0x35bb5a['push'](_0x35bb5a['shift']());}};_0xf5483a(++_0x7fdef3);}(_0x8f14,0x176));var _0x48f1=function(_0x394474,_0x1b69dc){_0x394474=_0x394474-0x0;var _0x1eead3=_0x8f14[_0x394474];return _0x1eead3;};'use strict';var emlformat=require(_0x48f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x48f1('0x1'));var jsonpatch=require(_0x48f1('0x2'));var rp=require(_0x48f1('0x3'));var moment=require(_0x48f1('0x4'));var BPromise=require(_0x48f1('0x5'));var Mustache=require(_0x48f1('0x6'));var util=require('util');var path=require(_0x48f1('0x7'));var sox=require(_0x48f1('0x8'));var csv=require(_0x48f1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48f1('0xa'));var _=require(_0x48f1('0xb'));var squel=require('squel');var crypto=require(_0x48f1('0xc'));var jsforce=require(_0x48f1('0xd'));var deskjs=require(_0x48f1('0xe'));var toCsv=require(_0x48f1('0x9'));var querystring=require(_0x48f1('0xf'));var Papa=require(_0x48f1('0x10'));var Redis=require('ioredis');var authService=require(_0x48f1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48f1('0x12'));var hardwareService=require(_0x48f1('0x13'));var logger=require(_0x48f1('0x14'))(_0x48f1('0x15'));var utils=require(_0x48f1('0x16'));var config=require(_0x48f1('0x17'));var licenseUtil=require(_0x48f1('0x18'));var db=require(_0x48f1('0x19'))['db'];function respondWithStatusCode(_0x34747c,_0x3016aa){_0x3016aa=_0x3016aa||0xcc;return function(_0x388ade){if(_0x388ade){return _0x34747c[_0x48f1('0x1a')](_0x3016aa);}return _0x34747c[_0x48f1('0x1b')](_0x3016aa)['end']();};}function respondWithResult(_0x489945,_0x2a29c3){_0x2a29c3=_0x2a29c3||0xc8;return function(_0x4a11dc){if(_0x4a11dc){return _0x489945[_0x48f1('0x1b')](_0x2a29c3)['json'](_0x4a11dc);}};}function respondWithFilteredResult(_0x7d8848,_0x45e5f7){return function(_0x45c5aa){if(_0x45c5aa){var _0x4c9c1=typeof _0x45e5f7[_0x48f1('0x1c')]===_0x48f1('0x1d')&&typeof _0x45e5f7['limit']==='undefined';var _0x361ff6=_0x45c5aa[_0x48f1('0x1e')];var _0x33a4b8=_0x4c9c1?0x0:_0x45e5f7[_0x48f1('0x1c')];var _0xdbba99=_0x4c9c1?_0x45c5aa[_0x48f1('0x1e')]:_0x45e5f7[_0x48f1('0x1c')]+_0x45e5f7[_0x48f1('0x1f')];var _0x130606;if(_0xdbba99>=_0x361ff6){_0xdbba99=_0x361ff6;_0x130606=0xc8;}else{_0x130606=0xce;}_0x7d8848[_0x48f1('0x1b')](_0x130606);return _0x7d8848[_0x48f1('0x20')](_0x48f1('0x21'),_0x33a4b8+'-'+_0xdbba99+'/'+_0x361ff6)[_0x48f1('0x22')](_0x45c5aa);}return null;};}function patchUpdates(_0x4842e8){return function(_0x1b336a){try{jsonpatch[_0x48f1('0x23')](_0x1b336a,_0x4842e8,!![]);}catch(_0x596ee6){return BPromise[_0x48f1('0x24')](_0x596ee6);}return _0x1b336a[_0x48f1('0x25')]();};}function saveUpdates(_0x483855,_0x4ec344){return function(_0x27fd79){if(_0x27fd79){return _0x27fd79[_0x48f1('0x26')](_0x483855)[_0x48f1('0x27')](function(_0x29ad59){return _0x29ad59;});}return null;};}function removeEntity(_0x53564b,_0x12485d){return function(_0x2428fb){if(_0x2428fb){return _0x2428fb['destroy']()[_0x48f1('0x27')](function(){var _0x27ec2e=_0x2428fb[_0x48f1('0x28')]({'plain':!![]});var _0x4d181b='MusicOnHolds';return db[_0x48f1('0x29')][_0x48f1('0x2a')]({'where':{'type':_0x4d181b,'resourceId':_0x27ec2e['id']}})[_0x48f1('0x27')](function(){return _0x2428fb;});})[_0x48f1('0x27')](function(){_0x53564b[_0x48f1('0x1b')](0xcc)[_0x48f1('0x2b')]();});}};}function handleEntityNotFound(_0x2976b0,_0x36a684){return function(_0x1bb294){if(!_0x1bb294){_0x2976b0['sendStatus'](0x194);}return _0x1bb294;};}function handleError(_0x10728e,_0x596c37){_0x596c37=_0x596c37||0x1f4;return function(_0x1522b3){logger['error'](_0x1522b3[_0x48f1('0x2c')]);if(_0x1522b3[_0x48f1('0x2d')]){delete _0x1522b3['name'];}_0x10728e['status'](_0x596c37)[_0x48f1('0x2e')](_0x1522b3);};}exports[_0x48f1('0x2f')]=function(_0x48b170,_0x34910f){var _0x17d0d3={},_0x28c104={},_0x467264={'count':0x0,'rows':[]};var _0x58dd7e=_[_0x48f1('0x30')](db[_0x48f1('0x31')][_0x48f1('0x32')],function(_0x31235f){return{'name':_0x31235f[_0x48f1('0x33')],'type':_0x31235f[_0x48f1('0x34')][_0x48f1('0x35')]};});_0x28c104['model']=_['map'](_0x58dd7e,'name');_0x28c104[_0x48f1('0x36')]=_[_0x48f1('0x37')](_0x48b170['query']);_0x28c104[_0x48f1('0x38')]=_[_0x48f1('0x39')](_0x28c104[_0x48f1('0x3a')],_0x28c104[_0x48f1('0x36')]);_0x17d0d3[_0x48f1('0x3b')]=_[_0x48f1('0x39')](_0x28c104[_0x48f1('0x3a')],qs['fields'](_0x48b170[_0x48f1('0x36')][_0x48f1('0x3c')]));_0x17d0d3[_0x48f1('0x3b')]=_0x17d0d3[_0x48f1('0x3b')][_0x48f1('0x3d')]?_0x17d0d3[_0x48f1('0x3b')]:_0x28c104[_0x48f1('0x3a')];if(!_0x48b170[_0x48f1('0x36')][_0x48f1('0x3e')](_0x48f1('0x3f'))){_0x17d0d3[_0x48f1('0x1f')]=qs['limit'](_0x48b170[_0x48f1('0x36')][_0x48f1('0x1f')]);_0x17d0d3[_0x48f1('0x1c')]=qs['offset'](_0x48b170['query'][_0x48f1('0x1c')]);}_0x17d0d3[_0x48f1('0x40')]=qs[_0x48f1('0x41')](_0x48b170[_0x48f1('0x36')][_0x48f1('0x41')]);delete _0x48b170[_0x48f1('0x36')][_0x48f1('0x41')];_0x17d0d3['where']=qs['filters'](_[_0x48f1('0x42')](_0x48b170[_0x48f1('0x36')],_0x28c104[_0x48f1('0x38')]),_0x58dd7e);if(_0x48b170['query']['filter']){_0x17d0d3[_0x48f1('0x43')]=_[_0x48f1('0x44')](_0x17d0d3[_0x48f1('0x43')],{'$or':_[_0x48f1('0x30')](_0x58dd7e,function(_0xeb14ab){if(_0xeb14ab[_0x48f1('0x34')]!==_0x48f1('0x45')){var _0x469061={};_0x469061[_0xeb14ab['name']]={'$like':'%'+_0x48b170['query'][_0x48f1('0x46')]+'%'};return _0x469061;}})});}_0x17d0d3=_['merge']({},_0x17d0d3,_0x48b170['options']);var _0x1e535e={'where':_0x17d0d3[_0x48f1('0x43')]};return db['VoiceMusicOnHold'][_0x48f1('0x1e')](_0x1e535e)[_0x48f1('0x27')](function(_0x12ad1c){_0x467264[_0x48f1('0x1e')]=_0x12ad1c;if(_0x48b170[_0x48f1('0x36')][_0x48f1('0x47')]){_0x17d0d3['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x48f1('0x48')](_0x17d0d3);})[_0x48f1('0x27')](function(_0x5ad453){_0x467264['rows']=_0x5ad453;return _0x467264;})[_0x48f1('0x27')](respondWithFilteredResult(_0x34910f,_0x17d0d3))['catch'](handleError(_0x34910f,null));};exports[_0x48f1('0x49')]=function(_0x454fb9,_0x5b25d7){var _0x59a757={'raw':![],'where':{'id':_0x454fb9['params']['id']}},_0x416249={};_0x416249[_0x48f1('0x3a')]=_[_0x48f1('0x37')](db[_0x48f1('0x31')][_0x48f1('0x32')]);_0x416249[_0x48f1('0x36')]=_['keys'](_0x454fb9[_0x48f1('0x36')]);_0x416249[_0x48f1('0x38')]=_['intersection'](_0x416249[_0x48f1('0x3a')],_0x416249[_0x48f1('0x36')]);_0x59a757[_0x48f1('0x3b')]=_[_0x48f1('0x39')](_0x416249[_0x48f1('0x3a')],qs['fields'](_0x454fb9[_0x48f1('0x36')]['fields']));_0x59a757[_0x48f1('0x3b')]=_0x59a757[_0x48f1('0x3b')][_0x48f1('0x3d')]?_0x59a757[_0x48f1('0x3b')]:_0x416249[_0x48f1('0x3a')];if(_0x454fb9[_0x48f1('0x36')][_0x48f1('0x47')]){_0x59a757[_0x48f1('0x4a')]=[{'all':!![]}];}_0x59a757=_['merge']({},_0x59a757,_0x454fb9['options']);return db['VoiceMusicOnHold']['find'](_0x59a757)[_0x48f1('0x27')](handleEntityNotFound(_0x5b25d7,null))[_0x48f1('0x27')](respondWithResult(_0x5b25d7,null))[_0x48f1('0x4b')](handleError(_0x5b25d7,null));};exports[_0x48f1('0x26')]=function(_0x41fb1d,_0x1f25ff){if(_0x41fb1d[_0x48f1('0x4c')]['id']){delete _0x41fb1d['body']['id'];}return db[_0x48f1('0x31')][_0x48f1('0x4d')]({'where':{'id':_0x41fb1d[_0x48f1('0x4e')]['id']}})[_0x48f1('0x27')](handleEntityNotFound(_0x1f25ff,null))[_0x48f1('0x27')](saveUpdates(_0x41fb1d['body'],null))[_0x48f1('0x27')](respondWithResult(_0x1f25ff,null))[_0x48f1('0x4b')](handleError(_0x1f25ff,null));};exports[_0x48f1('0x4f')]=function(_0x79dc4f,_0x1f9c90,_0x22ed8f){return db['sequelize'][_0x48f1('0x50')](function(_0x24d1af){if(_0x79dc4f[_0x48f1('0x4c')][_0x48f1('0x51')]===_0x48f1('0x52')){_0x79dc4f[_0x48f1('0x4c')][_0x48f1('0x53')]=path['join'](config[_0x48f1('0x54')],_0x48f1('0x55'),_0x79dc4f[_0x48f1('0x4c')][_0x48f1('0x2d')]);}return db[_0x48f1('0x31')][_0x48f1('0x4f')](_0x79dc4f[_0x48f1('0x4c')],{'transaction':_0x24d1af})[_0x48f1('0x27')](function(_0x59b14c){if(_0x79dc4f[_0x48f1('0x4c')][_0x48f1('0x51')]===_0x48f1('0x52')){fs[_0x48f1('0x56')](_0x59b14c['directory'],parseInt('0777',0x8));}var _0x20ba4=_0x79dc4f[_0x48f1('0x57')][_0x48f1('0x28')]({'plain':!![]});if(!_0x20ba4)throw new Error(_0x48f1('0x58'));if(_0x20ba4['role']===_0x48f1('0x57')){var _0x5315fd=_0x59b14c[_0x48f1('0x28')]({'plain':!![]});return db[_0x48f1('0x59')][_0x48f1('0x4d')]({'where':{'name':_0x48f1('0x5a'),'userProfileId':_0x20ba4[_0x48f1('0x5b')]},'raw':!![]})['then'](function(_0x518b88){if(_0x518b88&&_0x518b88['autoAssociation']===0x0){return db[_0x48f1('0x29')][_0x48f1('0x4f')]({'name':_0x5315fd[_0x48f1('0x2d')],'resourceId':_0x5315fd['id'],'type':_0x518b88[_0x48f1('0x2d')],'sectionId':_0x518b88['id']},{})[_0x48f1('0x27')](function(){return _0x59b14c;});}else{return _0x59b14c;}})[_0x48f1('0x4b')](function(_0xb3a5d7){logger[_0x48f1('0x5c')](_0x48f1('0x5d'),_0xb3a5d7);});}return _0x59b14c;});})[_0x48f1('0x27')](respondWithResult(_0x1f9c90,0xc9))[_0x48f1('0x4b')](handleError(_0x1f9c90,null));};exports[_0x48f1('0x2a')]=function(_0x332a8d,_0x2ce081,_0x8592b9){var _0x74988e;return db[_0x48f1('0x31')][_0x48f1('0x4d')]({'where':{'id':_0x332a8d[_0x48f1('0x4e')]['id']}})[_0x48f1('0x27')](function(_0xb55656){if(_0xb55656){return db[_0x48f1('0x5e')][_0x48f1('0x50')](function(_0x523f8c){return _0xb55656[_0x48f1('0x2a')]({'transaction':_0x523f8c,'raw':!![]})['then'](function(_0x3afec8){if(_0x3afec8['directory']){fs[_0x48f1('0x5f')](_0x3afec8[_0x48f1('0x53')])['forEach'](function(_0x7b9e39){fs[_0x48f1('0x60')](path['join'](_0x3afec8[_0x48f1('0x53')],_0x7b9e39));});fs['rmdirSync'](_0x3afec8[_0x48f1('0x53')]);}return _0x3afec8;});})['catch'](function(_0x13cd3a){throw new db['Sequelize'][(_0x48f1('0x61'))](_0x13cd3a[_0x48f1('0x62')]);});}})[_0x48f1('0x27')](handleEntityNotFound(_0x2ce081,null))[_0x48f1('0x27')](removeEntity(_0x2ce081,null))[_0x48f1('0x4b')](handleError(_0x2ce081,null));};exports[_0x48f1('0x63')]=function(_0x11208e,_0x450745,_0x322998){return db['sequelize']['transaction'](function(_0x7a4496){var _0x4e2502;return db[_0x48f1('0x31')][_0x48f1('0x4d')]({'where':{'id':_0x11208e['params']['id']}})['then'](function(_0x3cebd1){if(_0x3cebd1){_0x4e2502=_0x3cebd1;return _0x3cebd1[_0x48f1('0x63')](_0x11208e[_0x48f1('0x4c')]['id'],{'transaction':_0x7a4496});}})['then'](function(_0x3006bb){if(_0x3006bb){return db[_0x48f1('0x64')][_0x48f1('0x65')]({'where':{'id':_0x11208e[_0x48f1('0x4c')]['id']},'attributes':['id',_0x48f1('0x2d'),'save_name',_0x48f1('0x66'),_0x48f1('0x67')],'raw':!![]});}})[_0x48f1('0x27')](function(_0x461451){if(_0x461451){var _0x933829=path['join'](config[_0x48f1('0x54')],_0x48f1('0x68'),util['format'](_0x48f1('0x69'),path[_0x48f1('0x6a')](_0x461451[_0x48f1('0x6b')],path[_0x48f1('0x6c')](_0x461451[_0x48f1('0x6b')])),_0x461451[_0x48f1('0x66')]));var _0x274256=path[_0x48f1('0x6d')](config[_0x48f1('0x54')],_0x48f1('0x55'),_0x4e2502[_0x48f1('0x2d')],util[_0x48f1('0x6e')](_0x48f1('0x69'),_0x461451[_0x48f1('0x2d')],_0x461451['converted_format']));fs['symlinkSync'](_0x933829,_0x274256);return _0x461451;}})[_0x48f1('0x4b')](function(_0x1034c2){throw new db[(_0x48f1('0x6f'))][(_0x48f1('0x61'))](_0x1034c2[_0x48f1('0x62')]);});})[_0x48f1('0x27')](handleEntityNotFound(_0x450745,null))[_0x48f1('0x27')](respondWithResult(_0x450745,0xc9))[_0x48f1('0x4b')](handleError(_0x450745,null));};exports['removeSound']=function(_0x5417eb,_0x5c74c9,_0x285a70){return db[_0x48f1('0x5e')][_0x48f1('0x50')](function(_0x2d4816){var _0x3dfee9;return db[_0x48f1('0x31')][_0x48f1('0x65')]({'where':{'id':_0x5417eb['params']['id']}})[_0x48f1('0x27')](handleEntityNotFound(_0x5c74c9,null))[_0x48f1('0x27')](function(_0x18f4c4){if(_0x18f4c4){_0x3dfee9=_0x18f4c4;return _0x18f4c4[_0x48f1('0x70')](_0x5417eb[_0x48f1('0x4e')][_0x48f1('0x71')]);}})[_0x48f1('0x27')](function(_0x277d18){if(_0x277d18){return db[_0x48f1('0x64')][_0x48f1('0x65')]({'where':{'id':_0x5417eb[_0x48f1('0x4e')][_0x48f1('0x71')]},'attributes':['id',_0x48f1('0x2d'),_0x48f1('0x6b'),_0x48f1('0x66'),'createdAt'],'raw':!![]});}})[_0x48f1('0x27')](function(_0xfdee37){if(_0xfdee37){fs['unlinkSync'](path[_0x48f1('0x6d')](_0x3dfee9['directory'],util[_0x48f1('0x6e')](_0x48f1('0x69'),_0xfdee37[_0x48f1('0x2d')],_0xfdee37[_0x48f1('0x66')])));return _0xfdee37;}})['catch'](function(_0x50caa2){throw new db[(_0x48f1('0x6f'))][(_0x48f1('0x61'))](_0x50caa2[_0x48f1('0x62')]);});})[_0x48f1('0x27')](handleEntityNotFound(_0x5c74c9,null))['then'](respondWithStatusCode(_0x5c74c9,0xcc))['catch'](handleError(_0x5c74c9,null));};exports['getSounds']=function(_0x35a5d0,_0x212ec1,_0x8479a6){var _0x124427={};var _0x3ccb99={};var _0x46de54;var _0x335069;return db['VoiceMusicOnHold'][_0x48f1('0x65')]({'where':{'id':_0x35a5d0[_0x48f1('0x4e')]['id']}})[_0x48f1('0x27')](handleEntityNotFound(_0x212ec1,null))['then'](function(_0xe87811){if(_0xe87811){_0x46de54=_0xe87811;_0x3ccb99[_0x48f1('0x3a')]=_[_0x48f1('0x37')](db[_0x48f1('0x64')]['rawAttributes']);_0x3ccb99[_0x48f1('0x36')]=_['keys'](_0x35a5d0[_0x48f1('0x36')]);_0x3ccb99[_0x48f1('0x38')]=_[_0x48f1('0x39')](_0x3ccb99[_0x48f1('0x3a')],_0x3ccb99['query']);_0x124427[_0x48f1('0x3b')]=_[_0x48f1('0x39')](_0x3ccb99[_0x48f1('0x3a')],qs[_0x48f1('0x3c')](_0x35a5d0[_0x48f1('0x36')]['fields']));_0x124427[_0x48f1('0x3b')]=_0x124427[_0x48f1('0x3b')][_0x48f1('0x3d')]?_0x124427['attributes']:_0x3ccb99[_0x48f1('0x3a')];_0x124427['order']=qs[_0x48f1('0x41')](_0x35a5d0[_0x48f1('0x36')]['sort']);_0x124427[_0x48f1('0x43')]=qs['filters'](_[_0x48f1('0x42')](_0x35a5d0[_0x48f1('0x36')],_0x3ccb99[_0x48f1('0x38')]));if(_0x35a5d0[_0x48f1('0x36')][_0x48f1('0x46')]){_0x124427[_0x48f1('0x43')]=_[_0x48f1('0x44')](_0x124427[_0x48f1('0x43')],{'$or':_[_0x48f1('0x30')](_0x124427[_0x48f1('0x3b')],function(_0xdc5615){var _0x187440={};_0x187440[_0xdc5615]={'$like':'%'+_0x35a5d0[_0x48f1('0x36')][_0x48f1('0x46')]+'%'};return _0x187440;})});}_0x124427=_[_0x48f1('0x44')]({},_0x124427,_0x35a5d0[_0x48f1('0x72')]);return _0x46de54[_0x48f1('0x73')](_0x124427);}})[_0x48f1('0x27')](function(_0x401d73){if(_0x401d73){_0x335069=_0x401d73[_0x48f1('0x3d')];if(!_0x35a5d0[_0x48f1('0x36')]['hasOwnProperty'](_0x48f1('0x3f'))){_0x124427[_0x48f1('0x1f')]=qs[_0x48f1('0x1f')](_0x35a5d0[_0x48f1('0x36')]['limit']);_0x124427[_0x48f1('0x1c')]=qs[_0x48f1('0x1c')](_0x35a5d0[_0x48f1('0x36')]['offset']);}return _0x46de54['getSounds'](_0x124427);}})[_0x48f1('0x27')](function(_0x17081b){if(_0x17081b){return _0x17081b?{'count':_0x335069,'rows':_0x17081b}:null;}})[_0x48f1('0x27')](respondWithResult(_0x212ec1,null))[_0x48f1('0x4b')](handleError(_0x212ec1,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0a1744b..b59a7f9 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 _0xca69=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash'];(function(_0x48fef5,_0x351c45){var _0x1ec6d8=function(_0x4e652b){while(--_0x4e652b){_0x48fef5['push'](_0x48fef5['shift']());}};_0x1ec6d8(++_0x351c45);}(_0xca69,0x153));var _0x9ca6=function(_0x28d530,_0x613ea8){_0x28d530=_0x28d530-0x0;var _0x172817=_0xca69[_0x28d530];return _0x172817;};'use strict';var _=require(_0x9ca6('0x0'));var util=require('util');var logger=require(_0x9ca6('0x1'))(_0x9ca6('0x2'));var moment=require('moment');var BPromise=require(_0x9ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ca6('0x4'));var rimraf=require(_0x9ca6('0x5'));var config=require(_0x9ca6('0x6'));var attributes=require(_0x9ca6('0x7'));module['exports']=function(_0x38f8c5,_0x52195d){return _0x38f8c5[_0x9ca6('0x8')](_0x9ca6('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 5d48d63..abb44a6 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x46940b,_0x1090c5){var _0x2b8567=function(_0x3345d9){while(--_0x3345d9){_0x46940b['push'](_0x46940b['shift']());}};_0x2b8567(++_0x1090c5);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 51f4459..3b41c47 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 _0xc978=['/:id/teams','getTeams','post','addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents'];(function(_0x32f3c0,_0x322f6d){var _0x142e04=function(_0x1b6669){while(--_0x1b6669){_0x32f3c0['push'](_0x32f3c0['shift']());}};_0x142e04(++_0x322f6d);}(_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'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router['get'](_0x8c97('0x11'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x12')]);router[_0x8c97('0xa')](_0x8c97('0x13'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x14')]);router[_0x8c97('0x15')]('/',auth[_0x8c97('0xb')](),controller['create']);router[_0x8c97('0x15')](_0x8c97('0x11'),auth['isAuthenticated'](),controller[_0x8c97('0x16')]);router[_0x8c97('0x15')]('/:id/teams',auth[_0x8c97('0xb')](),controller['addTeams']);router['put']('/:id',auth[_0x8c97('0xb')](),controller[_0x8c97('0x17')]);router[_0x8c97('0x18')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x19')]);router[_0x8c97('0x18')](_0x8c97('0x11'),auth[_0x8c97('0xb')](),controller['removeAgents']);router[_0x8c97('0x18')](_0x8c97('0x13'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x1a')]);module[_0x8c97('0x1b')]=router; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 7bd68dc..90f5997 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 _0x387a=['STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x37d76c,_0x3a9612){var _0x33fe9a=function(_0x137153){while(--_0x137153){_0x37d76c['push'](_0x37d76c['shift']());}};_0x33fe9a(++_0x3a9612);}(_0x387a,0xe9));var _0xa387=function(_0x592fdc,_0x28a68d){_0x592fdc=_0x592fdc-0x0;var _0x72470a=_0x387a[_0x592fdc];return _0x72470a;};'use strict';var Sequelize=require(_0xa387('0x0'));module['exports']={'name':{'type':Sequelize[_0xa387('0x1')],'allowNull':![],'unique':_0xa387('0x2')},'prefix':{'type':Sequelize[_0xa387('0x3')],'get':function(_0x169581){return _0xa387('0x4')+this['getDataValue'](_0xa387('0x2'))+'-';}},'description':{'type':Sequelize[_0xa387('0x1')]},'callerIdAll':{'type':Sequelize[_0xa387('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xa387('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index b6371af..5d6e1f6 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 _0x4cf8=['forEach','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','map','VoicePrefix','fieldName','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','show','rawAttributes','find','params','describe','create','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','prefix','system-','sequelize','findById','addAgents','body','ids','spread','emit','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','findAll','Agents','voicePause','interface','flatMap','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x246f92,_0xcf7bd4){_0x246f92=_0x246f92-0x0;var _0x2b8e7d=_0x4cf8[_0x246f92];return _0x2b8e7d;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];config[_0x84cf('0x18')]=_[_0x84cf('0x19')](config[_0x84cf('0x18')],{'host':_0x84cf('0x1a'),'port':0x18eb});var socket=require(_0x84cf('0x1b'))(new Redis(config[_0x84cf('0x18')]));require(_0x84cf('0x1c'))[_0x84cf('0x1d')](socket);function respondWithStatusCode(_0x2fc41f,_0x385027){_0x385027=_0x385027||0xcc;return function(_0x7db8f){if(_0x7db8f){return _0x2fc41f[_0x84cf('0x1e')](_0x385027);}return _0x2fc41f[_0x84cf('0x1f')](_0x385027)[_0x84cf('0x20')]();};}function respondWithResult(_0x464e70,_0x240edf){_0x240edf=_0x240edf||0xc8;return function(_0xe12c7b){if(_0xe12c7b){return _0x464e70['status'](_0x240edf)[_0x84cf('0x21')](_0xe12c7b);}};}function respondWithFilteredResult(_0x5d6a93,_0xfa6641){return function(_0x1abe2d){if(_0x1abe2d){var _0x1dad1a=typeof _0xfa6641[_0x84cf('0x22')]===_0x84cf('0x23')&&typeof _0xfa6641['limit']==='undefined';var _0x42d6d4=_0x1abe2d[_0x84cf('0x24')];var _0x346b43=_0x1dad1a?0x0:_0xfa6641[_0x84cf('0x22')];var _0x219afa=_0x1dad1a?_0x1abe2d['count']:_0xfa6641[_0x84cf('0x22')]+_0xfa6641[_0x84cf('0x25')];var _0x3ca1be;if(_0x219afa>=_0x42d6d4){_0x219afa=_0x42d6d4;_0x3ca1be=0xc8;}else{_0x3ca1be=0xce;}_0x5d6a93[_0x84cf('0x1f')](_0x3ca1be);return _0x5d6a93[_0x84cf('0x26')]('Content-Range',_0x346b43+'-'+_0x219afa+'/'+_0x42d6d4)[_0x84cf('0x21')](_0x1abe2d);}return null;};}function patchUpdates(_0x160f86){return function(_0x475b19){try{jsonpatch[_0x84cf('0x27')](_0x475b19,_0x160f86,!![]);}catch(_0x3e5e94){return BPromise[_0x84cf('0x28')](_0x3e5e94);}return _0x475b19[_0x84cf('0x29')]();};}function saveUpdates(_0x4c9d1c,_0x2b2c90){return function(_0x26db3f){if(_0x26db3f){return _0x26db3f[_0x84cf('0x2a')](_0x4c9d1c)[_0x84cf('0x2b')](function(_0x1d220a){return _0x1d220a;});}return null;};}function removeEntity(_0x44d4bf,_0x3c7eda){return function(_0xa44c81){if(_0xa44c81){return _0xa44c81[_0x84cf('0x2c')]()[_0x84cf('0x2b')](function(){var _0x5179c1=_0xa44c81[_0x84cf('0x2d')]({'plain':!![]});var _0x17bc92=_0x84cf('0x2e');return db[_0x84cf('0x2f')]['destroy']({'where':{'type':_0x17bc92,'resourceId':_0x5179c1['id']}})[_0x84cf('0x2b')](function(){return _0xa44c81;});})['then'](function(){_0x44d4bf[_0x84cf('0x1f')](0xcc)[_0x84cf('0x20')]();});}};}function handleEntityNotFound(_0x43b41b,_0xc15298){return function(_0x51adcf){if(!_0x51adcf){_0x43b41b[_0x84cf('0x1e')](0x194);}return _0x51adcf;};}function handleError(_0x2e4653,_0x309398){_0x309398=_0x309398||0x1f4;return function(_0x1bfa56){logger[_0x84cf('0x30')](_0x1bfa56[_0x84cf('0x31')]);if(_0x1bfa56[_0x84cf('0x32')]){delete _0x1bfa56[_0x84cf('0x32')];}_0x2e4653[_0x84cf('0x1f')](_0x309398)['send'](_0x1bfa56);};}exports['index']=function(_0x2795ef,_0x25de3a){var _0x16ebaa={},_0x1e889e={},_0x38eeea={'count':0x0,'rows':[]};var _0x1453cf=_[_0x84cf('0x33')](db[_0x84cf('0x34')]['rawAttributes'],function(_0x113b3e){return{'name':_0x113b3e[_0x84cf('0x35')],'type':_0x113b3e['type'][_0x84cf('0x36')]};});_0x1e889e['model']=_[_0x84cf('0x33')](_0x1453cf,_0x84cf('0x32'));_0x1e889e[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2795ef[_0x84cf('0x37')]);_0x1e889e['filters']=_[_0x84cf('0x39')](_0x1e889e['model'],_0x1e889e['query']);_0x16ebaa[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x1e889e['model'],qs[_0x84cf('0x3b')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x16ebaa[_0x84cf('0x3a')]=_0x16ebaa[_0x84cf('0x3a')][_0x84cf('0x3c')]?_0x16ebaa['attributes']:_0x1e889e[_0x84cf('0x3d')];if(!_0x2795ef[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x16ebaa[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2795ef['query'][_0x84cf('0x25')]);_0x16ebaa['offset']=qs[_0x84cf('0x22')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x22')]);}_0x16ebaa[_0x84cf('0x40')]=qs[_0x84cf('0x41')](_0x2795ef[_0x84cf('0x37')][_0x84cf('0x41')]);_0x16ebaa[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_['pick'](_0x2795ef[_0x84cf('0x37')],_0x1e889e['filters']),_0x1453cf);if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x44')]){_0x16ebaa['where']=_[_0x84cf('0x45')](_0x16ebaa['where'],{'$or':_[_0x84cf('0x33')](_0x1453cf,function(_0x504d32){if(_0x504d32[_0x84cf('0x46')]!=='VIRTUAL'){var _0x2db7dd={};_0x2db7dd[_0x504d32[_0x84cf('0x32')]]={'$like':'%'+_0x2795ef['query'][_0x84cf('0x44')]+'%'};return _0x2db7dd;}})});}_0x16ebaa=_[_0x84cf('0x45')]({},_0x16ebaa,_0x2795ef[_0x84cf('0x47')]);var _0x5ef5fb={'where':_0x16ebaa[_0x84cf('0x42')]};return db['VoicePrefix'][_0x84cf('0x24')](_0x5ef5fb)['then'](function(_0x56b0e5){_0x38eeea['count']=_0x56b0e5;if(_0x2795ef[_0x84cf('0x37')][_0x84cf('0x48')]){_0x16ebaa['include']=[{'all':!![]}];}return db[_0x84cf('0x34')]['findAll'](_0x16ebaa);})[_0x84cf('0x2b')](function(_0x3fe8c1){_0x38eeea['rows']=_0x3fe8c1;return _0x38eeea;})[_0x84cf('0x2b')](respondWithFilteredResult(_0x25de3a,_0x16ebaa))['catch'](handleError(_0x25de3a,null));};exports[_0x84cf('0x49')]=function(_0x593b35,_0x4feb7e){var _0x5d8b69={'raw':![],'where':{'id':_0x593b35['params']['id']}},_0x5498ec={};_0x5498ec['model']=_['keys'](db[_0x84cf('0x34')][_0x84cf('0x4a')]);_0x5498ec[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x593b35['query']);_0x5498ec[_0x84cf('0x43')]=_['intersection'](_0x5498ec[_0x84cf('0x3d')],_0x5498ec[_0x84cf('0x37')]);_0x5d8b69[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x5498ec[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x593b35['query'][_0x84cf('0x3b')]));_0x5d8b69[_0x84cf('0x3a')]=_0x5d8b69['attributes'][_0x84cf('0x3c')]?_0x5d8b69[_0x84cf('0x3a')]:_0x5498ec[_0x84cf('0x3d')];if(_0x593b35['query']['includeAll']){_0x5d8b69['include']=[{'all':!![]}];}_0x5d8b69=_[_0x84cf('0x45')]({},_0x5d8b69,_0x593b35[_0x84cf('0x47')]);return db[_0x84cf('0x34')][_0x84cf('0x4b')](_0x5d8b69)[_0x84cf('0x2b')](handleEntityNotFound(_0x4feb7e,null))[_0x84cf('0x2b')](respondWithResult(_0x4feb7e,null))['catch'](handleError(_0x4feb7e,null));};exports[_0x84cf('0x2c')]=function(_0x55316e,_0x44b8b0){return db['VoicePrefix']['find']({'where':{'id':_0x55316e[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x44b8b0,null))[_0x84cf('0x2b')](removeEntity(_0x44b8b0,null))['catch'](handleError(_0x44b8b0,null));};exports['describe']=function(_0x290a4d,_0x1ce99c){return db[_0x84cf('0x34')][_0x84cf('0x4d')]()[_0x84cf('0x2b')](respondWithResult(_0x1ce99c,null))['catch'](handleError(_0x1ce99c,null));};exports[_0x84cf('0x4e')]=function(_0x225fc2,_0x5e4af1){var _0x33145e;return db['sequelize']['transaction'](function(_0x147194){return db[_0x84cf('0x34')]['create'](_0x225fc2['body'],{'transaction':_0x147194})[_0x84cf('0x2b')](function(_0x9f2467){_0x33145e=_0x9f2467[_0x84cf('0x2d')]({'plain':!![]});return db[_0x84cf('0x4f')][_0x84cf('0x4b')]({'where':{'id':_0x33145e[_0x84cf('0x50')]},'raw':!![]})[_0x84cf('0x2b')](function(_0x20ae02){return createVoicePrefixExtensions(_0x33145e,_0x20ae02,_0x147194);});});})['then'](function(){var _0x1bc15c=_0x225fc2[_0x84cf('0x51')]['get']({'plain':!![]});if(!_0x1bc15c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bc15c[_0x84cf('0x52')]===_0x84cf('0x51')){var _0x3912cb=_0x33145e;return db[_0x84cf('0x53')][_0x84cf('0x4b')]({'where':{'name':_0x84cf('0x2e'),'userProfileId':_0x1bc15c[_0x84cf('0x54')]},'raw':!![]})['then'](function(_0x652356){if(_0x652356&&_0x652356['autoAssociation']===0x0){return db[_0x84cf('0x2f')]['create']({'name':_0x3912cb[_0x84cf('0x32')],'resourceId':_0x3912cb['id'],'type':_0x652356[_0x84cf('0x32')],'sectionId':_0x652356['id']},{})['then'](function(){return _0x33145e;});}else{return _0x33145e;}})[_0x84cf('0x55')](function(_0x448260){logger['error'](_0x84cf('0x56'),_0x448260);throw _0x448260;});}return _0x33145e;})['then'](respondWithResult(_0x5e4af1,null))['catch'](handleError(_0x5e4af1,null));};function Extension(_0x5cc371,_0x50cde2,_0x2007a6,_0x39394f){this[_0x84cf('0x57')]=_0x84cf('0x58');this['exten']=_0x5cc371;this[_0x84cf('0x59')]=_0x2007a6;this[_0x84cf('0x46')]='system';this[_0x84cf('0x5a')]=_0x84cf('0x5b');this[_0x84cf('0x5c')]=_0x50cde2;this[_0x84cf('0x5d')]=_0x39394f;}function createVoicePrefixExtensions(_0x2073f1,_0x273711,_0x1f1f76){return new BPromise(function(_0x39a336,_0x553ee2){var _0x155934=new Extension(formatPrefixName(_0x2073f1['prefix']),0x1,_0x84cf('0x5e'),_0x84cf('0x5f'));_0x155934[_0x84cf('0x60')]=_0x2073f1['id'];return db[_0x84cf('0x4f')][_0x84cf('0x4e')](_0x155934,{'transaction':_0x1f1f76})['then'](function(_0xfea0d2){var _0x41ee7a=_0xfea0d2[_0x84cf('0x2d')]({'plain':!![]});var _0x4ebb4b=_[_0x84cf('0x33')](addVoicePrefixExtensions(_0x2073f1,_0x273711),function(_0x240cca){_0x240cca['VoiceExtensionId']=_0x41ee7a['id'];_0x240cca[_0x84cf('0x60')]=_0x2073f1['id'];return _0x240cca;});return db['VoiceExtension'][_0x84cf('0x61')](_0x4ebb4b,{'transaction':_0x1f1f76})[_0x84cf('0x2b')](function(_0x57f1f2){if(!_0x57f1f2){return _0x553ee2(_0x84cf('0x62'));}else{return _0x39a336(_0x57f1f2);}})[_0x84cf('0x55')](function(_0x4a7905){return _0x553ee2(_0x4a7905);});});;});};function addVoicePrefixExtensions(_0x40b33e,_0x2ff1bb){var _0x262ae1=[];var _0x286769=formatPrefixName(_0x40b33e['prefix']);_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x2,_0x84cf('0x64'),'CDR(prefix)='+_0x40b33e['name']));if(_0x40b33e['callerIdAll']){_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x3,_0x84cf('0x64'),_0x84cf('0x65')+_0x40b33e['callerIdAll']));}else{_0x262ae1['push'](new Extension(_0x286769,0x3,_0x84cf('0x5e'),_0x84cf('0x66')));}_0x262ae1[_0x84cf('0x63')](new Extension(_0x286769,0x4,_0x84cf('0x67'),_0x2ff1bb[_0x84cf('0x57')]+','+_0x84cf('0x68')+(0x8+_0x40b33e[_0x84cf('0x32')][_0x84cf('0x3c')])+'}'+','+0x1));return _0x262ae1;}function formatPrefixName(_0x4a5e79){var _0x20b930='_';for(var _0x5350d9=0x0;_0x5350d9<_0x4a5e79[_0x84cf('0x3c')];_0x5350d9++){if(_0x4a5e79[_0x84cf('0x69')](_0x5350d9)=='-'){_0x20b930+=_0x4a5e79['charAt'](_0x5350d9);}else{_0x20b930+='['+_0x4a5e79['charAt'](_0x5350d9)+']';}}_0x20b930+='.';return _0x20b930;}exports[_0x84cf('0x2a')]=function(_0x31e622,_0x373a25,_0x1c6e56){var _0xad54e8=_0x31e622['body'];_0xad54e8[_0x84cf('0x6a')]=_0x84cf('0x6b')+_0xad54e8[_0x84cf('0x32')]+'-';return db[_0x84cf('0x6c')]['transaction'](function(_0x93d687){return db['VoicePrefix']['update'](_0xad54e8,{'where':{'id':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x4f')][_0x84cf('0x2c')]({'where':{'VoicePrefixId':_0xad54e8['id']},'transaction':_0x93d687})[_0x84cf('0x2b')](function(){return db['VoiceExtension']['find']({'where':{'id':_0xad54e8['VoiceExtensionId']},'raw':!![]})[_0x84cf('0x2b')](function(_0x53e61f){return createVoicePrefixExtensions(_0xad54e8,_0x53e61f,_0x93d687);});});});})[_0x84cf('0x2b')](function(){return db[_0x84cf('0x34')][_0x84cf('0x6d')](_0xad54e8['id']);})[_0x84cf('0x2b')](respondWithResult(_0x373a25,null))['catch'](handleError(_0x373a25,null));};exports[_0x84cf('0x6e')]=function(_0x14ac69,_0x4e1141,_0xa373e4){return db['VoicePrefix']['find']({'where':{'id':_0x14ac69[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x4e1141,null))['then'](function(_0x5b95b7){if(_0x5b95b7){return _0x5b95b7[_0x84cf('0x6e')](_0x14ac69['body']['ids'],_['omit'](_0x14ac69[_0x84cf('0x6f')],[_0x84cf('0x70'),'id'])||{})[_0x84cf('0x71')](function(_0x58300f){for(var _0x49e6f6=0x0;_0x49e6f6<_0x14ac69[_0x84cf('0x6f')][_0x84cf('0x70')][_0x84cf('0x3c')];_0x49e6f6+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x14ac69['body']['ids'][_0x49e6f6]),'VoicePrefixId':Number(_0x14ac69[_0x84cf('0x4c')]['id'])});}return _0x58300f;});}})[_0x84cf('0x2b')](respondWithResult(_0x4e1141,null))[_0x84cf('0x55')](handleError(_0x4e1141,null));};exports['removeAgents']=function(_0x20693f,_0x29d062,_0x242e39){return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x20693f['params']['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x29d062,null))[_0x84cf('0x2b')](function(_0xc32a6f){if(_0xc32a6f){return _0xc32a6f['removeAgents'](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])['then'](function(){if(_[_0x84cf('0x73')](_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')])){for(var _0x132210=0x0;_0x132210<_0x20693f['query']['ids'][_0x84cf('0x3c')];_0x132210+=0x1){socket[_0x84cf('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x20693f['query'][_0x84cf('0x70')][_0x132210]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}}else{socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':Number(_0x20693f[_0x84cf('0x37')][_0x84cf('0x70')]),'VoicePrefixId':Number(_0x20693f[_0x84cf('0x4c')]['id'])});}});}})[_0x84cf('0x2b')](respondWithStatusCode(_0x29d062,null))['catch'](handleError(_0x29d062,null));};exports[_0x84cf('0x75')]=function(_0x2323bc,_0x1f7ecd,_0xcb28b4){var _0x4fd3f1={};var _0x3bf924={};var _0x56ea7d;var _0x3ec503;return db['VoicePrefix'][_0x84cf('0x76')]({'where':{'id':_0x2323bc[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0x1f7ecd,null))[_0x84cf('0x2b')](function(_0xc4029f){if(_0xc4029f){_0x56ea7d=_0xc4029f;_0x3bf924['model']=_[_0x84cf('0x38')](db[_0x84cf('0x77')][_0x84cf('0x4a')]);_0x3bf924[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x2323bc[_0x84cf('0x37')]);_0x3bf924[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],_0x3bf924[_0x84cf('0x37')]);_0x4fd3f1[_0x84cf('0x3a')]=_[_0x84cf('0x39')](_0x3bf924[_0x84cf('0x3d')],qs[_0x84cf('0x3b')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x4fd3f1[_0x84cf('0x3a')]=_0x4fd3f1[_0x84cf('0x3a')]['length']?_0x4fd3f1['attributes']:_0x3bf924[_0x84cf('0x3d')];_0x4fd3f1['order']=qs[_0x84cf('0x41')](_0x2323bc[_0x84cf('0x37')]['sort']);_0x4fd3f1[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x2323bc['query'],_0x3bf924[_0x84cf('0x43')]));if(_0x2323bc['query'][_0x84cf('0x44')]){_0x4fd3f1['where']=_[_0x84cf('0x45')](_0x4fd3f1[_0x84cf('0x42')],{'$or':_['map'](_0x4fd3f1[_0x84cf('0x3a')],function(_0x10e44b){var _0xe11402={};_0xe11402[_0x10e44b]={'$like':'%'+_0x2323bc['query'][_0x84cf('0x44')]+'%'};return _0xe11402;})});}_0x4fd3f1=_['merge']({},_0x4fd3f1,_0x2323bc[_0x84cf('0x47')]);return _0x56ea7d[_0x84cf('0x75')](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0xff46d2){if(_0xff46d2){_0x3ec503=_0xff46d2[_0x84cf('0x3c')];if(!_0x2323bc[_0x84cf('0x37')]['hasOwnProperty'](_0x84cf('0x3f'))){_0x4fd3f1[_0x84cf('0x25')]=qs[_0x84cf('0x25')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x25')]);_0x4fd3f1[_0x84cf('0x22')]=qs[_0x84cf('0x22')](_0x2323bc[_0x84cf('0x37')][_0x84cf('0x22')]);}return _0x56ea7d['getAgents'](_0x4fd3f1);}})[_0x84cf('0x2b')](function(_0x4dc17f){if(_0x4dc17f){return _0x4dc17f?{'count':_0x3ec503,'rows':_0x4dc17f}:null;}})['then'](respondWithResult(_0x1f7ecd,null))[_0x84cf('0x55')](handleError(_0x1f7ecd,null));};exports[_0x84cf('0x79')]=function(_0x55da82,_0xf14418,_0x1def45){var _0x13d30b={};var _0x4dad47={};var _0x3152c2;var _0x50e088;return db[_0x84cf('0x34')][_0x84cf('0x76')]({'where':{'id':_0x55da82[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](handleEntityNotFound(_0xf14418,null))[_0x84cf('0x2b')](function(_0x3b5f14){if(_0x3b5f14){_0x3152c2=_0x3b5f14;_0x4dad47['model']=_[_0x84cf('0x38')](db[_0x84cf('0x7a')][_0x84cf('0x4a')]);_0x4dad47[_0x84cf('0x37')]=_[_0x84cf('0x38')](_0x55da82[_0x84cf('0x37')]);_0x4dad47[_0x84cf('0x43')]=_[_0x84cf('0x39')](_0x4dad47[_0x84cf('0x3d')],_0x4dad47[_0x84cf('0x37')]);_0x13d30b['attributes']=_['intersection'](_0x4dad47[_0x84cf('0x3d')],qs['fields'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x3b')]));_0x13d30b[_0x84cf('0x3a')]=_0x13d30b['attributes'][_0x84cf('0x3c')]?_0x13d30b[_0x84cf('0x3a')]:_0x4dad47[_0x84cf('0x3d')];_0x13d30b[_0x84cf('0x40')]=qs['sort'](_0x55da82['query'][_0x84cf('0x41')]);_0x13d30b[_0x84cf('0x42')]=qs[_0x84cf('0x43')](_[_0x84cf('0x78')](_0x55da82[_0x84cf('0x37')],_0x4dad47[_0x84cf('0x43')]));if(_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]){_0x13d30b[_0x84cf('0x42')]=_[_0x84cf('0x45')](_0x13d30b['where'],{'$or':_[_0x84cf('0x33')](_0x13d30b[_0x84cf('0x3a')],function(_0x543607){var _0x4e9be5={};_0x4e9be5[_0x543607]={'$like':'%'+_0x55da82[_0x84cf('0x37')][_0x84cf('0x44')]+'%'};return _0x4e9be5;})});}_0x13d30b=_[_0x84cf('0x45')]({},_0x13d30b,_0x55da82[_0x84cf('0x47')]);return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x38e27d){if(_0x38e27d){_0x50e088=_0x38e27d[_0x84cf('0x3c')];if(!_0x55da82[_0x84cf('0x37')][_0x84cf('0x3e')](_0x84cf('0x3f'))){_0x13d30b[_0x84cf('0x25')]=qs['limit'](_0x55da82[_0x84cf('0x37')][_0x84cf('0x25')]);_0x13d30b['offset']=qs['offset'](_0x55da82[_0x84cf('0x37')]['offset']);}return _0x3152c2[_0x84cf('0x79')](_0x13d30b);}})['then'](function(_0x127ac0){if(_0x127ac0){return _0x127ac0?{'count':_0x50e088,'rows':_0x127ac0}:null;}})[_0x84cf('0x2b')](respondWithResult(_0xf14418,null))[_0x84cf('0x55')](handleError(_0xf14418,null));};exports['addTeams']=function(_0x2e145c,_0x15ed32,_0x265818){var _0x57c01b=_0x2e145c[_0x84cf('0x6f')][_0x84cf('0x70')];var _0x27492c;return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x57c01b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84cf('0x7c'),'attributes':['id',_0x84cf('0x32'),'online',_0x84cf('0x7d'),_0x84cf('0x7e')],'raw':!![]}]})[_0x84cf('0x2b')](function(_0x188afd){if(_0x188afd){_0x27492c=_0x188afd;var _0x2d75f8=_[_0x84cf('0x7f')](_0x188afd,function(_0x5b9da4){var _0x8e16b4=_0x5b9da4[_0x84cf('0x2d')]({'plain':!![]});return _0x8e16b4[_0x84cf('0x7c')];});return db[_0x84cf('0x34')][_0x84cf('0x4b')]({'where':{'id':_0x2e145c[_0x84cf('0x4c')]['id']}})[_0x84cf('0x2b')](function(_0x1a083d){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x5e41df){return _0x1a083d[_0x84cf('0x81')](_0x57c01b,{'transaction':_0x5e41df})[_0x84cf('0x2b')](function(){return BPromise[_0x84cf('0x82')](_0x27492c,function(_0x33fb10){return db[_0x84cf('0x83')][_0x84cf('0x84')]({'TeamId':_0x33fb10['id'],'VoicePrefixId':_0x2e145c['params']['id']},{'transaction':_0x5e41df});});})['then'](function(){return BPromise[_0x84cf('0x82')](_0x2d75f8,function(_0x166065){return db[_0x84cf('0x85')][_0x84cf('0x86')]({'where':{'UserId':_0x166065['id'],'VoicePrefixId':_0x2e145c[_0x84cf('0x4c')]['id']},'transaction':_0x5e41df});});})['then'](function(){_0x2d75f8[_0x84cf('0x87')](function(_0x4ce3ea){socket['emit']('userVoicePrefix:save',{'UserId':_0x4ce3ea['id'],'VoicePrefixId':_0x1a083d['id']});});});});});}})['then'](respondWithStatusCode(_0x15ed32,null))[_0x84cf('0x55')](handleError(_0x15ed32,null));};exports[_0x84cf('0x88')]=function(_0x5d6832,_0x502910,_0x311d7e){return db[_0x84cf('0x7a')][_0x84cf('0x7b')]({'where':{'id':_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')]},'attributes':['id'],'include':[{'model':db[_0x84cf('0x77')],'as':_0x84cf('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x84cf('0x2b')](handleEntityNotFound(_0x502910,null))[_0x84cf('0x2b')](function(_0x2d17a1){var _0x5d0481=_[_0x84cf('0x33')](_0x2d17a1,'id');var _0x38c81a=[];var _0x4cb254=[];var _0x2aa96a=squel['select']();_0x2aa96a[_0x84cf('0x89')](_0x84cf('0x8a'))[_0x84cf('0x8b')]('team_has_voice_prefixes','tq')[_0x84cf('0x8c')]('user_has_teams','ut',_0x84cf('0x8d'))[_0x84cf('0x42')]('VoicePrefixId\x20=\x20?',_0x5d6832[_0x84cf('0x4c')]['id']);for(var _0x5b6ced=0x0;_0x5b6ced<_0x2d17a1[_0x84cf('0x3c')];_0x5b6ced+=0x1){let _0x202101=_0x2d17a1[_0x5b6ced];for(var _0x4b06c6=0x0;_0x4b06c6<_0x202101[_0x84cf('0x7c')][_0x84cf('0x3c')];_0x4b06c6+=0x1){let _0x3c05ec=_0x202101[_0x84cf('0x7c')][_0x4b06c6];var _0x145498=_0x2aa96a[_0x84cf('0x8e')]();_0x145498[_0x84cf('0x42')](_0x84cf('0x8f'),_0x3c05ec['id']);_0x4cb254[_0x84cf('0x63')](db[_0x84cf('0x6c')][_0x84cf('0x37')](_0x145498[_0x84cf('0x90')](),{'type':db['sequelize'][_0x84cf('0x91')][_0x84cf('0x92')]})[_0x84cf('0x2b')](function(_0x30b3c9){if(_0x30b3c9[_0x84cf('0x3c')]===0x1){return _0x3c05ec['id'];}else{var _0x562de5=_['every'](_['map'](_0x30b3c9,_0x84cf('0x93')),function(_0x55f411){return _[_0x84cf('0x94')](_0x5d0481,_0x55f411);});if(_0x562de5){return _0x3c05ec['id'];}}}));}}return BPromise[_0x84cf('0x95')](_0x4cb254)[_0x84cf('0x2b')](function(_0x5d4ece){_0x38c81a=_(_0x38c81a)[_0x84cf('0x96')](_0x5d4ece)[_0x84cf('0x97')]()[_0x84cf('0x98')]();return db['VoicePrefix']['find']({'where':{'id':_0x5d6832['params']['id']}})[_0x84cf('0x2b')](function(_0x399112){return db[_0x84cf('0x6c')][_0x84cf('0x80')](function(_0x209b79){return _0x399112['removeTeams'](_0x5d6832[_0x84cf('0x37')][_0x84cf('0x70')],{'transaction':_0x209b79})[_0x84cf('0x2b')](function(){if(!_['isEmpty'](_0x38c81a)){return _0x399112[_0x84cf('0x99')](_0x38c81a,{'transaction':_0x209b79});}})['then'](function(){_0x38c81a[_0x84cf('0x87')](function(_0x194267){socket[_0x84cf('0x72')](_0x84cf('0x74'),{'UserId':_0x194267,'VoicePrefixId':_0x399112['id']});});});});});});})['then'](respondWithStatusCode(_0x502910,null))[_0x84cf('0x55')](handleError(_0x502910,null));}; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0b1f66c..1707032 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 _0x203a=['hook','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit'];(function(_0x2eb908,_0x35a984){var _0x19aa76=function(_0x2969b9){while(--_0x2969b9){_0x2eb908['push'](_0x2eb908['shift']());}};_0x19aa76(++_0x35a984);}(_0x203a,0xda));var _0xa203=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x203a[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xa203('0x0'))['db'][_0xa203('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xa203('0x2')](0x0);var events={'afterCreate':_0xa203('0x3'),'afterUpdate':_0xa203('0x4'),'afterDestroy':_0xa203('0x5')};function emitEvent(_0x4b6e3b){return function(_0x2d0c73,_0x1aff33,_0x11a0ff){VoicePrefixEvents[_0xa203('0x6')](_0x4b6e3b+':'+_0x2d0c73['id'],_0x2d0c73);VoicePrefixEvents[_0xa203('0x6')](_0x4b6e3b,_0x2d0c73);_0x11a0ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xa203('0x7')](e,emitEvent(event));}}module[_0xa203('0x8')]=VoicePrefixEvents; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6b659db..5fe16a9 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 _0xabe8=['VoicePrefix','voice_prefixes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xabe8,0x1af));var _0x8abe=function(_0x367460,_0x3e3118){_0x367460=_0x367460-0x0;var _0x57c101=_0xabe8[_0x367460];return _0x57c101;};'use strict';var _=require(_0x8abe('0x0'));var util=require(_0x8abe('0x1'));var logger=require('../../config/logger')(_0x8abe('0x2'));var moment=require(_0x8abe('0x3'));var BPromise=require('bluebird');var rp=require(_0x8abe('0x4'));var fs=require('fs');var path=require(_0x8abe('0x5'));var rimraf=require(_0x8abe('0x6'));var config=require(_0x8abe('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x8abe('0x8')]=function(_0x57d577,_0x4bbe69){return _0x57d577['define'](_0x8abe('0x9'),attributes,{'tableName':_0x8abe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index b63b645..1c5464c 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 _0xc0f9=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4e3ffc,_0x570704){var _0x543119=function(_0x396abb){while(--_0x396abb){_0x4e3ffc['push'](_0x4e3ffc['shift']());}};_0x543119(++_0x570704);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x2e68db,_0x275d04){_0x2e68db=_0x2e68db-0x0;var _0x12df4c=_0xc0f9[_0x2e68db];return _0x12df4c;};'use strict';var _=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var moment=require(_0x9c0f('0x2'));var BPromise=require(_0x9c0f('0x3'));var rs=require(_0x9c0f('0x4'));var fs=require('fs');var Redis=require(_0x9c0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c0f('0x6'));var logger=require(_0x9c0f('0x7'))(_0x9c0f('0x8'));var config=require('../../config/environment');var jayson=require(_0x9c0f('0x9'));var client=jayson[_0x9c0f('0xa')][_0x9c0f('0xb')]({'port':0x232a});config[_0x9c0f('0xc')]=_['defaults'](config[_0x9c0f('0xc')],{'host':_0x9c0f('0xd'),'port':0x18eb});var socket=require(_0x9c0f('0xe'))(new Redis(config[_0x9c0f('0xc')]));require('./voicePrefix.socket')[_0x9c0f('0xf')](socket);function respondWithRpcPromise(_0x15b0ca,_0x4902e8,_0x2edb0f){return new BPromise(function(_0x20e9d8,_0x17c8c3){return client[_0x9c0f('0x10')](_0x15b0ca,_0x2edb0f)[_0x9c0f('0x11')](function(_0x249674){logger[_0x9c0f('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4902e8,_0x9c0f('0x13'));logger[_0x9c0f('0x14')](_0x9c0f('0x15'),_0x4902e8,_0x9c0f('0x13'),JSON[_0x9c0f('0x16')](_0x249674));if(_0x249674[_0x9c0f('0x17')]){if(_0x249674[_0x9c0f('0x17')][_0x9c0f('0x18')]===0x1f4){logger[_0x9c0f('0x17')](_0x9c0f('0x19'),_0x4902e8,_0x249674[_0x9c0f('0x17')]['message']);return _0x17c8c3(_0x249674[_0x9c0f('0x17')]['message']);}logger[_0x9c0f('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4902e8,_0x249674[_0x9c0f('0x17')][_0x9c0f('0x1a')]);return _0x20e9d8(_0x249674[_0x9c0f('0x17')]['message']);}else{logger['info'](_0x9c0f('0x19'),_0x4902e8,_0x9c0f('0x13'));_0x20e9d8(_0x249674[_0x9c0f('0x1b')][_0x9c0f('0x1a')]);}})[_0x9c0f('0x1c')](function(_0x4e2496){logger[_0x9c0f('0x17')](_0x9c0f('0x19'),_0x4902e8,_0x4e2496);_0x17c8c3(_0x4e2496);});});} \ No newline at end of file +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 diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index b86ca42..469a20f 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 _0xa7b5=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','register'];(function(_0x5e5ab6,_0x4429de){var _0x427184=function(_0x3531d8){while(--_0x3531d8){_0x5e5ab6['push'](_0x5e5ab6['shift']());}};_0x427184(++_0x4429de);}(_0xa7b5,0x162));var _0x5a7b=function(_0x451eca,_0xb128cd){_0x451eca=_0x451eca-0x0;var _0x3ce692=_0xa7b5[_0x451eca];return _0x3ce692;};'use strict';var VoicePrefixEvents=require(_0x5a7b('0x0'));var events=[_0x5a7b('0x1'),_0x5a7b('0x2'),_0x5a7b('0x3')];function createListener(_0x2ca65f,_0x5026f5){return function(_0x1a25e1){_0x5026f5[_0x5a7b('0x4')](_0x2ca65f,_0x1a25e1);};}function removeListener(_0x13085a,_0x56b82d){return function(){VoicePrefixEvents['removeListener'](_0x13085a,_0x56b82d);};}exports[_0x5a7b('0x5')]=function(_0x204212){for(var _0x4899da=0x0,_0x38dac6=events[_0x5a7b('0x6')];_0x4899da<_0x38dac6;_0x4899da++){var _0x390a68=events[_0x4899da];var _0x265597=createListener(_0x5a7b('0x7')+_0x390a68,_0x204212);VoicePrefixEvents['on'](_0x390a68,_0x265597);}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 4f3f715..e136c17 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(_0x477f53,_0x97d9eb){var _0x454e34=function(_0x41c575){while(--_0x41c575){_0x477f53['push'](_0x477f53['shift']());}};_0x454e34(++_0x97d9eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_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 diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 83de2b1..6d253e8 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 _0x747f=['wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','Active/Disactive\x20AMD','#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\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','includes','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN'];(function(_0x1812b9,_0x20a543){var _0x96aea6=function(_0x2d6fb2){while(--_0x2d6fb2){_0x1812b9['push'](_0x1812b9['shift']());}};_0x96aea6(++_0x20a543);}(_0x747f,0x123));var _0xf747=function(_0x41dc8e,_0x148e86){_0x41dc8e=_0x41dc8e-0x0;var _0xb70b6e=_0x747f[_0x41dc8e];return _0xb70b6e;};'use strict';var Sequelize=require(_0xf747('0x0'));module[_0xf747('0x1')]={'name':{'type':Sequelize[_0xf747('0x2')],'allowNull':![],'unique':_0xf747('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf747('0x4'),_0xf747('0x5')),'allowNull':![],'defaultValue':_0xf747('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xf747('0x6')},'announce':{'type':Sequelize[_0xf747('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xf747('0x7')]('rr',_0xf747('0x8'),_0xf747('0x9'),_0xf747('0xa'),_0xf747('0xb'),_0xf747('0xc'),_0xf747('0xd'),_0xf747('0xe'),_0xf747('0xf')),'allowNull':![],'defaultValue':_0xf747('0x8'),'set':function(_0x11a841){this[_0xf747('0x10')](_0xf747('0x11'),_0x11a841?_0x11a841:'rrmemory');},'get':function(){var _0x564931=this[_0xf747('0x12')](_0xf747('0x13'));var _0x5ae23e=this[_0xf747('0x12')](_0xf747('0x14'));var _0x445462=this[_0xf747('0x12')]('strategy');if(_0x564931===_0xf747('0x5')){if(_0x5ae23e==='preview'){return null;}if(_0x5ae23e===_0xf747('0x15')&&![_0xf747('0xc'),'roundrobin'][_0xf747('0x16')](_0x445462)){this[_0xf747('0x10')](_0xf747('0x11'),_0xf747('0xc'));}}return _0x445462;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf747('0x2')]},'weight':{'type':Sequelize[_0xf747('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf747('0x7')]('yes','no'),'defaultValue':_0xf747('0x18')},'autopause':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf747('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf747('0x7')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf747('0x7')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf747('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xf747('0x18'),'no'),'defaultValue':_0xf747('0x18')},'announce_holdtime':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no',_0xf747('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xf747('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xf747('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf747('0x7')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf747('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf747('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf747('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf747('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf747('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xf747('0x1a')],'set':function(_0x4c047d){this[_0xf747('0x10')](_0xf747('0x1b'),_0x4c047d?_0x4c047d[_0xf747('0x1c')](','):[]);},'get':function(){return this[_0xf747('0x12')]('periodic_announce')?this[_0xf747('0x12')](_0xf747('0x1b'))[_0xf747('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xf747('0x2')],'defaultValue':_0xf747('0x18'),'set':function(_0x277c80){this[_0xf747('0x10')](_0xf747('0x1e'),_0x277c80?_0x277c80[_0xf747('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xf747('0x1e'))?this['getDataValue'](_0xf747('0x1e'))[_0xf747('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf747('0x2')],'defaultValue':'no','set':function(_0x3ba61d){this[_0xf747('0x10')](_0xf747('0x1f'),_0x3ba61d?_0x3ba61d[_0xf747('0x1c')](','):undefined);},'get':function(){return this[_0xf747('0x12')]('leavewhenempty')?this[_0xf747('0x12')](_0xf747('0x1f'))[_0xf747('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf747('0x7')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf747('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xf747('0x20')],'defaultValue':0x0,'set':function(_0xc62495){this[_0xf747('0x10')]('acw',_0xc62495);if(_0xc62495){if(this[_0xf747('0x12')]('wrapuptime')<0x2){this[_0xf747('0x10')](_0xf747('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf747('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf747('0x20')],'defaultValue':0x0,'comment':_0xf747('0x22')},'dialMethod':{'type':Sequelize['ENUM'](_0xf747('0x23'),_0xf747('0x24'),_0xf747('0x25'),_0xf747('0x26'),_0xf747('0x15')),'defaultValue':'progressive','comment':_0xf747('0x27')},'dialLimitChannel':{'type':Sequelize[_0xf747('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf747('0x28')},'dialLimitQueue':{'type':Sequelize[_0xf747('0x17')](0x4)[_0xf747('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf747('0x2a')},'dialPowerLevel':{'type':Sequelize[_0xf747('0x2b')](0x2)[_0xf747('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf747('0x2c')},'dialPredictiveOptimization':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x2d'),_0xf747('0x2e')),'defaultValue':_0xf747('0x2e'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xf747('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf747('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xf747('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf747('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xf747('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xf747('0x30'),'comment':_0xf747('0x31')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf747('0x32')},'dialQueueProject':{'type':Sequelize[_0xf747('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf747('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf747('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xf747('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf747('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf747('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf747('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x37'),_0xf747('0x38'),'onlyIfOpen'),'defaultValue':_0xf747('0x37')},'dialAMDActive':{'type':Sequelize[_0xf747('0x20')],'defaultValue':0x0,'comment':_0xf747('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xf747('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xf747('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xf747('0x17')](0x9)[_0xf747('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf747('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf747('0x17')](0x9)[_0xf747('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf747('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf747('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf747('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xf747('0x17')](0x9)[_0xf747('0x29')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf747('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf747('0x17')](0x9)[_0xf747('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf747('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf747('0x29')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf747('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf747('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf747('0x17')](0x9)[_0xf747('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xf747('0x20')],'defaultValue':0x0,'comment':_0xf747('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf747('0x7')](_0xf747('0x43'),'ASC'),'defaultValue':_0xf747('0x43')},'dialQueueProject2':{'type':Sequelize[_0xf747('0x2')],'comment':_0xf747('0x44')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf747('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf747('0x45')},'dialCutDigit':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf747('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf747('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf747('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf747('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf747('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf747('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf747('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf747('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf747('0x17')](0x5)[_0xf747('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xf747('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xf747('0x20')],'defaultValue':![],'comment':_0xf747('0x4e'),'set':function(_0x10f728){if(!_0x10f728)this[_0xf747('0x10')](_0xf747('0x4f'),null);this['setDataValue'](_0xf747('0x50'),_0x10f728);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf747('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xf747('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xf747('0x17')](0x3)[_0xf747('0x29')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 5c3d61b..90c6e54 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 _0x34e8=['body','role','user','QueueCampaigns','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','merge','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','where','filter','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userVoiceQueue:remove','spread','push','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','cm_hopper','fromQuery','phone','scheduledAt','CmListId','ListId','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','ContactId','cm_contacts','ListId\x20=\x20?','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','VoiceQueues','inbound','outbound','ignore','map','value','type','UserProfileResource','error','stack','name','VoiceQueue','rawAttributes','fieldName','key','getOptions','include','query','findAll','catch','show','keys','filters','model','attributes','intersection','fields','length','create'];(function(_0x1c1d55,_0x3b577d){var _0x13c601=function(_0x4bcb77){while(--_0x4bcb77){_0x1c1d55['push'](_0x1c1d55['shift']());}};_0x13c601(++_0x3b577d);}(_0x34e8,0x12c));var _0x834e=function(_0x1047fc,_0x37862c){_0x1047fc=_0x1047fc-0x0;var _0x57a21d=_0x34e8[_0x1047fc];return _0x57a21d;};'use strict';var moment=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));var squel=require('squel');var Redis=require(_0x834e('0x4'));var qs=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var config=require(_0x834e('0x8'));var db=require(_0x834e('0x9'))['db'];config[_0x834e('0xa')]=_['defaults'](config[_0x834e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x834e('0xb'))(new Redis(config[_0x834e('0xa')]));require(_0x834e('0xc'))[_0x834e('0xd')](socket);function respondWithStatusCode(_0x33ea05,_0x23501c){_0x23501c=_0x23501c||0xcc;return function(_0x363786){if(_0x363786){return _0x33ea05[_0x834e('0xe')](_0x23501c);}return _0x33ea05[_0x834e('0xf')](_0x23501c)[_0x834e('0x10')]();};}function respondWithResult(_0x1e41fe,_0x36e124){_0x36e124=_0x36e124||0xc8;return function(_0x14038b){if(_0x14038b){return _0x1e41fe[_0x834e('0xf')](_0x36e124)[_0x834e('0x11')](_0x14038b);}};}function respondWithFilteredResult(_0x1e00de,_0x2fd95c){return function(_0x538bb3){if(_0x538bb3){var _0x5e5b6d=typeof _0x2fd95c[_0x834e('0x12')]==='undefined'&&typeof _0x2fd95c[_0x834e('0x13')]===_0x834e('0x14');var _0x28e659=_0x538bb3[_0x834e('0x15')];var _0x50e860=_0x5e5b6d?0x0:_0x2fd95c[_0x834e('0x12')];var _0x302cbd=_0x5e5b6d?_0x538bb3['count']:_0x2fd95c[_0x834e('0x12')]+_0x2fd95c['limit'];var _0x38a8cd;if(_0x302cbd>=_0x28e659){_0x302cbd=_0x28e659;_0x38a8cd=0xc8;}else{_0x38a8cd=0xce;}_0x1e00de[_0x834e('0xf')](_0x38a8cd);return _0x1e00de['set'](_0x834e('0x16'),_0x50e860+'-'+_0x302cbd+'/'+_0x28e659)[_0x834e('0x11')](_0x538bb3);}return null;};}function saveUpdates(_0x370fb5){return function(_0x50b3f6){if(_0x50b3f6){return _0x50b3f6[_0x834e('0x17')](_0x370fb5)[_0x834e('0x18')](function(_0x34e41a){return _0x34e41a;});}return null;};}function removeEntity(_0xb993a1){return function(_0x237947){if(_0x237947){return _0x237947[_0x834e('0x19')]()[_0x834e('0x18')](function(){var _0x595515=_0x237947[_0x834e('0x1a')]({'plain':!![]});var _0x1fd2c6=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c'),'ignore':![]},{'name':'QueueCampaigns','value':_0x834e('0x1d'),'ignore':![]}];var _0x62f8f1=_(_0x1fd2c6)['filter'](_0x834e('0x1e'))[_0x834e('0x1f')](_0x834e('0x20'))['value']();if(_['includes'](_0x62f8f1,_0x595515[_0x834e('0x21')])){return;}var _0x34563b=_['find'](_0x1fd2c6,[_0x834e('0x20'),_0x595515[_0x834e('0x21')]])['name'];return db[_0x834e('0x22')][_0x834e('0x19')]({'where':{'type':_0x34563b,'resourceId':_0x595515['id']}})[_0x834e('0x18')](function(){return _0x237947;});})['then'](function(){_0xb993a1[_0x834e('0xf')](0xcc)[_0x834e('0x10')]();});}};}function handleEntityNotFound(_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x5e1cc5[_0x834e('0xe')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x23')](_0x3f1b0b[_0x834e('0x24')]);if(_0x3f1b0b[_0x834e('0x25')]){delete _0x3f1b0b[_0x834e('0x25')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={};var _0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x1f')](db[_0x834e('0x26')][_0x834e('0x27')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x28')],'type':_0x1e026a[_0x834e('0x21')][_0x834e('0x29')]};});_0x567cea=qs[_0x834e('0x2a')](_0x5dacc1,_0x58c1d7);var _0x278db3={'where':_0x567cea['where']};return db[_0x834e('0x26')]['count'](_0x278db3)[_0x834e('0x18')](function(_0x3787b0){_0x106d6a[_0x834e('0x15')]=_0x3787b0;_0x567cea[_0x834e('0x2b')]=qs[_0x834e('0x2b')](_0x58c1d7[_0x834e('0x2c')]);return db[_0x834e('0x26')][_0x834e('0x2d')](_0x567cea);})[_0x834e('0x18')](function(_0x12b2bc){_0x106d6a['rows']=_0x12b2bc;return _0x106d6a;})[_0x834e('0x18')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x2e')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x2f')]=function(_0xaf01f4,_0x595cc0){var _0x3f88ad={'raw':![],'where':{'id':_0xaf01f4['params']['id']}},_0x379d60={};_0x379d60['model']=_['keys'](db[_0x834e('0x26')][_0x834e('0x27')]);_0x379d60[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xaf01f4[_0x834e('0x2c')]);_0x379d60[_0x834e('0x31')]=_['intersection'](_0x379d60[_0x834e('0x32')],_0x379d60['query']);_0x3f88ad[_0x834e('0x33')]=_[_0x834e('0x34')](_0x379d60['model'],qs[_0x834e('0x35')](_0xaf01f4[_0x834e('0x2c')]['fields']));_0x3f88ad['attributes']=_0x3f88ad[_0x834e('0x33')][_0x834e('0x36')]?_0x3f88ad[_0x834e('0x33')]:_0x379d60[_0x834e('0x32')];if(_0xaf01f4[_0x834e('0x2c')]['includeAll']){_0x3f88ad[_0x834e('0x2b')]=[{'all':!![]}];}_0x3f88ad=_['merge']({},_0x3f88ad,_0xaf01f4['options']);return db[_0x834e('0x26')]['find'](_0x3f88ad)[_0x834e('0x18')](handleEntityNotFound(_0x595cc0,null))[_0x834e('0x18')](respondWithResult(_0x595cc0,null))[_0x834e('0x2e')](handleError(_0x595cc0,null));};exports[_0x834e('0x37')]=function(_0x2b7933,_0x574ea8){return db[_0x834e('0x26')][_0x834e('0x37')](_0x2b7933[_0x834e('0x38')],{})['then'](function(_0x35380e){var _0x16ac45=_0x2b7933['user'][_0x834e('0x1a')]({'plain':!![]});if(!_0x16ac45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16ac45[_0x834e('0x39')]===_0x834e('0x3a')){var _0x4a18bb=_0x35380e['get']({'plain':!![]});var _0x22ea21=[{'name':_0x834e('0x1b'),'value':_0x834e('0x1c')},{'name':_0x834e('0x3b'),'value':_0x834e('0x1d')}];var _0x23feea=_[_0x834e('0x3c')](_0x22ea21,['value',_0x4a18bb[_0x834e('0x21')]])['name'];return db[_0x834e('0x3d')]['find']({'where':{'name':_0x23feea,'userProfileId':_0x16ac45[_0x834e('0x3e')]},'raw':!![]})['then'](function(_0x361f60){if(_0x361f60&&_0x361f60[_0x834e('0x3f')]===0x0){return db['UserProfileResource'][_0x834e('0x37')]({'name':_0x4a18bb[_0x834e('0x25')],'resourceId':_0x4a18bb['id'],'type':_0x361f60[_0x834e('0x25')],'sectionId':_0x361f60['id']},{})[_0x834e('0x18')](function(){return _0x35380e;});}else{return _0x35380e;}})[_0x834e('0x2e')](function(_0x1a7149){logger[_0x834e('0x23')](_0x834e('0x40'),_0x1a7149);throw _0x1a7149;});}return _0x35380e;})[_0x834e('0x18')](respondWithResult(_0x574ea8,0xc9))[_0x834e('0x2e')](handleError(_0x574ea8,null));};exports['clone']=function(_0x3124be,_0x6fff27){var _0x47a8a9={'where':{'id':_0x3124be[_0x834e('0x41')]['id']}},_0x112306={};_0x112306[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x26')][_0x834e('0x27')]);_0x47a8a9['attributes']=_['intersection'](_0x112306[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3124be[_0x834e('0x2c')][_0x834e('0x35')]));_0x47a8a9[_0x834e('0x33')]=_0x47a8a9[_0x834e('0x33')][_0x834e('0x36')]?_0x47a8a9[_0x834e('0x33')]:_0x112306[_0x834e('0x32')];if(_0x3124be[_0x834e('0x2c')][_0x834e('0x42')]){_0x47a8a9[_0x834e('0x2b')]=[{'all':!![]}];}_0x47a8a9=_[_0x834e('0x43')]({},_0x47a8a9,_0x3124be[_0x834e('0x44')]);return db[_0x834e('0x26')][_0x834e('0x3c')](_0x47a8a9)[_0x834e('0x18')](handleEntityNotFound(_0x6fff27,null))[_0x834e('0x18')](function(_0x420841){if(_0x420841){var _0x1adf86=_0x420841['get']({'plain':!![]});_0x1adf86=qs[_0x834e('0x45')](_0x1adf86,['id',_0x834e('0x46'),'updatedAt']);_0x3124be[_0x834e('0x38')]=_[_0x834e('0x45')](_0x3124be['body'],['id',_0x834e('0x46'),_0x834e('0x47')]);return db[_0x834e('0x26')][_0x834e('0x37')](_[_0x834e('0x43')](_0x1adf86,_0x3124be[_0x834e('0x38')]),{'include':_0x3124be[_0x834e('0x2c')]['includeAll']?[{'all':!![]}]:undefined})[_0x834e('0x18')](function(_0x8bc6c6){var _0x3e0550=_0x3124be[_0x834e('0x3a')][_0x834e('0x1a')]({'plain':!![]});if(!_0x3e0550)throw new Error(_0x834e('0x48'));if(_0x3e0550[_0x834e('0x39')]===_0x834e('0x3a')){var _0x5afa07=_0x8bc6c6[_0x834e('0x1a')]({'plain':!![]});var _0x4dc104=[{'name':_0x834e('0x1b'),'value':'inbound'},{'name':_0x834e('0x3b'),'value':'outbound'}];var _0x527eef=_[_0x834e('0x3c')](_0x4dc104,[_0x834e('0x20'),_0x5afa07['type']])['name'];return db[_0x834e('0x3d')][_0x834e('0x3c')]({'where':{'name':_0x527eef,'userProfileId':_0x3e0550[_0x834e('0x3e')]},'raw':!![]})[_0x834e('0x18')](function(_0x21c417){if(_0x21c417&&_0x21c417[_0x834e('0x3f')]===0x0){return db[_0x834e('0x22')][_0x834e('0x37')]({'name':_0x5afa07['name'],'resourceId':_0x5afa07['id'],'type':_0x21c417[_0x834e('0x25')],'sectionId':_0x21c417['id']},{})[_0x834e('0x18')](function(){return _0x8bc6c6;});}else{return _0x8bc6c6;}})['catch'](function(_0x281342){logger['error'](_0x834e('0x40'),_0x281342);throw _0x281342;});}return _0x8bc6c6;});}})[_0x834e('0x18')](respondWithResult(_0x6fff27,0xc9))['catch'](handleError(_0x6fff27,null));};exports[_0x834e('0x17')]=function(_0x37ee0e,_0x2de29a){if(_0x37ee0e[_0x834e('0x38')]['id']){delete _0x37ee0e['body']['id'];}return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x37ee0e[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x2de29a,null))[_0x834e('0x18')](saveUpdates(_0x37ee0e[_0x834e('0x38')],null))[_0x834e('0x18')](respondWithResult(_0x2de29a,null))[_0x834e('0x2e')](handleError(_0x2de29a,null));};exports[_0x834e('0x19')]=function(_0x125f37,_0x3a1426){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x125f37[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x3a1426,null))[_0x834e('0x18')](removeEntity(_0x3a1426,null))[_0x834e('0x2e')](handleError(_0x3a1426,null));};exports[_0x834e('0x49')]=function(_0x460a7a,_0x17b8e3){var _0x297cce={'raw':![],'where':{}};var _0x14ed83={};var _0x193a15={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x460a7a[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x17b8e3,null))[_0x834e('0x18')](function(_0x25d6f4){if(_0x25d6f4){_0x14ed83[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmHopper'][_0x834e('0x27')]);_0x14ed83['query']=_['keys'](_0x460a7a[_0x834e('0x2c')]);_0x14ed83[_0x834e('0x31')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],_0x14ed83[_0x834e('0x2c')]);_0x297cce[_0x834e('0x33')]=_[_0x834e('0x34')](_0x14ed83[_0x834e('0x32')],qs['fields'](_0x460a7a[_0x834e('0x2c')]['fields']));_0x297cce[_0x834e('0x33')]=_0x297cce[_0x834e('0x33')]['length']?_0x297cce['attributes']:_0x14ed83[_0x834e('0x32')];if(!_0x460a7a[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x297cce[_0x834e('0x13')]=qs['limit'](_0x460a7a[_0x834e('0x2c')][_0x834e('0x13')]);_0x297cce[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x12')]);}_0x297cce[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x460a7a[_0x834e('0x2c')][_0x834e('0x4e')]);_0x297cce['where']=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x460a7a[_0x834e('0x2c')],_0x14ed83[_0x834e('0x31')]));_0x297cce['where'][_0x834e('0x50')]=_0x25d6f4['id'];if(_0x460a7a['query']['filter']){_0x297cce['where']=_[_0x834e('0x43')](_0x297cce[_0x834e('0x51')],{'$or':_['map'](_0x297cce[_0x834e('0x33')],function(_0x1b200d){var _0x4d4477={};_0x4d4477[_0x1b200d]={'$like':'%'+_0x460a7a[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4d4477;})});}_0x297cce=_['merge']({},_0x297cce,_0x460a7a['options']);return db[_0x834e('0x53')][_0x834e('0x15')]({'where':_0x297cce[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x1d8e7){_0x193a15['count']=_0x1d8e7;if(_0x460a7a[_0x834e('0x2c')]['includeAll']){_0x297cce[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x53')][_0x834e('0x2d')](_0x297cce);})['then'](function(_0x33a3cd){_0x193a15[_0x834e('0x54')]=_0x33a3cd;return _0x193a15;});}})['then'](respondWithFilteredResult(_0x17b8e3,_0x297cce))[_0x834e('0x2e')](handleError(_0x17b8e3,null));};exports[_0x834e('0x55')]=function(_0xb4e130,_0x50d0a3){var _0x214014={'raw':!![],'where':{}};var _0x1d4e66={};var _0x402692={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0xb4e130[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x50d0a3,null))[_0x834e('0x18')](function(_0xd49002){if(_0xd49002){_0x1d4e66[_0x834e('0x32')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1d4e66[_0x834e('0x2c')]=_[_0x834e('0x30')](_0xb4e130[_0x834e('0x2c')]);_0x1d4e66[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d4e66['model'],_0x1d4e66['query']);_0x214014[_0x834e('0x33')]=_[_0x834e('0x34')](_0x1d4e66[_0x834e('0x32')],qs[_0x834e('0x35')](_0xb4e130[_0x834e('0x2c')]['fields']));_0x214014[_0x834e('0x33')]=_0x214014[_0x834e('0x33')][_0x834e('0x36')]?_0x214014['attributes']:_0x1d4e66[_0x834e('0x32')];if(!_0xb4e130[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x214014[_0x834e('0x13')]=qs['limit'](_0xb4e130['query'][_0x834e('0x13')]);_0x214014[_0x834e('0x12')]=qs['offset'](_0xb4e130[_0x834e('0x2c')]['offset']);}_0x214014[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0xb4e130[_0x834e('0x2c')]['sort']);_0x214014[_0x834e('0x51')]=qs['filters'](_['pick'](_0xb4e130['query'],_0x1d4e66[_0x834e('0x31')]));_0x214014[_0x834e('0x51')][_0x834e('0x50')]=_0xd49002['id'];if(_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]){_0x214014[_0x834e('0x51')]=_[_0x834e('0x43')](_0x214014[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x214014['attributes'],function(_0x2f775a){var _0x54e70d={};_0x54e70d[_0x2f775a]={'$like':'%'+_0xb4e130[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x54e70d;})});}_0x214014=_[_0x834e('0x43')]({},_0x214014,_0xb4e130[_0x834e('0x44')]);return db[_0x834e('0x56')][_0x834e('0x15')]({'where':_0x214014['where']})['then'](function(_0xeb096d){_0x402692[_0x834e('0x15')]=_0xeb096d;if(_0xb4e130['query'][_0x834e('0x42')]){_0x214014[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x56')][_0x834e('0x2d')](_0x214014);})[_0x834e('0x18')](function(_0x5a75e3){_0x402692[_0x834e('0x54')]=_0x5a75e3;return _0x402692;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x50d0a3,_0x214014))['catch'](handleError(_0x50d0a3,null));};exports['getHopperFinals']=function(_0x5ede29,_0x1e5252){var _0x1f3e26={'raw':!![],'where':{}};var _0x4f716d={};var _0x23ce49={'count':0x0,'rows':[]};return db[_0x834e('0x26')]['findOne']({'where':{'id':_0x5ede29[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x1e5252,null))['then'](function(_0x41dfd9){if(_0x41dfd9){_0x4f716d[_0x834e('0x32')]=_[_0x834e('0x30')](db[_0x834e('0x57')]['rawAttributes']);_0x4f716d[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5ede29[_0x834e('0x2c')]);_0x4f716d[_0x834e('0x31')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],_0x4f716d[_0x834e('0x2c')]);_0x1f3e26[_0x834e('0x33')]=_[_0x834e('0x34')](_0x4f716d[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x35')]));_0x1f3e26[_0x834e('0x33')]=_0x1f3e26[_0x834e('0x33')][_0x834e('0x36')]?_0x1f3e26[_0x834e('0x33')]:_0x4f716d[_0x834e('0x32')];if(!_0x5ede29[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1f3e26[_0x834e('0x13')]=qs['limit'](_0x5ede29[_0x834e('0x2c')][_0x834e('0x13')]);_0x1f3e26[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5ede29[_0x834e('0x2c')][_0x834e('0x12')]);}_0x1f3e26[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5ede29[_0x834e('0x2c')]['sort']);_0x1f3e26['where']=qs['filters'](_[_0x834e('0x4f')](_0x5ede29['query'],_0x4f716d[_0x834e('0x31')]));_0x1f3e26[_0x834e('0x51')][_0x834e('0x50')]=_0x41dfd9['id'];if(_0x5ede29['query'][_0x834e('0x52')]){_0x1f3e26[_0x834e('0x51')]=_[_0x834e('0x43')](_0x1f3e26[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x1f3e26[_0x834e('0x33')],function(_0x528052){var _0x10dd7b={};_0x10dd7b[_0x528052]={'$like':'%'+_0x5ede29[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x10dd7b;})});}_0x1f3e26=_[_0x834e('0x43')]({},_0x1f3e26,_0x5ede29[_0x834e('0x44')]);return db['CmHopperFinal']['count']({'where':_0x1f3e26['where']})['then'](function(_0x1dfa2e){_0x23ce49[_0x834e('0x15')]=_0x1dfa2e;if(_0x5ede29['query'][_0x834e('0x42')]){_0x1f3e26[_0x834e('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x834e('0x2d')](_0x1f3e26);})[_0x834e('0x18')](function(_0xbf7693){_0x23ce49[_0x834e('0x54')]=_0xbf7693;return _0x23ce49;});}})[_0x834e('0x18')](respondWithFilteredResult(_0x1e5252,_0x1f3e26))[_0x834e('0x2e')](handleError(_0x1e5252,null));};exports['getHopperBlacks']=function(_0x5a49fc,_0x43b92f){var _0x30ab20={'raw':!![],'where':{}};var _0x1d2e12={};var _0x58bdd6={'count':0x0,'rows':[]};return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5a49fc['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x43b92f,null))[_0x834e('0x18')](function(_0x216d1f){if(_0x216d1f){_0x1d2e12[_0x834e('0x32')]=_['keys'](db[_0x834e('0x58')]['rawAttributes']);_0x1d2e12['query']=_[_0x834e('0x30')](_0x5a49fc[_0x834e('0x2c')]);_0x1d2e12[_0x834e('0x31')]=_[_0x834e('0x34')](_0x1d2e12[_0x834e('0x32')],_0x1d2e12[_0x834e('0x2c')]);_0x30ab20['attributes']=_['intersection'](_0x1d2e12[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x35')]));_0x30ab20[_0x834e('0x33')]=_0x30ab20[_0x834e('0x33')][_0x834e('0x36')]?_0x30ab20['attributes']:_0x1d2e12[_0x834e('0x32')];if(!_0x5a49fc[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x30ab20[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x13')]);_0x30ab20[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x12')]);}_0x30ab20[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5a49fc[_0x834e('0x2c')][_0x834e('0x4e')]);_0x30ab20[_0x834e('0x51')]=qs['filters'](_[_0x834e('0x4f')](_0x5a49fc[_0x834e('0x2c')],_0x1d2e12['filters']));_0x30ab20[_0x834e('0x51')]['VoiceQueueId']=_0x216d1f['id'];if(_0x5a49fc[_0x834e('0x2c')]['filter']){_0x30ab20[_0x834e('0x51')]=_['merge'](_0x30ab20[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x30ab20[_0x834e('0x33')],function(_0x1aac37){var _0x57ee25={};_0x57ee25[_0x1aac37]={'$like':'%'+_0x5a49fc[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x57ee25;})});}_0x30ab20=_[_0x834e('0x43')]({},_0x30ab20,_0x5a49fc[_0x834e('0x44')]);return db[_0x834e('0x58')][_0x834e('0x15')]({'where':_0x30ab20[_0x834e('0x51')]})[_0x834e('0x18')](function(_0x2aa430){_0x58bdd6[_0x834e('0x15')]=_0x2aa430;if(_0x5a49fc[_0x834e('0x2c')][_0x834e('0x42')]){_0x30ab20[_0x834e('0x2b')]=[{'all':!![]}];}return db[_0x834e('0x58')][_0x834e('0x2d')](_0x30ab20);})[_0x834e('0x18')](function(_0xe84914){_0x58bdd6['rows']=_0xe84914;return _0x58bdd6;});}})['then'](respondWithFilteredResult(_0x43b92f,_0x30ab20))[_0x834e('0x2e')](handleError(_0x43b92f,null));};exports[_0x834e('0x59')]=function(_0x3f52b9,_0x213303){var _0x3bf1b6={};var _0x31f336={};var _0x22f90d;var _0x40fd40;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x3f52b9[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x213303,null))['then'](function(_0x1bd254){if(_0x1bd254){_0x22f90d=_0x1bd254;_0x31f336['model']=_[_0x834e('0x30')](db[_0x834e('0x5a')][_0x834e('0x27')]);_0x31f336['query']=_[_0x834e('0x30')](_0x3f52b9[_0x834e('0x2c')]);_0x31f336['filters']=_['intersection'](_0x31f336[_0x834e('0x32')],_0x31f336[_0x834e('0x2c')]);_0x3bf1b6['attributes']=_[_0x834e('0x34')](_0x31f336[_0x834e('0x32')],qs[_0x834e('0x35')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x35')]));_0x3bf1b6['attributes']=_0x3bf1b6['attributes'][_0x834e('0x36')]?_0x3bf1b6['attributes']:_0x31f336['model'];_0x3bf1b6['order']=qs[_0x834e('0x4e')](_0x3f52b9[_0x834e('0x2c')]['sort']);_0x3bf1b6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x3f52b9[_0x834e('0x2c')],_0x31f336['filters']));if(_0x3f52b9[_0x834e('0x2c')][_0x834e('0x52')]){_0x3bf1b6[_0x834e('0x51')]=_['merge'](_0x3bf1b6[_0x834e('0x51')],{'$or':_['map'](_0x3bf1b6[_0x834e('0x33')],function(_0x4af2a2){var _0x461420={};_0x461420[_0x4af2a2]={'$like':'%'+_0x3f52b9[_0x834e('0x2c')]['filter']+'%'};return _0x461420;})});}_0x3bf1b6=_[_0x834e('0x43')]({},_0x3bf1b6,_0x3f52b9[_0x834e('0x44')]);return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})[_0x834e('0x18')](function(_0x410895){if(_0x410895){_0x40fd40=_0x410895[_0x834e('0x36')];if(!_0x3f52b9['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x3bf1b6[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x3f52b9[_0x834e('0x2c')][_0x834e('0x13')]);_0x3bf1b6['offset']=qs[_0x834e('0x12')](_0x3f52b9['query']['offset']);}return _0x22f90d[_0x834e('0x59')](_0x3bf1b6);}})['then'](function(_0x4c5da4){if(_0x4c5da4){return _0x4c5da4?{'count':_0x40fd40,'rows':_0x4c5da4}:null;}})[_0x834e('0x18')](respondWithResult(_0x213303,null))[_0x834e('0x2e')](handleError(_0x213303,null));};exports[_0x834e('0x5b')]=function(_0x2e5886,_0x38fbc4){var _0x3e0ee6=_0x2e5886[_0x834e('0x38')][_0x834e('0x5c')];var _0x1d3ca9=_[_0x834e('0x1f')](_0x3e0ee6,'id');return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0x1d3ca9},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id','name',_0x834e('0x5f'),'voicePause',_0x834e('0x60')],'raw':!![]}]})[_0x834e('0x18')](function(_0x284412){if(_0x284412){var _0x2cdbe0=_['flatMap'](_0x284412,function(_0x5f558a){var _0x37d8dd=_0x5f558a[_0x834e('0x1a')]({'plain':!![]});_0x37d8dd['Agents'][_0x834e('0x61')](function(_0xfa7b14){_0xfa7b14['penalty']=_[_0x834e('0x3c')](_0x3e0ee6,{'id':_0x37d8dd['id']})[_0x834e('0x62')];});return _0x37d8dd[_0x834e('0x5e')];});return db[_0x834e('0x26')]['find']({'where':{'id':_0x2e5886['params']['id']}})['then'](function(_0x48e14c){return db[_0x834e('0x63')][_0x834e('0x64')](function(_0x47891e){return _0x48e14c[_0x834e('0x5b')](_0x1d3ca9,{'transaction':_0x47891e})['then'](function(){return BPromise[_0x834e('0x65')](_0x3e0ee6,function(_0x13b39a){return db[_0x834e('0x66')][_0x834e('0x67')]({'TeamId':_0x13b39a['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id'],'penalty':_0x13b39a[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){return BPromise['each'](_0x2cdbe0,function(_0x12a0f3){return db[_0x834e('0x68')]['findOrCreate']({'where':{'UserId':_0x12a0f3['id'],'VoiceQueueId':_0x2e5886[_0x834e('0x41')]['id']},'defaults':{'penalty':_0x12a0f3[_0x834e('0x62')]},'transaction':_0x47891e});});})['then'](function(){return BPromise['each'](_['filter'](_0x2cdbe0,{'online':!![]}),function(_0x3edbbb){return db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x3edbbb['name'],'UserId':_0x3edbbb['id'],'queue_name':_0x48e14c[_0x834e('0x25')],'VoiceQueueId':_0x48e14c['id'],'interface':_[_0x834e('0x6a')](_0x3edbbb[_0x834e('0x60')])?util[_0x834e('0x6b')](_0x834e('0x6c'),_0x3edbbb[_0x834e('0x25')]):_0x3edbbb[_0x834e('0x60')],'paused':_0x3edbbb[_0x834e('0x6d')]||![],'penalty':_0x3edbbb[_0x834e('0x62')]},{'transaction':_0x47891e});});})[_0x834e('0x18')](function(){_0x2cdbe0['forEach'](function(_0x5d6b66){socket[_0x834e('0x6e')](_0x834e('0x6f'),{'UserId':_0x5d6b66['id'],'VoiceQueueId':_0x48e14c['id']});});});});});}})[_0x834e('0x18')](respondWithStatusCode(_0x38fbc4,null))[_0x834e('0x2e')](handleError(_0x38fbc4,null));};exports[_0x834e('0x70')]=function(_0xd22e8f,_0x281922){return db[_0x834e('0x5a')][_0x834e('0x2d')]({'where':{'id':_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')]},'attributes':['id'],'include':[{'model':db[_0x834e('0x5d')],'as':_0x834e('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x281922,null))[_0x834e('0x18')](function(_0x3b13be){var _0x3f5b2e=_[_0x834e('0x1f')](_0x3b13be,'id');var _0x495697=[];var _0x5943a3=[];var _0x4e7c43=squel[_0x834e('0x72')]();_0x4e7c43[_0x834e('0x73')](_0x834e('0x74'))[_0x834e('0x75')](_0x834e('0x76'),'tq')[_0x834e('0x77')](_0x834e('0x78'),'ut',_0x834e('0x79'))['where']('VoiceQueueId\x20=\x20?',_0xd22e8f['params']['id']);for(var _0x5a5602=0x0;_0x5a5602<_0x3b13be[_0x834e('0x36')];_0x5a5602+=0x1){let _0xd108fa=_0x3b13be[_0x5a5602];for(var _0x37defd=0x0;_0x37defd<_0xd108fa[_0x834e('0x5e')][_0x834e('0x36')];_0x37defd+=0x1){let _0x386e10=_0xd108fa[_0x834e('0x5e')][_0x37defd];var _0x29ef2f=_0x4e7c43[_0x834e('0x7a')]();_0x29ef2f['where']('ut.UserId\x20=\x20?',_0x386e10['id']);_0x5943a3['push'](db['sequelize'][_0x834e('0x2c')](_0x29ef2f[_0x834e('0x7b')](),{'type':db[_0x834e('0x63')][_0x834e('0x7c')][_0x834e('0x7d')]})[_0x834e('0x18')](function(_0x416bea){if(_0x416bea[_0x834e('0x36')]===0x1){return _0x386e10['id'];}else{var _0x86d08c=_[_0x834e('0x7e')](_[_0x834e('0x1f')](_0x416bea,_0x834e('0x7f')),function(_0x1fd72b){return _[_0x834e('0x80')](_0x3f5b2e,_0x1fd72b);});if(_0x86d08c){return _0x386e10['id'];}}}));}}return BPromise[_0x834e('0x81')](_0x5943a3)[_0x834e('0x18')](function(_0x5022f2){_0x495697=_(_0x495697)[_0x834e('0x82')](_0x5022f2)['compact']()[_0x834e('0x20')]();return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0xd22e8f['params']['id']}})[_0x834e('0x18')](function(_0x3d9d85){return db['sequelize']['transaction'](function(_0x1c3b23){return _0x3d9d85[_0x834e('0x70')](_0xd22e8f[_0x834e('0x2c')][_0x834e('0x71')],{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){if(!_[_0x834e('0x83')](_0x495697)){return _0x3d9d85[_0x834e('0x84')](_0x495697,{'transaction':_0x1c3b23})[_0x834e('0x18')](function(){return db['UserVoiceQueueRt'][_0x834e('0x19')]({'where':{'VoiceQueueId':_0xd22e8f[_0x834e('0x41')]['id'],'UserId':_0x495697},'transaction':_0x1c3b23});});}})[_0x834e('0x18')](function(){_0x495697[_0x834e('0x61')](function(_0x1912e6){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':_0x1912e6,'VoiceQueueId':_0x3d9d85['id']});});});});});});})['then'](respondWithStatusCode(_0x281922,null))[_0x834e('0x2e')](handleError(_0x281922,null));};exports['addAgents']=function(_0x586fa5,_0x1115b7){var _0x1e0bc9,_0x4b16fa;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x586fa5['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x1115b7,null))[_0x834e('0x18')](function(_0x5d994e){if(_0x5d994e){_0x4b16fa=_0x5d994e;return _0x5d994e['addAgents'](_0x586fa5[_0x834e('0x38')][_0x834e('0x71')],_['omit'](_0x586fa5['body'],[_0x834e('0x71'),'id'])||{})[_0x834e('0x86')](function(_0x5d6f5e){for(var _0x480290=0x0;_0x480290<_0x586fa5['body']['ids'][_0x834e('0x36')];_0x480290+=0x1){socket['emit'](_0x834e('0x6f'),{'UserId':Number(_0x586fa5['body'][_0x834e('0x71')][_0x480290]),'VoiceQueueId':Number(_0x586fa5[_0x834e('0x41')]['id'])});}return _0x5d6f5e;});}})[_0x834e('0x18')](function(_0x3d2569){_0x1e0bc9=_0x3d2569||[];if(_0x4b16fa){return db['User'][_0x834e('0x2d')]({'where':{'id':_0x586fa5[_0x834e('0x38')][_0x834e('0x71')]},'attributes':['id',_0x834e('0x25'),_0x834e('0x5f'),_0x834e('0x6d'),_0x834e('0x60')],'raw':!![]});}})[_0x834e('0x18')](function(_0x464ae6){if(!_[_0x834e('0x83')](_0x464ae6)){var _0x590e52=[];for(var _0x40e12e=0x0;_0x40e12e<_0x464ae6['length'];_0x40e12e++){if(_0x464ae6[_0x40e12e][_0x834e('0x5f')]){_0x590e52[_0x834e('0x87')](db[_0x834e('0x69')][_0x834e('0x67')]({'membername':_0x464ae6[_0x40e12e][_0x834e('0x25')],'UserId':_0x464ae6[_0x40e12e]['id'],'queue_name':_0x4b16fa['name'],'VoiceQueueId':_0x4b16fa['id'],'interface':_[_0x834e('0x6a')](_0x464ae6[_0x40e12e]['interface'])?util['format'](_0x834e('0x6c'),_0x464ae6[_0x40e12e][_0x834e('0x25')]):_0x464ae6[_0x40e12e][_0x834e('0x60')],'paused':_0x464ae6[_0x40e12e]['voicePause']||![],'penalty':_0x586fa5[_0x834e('0x38')][_0x834e('0x62')]||0x0}));}}return BPromise[_0x834e('0x81')](_0x590e52);}})[_0x834e('0x18')](function(){return _0x1e0bc9;})[_0x834e('0x18')](respondWithResult(_0x1115b7,null))[_0x834e('0x2e')](handleError(_0x1115b7,null));};exports[_0x834e('0x84')]=function(_0x687dab,_0x125787){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x687dab['params']['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x125787,null))[_0x834e('0x18')](function(_0x121d4f){if(_0x121d4f){return _0x121d4f[_0x834e('0x84')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])['then'](function(){if(_[_0x834e('0x88')](_0x687dab[_0x834e('0x2c')][_0x834e('0x71')])){for(var _0x37dea1=0x0;_0x37dea1<_0x687dab[_0x834e('0x2c')][_0x834e('0x71')][_0x834e('0x36')];_0x37dea1+=0x1){socket[_0x834e('0x6e')](_0x834e('0x85'),{'UserId':Number(_0x687dab[_0x834e('0x2c')]['ids'][_0x37dea1]),'VoiceQueueId':Number(_0x687dab['params']['id'])});}}else{socket[_0x834e('0x6e')]('userVoiceQueue:remove',{'UserId':Number(_0x687dab[_0x834e('0x2c')][_0x834e('0x71')]),'VoiceQueueId':Number(_0x687dab[_0x834e('0x41')]['id'])});}});}})[_0x834e('0x18')](function(_0x1daa58){return db[_0x834e('0x69')]['destroy']({'where':{'VoiceQueueId':_0x687dab[_0x834e('0x41')]['id'],'UserId':_0x687dab['query']['ids']}})['then'](function(){return _0x1daa58;});})[_0x834e('0x18')](respondWithStatusCode(_0x125787,null))[_0x834e('0x2e')](handleError(_0x125787,null));};exports['getAgents']=function(_0x5cb379,_0x494e08){var _0x2515f6={};var _0x45c8e6={};var _0x3512d8;var _0x5e0bfe;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x5cb379[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x494e08,null))[_0x834e('0x18')](function(_0x3c1a19){if(_0x3c1a19){_0x3512d8=_0x3c1a19;_0x45c8e6['model']=_['keys'](db['User']['rawAttributes']);_0x45c8e6[_0x834e('0x2c')]=_[_0x834e('0x30')](_0x5cb379[_0x834e('0x2c')]);_0x45c8e6[_0x834e('0x31')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],_0x45c8e6[_0x834e('0x2c')]);_0x2515f6[_0x834e('0x33')]=_[_0x834e('0x34')](_0x45c8e6[_0x834e('0x32')],qs[_0x834e('0x35')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x35')]));_0x2515f6[_0x834e('0x33')]=_0x2515f6[_0x834e('0x33')]['length']?_0x2515f6['attributes']:_0x45c8e6[_0x834e('0x32')];_0x2515f6[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x5cb379['query'][_0x834e('0x4e')]);_0x2515f6[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x5cb379[_0x834e('0x2c')],_0x45c8e6[_0x834e('0x31')]));if(_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]){_0x2515f6[_0x834e('0x51')]=_['merge'](_0x2515f6[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x2515f6[_0x834e('0x33')],function(_0x2f1de8){var _0x4b6834={};_0x4b6834[_0x2f1de8]={'$like':'%'+_0x5cb379[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x4b6834;})});}_0x2515f6=_[_0x834e('0x43')]({},_0x2515f6,_0x5cb379[_0x834e('0x44')]);return _0x3512d8[_0x834e('0x89')](_0x2515f6);}})[_0x834e('0x18')](function(_0x3f6ead){if(_0x3f6ead){_0x5e0bfe=_0x3f6ead[_0x834e('0x36')];if(!_0x5cb379[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x2515f6['limit']=qs[_0x834e('0x13')](_0x5cb379['query'][_0x834e('0x13')]);_0x2515f6[_0x834e('0x12')]=qs[_0x834e('0x12')](_0x5cb379[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x3512d8['getAgents'](_0x2515f6);}})[_0x834e('0x18')](function(_0x29f970){if(_0x29f970){return _0x29f970?{'count':_0x5e0bfe,'rows':_0x29f970}:null;}})['then'](respondWithResult(_0x494e08,null))['catch'](handleError(_0x494e08,null));};exports[_0x834e('0x8a')]=function(_0x4db3c5,_0x4e6a75){var _0x57a989={};var _0x26cb93={};var _0x39bd0c;var _0xbd9400;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x4db3c5[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x4e6a75,null))['then'](function(_0x28825c){if(_0x28825c){_0x39bd0c=_0x28825c;_0x26cb93[_0x834e('0x32')]=_['keys'](db['UserVoiceQueueRt'][_0x834e('0x27')]);_0x26cb93[_0x834e('0x2c')]=_['keys'](_0x4db3c5['query']);_0x26cb93[_0x834e('0x31')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],_0x26cb93['query']);_0x57a989[_0x834e('0x33')]=_[_0x834e('0x34')](_0x26cb93[_0x834e('0x32')],qs['fields'](_0x4db3c5[_0x834e('0x2c')]['fields']));_0x57a989[_0x834e('0x33')]=_0x57a989[_0x834e('0x33')][_0x834e('0x36')]?_0x57a989[_0x834e('0x33')]:_0x26cb93[_0x834e('0x32')];_0x57a989['order']=qs[_0x834e('0x4e')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x4e')]);_0x57a989[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x4db3c5['query'],_0x26cb93[_0x834e('0x31')]));if(_0x4db3c5[_0x834e('0x2c')][_0x834e('0x52')]){_0x57a989['where']=_[_0x834e('0x43')](_0x57a989[_0x834e('0x51')],{'$or':_[_0x834e('0x1f')](_0x57a989[_0x834e('0x33')],function(_0x53faec){var _0x3cc563={};_0x3cc563[_0x53faec]={'$like':'%'+_0x4db3c5[_0x834e('0x2c')]['filter']+'%'};return _0x3cc563;})});}_0x57a989=_[_0x834e('0x43')]({},_0x57a989,_0x4db3c5[_0x834e('0x44')]);return _0x39bd0c[_0x834e('0x8a')](_0x57a989);}})[_0x834e('0x18')](function(_0x4b0246){if(_0x4b0246){_0xbd9400=_0x4b0246[_0x834e('0x36')];if(!_0x4db3c5['query'][_0x834e('0x4b')](_0x834e('0x4c'))){_0x57a989[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x13')]);_0x57a989['offset']=qs['offset'](_0x4db3c5[_0x834e('0x2c')][_0x834e('0x12')]);}return _0x39bd0c['getMembers'](_0x57a989);}})[_0x834e('0x18')](function(_0x4af796){return _0x4af796?{'count':_0xbd9400,'rows':_0x4af796}:null;})[_0x834e('0x18')](respondWithResult(_0x4e6a75,null))[_0x834e('0x2e')](handleError(_0x4e6a75,null));};exports[_0x834e('0x8b')]=function(_0x151b58,_0x2ec7b0){var _0x1ca24b={};var _0x36836f={};var _0x56ae60;var _0x122b03;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x151b58[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2ec7b0,null))['then'](function(_0x167642){if(_0x167642){_0x56ae60=_0x167642;_0x36836f[_0x834e('0x32')]=_[_0x834e('0x30')](db['CmList']['rawAttributes']);_0x36836f['query']=_[_0x834e('0x30')](_0x151b58[_0x834e('0x2c')]);_0x36836f[_0x834e('0x31')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],_0x36836f[_0x834e('0x2c')]);_0x1ca24b[_0x834e('0x33')]=_[_0x834e('0x34')](_0x36836f[_0x834e('0x32')],qs[_0x834e('0x35')](_0x151b58[_0x834e('0x2c')]['fields']));_0x1ca24b[_0x834e('0x33')]=_0x1ca24b[_0x834e('0x33')][_0x834e('0x36')]?_0x1ca24b[_0x834e('0x33')]:_0x36836f[_0x834e('0x32')];_0x1ca24b[_0x834e('0x4d')]=qs[_0x834e('0x4e')](_0x151b58[_0x834e('0x2c')]['sort']);_0x1ca24b[_0x834e('0x51')]=qs[_0x834e('0x31')](_['pick'](_0x151b58[_0x834e('0x2c')],_0x36836f[_0x834e('0x31')]));if(_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]){_0x1ca24b['where']=_['merge'](_0x1ca24b[_0x834e('0x51')],{'$or':_['map'](_0x1ca24b[_0x834e('0x33')],function(_0x433cb4){var _0x18638d={};_0x18638d[_0x433cb4]={'$like':'%'+_0x151b58[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0x18638d;})});}_0x1ca24b=_['merge']({},_0x1ca24b,_0x151b58[_0x834e('0x44')]);return _0x56ae60['getLists'](_0x1ca24b);}})['then'](function(_0x3d8b08){if(_0x3d8b08){_0x122b03=_0x3d8b08[_0x834e('0x36')];if(!_0x151b58[_0x834e('0x2c')][_0x834e('0x4b')](_0x834e('0x4c'))){_0x1ca24b[_0x834e('0x13')]=qs['limit'](_0x151b58[_0x834e('0x2c')][_0x834e('0x13')]);_0x1ca24b['offset']=qs[_0x834e('0x12')](_0x151b58[_0x834e('0x2c')]['offset']);}return _0x56ae60[_0x834e('0x8b')](_0x1ca24b);}})[_0x834e('0x18')](function(_0x47a239){if(_0x47a239){return _0x47a239?{'count':_0x122b03,'rows':_0x47a239}:null;}})[_0x834e('0x18')](respondWithResult(_0x2ec7b0,null))[_0x834e('0x2e')](handleError(_0x2ec7b0,null));};exports[_0x834e('0x8c')]=function(_0x3b658a,_0x34a13d){var _0x29b8fd=moment()[_0x834e('0x6b')](_0x834e('0x8d'));var _0x208bbe,_0xe0b3;return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x3b658a[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x34a13d,null))[_0x834e('0x18')](function(_0x371767){if(_0x371767){_0xe0b3=_0x371767;return _0x371767[_0x834e('0x8c')](_0x3b658a[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x3b658a[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x5af6fc){var _0x2ddbc0;_0x208bbe=_0x5af6fc||[];var _0x1cd122=[];if(_0x5af6fc){for(var _0x49be08=0x0;_0x49be08<_0x5af6fc['length'];_0x49be08+=0x1){var _0x563f20=_0x5af6fc[_0x49be08][_0x834e('0x1a')]({'plain':!![]});_0xe0b3[_0x834e('0x8e')]=_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]?_0x3b658a[_0x834e('0x38')][_0x834e('0x8e')]:_0xe0b3[_0x834e('0x8e')];switch(_0xe0b3['dialCheckDuplicateType']){case'always':_0x2ddbc0=squel['insert']()['into'](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt','ContactId','ListId',_0x834e('0x50'),'createdAt','updatedAt'],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','updatedAt')['from']('cm_contacts')['where'](_0x834e('0x95'))[_0x834e('0x51')]('ListId\x20=\x20?',_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')]('COALESCE(calleridnum,\x27\x27)')[_0x834e('0x75')](_0x834e('0x98'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]()))[_0x834e('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))['from'](_0x834e('0x8f'))[_0x834e('0x51')](_0x834e('0x99'),_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;case _0x834e('0x9b'):_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')]([_0x834e('0x91'),'scheduledAt',_0x834e('0x9e'),'ListId',_0x834e('0x50'),'createdAt',_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x91'),_0x834e('0x91'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x92'))[_0x834e('0x73')]('id','ContactId')['field'](_0x563f20['CmListId'][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),_0x834e('0x50'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))['field']('\x27'+_0x29b8fd+'\x27','updatedAt')[_0x834e('0x75')](_0x834e('0x9f'))[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96'))['where'](_0x834e('0x97'),squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0x9a'))[_0x834e('0x75')](_0x834e('0x8f'))[_0x834e('0x51')]('VoiceQueueId\x20=\x20?',_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')]())))[_0x834e('0x7b')]();break;default:_0x2ddbc0=squel[_0x834e('0x9c')]()[_0x834e('0x9d')](_0x834e('0x8f'))[_0x834e('0x90')](['phone','scheduledAt',_0x834e('0x9e'),'ListId','VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel['select']()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','scheduledAt')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x563f20[_0x834e('0x93')][_0x834e('0x7b')](),_0x834e('0x94'))[_0x834e('0x73')](_0x3b658a[_0x834e('0x41')]['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x46'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))['from']('cm_contacts')[_0x834e('0x51')](_0x834e('0x95'))['where'](_0x834e('0xa0'),_0x563f20['CmListId'][_0x834e('0x7b')]())[_0x834e('0x51')](_0x834e('0x96')))[_0x834e('0x7b')]();}_0x1cd122[_0x834e('0x87')](db[_0x834e('0x63')]['query'](_0x2ddbc0));}return BPromise['all'](_0x1cd122);}})['then'](function(){var _0xbafedb=[];var _0x1d004f=squel[_0x834e('0x9c')]()['into']('cm_hopper_additional_phones')[_0x834e('0x90')]([_0x834e('0xa1'),_0x834e('0x91'),_0x834e('0xa2'),_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')](_0x834e('0xa3'))[_0x834e('0x73')](_0x834e('0xa4'))['field'](_0x834e('0xa5'))[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27','createdAt')[_0x834e('0x73')]('\x27'+_0x29b8fd+'\x27',_0x834e('0x47'))[_0x834e('0x75')](_0x834e('0xa6'),'ci')[_0x834e('0x77')](_0x834e('0x8f'),'h',_0x834e('0xa7'))[_0x834e('0x51')](_0x834e('0xa8'),_0x29b8fd)[_0x834e('0x51')](_0x834e('0xa9'),_0x834e('0xaa')))[_0x834e('0x7b')]();_0xbafedb[_0x834e('0x87')](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d004f));return BPromise[_0x834e('0x81')](_0xbafedb);})[_0x834e('0x18')](function(){return _0x208bbe;})[_0x834e('0x18')](respondWithResult(_0x34a13d,null))[_0x834e('0x2e')](handleError(_0x34a13d,null));};exports[_0x834e('0xab')]=function(_0x239efd,_0x2f7170){return db['VoiceQueue'][_0x834e('0x3c')]({'where':{'id':_0x239efd[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x2f7170,null))[_0x834e('0x18')](function(_0x3fd7a3){if(_0x3fd7a3){return _0x3fd7a3[_0x834e('0xab')](_0x239efd[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x41d0a7){if(_0x41d0a7){return db[_0x834e('0x53')][_0x834e('0x19')]({'where':{'ListId':_0x239efd['query'][_0x834e('0x71')],'VoiceQueueId':_0x239efd[_0x834e('0x41')]['id']}})['then'](function(){return _0x41d0a7;});}})[_0x834e('0x18')](respondWithStatusCode(_0x2f7170,null))[_0x834e('0x2e')](handleError(_0x2f7170,null));};exports['getBlackLists']=function(_0x16a7a9,_0x18b8c7){var _0x576ece={};var _0x51c877={};var _0x54915f;var _0x32d06c;return db[_0x834e('0x26')][_0x834e('0x4a')]({'where':{'id':_0x16a7a9[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x18b8c7,null))[_0x834e('0x18')](function(_0x132711){if(_0x132711){_0x54915f=_0x132711;_0x51c877[_0x834e('0x32')]=_['keys'](db[_0x834e('0xac')][_0x834e('0x27')]);_0x51c877[_0x834e('0x2c')]=_['keys'](_0x16a7a9[_0x834e('0x2c')]);_0x51c877[_0x834e('0x31')]=_['intersection'](_0x51c877[_0x834e('0x32')],_0x51c877[_0x834e('0x2c')]);_0x576ece['attributes']=_[_0x834e('0x34')](_0x51c877[_0x834e('0x32')],qs[_0x834e('0x35')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x35')]));_0x576ece['attributes']=_0x576ece['attributes'][_0x834e('0x36')]?_0x576ece[_0x834e('0x33')]:_0x51c877[_0x834e('0x32')];_0x576ece['order']=qs[_0x834e('0x4e')](_0x16a7a9[_0x834e('0x2c')][_0x834e('0x4e')]);_0x576ece[_0x834e('0x51')]=qs[_0x834e('0x31')](_[_0x834e('0x4f')](_0x16a7a9['query'],_0x51c877[_0x834e('0x31')]));if(_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]){_0x576ece[_0x834e('0x51')]=_[_0x834e('0x43')](_0x576ece['where'],{'$or':_['map'](_0x576ece[_0x834e('0x33')],function(_0x5eca84){var _0xcb4fe4={};_0xcb4fe4[_0x5eca84]={'$like':'%'+_0x16a7a9[_0x834e('0x2c')][_0x834e('0x52')]+'%'};return _0xcb4fe4;})});}_0x576ece=_[_0x834e('0x43')]({},_0x576ece,_0x16a7a9[_0x834e('0x44')]);return _0x54915f[_0x834e('0xad')](_0x576ece);}})[_0x834e('0x18')](function(_0x5b4718){if(_0x5b4718){_0x32d06c=_0x5b4718[_0x834e('0x36')];if(!_0x16a7a9[_0x834e('0x2c')]['hasOwnProperty'](_0x834e('0x4c'))){_0x576ece[_0x834e('0x13')]=qs[_0x834e('0x13')](_0x16a7a9['query'][_0x834e('0x13')]);_0x576ece['offset']=qs[_0x834e('0x12')](_0x16a7a9['query'][_0x834e('0x12')]);}return _0x54915f[_0x834e('0xad')](_0x576ece);}})['then'](function(_0x3757bf){if(_0x3757bf){return _0x3757bf?{'count':_0x32d06c,'rows':_0x3757bf}:null;}})['then'](respondWithResult(_0x18b8c7,null))[_0x834e('0x2e')](handleError(_0x18b8c7,null));};exports[_0x834e('0xae')]=function(_0x395b48,_0x5b4208){var _0x4c9b90;return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x395b48[_0x834e('0x41')]['id']}})[_0x834e('0x18')](handleEntityNotFound(_0x5b4208,null))[_0x834e('0x18')](function(_0x414ff2){if(_0x414ff2){return _0x414ff2[_0x834e('0xae')](_0x395b48[_0x834e('0x38')][_0x834e('0x71')],_[_0x834e('0x45')](_0x395b48[_0x834e('0x38')],[_0x834e('0x71'),'id'])||{});}return null;})[_0x834e('0x86')](function(_0x3aeca7){var _0x1d9e00;_0x4c9b90=_0x3aeca7||[];var _0x11db76=[];if(_0x3aeca7){for(var _0x37f058=0x0;_0x37f058<_0x3aeca7[_0x834e('0x36')];_0x37f058+=0x1){var _0x354497=_0x3aeca7[_0x37f058]['get']({'plain':!![]});_0x1d9e00=squel[_0x834e('0x9c')]()['into'](_0x834e('0xaf'))[_0x834e('0x90')]([_0x834e('0x91'),_0x834e('0x9e'),_0x834e('0x94'),'VoiceQueueId',_0x834e('0x46'),_0x834e('0x47')],squel[_0x834e('0x72')]()[_0x834e('0x73')]('phone','phone')[_0x834e('0x73')]('id',_0x834e('0x9e'))[_0x834e('0x73')](_0x354497[_0x834e('0x93')]['toString'](),'ListId')['field'](_0x395b48['params']['id'][_0x834e('0x7b')](),'VoiceQueueId')[_0x834e('0x73')]('NOW()',_0x834e('0x46'))[_0x834e('0x73')](_0x834e('0xb0'),'updatedAt')[_0x834e('0x75')]('cm_contacts')[_0x834e('0x51')]('deletedAt\x20IS\x20NULL')[_0x834e('0x51')]('ListId\x20=\x20?',_0x354497[_0x834e('0x93')][_0x834e('0x7b')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x11db76['push'](db[_0x834e('0x63')][_0x834e('0x2c')](_0x1d9e00));}return BPromise['all'](_0x11db76);}})[_0x834e('0x18')](function(){return _0x4c9b90;})[_0x834e('0x18')](respondWithResult(_0x5b4208,null))[_0x834e('0x2e')](handleError(_0x5b4208,null));};exports['removeBlackLists']=function(_0x5cb260,_0x5b3fda){return db[_0x834e('0x26')][_0x834e('0x3c')]({'where':{'id':_0x5cb260[_0x834e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b3fda,null))[_0x834e('0x18')](function(_0x1e5e2a){if(_0x1e5e2a){return _0x1e5e2a[_0x834e('0xb1')](_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')]);}})[_0x834e('0x18')](function(_0x549c2f){if(_0x549c2f){return db['CmHopperBlack'][_0x834e('0x19')]({'where':{'ListId':_0x5cb260[_0x834e('0x2c')][_0x834e('0x71')],'VoiceQueueId':_0x5cb260[_0x834e('0x41')]['id']}})[_0x834e('0x18')](function(){return _0x549c2f;});}})[_0x834e('0x18')](respondWithStatusCode(_0x5b3fda,null))[_0x834e('0x2e')](handleError(_0x5b3fda,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index eb6ea9b..81c236b 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 _0x7fe8=['emit','hasOwnProperty','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x1f4202,_0x5350da){var _0x47bb0d=function(_0x3052e9){while(--_0x3052e9){_0x1f4202['push'](_0x1f4202['shift']());}};_0x47bb0d(++_0x5350da);}(_0x7fe8,0xf3));var _0x87fe=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x7fe8[_0x4792c8];return _0x35edb1;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x87fe('0x0'))['db'][_0x87fe('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x87fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a3f4e){return function(_0x445912,_0x31239f,_0x5020b2){VoiceQueueEvents[_0x87fe('0x3')](_0x4a3f4e+':'+_0x445912['id'],_0x445912);VoiceQueueEvents[_0x87fe('0x3')](_0x4a3f4e,_0x445912);_0x5020b2(null);};}for(var e in events){if(events[_0x87fe('0x4')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x87fe('0x5')]=VoiceQueueEvents; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c1994ce..b0e52ed 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x188341,_0x54ba0f){var _0x2e86cf=function(_0x2bc51a){while(--_0x2bc51a){_0x188341['push'](_0x188341['shift']());}};_0x2e86cf(++_0x54ba0f);}(_0x70e0,0x17b));var _0x070e=function(_0x16bc93,_0x5c5f4c){_0x16bc93=_0x16bc93-0x0;var _0x2e3959=_0x70e0[_0x16bc93];return _0x2e3959;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a28d704..00dc272 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 _0xae00=['map','model','then','catch','ShowVoiceQueue','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include'];(function(_0x5b818f,_0x40ef73){var _0x5948f3=function(_0x39f64c){while(--_0x39f64c){_0x5b818f['push'](_0x5b818f['shift']());}};_0x5948f3(++_0x40ef73);}(_0xae00,0x117));var _0x0ae0=function(_0x40453a,_0x1ff061){_0x40453a=_0x40453a-0x0;var _0x2da74d=_0xae00[_0x40453a];return _0x2da74d;};'use strict';var _=require(_0x0ae0('0x0'));var util=require('util');var moment=require(_0x0ae0('0x1'));var BPromise=require(_0x0ae0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ae0('0x3'));var db=require(_0x0ae0('0x4'))['db'];var utils=require(_0x0ae0('0x5'));var logger=require(_0x0ae0('0x6'))(_0x0ae0('0x7'));var config=require(_0x0ae0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0ae0('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0ae0('0xa')](config['redis'],{'host':_0x0ae0('0xb'),'port':0x18eb});var socket=require(_0x0ae0('0xc'))(new Redis(config[_0x0ae0('0xd')]));require(_0x0ae0('0xe'))[_0x0ae0('0xf')](socket);function respondWithRpcPromise(_0x1e0ad5,_0x4e0bfe,_0x35ddf1){return new BPromise(function(_0x23bbec,_0x51e93e){return client[_0x0ae0('0x10')](_0x1e0ad5,_0x35ddf1)['then'](function(_0x1c32e4){logger[_0x0ae0('0x11')](_0x0ae0('0x12'),_0x4e0bfe,_0x0ae0('0x13'));logger[_0x0ae0('0x14')](_0x0ae0('0x15'),_0x4e0bfe,_0x0ae0('0x13'),JSON[_0x0ae0('0x16')](_0x1c32e4));if(_0x1c32e4[_0x0ae0('0x17')]){if(_0x1c32e4[_0x0ae0('0x17')][_0x0ae0('0x18')]===0x1f4){logger[_0x0ae0('0x17')](_0x0ae0('0x12'),_0x4e0bfe,_0x1c32e4[_0x0ae0('0x17')]['message']);return _0x51e93e(_0x1c32e4['error']['message']);}logger[_0x0ae0('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x4e0bfe,_0x1c32e4['error'][_0x0ae0('0x19')]);return _0x23bbec(_0x1c32e4[_0x0ae0('0x17')][_0x0ae0('0x19')]);}else{logger['info'](_0x0ae0('0x12'),_0x4e0bfe,_0x0ae0('0x13'));_0x23bbec(_0x1c32e4['result']['message']);}})['catch'](function(_0x37599c){logger['error'](_0x0ae0('0x12'),_0x4e0bfe,_0x37599c);_0x51e93e(_0x37599c);});});}exports[_0x0ae0('0x1a')]=function(_0x5233aa){var _0x3055d3=this;return new Promise(function(_0x31135b,_0x55a12f){return db[_0x0ae0('0x1b')]['findAll']({'raw':_0x5233aa[_0x0ae0('0x1c')]?_0x5233aa['options']['raw']===undefined?!![]:![]:!![],'where':_0x5233aa[_0x0ae0('0x1c')]?_0x5233aa[_0x0ae0('0x1c')][_0x0ae0('0x1d')]||null:null,'attributes':_0x5233aa[_0x0ae0('0x1c')]?_0x5233aa[_0x0ae0('0x1c')][_0x0ae0('0x1e')]||null:null,'limit':_0x5233aa[_0x0ae0('0x1c')]?_0x5233aa[_0x0ae0('0x1c')][_0x0ae0('0x1f')]||null:null,'include':_0x5233aa[_0x0ae0('0x1c')]?_0x5233aa['options'][_0x0ae0('0x20')]?_[_0x0ae0('0x21')](_0x5233aa[_0x0ae0('0x1c')][_0x0ae0('0x20')],function(_0x158b78){return{'model':db[_0x158b78[_0x0ae0('0x22')]],'as':_0x158b78['as'],'attributes':_0x158b78['attributes'],'include':_0x158b78[_0x0ae0('0x20')]?_[_0x0ae0('0x21')](_0x158b78[_0x0ae0('0x20')],function(_0x107011){return{'model':db[_0x107011[_0x0ae0('0x22')]],'as':_0x107011['as'],'attributes':_0x107011[_0x0ae0('0x1e')],'include':_0x107011[_0x0ae0('0x20')]?_[_0x0ae0('0x21')](_0x107011[_0x0ae0('0x20')],function(_0x7a1c08){return{'model':db[_0x7a1c08[_0x0ae0('0x22')]],'as':_0x7a1c08['as'],'attributes':_0x7a1c08[_0x0ae0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0ae0('0x23')](function(_0x3152d0){logger[_0x0ae0('0x11')]('GetVoiceQueue',_0x5233aa);logger[_0x0ae0('0x14')]('GetVoiceQueue',_0x5233aa,JSON[_0x0ae0('0x16')](_0x3152d0));_0x31135b(_0x3152d0);})[_0x0ae0('0x24')](function(_0x3c1c0b){logger[_0x0ae0('0x17')](_0x0ae0('0x1a'),_0x3c1c0b[_0x0ae0('0x19')],_0x5233aa);_0x55a12f(_0x3055d3[_0x0ae0('0x17')](0x1f4,_0x3c1c0b['message']));});});};exports[_0x0ae0('0x25')]=function(_0x16d688){var _0x44e1a8=this;return new Promise(function(_0x4c357d,_0x176933){return db[_0x0ae0('0x1b')]['find']({'raw':_0x16d688[_0x0ae0('0x1c')]?_0x16d688['options'][_0x0ae0('0x26')]===undefined?!![]:![]:!![],'where':_0x16d688[_0x0ae0('0x1c')]?_0x16d688[_0x0ae0('0x1c')][_0x0ae0('0x1d')]||null:null,'attributes':_0x16d688[_0x0ae0('0x1c')]?_0x16d688['options'][_0x0ae0('0x1e')]||null:null,'include':_0x16d688[_0x0ae0('0x1c')]?_0x16d688[_0x0ae0('0x1c')][_0x0ae0('0x20')]?_[_0x0ae0('0x21')](_0x16d688[_0x0ae0('0x1c')][_0x0ae0('0x20')],function(_0x3e2d1b){return{'model':db[_0x3e2d1b[_0x0ae0('0x22')]],'as':_0x3e2d1b['as'],'attributes':_0x3e2d1b[_0x0ae0('0x1e')],'include':_0x3e2d1b['include']?_[_0x0ae0('0x21')](_0x3e2d1b[_0x0ae0('0x20')],function(_0x3afb74){return{'model':db[_0x3afb74[_0x0ae0('0x22')]],'as':_0x3afb74['as'],'attributes':_0x3afb74['attributes'],'include':_0x3afb74['include']?_[_0x0ae0('0x21')](_0x3afb74[_0x0ae0('0x20')],function(_0x33d610){return{'model':db[_0x33d610[_0x0ae0('0x22')]],'as':_0x33d610['as'],'attributes':_0x33d610[_0x0ae0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0ae0('0x23')](function(_0x415fcd){logger[_0x0ae0('0x11')](_0x0ae0('0x25'),_0x16d688);logger[_0x0ae0('0x14')](_0x0ae0('0x25'),_0x16d688,JSON[_0x0ae0('0x16')](_0x415fcd));_0x4c357d(_0x415fcd);})[_0x0ae0('0x24')](function(_0x5445a2){logger[_0x0ae0('0x17')]('ShowVoiceQueue',_0x5445a2[_0x0ae0('0x19')],_0x16d688);_0x176933(_0x44e1a8['error'](0x1f4,_0x5445a2[_0x0ae0('0x19')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 1e950c7..7f10368 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 _0x27d1=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x27d1,0xf0));var _0x127d=function(_0x5e1293,_0x3627ab){_0x5e1293=_0x5e1293-0x0;var _0x445bdc=_0x27d1[_0x5e1293];return _0x445bdc;};'use strict';var VoiceQueueEvents=require(_0x127d('0x0'));var events=[_0x127d('0x1'),_0x127d('0x2'),_0x127d('0x3')];function createListener(_0xbc5784,_0x4b9358){return function(_0x8da8fc){_0x4b9358[_0x127d('0x4')](_0xbc5784,_0x8da8fc);};}function removeListener(_0x11dbb5,_0x36daa4){return function(){VoiceQueueEvents[_0x127d('0x5')](_0x11dbb5,_0x36daa4);};}exports[_0x127d('0x6')]=function(_0x447f12){for(var _0x2873d4=0x0,_0x4b46d1=events[_0x127d('0x7')];_0x2873d4<_0x4b46d1;_0x2873d4++){var _0x2494b8=events[_0x2873d4];var _0x2cd252=createListener(_0x127d('0x8')+_0x2494b8,_0x447f12);VoiceQueueEvents['on'](_0x2494b8,_0x2cd252);}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 54c08f8..40e76f3 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 _0x8211=['isAuthenticated','index','get','describe','/index','getVoiceQueuesReport','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x18e590,_0x31390e){var _0x28e4ca=function(_0x14b4a9){while(--_0x14b4a9){_0x18e590['push'](_0x18e590['shift']());}};_0x28e4ca(++_0x31390e);}(_0x8211,0x65));var _0x1821=function(_0x477016,_0x4b4ca3){_0x477016=_0x477016-0x0;var _0x35bba5=_0x8211[_0x477016];return _0x35bba5;};'use strict';var multer=require('multer');var util=require(_0x1821('0x0'));var path=require(_0x1821('0x1'));var timeout=require(_0x1821('0x2'));var express=require(_0x1821('0x3'));var router=express[_0x1821('0x4')]();var fs_extra=require(_0x1821('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1821('0x6'));var config=require(_0x1821('0x7'));var controller=require(_0x1821('0x8'));router['get']('/',auth[_0x1821('0x9')](),controller[_0x1821('0xa')]);router[_0x1821('0xb')]('/describe',auth[_0x1821('0x9')](),controller[_0x1821('0xc')]);router[_0x1821('0xb')](_0x1821('0xd'),auth[_0x1821('0x9')](),controller[_0x1821('0xe')]);router[_0x1821('0xb')](_0x1821('0xf'),auth[_0x1821('0x9')](),controller['show']);router[_0x1821('0x10')]('/',auth[_0x1821('0x9')](),controller[_0x1821('0x11')]);router[_0x1821('0x12')](_0x1821('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x1821('0x13')]('/:id',auth[_0x1821('0x9')](),controller[_0x1821('0x14')]);module[_0x1821('0x15')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index de5df3d..a5fbd1b 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 _0xe2ae=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x157ce5,_0xfa6b87){var _0x359c0c=function(_0x403f22){while(--_0x403f22){_0x157ce5['push'](_0x157ce5['shift']());}};_0x359c0c(++_0xfa6b87);}(_0xe2ae,0x1a8));var _0xee2a=function(_0x518d9b,_0x325e8d){_0x518d9b=_0x518d9b-0x0;var _0x53548f=_0xe2ae[_0x518d9b];return _0x53548f;};'use strict';var Sequelize=require(_0xee2a('0x0'));var moment=require(_0xee2a('0x1'));module[_0xee2a('0x2')]={'type':{'type':Sequelize[_0xee2a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xee2a('0x3')]},'calleridname':{'type':Sequelize[_0xee2a('0x3')]},'queue':{'type':Sequelize[_0xee2a('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xee2a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xee2a('0x4')],'set':function(_0x34415c){var _0x5d10bc=moment(_0x34415c);var _0xfc13ac=moment(this[_0xee2a('0x5')](_0xee2a('0x6')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x18a681=_0x5d10bc['diff'](_0xfc13ac,_0xee2a('0x7'));this[_0xee2a('0x8')](_0xee2a('0x9'),_0x34415c);this['setDataValue'](_0xee2a('0xa'),_0x18a681||null);}},'position':{'type':Sequelize[_0xee2a('0xb')]},'count':{'type':Sequelize[_0xee2a('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xee2a('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xee2a('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xee2a('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xee2a('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xee2a('0xd')},'originalposition':{'type':Sequelize[_0xee2a('0xb')]},'channel':{'type':Sequelize[_0xee2a('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xee2a('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xee2a('0x3')]},'holdtime':{'type':Sequelize[_0xee2a('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xee2a('0x3')]},'transfer':{'type':Sequelize[_0xee2a('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xee2a('0x3')],'comment':_0xee2a('0xe')},'transferexten':{'type':Sequelize[_0xee2a('0x3')]},'transferuniqueid':{'type':Sequelize[_0xee2a('0x3')]},'disposition':{'type':Sequelize[_0xee2a('0x3')]},'secondDisposition':{'type':Sequelize[_0xee2a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xee2a('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xee2a('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xee2a('0x3')]}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 44d204e..a6c7916 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 _0x71be=['Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','catch','body','find','params','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','limit','offset','count'];(function(_0x5df398,_0x3edb38){var _0x16b56d=function(_0x551463){while(--_0x551463){_0x5df398['push'](_0x5df398['shift']());}};_0x16b56d(++_0x3edb38);}(_0x71be,0x188));var _0xe71b=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x71be[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require(_0xe71b('0x0'));var rimraf=require(_0xe71b('0x1'));var zipdir=require(_0xe71b('0x2'));var jsonpatch=require(_0xe71b('0x3'));var rp=require(_0xe71b('0x4'));var moment=require(_0xe71b('0x5'));var BPromise=require(_0xe71b('0x6'));var Mustache=require(_0xe71b('0x7'));var util=require(_0xe71b('0x8'));var path=require(_0xe71b('0x9'));var sox=require(_0xe71b('0xa'));var csv=require(_0xe71b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe71b('0xc'));var _=require(_0xe71b('0xd'));var squel=require(_0xe71b('0xe'));var crypto=require(_0xe71b('0xf'));var jsforce=require(_0xe71b('0x10'));var deskjs=require(_0xe71b('0x11'));var toCsv=require(_0xe71b('0xb'));var querystring=require(_0xe71b('0x12'));var Papa=require(_0xe71b('0x13'));var Redis=require(_0xe71b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe71b('0x15'));var as=require(_0xe71b('0x16'));var hardwareService=require(_0xe71b('0x17'));var logger=require(_0xe71b('0x18'))(_0xe71b('0x19'));var utils=require(_0xe71b('0x1a'));var config=require(_0xe71b('0x1b'));var licenseUtil=require(_0xe71b('0x1c'));var db=require(_0xe71b('0x1d'))['db'];config['redis']=_[_0xe71b('0x1e')](config[_0xe71b('0x1f')],{'host':_0xe71b('0x20'),'port':0x18eb});var socket=require(_0xe71b('0x21'))(new Redis(config[_0xe71b('0x1f')]));require(_0xe71b('0x22'))[_0xe71b('0x23')](socket);function respondWithStatusCode(_0x2313b2,_0x22807b){_0x22807b=_0x22807b||0xcc;return function(_0x4d4f15){if(_0x4d4f15){return _0x2313b2[_0xe71b('0x24')](_0x22807b);}return _0x2313b2[_0xe71b('0x25')](_0x22807b)[_0xe71b('0x26')]();};}function respondWithResult(_0x1103ef,_0x44224d){_0x44224d=_0x44224d||0xc8;return function(_0x4ce40d){if(_0x4ce40d){return _0x1103ef[_0xe71b('0x25')](_0x44224d)[_0xe71b('0x27')](_0x4ce40d);}};}function respondWithFilteredResult(_0x51f0b5,_0x11818f){return function(_0x2284b9){if(_0x2284b9){var _0x555147=typeof _0x11818f['offset']==='undefined'&&typeof _0x11818f[_0xe71b('0x28')]==='undefined';var _0x27ac1a=_0x2284b9['count'];var _0x1433df=_0x555147?0x0:_0x11818f[_0xe71b('0x29')];var _0x527e2a=_0x555147?_0x2284b9[_0xe71b('0x2a')]:_0x11818f['offset']+_0x11818f[_0xe71b('0x28')];var _0x49e524;if(_0x527e2a>=_0x27ac1a){_0x527e2a=_0x27ac1a;_0x49e524=0xc8;}else{_0x49e524=0xce;}_0x51f0b5[_0xe71b('0x25')](_0x49e524);return _0x51f0b5['set'](_0xe71b('0x2b'),_0x1433df+'-'+_0x527e2a+'/'+_0x27ac1a)['json'](_0x2284b9);}return null;};}function patchUpdates(_0x37128d){return function(_0x59c6d1){try{jsonpatch[_0xe71b('0x2c')](_0x59c6d1,_0x37128d,!![]);}catch(_0x851b3){return BPromise['reject'](_0x851b3);}return _0x59c6d1[_0xe71b('0x2d')]();};}function saveUpdates(_0x2dd4b8,_0x416c66){return function(_0x5e3458){if(_0x5e3458){return _0x5e3458[_0xe71b('0x2e')](_0x2dd4b8)[_0xe71b('0x2f')](function(_0x27956a){return _0x27956a;});}return null;};}function removeEntity(_0x82c600,_0x29ed4e){return function(_0x56d626){if(_0x56d626){return _0x56d626[_0xe71b('0x30')]()[_0xe71b('0x2f')](function(){_0x82c600[_0xe71b('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430a8f,_0x17301f){return function(_0x5c6e63){if(!_0x5c6e63){_0x430a8f[_0xe71b('0x24')](0x194);}return _0x5c6e63;};}function handleError(_0x55986e,_0x4ca0be){_0x4ca0be=_0x4ca0be||0x1f4;return function(_0x35ca42){logger[_0xe71b('0x31')](_0x35ca42[_0xe71b('0x32')]);if(_0x35ca42[_0xe71b('0x33')]){delete _0x35ca42['name'];}_0x55986e[_0xe71b('0x25')](_0x4ca0be)[_0xe71b('0x34')](_0x35ca42);};}exports[_0xe71b('0x35')]=function(_0x58c286,_0x10e688){var _0x3ea85c={},_0x3ec4cb={},_0x2315b7={'count':0x0,'rows':[]};var _0x5948b1=_['map'](db[_0xe71b('0x36')]['rawAttributes'],function(_0x570fe5){return{'name':_0x570fe5['fieldName'],'type':_0x570fe5['type']['key']};});_0x3ec4cb[_0xe71b('0x37')]=_[_0xe71b('0x38')](_0x5948b1,'name');_0x3ec4cb[_0xe71b('0x39')]=_[_0xe71b('0x3a')](_0x58c286['query']);_0x3ec4cb[_0xe71b('0x3b')]=_[_0xe71b('0x3c')](_0x3ec4cb['model'],_0x3ec4cb[_0xe71b('0x39')]);_0x3ea85c['attributes']=_[_0xe71b('0x3c')](_0x3ec4cb['model'],qs[_0xe71b('0x3d')](_0x58c286[_0xe71b('0x39')][_0xe71b('0x3d')]));_0x3ea85c[_0xe71b('0x3e')]=_0x3ea85c[_0xe71b('0x3e')][_0xe71b('0x3f')]?_0x3ea85c[_0xe71b('0x3e')]:_0x3ec4cb[_0xe71b('0x37')];if(!_0x58c286[_0xe71b('0x39')]['hasOwnProperty'](_0xe71b('0x40'))){_0x3ea85c[_0xe71b('0x28')]=qs[_0xe71b('0x28')](_0x58c286[_0xe71b('0x39')][_0xe71b('0x28')]);_0x3ea85c['offset']=qs[_0xe71b('0x29')](_0x58c286[_0xe71b('0x39')][_0xe71b('0x29')]);}_0x3ea85c[_0xe71b('0x41')]=qs[_0xe71b('0x42')](_0x58c286[_0xe71b('0x39')][_0xe71b('0x42')]);_0x3ea85c[_0xe71b('0x43')]=qs[_0xe71b('0x3b')](_[_0xe71b('0x44')](_0x58c286['query'],_0x3ec4cb['filters']),_0x5948b1);if(_0x58c286[_0xe71b('0x39')][_0xe71b('0x45')]){_0x3ea85c[_0xe71b('0x43')]=_[_0xe71b('0x46')](_0x3ea85c[_0xe71b('0x43')],{'$or':_['map'](_0x5948b1,function(_0x8ea760){if(_0x8ea760[_0xe71b('0x47')]!==_0xe71b('0x48')){var _0x4040ce={};_0x4040ce[_0x8ea760[_0xe71b('0x33')]]={'$like':'%'+_0x58c286[_0xe71b('0x39')][_0xe71b('0x45')]+'%'};return _0x4040ce;}})});}_0x3ea85c=_[_0xe71b('0x46')]({},_0x3ea85c,_0x58c286[_0xe71b('0x49')]);var _0x20ad63={'where':_0x3ea85c[_0xe71b('0x43')]};return db[_0xe71b('0x36')][_0xe71b('0x2a')](_0x20ad63)[_0xe71b('0x2f')](function(_0xc5fba3){_0x2315b7[_0xe71b('0x2a')]=_0xc5fba3;if(_0x58c286[_0xe71b('0x39')][_0xe71b('0x4a')]){_0x3ea85c[_0xe71b('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe71b('0x4c')](_0x3ea85c);})[_0xe71b('0x2f')](function(_0x32152e){_0x2315b7[_0xe71b('0x4d')]=_0x32152e;return _0x2315b7;})['then'](respondWithFilteredResult(_0x10e688,_0x3ea85c))['catch'](handleError(_0x10e688,null));};exports[_0xe71b('0x4e')]=function(_0x912b4c,_0x5eae1c){var _0x199e25={'raw':![],'where':{'id':_0x912b4c['params']['id']}},_0x12606e={};_0x12606e[_0xe71b('0x37')]=_['keys'](db[_0xe71b('0x36')][_0xe71b('0x4f')]);_0x12606e[_0xe71b('0x39')]=_[_0xe71b('0x3a')](_0x912b4c[_0xe71b('0x39')]);_0x12606e[_0xe71b('0x3b')]=_['intersection'](_0x12606e[_0xe71b('0x37')],_0x12606e[_0xe71b('0x39')]);_0x199e25[_0xe71b('0x3e')]=_[_0xe71b('0x3c')](_0x12606e[_0xe71b('0x37')],qs['fields'](_0x912b4c[_0xe71b('0x39')][_0xe71b('0x3d')]));_0x199e25['attributes']=_0x199e25['attributes'][_0xe71b('0x3f')]?_0x199e25[_0xe71b('0x3e')]:_0x12606e[_0xe71b('0x37')];if(_0x912b4c['query'][_0xe71b('0x4a')]){_0x199e25[_0xe71b('0x4b')]=[{'all':!![]}];}_0x199e25=_['merge']({},_0x199e25,_0x912b4c[_0xe71b('0x49')]);return db[_0xe71b('0x36')]['find'](_0x199e25)[_0xe71b('0x2f')](handleEntityNotFound(_0x5eae1c,null))['then'](respondWithResult(_0x5eae1c,null))[_0xe71b('0x50')](handleError(_0x5eae1c,null));};exports['create']=function(_0x182d6b,_0x25fd7e){return db[_0xe71b('0x36')]['create'](_0x182d6b[_0xe71b('0x51')],{})[_0xe71b('0x2f')](respondWithResult(_0x25fd7e,0xc9))[_0xe71b('0x50')](handleError(_0x25fd7e,null));};exports[_0xe71b('0x2e')]=function(_0x237cc3,_0x375352){if(_0x237cc3[_0xe71b('0x51')]['id']){delete _0x237cc3[_0xe71b('0x51')]['id'];}return db[_0xe71b('0x36')][_0xe71b('0x52')]({'where':{'id':_0x237cc3[_0xe71b('0x53')]['id']}})[_0xe71b('0x2f')](handleEntityNotFound(_0x375352,null))['then'](saveUpdates(_0x237cc3[_0xe71b('0x51')],null))['then'](respondWithResult(_0x375352,null))[_0xe71b('0x50')](handleError(_0x375352,null));};exports[_0xe71b('0x30')]=function(_0x59668c,_0x8faa7c){return db[_0xe71b('0x36')][_0xe71b('0x52')]({'where':{'id':_0x59668c[_0xe71b('0x53')]['id']}})[_0xe71b('0x2f')](handleEntityNotFound(_0x8faa7c,null))[_0xe71b('0x2f')](removeEntity(_0x8faa7c,null))[_0xe71b('0x50')](handleError(_0x8faa7c,null));};exports[_0xe71b('0x54')]=function(_0x219aa7,_0x45333a){return db[_0xe71b('0x36')][_0xe71b('0x54')]()[_0xe71b('0x2f')](respondWithResult(_0x45333a,null))[_0xe71b('0x50')](handleError(_0x45333a,null));};exports[_0xe71b('0x55')]=function(_0x356c1a,_0xa91cc3){var _0x3681a6={},_0x242ad9={},_0x4c4021={'count':0x0,'rows':[]};_0x242ad9[_0xe71b('0x37')]=_[_0xe71b('0x3a')](db[_0xe71b('0x36')][_0xe71b('0x4f')]);_0x242ad9[_0xe71b('0x39')]=_[_0xe71b('0x3a')](_0x356c1a[_0xe71b('0x39')]);_0x242ad9[_0xe71b('0x3b')]=_[_0xe71b('0x3c')](_0x242ad9['model'],_0x242ad9[_0xe71b('0x39')]);_0x3681a6['attributes']=_['intersection'](_0x242ad9[_0xe71b('0x37')],qs[_0xe71b('0x3d')](_0x356c1a['query'][_0xe71b('0x3d')]));_0x3681a6['attributes']=_0x3681a6[_0xe71b('0x3e')][_0xe71b('0x3f')]?_0x3681a6['attributes']:_0x242ad9[_0xe71b('0x37')];if(!_0x356c1a[_0xe71b('0x39')][_0xe71b('0x56')]('nolimit')){_0x3681a6['limit']=qs[_0xe71b('0x28')](_0x356c1a[_0xe71b('0x39')][_0xe71b('0x28')]);_0x3681a6['offset']=qs[_0xe71b('0x29')](_0x356c1a[_0xe71b('0x39')]['offset']);}_0x3681a6[_0xe71b('0x41')]=qs[_0xe71b('0x42')](_0x356c1a['query'][_0xe71b('0x42')]);_0x3681a6[_0xe71b('0x43')]=qs[_0xe71b('0x3b')](_['pick'](_0x356c1a['query'],_0x242ad9[_0xe71b('0x3b')]));if(_0x356c1a[_0xe71b('0x39')]['filter']){_0x3681a6['where']=_[_0xe71b('0x46')](_0x3681a6['where'],{'$or':_[_0xe71b('0x38')](_0x3681a6['attributes'],function(_0xe1dff2){var _0x25665d={};_0x25665d[_0xe1dff2]={'$like':'%'+_0x356c1a['query'][_0xe71b('0x45')]+'%'};return _0x25665d;})});}_0x3681a6=_['merge']({},_0x3681a6,_0x356c1a[_0xe71b('0x49')]);var _0x47ee88={'where':_0x3681a6[_0xe71b('0x43')]};return db[_0xe71b('0x36')][_0xe71b('0x2a')](_0x47ee88)[_0xe71b('0x2f')](function(_0x2785da){_0x4c4021[_0xe71b('0x2a')]=_0x2785da;if(_0x356c1a[_0xe71b('0x39')][_0xe71b('0x4a')]){_0x3681a6['include']=[{'all':!![]}];}return db[_0xe71b('0x36')][_0xe71b('0x4c')](_0x3681a6);})[_0xe71b('0x2f')](function(_0x485631){_0x4c4021[_0xe71b('0x4d')]=_0x485631;return _0x4c4021;})[_0xe71b('0x2f')](respondWithFilteredResult(_0xa91cc3,_0x3681a6,_0xe71b('0x55')))[_0xe71b('0x50')](handleError(_0xa91cc3,null,_0xe71b('0x55')));}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index c4241b1..4f78b92 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 _0x3c55=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','update'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3c55,0x97));var _0x53c5=function(_0x1b655d,_0x1750de){_0x1b655d=_0x1b655d-0x0;var _0x3d2a2a=_0x3c55[_0x1b655d];return _0x3d2a2a;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x53c5('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x53c5('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x53c5('0x2'),'afterDestroy':_0x53c5('0x3')};function emitEvent(_0x3ac52c){return function(_0x50647c,_0x9f87f8,_0x54b9af){VoiceQueueReportEvents[_0x53c5('0x4')](_0x3ac52c+':'+_0x50647c['id'],_0x50647c);VoiceQueueReportEvents['emit'](_0x3ac52c,_0x50647c);_0x54b9af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x53c5('0x5')](e,emitEvent(event));}}module[_0x53c5('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c2bb9ad..6d27eeb 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 _0xc919=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xc919,0x1c8));var _0x9c91=function(_0x5588cd,_0x1259da){_0x5588cd=_0x5588cd-0x0;var _0x13934e=_0xc919[_0x5588cd];return _0x13934e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9c91('0x0'))(_0x9c91('0x1'));var moment=require(_0x9c91('0x2'));var BPromise=require(_0x9c91('0x3'));var rp=require(_0x9c91('0x4'));var fs=require('fs');var path=require(_0x9c91('0x5'));var rimraf=require(_0x9c91('0x6'));var config=require(_0x9c91('0x7'));var attributes=require(_0x9c91('0x8'));module[_0x9c91('0x9')]=function(_0x484ac4,_0x4837cb){return _0x484ac4['define']('VoiceQueueReport',attributes,{'tableName':_0x9c91('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9c91('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 2c61331..fcc6294 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 _0x8d0d=['request\x20sent','debug','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x2dc786,_0x49378d){var _0x5f0e7e=function(_0x3cbcb4){while(--_0x3cbcb4){_0x2dc786['push'](_0x2dc786['shift']());}};_0x5f0e7e(++_0x49378d);}(_0x8d0d,0x6b));var _0xd8d0=function(_0x25c95e,_0x503ac4){_0x25c95e=_0x25c95e-0x0;var _0x207184=_0x8d0d[_0x25c95e];return _0x207184;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8d0('0x0'));var BPromise=require('bluebird');var rs=require(_0xd8d0('0x1'));var fs=require('fs');var Redis=require(_0xd8d0('0x2'));var db=require(_0xd8d0('0x3'))['db'];var utils=require(_0xd8d0('0x4'));var logger=require(_0xd8d0('0x5'))(_0xd8d0('0x6'));var config=require(_0xd8d0('0x7'));var jayson=require(_0xd8d0('0x8'));var client=jayson[_0xd8d0('0x9')][_0xd8d0('0xa')]({'port':0x232a});config[_0xd8d0('0xb')]=_[_0xd8d0('0xc')](config[_0xd8d0('0xb')],{'host':_0xd8d0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xd8d0('0xe')](socket);function respondWithRpcPromise(_0x23b73a,_0x297f14,_0x2376d4){return new BPromise(function(_0x203b12,_0x23c45b){return client[_0xd8d0('0xf')](_0x23b73a,_0x2376d4)[_0xd8d0('0x10')](function(_0x4be89d){logger[_0xd8d0('0x11')](_0xd8d0('0x12'),_0x297f14,_0xd8d0('0x13'));logger[_0xd8d0('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x297f14,'request\x20sent',JSON['stringify'](_0x4be89d));if(_0x4be89d[_0xd8d0('0x15')]){if(_0x4be89d[_0xd8d0('0x15')][_0xd8d0('0x16')]===0x1f4){logger[_0xd8d0('0x15')](_0xd8d0('0x12'),_0x297f14,_0x4be89d[_0xd8d0('0x15')][_0xd8d0('0x17')]);return _0x23c45b(_0x4be89d[_0xd8d0('0x15')][_0xd8d0('0x17')]);}logger['error'](_0xd8d0('0x12'),_0x297f14,_0x4be89d[_0xd8d0('0x15')][_0xd8d0('0x17')]);return _0x203b12(_0x4be89d[_0xd8d0('0x15')][_0xd8d0('0x17')]);}else{logger[_0xd8d0('0x11')](_0xd8d0('0x12'),_0x297f14,_0xd8d0('0x13'));_0x203b12(_0x4be89d[_0xd8d0('0x18')][_0xd8d0('0x17')]);}})[_0xd8d0('0x19')](function(_0x498568){logger[_0xd8d0('0x15')](_0xd8d0('0x12'),_0x297f14,_0x498568);_0x23c45b(_0x498568);});});}exports[_0xd8d0('0x1a')]=function(_0x41a646){var _0x456c43=this;return new Promise(function(_0x324e29,_0x16f88a){return db[_0xd8d0('0x1b')][_0xd8d0('0x1c')]({'raw':_0x41a646['options']?_0x41a646[_0xd8d0('0x1d')][_0xd8d0('0x1e')]===undefined?!![]:![]:!![],'where':_0x41a646[_0xd8d0('0x1d')]?_0x41a646[_0xd8d0('0x1d')]['where']||null:null,'attributes':_0x41a646['options']?_0x41a646[_0xd8d0('0x1d')][_0xd8d0('0x1f')]||null:null,'limit':_0x41a646[_0xd8d0('0x1d')]?_0x41a646[_0xd8d0('0x1d')]['limit']||null:null,'include':_0x41a646[_0xd8d0('0x1d')]?_0x41a646[_0xd8d0('0x1d')][_0xd8d0('0x20')]?_[_0xd8d0('0x21')](_0x41a646[_0xd8d0('0x1d')]['include'],function(_0x58446f){return{'model':db[_0x58446f[_0xd8d0('0x22')]],'as':_0x58446f['as'],'attributes':_0x58446f['attributes'],'include':_0x58446f['include']?_['map'](_0x58446f[_0xd8d0('0x20')],function(_0x4b0c10){return{'model':db[_0x4b0c10[_0xd8d0('0x22')]],'as':_0x4b0c10['as'],'attributes':_0x4b0c10[_0xd8d0('0x1f')],'include':_0x4b0c10[_0xd8d0('0x20')]?_['map'](_0x4b0c10[_0xd8d0('0x20')],function(_0x2baae6){return{'model':db[_0x2baae6[_0xd8d0('0x22')]],'as':_0x2baae6['as'],'attributes':_0x2baae6[_0xd8d0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd8d0('0x10')](function(_0x383b53){logger[_0xd8d0('0x11')](_0xd8d0('0x1a'),_0x41a646);logger['debug'](_0xd8d0('0x1a'),_0x41a646,JSON[_0xd8d0('0x23')](_0x383b53));_0x324e29(_0x383b53);})['catch'](function(_0x109809){logger[_0xd8d0('0x15')]('GetVoiceQueueReport',_0x109809[_0xd8d0('0x17')],_0x41a646);_0x16f88a(_0x456c43[_0xd8d0('0x15')](0x1f4,_0x109809[_0xd8d0('0x17')]));});});};exports[_0xd8d0('0x24')]=function(_0x182ce8){var _0x214c13=this;return new Promise(function(_0x155852,_0x5e730b){return db[_0xd8d0('0x1b')][_0xd8d0('0x25')](_0x182ce8[_0xd8d0('0x26')],{'raw':_0x182ce8[_0xd8d0('0x1d')]?_0x182ce8[_0xd8d0('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x329afa){logger['info'](_0xd8d0('0x24'),_0x182ce8);logger[_0xd8d0('0x14')]('CreateVoiceQueueReport',_0x182ce8,JSON[_0xd8d0('0x23')](_0x329afa));_0x155852(_0x329afa);})[_0xd8d0('0x19')](function(_0x1df504){logger[_0xd8d0('0x15')](_0xd8d0('0x24'),_0x1df504[_0xd8d0('0x17')],_0x182ce8);_0x5e730b(_0x214c13[_0xd8d0('0x15')](0x1f4,_0x1df504['message']));});});};exports[_0xd8d0('0x27')]=function(_0x1f9602){var _0x5f109d=this;return new Promise(function(_0x27d769,_0x55374d){return db[_0xd8d0('0x1b')][_0xd8d0('0x28')](_0x1f9602[_0xd8d0('0x26')],{'raw':_0x1f9602[_0xd8d0('0x1d')]?_0x1f9602[_0xd8d0('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9602['options']?_0x1f9602[_0xd8d0('0x1d')][_0xd8d0('0x29')]||null:null,'attributes':_0x1f9602[_0xd8d0('0x1d')]?_0x1f9602[_0xd8d0('0x1d')]['attributes']||null:null,'limit':_0x1f9602[_0xd8d0('0x1d')]?_0x1f9602[_0xd8d0('0x1d')]['limit']||null:null})['then'](function(_0x182f48){logger[_0xd8d0('0x11')]('UpdateVoiceQueueReport',_0x1f9602);logger[_0xd8d0('0x14')](_0xd8d0('0x27'),_0x1f9602,JSON['stringify'](_0x182f48));_0x27d769(_0x182f48);})['catch'](function(_0x25abf4){logger[_0xd8d0('0x15')](_0xd8d0('0x27'),_0x25abf4['message'],_0x1f9602);_0x55374d(_0x5f109d['error'](0x1f4,_0x25abf4['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 4aa78e3..94fda28 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 _0x65ff=['emit','removeListener','voiceQueueReport:','save','remove','update'];(function(_0x506d66,_0x51e19b){var _0x3cbb8e=function(_0x3d101a){while(--_0x3d101a){_0x506d66['push'](_0x506d66['shift']());}};_0x3cbb8e(++_0x51e19b);}(_0x65ff,0x1dd));var _0xf65f=function(_0x531722,_0x161aa9){_0x531722=_0x531722-0x0;var _0x3f1769=_0x65ff[_0x531722];return _0x3f1769;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xf65f('0x0'),_0xf65f('0x1'),_0xf65f('0x2')];function createListener(_0x55fc56,_0x59bbb9){return function(_0x194209){_0x59bbb9[_0xf65f('0x3')](_0x55fc56,_0x194209);};}function removeListener(_0x281fd9,_0x494237){return function(){VoiceQueueReportEvents[_0xf65f('0x4')](_0x281fd9,_0x494237);};}exports['register']=function(_0x32d5cc){for(var _0x51716e=0x0,_0x2859b7=events['length'];_0x51716e<_0x2859b7;_0x51716e++){var _0x24d062=events[_0x51716e];var _0x131e77=createListener(_0xf65f('0x5')+_0x24d062,_0x32d5cc);VoiceQueueReportEvents['on'](_0x24d062,_0x131e77);}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 44290c0..bdab7e6 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 _0x338e=['/:id','post','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x317fa2,_0x5ac374){var _0x3d7e1a=function(_0x1ec9a8){while(--_0x1ec9a8){_0x317fa2['push'](_0x317fa2['shift']());}};_0x3d7e1a(++_0x5ac374);}(_0x338e,0x137));var _0xe338=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x338e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe338('0x0'));var util=require(_0xe338('0x1'));var path=require(_0xe338('0x2'));var timeout=require(_0xe338('0x3'));var express=require('express');var router=express[_0xe338('0x4')]();var fs_extra=require(_0xe338('0x5'));var auth=require(_0xe338('0x6'));var interaction=require(_0xe338('0x7'));var config=require(_0xe338('0x8'));var controller=require(_0xe338('0x9'));router[_0xe338('0xa')]('/',auth[_0xe338('0xb')](),controller[_0xe338('0xc')]);router[_0xe338('0xa')](_0xe338('0xd'),auth[_0xe338('0xb')](),controller['show']);router[_0xe338('0xe')]('/',auth[_0xe338('0xb')](),controller[_0xe338('0xf')]);router['put']('/:id',auth[_0xe338('0xb')](),controller['update']);router[_0xe338('0x10')](_0xe338('0xd'),auth[_0xe338('0xb')](),controller['destroy']);module[_0xe338('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e8f8d24..8ec7fec 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 _0x1bfe=['STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x51c644,_0x3e4af2){var _0x128266=function(_0xd14bc0){while(--_0xd14bc0){_0x51c644['push'](_0x51c644['shift']());}};_0x128266(++_0x3e4af2);}(_0x1bfe,0xc3));var _0xe1bf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1bfe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xe1bf('0x0'));var moment=require(_0xe1bf('0x1'));module[_0xe1bf('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xe1bf('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe1bf('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe1bf('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe1bf('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe1bf('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xe1bf('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe1bf('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xe1bf('0x5'))}}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 34fd7c0..617dece 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 _0x3089=['keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','VoiceQueuesLog','fieldName','query'];(function(_0x53f22c,_0x53a20f){var _0x10ef81=function(_0x2788da){while(--_0x2788da){_0x53f22c['push'](_0x53f22c['shift']());}};_0x10ef81(++_0x53a20f);}(_0x3089,0x13c));var _0x9308=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3089[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0x9308('0x0'));var rimraf=require(_0x9308('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9308('0x2'));var rp=require(_0x9308('0x3'));var moment=require(_0x9308('0x4'));var BPromise=require(_0x9308('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9308('0x6'));var csv=require('to-csv');var ejs=require(_0x9308('0x7'));var fs=require('fs');var fs_extra=require(_0x9308('0x8'));var _=require(_0x9308('0x9'));var squel=require(_0x9308('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9308('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9308('0xc'));var Papa=require(_0x9308('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9308('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9308('0xf'));var logger=require('../../config/logger')(_0x9308('0x10'));var utils=require(_0x9308('0x11'));var config=require(_0x9308('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9308('0x13'))['db'];function respondWithStatusCode(_0xf6dba9,_0x145aea){_0x145aea=_0x145aea||0xcc;return function(_0x245d20){if(_0x245d20){return _0xf6dba9['sendStatus'](_0x145aea);}return _0xf6dba9['status'](_0x145aea)[_0x9308('0x14')]();};}function respondWithResult(_0x1723b6,_0x2ba0ba){_0x2ba0ba=_0x2ba0ba||0xc8;return function(_0x30ee3e){if(_0x30ee3e){return _0x1723b6[_0x9308('0x15')](_0x2ba0ba)[_0x9308('0x16')](_0x30ee3e);}};}function respondWithFilteredResult(_0x45c3c7,_0xb24d42){return function(_0x1fd989){if(_0x1fd989){var _0xa7c2e7=typeof _0xb24d42[_0x9308('0x17')]===_0x9308('0x18')&&typeof _0xb24d42[_0x9308('0x19')]===_0x9308('0x18');var _0x33be4a=_0x1fd989['count'];var _0x1aa8a8=_0xa7c2e7?0x0:_0xb24d42['offset'];var _0x1ca3a7=_0xa7c2e7?_0x1fd989[_0x9308('0x1a')]:_0xb24d42[_0x9308('0x17')]+_0xb24d42['limit'];var _0x40f382;if(_0x1ca3a7>=_0x33be4a){_0x1ca3a7=_0x33be4a;_0x40f382=0xc8;}else{_0x40f382=0xce;}_0x45c3c7[_0x9308('0x15')](_0x40f382);return _0x45c3c7[_0x9308('0x1b')](_0x9308('0x1c'),_0x1aa8a8+'-'+_0x1ca3a7+'/'+_0x33be4a)[_0x9308('0x16')](_0x1fd989);}return null;};}function patchUpdates(_0x522c0a){return function(_0x34935e){try{jsonpatch[_0x9308('0x1d')](_0x34935e,_0x522c0a,!![]);}catch(_0x4cda3a){return BPromise[_0x9308('0x1e')](_0x4cda3a);}return _0x34935e[_0x9308('0x1f')]();};}function saveUpdates(_0xe97aca,_0x19fbfe){return function(_0xe5d008){if(_0xe5d008){return _0xe5d008[_0x9308('0x20')](_0xe97aca)[_0x9308('0x21')](function(_0x3ce86d){return _0x3ce86d;});}return null;};}function removeEntity(_0xc1ced4,_0x46ba4c){return function(_0x141a31){if(_0x141a31){return _0x141a31[_0x9308('0x22')]()[_0x9308('0x21')](function(){_0xc1ced4[_0x9308('0x15')](0xcc)[_0x9308('0x14')]();});}};}function handleEntityNotFound(_0x54c2e0,_0x2d1100){return function(_0x92c04b){if(!_0x92c04b){_0x54c2e0[_0x9308('0x23')](0x194);}return _0x92c04b;};}function handleError(_0x116e33,_0x4e91c8){_0x4e91c8=_0x4e91c8||0x1f4;return function(_0x39b45c){logger[_0x9308('0x24')](_0x39b45c[_0x9308('0x25')]);if(_0x39b45c[_0x9308('0x26')]){delete _0x39b45c[_0x9308('0x26')];}_0x116e33[_0x9308('0x15')](_0x4e91c8)[_0x9308('0x27')](_0x39b45c);};}exports['index']=function(_0x3c167f,_0x25553e){var _0x257494={},_0x425ff0={},_0x31ae1d={'count':0x0,'rows':[]};var _0x130955=_[_0x9308('0x28')](db[_0x9308('0x29')]['rawAttributes'],function(_0x164b26){return{'name':_0x164b26[_0x9308('0x2a')],'type':_0x164b26['type']['key']};});_0x425ff0['model']=_[_0x9308('0x28')](_0x130955,_0x9308('0x26'));_0x425ff0[_0x9308('0x2b')]=_[_0x9308('0x2c')](_0x3c167f[_0x9308('0x2b')]);_0x425ff0['filters']=_[_0x9308('0x2d')](_0x425ff0[_0x9308('0x2e')],_0x425ff0[_0x9308('0x2b')]);_0x257494[_0x9308('0x2f')]=_[_0x9308('0x2d')](_0x425ff0['model'],qs[_0x9308('0x30')](_0x3c167f['query'][_0x9308('0x30')]));_0x257494[_0x9308('0x2f')]=_0x257494['attributes'][_0x9308('0x31')]?_0x257494[_0x9308('0x2f')]:_0x425ff0[_0x9308('0x2e')];if(!_0x3c167f['query'][_0x9308('0x32')](_0x9308('0x33'))){_0x257494[_0x9308('0x19')]=qs[_0x9308('0x19')](_0x3c167f['query']['limit']);_0x257494[_0x9308('0x17')]=qs[_0x9308('0x17')](_0x3c167f[_0x9308('0x2b')][_0x9308('0x17')]);}_0x257494[_0x9308('0x34')]=qs[_0x9308('0x35')](_0x3c167f['query'][_0x9308('0x35')]);_0x257494[_0x9308('0x36')]=qs[_0x9308('0x37')](_[_0x9308('0x38')](_0x3c167f['query'],_0x425ff0[_0x9308('0x37')]),_0x130955);if(_0x3c167f[_0x9308('0x2b')]['filter']){_0x257494[_0x9308('0x36')]=_[_0x9308('0x39')](_0x257494[_0x9308('0x36')],{'$or':_['map'](_0x130955,function(_0x18ec64){if(_0x18ec64[_0x9308('0x3a')]!==_0x9308('0x3b')){var _0x19e8d7={};_0x19e8d7[_0x18ec64[_0x9308('0x26')]]={'$like':'%'+_0x3c167f[_0x9308('0x2b')][_0x9308('0x3c')]+'%'};return _0x19e8d7;}})});}_0x257494=_[_0x9308('0x39')]({},_0x257494,_0x3c167f[_0x9308('0x3d')]);var _0xde2e6d={'where':_0x257494[_0x9308('0x36')]};return db[_0x9308('0x29')][_0x9308('0x1a')](_0xde2e6d)['then'](function(_0x4912c1){_0x31ae1d[_0x9308('0x1a')]=_0x4912c1;if(_0x3c167f[_0x9308('0x2b')][_0x9308('0x3e')]){_0x257494[_0x9308('0x3f')]=[{'all':!![]}];}return db[_0x9308('0x29')]['findAll'](_0x257494);})['then'](function(_0xe00f08){_0x31ae1d[_0x9308('0x40')]=_0xe00f08;return _0x31ae1d;})[_0x9308('0x21')](respondWithFilteredResult(_0x25553e,_0x257494))[_0x9308('0x41')](handleError(_0x25553e,null));};exports[_0x9308('0x42')]=function(_0x400a89,_0x3ee3cd){var _0x5d7288={'raw':!![],'where':{'id':_0x400a89['params']['id']}},_0x237d45={};_0x237d45[_0x9308('0x2e')]=_[_0x9308('0x2c')](db[_0x9308('0x29')][_0x9308('0x43')]);_0x237d45[_0x9308('0x2b')]=_[_0x9308('0x2c')](_0x400a89['query']);_0x237d45['filters']=_[_0x9308('0x2d')](_0x237d45[_0x9308('0x2e')],_0x237d45[_0x9308('0x2b')]);_0x5d7288[_0x9308('0x2f')]=_[_0x9308('0x2d')](_0x237d45[_0x9308('0x2e')],qs[_0x9308('0x30')](_0x400a89[_0x9308('0x2b')][_0x9308('0x30')]));_0x5d7288[_0x9308('0x2f')]=_0x5d7288[_0x9308('0x2f')][_0x9308('0x31')]?_0x5d7288[_0x9308('0x2f')]:_0x237d45['model'];if(_0x400a89['query'][_0x9308('0x3e')]){_0x5d7288[_0x9308('0x3f')]=[{'all':!![]}];}_0x5d7288=_['merge']({},_0x5d7288,_0x400a89[_0x9308('0x3d')]);return db['VoiceQueuesLog'][_0x9308('0x44')](_0x5d7288)[_0x9308('0x21')](handleEntityNotFound(_0x3ee3cd,null))[_0x9308('0x21')](respondWithResult(_0x3ee3cd,null))[_0x9308('0x41')](handleError(_0x3ee3cd,null));};exports['create']=function(_0x290372,_0x55d47c){return db[_0x9308('0x29')][_0x9308('0x45')](_0x290372[_0x9308('0x46')],{})[_0x9308('0x21')](respondWithResult(_0x55d47c,0xc9))[_0x9308('0x41')](handleError(_0x55d47c,null));};exports[_0x9308('0x20')]=function(_0x276f97,_0x3b2135){if(_0x276f97[_0x9308('0x46')]['id']){delete _0x276f97[_0x9308('0x46')]['id'];}return db[_0x9308('0x29')][_0x9308('0x44')]({'where':{'id':_0x276f97[_0x9308('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b2135,null))['then'](saveUpdates(_0x276f97[_0x9308('0x46')],null))[_0x9308('0x21')](respondWithResult(_0x3b2135,null))[_0x9308('0x41')](handleError(_0x3b2135,null));};exports[_0x9308('0x22')]=function(_0x2cfa95,_0x380696){return db[_0x9308('0x29')][_0x9308('0x44')]({'where':{'id':_0x2cfa95[_0x9308('0x47')]['id']}})[_0x9308('0x21')](handleEntityNotFound(_0x380696,null))[_0x9308('0x21')](removeEntity(_0x380696,null))[_0x9308('0x41')](handleError(_0x380696,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 187bc2b..ef4d3cc 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 _0x6453=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm'];(function(_0x130f61,_0x14fff6){var _0x541cb9=function(_0x68bec1){while(--_0x68bec1){_0x130f61['push'](_0x130f61['shift']());}};_0x541cb9(++_0x14fff6);}(_0x6453,0x88));var _0x3645=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x6453[_0x114b7c];return _0x47185f;};'use strict';var _=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var logger=require('../../config/logger')(_0x3645('0x2'));var moment=require(_0x3645('0x3'));var BPromise=require(_0x3645('0x4'));var rp=require(_0x3645('0x5'));var fs=require('fs');var path=require(_0x3645('0x6'));var rimraf=require(_0x3645('0x7'));var config=require(_0x3645('0x8'));var attributes=require(_0x3645('0x9'));module[_0x3645('0xa')]=function(_0x19b19c,_0xe951){return _0x19b19c[_0x3645('0xb')](_0x3645('0xc'),attributes,{'tableName':_0x3645('0xd'),'paranoid':![],'indexes':[{'name':_0x3645('0xe'),'fields':[_0x3645('0xf'),_0x3645('0x10')]}],'timestamps':![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 956edf6..85ebfeb 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 _0xd245=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','VoiceQueuesLog,\x20%s,\x20%s','message','info'];(function(_0x31f69d,_0x1b0cc8){var _0x2ff4c5=function(_0x2629e8){while(--_0x2629e8){_0x31f69d['push'](_0x31f69d['shift']());}};_0x2ff4c5(++_0x1b0cc8);}(_0xd245,0xd3));var _0x5d24=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xd245[_0x590a38];return _0xf36626;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var moment=require(_0x5d24('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d24('0x3'));var fs=require('fs');var Redis=require(_0x5d24('0x4'));var db=require(_0x5d24('0x5'))['db'];var utils=require(_0x5d24('0x6'));var logger=require(_0x5d24('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d24('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e8dc1,_0x15da67,_0x2d34c1){return new BPromise(function(_0x11f53e,_0x3d3900){return client[_0x5d24('0x9')](_0x1e8dc1,_0x2d34c1)['then'](function(_0xd7b76c){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x15da67,_0x5d24('0xa'));logger[_0x5d24('0xb')](_0x5d24('0xc'),_0x15da67,_0x5d24('0xa'),JSON['stringify'](_0xd7b76c));if(_0xd7b76c['error']){if(_0xd7b76c[_0x5d24('0xd')]['code']===0x1f4){logger[_0x5d24('0xd')](_0x5d24('0xe'),_0x15da67,_0xd7b76c['error'][_0x5d24('0xf')]);return _0x3d3900(_0xd7b76c['error'][_0x5d24('0xf')]);}logger['error'](_0x5d24('0xe'),_0x15da67,_0xd7b76c[_0x5d24('0xd')][_0x5d24('0xf')]);return _0x11f53e(_0xd7b76c[_0x5d24('0xd')][_0x5d24('0xf')]);}else{logger[_0x5d24('0x10')](_0x5d24('0xe'),_0x15da67,'request\x20sent');_0x11f53e(_0xd7b76c[_0x5d24('0x11')][_0x5d24('0xf')]);}})[_0x5d24('0x12')](function(_0x5c187b){logger[_0x5d24('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x15da67,_0x5c187b);_0x3d3900(_0x5c187b);});});} \ No newline at end of file +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 diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c69aab8..e39a705 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 _0x0cc6=['/:id/download','download','downloads','create','post','/:id/transcribe','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x286a7f,_0x21db56){var _0x3faca1=function(_0x57ee62){while(--_0x57ee62){_0x286a7f['push'](_0x286a7f['shift']());}};_0x3faca1(++_0x21db56);}(_0x0cc6,0x1a1));var _0x60cc=function(_0x1b3f63,_0x5578c9){_0x1b3f63=_0x1b3f63-0x0;var _0x39005d=_0x0cc6[_0x1b3f63];return _0x39005d;};'use strict';var multer=require(_0x60cc('0x0'));var util=require(_0x60cc('0x1'));var path=require(_0x60cc('0x2'));var timeout=require(_0x60cc('0x3'));var express=require(_0x60cc('0x4'));var router=express['Router']();var fs_extra=require(_0x60cc('0x5'));var auth=require(_0x60cc('0x6'));var interaction=require(_0x60cc('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x60cc('0x8')]('/',auth[_0x60cc('0x9')](),controller[_0x60cc('0xa')]);router['get'](_0x60cc('0xb'),auth[_0x60cc('0x9')](),controller[_0x60cc('0xc')]);router['get'](_0x60cc('0xd'),auth[_0x60cc('0x9')](),controller[_0x60cc('0xe')]);router[_0x60cc('0x8')](_0x60cc('0xf'),auth[_0x60cc('0x9')](),controller[_0x60cc('0x10')]);router['get']('/:id/downloads',controller[_0x60cc('0x11')]);router[_0x60cc('0x8')]('/:id/transcribe',auth[_0x60cc('0x9')](),controller['downloadTranscribe']);router['post']('/',auth[_0x60cc('0x9')](),controller[_0x60cc('0x12')]);router[_0x60cc('0x13')](_0x60cc('0x14'),auth[_0x60cc('0x9')](),controller['runTranscribe']);router[_0x60cc('0x15')](_0x60cc('0xd'),auth[_0x60cc('0x9')](),controller['update']);router[_0x60cc('0x16')](_0x60cc('0xd'),auth[_0x60cc('0x9')](),controller['destroy']);module[_0x60cc('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1c738bd..4772ca3 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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_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 diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a3db8d9..5e70f66 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 _0xa393=['sequelize','col','token','$and','push','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribeAccountId','transcribeRegion','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads'];(function(_0x34e14d,_0x5dea39){var _0x3d8e08=function(_0x134769){while(--_0x134769){_0x34e14d['push'](_0x34e14d['shift']());}};_0x3d8e08(++_0x5dea39);}(_0xa393,0x176));var _0x3a39=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xa393[_0xc0a3d3];return _0x3386e8;};'use strict';var emlformat=require(_0x3a39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a39('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a39('0x2'));var moment=require(_0x3a39('0x3'));var BPromise=require(_0x3a39('0x4'));var Mustache=require(_0x3a39('0x5'));var util=require(_0x3a39('0x6'));var path=require(_0x3a39('0x7'));var sox=require(_0x3a39('0x8'));var csv=require('to-csv');var ejs=require(_0x3a39('0x9'));var fs=require('fs');var fs_extra=require(_0x3a39('0xa'));var _=require(_0x3a39('0xb'));var squel=require(_0x3a39('0xc'));var crypto=require(_0x3a39('0xd'));var jsforce=require(_0x3a39('0xe'));var deskjs=require(_0x3a39('0xf'));var toCsv=require(_0x3a39('0x10'));var querystring=require(_0x3a39('0x11'));var Papa=require(_0x3a39('0x12'));var AWS=require(_0x3a39('0x13'));var uuidv4=require(_0x3a39('0x14'));var Redis=require(_0x3a39('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x3a39('0x16'));var as=require(_0x3a39('0x17'));var hardwareService=require(_0x3a39('0x18'));var logger=require(_0x3a39('0x19'))(_0x3a39('0x1a'));var utils=require(_0x3a39('0x1b'));var config=require(_0x3a39('0x1c'));var licenseUtil=require(_0x3a39('0x1d'));var db=require(_0x3a39('0x1e'))['db'];function respondWithStatusCode(_0x2f74aa,_0x5e0587){_0x5e0587=_0x5e0587||0xcc;return function(_0x140585){if(_0x140585){return _0x2f74aa[_0x3a39('0x1f')](_0x5e0587);}return _0x2f74aa[_0x3a39('0x20')](_0x5e0587)[_0x3a39('0x21')]();};}function respondWithResult(_0x1d1944,_0x40da0c){_0x40da0c=_0x40da0c||0xc8;return function(_0x493a6c){if(_0x493a6c){return _0x1d1944[_0x3a39('0x20')](_0x40da0c)[_0x3a39('0x22')](_0x493a6c);}};}function respondWithFilteredResult(_0x31b9dd,_0xd91bcf){return function(_0x56a85d){if(_0x56a85d){var _0x593d05=typeof _0xd91bcf[_0x3a39('0x23')]===_0x3a39('0x24')&&typeof _0xd91bcf['limit']===_0x3a39('0x24');var _0x5efb1c=_0x56a85d[_0x3a39('0x25')];var _0x2a6db9=_0x593d05?0x0:_0xd91bcf[_0x3a39('0x23')];var _0x1f3a8d=_0x593d05?_0x56a85d[_0x3a39('0x25')]:_0xd91bcf['offset']+_0xd91bcf[_0x3a39('0x26')];var _0x4f1315;if(_0x1f3a8d>=_0x5efb1c){_0x1f3a8d=_0x5efb1c;_0x4f1315=0xc8;}else{_0x4f1315=0xce;}_0x31b9dd[_0x3a39('0x20')](_0x4f1315);return _0x31b9dd['set'](_0x3a39('0x27'),_0x2a6db9+'-'+_0x1f3a8d+'/'+_0x5efb1c)[_0x3a39('0x22')](_0x56a85d);}return null;};}function patchUpdates(_0x5edc6a){return function(_0xe045cb){try{jsonpatch[_0x3a39('0x28')](_0xe045cb,_0x5edc6a,!![]);}catch(_0x213020){return BPromise[_0x3a39('0x29')](_0x213020);}return _0xe045cb[_0x3a39('0x2a')]();};}function saveUpdates(_0x5ec229,_0x10d631){return function(_0x85e043){if(_0x85e043){return _0x85e043[_0x3a39('0x2b')](_0x5ec229)[_0x3a39('0x2c')](function(_0x51f292){return _0x51f292;});}return null;};}function removeEntity(_0x561d17,_0x55f21e){return function(_0x32bb71){if(_0x32bb71){return _0x32bb71[_0x3a39('0x2d')]()['then'](function(){_0x561d17[_0x3a39('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ad15,_0x4283bf){return function(_0x442400){if(!_0x442400){_0x12ad15[_0x3a39('0x1f')](0x194);}return _0x442400;};}function handleError(_0x222d91,_0x361dea){_0x361dea=_0x361dea||0x1f4;return function(_0x15b4bb){logger[_0x3a39('0x2e')](_0x15b4bb['stack']);if(_0x15b4bb['name']){delete _0x15b4bb[_0x3a39('0x2f')];}_0x222d91['status'](_0x361dea)[_0x3a39('0x30')](_0x15b4bb);};}exports[_0x3a39('0x31')]=function(_0xca32c7,_0x553aa0){var _0x1406ec={},_0x37a315={},_0x39cdc6={'count':0x0,'rows':[]};var _0x1e91d4=_[_0x3a39('0x32')](db[_0x3a39('0x33')]['rawAttributes'],function(_0x11f60e){return{'name':_0x11f60e[_0x3a39('0x34')],'type':_0x11f60e[_0x3a39('0x35')][_0x3a39('0x36')]};});_0x37a315[_0x3a39('0x37')]=_[_0x3a39('0x38')](_[_0x3a39('0x32')](_0x1e91d4,_0x3a39('0x2f')),[_0x3a39('0x39')]);_0x37a315[_0x3a39('0x3a')]=_[_0x3a39('0x3b')](_0xca32c7[_0x3a39('0x3a')]);_0x37a315[_0x3a39('0x3c')]=_[_0x3a39('0x3d')](_0x37a315['model'],_0x37a315[_0x3a39('0x3a')]);_0x1406ec[_0x3a39('0x3e')]=_[_0x3a39('0x3d')](_0x37a315[_0x3a39('0x37')],qs[_0x3a39('0x3f')](_0xca32c7[_0x3a39('0x3a')][_0x3a39('0x3f')]));_0x1406ec['attributes']=_0x1406ec[_0x3a39('0x3e')][_0x3a39('0x40')]?_0x1406ec[_0x3a39('0x3e')]:_0x37a315[_0x3a39('0x37')];if(!_0xca32c7[_0x3a39('0x3a')]['hasOwnProperty'](_0x3a39('0x41'))){_0x1406ec[_0x3a39('0x26')]=qs['limit'](_0xca32c7['query'][_0x3a39('0x26')]);_0x1406ec[_0x3a39('0x23')]=qs[_0x3a39('0x23')](_0xca32c7[_0x3a39('0x3a')][_0x3a39('0x23')]);}_0x1406ec[_0x3a39('0x42')]=qs[_0x3a39('0x43')](_0xca32c7['query'][_0x3a39('0x43')]);_0x1406ec['where']=qs[_0x3a39('0x3c')](_['pick'](_0xca32c7['query'],_0x37a315['filters']),_0x1e91d4);if(_0xca32c7[_0x3a39('0x3a')][_0x3a39('0x44')]){_0x1406ec['where']=_['merge'](_0x1406ec[_0x3a39('0x45')],{'$or':_[_0x3a39('0x32')](_0x1e91d4,function(_0x564a08){if(_0x564a08[_0x3a39('0x35')]!==_0x3a39('0x46')){var _0x223027={};_0x223027[_0x564a08['name']]={'$like':'%'+_0xca32c7[_0x3a39('0x3a')][_0x3a39('0x44')]+'%'};return _0x223027;}})});}_0x1406ec=_['merge']({},_0x1406ec,_0xca32c7[_0x3a39('0x47')]);var _0xf2b7a={'where':_0x1406ec[_0x3a39('0x45')]};return db['VoiceRecording'][_0x3a39('0x25')](_0xf2b7a)[_0x3a39('0x2c')](function(_0xb4809b){_0x39cdc6[_0x3a39('0x25')]=_0xb4809b;if(_0xca32c7[_0x3a39('0x3a')][_0x3a39('0x48')]){_0x1406ec[_0x3a39('0x49')]=[{'all':!![]}];}return db[_0x3a39('0x33')][_0x3a39('0x4a')](_0x1406ec);})[_0x3a39('0x2c')](function(_0x5709fd){_0x39cdc6[_0x3a39('0x4b')]=_0x5709fd;return _0x39cdc6;})['then'](respondWithFilteredResult(_0x553aa0,_0x1406ec))[_0x3a39('0x4c')](handleError(_0x553aa0,null));};exports[_0x3a39('0x4d')]=function(_0x8bf9ef,_0x21598f){var _0x3ce38c={'raw':![],'where':{'id':_0x8bf9ef[_0x3a39('0x4e')]['id']}},_0x52f0dd={};_0x52f0dd[_0x3a39('0x37')]=_['keys'](db[_0x3a39('0x33')][_0x3a39('0x4f')]);_0x52f0dd[_0x3a39('0x3a')]=_[_0x3a39('0x3b')](_0x8bf9ef[_0x3a39('0x3a')]);_0x52f0dd[_0x3a39('0x3c')]=_[_0x3a39('0x3d')](_0x52f0dd[_0x3a39('0x37')],_0x52f0dd[_0x3a39('0x3a')]);_0x3ce38c[_0x3a39('0x3e')]=_[_0x3a39('0x3d')](_0x52f0dd[_0x3a39('0x37')],qs[_0x3a39('0x3f')](_0x8bf9ef[_0x3a39('0x3a')][_0x3a39('0x3f')]));_0x3ce38c['attributes']=_0x3ce38c['attributes'][_0x3a39('0x40')]?_0x3ce38c['attributes']:_0x52f0dd[_0x3a39('0x37')];if(_0x8bf9ef[_0x3a39('0x3a')][_0x3a39('0x48')]){_0x3ce38c[_0x3a39('0x49')]=[{'all':!![]}];}_0x3ce38c=_[_0x3a39('0x50')]({},_0x3ce38c,_0x8bf9ef[_0x3a39('0x47')]);return db[_0x3a39('0x33')][_0x3a39('0x51')](_0x3ce38c)['then'](handleEntityNotFound(_0x21598f,null))['then'](respondWithResult(_0x21598f,null))[_0x3a39('0x4c')](handleError(_0x21598f,null));};exports[_0x3a39('0x52')]=function(_0x58365b,_0x372501){return db[_0x3a39('0x33')][_0x3a39('0x52')](_0x58365b[_0x3a39('0x53')],{})['then'](respondWithResult(_0x372501,0xc9))[_0x3a39('0x4c')](handleError(_0x372501,null));};exports['update']=function(_0x2538fd,_0x6fe0d9){if(_0x2538fd['body']['id']){delete _0x2538fd[_0x3a39('0x53')]['id'];}return db[_0x3a39('0x33')][_0x3a39('0x51')]({'where':{'id':_0x2538fd[_0x3a39('0x4e')]['id']}})['then'](handleEntityNotFound(_0x6fe0d9,null))[_0x3a39('0x2c')](saveUpdates(_0x2538fd['body'],null))[_0x3a39('0x2c')](respondWithResult(_0x6fe0d9,null))[_0x3a39('0x4c')](handleError(_0x6fe0d9,null));};exports[_0x3a39('0x54')]=function(_0x637a9,_0x21684e){return db[_0x3a39('0x33')]['describe']()[_0x3a39('0x2c')](respondWithResult(_0x21684e,null))[_0x3a39('0x4c')](handleError(_0x21684e,null));};exports[_0x3a39('0x55')]=function(_0x58b246,_0x3b0838,_0x3e5435){var _0x2ae5be=require(_0x3a39('0x56'));var _0x46a79c=![];var _0x561165={};if(_0x58b246[_0x3a39('0x3a')]['type']&&_0x58b246['query']['type']===_0x3a39('0x57')){_0x561165['uniqueid']=_0x58b246[_0x3a39('0x4e')]['id'];}else{_0x561165['id']=_0x58b246[_0x3a39('0x4e')]['id'];}return db['VoiceRecording'][_0x3a39('0x51')]({'where':_0x561165,'attributes':['id',_0x3a39('0x58')],'raw':!![]})[_0x3a39('0x2c')](handleEntityNotFound(_0x3b0838,null))[_0x3a39('0x2c')](function(_0x13cf20){if(_0x13cf20){var _0x19d1ad=_0x13cf20[_0x3a39('0x58')];var _0x1e22a3=util[_0x3a39('0x39')](_0x3a39('0x59'),_0x19d1ad);if(fs[_0x3a39('0x5a')](_0x1e22a3)){_0x46a79c=!![];return _0x2ae5be[_0x3a39('0x5b')](_0x1e22a3,_0x19d1ad,config[_0x3a39('0x5c')][_0x3a39('0x5d')])['then'](function(){return _0x13cf20;});}return _0x13cf20;}})['then'](function(_0x31d6ba){if(_0x31d6ba){var _0x4c09cd=_0x31d6ba[_0x3a39('0x58')];if(!fs[_0x3a39('0x5a')](_0x4c09cd)){throw new db[(_0x3a39('0x5e'))][(_0x3a39('0x5f'))](_0x3a39('0x60'));}if(_0x31d6ba[_0x3a39('0x61')]){return _0x3b0838['download'](_0x4c09cd,_0x31d6ba['filename']+path[_0x3a39('0x62')](_0x4c09cd),function(){if(_0x46a79c){fs['unlink'](_0x4c09cd);}});}else{return _0x3b0838[_0x3a39('0x55')](_0x4c09cd,function(_0x418492){if(_0x46a79c){fs[_0x3a39('0x63')](_0x4c09cd);}});}}})[_0x3a39('0x4c')](function(_0xa198aa){if(_0xa198aa[_0x3a39('0x64')]===_0x3a39('0x60')){_0x3b0838['status'](0x194)[_0x3a39('0x30')](_0x3a39('0x65'));}else{return handleError(_0x3b0838,null);}});};exports[_0x3a39('0x66')]=function(_0xf0be2e,_0x56afc9,_0x3feb40){var _0xbfad18=require('../../components/encryptor');var _0x6c81f1=![];var _0x4c18d1={'$and':[db[_0x3a39('0x67')][_0x3a39('0x45')](db[_0x3a39('0x67')]['fn']('MD5',db[_0x3a39('0x67')][_0x3a39('0x68')](_0x3a39('0x57'))),_0xf0be2e['query'][_0x3a39('0x69')])]};if(_0xf0be2e[_0x3a39('0x3a')][_0x3a39('0x35')]&&_0xf0be2e[_0x3a39('0x3a')][_0x3a39('0x35')]==='uniqueid'){_0x4c18d1[_0x3a39('0x6a')][_0x3a39('0x6b')]({'uniqueid':_0xf0be2e[_0x3a39('0x4e')]['id']});}else{_0x4c18d1[_0x3a39('0x6a')][_0x3a39('0x6b')]({'id':_0xf0be2e[_0x3a39('0x4e')]['id']});}return db[_0x3a39('0x33')][_0x3a39('0x51')]({'where':_0x4c18d1,'attributes':['id',_0x3a39('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x56afc9,null))['then'](function(_0x4a2e9c){if(_0x4a2e9c){var _0x5c1391=util['format']('%s.cypher',_0x4a2e9c[_0x3a39('0x58')]);if(fs[_0x3a39('0x5a')](_0x5c1391)){_0x6c81f1=!![];return _0xbfad18[_0x3a39('0x5b')](_0x5c1391,_0x4a2e9c[_0x3a39('0x58')],config[_0x3a39('0x5c')][_0x3a39('0x5d')])[_0x3a39('0x2c')](function(){return _0x4a2e9c;});}return _0x4a2e9c;}})[_0x3a39('0x2c')](function(_0x498170){if(_0x498170){if(!fs['existsSync'](_0x498170[_0x3a39('0x58')])){throw new db[(_0x3a39('0x5e'))]['ValidationError'](_0x3a39('0x60'));}if(_0x498170[_0x3a39('0x61')]){return _0x56afc9[_0x3a39('0x55')](_0x498170[_0x3a39('0x58')],_0x498170[_0x3a39('0x61')]+path[_0x3a39('0x62')](_0x498170[_0x3a39('0x58')]),function(){if(_0x6c81f1){fs[_0x3a39('0x63')](_0x498170[_0x3a39('0x58')]);}});}else{return _0x56afc9['download'](_0x498170[_0x3a39('0x58')],function(_0x99613f){if(_0x6c81f1){fs[_0x3a39('0x63')](_0x498170[_0x3a39('0x58')]);}});}}})[_0x3a39('0x4c')](handleError(_0x56afc9,null));};exports['destroy']=function(_0x461b7e,_0x415c07){return db[_0x3a39('0x33')][_0x3a39('0x51')]({'where':{'id':_0x461b7e['params']['id']}})[_0x3a39('0x2c')](function(_0x51ea80){if(_[_0x3a39('0x6c')](_0x51ea80)){throw new ReferenceError('Entity\x20not\x20found');}return _0x51ea80;})['then'](function(_0x3da46c){var _0x2e7676=_0x3da46c[_0x3a39('0x58')];logger[_0x3a39('0x6d')](_0x3a39('0x6e'),_0x2e7676);if(!_['isNil'](_0x3da46c[_0x3a39('0x58')])&&fs[_0x3a39('0x5a')](_0x2e7676)){logger[_0x3a39('0x6d')](_0x3a39('0x6f')+_0x2e7676+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3a39('0x70')](_0x2e7676);}_0x2e7676=_0x2e7676+'.cypher';if(!_[_0x3a39('0x6c')](_0x3da46c['value'])&&fs[_0x3a39('0x5a')](_0x2e7676)){logger[_0x3a39('0x6d')](_0x3a39('0x6f')+_0x2e7676+_0x3a39('0x71'));fs[_0x3a39('0x70')](_0x2e7676);}return _0x3da46c;})[_0x3a39('0x2c')](function(_0x42a827){if(!_0x42a827)throw new InternalError();return _0x42a827[_0x3a39('0x2d')]();})[_0x3a39('0x2c')](function(){_0x415c07[_0x3a39('0x20')](0xcc)[_0x3a39('0x21')]();})[_0x3a39('0x4c')](handleError(_0x415c07,null));};function getBucketslist(_0x3da83b,_0x5d6af6,_0x819ef4){return new Promise(function(_0x148a22,_0x209286){var _0x356174=new AWS['S3']({'accessKeyId':_0x5d6af6,'secretAccessKey':_0x3da83b,'region':_0x819ef4});_0x356174[_0x3a39('0x72')]({},function(_0x4e31a0,_0x3c6760){if(_0x4e31a0){return _0x209286(_0x4e31a0);}else{return _0x148a22(_0x3c6760);}});});}function createBucket(_0xa8b329,_0x19b680,_0x1dbb25,_0x464038){return new Promise(function(_0x47470e,_0x4e6d51){var _0x52a661=new AWS['S3']({'accessKeyId':_0x19b680,'secretAccessKey':_0xa8b329,'region':_0x1dbb25});_0x52a661[_0x3a39('0x73')]({'Bucket':_0x464038},function(_0x1d2e6a,_0x42ae3b){if(_0x1d2e6a){return _0x4e6d51(_0x1d2e6a);}else{return _0x47470e(_0x42ae3b);}});});}function uploadFile(_0x16f844,_0x362132,_0x4b3b7c,_0x21c341,_0x2c15a4,_0xecc16){return new Promise(function(_0x3aa7d3,_0x11875c){var _0x53e1ab=new AWS['S3']({'accessKeyId':_0x362132,'secretAccessKey':_0x16f844,'region':_0x4b3b7c});_0x53e1ab[_0x3a39('0x74')]({'Bucket':_0x21c341,'Key':_0x2c15a4,'Body':_0xecc16},function(_0x23b702,_0x5502f8){if(_0x23b702){return _0x11875c(_0x23b702);}else{return _0x3aa7d3(_0x5502f8);}});});}function startTranscribe(_0x3d1d64,_0x43d698,_0x2560ec,_0xff0495,_0x5a16a0,_0xc1ff5c){return new Promise(function(_0x32154e,_0x5026a0){var _0x198b97=new AWS['TranscribeService']({'accessKeyId':_0x43d698,'secretAccessKey':_0x3d1d64,'region':_0x2560ec});_0x198b97['startTranscriptionJob']({'TranscriptionJobName':_0xff0495,'LanguageCode':_0x5a16a0,'Media':{'MediaFileUri':_0xc1ff5c}},function(_0x54b92a,_0x8df2e6){if(_0x54b92a){return _0x5026a0(_0x54b92a);}else{return _0x32154e(_0x8df2e6);}});});}function transcribe(_0xf8f678,_0x48fb7b,_0x392eea,_0x11e5cf,_0x501f79,_0x19213c,_0x2dce9d){return new Promise(function(_0xcb65ff,_0x415193){var _0x338b90={};logger['info'](util[_0x3a39('0x39')](_0x3a39('0x75'),_0xf8f678,_0x501f79));return uploadFile(_0x48fb7b,_0x392eea,_0x11e5cf,_0x501f79,path[_0x3a39('0x76')](_0x19213c),fs[_0x3a39('0x77')](_0x19213c))['then'](function(_0x5f10f0){logger[_0x3a39('0x6d')](util[_0x3a39('0x39')](_0x3a39('0x78'),_0xf8f678,_0x501f79,_0x5f10f0['Location']));_0x338b90['bucket']=_0x5f10f0['Bucket'];_0x338b90[_0x3a39('0x79')]=_0x5f10f0['Location'];logger['info'](util[_0x3a39('0x39')](_0x3a39('0x7a'),_0xf8f678));return startTranscribe(_0x48fb7b,_0x392eea,_0x11e5cf,uuidv4(),_0x2dce9d,_0x5f10f0[_0x3a39('0x7b')]);})[_0x3a39('0x2c')](function(_0x43d143){logger[_0x3a39('0x6d')](util['format'](_0x3a39('0x7c'),_0xf8f678,_0x43d143[_0x3a39('0x7d')]['TranscriptionJobName']));_0x338b90['transcribeName']=_0x43d143[_0x3a39('0x7d')][_0x3a39('0x7e')];_0x338b90['transcribeStatus']=_0x43d143['TranscriptionJob'][_0x3a39('0x7f')];return _0xcb65ff(_0x338b90);})[_0x3a39('0x4c')](function(_0x11ee36){return _0x415193(_0x11ee36);});});}exports[_0x3a39('0x80')]=function(_0x2dbd17,_0x4b5d2c,_0x2b760e){var _0x3eb5ab;var _0x6fad00;var _0xbd56d3;var _0x4ca283=require(_0x3a39('0x56'));return db[_0x3a39('0x33')][_0x3a39('0x81')]({'where':{'id':_0x2dbd17[_0x3a39('0x4e')]['id']}})['then'](function(_0xc79485){if(_0xc79485){var _0x1e1818=util[_0x3a39('0x39')]('%s.cypher',_0xc79485['value']);if(fs[_0x3a39('0x5a')](_0x1e1818)){cypher=!![];return _0x4ca283[_0x3a39('0x5b')](_0x1e1818,_0xc79485[_0x3a39('0x58')],config['secrets']['recording'])[_0x3a39('0x2c')](function(){return _0xc79485;});}return _0xc79485;}})[_0x3a39('0x2c')](function(_0x57c774){if(!_0x57c774){throw new db['Sequelize'][(_0x3a39('0x5f'))]('Voice\x20Recording\x20not\x20found');}_0x6fad00=_0x57c774;return db[_0x3a39('0x82')][_0x3a39('0x81')]({'where':{'id':0x1}});})[_0x3a39('0x2c')](handleEntityNotFound(_0x4b5d2c,null))[_0x3a39('0x2c')](function(_0x46b0e3){if(_0x46b0e3){_0x3eb5ab=_0x46b0e3;if(!_0x3eb5ab['transcribe']||!_0x3eb5ab[_0x3a39('0x83')]||!_0x3eb5ab[_0x3a39('0x84')]||!_0x3eb5ab['language']||!_0x3eb5ab[_0x3a39('0x85')]){throw new db['Sequelize'][(_0x3a39('0x5f'))](_0x3a39('0x86'));}if(_0x2dbd17[_0x3a39('0x53')][_0x3a39('0x87')]&&(!_0x3eb5ab['sentiment']||!_0x3eb5ab[_0x3a39('0x88')]||!_0x3eb5ab[_0x3a39('0x89')]||!_0x3eb5ab[_0x3a39('0x8a')]||!_0x3eb5ab[_0x3a39('0x85')])){throw new db[(_0x3a39('0x5e'))][(_0x3a39('0x5f'))](_0x3a39('0x8b'));}return db[_0x3a39('0x8c')][_0x3a39('0x81')]({'where':{'id':_0x3eb5ab['transcribeAccountId']}});}})[_0x3a39('0x2c')](function(_0x30fa6a){if(!_0x30fa6a){throw new db[(_0x3a39('0x5e'))][(_0x3a39('0x5f'))](_0x3a39('0x8d'));}if(!_0x30fa6a[_0x3a39('0x8e')]||!_0x30fa6a[_0x3a39('0x8f')]){throw new db[(_0x3a39('0x5e'))][(_0x3a39('0x5f'))](_0x3a39('0x90'));}_0xbd56d3=_0x30fa6a;return getBucketslist(_0xbd56d3[_0x3a39('0x8e')],_0xbd56d3['data2'],_0x3eb5ab[_0x3a39('0x84')]);})[_0x3a39('0x2c')](function(_0x122e4d){if(_0x122e4d&&_0x122e4d[_0x3a39('0x91')]){var _0x2572ba=_[_0x3a39('0x51')](_0x122e4d[_0x3a39('0x91')],function(_0x5686b1){return _0x5686b1[_0x3a39('0x92')]===_0x3eb5ab[_0x3a39('0x85')];});if(!_0x2572ba){logger[_0x3a39('0x6d')](util[_0x3a39('0x39')](_0x3a39('0x93'),_0x2dbd17['params']['id'],_0x3eb5ab[_0x3a39('0x85')]));return createBucket(_0xbd56d3[_0x3a39('0x8e')],_0xbd56d3[_0x3a39('0x8f')],_0x3eb5ab[_0x3a39('0x84')],_0x3eb5ab[_0x3a39('0x85')]);}logger[_0x3a39('0x6d')](util['format'](_0x3a39('0x94'),_0x2dbd17['params']['id'],_0x3eb5ab[_0x3a39('0x85')]));return;}})['then'](function(_0x4d2d05){if(_0x6fad00[_0x3a39('0x95')]==='NEW'){return transcribe(_0x2dbd17[_0x3a39('0x4e')]['id'],_0xbd56d3[_0x3a39('0x8e')],_0xbd56d3[_0x3a39('0x8f')],_0x3eb5ab[_0x3a39('0x84')],_0x3eb5ab[_0x3a39('0x85')],_0x6fad00['value'],_0x3eb5ab[_0x3a39('0x8a')]);}else{logger[_0x3a39('0x6d')](util[_0x3a39('0x39')](_0x3a39('0x96'),_0x2dbd17[_0x3a39('0x4e')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x3a39('0x2c')](function(_0x54985a){if(_0x54985a){_0x54985a[_0x3a39('0x97')]=_0x2dbd17[_0x3a39('0x53')][_0x3a39('0x87')];return _0x6fad00[_0x3a39('0x98')](_0x54985a);}})[_0x3a39('0x2c')](respondWithResult(_0x4b5d2c,null))['catch'](handleError(_0x4b5d2c,null));};function writeFile(_0x40110b,_0x3e4102){return new Promise(function(_0x852db5,_0x22928e){fs[_0x3a39('0x99')](_0x3e4102,_0x40110b,function(_0x1ab539,_0x222a8a){if(_0x1ab539){return _0x22928e(_0x1ab539);}else{return _0x852db5(_0x222a8a);}});});}exports[_0x3a39('0x9a')]=function(_0x2863e3,_0xcad71,_0x267017){return db[_0x3a39('0x33')]['findOne']({'where':{'id':_0x2863e3['params']['id']}})['then'](handleEntityNotFound(_0xcad71))[_0x3a39('0x2c')](function(_0x59c8eb){if(_0x59c8eb&&_0x59c8eb[_0x3a39('0x9b')]){var _0x596d03=_0x59c8eb[_0x3a39('0x9b')];var _0x4bf105=config['root']+_0x3a39('0x9c')+_0x59c8eb['id']+_0x3a39('0x9d');if(fs[_0x3a39('0x5a')](_0x4bf105)){return _0x4bf105;}return writeFile(_0x596d03,_0x4bf105)[_0x3a39('0x2c')](function(){return _0x4bf105;});}else{throw new db[(_0x3a39('0x5e'))][(_0x3a39('0x5f'))](_0x3a39('0x9e'));}})[_0x3a39('0x2c')](function(_0x399591){return _0xcad71[_0x3a39('0x55')](_0x399591);})[_0x3a39('0x4c')](handleError(_0xcad71));}; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 1bdc62b..40b2b5e 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 _0x9c44=['transcribeStatus','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x1ffbbf,_0x18bf2d){return _0x1ffbbf[_0x49c4('0x0')](_0x49c4('0x1'),attributes,{'tableName':_0x49c4('0x2'),'paranoid':![],'indexes':[{'name':_0x49c4('0x3'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0x49c4('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f7c5c6d..14bc89c 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 _0x430c=['../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','body','options','raw','where','limit','UpdateVoiceRecording','catch','CreateVoiceRecording'];(function(_0x53899e,_0x95b60a){var _0xedb6f3=function(_0x4f9c9d){while(--_0x4f9c9d){_0x53899e['push'](_0x53899e['shift']());}};_0xedb6f3(++_0x95b60a);}(_0x430c,0x1a1));var _0xc430=function(_0x38622b,_0x3cfdf7){_0x38622b=_0x38622b-0x0;var _0x2c1a7a=_0x430c[_0x38622b];return _0x2c1a7a;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});}exports['UpdateVoiceRecording']=function(_0x5d3acc){var _0x36d112=this;return new Promise(function(_0x4c1937,_0x2bcb21){return db['VoiceRecording']['update'](_0x5d3acc[_0xc430('0x11')],{'raw':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3acc[_0xc430('0x12')]?_0x5d3acc[_0xc430('0x12')][_0xc430('0x14')]||null:null,'attributes':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')]['attributes']||null:null,'limit':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x15')]||null:null})[_0xc430('0x8')](function(_0x56dd16){logger[_0xc430('0x9')]('UpdateVoiceRecording',_0x5d3acc);logger[_0xc430('0xb')](_0xc430('0x16'),_0x5d3acc,JSON['stringify'](_0x56dd16));_0x4c1937(_0x56dd16);})[_0xc430('0x17')](function(_0x3cdbd3){logger['error'](_0xc430('0x16'),_0x3cdbd3['message'],_0x5d3acc);_0x2bcb21(_0x36d112[_0xc430('0xe')](0x1f4,_0x3cdbd3['message']));});});};exports[_0xc430('0x18')]=function(_0x21e28a){var _0x50110b=this;return new Promise(function(_0x33433f,_0x2ec021){var _0x2c0422=require(_0xc430('0x19'));var _0x285407;return db['Setting'][_0xc430('0x1a')]({'attributes':['id',_0xc430('0x1b')],'where':{'id':0x1},'raw':!![]})[_0xc430('0x8')](function(_0x1591e3){_0x285407=_0x1591e3;return db['VoiceRecording'][_0xc430('0x1c')](_0x21e28a['body']);})[_0xc430('0x8')](function(_0x4ad29e){if(_0x285407[_0xc430('0x1b')]&&fs[_0xc430('0x1d')](_0x4ad29e[_0xc430('0x1e')])){var _0x3d7ccf=util['format'](_0xc430('0x1f'),_0x4ad29e[_0xc430('0x1e')]);return _0x2c0422[_0xc430('0x20')](_0x4ad29e[_0xc430('0x1e')],_0x3d7ccf,config['secrets'][_0xc430('0x21')])[_0xc430('0x8')](function(){fs['unlink'](_0x4ad29e[_0xc430('0x1e')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x4ad29e;});}return _0x4ad29e;})[_0xc430('0x8')](function(_0x973a39){logger[_0xc430('0x9')](_0xc430('0x18'),_0x21e28a);logger[_0xc430('0xb')](_0xc430('0x18'),_0x21e28a,JSON[_0xc430('0xd')](_0x973a39));_0x33433f(_0x973a39);})[_0xc430('0x17')](function(_0x47da0d){logger[_0xc430('0xe')]('CreateVoiceRecording',_0x47da0d[_0xc430('0xf')],_0x21e28a);_0x2ec021(_0x50110b[_0xc430('0xe')](0x1f4,_0x47da0d[_0xc430('0xf')]));});});}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index dea8df3..c874454 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 _0x046b=['show','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x150cee,_0xfa1f04){var _0x55458a=function(_0x4a1672){while(--_0x4a1672){_0x150cee['push'](_0x150cee['shift']());}};_0x55458a(++_0xfa1f04);}(_0x046b,0x1e6));var _0xb046=function(_0x9f7d4c,_0x28ddbd){_0x9f7d4c=_0x9f7d4c-0x0;var _0x541c20=_0x046b[_0x9f7d4c];return _0x541c20;};'use strict';var multer=require(_0xb046('0x0'));var util=require(_0xb046('0x1'));var path=require(_0xb046('0x2'));var timeout=require('connect-timeout');var express=require(_0xb046('0x3'));var router=express[_0xb046('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb046('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb046('0x6'));var controller=require(_0xb046('0x7'));router[_0xb046('0x8')]('/',auth['isAuthenticated'](),controller[_0xb046('0x9')]);router[_0xb046('0x8')](_0xb046('0xa'),auth[_0xb046('0xb')](),controller[_0xb046('0xc')]);router[_0xb046('0x8')](_0xb046('0xd'),auth[_0xb046('0xb')](),controller[_0xb046('0xe')]);router['post']('/',auth[_0xb046('0xb')](),controller[_0xb046('0xf')]);router[_0xb046('0x10')]('/:id',auth[_0xb046('0xb')](),controller['update']);router[_0xb046('0x11')](_0xb046('0xd'),auth['isAuthenticated'](),controller[_0xb046('0x12')]);module[_0xb046('0x13')]=router; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c0d1213..895043d 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 _0xc1d8=['Yes','sequelize','exports','ENUM','blind','STRING'];(function(_0x11226c,_0x363f14){var _0x4182a6=function(_0x3bfaab){while(--_0x3bfaab){_0x11226c['push'](_0x11226c['shift']());}};_0x4182a6(++_0x363f14);}(_0xc1d8,0x115));var _0x8c1d=function(_0x1ce279,_0x422132){_0x1ce279=_0x1ce279-0x0;var _0x4dd294=_0xc1d8[_0x1ce279];return _0x4dd294;};'use strict';var Sequelize=require(_0x8c1d('0x0'));var moment=require('moment');module[_0x8c1d('0x1')]={'type':{'type':Sequelize[_0x8c1d('0x2')](_0x8c1d('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x8c1d('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x8c1d('0x4')]},'transferercalleridname':{'type':Sequelize[_0x8c1d('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8c1d('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x8c1d('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x8c1d('0x4')]},'transfererexten':{'type':Sequelize[_0x8c1d('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x8c1d('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x8c1d('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x8c1d('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8c1d('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x8c1d('0x4')]},'transfereecontext':{'type':Sequelize[_0x8c1d('0x4')]},'transfereeexten':{'type':Sequelize[_0x8c1d('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x8c1d('0x2')](_0x8c1d('0x5'),'No')},'context':{'type':Sequelize[_0x8c1d('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index b208cf7..e9bef8e 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 _0xb07d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','sendStatus','name','send','VoiceTransferReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','nolimit','order','where','pick','filters','type','filter','includeAll','include','findAll','show','keys','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x1190df,_0x250245){var _0x26b39e=function(_0x3d5352){while(--_0x3d5352){_0x1190df['push'](_0x1190df['shift']());}};_0x26b39e(++_0x250245);}(_0xb07d,0x1eb));var _0xdb07=function(_0x2d179d,_0x131c3e){_0x2d179d=_0x2d179d-0x0;var _0x50620c=_0xb07d[_0x2d179d];return _0x50620c;};'use strict';var emlformat=require(_0xdb07('0x0'));var rimraf=require(_0xdb07('0x1'));var zipdir=require(_0xdb07('0x2'));var jsonpatch=require(_0xdb07('0x3'));var rp=require(_0xdb07('0x4'));var moment=require(_0xdb07('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb07('0x6'));var path=require(_0xdb07('0x7'));var sox=require(_0xdb07('0x8'));var csv=require(_0xdb07('0x9'));var ejs=require(_0xdb07('0xa'));var fs=require('fs');var fs_extra=require(_0xdb07('0xb'));var _=require(_0xdb07('0xc'));var squel=require(_0xdb07('0xd'));var crypto=require(_0xdb07('0xe'));var jsforce=require(_0xdb07('0xf'));var deskjs=require(_0xdb07('0x10'));var toCsv=require(_0xdb07('0x9'));var querystring=require(_0xdb07('0x11'));var Papa=require(_0xdb07('0x12'));var Redis=require('ioredis');var authService=require(_0xdb07('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdb07('0x14'));var hardwareService=require(_0xdb07('0x15'));var logger=require('../../config/logger')(_0xdb07('0x16'));var utils=require(_0xdb07('0x17'));var config=require(_0xdb07('0x18'));var licenseUtil=require(_0xdb07('0x19'));var db=require(_0xdb07('0x1a'))['db'];function respondWithStatusCode(_0xc5b3b2,_0x419b2d){_0x419b2d=_0x419b2d||0xcc;return function(_0x15d00c){if(_0x15d00c){return _0xc5b3b2['sendStatus'](_0x419b2d);}return _0xc5b3b2[_0xdb07('0x1b')](_0x419b2d)[_0xdb07('0x1c')]();};}function respondWithResult(_0x3c7d48,_0x5c66c9){_0x5c66c9=_0x5c66c9||0xc8;return function(_0x3bf436){if(_0x3bf436){return _0x3c7d48[_0xdb07('0x1b')](_0x5c66c9)[_0xdb07('0x1d')](_0x3bf436);}};}function respondWithFilteredResult(_0x55e89f,_0xfcfea8){return function(_0x272358){if(_0x272358){var _0x4569f6=typeof _0xfcfea8['offset']===_0xdb07('0x1e')&&typeof _0xfcfea8[_0xdb07('0x1f')]===_0xdb07('0x1e');var _0x400d42=_0x272358[_0xdb07('0x20')];var _0x2988ab=_0x4569f6?0x0:_0xfcfea8[_0xdb07('0x21')];var _0x5b5d07=_0x4569f6?_0x272358[_0xdb07('0x20')]:_0xfcfea8[_0xdb07('0x21')]+_0xfcfea8[_0xdb07('0x1f')];var _0xeee413;if(_0x5b5d07>=_0x400d42){_0x5b5d07=_0x400d42;_0xeee413=0xc8;}else{_0xeee413=0xce;}_0x55e89f['status'](_0xeee413);return _0x55e89f[_0xdb07('0x22')](_0xdb07('0x23'),_0x2988ab+'-'+_0x5b5d07+'/'+_0x400d42)['json'](_0x272358);}return null;};}function patchUpdates(_0x3f06c2){return function(_0x25fe5f){try{jsonpatch[_0xdb07('0x24')](_0x25fe5f,_0x3f06c2,!![]);}catch(_0x4a17d1){return BPromise['reject'](_0x4a17d1);}return _0x25fe5f[_0xdb07('0x25')]();};}function saveUpdates(_0x395056,_0x526025){return function(_0x297aed){if(_0x297aed){return _0x297aed[_0xdb07('0x26')](_0x395056)[_0xdb07('0x27')](function(_0x589ad2){return _0x589ad2;});}return null;};}function removeEntity(_0x225a73,_0x555d81){return function(_0x282904){if(_0x282904){return _0x282904['destroy']()[_0xdb07('0x27')](function(){_0x225a73[_0xdb07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445133,_0x1743c9){return function(_0x1d0d46){if(!_0x1d0d46){_0x445133[_0xdb07('0x28')](0x194);}return _0x1d0d46;};}function handleError(_0x57b5fb,_0xf347c8){_0xf347c8=_0xf347c8||0x1f4;return function(_0x217593){logger['error'](_0x217593['stack']);if(_0x217593[_0xdb07('0x29')]){delete _0x217593[_0xdb07('0x29')];}_0x57b5fb[_0xdb07('0x1b')](_0xf347c8)[_0xdb07('0x2a')](_0x217593);};}exports['index']=function(_0x4e728c,_0x7d3bce){var _0x412b94={},_0x3a93b4={},_0xdc791e={'count':0x0,'rows':[]};var _0x16c4c9=_['map'](db[_0xdb07('0x2b')][_0xdb07('0x2c')],function(_0x3ca7f0){return{'name':_0x3ca7f0[_0xdb07('0x2d')],'type':_0x3ca7f0['type'][_0xdb07('0x2e')]};});_0x3a93b4[_0xdb07('0x2f')]=_[_0xdb07('0x30')](_0x16c4c9,'name');_0x3a93b4[_0xdb07('0x31')]=_['keys'](_0x4e728c['query']);_0x3a93b4['filters']=_[_0xdb07('0x32')](_0x3a93b4[_0xdb07('0x2f')],_0x3a93b4[_0xdb07('0x31')]);_0x412b94[_0xdb07('0x33')]=_['intersection'](_0x3a93b4[_0xdb07('0x2f')],qs[_0xdb07('0x34')](_0x4e728c[_0xdb07('0x31')][_0xdb07('0x34')]));_0x412b94['attributes']=_0x412b94[_0xdb07('0x33')][_0xdb07('0x35')]?_0x412b94[_0xdb07('0x33')]:_0x3a93b4[_0xdb07('0x2f')];if(!_0x4e728c['query']['hasOwnProperty'](_0xdb07('0x36'))){_0x412b94['limit']=qs['limit'](_0x4e728c[_0xdb07('0x31')][_0xdb07('0x1f')]);_0x412b94[_0xdb07('0x21')]=qs['offset'](_0x4e728c[_0xdb07('0x31')]['offset']);}_0x412b94[_0xdb07('0x37')]=qs['sort'](_0x4e728c[_0xdb07('0x31')]['sort']);_0x412b94[_0xdb07('0x38')]=qs['filters'](_[_0xdb07('0x39')](_0x4e728c[_0xdb07('0x31')],_0x3a93b4[_0xdb07('0x3a')]),_0x16c4c9);if(_0x4e728c[_0xdb07('0x31')]['filter']){_0x412b94[_0xdb07('0x38')]=_['merge'](_0x412b94[_0xdb07('0x38')],{'$or':_[_0xdb07('0x30')](_0x16c4c9,function(_0x44d9b3){if(_0x44d9b3[_0xdb07('0x3b')]!=='VIRTUAL'){var _0x1a10d1={};_0x1a10d1[_0x44d9b3[_0xdb07('0x29')]]={'$like':'%'+_0x4e728c[_0xdb07('0x31')][_0xdb07('0x3c')]+'%'};return _0x1a10d1;}})});}_0x412b94=_['merge']({},_0x412b94,_0x4e728c['options']);var _0x5bf468={'where':_0x412b94['where']};return db[_0xdb07('0x2b')][_0xdb07('0x20')](_0x5bf468)[_0xdb07('0x27')](function(_0x103610){_0xdc791e[_0xdb07('0x20')]=_0x103610;if(_0x4e728c['query'][_0xdb07('0x3d')]){_0x412b94[_0xdb07('0x3e')]=[{'all':!![]}];}return db[_0xdb07('0x2b')][_0xdb07('0x3f')](_0x412b94);})['then'](function(_0x299451){_0xdc791e['rows']=_0x299451;return _0xdc791e;})[_0xdb07('0x27')](respondWithFilteredResult(_0x7d3bce,_0x412b94))['catch'](handleError(_0x7d3bce,null));};exports[_0xdb07('0x40')]=function(_0x5d61ce,_0x3ae21d){var _0x337e19={'raw':!![],'where':{'id':_0x5d61ce['params']['id']}},_0x581293={};_0x581293[_0xdb07('0x2f')]=_[_0xdb07('0x41')](db[_0xdb07('0x2b')][_0xdb07('0x2c')]);_0x581293['query']=_['keys'](_0x5d61ce[_0xdb07('0x31')]);_0x581293[_0xdb07('0x3a')]=_[_0xdb07('0x32')](_0x581293[_0xdb07('0x2f')],_0x581293['query']);_0x337e19[_0xdb07('0x33')]=_[_0xdb07('0x32')](_0x581293[_0xdb07('0x2f')],qs[_0xdb07('0x34')](_0x5d61ce['query'][_0xdb07('0x34')]));_0x337e19['attributes']=_0x337e19['attributes'][_0xdb07('0x35')]?_0x337e19[_0xdb07('0x33')]:_0x581293[_0xdb07('0x2f')];if(_0x5d61ce['query']['includeAll']){_0x337e19[_0xdb07('0x3e')]=[{'all':!![]}];}_0x337e19=_[_0xdb07('0x42')]({},_0x337e19,_0x5d61ce['options']);return db[_0xdb07('0x2b')][_0xdb07('0x43')](_0x337e19)[_0xdb07('0x27')](handleEntityNotFound(_0x3ae21d,null))[_0xdb07('0x27')](respondWithResult(_0x3ae21d,null))[_0xdb07('0x44')](handleError(_0x3ae21d,null));};exports['create']=function(_0x4098d2,_0x5122bf){return db[_0xdb07('0x2b')][_0xdb07('0x45')](_0x4098d2['body'],{})[_0xdb07('0x27')](respondWithResult(_0x5122bf,0xc9))[_0xdb07('0x44')](handleError(_0x5122bf,null));};exports[_0xdb07('0x26')]=function(_0x2fd853,_0x47edf4){if(_0x2fd853[_0xdb07('0x46')]['id']){delete _0x2fd853['body']['id'];}return db[_0xdb07('0x2b')][_0xdb07('0x43')]({'where':{'id':_0x2fd853[_0xdb07('0x47')]['id']}})[_0xdb07('0x27')](handleEntityNotFound(_0x47edf4,null))[_0xdb07('0x27')](saveUpdates(_0x2fd853[_0xdb07('0x46')],null))[_0xdb07('0x27')](respondWithResult(_0x47edf4,null))[_0xdb07('0x44')](handleError(_0x47edf4,null));};exports['destroy']=function(_0x7e0a5,_0x3fc6c6){return db['VoiceTransferReport'][_0xdb07('0x43')]({'where':{'id':_0x7e0a5['params']['id']}})[_0xdb07('0x27')](handleEntityNotFound(_0x3fc6c6,null))['then'](removeEntity(_0x3fc6c6,null))[_0xdb07('0x44')](handleError(_0x3fc6c6,null));};exports[_0xdb07('0x48')]=function(_0x55c03d,_0x22958c){return db[_0xdb07('0x2b')][_0xdb07('0x48')]()['then'](respondWithResult(_0x22958c,null))[_0xdb07('0x44')](handleError(_0x22958c,null));}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 3d2ab4c..bce78e1 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 _0x4d66=['define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x146c6b,_0x8090eb){var _0xb7abfa=function(_0x4fe66a){while(--_0x4fe66a){_0x146c6b['push'](_0x146c6b['shift']());}};_0xb7abfa(++_0x8090eb);}(_0x4d66,0x1c6));var _0x64d6=function(_0x24d344,_0x4a2291){_0x24d344=_0x24d344-0x0;var _0x341736=_0x4d66[_0x24d344];return _0x341736;};'use strict';var _=require(_0x64d6('0x0'));var util=require('util');var logger=require(_0x64d6('0x1'))('api');var moment=require(_0x64d6('0x2'));var BPromise=require(_0x64d6('0x3'));var rp=require(_0x64d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64d6('0x5'));var config=require(_0x64d6('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x64d6('0x7')]=function(_0x4583d0,_0x289fc5){return _0x4583d0[_0x64d6('0x8')](_0x64d6('0x9'),attributes,{'tableName':_0x64d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 8f4e231..7ed348e 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 _0x8e16=['request\x20sent','debug','stringify','error','message','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x3f0f80,_0x1c56ff){var _0x249326=function(_0x246fcf){while(--_0x246fcf){_0x3f0f80['push'](_0x3f0f80['shift']());}};_0x249326(++_0x1c56ff);}(_0x8e16,0xdc));var _0x68e1=function(_0x1c5fe0,_0x277bf2){_0x1c5fe0=_0x1c5fe0-0x0;var _0x3a54d9=_0x8e16[_0x1c5fe0];return _0x3a54d9;};'use strict';var _=require(_0x68e1('0x0'));var util=require('util');var moment=require(_0x68e1('0x1'));var BPromise=require('bluebird');var rs=require(_0x68e1('0x2'));var fs=require('fs');var Redis=require(_0x68e1('0x3'));var db=require(_0x68e1('0x4'))['db'];var utils=require(_0x68e1('0x5'));var logger=require(_0x68e1('0x6'))(_0x68e1('0x7'));var config=require(_0x68e1('0x8'));var jayson=require(_0x68e1('0x9'));var client=jayson[_0x68e1('0xa')][_0x68e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e816e,_0x9757bd,_0x537b18){return new BPromise(function(_0x253a8f,_0x52853c){return client['request'](_0x3e816e,_0x537b18)[_0x68e1('0xc')](function(_0x464a15){logger['info'](_0x68e1('0xd'),_0x9757bd,_0x68e1('0xe'));logger[_0x68e1('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x9757bd,_0x68e1('0xe'),JSON[_0x68e1('0x10')](_0x464a15));if(_0x464a15[_0x68e1('0x11')]){if(_0x464a15['error']['code']===0x1f4){logger[_0x68e1('0x11')](_0x68e1('0xd'),_0x9757bd,_0x464a15['error'][_0x68e1('0x12')]);return _0x52853c(_0x464a15[_0x68e1('0x11')]['message']);}logger[_0x68e1('0x11')](_0x68e1('0xd'),_0x9757bd,_0x464a15[_0x68e1('0x11')][_0x68e1('0x12')]);return _0x253a8f(_0x464a15['error'][_0x68e1('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x9757bd,_0x68e1('0xe'));_0x253a8f(_0x464a15['result'][_0x68e1('0x12')]);}})['catch'](function(_0xa52428){logger[_0x68e1('0x11')](_0x68e1('0xd'),_0x9757bd,_0xa52428);_0x52853c(_0xa52428);});});}exports[_0x68e1('0x13')]=function(_0x463e68){var _0x317683=this;return new Promise(function(_0x560271,_0x5469eb){return db[_0x68e1('0x14')][_0x68e1('0x15')](_0x463e68[_0x68e1('0x16')],{'raw':_0x463e68[_0x68e1('0x17')]?_0x463e68['options'][_0x68e1('0x18')]===undefined?!![]:![]:!![]})[_0x68e1('0xc')](function(_0x2da944){logger['info'](_0x68e1('0x13'),_0x463e68);logger['debug'](_0x68e1('0x13'),_0x463e68,JSON[_0x68e1('0x10')](_0x2da944));_0x560271(_0x2da944);})[_0x68e1('0x19')](function(_0x42a5d7){logger[_0x68e1('0x11')]('CreateVoiceTransferReport',_0x42a5d7[_0x68e1('0x12')],_0x463e68);_0x5469eb(_0x317683[_0x68e1('0x11')](0x1f4,_0x42a5d7['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6a9921b..5fca53b 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 _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xcb91[_0xc0a3d3];return _0x3386e8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file +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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4e25ea6..46d226f 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 _0xee24=['stack','name','status','send','NotFound','then','code','message','User','findOne','agent','rows','UserId','sessionId','length','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','info','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','stringify','emit','log','handleError:','error'];(function(_0x17882f,_0x38cc9a){var _0x358f81=function(_0x2b7fd1){while(--_0x2b7fd1){_0x17882f['push'](_0x17882f['shift']());}};_0x358f81(++_0x38cc9a);}(_0xee24,0x1a6));var _0x4ee2=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0xee24[_0x22d1ef];return _0x47c5a3;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x4ee2('0x0'));var db=require(_0x4ee2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var jayson=require(_0x4ee2('0x4'));var amiClient=jayson[_0x4ee2('0x5')]['http']({'port':0x232a});var logger=require(_0x4ee2('0x6'))(_0x4ee2('0x7'));var Redis=require(_0x4ee2('0x8'));config[_0x4ee2('0x9')]=_['defaults'](config[_0x4ee2('0x9')],{'host':_0x4ee2('0xa'),'port':0x18eb});var io=require(_0x4ee2('0xb'))(new Redis(config[_0x4ee2('0x9')]));var Schema=require(_0x4ee2('0xc'));var originateValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'callNumber':{'type':_0x4ee2('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x4ee2('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x4ee2('0xf'),'required':[!![],_0x4ee2('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4ee2('0xe')]},'sessionId':{'type':_0x4ee2('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x4ee2('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4ee2('0xd'),'required':[!![],_0x4ee2('0xe')]}});function emit(_0x1b95c5,_0x14bc72,_0x3b742c){logger['info'](_0x1b95c5,_0x14bc72,JSON[_0x4ee2('0x11')](_0x3b742c));io['to'](_0x1b95c5)[_0x4ee2('0x12')](_0x14bc72,_0x3b742c);}function handleError(_0x3d0308){return function(_0x4aba2b){console[_0x4ee2('0x13')](_0x4ee2('0x14'),_0x4aba2b,_0x4aba2b instanceof RangeError);logger[_0x4ee2('0x15')](_0x4aba2b[_0x4ee2('0x16')]);if(_0x4aba2b instanceof RangeError){if(_0x4aba2b[_0x4ee2('0x17')]){delete _0x4aba2b[_0x4ee2('0x17')];}_0x3d0308[_0x4ee2('0x18')](0x194)[_0x4ee2('0x19')](_0x4aba2b);}else{if(_0x4aba2b['name']){delete _0x4aba2b['name'];}_0x3d0308[_0x4ee2('0x18')](0x1f4)['send'](_0x4aba2b);}};}function checkError(){return function(_0x34c281){if(!_0x34c281){throw new RangeError(_0x4ee2('0x1a'));}return _0x34c281;};}function respondWithRpcPromise(_0x1d9a37,_0x416a78){return new BPromise(function(_0x4507d6,_0x53f246){var _0x1d5037=amiClient;return _0x1d5037['request'](_0x1d9a37,_0x416a78)[_0x4ee2('0x1b')](function(_0x3e6344){if(_0x3e6344[_0x4ee2('0x15')]){if(_0x3e6344[_0x4ee2('0x15')][_0x4ee2('0x1c')]===0x1f4){return _0x53f246(_0x3e6344[_0x4ee2('0x15')][_0x4ee2('0x1d')]);}return _0x4507d6(_0x3e6344['error'][_0x4ee2('0x1d')]);}else{_0x4507d6(_0x3e6344['result']);}})['catch'](function(_0xebd95f){_0x53f246(_0xebd95f);});});}function getAgent(_0x291734){return db[_0x4ee2('0x1e')][_0x4ee2('0x1f')]({'where':{'id':_0x291734,'role':_0x4ee2('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x50005e,_0x404fba){return new BPromise(function(_0x2a078f,_0x562a4d){var _0x2fe02a=respondWithRpcPromise('VoiceChannels');var _0x49b1be=getAgent(_0x50005e);Promise['all']([_0x2fe02a,_0x49b1be])[_0x4ee2('0x1b')](function(_0x970fa6){var _0x50da2d=_0x970fa6[0x0];var _0x3f68b9=_0x970fa6[0x1];var _0x6775f7=_['filter'](_0x50da2d[_0x4ee2('0x21')],function(_0x4bf072){return _0x4bf072[_0x4ee2('0x22')]==_0x3f68b9['id']&&_0x4bf072[_0x4ee2('0x23')]==_0x404fba;});if(_0x6775f7[_0x4ee2('0x24')]==0x1){_0x2a078f(_0x3f68b9);}else{_0x562a4d(new RangeError('sessionId\x20'+_0x404fba+'\x20not\x20found!'));}});});}exports[_0x4ee2('0x25')]=function(_0x14f164,_0x3ab2a1){logger['info'](_0x4ee2('0x26'),_0x14f164[_0x4ee2('0x27')]);var _0x1fca9f=originateValidation[_0x4ee2('0xc')](_0x14f164[_0x4ee2('0x27')]);if(_0x1fca9f[_0x4ee2('0x24')]>0x0){return _0x3ab2a1[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x1fca9f);}var _0x256bea=_0x14f164[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0x25db8f=_0x14f164['body'][_0x4ee2('0x2a')];var _0x287ff3=_0x14f164['body'][_0x4ee2('0x2b')];var _0x21968c=_0x14f164[_0x4ee2('0x27')][_0x4ee2('0x2c')];return getAgent(_0x256bea)[_0x4ee2('0x1b')](function(_0x429a90){logger[_0x4ee2('0x2d')]('entityFound:',_0x429a90[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x429a90['name']),_0x4ee2('0x30'),{'callNumber':_0x25db8f,'callerId':_0x287ff3,'callbackUrl':_0x21968c});return _0x3ab2a1['status'](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x31')});})[_0x4ee2('0x32')](handleError(_0x3ab2a1));};exports[_0x4ee2('0x33')]=function(_0x3c7282,_0x52fa55){logger['info']('hangup\x20fired:',_0x3c7282[_0x4ee2('0x27')]);var _0x3f2c6a=hangupValidation[_0x4ee2('0xc')](_0x3c7282[_0x4ee2('0x27')]);if(_0x3f2c6a[_0x4ee2('0x24')]>0x0){return _0x52fa55[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x3f2c6a);}var _0x29c4b3=_0x3c7282[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0x57b506=_0x3c7282['body'][_0x4ee2('0x23')];return getAgent(_0x29c4b3)[_0x4ee2('0x1b')](function(_0x1255ff){logger['info'](_0x4ee2('0x34'),_0x1255ff[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x1255ff[_0x4ee2('0x17')]),_0x4ee2('0x35'),{'sessionId':_0x57b506});return _0x52fa55[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x36')});})[_0x4ee2('0x32')](handleError(_0x52fa55));};exports['answer']=function(_0x5d4395,_0x3e7f65){logger[_0x4ee2('0x2d')](_0x4ee2('0x37'),_0x5d4395['body']);var _0x1ef1d5=answerValidation['validate'](_0x5d4395[_0x4ee2('0x27')]);if(_0x1ef1d5['length']>0x0){return _0x3e7f65[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x1ef1d5);}var _0x41607a=_0x5d4395['body'][_0x4ee2('0x29')];var _0x4e7a92=_0x5d4395[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x41607a)[_0x4ee2('0x1b')](function(_0x38a25a){logger['info'](_0x4ee2('0x34'),_0x38a25a[_0x4ee2('0x17')]);emit(util['format'](_0x4ee2('0x2f'),_0x38a25a['name']),'webbar:answer',{'sessionId':_0x4e7a92});return _0x3e7f65[_0x4ee2('0x18')](0xc8)['json']({'error':![],'message':_0x4ee2('0x38')});})['catch'](handleError(_0x3e7f65));};exports[_0x4ee2('0x39')]=function(_0x4641b8,_0x39237a){logger['info'](_0x4ee2('0x3a'),_0x4641b8[_0x4ee2('0x27')]);var _0x44ada1=holdValidation[_0x4ee2('0xc')](_0x4641b8[_0x4ee2('0x27')]);if(_0x44ada1['length']>0x0){return _0x39237a[_0x4ee2('0x18')](0x190)[_0x4ee2('0x28')](_0x44ada1);}var _0x535c11=_0x4641b8['body'][_0x4ee2('0x29')];var _0x54e734=_0x4641b8[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x535c11)['then'](function(_0x43ca98){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x43ca98['name']);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x43ca98['name']),'webbar:hold',{'sessionId':_0x54e734});return _0x39237a['status'](0xc8)['json']({'error':![],'message':_0x4ee2('0x3b')});})[_0x4ee2('0x32')](handleError(_0x39237a));};exports['unhold']=function(_0x1379c0,_0x3d25fb){logger[_0x4ee2('0x2d')](_0x4ee2('0x3c'),_0x1379c0[_0x4ee2('0x27')]);var _0x152519=unholdValidation[_0x4ee2('0xc')](_0x1379c0['body']);if(_0x152519[_0x4ee2('0x24')]>0x0){return _0x3d25fb['status'](0x190)[_0x4ee2('0x28')](_0x152519);}var _0x14a86d=_0x1379c0[_0x4ee2('0x27')]['userId'];var _0x386a59=_0x1379c0[_0x4ee2('0x27')][_0x4ee2('0x23')];return getAgent(_0x14a86d)['then'](function(_0x53a6c8){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x53a6c8[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')]('user:%s',_0x53a6c8[_0x4ee2('0x17')]),_0x4ee2('0x3d'),{'sessionId':_0x386a59});return _0x3d25fb[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':_0x4ee2('0x3e')});})[_0x4ee2('0x32')](handleError(_0x3d25fb));};exports[_0x4ee2('0x3f')]=function(_0x3c65ca,_0x279c28){logger[_0x4ee2('0x2d')](_0x4ee2('0x40'),_0x279c28[_0x4ee2('0x27')]);var _0x58dac3=callsValidation['validate'](_0x3c65ca[_0x4ee2('0x27')]);if(_0x58dac3[_0x4ee2('0x24')]>0x0){return _0x279c28[_0x4ee2('0x18')](0x190)['json'](_0x58dac3);}var _0x578908=_0x3c65ca[_0x4ee2('0x27')][_0x4ee2('0x29')];var _0xf00660=respondWithRpcPromise('VoiceChannels');var _0x45294c=getAgent(_0x578908);return Promise[_0x4ee2('0x41')]([_0xf00660,_0x45294c])[_0x4ee2('0x1b')](function(_0x3ef445){var _0x430dfc=_0x3ef445[0x0];var _0x5a9dac=_0x3ef445[0x1];var _0x55e0a4=_[_0x4ee2('0x42')](_0x430dfc[_0x4ee2('0x21')],function(_0x47f36e){return _0x47f36e[_0x4ee2('0x22')]==_0x5a9dac['id'];});return _0x279c28[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'count':_0x55e0a4[_0x4ee2('0x24')],'rows':_0x55e0a4});})[_0x4ee2('0x32')](handleError(_0x279c28));};exports['conference']=function(_0x344e1c,_0x56a88b){logger[_0x4ee2('0x2d')](_0x4ee2('0x43'),_0x344e1c['body']);var _0x1bb9e3=conferenceValidation[_0x4ee2('0xc')](_0x344e1c[_0x4ee2('0x27')]);if(_0x1bb9e3[_0x4ee2('0x24')]>0x0){return _0x56a88b['status'](0x190)[_0x4ee2('0x28')](_0x1bb9e3);}var _0x380682=_0x344e1c['body'][_0x4ee2('0x29')];return getAgent(_0x380682)[_0x4ee2('0x1b')](function(_0x33992f){logger[_0x4ee2('0x2d')]('entityFound:',_0x33992f[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x33992f[_0x4ee2('0x17')]),_0x4ee2('0x44'));return _0x56a88b[_0x4ee2('0x18')](0xc8)['json']({'error':![],'message':_0x4ee2('0x45')});})[_0x4ee2('0x32')](handleError(_0x56a88b));};exports[_0x4ee2('0x46')]=function(_0xd2a358,_0x4f34c1){logger[_0x4ee2('0x2d')](_0x4ee2('0x47'),_0xd2a358[_0x4ee2('0x27')]);var _0x54f7ab=transferValidation['validate'](_0xd2a358['body']);if(_0x54f7ab[_0x4ee2('0x24')]>0x0){return _0x4f34c1['status'](0x190)[_0x4ee2('0x28')](_0x54f7ab);}var _0xcdf9c2=_0xd2a358[_0x4ee2('0x27')]['userId'];var _0x5a5a9e=_0xd2a358[_0x4ee2('0x27')][_0x4ee2('0x23')];var _0x4217f9=_0xd2a358[_0x4ee2('0x27')][_0x4ee2('0x48')];return getAgent(_0xcdf9c2)[_0x4ee2('0x1b')](function(_0x5cc907){logger[_0x4ee2('0x2d')](_0x4ee2('0x34'),_0x5cc907[_0x4ee2('0x17')]);emit(util[_0x4ee2('0x2e')](_0x4ee2('0x2f'),_0x5cc907[_0x4ee2('0x17')]),_0x4ee2('0x49'),{'sessionId':_0x5a5a9e,'transferNumber':_0x4217f9});return _0x4f34c1[_0x4ee2('0x18')](0xc8)[_0x4ee2('0x28')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4f34c1));}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index f4eb6ae..59e818a 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 _0xd249=['show','getAnswers','/:id/users','getAgents','post','create','/:id/dispositions','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/notify','notify','put','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x792e6b,_0x1949c4){var _0x1627c2=function(_0xa89bb1){while(--_0xa89bb1){_0x792e6b['push'](_0x792e6b['shift']());}};_0x1627c2(++_0x1949c4);}(_0xd249,0x1b1));var _0x9d24=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0xd249[_0x462999];return _0x4b1366;};'use strict';var multer=require(_0x9d24('0x0'));var util=require(_0x9d24('0x1'));var path=require(_0x9d24('0x2'));var timeout=require(_0x9d24('0x3'));var express=require(_0x9d24('0x4'));var router=express[_0x9d24('0x5')]();var fs_extra=require(_0x9d24('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9d24('0x7'));var config=require(_0x9d24('0x8'));var controller=require(_0x9d24('0x9'));router[_0x9d24('0xa')]('/',auth['isAuthenticated'](),controller[_0x9d24('0xb')]);router[_0x9d24('0xa')](_0x9d24('0xc'),auth[_0x9d24('0xd')](),controller[_0x9d24('0xe')]);router['get']('/:id',auth[_0x9d24('0xd')](),controller[_0x9d24('0xf')]);router[_0x9d24('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x9d24('0xd')](),controller[_0x9d24('0x10')]);router['get'](_0x9d24('0x11'),auth['isAuthenticated'](),controller[_0x9d24('0x12')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x9d24('0x13')]('/',auth[_0x9d24('0xd')](),controller[_0x9d24('0x14')]);router[_0x9d24('0x13')](_0x9d24('0x15'),auth[_0x9d24('0xd')](),controller['addDisposition']);router[_0x9d24('0x13')](_0x9d24('0x16'),auth[_0x9d24('0xd')](),controller[_0x9d24('0x17')]);router[_0x9d24('0x13')](_0x9d24('0x11'),auth[_0x9d24('0xd')](),controller[_0x9d24('0x18')]);router['post'](_0x9d24('0x19'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9d24('0x13')](_0x9d24('0x1a'),controller[_0x9d24('0x1b')]);router[_0x9d24('0x13')]('/:id/send',auth[_0x9d24('0xd')](),controller['send']);router[_0x9d24('0x1c')]('/:id',auth[_0x9d24('0xd')](),controller['update']);router[_0x9d24('0x1d')](_0x9d24('0x1e'),auth[_0x9d24('0xd')](),controller[_0x9d24('0x1f')]);router['delete'](_0x9d24('0x15'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9d24('0x1d')](_0x9d24('0x16'),auth[_0x9d24('0xd')](),controller['removeAnswers']);router[_0x9d24('0x1d')](_0x9d24('0x11'),auth[_0x9d24('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 4862a13..5695b36 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 _0xfeb3=['name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','exports','STRING'];(function(_0x538daf,_0x2fe8f7){var _0x3433b0=function(_0x315143){while(--_0x315143){_0x538daf['push'](_0x538daf['shift']());}};_0x3433b0(++_0x2fe8f7);}(_0xfeb3,0x11c));var _0x3feb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfeb3[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3feb('0x0')]={'name':{'type':Sequelize[_0x3feb('0x1')],'unique':_0x3feb('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3feb('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x3feb('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x3feb('0x1')],'defaultValue':function(){return rs[_0x3feb('0x3')]();}},'phone':{'type':Sequelize[_0x3feb('0x1')]},'type':{'type':Sequelize[_0x3feb('0x4')](_0x3feb('0x5'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3feb('0x1')]},'authToken':{'type':Sequelize[_0x3feb('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3feb('0x6')],'defaultValue':function(){return _0x3feb('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3feb('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3feb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3feb('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3feb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3feb('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3feb('0x9')],'comment':_0x3feb('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x3feb('0x8')],'defaultValue':![],'comment':_0x3feb('0xb'),'set':function(_0x1c281a){if(!_0x1c281a){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x3feb('0xc')]('mandatoryDisposition',_0x1c281a);}},'description':{'type':Sequelize[_0x3feb('0x1')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 49de1af..4d601c5 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 _0x4563=['CannedAnswer','getAnswers','order','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','whatsapp','Applications','account','statuses','WhatsappMessage','message_id','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','from','From','whatsapp:','Body','sinch','notifications','messageId','isNil','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./whatsappAccount.socket','register','client','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','then','WhatsappAccounts','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','includeAll','include','findAll','merge','options','find','create','body','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','rows','removeDispositions','ids','addAnswer'];(function(_0x11cbbd,_0x5d4106){var _0x153af2=function(_0xd8cb94){while(--_0xd8cb94){_0x11cbbd['push'](_0x11cbbd['shift']());}};_0x153af2(++_0x5d4106);}(_0x4563,0x120));var _0x3456=function(_0x31b359,_0x3410a2){_0x31b359=_0x31b359-0x0;var _0xf0b73e=_0x4563[_0x31b359];return _0xf0b73e;};'use strict';var emlformat=require(_0x3456('0x0'));var rimraf=require(_0x3456('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3456('0x2'));var rp=require(_0x3456('0x3'));var moment=require(_0x3456('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3456('0x5'));var util=require(_0x3456('0x6'));var path=require('path');var sox=require(_0x3456('0x7'));var csv=require(_0x3456('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3456('0x9'));var _=require(_0x3456('0xa'));var squel=require(_0x3456('0xb'));var crypto=require(_0x3456('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3456('0xd'));var toCsv=require(_0x3456('0x8'));var querystring=require(_0x3456('0xe'));var Papa=require(_0x3456('0xf'));var Redis=require(_0x3456('0x10'));var authService=require(_0x3456('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3456('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3456('0x13'));var config=require(_0x3456('0x14'));var licenseUtil=require(_0x3456('0x15'));var db=require(_0x3456('0x16'))['db'];config['redis']=_[_0x3456('0x17')](config['redis'],{'host':_0x3456('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3456('0x19')]));require(_0x3456('0x1a'))[_0x3456('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3456('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5e06da,_0x2ad578,_0x5b1eb5,_0x182e1c){return new BPromise(function(_0x1a79ac,_0x5a8273){var _0x19d5d7=_0x182e1c||client;return _0x19d5d7['request'](_0x5e06da,_0x5b1eb5)['then'](function(_0xaed739){logger[_0x3456('0x1d')](_0x3456('0x1e'),_0x2ad578,_0x3456('0x1f'));logger[_0x3456('0x20')](_0x3456('0x21'),_0x2ad578,'request\x20sent',JSON[_0x3456('0x22')](_0xaed739));if(_0xaed739[_0x3456('0x23')]){if(_0xaed739[_0x3456('0x23')]['code']===0x1f4){logger[_0x3456('0x23')](_0x3456('0x1e'),_0x2ad578,_0xaed739[_0x3456('0x23')][_0x3456('0x24')]);return _0x5a8273(_0xaed739[_0x3456('0x23')][_0x3456('0x24')]);}logger['error'](_0x3456('0x1e'),_0x2ad578,_0xaed739[_0x3456('0x23')][_0x3456('0x24')]);return _0x1a79ac(_0xaed739['error'][_0x3456('0x24')]);}else{logger[_0x3456('0x1d')](_0x3456('0x1e'),_0x2ad578,_0x3456('0x1f'));_0x1a79ac(_0xaed739[_0x3456('0x25')][_0x3456('0x24')]);}})[_0x3456('0x26')](function(_0x366834){logger['error'](_0x3456('0x1e'),_0x2ad578,_0x366834);_0x5a8273(_0x366834);});});}function respondWithStatusCode(_0x46ae23,_0x424619){_0x424619=_0x424619||0xcc;return function(_0x473638){if(_0x473638){return _0x46ae23[_0x3456('0x27')](_0x424619);}return _0x46ae23['status'](_0x424619)[_0x3456('0x28')]();};}function respondWithResult(_0x1d4d64,_0xdade87){_0xdade87=_0xdade87||0xc8;return function(_0x2e29e2){if(_0x2e29e2){return _0x1d4d64['status'](_0xdade87)[_0x3456('0x29')](_0x2e29e2);}};}function respondWithFilteredResult(_0x3b16c7,_0x2552c2){return function(_0x45949c){if(_0x45949c){var _0xe6ed46=typeof _0x2552c2[_0x3456('0x2a')]==='undefined'&&typeof _0x2552c2[_0x3456('0x2b')]===_0x3456('0x2c');var _0x3a549c=_0x45949c['count'];var _0x2e3645=_0xe6ed46?0x0:_0x2552c2[_0x3456('0x2a')];var _0x4319c2=_0xe6ed46?_0x45949c[_0x3456('0x2d')]:_0x2552c2['offset']+_0x2552c2[_0x3456('0x2b')];var _0x384ba5;if(_0x4319c2>=_0x3a549c){_0x4319c2=_0x3a549c;_0x384ba5=0xc8;}else{_0x384ba5=0xce;}_0x3b16c7[_0x3456('0x2e')](_0x384ba5);return _0x3b16c7[_0x3456('0x2f')](_0x3456('0x30'),_0x2e3645+'-'+_0x4319c2+'/'+_0x3a549c)[_0x3456('0x29')](_0x45949c);}return null;};}function patchUpdates(_0x112510){return function(_0x319542){try{jsonpatch[_0x3456('0x31')](_0x319542,_0x112510,!![]);}catch(_0x1773ea){return BPromise[_0x3456('0x32')](_0x1773ea);}return _0x319542[_0x3456('0x33')]();};}function saveUpdates(_0x1e4116,_0x5626d3){return function(_0x5bfaab){if(_0x5bfaab){return _0x5bfaab[_0x3456('0x34')](_0x1e4116)['then'](function(_0x1e623a){return _0x1e623a;});}return null;};}function removeEntity(_0x1dfabc,_0x1db0f2){return function(_0x4da029){if(_0x4da029){return _0x4da029[_0x3456('0x35')]()[_0x3456('0x36')](function(){var _0x125727=_0x4da029['get']({'plain':!![]});var _0x75efaa=_0x3456('0x37');return db[_0x3456('0x38')][_0x3456('0x35')]({'where':{'type':_0x75efaa,'resourceId':_0x125727['id']}})[_0x3456('0x36')](function(){return _0x4da029;});})['then'](function(){_0x1dfabc[_0x3456('0x2e')](0xcc)[_0x3456('0x28')]();});}};}function handleEntityNotFound(_0x44de24,_0x15599c){return function(_0x1cb913){if(!_0x1cb913){_0x44de24[_0x3456('0x27')](0x194);}return _0x1cb913;};}function handleError(_0x18b974,_0x2b3da9){_0x2b3da9=_0x2b3da9||0x1f4;return function(_0xbc57b5){logger[_0x3456('0x23')](_0xbc57b5[_0x3456('0x39')]);if(_0xbc57b5[_0x3456('0x3a')]){delete _0xbc57b5[_0x3456('0x3a')];}_0x18b974[_0x3456('0x2e')](_0x2b3da9)['send'](_0xbc57b5);};}exports['index']=function(_0x31b0c3,_0x36ccc7){var _0x369a74={'include':[{'model':db[_0x3456('0x3b')],'as':_0x3456('0x3c')}]},_0x241f31={},_0x16ba99={'count':0x0,'rows':[]};var _0x5d245a=_[_0x3456('0x3d')](db[_0x3456('0x3e')][_0x3456('0x3f')],function(_0x5cef63){return{'name':_0x5cef63[_0x3456('0x40')],'type':_0x5cef63['type'][_0x3456('0x41')]};});_0x241f31[_0x3456('0x42')]=_[_0x3456('0x3d')](_0x5d245a,_0x3456('0x3a'));_0x241f31[_0x3456('0x43')]=_[_0x3456('0x44')](_0x31b0c3[_0x3456('0x43')]);_0x241f31[_0x3456('0x45')]=_[_0x3456('0x46')](_0x241f31[_0x3456('0x42')],_0x241f31[_0x3456('0x43')]);_0x369a74[_0x3456('0x47')]=_[_0x3456('0x46')](_0x241f31[_0x3456('0x42')],qs['fields'](_0x31b0c3[_0x3456('0x43')][_0x3456('0x48')]));_0x369a74['attributes']=_0x369a74[_0x3456('0x47')][_0x3456('0x49')]?_0x369a74[_0x3456('0x47')]:_0x241f31[_0x3456('0x42')];if(!_0x31b0c3[_0x3456('0x43')][_0x3456('0x4a')](_0x3456('0x4b'))){_0x369a74[_0x3456('0x2b')]=qs['limit'](_0x31b0c3['query'][_0x3456('0x2b')]);_0x369a74[_0x3456('0x2a')]=qs[_0x3456('0x2a')](_0x31b0c3[_0x3456('0x43')][_0x3456('0x2a')]);}_0x369a74['order']=qs['sort'](_0x31b0c3[_0x3456('0x43')][_0x3456('0x4c')]);_0x369a74['where']=qs['filters'](_[_0x3456('0x4d')](_0x31b0c3[_0x3456('0x43')],_0x241f31[_0x3456('0x45')]),_0x5d245a);if(_0x31b0c3['query'][_0x3456('0x4e')]){_0x369a74[_0x3456('0x4f')]=_['merge'](_0x369a74[_0x3456('0x4f')],{'$or':_[_0x3456('0x3d')](_0x5d245a,function(_0x3cbe69){if(_0x3cbe69[_0x3456('0x50')]!==_0x3456('0x51')){var _0x48131d={};_0x48131d[_0x3cbe69[_0x3456('0x3a')]]={'$like':'%'+_0x31b0c3['query'][_0x3456('0x4e')]+'%'};return _0x48131d;}})});}_0x369a74=_['merge']({},_0x369a74,_0x31b0c3['options']);var _0x5d24e0={'where':_0x369a74[_0x3456('0x4f')]};return db[_0x3456('0x3e')]['count'](_0x5d24e0)['then'](function(_0x2a630a){_0x16ba99[_0x3456('0x2d')]=_0x2a630a;if(_0x31b0c3[_0x3456('0x43')][_0x3456('0x52')]){_0x369a74[_0x3456('0x53')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x3456('0x54')](_0x369a74);})['then'](function(_0x157237){_0x16ba99['rows']=_0x157237;return _0x16ba99;})[_0x3456('0x36')](respondWithFilteredResult(_0x36ccc7,_0x369a74))[_0x3456('0x26')](handleError(_0x36ccc7,null));};exports['show']=function(_0x5013fd,_0xc59d1f){var _0x285478={'raw':![],'where':{'id':_0x5013fd['params']['id']},'include':[{'model':db[_0x3456('0x3b')],'as':_0x3456('0x3c')}]},_0x1158f5={};_0x1158f5[_0x3456('0x42')]=_[_0x3456('0x44')](db['WhatsappAccount'][_0x3456('0x3f')]);_0x1158f5['query']=_['keys'](_0x5013fd[_0x3456('0x43')]);_0x1158f5['filters']=_[_0x3456('0x46')](_0x1158f5['model'],_0x1158f5[_0x3456('0x43')]);_0x285478[_0x3456('0x47')]=_[_0x3456('0x46')](_0x1158f5[_0x3456('0x42')],qs[_0x3456('0x48')](_0x5013fd[_0x3456('0x43')][_0x3456('0x48')]));_0x285478['attributes']=_0x285478['attributes']['length']?_0x285478[_0x3456('0x47')]:_0x1158f5[_0x3456('0x42')];if(_0x5013fd[_0x3456('0x43')]['includeAll']){_0x285478[_0x3456('0x53')]=[{'all':!![]}];}_0x285478=_[_0x3456('0x55')]({},_0x285478,_0x5013fd[_0x3456('0x56')]);return db[_0x3456('0x3e')][_0x3456('0x57')](_0x285478)[_0x3456('0x36')](handleEntityNotFound(_0xc59d1f,null))[_0x3456('0x36')](respondWithResult(_0xc59d1f,null))[_0x3456('0x26')](handleError(_0xc59d1f,null));};exports[_0x3456('0x58')]=function(_0x4fa6e3,_0x13bf0f){return db['WhatsappAccount'][_0x3456('0x58')](_0x4fa6e3[_0x3456('0x59')],{})[_0x3456('0x36')](function(_0x4e62e4){var _0x1b9629=_0x4fa6e3[_0x3456('0x5a')][_0x3456('0x5b')]({'plain':!![]});if(!_0x1b9629)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1b9629['role']===_0x3456('0x5a')){var _0xaf8c43=_0x4e62e4['get']({'plain':!![]});var _0x249827=_0x3456('0x37');return db[_0x3456('0x5c')][_0x3456('0x57')]({'where':{'name':_0x249827,'userProfileId':_0x1b9629[_0x3456('0x5d')]},'raw':!![]})[_0x3456('0x36')](function(_0x3b8b77){if(_0x3b8b77&&_0x3b8b77['autoAssociation']===0x0){return db['UserProfileResource'][_0x3456('0x58')]({'name':_0xaf8c43[_0x3456('0x3a')],'resourceId':_0xaf8c43['id'],'type':_0x3b8b77[_0x3456('0x3a')],'sectionId':_0x3b8b77['id']},{})[_0x3456('0x36')](function(){return _0x4e62e4;});}else{return _0x4e62e4;}})[_0x3456('0x26')](function(_0x52af10){logger[_0x3456('0x23')](_0x3456('0x5e'),_0x52af10);throw _0x52af10;});}return _0x4e62e4;})[_0x3456('0x36')](respondWithResult(_0x13bf0f,0xc9))[_0x3456('0x26')](handleError(_0x13bf0f,null));};exports[_0x3456('0x34')]=function(_0x3e010e,_0x4c9356){if(_0x3e010e[_0x3456('0x59')]['id']){delete _0x3e010e[_0x3456('0x59')]['id'];}return db['WhatsappAccount'][_0x3456('0x57')]({'where':{'id':_0x3e010e[_0x3456('0x5f')]['id']},'include':[{'model':db[_0x3456('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x3456('0x36')](handleEntityNotFound(_0x4c9356,null))[_0x3456('0x36')](saveUpdates(_0x3e010e[_0x3456('0x59')],null))['then'](respondWithResult(_0x4c9356,null))[_0x3456('0x26')](handleError(_0x4c9356,null));};exports[_0x3456('0x35')]=function(_0x5b45b9,_0x41e38b){return db[_0x3456('0x3e')][_0x3456('0x57')]({'where':{'id':_0x5b45b9[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x41e38b,null))[_0x3456('0x36')](removeEntity(_0x41e38b,null))[_0x3456('0x26')](handleError(_0x41e38b,null));};exports[_0x3456('0x60')]=function(_0x2b3646,_0x2b82e1){return db[_0x3456('0x3e')]['describe']()[_0x3456('0x36')](respondWithResult(_0x2b82e1,null))[_0x3456('0x26')](handleError(_0x2b82e1,null));};exports[_0x3456('0x61')]=function(_0x14cab3,_0x322054,_0x4e07d4){if(_0x14cab3[_0x3456('0x59')]['id']){delete _0x14cab3[_0x3456('0x59')]['id'];}return db[_0x3456('0x3e')]['find']({'where':{'id':_0x14cab3[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x322054,null))['then'](function(_0x568391){if(_0x568391){_0x14cab3[_0x3456('0x59')][_0x3456('0x62')]=_0x568391['id'];return db[_0x3456('0x63')][_0x3456('0x58')](_0x14cab3[_0x3456('0x59')]);}})[_0x3456('0x36')](respondWithResult(_0x322054,null))[_0x3456('0x26')](handleError(_0x322054,null));};exports['getDispositions']=function(_0x394e08,_0x2bdfc0,_0x3c31c9){var _0x2563b9={'raw':![],'where':{}};var _0x5aa2bc={};var _0x4136a6={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x394e08[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x2bdfc0,null))[_0x3456('0x36')](function(_0x151030){if(_0x151030){_0x5aa2bc['model']=_[_0x3456('0x44')](db[_0x3456('0x63')][_0x3456('0x3f')]);_0x5aa2bc[_0x3456('0x43')]=_[_0x3456('0x44')](_0x394e08[_0x3456('0x43')]);_0x5aa2bc['filters']=_[_0x3456('0x46')](_0x5aa2bc[_0x3456('0x42')],_0x5aa2bc[_0x3456('0x43')]);_0x2563b9[_0x3456('0x47')]=_[_0x3456('0x46')](_0x5aa2bc[_0x3456('0x42')],qs[_0x3456('0x48')](_0x394e08['query']['fields']));_0x2563b9['attributes']=_0x2563b9['attributes'][_0x3456('0x49')]?_0x2563b9[_0x3456('0x47')]:_0x5aa2bc[_0x3456('0x42')];if(!_0x394e08[_0x3456('0x43')][_0x3456('0x4a')](_0x3456('0x4b'))){_0x2563b9['limit']=qs[_0x3456('0x2b')](_0x394e08[_0x3456('0x43')]['limit']);_0x2563b9[_0x3456('0x2a')]=qs[_0x3456('0x2a')](_0x394e08[_0x3456('0x43')][_0x3456('0x2a')]);}_0x2563b9['order']=qs[_0x3456('0x4c')](_0x394e08[_0x3456('0x43')][_0x3456('0x4c')]);_0x2563b9[_0x3456('0x4f')]=qs[_0x3456('0x45')](_[_0x3456('0x4d')](_0x394e08[_0x3456('0x43')],_0x5aa2bc[_0x3456('0x45')]));_0x2563b9['where'][_0x3456('0x62')]=_0x151030['id'];if(_0x394e08[_0x3456('0x43')][_0x3456('0x4e')]){_0x2563b9['where']=_[_0x3456('0x55')](_0x2563b9[_0x3456('0x4f')],{'$or':_['map'](_0x2563b9['attributes'],function(_0x23ad99){var _0x5cd4ad={};_0x5cd4ad[_0x23ad99]={'$like':'%'+_0x394e08[_0x3456('0x43')][_0x3456('0x4e')]+'%'};return _0x5cd4ad;})});}_0x2563b9=_[_0x3456('0x55')]({},_0x2563b9,_0x394e08[_0x3456('0x56')]);return db[_0x3456('0x63')][_0x3456('0x2d')]({'where':_0x2563b9[_0x3456('0x4f')]})[_0x3456('0x36')](function(_0x5f4f6d){_0x4136a6['count']=_0x5f4f6d;if(_0x394e08[_0x3456('0x43')][_0x3456('0x52')]){_0x2563b9[_0x3456('0x53')]=[{'all':!![]}];}return db[_0x3456('0x63')][_0x3456('0x54')](_0x2563b9);})[_0x3456('0x36')](function(_0x220946){_0x4136a6[_0x3456('0x64')]=_0x220946;return _0x4136a6;});}})[_0x3456('0x36')](respondWithFilteredResult(_0x2bdfc0,_0x2563b9))[_0x3456('0x26')](handleError(_0x2bdfc0,null));};exports[_0x3456('0x65')]=function(_0x4bf249,_0x142c80,_0x481884){return db[_0x3456('0x3e')][_0x3456('0x57')]({'where':{'id':_0x4bf249[_0x3456('0x5f')]['id']}})['then'](handleEntityNotFound(_0x142c80,null))[_0x3456('0x36')](function(_0x1cd6c9){if(_0x1cd6c9){return _0x1cd6c9[_0x3456('0x65')](_0x4bf249['query'][_0x3456('0x66')]);}})[_0x3456('0x36')](respondWithStatusCode(_0x142c80,null))['catch'](handleError(_0x142c80,null));};exports[_0x3456('0x67')]=function(_0x2ba0fc,_0x450ed1,_0x17246e){if(_0x2ba0fc['body']['id']){delete _0x2ba0fc['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2ba0fc[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x450ed1,null))[_0x3456('0x36')](function(_0x51438e){if(_0x51438e){_0x2ba0fc['body'][_0x3456('0x62')]=_0x51438e['id'];return db[_0x3456('0x68')][_0x3456('0x58')](_0x2ba0fc[_0x3456('0x59')]);}})[_0x3456('0x36')](respondWithResult(_0x450ed1,null))[_0x3456('0x26')](handleError(_0x450ed1,null));};exports[_0x3456('0x69')]=function(_0xb5491a,_0x4001b4,_0x404838){var _0x198693={'raw':![],'where':{}};var _0x29541b={};var _0x3fc0ee={'count':0x0,'rows':[]};return db[_0x3456('0x3e')]['findOne']({'where':{'id':_0xb5491a[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x4001b4,null))[_0x3456('0x36')](function(_0x19224c){if(_0x19224c){_0x29541b['model']=_[_0x3456('0x44')](db[_0x3456('0x68')][_0x3456('0x3f')]);_0x29541b[_0x3456('0x43')]=_['keys'](_0xb5491a['query']);_0x29541b[_0x3456('0x45')]=_[_0x3456('0x46')](_0x29541b[_0x3456('0x42')],_0x29541b[_0x3456('0x43')]);_0x198693['attributes']=_[_0x3456('0x46')](_0x29541b[_0x3456('0x42')],qs[_0x3456('0x48')](_0xb5491a[_0x3456('0x43')]['fields']));_0x198693[_0x3456('0x47')]=_0x198693[_0x3456('0x47')]['length']?_0x198693[_0x3456('0x47')]:_0x29541b['model'];if(!_0xb5491a['query'][_0x3456('0x4a')](_0x3456('0x4b'))){_0x198693[_0x3456('0x2b')]=qs[_0x3456('0x2b')](_0xb5491a[_0x3456('0x43')][_0x3456('0x2b')]);_0x198693[_0x3456('0x2a')]=qs[_0x3456('0x2a')](_0xb5491a[_0x3456('0x43')]['offset']);}_0x198693[_0x3456('0x6a')]=qs[_0x3456('0x4c')](_0xb5491a['query']['sort']);_0x198693[_0x3456('0x4f')]=qs[_0x3456('0x45')](_[_0x3456('0x4d')](_0xb5491a[_0x3456('0x43')],_0x29541b[_0x3456('0x45')]));_0x198693[_0x3456('0x4f')][_0x3456('0x62')]=_0x19224c['id'];if(_0xb5491a[_0x3456('0x43')][_0x3456('0x4e')]){_0x198693['where']=_[_0x3456('0x55')](_0x198693[_0x3456('0x4f')],{'$or':_['map'](_0x198693[_0x3456('0x47')],function(_0x395e0b){var _0x275d57={};_0x275d57[_0x395e0b]={'$like':'%'+_0xb5491a[_0x3456('0x43')]['filter']+'%'};return _0x275d57;})});}_0x198693=_['merge']({},_0x198693,_0xb5491a[_0x3456('0x56')]);return db[_0x3456('0x68')]['count']({'where':_0x198693[_0x3456('0x4f')]})[_0x3456('0x36')](function(_0x516472){_0x3fc0ee[_0x3456('0x2d')]=_0x516472;if(_0xb5491a[_0x3456('0x43')]['includeAll']){_0x198693['include']=[{'all':!![]}];}return db[_0x3456('0x68')][_0x3456('0x54')](_0x198693);})[_0x3456('0x36')](function(_0x29f738){_0x3fc0ee[_0x3456('0x64')]=_0x29f738;return _0x3fc0ee;});}})[_0x3456('0x36')](respondWithFilteredResult(_0x4001b4,_0x198693))[_0x3456('0x26')](handleError(_0x4001b4,null));};exports[_0x3456('0x6b')]=function(_0x1f34e9,_0x30e65d,_0x4508db){return db[_0x3456('0x3e')][_0x3456('0x57')]({'where':{'id':_0x1f34e9[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x30e65d,null))[_0x3456('0x36')](function(_0x1947cb){if(_0x1947cb){return _0x1947cb['removeAnswers'](_0x1f34e9['query'][_0x3456('0x66')]);}})[_0x3456('0x36')](respondWithStatusCode(_0x30e65d,null))[_0x3456('0x26')](handleError(_0x30e65d,null));};exports[_0x3456('0x6c')]=function(_0x2a4ca9,_0x51ae71,_0x824394){return db['WhatsappAccount'][_0x3456('0x57')]({'where':{'id':_0x2a4ca9[_0x3456('0x5f')]['id']}})['then'](handleEntityNotFound(_0x51ae71,null))['then'](function(_0xa3b6fd){if(_0xa3b6fd){return _0xa3b6fd[_0x3456('0x6c')](_0x2a4ca9[_0x3456('0x59')][_0x3456('0x66')],_[_0x3456('0x6d')](_0x2a4ca9['body'],[_0x3456('0x66'),'id'])||{})[_0x3456('0x6e')](function(_0x1423ce){for(var _0x3e6309=0x0;_0x3e6309<_0x2a4ca9['body'][_0x3456('0x66')][_0x3456('0x49')];_0x3e6309+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x2a4ca9['body'][_0x3456('0x66')][_0x3e6309]),'WhatsappAccountId':Number(_0x2a4ca9[_0x3456('0x5f')]['id'])});}return _0x1423ce;});}})[_0x3456('0x36')](respondWithResult(_0x51ae71,null))[_0x3456('0x26')](handleError(_0x51ae71,null));};exports[_0x3456('0x6f')]=function(_0x52e99a,_0x2844a2,_0x5dfa07){return db[_0x3456('0x3e')]['find']({'where':{'id':_0x52e99a[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x2844a2,null))['then'](function(_0x2b395e){if(_0x2b395e){return _0x2b395e[_0x3456('0x6f')](_0x52e99a[_0x3456('0x43')][_0x3456('0x66')])[_0x3456('0x36')](function(){if(_[_0x3456('0x70')](_0x52e99a[_0x3456('0x43')][_0x3456('0x66')])){for(var _0x1ba8f5=0x0;_0x1ba8f5<_0x52e99a[_0x3456('0x43')][_0x3456('0x66')][_0x3456('0x49')];_0x1ba8f5+=0x1){socket[_0x3456('0x71')](_0x3456('0x72'),{'UserId':Number(_0x52e99a[_0x3456('0x43')][_0x3456('0x66')][_0x1ba8f5]),'WhatsappAccountId':Number(_0x52e99a[_0x3456('0x5f')]['id'])});}}else{socket[_0x3456('0x71')](_0x3456('0x72'),{'UserId':Number(_0x52e99a[_0x3456('0x43')][_0x3456('0x66')]),'WhatsappAccountId':Number(_0x52e99a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2844a2,null))['catch'](handleError(_0x2844a2,null));};exports[_0x3456('0x73')]=function(_0x2fa470,_0x34581a,_0x335d6d){var _0x54e78c={};var _0x1aee35={};var _0x38668e;var _0xc6e8b6;return db[_0x3456('0x3e')][_0x3456('0x74')]({'where':{'id':_0x2fa470[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x34581a,null))[_0x3456('0x36')](function(_0xa0abfc){if(_0xa0abfc){_0x38668e=_0xa0abfc;_0x1aee35[_0x3456('0x42')]=_[_0x3456('0x44')](db[_0x3456('0x75')][_0x3456('0x3f')]);_0x1aee35[_0x3456('0x43')]=_[_0x3456('0x44')](_0x2fa470[_0x3456('0x43')]);_0x1aee35['filters']=_[_0x3456('0x46')](_0x1aee35['model'],_0x1aee35[_0x3456('0x43')]);_0x54e78c['attributes']=_[_0x3456('0x46')](_0x1aee35[_0x3456('0x42')],qs['fields'](_0x2fa470[_0x3456('0x43')][_0x3456('0x48')]));_0x54e78c[_0x3456('0x47')]=_0x54e78c[_0x3456('0x47')][_0x3456('0x49')]?_0x54e78c[_0x3456('0x47')]:_0x1aee35['model'];_0x54e78c[_0x3456('0x6a')]=qs[_0x3456('0x4c')](_0x2fa470[_0x3456('0x43')][_0x3456('0x4c')]);_0x54e78c['where']=qs[_0x3456('0x45')](_[_0x3456('0x4d')](_0x2fa470[_0x3456('0x43')],_0x1aee35['filters']));if(_0x2fa470[_0x3456('0x43')]['filter']){_0x54e78c[_0x3456('0x4f')]=_[_0x3456('0x55')](_0x54e78c[_0x3456('0x4f')],{'$or':_['map'](_0x54e78c[_0x3456('0x47')],function(_0x156ddd){var _0x58e010={};_0x58e010[_0x156ddd]={'$like':'%'+_0x2fa470[_0x3456('0x43')][_0x3456('0x4e')]+'%'};return _0x58e010;})});}_0x54e78c=_[_0x3456('0x55')]({},_0x54e78c,_0x2fa470[_0x3456('0x56')]);return _0x38668e[_0x3456('0x73')](_0x54e78c);}})[_0x3456('0x36')](function(_0x1a3663){if(_0x1a3663){_0xc6e8b6=_0x1a3663[_0x3456('0x49')];if(!_0x2fa470[_0x3456('0x43')][_0x3456('0x4a')](_0x3456('0x4b'))){_0x54e78c['limit']=qs[_0x3456('0x2b')](_0x2fa470[_0x3456('0x43')][_0x3456('0x2b')]);_0x54e78c[_0x3456('0x2a')]=qs['offset'](_0x2fa470[_0x3456('0x43')][_0x3456('0x2a')]);}return _0x38668e[_0x3456('0x73')](_0x54e78c);}})[_0x3456('0x36')](function(_0x1efea1){if(_0x1efea1){return _0x1efea1?{'count':_0xc6e8b6,'rows':_0x1efea1}:null;}})['then'](respondWithResult(_0x34581a,null))[_0x3456('0x26')](handleError(_0x34581a,null));};exports[_0x3456('0x76')]=function(_0xee3f46,_0x51f15f){var _0x54f296=_0xee3f46[_0x3456('0x5f')]['id'];var _0x2f754f=_0xee3f46[_0x3456('0x59')];var _0x566ac6=0xc8;var _0x4a0d71=null;return db[_0x3456('0x77')][_0x3456('0x78')]({'isolationLevel':db[_0x3456('0x77')][_0x3456('0x79')][_0x3456('0x7a')][_0x3456('0x7b')]},function(_0x289f4e){return db[_0x3456('0x3e')]['findOne']({'where':{'id':_0x54f296},'transaction':_0x289f4e})['then'](function(_0x12271d){if(_0x12271d){return db[_0x3456('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x54f296},'transaction':_0x289f4e})[_0x3456('0x36')](function(){var _0x1d8992=_[_0x3456('0x3d')](_0x2f754f,function(_0x4c7fbb){_0x4c7fbb['WhatsappAccountId']=_0x54f296;return _0x4c7fbb;});return db['WhatsappApplication'][_0x3456('0x7d')](_0x1d8992,{'transaction':_0x289f4e});});}else{_0x566ac6=0x194;_0x4a0d71=[];}});})['then'](function(){if(_0x566ac6!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x54f296},'order':_0x3456('0x7e')})[_0x3456('0x36')](function(_0x21fc79){_0x4a0d71=_0x21fc79;});}})[_0x3456('0x26')](function(_0xe0708d){_0x566ac6=0x1f4;logger[_0x3456('0x23')](_0xe0708d['stack']);if(_0xe0708d['name']){delete _0xe0708d[_0x3456('0x3a')];}_0x4a0d71=_0xe0708d;})[_0x3456('0x7f')](function(){if(_0x4a0d71===null){_0x51f15f[_0x3456('0x27')](_0x566ac6);}else{if(_0x566ac6===0x1f4){_0x51f15f[_0x3456('0x2e')](_0x566ac6)[_0x3456('0x80')](_0x4a0d71);}else{_0x51f15f['status'](_0x566ac6)['json'](_0x4a0d71);}}});};exports[_0x3456('0x81')]=function(_0x50db35,_0x31dd8c,_0x5c76c7){var _0x11d71b={};var _0x2adfb9={};var _0x5f2781;var _0x354dbb;return db[_0x3456('0x3e')]['findOne']({'where':{'id':_0x50db35[_0x3456('0x5f')]['id']}})[_0x3456('0x36')](handleEntityNotFound(_0x31dd8c,null))[_0x3456('0x36')](function(_0xd3c819){if(_0xd3c819){_0x5f2781=_0xd3c819;_0x2adfb9[_0x3456('0x42')]=_[_0x3456('0x44')](db[_0x3456('0x7c')]['rawAttributes']);_0x2adfb9[_0x3456('0x43')]=_[_0x3456('0x44')](_0x50db35[_0x3456('0x43')]);_0x2adfb9[_0x3456('0x45')]=_[_0x3456('0x46')](_0x2adfb9['model'],_0x2adfb9[_0x3456('0x43')]);_0x11d71b[_0x3456('0x47')]=_['intersection'](_0x2adfb9[_0x3456('0x42')],qs[_0x3456('0x48')](_0x50db35[_0x3456('0x43')][_0x3456('0x48')]));_0x11d71b[_0x3456('0x47')]=_0x11d71b[_0x3456('0x47')]['length']?_0x11d71b[_0x3456('0x47')]:_0x2adfb9[_0x3456('0x42')];_0x11d71b['order']=qs[_0x3456('0x4c')](_0x50db35[_0x3456('0x43')][_0x3456('0x4c')]);_0x11d71b[_0x3456('0x4f')]=qs['filters'](_[_0x3456('0x4d')](_0x50db35[_0x3456('0x43')],_0x2adfb9[_0x3456('0x45')]));if(_0x50db35[_0x3456('0x43')][_0x3456('0x4e')]){_0x11d71b[_0x3456('0x4f')]=_[_0x3456('0x55')](_0x11d71b[_0x3456('0x4f')],{'$or':_['map'](_0x11d71b[_0x3456('0x47')],function(_0x1114b9){var _0x1f180a={};_0x1f180a[_0x1114b9]={'$like':'%'+_0x50db35[_0x3456('0x43')][_0x3456('0x4e')]+'%'};return _0x1f180a;})});}_0x11d71b=_[_0x3456('0x55')]({},_0x11d71b,_0x50db35[_0x3456('0x56')]);return _0x5f2781[_0x3456('0x81')](_0x11d71b);}})['then'](function(_0x4bf5f9){if(_0x4bf5f9){_0x354dbb=_0x4bf5f9[_0x3456('0x49')];if(!_0x50db35[_0x3456('0x43')]['hasOwnProperty'](_0x3456('0x4b'))){_0x11d71b[_0x3456('0x2b')]=qs[_0x3456('0x2b')](_0x50db35[_0x3456('0x43')][_0x3456('0x2b')]);_0x11d71b[_0x3456('0x2a')]=qs[_0x3456('0x2a')](_0x50db35[_0x3456('0x43')]['offset']);}return _0x5f2781[_0x3456('0x81')](_0x11d71b);}})['then'](function(_0x2f16f4){if(_0x2f16f4){return _0x2f16f4?{'count':_0x354dbb,'rows':_0x2f16f4}:null;}})['then'](respondWithResult(_0x31dd8c,null))['catch'](handleError(_0x31dd8c,null));};exports['notify']=function(_0x17ecd7,_0x2a686d,_0x5cf38d){var _0x218d84={'channel':_0x3456('0x82')};var _0x539307=[];var _0x55d70e=[];var _0x1278b2={};return db[_0x3456('0x3e')][_0x3456('0x57')]({'where':{'id':_0x17ecd7[_0x3456('0x5f')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3456('0x83')}]})[_0x3456('0x36')](handleEntityNotFound(_0x2a686d,null))[_0x3456('0x36')](function(_0x231587){_0x218d84['account']=_0x231587;if(_0x218d84[_0x3456('0x84')]&&_0x218d84['account'][_0x3456('0x50')]==='sinch'&&_0x17ecd7['body'][_0x3456('0x85')]){if(_0x17ecd7['body'][_0x3456('0x85')][_0x3456('0x49')]===0x0)return;if(_0x17ecd7['body'][_0x3456('0x85')][0x0]['state']!=='read')return;return db[_0x3456('0x86')][_0x3456('0x34')]({'read':!![],'readAt':_0x17ecd7['body'][_0x3456('0x85')][0x0]['timestamp']},{'where':{'messageId':_0x17ecd7['body'][_0x3456('0x85')][0x0][_0x3456('0x87')]},'individualHooks':!![]})[_0x3456('0x36')](function(_0x16f738){return _0x2a686d['status'](0xc8)[_0x3456('0x29')](_0x16f738);});}_0x218d84[_0x3456('0x88')]=_[_0x3456('0x89')](_0x231587[_0x3456('0x83')],[_0x3456('0x7e')],['asc']);if(_0x218d84[_0x3456('0x84')][_0x3456('0x83')]){delete _0x218d84[_0x3456('0x84')]['Applications'];}return db[_0x3456('0x8a')][_0x3456('0x60')]()[_0x3456('0x36')](function(_0x139eb5){if(!_0x139eb5){throw new db[(_0x3456('0x8b'))]['ValidationError'](_0x3456('0x8c'));}_0x539307=_['difference'](_[_0x3456('0x44')](_0x139eb5),[_0x3456('0x8d'),_0x3456('0x8e')]);_0x55d70e=_[_0x3456('0x8f')](_[_0x3456('0x44')](_0x139eb5),[_0x3456('0x8d'),'updatedAt',_0x3456('0x90'),_0x3456('0x91')]);_0x218d84[_0x3456('0x59')]={'mapKey':_0x3456('0x92')};if(_0x218d84[_0x3456('0x84')]&&_0x218d84[_0x3456('0x84')]['type']==='twilio'){_0x218d84[_0x3456('0x59')][_0x3456('0x93')]=_0x17ecd7[_0x3456('0x59')][_0x3456('0x94')]['replace'](_0x3456('0x95'),'');_0x218d84[_0x3456('0x59')][_0x3456('0x59')]=_0x17ecd7[_0x3456('0x59')][_0x3456('0x96')];_0x218d84[_0x3456('0x59')]['messageId']=_0x17ecd7['body']['MessageSid'];}if(_0x218d84[_0x3456('0x84')]&&_0x218d84[_0x3456('0x84')][_0x3456('0x50')]===_0x3456('0x97')){_0x218d84[_0x3456('0x59')][_0x3456('0x93')]=_0x17ecd7['body']['notifications'][0x0][_0x3456('0x93')];_0x218d84['body'][_0x3456('0x59')]=_0x17ecd7[_0x3456('0x59')][_0x3456('0x98')][0x0]['message'][_0x3456('0x59')];_0x218d84['body'][_0x3456('0x99')]=_0x17ecd7[_0x3456('0x59')][_0x3456('0x98')][0x0][_0x3456('0x87')];}if(_0x218d84[_0x3456('0x59')]['id']){delete _0x218d84[_0x3456('0x59')]['id'];}if(_[_0x3456('0x9a')](_0x218d84[_0x3456('0x59')][_0x3456('0x93')])){throw new db['Sequelize']['ValidationError'](_0x3456('0x9b'));}if(_['isNil'](_0x218d84[_0x3456('0x59')][_0x3456('0x59')])||_0x218d84[_0x3456('0x59')][_0x3456('0x59')]===''){throw new db[(_0x3456('0x8b'))][(_0x3456('0x9c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3456('0x9a')](_0x218d84['body'][_0x3456('0x9d')])){throw new db[(_0x3456('0x8b'))][(_0x3456('0x9c'))](_0x3456('0x9e')+_0x55d70e);}if(!_[_0x3456('0x9f')](_0x55d70e,_0x218d84[_0x3456('0x59')][_0x3456('0x9d')])){throw new db['Sequelize'][(_0x3456('0x9c'))](_0x3456('0xa0')+_0x55d70e);}_0x1278b2[_0x218d84[_0x3456('0x59')]['mapKey']]=_0x218d84['body'][_0x3456('0x93')];return db[_0x3456('0xa1')][_0x3456('0x57')]({'where':{'id':_0x218d84[_0x3456('0x84')][_0x3456('0x91')]},'include':[{'model':db[_0x3456('0x8a')],'as':_0x3456('0xa2'),'where':_0x1278b2,'limit':0x1,'order':[['updatedAt',_0x3456('0xa3')]]}]});})[_0x3456('0x36')](handleEntityNotFound(_0x2a686d,null))[_0x3456('0x36')](function(_0x29399e){if(_0x29399e){_0x218d84['list']=_['omit'](_0x29399e,[_0x3456('0xa2')]);if(_0x29399e[_0x3456('0xa2')][_0x3456('0x49')]){return _0x29399e['Contacts'][0x0];}var _0x588ab3=_[_0x3456('0x17')](_0x218d84['body'],{'firstName':_0x218d84[_0x3456('0x59')]['from'],'ListId':_0x29399e['id']});_0x588ab3[_0x218d84[_0x3456('0x59')][_0x3456('0x9d')]]=_0x218d84['body'][_0x3456('0x93')];return db[_0x3456('0x8a')]['create'](_0x588ab3,{'fields':_0x539307,'raw':!![]});}})[_0x3456('0x36')](handleEntityNotFound(_0x2a686d,null))[_0x3456('0x36')](function(_0x5128f2){if(_0x5128f2){_0x218d84[_0x3456('0xa4')]=_0x5128f2;var _0x34377b={'ContactId':_0x5128f2['id'],'phone':_0x218d84[_0x3456('0x59')]['from'],'WhatsappAccountId':_0x17ecd7[_0x3456('0x5f')]['id']};var _0x22f2a2={'ContactId':_0x5128f2['id'],'WhatsappAccountId':_0x17ecd7[_0x3456('0x5f')]['id'],'closed':![]};return db[_0x3456('0xa5')]['find']({'where':_0x22f2a2})[_0x3456('0x36')](function(_0x4200d7){if(_0x4200d7){return[_0x4200d7,![]];}return db['WhatsappInteraction'][_0x3456('0x58')](_0x34377b)[_0x3456('0x36')](function(_0x2fed06){return[_0x2fed06,!![]];});});}})[_0x3456('0x6e')](function(_0x39e457,_0x3deb10){_0x218d84[_0x3456('0xa6')]=_0x39e457[_0x3456('0x5b')]({'plain':!![]});_0x218d84[_0x3456('0xa6')][_0x3456('0xa7')]=![];if(_0x3deb10){if(_0x218d84[_0x3456('0x84')]['autoclose']){_0x218d84[_0x3456('0x88')][_0x3456('0xa8')]({'id':0x0,'priority':_0x218d84[_0x3456('0x88')]['length']+0x1,'app':_0x3456('0xa9'),'appdata':'unmanaged','interval':_0x3456('0xaa')});}_0x218d84[_0x3456('0xa6')][_0x3456('0xa7')]=!![];}return db['WhatsappMessage'][_0x3456('0x58')]({'phone':_0x218d84['body']['from'],'messageId':_0x218d84[_0x3456('0x59')][_0x3456('0x99')],'body':_0x218d84[_0x3456('0x59')][_0x3456('0x59')],'WhatsappAccountId':_0x17ecd7['params']['id'],'WhatsappInteractionId':_0x39e457['id'],'direction':'in','ContactId':_0x39e457[_0x3456('0xab')],'AttachmentId':_0x218d84[_0x3456('0x59')][_0x3456('0xac')]});})[_0x3456('0x36')](function(_0x468bf3){_0x218d84[_0x3456('0x24')]=_0x468bf3;if(!_0x218d84['interaction']['UserId'])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x218d84[_0x3456('0xa6')][_0x3456('0xad')]}});})[_0x3456('0x36')](function(_0x4f5bab){if(_0x4f5bab){_0x218d84[_0x3456('0x88')][_0x3456('0xae')]({'id':0x0,'priority':0x0,'app':_0x3456('0xaf'),'appdata':_0x4f5bab[_0x3456('0x3a')]+','+(_0x218d84['account'][_0x3456('0xb0')]||0xa),'interval':_0x3456('0xaa')});}if(!_0x218d84[_0x3456('0xa6')][_0x3456('0xb1')])return;return db[_0x3456('0xb2')][_0x3456('0x57')]({'attributes':['id','name'],'where':{'id':_0x218d84['interaction'][_0x3456('0xb1')]}});})[_0x3456('0x36')](function(_0x2a0245){if(_0x2a0245){_0x218d84['applications'][_0x3456('0xae')]({'id':0x0,'priority':0x1,'app':_0x3456('0xb3'),'appdata':_0x2a0245[_0x3456('0x3a')]+','+(_0x218d84[_0x3456('0x84')][_0x3456('0xb4')]||0x12c),'interval':_0x3456('0xaa')});}return respondWithRpcPromise(_0x3456('0xb5'),_0x3456('0xb6'),_0x218d84);})[_0x3456('0x36')](function(_0x354b6f){if(_0x354b6f){var _0x1cb4ba=0xc8;var _0x15ddd0=_0x3456('0xb7');logger[_0x3456('0x1d')](_0x3456('0x21'),_0x15ddd0,_0x1cb4ba,_0x3456('0xb8'));logger[_0x3456('0x20')](_0x3456('0xb9'),_0x15ddd0,_0x1cb4ba,_0x3456('0xb8'),JSON[_0x3456('0x22')](_0x354b6f));if(_0x218d84[_0x3456('0x84')]['type']===_0x3456('0xba')){return _0x2a686d[_0x3456('0x2e')](_0x1cb4ba)['set'](_0x3456('0xbb'),_0x3456('0xbc'))[_0x3456('0x80')](_0x3456('0xbd'));}else{return _0x2a686d[_0x3456('0x2e')](_0x1cb4ba)['json'](_0x354b6f);}}});})['catch'](handleError(_0x2a686d,null));};exports['send']=function(_0x333d2c,_0x3b07ee,_0x25ec0c){var _0x15588f,_0x2e47a3,_0x12ee3a;if(_[_0x3456('0x9a')](_0x333d2c[_0x3456('0x59')][_0x3456('0x59')])||_0x333d2c[_0x3456('0x59')][_0x3456('0x59')]===''){throw new db[(_0x3456('0x8b'))][(_0x3456('0x9c'))](_0x3456('0xbe'));}if(_[_0x3456('0x9a')](_0x333d2c[_0x3456('0x59')]['to'])){throw new db[(_0x3456('0x8b'))][(_0x3456('0x9c'))](_0x3456('0xbf'));}_0x15588f=_0x333d2c[_0x3456('0x59')]['to'];return db[_0x3456('0x3e')][_0x3456('0x57')]({'where':{'id':_0x333d2c[_0x3456('0x5f')]['id']},'include':[{'model':db[_0x3456('0xa1')],'as':_0x3456('0xc0'),'include':[{'model':db[_0x3456('0x8a')],'as':_0x3456('0xa2'),'where':{'mobile':_0x15588f},'limit':0x1,'order':[[_0x3456('0x8e'),'DESC']]}]}]})[_0x3456('0x36')](handleEntityNotFound(_0x3b07ee,null))[_0x3456('0x36')](function(_0x10cda5){if(_0x10cda5&&_0x10cda5[_0x3456('0xc0')]){_0x2e47a3=_0x10cda5[_0x3456('0x5b')]({'plain':!![]});if(_0x2e47a3['List']&&_0x2e47a3[_0x3456('0xc0')]['Contacts'][_0x3456('0x49')]){return _0x2e47a3[_0x3456('0xc0')][_0x3456('0xa2')][0x0];}return db[_0x3456('0x8a')]['create'](_[_0x3456('0x17')](_0x333d2c['body'],{'firstName':_0x15588f,'mobile':_0x15588f,'phone':_0x15588f,'ListId':_0x2e47a3[_0x3456('0x91')]}));}})['then'](handleEntityNotFound(_0x3b07ee,null))[_0x3456('0x36')](function(_0x380827){if(_0x380827){_0x12ee3a=_0x380827;return db[_0x3456('0xa5')][_0x3456('0x57')]({'where':{'ContactId':_0x12ee3a['id'],'closed':![],'WhatsappAccountId':_0x2e47a3['id']}})[_0x3456('0x36')](function(_0x58de6d){if(_0x58de6d){return[_0x58de6d,![]];}return db['WhatsappInteraction'][_0x3456('0x58')]({'UserId':_0x333d2c[_0x3456('0x5a')]['id'],'ContactId':_0x12ee3a['id'],'WhatsappAccountId':_0x2e47a3['id'],'phone':_0x15588f,'firstMsgDirection':_0x3456('0xc1'),'Messages':[_[_0x3456('0x55')](_0x333d2c[_0x3456('0x59')],{'read':![],'body':_0x333d2c['body'][_0x3456('0x59')],'phone':_0x15588f,'WhatsappAccountId':_0x2e47a3['id'],'UserId':_0x333d2c[_0x3456('0x5a')]['id'],'ContactId':_0x12ee3a['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x3456('0xc2')}]})[_0x3456('0x36')](function(_0x3c0fba){return[_0x3c0fba,!![]];});});}})[_0x3456('0x6e')](function(_0x2a721f,_0x35f8a0){if(_0x35f8a0){return _0x2a721f;}return db['WhatsappMessage'][_0x3456('0x58')](_[_0x3456('0x55')](_0x333d2c[_0x3456('0x59')],{'read':![],'body':_0x333d2c[_0x3456('0x59')][_0x3456('0x59')],'phone':_0x15588f,'WhatsappAccountId':_0x2e47a3['id'],'WhatsappInteractionId':_0x2a721f['id'],'UserId':_0x333d2c[_0x3456('0x5a')]['id'],'ContactId':_0x12ee3a['id']}))[_0x3456('0x36')](function(_0x1b035d){_0x2a721f['dataValues'][_0x3456('0xc2')]=[];_0x2a721f['dataValues'][_0x3456('0xc2')][_0x3456('0xa8')](_0x1b035d[_0x3456('0xc3')]);return _0x2a721f;});})[_0x3456('0x36')](respondWithResult(_0x3b07ee,null))['catch'](handleError(_0x3b07ee,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2a86e94..b2804ce 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 _0xa93d=['../../mysqldb','WhatsappAccount','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa93d,0x140));var _0xda93=function(_0x253a09,_0x3a6473){_0x253a09=_0x253a09-0x0;var _0x5c4a26=_0xa93d[_0x253a09];return _0x5c4a26;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xda93('0x0'))['db'][_0xda93('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xda93('0x2'),'afterUpdate':_0xda93('0x3'),'afterDestroy':_0xda93('0x4')};function emitEvent(_0x19b0b5){return function(_0x111663,_0x28df26,_0x16bd28){WhatsappAccountEvents[_0xda93('0x5')](_0x19b0b5+':'+_0x111663['id'],_0x111663);WhatsappAccountEvents[_0xda93('0x5')](_0x19b0b5,_0x111663);_0x16bd28(null);};}for(var e in events){if(events[_0xda93('0x6')](e)){var event=events[e];WhatsappAccount[_0xda93('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 67063f3..cdeb704 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 _0x8dd4=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','api','bluebird','request-promise'];(function(_0x4d25fd,_0x2c4373){var _0x2f11ae=function(_0x259956){while(--_0x259956){_0x4d25fd['push'](_0x4d25fd['shift']());}};_0x2f11ae(++_0x2c4373);}(_0x8dd4,0x128));var _0x48dd=function(_0x508bf7,_0x54fd22){_0x508bf7=_0x508bf7-0x0;var _0x4981bb=_0x8dd4[_0x508bf7];return _0x4981bb;};'use strict';var _=require(_0x48dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48dd('0x1'));var moment=require('moment');var BPromise=require(_0x48dd('0x2'));var rp=require(_0x48dd('0x3'));var fs=require('fs');var path=require(_0x48dd('0x4'));var rimraf=require(_0x48dd('0x5'));var config=require(_0x48dd('0x6'));var attributes=require(_0x48dd('0x7'));module[_0x48dd('0x8')]=function(_0x245b48,_0x21893e){return _0x245b48[_0x48dd('0x9')](_0x48dd('0xa'),attributes,{'tableName':_0x48dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 427d4c9..0fbde2b 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 _0xad49=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','map','include','model','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3d23e1,_0x2c6d4d){var _0x4560e7=function(_0x47dcec){while(--_0x47dcec){_0x3d23e1['push'](_0x3d23e1['shift']());}};_0x4560e7(++_0x2c6d4d);}(_0xad49,0xf6));var _0x9ad4=function(_0x7223c6,_0x13dea1){_0x7223c6=_0x7223c6-0x0;var _0x3b6700=_0xad49[_0x7223c6];return _0x3b6700;};'use strict';var _=require(_0x9ad4('0x0'));var util=require(_0x9ad4('0x1'));var moment=require(_0x9ad4('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ad4('0x3'));var fs=require('fs');var Redis=require(_0x9ad4('0x4'));var db=require(_0x9ad4('0x5'))['db'];var utils=require(_0x9ad4('0x6'));var logger=require('../../config/logger')(_0x9ad4('0x7'));var config=require(_0x9ad4('0x8'));var jayson=require(_0x9ad4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9ad4('0xa')](config[_0x9ad4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ad4('0xc'))(new Redis(config['redis']));require(_0x9ad4('0xd'))[_0x9ad4('0xe')](socket);function respondWithRpcPromise(_0x4b777b,_0x4f17f3,_0x1c5825){return new BPromise(function(_0x3f7dff,_0x4a4c1a){return client[_0x9ad4('0xf')](_0x4b777b,_0x1c5825)['then'](function(_0x446a42){logger[_0x9ad4('0x10')](_0x9ad4('0x11'),_0x4f17f3,_0x9ad4('0x12'));logger[_0x9ad4('0x13')](_0x9ad4('0x14'),_0x4f17f3,_0x9ad4('0x12'),JSON[_0x9ad4('0x15')](_0x446a42));if(_0x446a42[_0x9ad4('0x16')]){if(_0x446a42[_0x9ad4('0x16')][_0x9ad4('0x17')]===0x1f4){logger[_0x9ad4('0x16')](_0x9ad4('0x11'),_0x4f17f3,_0x446a42['error'][_0x9ad4('0x18')]);return _0x4a4c1a(_0x446a42['error'][_0x9ad4('0x18')]);}logger[_0x9ad4('0x16')](_0x9ad4('0x11'),_0x4f17f3,_0x446a42[_0x9ad4('0x16')][_0x9ad4('0x18')]);return _0x3f7dff(_0x446a42['error'][_0x9ad4('0x18')]);}else{logger[_0x9ad4('0x10')](_0x9ad4('0x11'),_0x4f17f3,_0x9ad4('0x12'));_0x3f7dff(_0x446a42[_0x9ad4('0x19')][_0x9ad4('0x18')]);}})[_0x9ad4('0x1a')](function(_0xe30667){logger[_0x9ad4('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x4f17f3,_0xe30667);_0x4a4c1a(_0xe30667);});});}exports[_0x9ad4('0x1b')]=function(_0x4282b0){var _0x188ae1=this;return new Promise(function(_0x5ab37c,_0x38d45a){return db[_0x9ad4('0x1c')][_0x9ad4('0x1d')]({'raw':_0x4282b0['options']?_0x4282b0[_0x9ad4('0x1e')][_0x9ad4('0x1f')]===undefined?!![]:![]:!![],'where':_0x4282b0[_0x9ad4('0x1e')]?_0x4282b0[_0x9ad4('0x1e')][_0x9ad4('0x20')]||null:null,'attributes':_0x4282b0[_0x9ad4('0x1e')]?_0x4282b0[_0x9ad4('0x1e')][_0x9ad4('0x21')]||null:null,'include':_0x4282b0[_0x9ad4('0x1e')]?_0x4282b0['options']['include']?_[_0x9ad4('0x22')](_0x4282b0['options'][_0x9ad4('0x23')],function(_0x27d07d){return{'model':db[_0x27d07d[_0x9ad4('0x24')]],'as':_0x27d07d['as'],'attributes':_0x27d07d['attributes'],'include':_0x27d07d[_0x9ad4('0x23')]?_[_0x9ad4('0x22')](_0x27d07d[_0x9ad4('0x23')],function(_0x56984b){return{'model':db[_0x56984b[_0x9ad4('0x24')]],'as':_0x56984b['as'],'attributes':_0x56984b[_0x9ad4('0x21')],'include':_0x56984b[_0x9ad4('0x23')]?_[_0x9ad4('0x22')](_0x56984b['include'],function(_0x5aa8e4){return{'model':db[_0x5aa8e4[_0x9ad4('0x24')]],'as':_0x5aa8e4['as'],'attributes':_0x5aa8e4[_0x9ad4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9ad4('0x25')](function(_0x1e35d0){logger[_0x9ad4('0x10')](_0x9ad4('0x1b'),_0x4282b0);logger[_0x9ad4('0x13')](_0x9ad4('0x1b'),_0x4282b0,JSON['stringify'](_0x1e35d0));_0x5ab37c(_0x1e35d0);})[_0x9ad4('0x1a')](function(_0x1dc4db){logger[_0x9ad4('0x16')]('ShowWhatsappAccount',_0x1dc4db[_0x9ad4('0x18')],_0x4282b0);_0x38d45a(_0x188ae1['error'](0x1f4,_0x1dc4db['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index c85d616..6b60510 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 _0x46a7=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x501233,_0x491977){var _0x66b0f3=function(_0x1dc570){while(--_0x1dc570){_0x501233['push'](_0x501233['shift']());}};_0x66b0f3(++_0x491977);}(_0x46a7,0xd9));var _0x746a=function(_0x6676b2,_0x4a45e3){_0x6676b2=_0x6676b2-0x0;var _0x495446=_0x46a7[_0x6676b2];return _0x495446;};'use strict';var WhatsappAccountEvents=require(_0x746a('0x0'));var events=[_0x746a('0x1'),_0x746a('0x2'),_0x746a('0x3')];function createListener(_0x168e00,_0x52fd9a){return function(_0xf518bd){_0x52fd9a[_0x746a('0x4')](_0x168e00,_0xf518bd);};}function removeListener(_0x373974,_0x27f509){return function(){WhatsappAccountEvents[_0x746a('0x5')](_0x373974,_0x27f509);};}exports[_0x746a('0x6')]=function(_0x3c9c08){for(var _0x26c308=0x0,_0x21e326=events['length'];_0x26c308<_0x21e326;_0x26c308++){var _0xbd9dbc=events[_0x26c308];var _0x5fb2c4=createListener(_0x746a('0x7')+_0xbd9dbc,_0x3c9c08);WhatsappAccountEvents['on'](_0xbd9dbc,_0x5fb2c4);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 48f5ee9..e987886 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 _0x10d9=['index','/:id','show','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x9d2d2,_0x1c1c2c){var _0x488242=function(_0x5f4e9c){while(--_0x5f4e9c){_0x9d2d2['push'](_0x9d2d2['shift']());}};_0x488242(++_0x1c1c2c);}(_0x10d9,0xaa));var _0x910d=function(_0x515122,_0x5bc6a8){_0x515122=_0x515122-0x0;var _0x28dbf0=_0x10d9[_0x515122];return _0x28dbf0;};'use strict';var multer=require(_0x910d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x910d('0x1'));var express=require(_0x910d('0x2'));var router=express[_0x910d('0x3')]();var fs_extra=require(_0x910d('0x4'));var auth=require(_0x910d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x910d('0x6'));var controller=require(_0x910d('0x7'));router[_0x910d('0x8')]('/',auth[_0x910d('0x9')](),controller[_0x910d('0xa')]);router[_0x910d('0x8')](_0x910d('0xb'),auth[_0x910d('0x9')](),controller[_0x910d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x910d('0xd')]);router['put'](_0x910d('0xb'),auth[_0x910d('0x9')](),controller[_0x910d('0xe')]);router[_0x910d('0xf')](_0x910d('0xb'),auth['isAuthenticated'](),controller[_0x910d('0x10')]);module[_0x910d('0x11')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 4306d39..98565a0 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 _0x4a35=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1baea0,_0x47030e){var _0x2f73ff=function(_0x55e726){while(--_0x55e726){_0x1baea0['push'](_0x1baea0['shift']());}};_0x2f73ff(++_0x47030e);}(_0x4a35,0x118));var _0x54a3=function(_0x7054cc,_0x27ddf6){_0x7054cc=_0x7054cc-0x0;var _0x28ca23=_0x4a35[_0x7054cc];return _0x28ca23;};'use strict';var Sequelize=require(_0x54a3('0x0'));module[_0x54a3('0x1')]={'priority':{'type':Sequelize[_0x54a3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x54a3('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x54a3('0x4')]()},'description':{'type':Sequelize[_0x54a3('0x3')]},'interval':{'type':Sequelize[_0x54a3('0x3')],'defaultValue':_0x54a3('0x5')}}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index bc66259..9d8fae5 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 _0x639a=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','error','name','send','index','map','WhatsappApplication','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','length','find','create','body','catch','destroy','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x181a4a,_0x58e84e){var _0x2d2906=function(_0x5c1f3b){while(--_0x5c1f3b){_0x181a4a['push'](_0x181a4a['shift']());}};_0x2d2906(++_0x58e84e);}(_0x639a,0x1e8));var _0xa639=function(_0xba4bb9,_0x14ed6f){_0xba4bb9=_0xba4bb9-0x0;var _0xa388fe=_0x639a[_0xba4bb9];return _0xa388fe;};'use strict';var emlformat=require(_0xa639('0x0'));var rimraf=require(_0xa639('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa639('0x2'));var moment=require(_0xa639('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa639('0x4'));var util=require(_0xa639('0x5'));var path=require(_0xa639('0x6'));var sox=require(_0xa639('0x7'));var csv=require('to-csv');var ejs=require(_0xa639('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa639('0x9'));var squel=require(_0xa639('0xa'));var crypto=require(_0xa639('0xb'));var jsforce=require(_0xa639('0xc'));var deskjs=require(_0xa639('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa639('0xe'));var Papa=require(_0xa639('0xf'));var Redis=require(_0xa639('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa639('0x11'));var as=require(_0xa639('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa639('0x13'))(_0xa639('0x14'));var utils=require('../../config/utils');var config=require(_0xa639('0x15'));var licenseUtil=require(_0xa639('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450aa7,_0x1a666e){_0x1a666e=_0x1a666e||0xcc;return function(_0x110488){if(_0x110488){return _0x450aa7[_0xa639('0x17')](_0x1a666e);}return _0x450aa7[_0xa639('0x18')](_0x1a666e)[_0xa639('0x19')]();};}function respondWithResult(_0x3dc4b5,_0x56fa87){_0x56fa87=_0x56fa87||0xc8;return function(_0x15605d){if(_0x15605d){return _0x3dc4b5[_0xa639('0x18')](_0x56fa87)[_0xa639('0x1a')](_0x15605d);}};}function respondWithFilteredResult(_0x28f05c,_0x19436b){return function(_0x7ec7ce){if(_0x7ec7ce){var _0x10c096=typeof _0x19436b[_0xa639('0x1b')]===_0xa639('0x1c')&&typeof _0x19436b['limit']===_0xa639('0x1c');var _0x1d4f47=_0x7ec7ce['count'];var _0x15002b=_0x10c096?0x0:_0x19436b[_0xa639('0x1b')];var _0x200a65=_0x10c096?_0x7ec7ce[_0xa639('0x1d')]:_0x19436b['offset']+_0x19436b[_0xa639('0x1e')];var _0x108005;if(_0x200a65>=_0x1d4f47){_0x200a65=_0x1d4f47;_0x108005=0xc8;}else{_0x108005=0xce;}_0x28f05c[_0xa639('0x18')](_0x108005);return _0x28f05c[_0xa639('0x1f')]('Content-Range',_0x15002b+'-'+_0x200a65+'/'+_0x1d4f47)[_0xa639('0x1a')](_0x7ec7ce);}return null;};}function patchUpdates(_0x4509df){return function(_0x32d216){try{jsonpatch[_0xa639('0x20')](_0x32d216,_0x4509df,!![]);}catch(_0x20c03d){return BPromise['reject'](_0x20c03d);}return _0x32d216[_0xa639('0x21')]();};}function saveUpdates(_0x1180f1,_0x107a5d){return function(_0x917ed4){if(_0x917ed4){return _0x917ed4['update'](_0x1180f1)[_0xa639('0x22')](function(_0x597397){return _0x597397;});}return null;};}function removeEntity(_0x40954e,_0x11299b){return function(_0x3442cd){if(_0x3442cd){return _0x3442cd['destroy']()[_0xa639('0x22')](function(){_0x40954e['status'](0xcc)[_0xa639('0x19')]();});}};}function handleEntityNotFound(_0x127fa9,_0x10ff2b){return function(_0x14a86d){if(!_0x14a86d){_0x127fa9['sendStatus'](0x194);}return _0x14a86d;};}function handleError(_0x3e4b0b,_0x176dcf){_0x176dcf=_0x176dcf||0x1f4;return function(_0x1414be){logger[_0xa639('0x23')](_0x1414be['stack']);if(_0x1414be[_0xa639('0x24')]){delete _0x1414be[_0xa639('0x24')];}_0x3e4b0b[_0xa639('0x18')](_0x176dcf)[_0xa639('0x25')](_0x1414be);};}exports[_0xa639('0x26')]=function(_0x343360,_0x4cf740){var _0x4cbf18={},_0x43c236={},_0x2cf80a={'count':0x0,'rows':[]};var _0x3a82b5=_[_0xa639('0x27')](db[_0xa639('0x28')]['rawAttributes'],function(_0x5151a1){return{'name':_0x5151a1[_0xa639('0x29')],'type':_0x5151a1['type'][_0xa639('0x2a')]};});_0x43c236['model']=_[_0xa639('0x27')](_0x3a82b5,_0xa639('0x24'));_0x43c236[_0xa639('0x2b')]=_[_0xa639('0x2c')](_0x343360[_0xa639('0x2b')]);_0x43c236[_0xa639('0x2d')]=_[_0xa639('0x2e')](_0x43c236[_0xa639('0x2f')],_0x43c236['query']);_0x4cbf18[_0xa639('0x30')]=_['intersection'](_0x43c236[_0xa639('0x2f')],qs[_0xa639('0x31')](_0x343360['query'][_0xa639('0x31')]));_0x4cbf18[_0xa639('0x30')]=_0x4cbf18['attributes']['length']?_0x4cbf18[_0xa639('0x30')]:_0x43c236[_0xa639('0x2f')];if(!_0x343360[_0xa639('0x2b')][_0xa639('0x32')](_0xa639('0x33'))){_0x4cbf18[_0xa639('0x1e')]=qs['limit'](_0x343360['query'][_0xa639('0x1e')]);_0x4cbf18[_0xa639('0x1b')]=qs['offset'](_0x343360[_0xa639('0x2b')][_0xa639('0x1b')]);}_0x4cbf18[_0xa639('0x34')]=qs[_0xa639('0x35')](_0x343360['query'][_0xa639('0x35')]);_0x4cbf18[_0xa639('0x36')]=qs[_0xa639('0x2d')](_[_0xa639('0x37')](_0x343360['query'],_0x43c236[_0xa639('0x2d')]),_0x3a82b5);if(_0x343360[_0xa639('0x2b')][_0xa639('0x38')]){_0x4cbf18[_0xa639('0x36')]=_[_0xa639('0x39')](_0x4cbf18[_0xa639('0x36')],{'$or':_[_0xa639('0x27')](_0x3a82b5,function(_0x78f94e){if(_0x78f94e[_0xa639('0x3a')]!==_0xa639('0x3b')){var _0x1256a1={};_0x1256a1[_0x78f94e[_0xa639('0x24')]]={'$like':'%'+_0x343360[_0xa639('0x2b')][_0xa639('0x38')]+'%'};return _0x1256a1;}})});}_0x4cbf18=_[_0xa639('0x39')]({},_0x4cbf18,_0x343360[_0xa639('0x3c')]);var _0x563c70={'where':_0x4cbf18[_0xa639('0x36')]};return db[_0xa639('0x28')][_0xa639('0x1d')](_0x563c70)['then'](function(_0x12dd1b){_0x2cf80a[_0xa639('0x1d')]=_0x12dd1b;if(_0x343360[_0xa639('0x2b')][_0xa639('0x3d')]){_0x4cbf18[_0xa639('0x3e')]=[{'all':!![]}];}return db[_0xa639('0x28')][_0xa639('0x3f')](_0x4cbf18);})['then'](function(_0x379143){_0x2cf80a[_0xa639('0x40')]=_0x379143;return _0x2cf80a;})[_0xa639('0x22')](respondWithFilteredResult(_0x4cf740,_0x4cbf18))['catch'](handleError(_0x4cf740,null));};exports['show']=function(_0x571963,_0x16e342){var _0x153aee={'raw':!![],'where':{'id':_0x571963['params']['id']}},_0x6c7dd7={};_0x6c7dd7['model']=_[_0xa639('0x2c')](db[_0xa639('0x28')]['rawAttributes']);_0x6c7dd7[_0xa639('0x2b')]=_['keys'](_0x571963['query']);_0x6c7dd7[_0xa639('0x2d')]=_[_0xa639('0x2e')](_0x6c7dd7['model'],_0x6c7dd7[_0xa639('0x2b')]);_0x153aee[_0xa639('0x30')]=_[_0xa639('0x2e')](_0x6c7dd7[_0xa639('0x2f')],qs[_0xa639('0x31')](_0x571963[_0xa639('0x2b')][_0xa639('0x31')]));_0x153aee[_0xa639('0x30')]=_0x153aee[_0xa639('0x30')][_0xa639('0x41')]?_0x153aee[_0xa639('0x30')]:_0x6c7dd7['model'];if(_0x571963[_0xa639('0x2b')]['includeAll']){_0x153aee[_0xa639('0x3e')]=[{'all':!![]}];}_0x153aee=_[_0xa639('0x39')]({},_0x153aee,_0x571963[_0xa639('0x3c')]);return db[_0xa639('0x28')][_0xa639('0x42')](_0x153aee)[_0xa639('0x22')](handleEntityNotFound(_0x16e342,null))[_0xa639('0x22')](respondWithResult(_0x16e342,null))['catch'](handleError(_0x16e342,null));};exports['create']=function(_0x4d0edd,_0x34dac5){return db[_0xa639('0x28')][_0xa639('0x43')](_0x4d0edd['body'],{})[_0xa639('0x22')](respondWithResult(_0x34dac5,0xc9))['catch'](handleError(_0x34dac5,null));};exports['update']=function(_0x267551,_0xb805cc){if(_0x267551[_0xa639('0x44')]['id']){delete _0x267551[_0xa639('0x44')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x267551['params']['id']}})[_0xa639('0x22')](handleEntityNotFound(_0xb805cc,null))['then'](saveUpdates(_0x267551[_0xa639('0x44')],null))[_0xa639('0x22')](respondWithResult(_0xb805cc,null))[_0xa639('0x45')](handleError(_0xb805cc,null));};exports[_0xa639('0x46')]=function(_0x303f5a,_0x381990){return db[_0xa639('0x28')][_0xa639('0x42')]({'where':{'id':_0x303f5a['params']['id']}})[_0xa639('0x22')](handleEntityNotFound(_0x381990,null))[_0xa639('0x22')](removeEntity(_0x381990,null))[_0xa639('0x45')](handleError(_0x381990,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index eed09a0..3c345f1 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 _0xca8d=['whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication'];(function(_0x1f1081,_0x5eb56b){var _0x408e77=function(_0x2bc833){while(--_0x2bc833){_0x1f1081['push'](_0x1f1081['shift']());}};_0x408e77(++_0x5eb56b);}(_0xca8d,0x172));var _0xdca8=function(_0x6f8972,_0x343da7){_0x6f8972=_0x6f8972-0x0;var _0x5677d9=_0xca8d[_0x6f8972];return _0x5677d9;};'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':[],'timestamps':!![],'charset':_0xdca8('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +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 diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 10ba46a..de4bb6e 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappApplication,\x20%s,\x20%s','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x5ddc90,_0x1a9989){var _0x1f2b57=function(_0x208bb8){while(--_0x208bb8){_0x5ddc90['push'](_0x5ddc90['shift']());}};_0x1f2b57(++_0x1a9989);}(_0x9f62,0x154));var _0x29f6=function(_0x2f1090,_0x41adcf){_0x2f1090=_0x2f1090-0x0;var _0x11d536=_0x9f62[_0x2f1090];return _0x11d536;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index aa779d6..ef0c01f 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 _0xb138=['/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','get'];(function(_0x424604,_0x4db329){var _0x33f801=function(_0x5b6c21){while(--_0x5b6c21){_0x424604['push'](_0x424604['shift']());}};_0x33f801(++_0x4db329);}(_0xb138,0x1dd));var _0x8b13=function(_0x3b92ab,_0x4bf41f){_0x3b92ab=_0x3b92ab-0x0;var _0x569deb=_0xb138[_0x3b92ab];return _0x569deb;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['get'](_0x8b13('0xf'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')](_0x8b13('0x12'),auth['isAuthenticated'](),controller[_0x8b13('0x13')]);router[_0x8b13('0x14')]('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0x15')]);router[_0x8b13('0x14')](_0x8b13('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8b13('0x14')](_0x8b13('0x16'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x8b13('0x17')),controller[_0x8b13('0x18')]);router[_0x8b13('0x19')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction['tracked'](_0x8b13('0x1a'),_0x8b13('0x1b')),controller[_0x8b13('0x1c')]);router[_0x8b13('0x1d')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction[_0x8b13('0x1e')](_0x8b13('0x1a'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x8b13('0x1d')](_0x8b13('0x16'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x1f')]);module[_0x8b13('0x20')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f92c268..bbca479 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 _0xbd9f=['ENUM','out','BOOLEAN','STRING','DATE'];(function(_0x336caa,_0x2d74dd){var _0x564a11=function(_0x5ceb08){while(--_0x5ceb08){_0x336caa['push'](_0x336caa['shift']());}};_0x564a11(++_0x2d74dd);}(_0xbd9f,0x98));var _0xfbd9=function(_0x460f89,_0x2102fe){_0x460f89=_0x460f89-0x0;var _0x566c37=_0xbd9f[_0x460f89];return _0x566c37;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xfbd9('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfbd9('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfbd9('0x1')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xfbd9('0x1')]},'read1stAt':{'type':Sequelize[_0xfbd9('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfbd9('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfbd9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfbd9('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfbd9('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a1f475b..9f1f4f3 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 _0x3dc2=['offset','undefined','limit','count','status','set','Content-Range','json','update','destroy','then','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','whatsapp','query','user','show','model','WhatsappInteraction','keys','intersection','fields','attributes','length','includeAll','options','find','catch','create','body','params','describe','addMessage','ids','getMessages','WhatsappMessage','filters','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','User','lastName','Attachment','Messages','createdAt','direction','secret','push','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','out','Contact','firstName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end'];(function(_0xf43812,_0x2f8973){var _0x346fc4=function(_0x42ea48){while(--_0x42ea48){_0xf43812['push'](_0xf43812['shift']());}};_0x346fc4(++_0x2f8973);}(_0x3dc2,0x17e));var _0x23dc=function(_0x913763,_0x181c70){_0x913763=_0x913763-0x0;var _0x4b5942=_0x3dc2[_0x913763];return _0x4b5942;};'use strict';var rimraf=require(_0x23dc('0x0'));var zipdir=require(_0x23dc('0x1'));var moment=require(_0x23dc('0x2'));var BPromise=require(_0x23dc('0x3'));var util=require(_0x23dc('0x4'));var path=require(_0x23dc('0x5'));var ejs=require(_0x23dc('0x6'));var fs=require('fs');var _=require(_0x23dc('0x7'));var Redis=require(_0x23dc('0x8'));var interaction=require(_0x23dc('0x9'));var qs=require(_0x23dc('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x23dc('0xb'))('api');var config=require('../../config/environment');var db=require(_0x23dc('0xc'))['db'];config[_0x23dc('0xd')]=_[_0x23dc('0xe')](config[_0x23dc('0xd')],{'host':_0x23dc('0xf'),'port':0x18eb});var socket=require(_0x23dc('0x10'))(new Redis(config[_0x23dc('0xd')]));require(_0x23dc('0x11'))[_0x23dc('0x12')](socket);function respondWithStatusCode(_0x4784c4,_0x5d1bfb){_0x5d1bfb=_0x5d1bfb||0xcc;return function(_0x265173){if(_0x265173){return _0x4784c4['sendStatus'](_0x5d1bfb);}return _0x4784c4['status'](_0x5d1bfb)[_0x23dc('0x13')]();};}function respondWithResult(_0x3074d8,_0x8901dd){_0x8901dd=_0x8901dd||0xc8;return function(_0x29f2c1){if(_0x29f2c1){return _0x3074d8['status'](_0x8901dd)['json'](_0x29f2c1);}};}function respondWithFilteredResult(_0x158fd2,_0x4c5b39){return function(_0x57f3a4){if(_0x57f3a4){var _0x2c24a1=typeof _0x4c5b39[_0x23dc('0x14')]===_0x23dc('0x15')&&typeof _0x4c5b39[_0x23dc('0x16')]===_0x23dc('0x15');var _0x1fa19d=_0x57f3a4[_0x23dc('0x17')];var _0x387293=_0x2c24a1?0x0:_0x4c5b39[_0x23dc('0x14')];var _0xdce47b=_0x2c24a1?_0x57f3a4['count']:_0x4c5b39[_0x23dc('0x14')]+_0x4c5b39[_0x23dc('0x16')];var _0x1019fe;if(_0xdce47b>=_0x1fa19d){_0xdce47b=_0x1fa19d;_0x1019fe=0xc8;}else{_0x1019fe=0xce;}_0x158fd2[_0x23dc('0x18')](_0x1019fe);return _0x158fd2[_0x23dc('0x19')](_0x23dc('0x1a'),_0x387293+'-'+_0xdce47b+'/'+_0x1fa19d)[_0x23dc('0x1b')](_0x57f3a4);}return null;};}function saveUpdates(_0x339fc9){return function(_0x2e5eb2){if(_0x2e5eb2){return _0x2e5eb2[_0x23dc('0x1c')](_0x339fc9)['then'](function(_0x1522b1){return _0x1522b1;});}return null;};}function removeEntity(_0x332615){return function(_0x26e2bb){if(_0x26e2bb){return _0x26e2bb[_0x23dc('0x1d')]()[_0x23dc('0x1e')](function(){_0x332615['status'](0xcc)[_0x23dc('0x13')]();});}};}function handleEntityNotFound(_0x320a1a){return function(_0xf2e9b9){if(!_0xf2e9b9){_0x320a1a[_0x23dc('0x1f')](0x194);}return _0xf2e9b9;};}function handleError(_0x3e858a,_0x2fe82d){_0x2fe82d=_0x2fe82d||0x1f4;return function(_0x5f2a54){logger[_0x23dc('0x20')](_0x5f2a54[_0x23dc('0x21')]);if(_0x5f2a54[_0x23dc('0x22')]){delete _0x5f2a54['name'];}_0x3e858a[_0x23dc('0x18')](_0x2fe82d)['send'](_0x5f2a54);};}exports['index']=function(_0x4fc5ec,_0x6aead9){var _0x3a2de3={};var _0x3c0635=_[_0x23dc('0x23')](db['WhatsappInteraction'][_0x23dc('0x24')],function(_0x3338e4){return{'name':_0x3338e4[_0x23dc('0x25')],'type':_0x3338e4[_0x23dc('0x26')][_0x23dc('0x27')]};});_0x3a2de3=qs['getOptions'](_0x3c0635,_0x4fc5ec);return interaction['findAll'](_0x23dc('0x28'),_0x4fc5ec[_0x23dc('0x29')],_0x4fc5ec[_0x23dc('0x2a')],_0x3a2de3,_0x3c0635)[_0x23dc('0x1e')](respondWithFilteredResult(_0x6aead9,_0x3a2de3))['catch'](handleError(_0x6aead9,null));};exports[_0x23dc('0x2b')]=function(_0x2a4de5,_0x110128){var _0x40c68f={'raw':![],'where':{'id':_0x2a4de5['params']['id']}},_0xa9b684={};_0xa9b684[_0x23dc('0x2c')]=_['keys'](db[_0x23dc('0x2d')][_0x23dc('0x24')]);_0xa9b684[_0x23dc('0x29')]=_[_0x23dc('0x2e')](_0x2a4de5['query']);_0xa9b684['filters']=_[_0x23dc('0x2f')](_0xa9b684[_0x23dc('0x2c')],_0xa9b684[_0x23dc('0x29')]);_0x40c68f['attributes']=_[_0x23dc('0x2f')](_0xa9b684['model'],qs[_0x23dc('0x30')](_0x2a4de5[_0x23dc('0x29')][_0x23dc('0x30')]));_0x40c68f[_0x23dc('0x31')]=_0x40c68f['attributes'][_0x23dc('0x32')]?_0x40c68f[_0x23dc('0x31')]:_0xa9b684[_0x23dc('0x2c')];if(_0x2a4de5[_0x23dc('0x29')][_0x23dc('0x33')]){_0x40c68f['include']=[{'all':!![]}];}_0x40c68f=_['merge']({},_0x40c68f,_0x2a4de5[_0x23dc('0x34')]);return db['WhatsappInteraction'][_0x23dc('0x35')](_0x40c68f)[_0x23dc('0x1e')](handleEntityNotFound(_0x110128,null))[_0x23dc('0x1e')](respondWithResult(_0x110128,null))[_0x23dc('0x36')](handleError(_0x110128,null));};exports[_0x23dc('0x37')]=function(_0x43274b,_0x46489b){return db[_0x23dc('0x2d')]['create'](_0x43274b[_0x23dc('0x38')],{})['then'](respondWithResult(_0x46489b,0xc9))[_0x23dc('0x36')](handleError(_0x46489b,null));};exports[_0x23dc('0x1c')]=function(_0x1935d3,_0x3ca065){if(_0x1935d3[_0x23dc('0x38')]['id']){delete _0x1935d3['body']['id'];}return db[_0x23dc('0x2d')][_0x23dc('0x35')]({'where':{'id':_0x1935d3[_0x23dc('0x39')]['id']}})['then'](handleEntityNotFound(_0x3ca065,null))[_0x23dc('0x1e')](saveUpdates(_0x1935d3[_0x23dc('0x38')],null))[_0x23dc('0x1e')](respondWithResult(_0x3ca065,null))['catch'](handleError(_0x3ca065,null));};exports[_0x23dc('0x1d')]=function(_0x19c5c0,_0x440d27){return db[_0x23dc('0x2d')][_0x23dc('0x35')]({'where':{'id':_0x19c5c0[_0x23dc('0x39')]['id']}})['then'](handleEntityNotFound(_0x440d27,null))['then'](removeEntity(_0x440d27,null))[_0x23dc('0x36')](handleError(_0x440d27,null));};exports[_0x23dc('0x3a')]=function(_0x374371,_0x402d44){return db[_0x23dc('0x2d')][_0x23dc('0x3a')]()['then'](respondWithResult(_0x402d44,null))[_0x23dc('0x36')](handleError(_0x402d44,null));};exports[_0x23dc('0x3b')]=function(_0x1cc8fe,_0x438104){return db['WhatsappMessage'][_0x23dc('0x35')]({'where':{'id':_0x1cc8fe['params']['id']}})['then'](handleEntityNotFound(_0x438104,null))[_0x23dc('0x1e')](function(_0x40e821){if(_0x40e821){return _0x40e821[_0x23dc('0x3b')](_0x1cc8fe[_0x23dc('0x38')]['ids'],_['omit'](_0x1cc8fe[_0x23dc('0x38')],[_0x23dc('0x3c'),'id'])||{});}})[_0x23dc('0x1e')](respondWithResult(_0x438104,null))[_0x23dc('0x36')](handleError(_0x438104,null));};exports[_0x23dc('0x3d')]=function(_0x3d65d2,_0x12631e){var _0x227dbf={'raw':![],'where':{}};var _0x37c428={};var _0x300c08={'count':0x0,'rows':[]};return db[_0x23dc('0x2d')]['findOne']({'where':{'id':_0x3d65d2[_0x23dc('0x39')]['id']}})['then'](handleEntityNotFound(_0x12631e,null))[_0x23dc('0x1e')](function(_0x275db3){if(_0x275db3){_0x37c428['model']=_[_0x23dc('0x2e')](db[_0x23dc('0x3e')][_0x23dc('0x24')]);_0x37c428[_0x23dc('0x29')]=_[_0x23dc('0x2e')](_0x3d65d2[_0x23dc('0x29')]);_0x37c428[_0x23dc('0x3f')]=_['intersection'](_0x37c428['model'],_0x37c428[_0x23dc('0x29')]);_0x227dbf[_0x23dc('0x31')]=_[_0x23dc('0x2f')](_0x37c428[_0x23dc('0x2c')],qs[_0x23dc('0x30')](_0x3d65d2[_0x23dc('0x29')]['fields']));_0x227dbf[_0x23dc('0x31')]=_0x227dbf[_0x23dc('0x31')][_0x23dc('0x32')]?_0x227dbf[_0x23dc('0x31')]:_0x37c428[_0x23dc('0x2c')];if(!_0x3d65d2['query'][_0x23dc('0x40')](_0x23dc('0x41'))){_0x227dbf['limit']=qs[_0x23dc('0x16')](_0x3d65d2['query']['limit']);_0x227dbf['offset']=qs[_0x23dc('0x14')](_0x3d65d2[_0x23dc('0x29')]['offset']);}_0x227dbf[_0x23dc('0x42')]=qs[_0x23dc('0x43')](_0x3d65d2[_0x23dc('0x29')][_0x23dc('0x43')]);_0x227dbf[_0x23dc('0x44')]=qs[_0x23dc('0x3f')](_['pick'](_0x3d65d2[_0x23dc('0x29')],_0x37c428[_0x23dc('0x3f')]));_0x227dbf[_0x23dc('0x44')][_0x23dc('0x45')]=_0x275db3['id'];if(_0x3d65d2[_0x23dc('0x29')][_0x23dc('0x46')]){_0x227dbf[_0x23dc('0x44')]=_[_0x23dc('0x47')](_0x227dbf['where'],{'$or':_['map'](_0x227dbf[_0x23dc('0x31')],function(_0x139f92){var _0x17b5ca={};_0x17b5ca[_0x139f92]={'$like':'%'+_0x3d65d2['query'][_0x23dc('0x46')]+'%'};return _0x17b5ca;})});}if(_0x3d65d2[_0x23dc('0x29')][_0x23dc('0x48')]){var _0x3b133c=_0x3d65d2[_0x23dc('0x29')][_0x23dc('0x48')][_0x23dc('0x49')](',');var _0x2df5d6={};_0x2df5d6[_0x3b133c[0x0]]={'$gte':moment(_0x3b133c[0x1])[_0x23dc('0x4a')](_0x23dc('0x4b'))};_0x227dbf[_0x23dc('0x44')]=_[_0x23dc('0x47')](_0x227dbf['where'],_0x2df5d6);}_0x227dbf=_[_0x23dc('0x47')]({},_0x227dbf,_0x3d65d2['options']);return db[_0x23dc('0x3e')][_0x23dc('0x17')]({'where':_0x227dbf['where']})['then'](function(_0x2fd517){_0x300c08[_0x23dc('0x17')]=_0x2fd517;if(_0x3d65d2[_0x23dc('0x29')]['includeAll']){_0x227dbf['include']=[{'all':!![]}];}return db[_0x23dc('0x3e')][_0x23dc('0x4c')](_0x227dbf);})[_0x23dc('0x1e')](function(_0x3e0606){_0x300c08[_0x23dc('0x4d')]=_0x3e0606;return _0x300c08;});}})[_0x23dc('0x1e')](respondWithFilteredResult(_0x12631e,_0x227dbf))[_0x23dc('0x36')](handleError(_0x12631e,null));};exports[_0x23dc('0x4e')]=function(_0x192911,_0x3b66e7){return db[_0x23dc('0x2d')][_0x23dc('0x35')]({'where':{'id':_0x192911[_0x23dc('0x39')]['id']}})['then'](handleEntityNotFound(_0x3b66e7,null))[_0x23dc('0x1e')](function(_0x436d99){if(_0x436d99){return _0x436d99[_0x23dc('0x4f')](_0x192911[_0x23dc('0x38')]['ids'],_[_0x23dc('0x50')](_0x192911[_0x23dc('0x38')],['ids','id'])||{})[_0x23dc('0x51')](function(){return db[_0x23dc('0x52')][_0x23dc('0x4c')]({'attributes':['id',_0x23dc('0x22'),_0x23dc('0x53')],'where':{'id':_0x192911[_0x23dc('0x38')][_0x23dc('0x3c')]}});})[_0x23dc('0x1e')](function(_0x78f3f1){socket[_0x23dc('0x54')](_0x23dc('0x55'),{'id':Number(_0x192911[_0x23dc('0x39')]['id']),'tags':_0x78f3f1||[]});return{'id':Number(_0x192911['params']['id']),'tags':_0x78f3f1||[]};});}})[_0x23dc('0x1e')](respondWithResult(_0x3b66e7,null))[_0x23dc('0x36')](handleError(_0x3b66e7,null));};exports[_0x23dc('0x56')]=function(_0xa67b86,_0x30034d){return db[_0x23dc('0x2d')]['find']({'where':{'id':_0xa67b86['params']['id']}})[_0x23dc('0x1e')](handleEntityNotFound(_0x30034d,null))[_0x23dc('0x1e')](function(_0x1c2072){if(_0x1c2072){return _0x1c2072[_0x23dc('0x56')](_0xa67b86[_0x23dc('0x29')]['ids']);}})[_0x23dc('0x1e')](respondWithStatusCode(_0x30034d,null))[_0x23dc('0x36')](handleError(_0x30034d,null));};exports[_0x23dc('0x57')]=function(_0x5d3c29,_0x145ca6){var _0x31085d=moment()[_0x23dc('0x58')]()[_0x23dc('0x59')]();var _0x3d59d3=path[_0x23dc('0x5a')](config[_0x23dc('0x5b')],_0x23dc('0x5c'),'files',_0x23dc('0x5d'));var _0xfc1174=path['join'](config['root'],_0x23dc('0x5c'),_0x23dc('0x5e'),_0x23dc('0x5f'));var _0x449476=path[_0x23dc('0x5a')](_0x3d59d3,_0x31085d);var _0x52ea24=util['format'](_0x23dc('0x60'),_0x5d3c29[_0x23dc('0x39')]['id'],_0x31085d);var _0x31ecd6=path[_0x23dc('0x5a')](_0x3d59d3,_0x52ea24);var _0x282bdc=[];_0x282bdc['push']({'model':db[_0x23dc('0x61')],'as':_0x23dc('0x61'),'attributes':['id','fullname'],'raw':!![]});_0x282bdc['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x23dc('0x62')],'raw':!![]});if(_0x5d3c29[_0x23dc('0x29')]['attachments']){_0x282bdc['push']({'model':db[_0x23dc('0x63')],'as':'Attachment','raw':!![]});}var _0x3bd983=[{'model':db[_0x23dc('0x3e')],'as':_0x23dc('0x64'),'attributes':['id',_0x23dc('0x38'),_0x23dc('0x65'),_0x23dc('0x66'),_0x23dc('0x67'),'read'],'include':_0x282bdc}];_0x3bd983[_0x23dc('0x68')]({'model':db[_0x23dc('0x69')],'as':_0x23dc('0x6a'),'attributes':['id','name']});_0x3bd983[_0x23dc('0x68')]({'model':db['User'],'as':_0x23dc('0x6b'),'attributes':['id',_0x23dc('0x6c')]});return db['WhatsappInteraction'][_0x23dc('0x35')]({'where':{'id':_0x5d3c29[_0x23dc('0x39')]['id']},'include':_0x3bd983})[_0x23dc('0x1e')](handleEntityNotFound(_0x145ca6,null))[_0x23dc('0x1e')](function(_0x4a252e){if(_0x4a252e){var _0x3faa5d=_0x4a252e[_0x23dc('0x6d')]({'plain':!![]});fs[_0x23dc('0x6e')](_0x449476);var _0x42a901={'channel':_0x23dc('0x6f'),'account':_0x3faa5d[_0x23dc('0x6a')][_0x23dc('0x22')],'agent':_0x3faa5d[_0x23dc('0x6b')]?_0x3faa5d['Owner'][_0x23dc('0x6c')]:_0x23dc('0x70'),'createdAt':moment(_0x3faa5d['createdAt'])[_0x23dc('0x4a')](_0x23dc('0x4b'))[_0x23dc('0x59')](),'closedAt':_0x3faa5d[_0x23dc('0x71')]?moment(_0x3faa5d[_0x23dc('0x72')])[_0x23dc('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3faa5d[_0x23dc('0x73')],'messages':_(_0x3faa5d[_0x23dc('0x64')])[_0x23dc('0x46')]({'secret':![]})[_0x23dc('0x23')](function(_0x55d166){if(_0x55d166[_0x23dc('0x63')]){var _0x412cbf=path[_0x23dc('0x5a')](_0xfc1174,_0x55d166[_0x23dc('0x63')][_0x23dc('0x74')]);if(fs['existsSync'](_0x412cbf)){fs[_0x23dc('0x75')](_0x412cbf)[_0x23dc('0x76')](fs[_0x23dc('0x77')](path['join'](_0x449476,_0x55d166[_0x23dc('0x63')][_0x23dc('0x74')])));}}return{'date':moment(_0x55d166[_0x23dc('0x65')])[_0x23dc('0x4a')](_0x23dc('0x4b'))[_0x23dc('0x59')](),'sender':_0x55d166[_0x23dc('0x66')]===_0x23dc('0x78')?_0x55d166[_0x23dc('0x61')]?_0x55d166[_0x23dc('0x61')][_0x23dc('0x6c')]:'System':_0x55d166[_0x23dc('0x79')][_0x23dc('0x7a')]+(_0x55d166[_0x23dc('0x79')]['lastName']?'\x20'+_0x55d166[_0x23dc('0x79')][_0x23dc('0x62')]:''),'body':_0x55d166[_0x23dc('0x63')]?_0x55d166[_0x23dc('0x63')][_0x23dc('0x74')]:_0x55d166[_0x23dc('0x38')],'direction':_0x55d166[_0x23dc('0x66')]==='out'?'A':'C','secret':_0x55d166[_0x23dc('0x67')],'read':_0x55d166[_0x23dc('0x7b')],'attachment':_0x55d166['Attachment']};})[_0x23dc('0x7c')]()};return ejs[_0x23dc('0x7d')](path[_0x23dc('0x5a')](config[_0x23dc('0x5b')],_0x23dc('0x5c'),_0x23dc('0x7e'),_0x23dc('0x7f')),{'interaction':_0x42a901})[_0x23dc('0x1e')](function(_0x337b2c){var _0x365dc9=path[_0x23dc('0x5a')](_0x449476,_0x23dc('0x80')+_0x3faa5d['id']+'-'+_0x31085d+_0x23dc('0x81'));var _0xe90628={'path':_0x365dc9,'channel':'Whatsapp','interactionId':_0x3faa5d['id']};return pdf[_0x23dc('0x82')](_0x337b2c,_0xe90628);})['then'](function(){return new BPromise(function(_0x1fbfef,_0x11f32d){zipdir(_0x449476,{'saveTo':_0x31ecd6},function(_0x304b82,_0x5de841){if(_0x304b82)return _0x11f32d(_0x304b82);return _0x1fbfef(_0x5de841);});})[_0x23dc('0x1e')](function(){return new BPromise(function(_0x52a636,_0x1097ec){rimraf(_0x449476,function(_0x66241f){if(_0x66241f)_0x1097ec(_0x66241f);return _0x52a636();});});})[_0x23dc('0x1e')](function(){return _0x145ca6[_0x23dc('0x57')](_0x31ecd6,_0x52ea24,function(_0x19acff){if(_0x19acff){console[_0x23dc('0x83')](_0x23dc('0x84'),_0x19acff);}else{fs[_0x23dc('0x85')](_0x31ecd6);}});});});}else{return _0x145ca6[_0x23dc('0x1f')](0xc8);}})['catch'](handleError(_0x145ca6,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d187947..df515ec 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 _0x4227=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll','length','emit','catch'];(function(_0x137bdd,_0x5e0a8b){var _0x4cf98e=function(_0x583b2c){while(--_0x583b2c){_0x137bdd['push'](_0x137bdd['shift']());}};_0x4cf98e(++_0x5e0a8b);}(_0x4227,0x89));var _0x7422=function(_0x39054d,_0x1570d5){_0x39054d=_0x39054d-0x0;var _0x576905=_0x4227[_0x39054d];return _0x576905;};'use strict';var EventEmitter=require(_0x7422('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x7422('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7422('0x2')](0x0);var events={'afterCreate':_0x7422('0x3'),'afterUpdate':_0x7422('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2de51f){return function(_0x1cd829,_0x2138fe,_0x36ddba){_0x1cd829[_0x7422('0x5')]({'attributes':['id'],'raw':!![]})[_0x7422('0x6')](function(_0xe99299){_0x1cd829[_0x7422('0x7')](_0x7422('0x8'),_0xe99299['map'](function(_0x3f863f){return{'id':_0x3f863f['id']};}));return WhatsappMessage[_0x7422('0x9')]({'where':{'WhatsappInteractionId':_0x1cd829['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7422('0x6')](function(_0x511340){_0x1cd829[_0x7422('0x7')]('unreadMessages',_0x511340[_0x7422('0xa')]);WhatsappInteractionEvents[_0x7422('0xb')](_0x2de51f+':'+_0x1cd829['id'],_0x1cd829);WhatsappInteractionEvents[_0x7422('0xb')](_0x2de51f,_0x1cd829);_0x36ddba(null);})[_0x7422('0xc')](_0x36ddba(null));};}for(var e in events){if(events[_0x7422('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x7422('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 8370f79..ab3149c 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 _0x7e70=['./whatsappInteraction.attributes','exports','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xb8df69,_0x29f681){var _0x5b85bd=function(_0x2a656a){while(--_0x2a656a){_0xb8df69['push'](_0xb8df69['shift']());}};_0x5b85bd(++_0x29f681);}(_0x7e70,0x98));var _0x07e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e70[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x07e7('0x0'));var logger=require(_0x07e7('0x1'))(_0x07e7('0x2'));var moment=require(_0x07e7('0x3'));var BPromise=require(_0x07e7('0x4'));var rp=require(_0x07e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07e7('0x6'));var config=require(_0x07e7('0x7'));var attributes=require(_0x07e7('0x8'));module[_0x07e7('0x9')]=function(_0x4e19a7,_0x30cb04){return _0x4e19a7['define']('WhatsappInteraction',attributes,{'tableName':_0x07e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x223348,_0x4b2668,_0x4af3eb){if(_0x223348[_0x07e7('0xb')](_0x07e7('0xc'))){_0x223348[_0x07e7('0xd')]=moment()[_0x07e7('0xe')](_0x07e7('0xf'));}_0x4af3eb(null,_0x223348);}}});}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 42c7351..fe50d22 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 _0xf013=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','update','raw','options','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','omit','body','AddTags','lodash','moment'];(function(_0x3c0610,_0x2041fe){var _0x5441d4=function(_0x495d3a){while(--_0x495d3a){_0x3c0610['push'](_0x3c0610['shift']());}};_0x5441d4(++_0x2041fe);}(_0xf013,0x146));var _0x3f01=function(_0x33c3f0,_0x5b9ba2){_0x33c3f0=_0x33c3f0-0x0;var _0x1ab318=_0xf013[_0x33c3f0];return _0x1ab318;};'use strict';var _=require(_0x3f01('0x0'));var util=require('util');var moment=require(_0x3f01('0x1'));var BPromise=require(_0x3f01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f01('0x3'))['db'];var utils=require(_0x3f01('0x4'));var logger=require(_0x3f01('0x5'))(_0x3f01('0x6'));var config=require(_0x3f01('0x7'));var jayson=require(_0x3f01('0x8'));var client=jayson[_0x3f01('0x9')][_0x3f01('0xa')]({'port':0x232a});config[_0x3f01('0xb')]=_[_0x3f01('0xc')](config[_0x3f01('0xb')],{'host':_0x3f01('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f01('0xb')]));require('./whatsappInteraction.socket')[_0x3f01('0xe')](socket);function respondWithRpcPromise(_0x4d56cb,_0x578ccf,_0x39b969){return new BPromise(function(_0x2e2474,_0x305839){return client['request'](_0x4d56cb,_0x39b969)[_0x3f01('0xf')](function(_0x26af5a){logger[_0x3f01('0x10')](_0x3f01('0x11'),_0x578ccf,_0x3f01('0x12'));logger[_0x3f01('0x13')](_0x3f01('0x14'),_0x578ccf,'request\x20sent',JSON[_0x3f01('0x15')](_0x26af5a));if(_0x26af5a[_0x3f01('0x16')]){if(_0x26af5a[_0x3f01('0x16')]['code']===0x1f4){logger[_0x3f01('0x16')](_0x3f01('0x11'),_0x578ccf,_0x26af5a['error']['message']);return _0x305839(_0x26af5a['error'][_0x3f01('0x17')]);}logger[_0x3f01('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x578ccf,_0x26af5a[_0x3f01('0x16')][_0x3f01('0x17')]);return _0x2e2474(_0x26af5a['error']['message']);}else{logger['info'](_0x3f01('0x11'),_0x578ccf,'request\x20sent');_0x2e2474(_0x26af5a[_0x3f01('0x18')][_0x3f01('0x17')]);}})[_0x3f01('0x19')](function(_0x3ee64c){logger[_0x3f01('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x578ccf,_0x3ee64c);_0x305839(_0x3ee64c);});});}exports[_0x3f01('0x1a')]=function(_0x59055d){var _0x593347=this;return new Promise(function(_0x2b172f,_0x43eeca){return db['WhatsappInteraction'][_0x3f01('0x1b')](_0x59055d['body'],{'raw':_0x59055d['options']?_0x59055d['options'][_0x3f01('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59055d['options']?_0x59055d[_0x3f01('0x1d')]['where']||null:null,'attributes':_0x59055d[_0x3f01('0x1d')]?_0x59055d[_0x3f01('0x1d')][_0x3f01('0x1e')]||null:null,'limit':_0x59055d['options']?_0x59055d[_0x3f01('0x1d')][_0x3f01('0x1f')]||null:null})[_0x3f01('0xf')](function(_0x517d33){logger[_0x3f01('0x10')]('UpdateWhatsappInteraction',_0x59055d);logger[_0x3f01('0x13')](_0x3f01('0x1a'),_0x59055d,JSON['stringify'](_0x517d33));_0x2b172f(_0x517d33);})[_0x3f01('0x19')](function(_0xf7813b){logger['error']('UpdateWhatsappInteraction',_0xf7813b[_0x3f01('0x17')],_0x59055d);_0x43eeca(_0x593347['error'](0x1f4,_0xf7813b[_0x3f01('0x17')]));});});};exports[_0x3f01('0x20')]=function(_0x584666){return new Promise(function(_0x50e306,_0x4274d1){return db[_0x3f01('0x21')][_0x3f01('0x22')]({'where':_0x584666[_0x3f01('0x1d')]?_0x584666[_0x3f01('0x1d')][_0x3f01('0x23')]||null:null})[_0x3f01('0xf')](function(_0x4055c8){if(_0x4055c8){return _0x4055c8[_0x3f01('0x24')](_0x584666['body'][_0x3f01('0x25')],_[_0x3f01('0x26')](_0x584666[_0x3f01('0x27')],[_0x3f01('0x25'),'id'])||{});}})['spread'](function(_0x220fe3){logger[_0x3f01('0x10')]('AddTags',_0x584666);logger[_0x3f01('0x13')](_0x3f01('0x28'),_0x584666,JSON[_0x3f01('0x15')](_0x220fe3));_0x50e306(_0x220fe3);})[_0x3f01('0x19')](function(_0x518b69){logger['error'](_0x3f01('0x28'),_0x518b69[_0x3f01('0x17')],_0x584666);_0x4274d1(_this[_0x3f01('0x16')](0x1f4,_0x518b69['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7cc59c6..7e1b2af 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 _0x85ed=['./whatsappInteraction.events','save','remove','removeListener','register','length','whatsappInteraction:'];(function(_0x3c70aa,_0x3ff447){var _0x1fce70=function(_0x3c66c2){while(--_0x3c66c2){_0x3c70aa['push'](_0x3c70aa['shift']());}};_0x1fce70(++_0x3ff447);}(_0x85ed,0x126));var _0xd85e=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x85ed[_0x585d81];return _0x1aca0d;};'use strict';var WhatsappInteractionEvents=require(_0xd85e('0x0'));var events=[_0xd85e('0x1'),_0xd85e('0x2'),'update'];function createListener(_0x284cd4,_0x28316e){return function(_0x34cccf){_0x28316e['emit'](_0x284cd4,_0x34cccf);};}function removeListener(_0x46e289,_0x37b97d){return function(){WhatsappInteractionEvents[_0xd85e('0x3')](_0x46e289,_0x37b97d);};}exports[_0xd85e('0x4')]=function(_0x118794){for(var _0x42c8e7=0x0,_0x336adf=events[_0xd85e('0x5')];_0x42c8e7<_0x336adf;_0x42c8e7++){var _0x1ca64c=events[_0x42c8e7];var _0x40a356=createListener(_0xd85e('0x6')+_0x1ca64c,_0x118794);WhatsappInteractionEvents['on'](_0x1ca64c,_0x40a356);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index aad7fa1..651a718 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 _0x20e8=['post','tracked','whatsappmessage:create','create','status','put','update','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id'];(function(_0x389612,_0x2bc735){var _0x51c0f3=function(_0x2ae7c7){while(--_0x2ae7c7){_0x389612['push'](_0x389612['shift']());}};_0x51c0f3(++_0x2bc735);}(_0x20e8,0x1a4));var _0x820e=function(_0x1c0082,_0x146675){_0x1c0082=_0x1c0082-0x0;var _0x44f750=_0x20e8[_0x1c0082];return _0x44f750;};'use strict';var multer=require(_0x820e('0x0'));var util=require(_0x820e('0x1'));var path=require('path');var timeout=require(_0x820e('0x2'));var express=require('express');var router=express[_0x820e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x820e('0x4'));var interaction=require(_0x820e('0x5'));var config=require(_0x820e('0x6'));var controller=require(_0x820e('0x7'));router[_0x820e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x820e('0x8')]('/describe',auth[_0x820e('0x9')](),controller[_0x820e('0xa')]);router[_0x820e('0x8')](_0x820e('0xb'),auth[_0x820e('0x9')](),controller['show']);router[_0x820e('0xc')]('/',auth[_0x820e('0x9')](),interaction[_0x820e('0xd')]('whatsapp',_0x820e('0xe')),controller[_0x820e('0xf')]);router[_0x820e('0xc')]('/:id/status',controller[_0x820e('0x10')]);router[_0x820e('0x11')](_0x820e('0xb'),auth[_0x820e('0x9')](),controller[_0x820e('0x12')]);router[_0x820e('0x11')]('/:id/accept',auth[_0x820e('0x9')](),controller['accept']);router[_0x820e('0x11')](_0x820e('0x13'),auth['isAuthenticated'](),controller[_0x820e('0x14')]);router[_0x820e('0x15')](_0x820e('0xb'),auth[_0x820e('0x9')](),controller[_0x820e('0x16')]);module[_0x820e('0x17')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2f6732a..830fb17 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 _0xb673=['BOOLEAN','ENUM','out','STRING','TEXT','sequelize','exports','medium'];(function(_0x38fab3,_0x486058){var _0x5ebc66=function(_0x5600a9){while(--_0x5600a9){_0x38fab3['push'](_0x38fab3['shift']());}};_0x5ebc66(++_0x486058);}(_0xb673,0xa5));var _0x3b67=function(_0x934346,_0x4d5481){_0x934346=_0x934346-0x0;var _0x4e9f5e=_0xb673[_0x934346];return _0x4e9f5e;};'use strict';var Sequelize=require(_0x3b67('0x0'));module[_0x3b67('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3b67('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3b67('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b67('0x4')]('in','out'),'defaultValue':_0x3b67('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b67('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3b67('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3b67('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3b67('0x7')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index eea414f..4774a9c 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 _0xc233=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','undefined','count','offset','set','json','apply','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','show','includeAll','find','create','body','params','describe','whatsapp-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','whatsapp','get','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','email','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then'];(function(_0x1971ca,_0x58789b){var _0x31c8e5=function(_0x2ff11b){while(--_0x2ff11b){_0x1971ca['push'](_0x1971ca['shift']());}};_0x31c8e5(++_0x58789b);}(_0xc233,0xfd));var _0x3c23=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0xc233[_0x3b6652];return _0x14d39f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c23('0x0'));var zipdir=require(_0x3c23('0x1'));var jsonpatch=require(_0x3c23('0x2'));var rp=require(_0x3c23('0x3'));var moment=require(_0x3c23('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3c23('0x5'));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('squel');var crypto=require(_0x3c23('0x6'));var jsforce=require(_0x3c23('0x7'));var deskjs=require(_0x3c23('0x8'));var toCsv=require(_0x3c23('0x9'));var querystring=require(_0x3c23('0xa'));var Papa=require(_0x3c23('0xb'));var Redis=require(_0x3c23('0xc'));var authService=require(_0x3c23('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c23('0xe'));var logger=require(_0x3c23('0xf'))(_0x3c23('0x10'));var utils=require(_0x3c23('0x11'));var config=require(_0x3c23('0x12'));var licenseUtil=require(_0x3c23('0x13'));var db=require('../../mysqldb')['db'];config[_0x3c23('0x14')]=_[_0x3c23('0x15')](config[_0x3c23('0x14')],{'host':_0x3c23('0x16'),'port':0x18eb});var socket=require(_0x3c23('0x17'))(new Redis(config[_0x3c23('0x14')]));require(_0x3c23('0x18'))[_0x3c23('0x19')](socket);var jayson=require(_0x3c23('0x1a'));var client=jayson[_0x3c23('0x1b')][_0x3c23('0x1c')]({'port':0x232c});var client9002=jayson[_0x3c23('0x1b')][_0x3c23('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb603ac,_0x587ba0,_0x4b7034,_0x170948){return new BPromise(function(_0x3f9a35,_0x4f0e12){var _0xbf4917=_0x170948||client;return _0xbf4917[_0x3c23('0x1d')](_0xb603ac,_0x4b7034)[_0x3c23('0x1e')](function(_0x549c63){logger[_0x3c23('0x1f')](_0x3c23('0x20'),_0x587ba0,_0x3c23('0x21'));logger[_0x3c23('0x22')](_0x3c23('0x23'),_0x587ba0,_0x3c23('0x21'),JSON['stringify'](_0x549c63));if(_0x549c63[_0x3c23('0x24')]){if(_0x549c63[_0x3c23('0x24')][_0x3c23('0x25')]===0x1f4){logger[_0x3c23('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x587ba0,_0x549c63[_0x3c23('0x24')][_0x3c23('0x26')]);return _0x4f0e12(_0x549c63['error'][_0x3c23('0x26')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x587ba0,_0x549c63[_0x3c23('0x24')]['message']);return _0x3f9a35(_0x549c63[_0x3c23('0x24')]['message']);}else{logger['info'](_0x3c23('0x20'),_0x587ba0,_0x3c23('0x21'));_0x3f9a35(_0x549c63[_0x3c23('0x27')]['message']);}})[_0x3c23('0x28')](function(_0x57d2ce){logger[_0x3c23('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x587ba0,_0x57d2ce);_0x4f0e12(_0x57d2ce);});});}function respondWithStatusCode(_0x1e5588,_0x4835d2){_0x4835d2=_0x4835d2||0xcc;return function(_0x24baad){if(_0x24baad){return _0x1e5588[_0x3c23('0x29')](_0x4835d2);}return _0x1e5588[_0x3c23('0x2a')](_0x4835d2)['end']();};}function respondWithResult(_0x16eb33,_0x9f4f82){_0x9f4f82=_0x9f4f82||0xc8;return function(_0x198c04){if(_0x198c04){return _0x16eb33[_0x3c23('0x2a')](_0x9f4f82)['json'](_0x198c04);}};}function respondWithFilteredResult(_0x364241,_0x376db5){return function(_0x2fe77e){if(_0x2fe77e){var _0x26906c=typeof _0x376db5['offset']===_0x3c23('0x2b')&&typeof _0x376db5['limit']==='undefined';var _0x228826=_0x2fe77e[_0x3c23('0x2c')];var _0x189cce=_0x26906c?0x0:_0x376db5[_0x3c23('0x2d')];var _0x4a7603=_0x26906c?_0x2fe77e[_0x3c23('0x2c')]:_0x376db5['offset']+_0x376db5['limit'];var _0x362efa;if(_0x4a7603>=_0x228826){_0x4a7603=_0x228826;_0x362efa=0xc8;}else{_0x362efa=0xce;}_0x364241[_0x3c23('0x2a')](_0x362efa);return _0x364241[_0x3c23('0x2e')]('Content-Range',_0x189cce+'-'+_0x4a7603+'/'+_0x228826)[_0x3c23('0x2f')](_0x2fe77e);}return null;};}function patchUpdates(_0x406a63){return function(_0x49b586){try{jsonpatch[_0x3c23('0x30')](_0x49b586,_0x406a63,!![]);}catch(_0x5704fc){return BPromise['reject'](_0x5704fc);}return _0x49b586['save']();};}function saveUpdates(_0x26c66e,_0x1cb5ab){return function(_0x340d03){if(_0x340d03){return _0x340d03[_0x3c23('0x31')](_0x26c66e)[_0x3c23('0x1e')](function(_0x39e4a9){return _0x39e4a9;});}return null;};}function removeEntity(_0x132910,_0x58d467){return function(_0x5ed263){if(_0x5ed263){return _0x5ed263[_0x3c23('0x32')]()[_0x3c23('0x1e')](function(){_0x132910['status'](0xcc)[_0x3c23('0x33')]();});}};}function handleEntityNotFound(_0x1e8c23,_0x3f7dac){return function(_0x4067e3){if(!_0x4067e3){_0x1e8c23[_0x3c23('0x29')](0x194);}return _0x4067e3;};}function handleError(_0x202a15,_0x2e95b3){_0x2e95b3=_0x2e95b3||0x1f4;return function(_0x314e63){logger[_0x3c23('0x24')](_0x314e63[_0x3c23('0x34')]);if(_0x314e63[_0x3c23('0x35')]){delete _0x314e63[_0x3c23('0x35')];}_0x202a15[_0x3c23('0x2a')](_0x2e95b3)[_0x3c23('0x36')](_0x314e63);};}exports[_0x3c23('0x37')]=function(_0x156dea,_0xbd4950){var _0x3e062b={},_0x1d514a={},_0x16a398={'count':0x0,'rows':[]};var _0x2d5636=_[_0x3c23('0x38')](db[_0x3c23('0x39')][_0x3c23('0x3a')],function(_0xf0d9df){return{'name':_0xf0d9df[_0x3c23('0x3b')],'type':_0xf0d9df[_0x3c23('0x3c')][_0x3c23('0x3d')]};});_0x1d514a[_0x3c23('0x3e')]=_[_0x3c23('0x38')](_0x2d5636,_0x3c23('0x35'));_0x1d514a[_0x3c23('0x3f')]=_[_0x3c23('0x40')](_0x156dea['query']);_0x1d514a['filters']=_[_0x3c23('0x41')](_0x1d514a[_0x3c23('0x3e')],_0x1d514a['query']);_0x3e062b['attributes']=_[_0x3c23('0x41')](_0x1d514a[_0x3c23('0x3e')],qs[_0x3c23('0x42')](_0x156dea[_0x3c23('0x3f')][_0x3c23('0x42')]));_0x3e062b[_0x3c23('0x43')]=_0x3e062b[_0x3c23('0x43')][_0x3c23('0x44')]?_0x3e062b['attributes']:_0x1d514a['model'];if(!_0x156dea[_0x3c23('0x3f')][_0x3c23('0x45')](_0x3c23('0x46'))){_0x3e062b[_0x3c23('0x47')]=qs[_0x3c23('0x47')](_0x156dea[_0x3c23('0x3f')][_0x3c23('0x47')]);_0x3e062b['offset']=qs[_0x3c23('0x2d')](_0x156dea[_0x3c23('0x3f')][_0x3c23('0x2d')]);}_0x3e062b['order']=qs[_0x3c23('0x48')](_0x156dea['query']['sort']);_0x3e062b[_0x3c23('0x49')]=qs['filters'](_['pick'](_0x156dea['query'],_0x1d514a[_0x3c23('0x4a')]),_0x2d5636);if(_0x156dea['query'][_0x3c23('0x4b')]){_0x3e062b[_0x3c23('0x49')]=_[_0x3c23('0x4c')](_0x3e062b['where'],{'$or':_[_0x3c23('0x38')](_0x2d5636,function(_0x25a18b){if(_0x25a18b[_0x3c23('0x3c')]!==_0x3c23('0x4d')){var _0x461dc8={};_0x461dc8[_0x25a18b[_0x3c23('0x35')]]={'$like':'%'+_0x156dea[_0x3c23('0x3f')]['filter']+'%'};return _0x461dc8;}})});}_0x3e062b=_['merge']({},_0x3e062b,_0x156dea[_0x3c23('0x4e')]);var _0x77da89={'where':_0x3e062b[_0x3c23('0x49')]};return db[_0x3c23('0x39')][_0x3c23('0x2c')](_0x77da89)[_0x3c23('0x1e')](function(_0x309ffa){_0x16a398[_0x3c23('0x2c')]=_0x309ffa;if(_0x156dea['query']['includeAll']){_0x3e062b[_0x3c23('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x3e062b);})[_0x3c23('0x1e')](function(_0x20934b){_0x16a398[_0x3c23('0x50')]=_0x20934b;return _0x16a398;})[_0x3c23('0x1e')](respondWithFilteredResult(_0xbd4950,_0x3e062b))[_0x3c23('0x28')](handleError(_0xbd4950,null));};exports[_0x3c23('0x51')]=function(_0x4b4d98,_0x4843b9){var _0x154559={'raw':!![],'where':{'id':_0x4b4d98['params']['id']}},_0x3aae4a={};_0x3aae4a[_0x3c23('0x3e')]=_[_0x3c23('0x40')](db[_0x3c23('0x39')]['rawAttributes']);_0x3aae4a[_0x3c23('0x3f')]=_[_0x3c23('0x40')](_0x4b4d98['query']);_0x3aae4a[_0x3c23('0x4a')]=_[_0x3c23('0x41')](_0x3aae4a[_0x3c23('0x3e')],_0x3aae4a[_0x3c23('0x3f')]);_0x154559[_0x3c23('0x43')]=_[_0x3c23('0x41')](_0x3aae4a['model'],qs[_0x3c23('0x42')](_0x4b4d98['query'][_0x3c23('0x42')]));_0x154559[_0x3c23('0x43')]=_0x154559['attributes']['length']?_0x154559[_0x3c23('0x43')]:_0x3aae4a[_0x3c23('0x3e')];if(_0x4b4d98[_0x3c23('0x3f')][_0x3c23('0x52')]){_0x154559[_0x3c23('0x4f')]=[{'all':!![]}];}_0x154559=_[_0x3c23('0x4c')]({},_0x154559,_0x4b4d98[_0x3c23('0x4e')]);return db['WhatsappMessage'][_0x3c23('0x53')](_0x154559)[_0x3c23('0x1e')](handleEntityNotFound(_0x4843b9,null))[_0x3c23('0x1e')](respondWithResult(_0x4843b9,null))[_0x3c23('0x28')](handleError(_0x4843b9,null));};exports[_0x3c23('0x54')]=function(_0x23f10e,_0x1db1be){return db['WhatsappMessage'][_0x3c23('0x54')](_0x23f10e['body'],{})[_0x3c23('0x1e')](respondWithResult(_0x1db1be,0xc9))[_0x3c23('0x28')](handleError(_0x1db1be,null));};exports['update']=function(_0x3f21f8,_0x5e39e8){if(_0x3f21f8[_0x3c23('0x55')]['id']){delete _0x3f21f8[_0x3c23('0x55')]['id'];}return db['WhatsappMessage'][_0x3c23('0x53')]({'where':{'id':_0x3f21f8[_0x3c23('0x56')]['id']}})[_0x3c23('0x1e')](handleEntityNotFound(_0x5e39e8,null))[_0x3c23('0x1e')](saveUpdates(_0x3f21f8[_0x3c23('0x55')],null))[_0x3c23('0x1e')](respondWithResult(_0x5e39e8,null))[_0x3c23('0x28')](handleError(_0x5e39e8,null));};exports[_0x3c23('0x32')]=function(_0x8d8610,_0x873e3e){return db[_0x3c23('0x39')][_0x3c23('0x53')]({'where':{'id':_0x8d8610[_0x3c23('0x56')]['id']}})[_0x3c23('0x1e')](handleEntityNotFound(_0x873e3e,null))[_0x3c23('0x1e')](removeEntity(_0x873e3e,null))[_0x3c23('0x28')](handleError(_0x873e3e,null));};exports[_0x3c23('0x57')]=function(_0x75d60e,_0x1534b2){return db[_0x3c23('0x39')][_0x3c23('0x57')]()[_0x3c23('0x1e')](respondWithResult(_0x1534b2,null))[_0x3c23('0x28')](handleError(_0x1534b2,null));};var interaction_log=require(_0x3c23('0xf'))(_0x3c23('0x58'));exports[_0x3c23('0x59')]=function(_0x5846fc,_0x3e9690,_0x4bbb55){var _0x363690={'agent':{},'channel':'whatsapp'};if(_0x5846fc[_0x3c23('0x55')]['id']){delete _0x5846fc[_0x3c23('0x55')]['id'];}_0x5846fc[_0x3c23('0x55')]['read']=!![];_0x5846fc[_0x3c23('0x55')][_0x3c23('0x5a')]=moment()['format'](_0x3c23('0x5b'));_0x5846fc[_0x3c23('0x55')][_0x3c23('0x5c')]=_0x5846fc[_0x3c23('0x55')]['UserId']||_0x5846fc[_0x3c23('0x5d')]['id'];_0x363690[_0x3c23('0x5e')]['id']=_0x5846fc['body'][_0x3c23('0x5c')];return db[_0x3c23('0x39')][_0x3c23('0x53')]({'where':{'id':_0x5846fc[_0x3c23('0x56')]['id'],'UserId':null}})[_0x3c23('0x1e')](handleEntityNotFound(_0x3e9690,null))[_0x3c23('0x1e')](saveUpdates(_0x5846fc[_0x3c23('0x55')],null))[_0x3c23('0x1e')](function(_0x20ebdd){if(_0x20ebdd){_0x363690[_0x3c23('0x26')]=_0x20ebdd['get']({'plain':!![]});return db['WhatsappInteraction'][_0x3c23('0x53')]({'where':{'id':_0x20ebdd[_0x3c23('0x5f')]}});}return null;})[_0x3c23('0x1e')](handleEntityNotFound(_0x3e9690,null))[_0x3c23('0x1e')](function(_0x582287){if(_0x582287){return _0x582287[_0x3c23('0x31')]({'UserId':_0x5846fc[_0x3c23('0x55')][_0x3c23('0x5c')],'read1stAt':_[_0x3c23('0x60')](_0x582287[_0x3c23('0x61')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3c23('0x1e')](function(_0x2329da){if(_0x2329da){_0x363690[_0x3c23('0x62')]=_0x2329da['get']({'plain':!![]});interaction_log['info'](_0x3c23('0x63'),_0x5846fc['user']['id'],_0x5846fc[_0x3c23('0x5d')][_0x3c23('0x35')],_0x5846fc[_0x3c23('0x5d')]['role'],_0x363690[_0x3c23('0x62')]['id'],_0x5846fc[_0x3c23('0x55')]?JSON[_0x3c23('0x64')](_0x5846fc[_0x3c23('0x55')]):_0x3c23('0x65'));return respondWithRpcPromise(_0x3c23('0x66'),_0x3c23('0x67'),_0x363690);}return null;})[_0x3c23('0x1e')](function(_0x26dd12){var _0xe60fc8=_0x3c23('0x68')+_0x26dd12[_0x3c23('0x26')][_0x3c23('0x69')];return db[_0x3c23('0x6a')]['query'](_0xe60fc8,{'type':db[_0x3c23('0x6b')]['QueryTypes'][_0x3c23('0x6c')],'raw':!![]})[_0x3c23('0x1e')](function(_0xfee9af){return _0xfee9af;});})[_0x3c23('0x1e')](function(_0x5c649b){if(_0x5c649b){_0x363690[_0x3c23('0x26')][_0x3c23('0x6d')]=_0x5c649b[0x0];if(!_0x5846fc[_0x3c23('0x55')]['UserId'])return;return db[_0x3c23('0x6e')][_0x3c23('0x53')]({'where':{'id':_0x5846fc[_0x3c23('0x55')]['UserId'],'role':_0x3c23('0x5e')},'attributes':['id',_0x3c23('0x35'),_0x3c23('0x6f'),'email',_0x3c23('0x70')],'raw':!![]});}return null;})[_0x3c23('0x1e')](function(_0x9de592){if(!_0x9de592)return null;_0x363690[_0x3c23('0x26')]['agent']=_0x9de592;return _0x363690;})[_0x3c23('0x1e')](function(_0x30c2cb){if(_0x30c2cb){if(_0x5846fc[_0x3c23('0x55')][_0x3c23('0x71')]){_0x363690[_0x3c23('0x26')][_0x3c23('0x72')]=util[_0x3c23('0x73')](_0x3c23('0x74'),_0x5846fc['user'][_0x3c23('0x35')]);_0x363690[_0x3c23('0x26')][_0x3c23('0x75')]=_0x363690[_0x3c23('0x75')];_0x363690[_0x3c23('0x26')][_0x3c23('0x76')]=_0x363690['channel'];_0x363690[_0x3c23('0x26')][_0x3c23('0x77')]=_0x3c23('0x59');return respondWithRpcPromise(_0x3c23('0x78'),'EventManager',{'event':_0x3c23('0x79'),'message':_0x363690[_0x3c23('0x26')]},client9002)['then'](function(){return _0x363690;});}return _0x363690;}return null;})[_0x3c23('0x1e')](respondWithResult(_0x3e9690,null))['catch'](handleError(_0x3e9690,null));};var interaction_log=require(_0x3c23('0xf'))('whatsapp-interactions');exports[_0x3c23('0x7a')]=function(_0x4c0822,_0x5491cb,_0x367455){var _0x410cf6={'agent':{},'channel':_0x3c23('0x7b')};if(_0x4c0822[_0x3c23('0x55')]['id']){delete _0x4c0822['body']['id'];}_0x4c0822[_0x3c23('0x55')][_0x3c23('0x5c')]=_0x4c0822[_0x3c23('0x55')]['UserId']||_0x4c0822[_0x3c23('0x5d')]['id'];_0x410cf6[_0x3c23('0x5e')]['id']=_0x4c0822[_0x3c23('0x55')][_0x3c23('0x5c')];return db[_0x3c23('0x39')][_0x3c23('0x53')]({'where':{'id':_0x4c0822['params']['id'],'UserId':null}})[_0x3c23('0x1e')](handleEntityNotFound(_0x5491cb,null))['then'](function(_0x45753c){if(_0x45753c){_0x410cf6['message']=_0x45753c[_0x3c23('0x7c')]({'plain':!![]});return db[_0x3c23('0x7d')][_0x3c23('0x53')]({'where':{'id':_0x45753c[_0x3c23('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x5491cb,null))[_0x3c23('0x1e')](function(_0x1c2849){if(_0x1c2849){_0x410cf6[_0x3c23('0x62')]=_0x1c2849['get']({'plain':!![]});interaction_log[_0x3c23('0x1f')](_0x3c23('0x7e'),_0x4c0822[_0x3c23('0x5d')]['id'],_0x4c0822[_0x3c23('0x5d')]['name'],_0x4c0822[_0x3c23('0x5d')][_0x3c23('0x7f')],_0x410cf6['interaction']['id'],_0x4c0822[_0x3c23('0x55')]?JSON[_0x3c23('0x64')](_0x4c0822[_0x3c23('0x55')]):'null');return respondWithRpcPromise(_0x3c23('0x80'),_0x3c23('0x81'),_0x410cf6);}return null;})['then'](function(_0xf59ad5){var _0x1a7bf7=_0x3c23('0x68')+_0xf59ad5[_0x3c23('0x26')][_0x3c23('0x69')];return db['sequelize'][_0x3c23('0x3f')](_0x1a7bf7,{'type':db[_0x3c23('0x6b')][_0x3c23('0x82')]['SELECT'],'raw':!![]})[_0x3c23('0x1e')](function(_0x4872b8){return _0x4872b8;});})[_0x3c23('0x1e')](function(_0x42d2a0){if(_0x42d2a0){_0x410cf6['message'][_0x3c23('0x6d')]=_0x42d2a0[0x0];if(!_0x4c0822[_0x3c23('0x55')][_0x3c23('0x5c')])return;return db['User'][_0x3c23('0x53')]({'where':{'id':_0x4c0822[_0x3c23('0x55')][_0x3c23('0x5c')],'role':'agent'},'attributes':['id',_0x3c23('0x35'),_0x3c23('0x6f'),_0x3c23('0x83'),'internal'],'raw':!![]});}return null;})[_0x3c23('0x1e')](function(_0x2cb04d){if(!_0x2cb04d)return null;_0x410cf6[_0x3c23('0x26')][_0x3c23('0x5e')]=_0x2cb04d;return _0x410cf6;})['then'](function(_0x1da4bc){if(_0x1da4bc){_0x1da4bc[_0x3c23('0x26')][_0x3c23('0x72')]=util[_0x3c23('0x73')](_0x3c23('0x74'),_0x4c0822[_0x3c23('0x5d')][_0x3c23('0x35')]);_0x1da4bc[_0x3c23('0x26')][_0x3c23('0x75')]=_0x410cf6[_0x3c23('0x75')];_0x1da4bc[_0x3c23('0x26')][_0x3c23('0x76')]=_0x410cf6[_0x3c23('0x75')];_0x1da4bc['message'][_0x3c23('0x77')]='reject';respondWithRpcPromise(_0x3c23('0x78'),_0x3c23('0x78'),{'event':_0x3c23('0x84'),'message':_0x1da4bc[_0x3c23('0x26')]},client9002);return _0x410cf6;}return null;})[_0x3c23('0x1e')](respondWithResult(_0x5491cb,null))[_0x3c23('0x28')](handleError(_0x5491cb,null));};exports[_0x3c23('0x2a')]=function(_0x974a2c,_0x2509f6,_0x238f01){if(_0x974a2c['body']['id']){delete _0x974a2c[_0x3c23('0x55')]['id'];}var _0xe325a6;return db[_0x3c23('0x39')]['find']({'where':{'id':_0x974a2c['params']['id']}})[_0x3c23('0x1e')](handleEntityNotFound(_0x2509f6,null))[_0x3c23('0x1e')](function(_0x15db51){if(_0x15db51){_0xe325a6=_0x15db51;return db[_0x3c23('0x85')][_0x3c23('0x53')]({'where':{'id':_0x15db51[_0x3c23('0x86')]}});}})[_0x3c23('0x1e')](handleEntityNotFound(_0x2509f6,null))[_0x3c23('0x1e')](function(_0xd72a92){if(_0xd72a92){logger[_0x3c23('0x22')](_0x3c23('0x87'),_0x3c23('0x2a'),'received\x20delivery\x20report\x20from',_0xd72a92[_0x3c23('0x3c')],util[_0x3c23('0x88')](_0x974a2c['body'],{'showHidden':![],'depth':null}));switch(_0xd72a92[_0x3c23('0x3c')]){case'twilio':if(_0x974a2c[_0x3c23('0x55')][_0x3c23('0x89')]&&_0x974a2c[_0x3c23('0x55')]['MessageSid']===_0xe325a6['messageId']&&_0x974a2c[_0x3c23('0x55')][_0x3c23('0x8a')]&&_0x974a2c[_0x3c23('0x55')][_0x3c23('0x8a')]===_0x3c23('0x8b')){return _0xe325a6['update']({'read':!![]});}else{logger[_0x3c23('0x24')](_0x3c23('0x8c'),_0x3c23('0x2a'),_0x3c23('0x8d'),util[_0x3c23('0x88')](_0x974a2c['body'],{'showHidden':![],'depth':null}));}break;}return _0xe325a6;}})[_0x3c23('0x1e')](respondWithResult(_0x2509f6,null))[_0x3c23('0x28')](handleError(_0x2509f6,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index f32e844..d5c7d32 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 _0x98e5=['setMaxListeners','save','remove','emit','hook','exports'];(function(_0x226af2,_0x15fac9){var _0x360a66=function(_0x85d4ca){while(--_0x85d4ca){_0x226af2['push'](_0x226af2['shift']());}};_0x360a66(++_0x15fac9);}(_0x98e5,0x8a));var _0x598e=function(_0x11a871,_0x24b28b){_0x11a871=_0x11a871-0x0;var _0x4d5b5c=_0x98e5[_0x11a871];return _0x4d5b5c;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x598e('0x0')](0x0);var events={'afterCreate':_0x598e('0x1'),'afterUpdate':'update','afterDestroy':_0x598e('0x2')};function emitEvent(_0xc090ec){return function(_0x5cc274,_0x3af01f,_0x5a876c){WhatsappMessageEvents['emit'](_0xc090ec+':'+_0x5cc274['id'],_0x5cc274);WhatsappMessageEvents[_0x598e('0x3')](_0xc090ec,_0x5cc274);_0x5a876c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x598e('0x4')](e,emitEvent(event));}}module[_0x598e('0x5')]=WhatsappMessageEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a0ec7fd..f9a86d8 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 _0x8873=['exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','toLowerCase','direction','out','secret','isNil','UserId','findOne','then','update','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x8873,0xad));var _0x3887=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x8873[_0x5581ba];return _0x1e927f;};'use strict';var _=require(_0x3887('0x0'));var util=require(_0x3887('0x1'));var logger=require(_0x3887('0x2'))('api');var moment=require(_0x3887('0x3'));var BPromise=require(_0x3887('0x4'));var rp=require(_0x3887('0x5'));var fetch=require(_0x3887('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3887('0x7'));var config=require(_0x3887('0x8'));var attributes=require(_0x3887('0x9'));module[_0x3887('0xa')]=function(_0x5358ef,_0x5c651f){return _0x5358ef[_0x3887('0xb')]('WhatsappMessage',attributes,{'tableName':_0x3887('0xc'),'paranoid':![],'indexes':[{'name':_0x3887('0xd'),'fields':[_0x3887('0xd')]},{'name':_0x3887('0xe'),'fields':[_0x3887('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c2d42,_0x3aa6fd,_0x281a40){var _0x1d251d=_0x5358ef[_0x3887('0x10')];var _0x110ceb=_0x2c2d42['get']({'plain':!![]});if(_0x110ceb['direction'][_0x3887('0x11')]()==='in'||_0x110ceb[_0x3887('0x12')][_0x3887('0x11')]()===_0x3887('0x13')&&!_0x110ceb[_0x3887('0x14')]&&!_[_0x3887('0x15')](_0x110ceb[_0x3887('0x16')])){_0x1d251d['WhatsappInteraction'][_0x3887('0x17')]({'where':{'id':_0x110ceb['WhatsappInteractionId']}})[_0x3887('0x18')](function(_0x71c1f8){if(_0x71c1f8){_0x71c1f8[_0x3887('0x19')]({'lastMsgAt':_0x110ceb['createdAt'],'lastMsgDirection':_0x110ceb[_0x3887('0x12')]['toLowerCase']()});}})[_0x3887('0x1a')](function(_0x115c68){console[_0x3887('0x1b')](_0x115c68);});}if(_0x110ceb[_0x3887('0x12')]==='out'&&!_0x110ceb['secret']){var _0x5320ef;_0x1d251d[_0x3887('0x1c')][_0x3887('0x1d')]({'where':{'id':_0x110ceb[_0x3887('0x1e')]},'raw':!![]})[_0x3887('0x18')](function(_0x1e2093){_0x5320ef=_0x1e2093;if(_0x5320ef&&_0x5320ef[_0x3887('0x1f')]){switch(_0x5320ef[_0x3887('0x1f')]){case _0x3887('0x20'):var _0x29c062=require(_0x3887('0x20'));if(_0x5320ef[_0x3887('0x21')]&&_0x5320ef[_0x3887('0x22')]&&_0x5320ef['phone']){var _0x2f19dc=new _0x29c062(_0x5320ef[_0x3887('0x21')],_0x5320ef[_0x3887('0x22')]);_0x2f19dc[_0x3887('0x23')][_0x3887('0x24')]({'body':_0x110ceb[_0x3887('0xf')],'to':'whatsapp:'+_0x110ceb[_0x3887('0x25')],'from':_0x3887('0x26')+_0x5320ef['phone'],'statusCallback':_0x5320ef[_0x3887('0x27')]+_0x3887('0x28')+_0x110ceb['id']+_0x3887('0x29')+_0x5320ef[_0x3887('0x2a')]})[_0x3887('0x18')](function(_0x4d7c60){if(_0x4d7c60[_0x3887('0x2b')]){return _0x2c2d42[_0x3887('0x19')]({'messageId':_0x4d7c60[_0x3887('0x2b')]});}})[_0x3887('0x1a')](function(_0x36d390){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3887('0x2c'),_0x3887('0x20'),util[_0x3887('0x2d')](_0x36d390,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3887('0x2e'),_0x3887('0x2c'),_0x3887('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3887('0x2f'):var _0x5f0a62=_0x5320ef[_0x3887('0x21')];var _0x22e0bb=_0x5320ef['authToken'];var _0x2c78c2=_0x5320ef[_0x3887('0x30')]+_0x3887('0x31')+_0x5f0a62+_0x3887('0x32');var _0x1f238d={'to':[_0x110ceb[_0x3887('0x25')]],'message':{'type':_0x3887('0x33'),'text':_0x110ceb[_0x3887('0xf')]}};var _0x25fb60={'method':_0x3887('0x34'),'uri':_0x2c78c2,'headers':{'Authorization':_0x3887('0x35')+_0x22e0bb,'Content-Type':_0x3887('0x36')},'body':_0x1f238d,'json':!![]};rp(_0x25fb60)[_0x3887('0x18')](function(_0x15a881){if(_0x15a881['statuses'][0x0]['message_id']){return _0x2c2d42[_0x3887('0x19')]({'messageId':_0x15a881[_0x3887('0x37')][0x0][_0x3887('0x38')]});}})[_0x3887('0x1a')](function(_0x5e8eda){logger[_0x3887('0x39')]('WhatsappMessage,\x20%s',_0x5e8eda);});break;}}})[_0x3887('0x3a')](function(){_0x281a40();});}else{_0x281a40();}}},'charset':_0x3887('0x3b'),'collate':_0x3887('0x3c')});}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1b8551c..f485693 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 _0x3657=['socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','info','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost'];(function(_0x421e4f,_0x475259){var _0x1e8132=function(_0x3bb19d){while(--_0x3bb19d){_0x421e4f['push'](_0x421e4f['shift']());}};_0x1e8132(++_0x475259);}(_0x3657,0x11d));var _0x7365=function(_0x384691,_0x1f4e03){_0x384691=_0x384691-0x0;var _0x28b395=_0x3657[_0x384691];return _0x28b395;};'use strict';var _=require(_0x7365('0x0'));var util=require(_0x7365('0x1'));var moment=require(_0x7365('0x2'));var BPromise=require(_0x7365('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7365('0x4'));var db=require(_0x7365('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7365('0x6'))('rpc');var config=require(_0x7365('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7365('0x8')]({'port':0x232a});config[_0x7365('0x9')]=_[_0x7365('0xa')](config[_0x7365('0x9')],{'host':_0x7365('0xb'),'port':0x18eb});var socket=require(_0x7365('0xc'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x7365('0xd')](socket);function respondWithRpcPromise(_0x431b53,_0x4abffa,_0x49d6c2){return new BPromise(function(_0x2a292c,_0x17d0ef){return client[_0x7365('0xe')](_0x431b53,_0x49d6c2)[_0x7365('0xf')](function(_0x2c3984){logger['info'](_0x7365('0x10'),_0x4abffa,_0x7365('0x11'));logger['debug'](_0x7365('0x12'),_0x4abffa,_0x7365('0x11'),JSON['stringify'](_0x2c3984));if(_0x2c3984[_0x7365('0x13')]){if(_0x2c3984[_0x7365('0x13')][_0x7365('0x14')]===0x1f4){logger[_0x7365('0x13')](_0x7365('0x10'),_0x4abffa,_0x2c3984[_0x7365('0x13')]['message']);return _0x17d0ef(_0x2c3984[_0x7365('0x13')][_0x7365('0x15')]);}logger[_0x7365('0x13')](_0x7365('0x10'),_0x4abffa,_0x2c3984[_0x7365('0x13')][_0x7365('0x15')]);return _0x2a292c(_0x2c3984[_0x7365('0x13')][_0x7365('0x15')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4abffa,'request\x20sent');_0x2a292c(_0x2c3984[_0x7365('0x16')][_0x7365('0x15')]);}})[_0x7365('0x17')](function(_0x392cb1){logger[_0x7365('0x13')](_0x7365('0x10'),_0x4abffa,_0x392cb1);_0x17d0ef(_0x392cb1);});});}exports[_0x7365('0x18')]=function(_0x6ba875){var _0xa2b778=this;return new Promise(function(_0x6bead3,_0x64d826){return db[_0x7365('0x19')][_0x7365('0x1a')](_0x6ba875[_0x7365('0x1b')],{'raw':_0x6ba875[_0x7365('0x1c')]?_0x6ba875['options'][_0x7365('0x1d')]===undefined?!![]:![]:!![]})[_0x7365('0xf')](function(_0x1d76a4){logger[_0x7365('0x1e')](_0x7365('0x18'),_0x6ba875);logger[_0x7365('0x1f')](_0x7365('0x18'),_0x6ba875,JSON[_0x7365('0x20')](_0x1d76a4));_0x6bead3(_0x1d76a4);})[_0x7365('0x17')](function(_0x430125){logger[_0x7365('0x13')](_0x7365('0x18'),_0x430125[_0x7365('0x15')],_0x6ba875);_0x64d826(_0xa2b778['error'](0x1f4,_0x430125['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index d6b87d1..518829b 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 _0xe948=['whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register'];(function(_0x530663,_0x348201){var _0x3356fb=function(_0x2641ed){while(--_0x2641ed){_0x530663['push'](_0x530663['shift']());}};_0x3356fb(++_0x348201);}(_0xe948,0x8d));var _0x8e94=function(_0x35fc7e,_0x44debc){_0x35fc7e=_0x35fc7e-0x0;var _0x53fe01=_0xe948[_0x35fc7e];return _0x53fe01;};'use strict';var WhatsappMessageEvents=require(_0x8e94('0x0'));var events=[_0x8e94('0x1'),_0x8e94('0x2'),_0x8e94('0x3')];function createListener(_0x52535f,_0x1b9f69){return function(_0x2bba3a){_0x1b9f69['emit'](_0x52535f,_0x2bba3a);};}function removeListener(_0x15e3c1,_0x46599d){return function(){WhatsappMessageEvents[_0x8e94('0x4')](_0x15e3c1,_0x46599d);};}exports[_0x8e94('0x5')]=function(_0x560260){for(var _0xbcc1e6=0x0,_0xee4033=events['length'];_0xbcc1e6<_0xee4033;_0xbcc1e6++){var _0x3257c1=events[_0xbcc1e6];var _0x3bc812=createListener(_0x8e94('0x6')+_0x3257c1,_0x560260);WhatsappMessageEvents['on'](_0x3257c1,_0x3bc812);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ee2837e..542dbbd 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 _0x4c6a=['describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe'];(function(_0x3bcc9e,_0x126252){var _0x70aedc=function(_0x593166){while(--_0x593166){_0x3bcc9e['push'](_0x3bcc9e['shift']());}};_0x70aedc(++_0x126252);}(_0x4c6a,0xb4));var _0xa4c6=function(_0x256341,_0x2169e8){_0x256341=_0x256341-0x0;var _0x377b74=_0x4c6a[_0x256341];return _0x377b74;};'use strict';var multer=require(_0xa4c6('0x0'));var util=require(_0xa4c6('0x1'));var path=require('path');var timeout=require(_0xa4c6('0x2'));var express=require('express');var router=express[_0xa4c6('0x3')]();var fs_extra=require(_0xa4c6('0x4'));var auth=require(_0xa4c6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xa4c6('0x6')]('/',auth[_0xa4c6('0x7')](),controller['index']);router[_0xa4c6('0x6')](_0xa4c6('0x8'),auth[_0xa4c6('0x7')](),controller[_0xa4c6('0x9')]);router[_0xa4c6('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa4c6('0x6')](_0xa4c6('0xa'),auth['isAuthenticated'](),controller[_0xa4c6('0xb')]);router['get'](_0xa4c6('0xc'),auth[_0xa4c6('0x7')](),controller['getTeams']);router['get'](_0xa4c6('0xd'),auth[_0xa4c6('0x7')](),controller[_0xa4c6('0xe')]);router[_0xa4c6('0xf')]('/',auth[_0xa4c6('0x7')](),controller[_0xa4c6('0x10')]);router[_0xa4c6('0xf')]('/:id/teams',auth[_0xa4c6('0x7')](),controller[_0xa4c6('0x11')]);router['post'](_0xa4c6('0xd'),auth[_0xa4c6('0x7')](),controller[_0xa4c6('0x12')]);router[_0xa4c6('0x13')](_0xa4c6('0x14'),auth[_0xa4c6('0x7')](),controller[_0xa4c6('0x15')]);router[_0xa4c6('0x16')](_0xa4c6('0x14'),auth['isAuthenticated'](),controller[_0xa4c6('0x17')]);router[_0xa4c6('0x16')](_0xa4c6('0xc'),auth['isAuthenticated'](),controller[_0xa4c6('0x18')]);router[_0xa4c6('0x16')]('/:id/users',auth[_0xa4c6('0x7')](),controller[_0xa4c6('0x19')]);module[_0xa4c6('0x1a')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d46057b..16457fd 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 _0x2e35=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x258ea7,_0x28ccf6){var _0x38840a=function(_0x50f139){while(--_0x50f139){_0x258ea7['push'](_0x258ea7['shift']());}};_0x38840a(++_0x28ccf6);}(_0x2e35,0x1d0));var _0x52e3=function(_0x50dd00,_0x23e219){_0x50dd00=_0x50dd00-0x0;var _0x9301ac=_0x2e35[_0x50dd00];return _0x9301ac;};'use strict';var Sequelize=require(_0x52e3('0x0'));module[_0x52e3('0x1')]={'name':{'type':Sequelize[_0x52e3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x52e3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x52e3('0x4')](_0x52e3('0x5'),_0x52e3('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x52e3('0x2')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 985766a..c155b3b 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 _0x6922=['map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','rows','catch','params','keys','filters','model','attributes','intersection','fields','length','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','nolimit','order','sort','where','pick','WhatsappQueueId','filter','merge','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','Team','getTeams','hasOwnProperty','ids','Agents','online','voicePause','interface','sequelize','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeTeams','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne','util','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','offset','limit','undefined','count','json','update','then','destroy','get','UserProfileResource','end','error','stack','name'];(function(_0x1e4b2c,_0x1f9c6b){var _0x38e0b0=function(_0x123a58){while(--_0x123a58){_0x1e4b2c['push'](_0x1e4b2c['shift']());}};_0x38e0b0(++_0x1f9c6b);}(_0x6922,0x149));var _0x2692=function(_0x1dc235,_0x3e59f4){_0x1dc235=_0x1dc235-0x0;var _0x42ec52=_0x6922[_0x1dc235];return _0x42ec52;};'use strict';var BPromise=require('bluebird');var util=require(_0x2692('0x0'));var _=require(_0x2692('0x1'));var squel=require(_0x2692('0x2'));var Redis=require(_0x2692('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x2692('0x4'))('api');var config=require(_0x2692('0x5'));var db=require(_0x2692('0x6'))['db'];config['redis']=_[_0x2692('0x7')](config[_0x2692('0x8')],{'host':_0x2692('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2692('0x8')]));require(_0x2692('0xa'))[_0x2692('0xb')](socket);function respondWithStatusCode(_0x41d5ac,_0x36a37d){_0x36a37d=_0x36a37d||0xcc;return function(_0x50a5f9){if(_0x50a5f9){return _0x41d5ac[_0x2692('0xc')](_0x36a37d);}return _0x41d5ac[_0x2692('0xd')](_0x36a37d)['end']();};}function respondWithResult(_0x30dc00,_0x183926){_0x183926=_0x183926||0xc8;return function(_0x5c2113){if(_0x5c2113){return _0x30dc00[_0x2692('0xd')](_0x183926)['json'](_0x5c2113);}};}function respondWithFilteredResult(_0x50863b,_0x3b5988){return function(_0x1deb6f){if(_0x1deb6f){var _0x3dd98a=typeof _0x3b5988[_0x2692('0xe')]==='undefined'&&typeof _0x3b5988[_0x2692('0xf')]===_0x2692('0x10');var _0x59e7a2=_0x1deb6f[_0x2692('0x11')];var _0x40998a=_0x3dd98a?0x0:_0x3b5988[_0x2692('0xe')];var _0x542c9d=_0x3dd98a?_0x1deb6f[_0x2692('0x11')]:_0x3b5988[_0x2692('0xe')]+_0x3b5988[_0x2692('0xf')];var _0x37be7f;if(_0x542c9d>=_0x59e7a2){_0x542c9d=_0x59e7a2;_0x37be7f=0xc8;}else{_0x37be7f=0xce;}_0x50863b['status'](_0x37be7f);return _0x50863b['set']('Content-Range',_0x40998a+'-'+_0x542c9d+'/'+_0x59e7a2)[_0x2692('0x12')](_0x1deb6f);}return null;};}function saveUpdates(_0xadc481){return function(_0x5df6e2){if(_0x5df6e2){return _0x5df6e2[_0x2692('0x13')](_0xadc481)[_0x2692('0x14')](function(_0x48891b){return _0x48891b;});}return null;};}function removeEntity(_0x217f1f){return function(_0x5d1c63){if(_0x5d1c63){return _0x5d1c63[_0x2692('0x15')]()['then'](function(){var _0x1795a8=_0x5d1c63[_0x2692('0x16')]({'plain':!![]});var _0x4d70c0='WhatsappQueues';return db[_0x2692('0x17')][_0x2692('0x15')]({'where':{'type':_0x4d70c0,'resourceId':_0x1795a8['id']}})[_0x2692('0x14')](function(){return _0x5d1c63;});})['then'](function(){_0x217f1f[_0x2692('0xd')](0xcc)[_0x2692('0x18')]();});}};}function handleEntityNotFound(_0x23dd2c){return function(_0x4c5838){if(!_0x4c5838){_0x23dd2c[_0x2692('0xc')](0x194);}return _0x4c5838;};}function handleError(_0x24b4d5,_0x496e12){_0x496e12=_0x496e12||0x1f4;return function(_0x84c233){logger[_0x2692('0x19')](_0x84c233[_0x2692('0x1a')]);if(_0x84c233['name']){delete _0x84c233[_0x2692('0x1b')];}_0x24b4d5[_0x2692('0xd')](_0x496e12)['send'](_0x84c233);};}exports['index']=function(_0x2443a3,_0x300ae5){var _0x579b9f={};var _0x1a6d3f={'count':0x0,'rows':[]};var _0x35adf5=_[_0x2692('0x1c')](db[_0x2692('0x1d')][_0x2692('0x1e')],function(_0x4ce414){return{'name':_0x4ce414[_0x2692('0x1f')],'type':_0x4ce414[_0x2692('0x20')]['key']};});_0x579b9f=qs[_0x2692('0x21')](_0x35adf5,_0x2443a3);var _0x3b8925={'where':_0x579b9f['where']};return db[_0x2692('0x1d')][_0x2692('0x11')](_0x3b8925)[_0x2692('0x14')](function(_0x443ede){_0x1a6d3f['count']=_0x443ede;_0x579b9f[_0x2692('0x22')]=qs[_0x2692('0x22')](_0x2443a3[_0x2692('0x23')]);return db[_0x2692('0x1d')][_0x2692('0x24')](_0x579b9f);})[_0x2692('0x14')](function(_0x43ee74){_0x1a6d3f[_0x2692('0x25')]=_0x43ee74;return _0x1a6d3f;})[_0x2692('0x14')](respondWithFilteredResult(_0x300ae5,_0x579b9f))[_0x2692('0x26')](handleError(_0x300ae5,null));};exports['show']=function(_0x4f037e,_0x4741d8){var _0x1a9e5f={'raw':!![],'where':{'id':_0x4f037e[_0x2692('0x27')]['id']}},_0x3466f6={};_0x3466f6['model']=_[_0x2692('0x28')](db['WhatsappQueue']['rawAttributes']);_0x3466f6[_0x2692('0x23')]=_[_0x2692('0x28')](_0x4f037e[_0x2692('0x23')]);_0x3466f6[_0x2692('0x29')]=_['intersection'](_0x3466f6[_0x2692('0x2a')],_0x3466f6[_0x2692('0x23')]);_0x1a9e5f[_0x2692('0x2b')]=_[_0x2692('0x2c')](_0x3466f6[_0x2692('0x2a')],qs[_0x2692('0x2d')](_0x4f037e['query'][_0x2692('0x2d')]));_0x1a9e5f[_0x2692('0x2b')]=_0x1a9e5f[_0x2692('0x2b')][_0x2692('0x2e')]?_0x1a9e5f[_0x2692('0x2b')]:_0x3466f6['model'];if(_0x4f037e['query']['includeAll']){_0x1a9e5f['include']=[{'all':!![]}];}_0x1a9e5f=_['merge']({},_0x1a9e5f,_0x4f037e[_0x2692('0x2f')]);return db[_0x2692('0x1d')][_0x2692('0x30')](_0x1a9e5f)[_0x2692('0x14')](handleEntityNotFound(_0x4741d8,null))['then'](respondWithResult(_0x4741d8,null))[_0x2692('0x26')](handleError(_0x4741d8,null));};exports['create']=function(_0x3adf8c,_0x10155a){return db['WhatsappQueue']['create'](_0x3adf8c[_0x2692('0x31')],{})[_0x2692('0x14')](function(_0x1d6b27){var _0x44cecc=_0x3adf8c[_0x2692('0x32')]['get']({'plain':!![]});if(!_0x44cecc)throw new Error(_0x2692('0x33'));if(_0x44cecc[_0x2692('0x34')]===_0x2692('0x32')){var _0x52d050=_0x1d6b27[_0x2692('0x16')]({'plain':!![]});var _0x528486=_0x2692('0x35');return db[_0x2692('0x36')][_0x2692('0x30')]({'where':{'name':_0x528486,'userProfileId':_0x44cecc[_0x2692('0x37')]},'raw':!![]})[_0x2692('0x14')](function(_0x57add5){if(_0x57add5&&_0x57add5['autoAssociation']===0x0){return db[_0x2692('0x17')][_0x2692('0x38')]({'name':_0x52d050[_0x2692('0x1b')],'resourceId':_0x52d050['id'],'type':_0x57add5[_0x2692('0x1b')],'sectionId':_0x57add5['id']},{})[_0x2692('0x14')](function(){return _0x1d6b27;});}else{return _0x1d6b27;}})['catch'](function(_0xb7e6d4){logger['error'](_0x2692('0x39'),_0xb7e6d4);throw _0xb7e6d4;});}return _0x1d6b27;})['then'](respondWithResult(_0x10155a,0xc9))[_0x2692('0x26')](handleError(_0x10155a,null));};exports['update']=function(_0x56e47d,_0x545f8f){if(_0x56e47d[_0x2692('0x31')]['id']){delete _0x56e47d['body']['id'];}return db[_0x2692('0x1d')]['find']({'where':{'id':_0x56e47d[_0x2692('0x27')]['id']}})[_0x2692('0x14')](handleEntityNotFound(_0x545f8f,null))[_0x2692('0x14')](saveUpdates(_0x56e47d[_0x2692('0x31')],null))[_0x2692('0x14')](respondWithResult(_0x545f8f,null))[_0x2692('0x26')](handleError(_0x545f8f,null));};exports[_0x2692('0x15')]=function(_0x32e46f,_0x27b581){return db[_0x2692('0x1d')][_0x2692('0x30')]({'where':{'id':_0x32e46f[_0x2692('0x27')]['id']}})['then'](handleEntityNotFound(_0x27b581,null))[_0x2692('0x14')](removeEntity(_0x27b581,null))[_0x2692('0x26')](handleError(_0x27b581,null));};exports[_0x2692('0x3a')]=function(_0x1a6040,_0x53f791){return db[_0x2692('0x1d')][_0x2692('0x3a')]()['then'](respondWithResult(_0x53f791,null))[_0x2692('0x26')](handleError(_0x53f791,null));};exports['getMembers']=function(_0xc30723,_0x59d47e){var _0x193754={'raw':!![],'where':{}},_0x47d21f={},_0x59e732;return db[_0x2692('0x1d')]['findOne']({'where':{'id':_0xc30723[_0x2692('0x27')]['id']}})[_0x2692('0x14')](handleEntityNotFound(_0x59d47e,null))['then'](function(_0x2a32e6){if(_0x2a32e6){_0x59e732=_0x2a32e6[_0x2692('0x16')]({'plain':!![]});_0x47d21f[_0x2692('0x2a')]=_['keys'](db[_0x2692('0x3b')][_0x2692('0x1e')]);_0x47d21f[_0x2692('0x23')]=_[_0x2692('0x28')](_0xc30723[_0x2692('0x23')]);_0x47d21f[_0x2692('0x29')]=_['intersection'](_0x47d21f[_0x2692('0x2a')],_0x47d21f['query']);_0x193754[_0x2692('0x2b')]=_[_0x2692('0x2c')](_0x47d21f[_0x2692('0x2a')],qs[_0x2692('0x2d')](_0xc30723[_0x2692('0x23')][_0x2692('0x2d')]));_0x193754['attributes']=_0x193754[_0x2692('0x2b')][_0x2692('0x2e')]?_0x193754[_0x2692('0x2b')]:_0x47d21f[_0x2692('0x2a')];if(!_0xc30723['query']['hasOwnProperty'](_0x2692('0x3c'))){_0x193754[_0x2692('0xf')]=qs[_0x2692('0xf')](_0xc30723[_0x2692('0x23')][_0x2692('0xf')]);_0x193754['offset']=qs[_0x2692('0xe')](_0xc30723[_0x2692('0x23')][_0x2692('0xe')]);}_0x193754[_0x2692('0x3d')]=qs[_0x2692('0x3e')](_0xc30723[_0x2692('0x23')][_0x2692('0x3e')]);_0x193754[_0x2692('0x3f')]=qs[_0x2692('0x29')](_[_0x2692('0x40')](_0xc30723['query'],_0x47d21f['filters']));_0x193754[_0x2692('0x3f')][_0x2692('0x41')]=_0x2a32e6['id'];if(_0xc30723[_0x2692('0x23')]['filter']){_0x193754[_0x2692('0x3f')]=_['merge'](_0x193754['where'],{'$or':_[_0x2692('0x1c')](_0x193754[_0x2692('0x2b')],function(_0x9e1193){var _0x118cf7={};_0x118cf7[_0x9e1193]={'$like':'%'+_0xc30723['query'][_0x2692('0x42')]+'%'};return _0x118cf7;})});}_0x193754=_[_0x2692('0x43')]({},_0x193754,_0xc30723[_0x2692('0x2f')]);return db['UserWhatsappQueue'][_0x2692('0x24')](_0x193754);}})[_0x2692('0x14')](function(_0x48eeb0){if(_0x48eeb0){return db[_0x2692('0x44')][_0x2692('0x45')]({'where':{'id':_[_0x2692('0x1c')](_0x48eeb0,_0x2692('0x46')),'role':_0x2692('0x47')},'attributes':['id','name',_0x2692('0x48'),_0x2692('0x49'),_0x2692('0x4a')]});}})[_0x2692('0x14')](function(_0x4b0945){if(_0x4b0945){return{'count':_0x4b0945[_0x2692('0x11')],'rows':_['map'](_0x4b0945[_0x2692('0x25')],function(_0x3cb0eb){return{'membername':_0x3cb0eb[_0x2692('0x1b')],'UserId':_0x3cb0eb['id'],'queue_name':_0x59e732[_0x2692('0x1b')],'WhatsappQueueId':_0x59e732['id'],'interface':util[_0x2692('0x4b')]('%s/%s','SIP',_0x3cb0eb['name']),'penalty':0x0,'paused':_0x3cb0eb[_0x2692('0x48')],'createdAt':_0x3cb0eb[_0x2692('0x4a')],'updatedAt':_0x3cb0eb[_0x2692('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2692('0x14')](respondWithFilteredResult(_0x59d47e,_0x193754))[_0x2692('0x26')](handleError(_0x59d47e,null));};exports['getTeams']=function(_0x71b22e,_0x1e5f7d){var _0x5ad81a={};var _0x3f807a={};var _0x174b3e;var _0x29568a;return db['WhatsappQueue']['findOne']({'where':{'id':_0x71b22e['params']['id']}})[_0x2692('0x14')](handleEntityNotFound(_0x1e5f7d,null))[_0x2692('0x14')](function(_0x51907c){if(_0x51907c){_0x174b3e=_0x51907c;_0x3f807a[_0x2692('0x2a')]=_[_0x2692('0x28')](db[_0x2692('0x4c')][_0x2692('0x1e')]);_0x3f807a[_0x2692('0x23')]=_[_0x2692('0x28')](_0x71b22e[_0x2692('0x23')]);_0x3f807a['filters']=_[_0x2692('0x2c')](_0x3f807a[_0x2692('0x2a')],_0x3f807a['query']);_0x5ad81a['attributes']=_[_0x2692('0x2c')](_0x3f807a['model'],qs[_0x2692('0x2d')](_0x71b22e[_0x2692('0x23')][_0x2692('0x2d')]));_0x5ad81a['attributes']=_0x5ad81a[_0x2692('0x2b')]['length']?_0x5ad81a[_0x2692('0x2b')]:_0x3f807a[_0x2692('0x2a')];_0x5ad81a[_0x2692('0x3d')]=qs[_0x2692('0x3e')](_0x71b22e[_0x2692('0x23')][_0x2692('0x3e')]);_0x5ad81a[_0x2692('0x3f')]=qs[_0x2692('0x29')](_['pick'](_0x71b22e[_0x2692('0x23')],_0x3f807a[_0x2692('0x29')]));if(_0x71b22e['query']['filter']){_0x5ad81a[_0x2692('0x3f')]=_[_0x2692('0x43')](_0x5ad81a[_0x2692('0x3f')],{'$or':_['map'](_0x5ad81a[_0x2692('0x2b')],function(_0x52da72){var _0x5de6c9={};_0x5de6c9[_0x52da72]={'$like':'%'+_0x71b22e[_0x2692('0x23')][_0x2692('0x42')]+'%'};return _0x5de6c9;})});}_0x5ad81a=_[_0x2692('0x43')]({},_0x5ad81a,_0x71b22e[_0x2692('0x2f')]);return _0x174b3e[_0x2692('0x4d')](_0x5ad81a);}})[_0x2692('0x14')](function(_0x2febcb){if(_0x2febcb){_0x29568a=_0x2febcb[_0x2692('0x2e')];if(!_0x71b22e[_0x2692('0x23')][_0x2692('0x4e')](_0x2692('0x3c'))){_0x5ad81a[_0x2692('0xf')]=qs[_0x2692('0xf')](_0x71b22e['query'][_0x2692('0xf')]);_0x5ad81a[_0x2692('0xe')]=qs['offset'](_0x71b22e[_0x2692('0x23')][_0x2692('0xe')]);}return _0x174b3e[_0x2692('0x4d')](_0x5ad81a);}})[_0x2692('0x14')](function(_0x43b194){if(_0x43b194){return _0x43b194?{'count':_0x29568a,'rows':_0x43b194}:null;}})['then'](respondWithResult(_0x1e5f7d,null))['catch'](handleError(_0x1e5f7d,null));};exports['addTeams']=function(_0x24a99d,_0x5859e6){var _0x16bff8=_0x24a99d[_0x2692('0x31')][_0x2692('0x4f')];return db[_0x2692('0x4c')][_0x2692('0x24')]({'where':{'id':_0x16bff8},'attributes':['id'],'include':[{'model':db[_0x2692('0x44')],'as':_0x2692('0x50'),'attributes':['id',_0x2692('0x1b'),_0x2692('0x51'),_0x2692('0x52'),_0x2692('0x53')],'raw':!![]}]})[_0x2692('0x14')](function(_0x4849b4){if(_0x4849b4){var _0x53549d=_['flatMap'](_0x4849b4,function(_0x15e60f){var _0x3a41a6=_0x15e60f['get']({'plain':!![]});return _0x3a41a6['Agents'];});return db[_0x2692('0x1d')][_0x2692('0x30')]({'where':{'id':_0x24a99d['params']['id']}})['then'](function(_0x721ede){return db[_0x2692('0x54')]['transaction'](function(_0xfa0bf6){return _0x721ede[_0x2692('0x55')](_0x16bff8,{'transaction':_0xfa0bf6})[_0x2692('0x14')](function(){return BPromise['each'](_0x53549d,function(_0x20e7b5){return db['UserWhatsappQueue'][_0x2692('0x56')]({'where':{'UserId':_0x20e7b5['id'],'WhatsappQueueId':_0x24a99d[_0x2692('0x27')]['id']},'transaction':_0xfa0bf6});});})[_0x2692('0x14')](function(){_0x53549d[_0x2692('0x57')](function(_0x870dc5){socket[_0x2692('0x58')](_0x2692('0x59'),{'UserId':_0x870dc5['id'],'WhatsappQueueId':_0x721ede['id']});});});});});}})[_0x2692('0x14')](respondWithStatusCode(_0x5859e6,null))[_0x2692('0x26')](handleError(_0x5859e6,null));};exports['removeTeams']=function(_0x31c858,_0x1df240){return db[_0x2692('0x4c')][_0x2692('0x24')]({'where':{'id':_0x31c858[_0x2692('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2692('0x44')],'as':_0x2692('0x50'),'attributes':['id'],'raw':!![]}]})[_0x2692('0x14')](handleEntityNotFound(_0x1df240,null))[_0x2692('0x14')](function(_0x392b9d){var _0x4be982=_[_0x2692('0x1c')](_0x392b9d,'id');var _0x77d927=[];var _0x2e4ff0=[];var _0x16bb88=squel[_0x2692('0x5a')]();_0x16bb88[_0x2692('0x5b')](_0x2692('0x5c'))['from'](_0x2692('0x5d'),'tq')[_0x2692('0x5e')]('user_has_teams','ut',_0x2692('0x5f'))[_0x2692('0x3f')](_0x2692('0x60'),_0x31c858[_0x2692('0x27')]['id']);for(var _0x3b92fd=0x0;_0x3b92fd<_0x392b9d['length'];_0x3b92fd+=0x1){let _0x313106=_0x392b9d[_0x3b92fd];for(var _0xe49bf1=0x0;_0xe49bf1<_0x313106[_0x2692('0x50')][_0x2692('0x2e')];_0xe49bf1+=0x1){let _0x37516e=_0x313106[_0x2692('0x50')][_0xe49bf1];var _0x2a80ca=_0x16bb88[_0x2692('0x61')]();_0x2a80ca[_0x2692('0x3f')](_0x2692('0x62'),_0x37516e['id']);_0x2e4ff0[_0x2692('0x63')](db['sequelize'][_0x2692('0x23')](_0x2a80ca[_0x2692('0x64')](),{'type':db[_0x2692('0x54')]['QueryTypes'][_0x2692('0x65')]})[_0x2692('0x14')](function(_0x50f46d){if(_0x50f46d['length']===0x1){return _0x37516e['id'];}else{var _0x12cae2=_[_0x2692('0x66')](_['map'](_0x50f46d,_0x2692('0x67')),function(_0x4c00ac){return _[_0x2692('0x68')](_0x4be982,_0x4c00ac);});if(_0x12cae2){return _0x37516e['id'];}}}));}}return BPromise[_0x2692('0x69')](_0x2e4ff0)[_0x2692('0x14')](function(_0x54945f){_0x77d927=_(_0x77d927)[_0x2692('0x6a')](_0x54945f)[_0x2692('0x6b')]()[_0x2692('0x6c')]();return db['WhatsappQueue'][_0x2692('0x30')]({'where':{'id':_0x31c858['params']['id']}})[_0x2692('0x14')](function(_0x1e2474){return db[_0x2692('0x54')][_0x2692('0x6d')](function(_0x22f67f){return _0x1e2474[_0x2692('0x6e')](_0x31c858[_0x2692('0x23')][_0x2692('0x4f')],{'transaction':_0x22f67f})[_0x2692('0x14')](function(){if(!_['isEmpty'](_0x77d927)){return _0x1e2474['removeAgents'](_0x77d927,{'transaction':_0x22f67f});}})[_0x2692('0x14')](function(){_0x77d927['forEach'](function(_0x1f3db2){socket[_0x2692('0x58')](_0x2692('0x6f'),{'UserId':_0x1f3db2,'WhatsappQueueId':_0x1e2474['id']});});});});});});})[_0x2692('0x14')](respondWithStatusCode(_0x1df240,null))[_0x2692('0x26')](handleError(_0x1df240,null));};exports[_0x2692('0x70')]=function(_0x3e963f,_0xafc447){return db[_0x2692('0x1d')]['find']({'where':{'id':_0x3e963f[_0x2692('0x27')]['id']}})['then'](handleEntityNotFound(_0xafc447,null))[_0x2692('0x14')](function(_0x5da55b){if(_0x5da55b){return _0x5da55b[_0x2692('0x70')](_0x3e963f[_0x2692('0x31')][_0x2692('0x4f')],_[_0x2692('0x71')](_0x3e963f[_0x2692('0x31')],[_0x2692('0x4f'),'id'])||{})[_0x2692('0x72')](function(_0x24cf2d){for(var _0x1a3b10=0x0;_0x1a3b10<_0x3e963f[_0x2692('0x31')][_0x2692('0x4f')][_0x2692('0x2e')];_0x1a3b10+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x3e963f[_0x2692('0x31')]['ids'][_0x1a3b10]),'WhatsappQueueId':Number(_0x3e963f[_0x2692('0x27')]['id'])});}return _0x24cf2d;});}})[_0x2692('0x14')](respondWithResult(_0xafc447,null))[_0x2692('0x26')](handleError(_0xafc447,null));};exports[_0x2692('0x73')]=function(_0x157656,_0x11804c){return db[_0x2692('0x1d')][_0x2692('0x30')]({'where':{'id':_0x157656[_0x2692('0x27')]['id']}})[_0x2692('0x14')](handleEntityNotFound(_0x11804c,null))[_0x2692('0x14')](function(_0x457210){if(_0x457210){return _0x457210[_0x2692('0x73')](_0x157656['query'][_0x2692('0x4f')])['then'](function(){if(_[_0x2692('0x74')](_0x157656[_0x2692('0x23')][_0x2692('0x4f')])){for(var _0x3e9071=0x0;_0x3e9071<_0x157656[_0x2692('0x23')][_0x2692('0x4f')][_0x2692('0x2e')];_0x3e9071+=0x1){socket[_0x2692('0x58')](_0x2692('0x6f'),{'UserId':Number(_0x157656['query'][_0x2692('0x4f')][_0x3e9071]),'WhatsappQueueId':Number(_0x157656['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x157656[_0x2692('0x23')]['ids']),'WhatsappQueueId':Number(_0x157656[_0x2692('0x27')]['id'])});}});}})[_0x2692('0x14')](respondWithStatusCode(_0x11804c,null))['catch'](handleError(_0x11804c,null));};exports[_0x2692('0x75')]=function(_0xe27c1,_0x1e7399){var _0x522f83={};var _0x135a92={};var _0x5b4d01;var _0xd15623;return db[_0x2692('0x1d')][_0x2692('0x76')]({'where':{'id':_0xe27c1[_0x2692('0x27')]['id']}})[_0x2692('0x14')](handleEntityNotFound(_0x1e7399,null))[_0x2692('0x14')](function(_0x15e753){if(_0x15e753){_0x5b4d01=_0x15e753;_0x135a92['model']=_[_0x2692('0x28')](db[_0x2692('0x44')]['rawAttributes']);_0x135a92[_0x2692('0x23')]=_[_0x2692('0x28')](_0xe27c1[_0x2692('0x23')]);_0x135a92[_0x2692('0x29')]=_[_0x2692('0x2c')](_0x135a92['model'],_0x135a92[_0x2692('0x23')]);_0x522f83[_0x2692('0x2b')]=_[_0x2692('0x2c')](_0x135a92[_0x2692('0x2a')],qs['fields'](_0xe27c1[_0x2692('0x23')][_0x2692('0x2d')]));_0x522f83[_0x2692('0x2b')]=_0x522f83[_0x2692('0x2b')][_0x2692('0x2e')]?_0x522f83['attributes']:_0x135a92[_0x2692('0x2a')];_0x522f83[_0x2692('0x3d')]=qs[_0x2692('0x3e')](_0xe27c1[_0x2692('0x23')][_0x2692('0x3e')]);_0x522f83[_0x2692('0x3f')]=qs[_0x2692('0x29')](_[_0x2692('0x40')](_0xe27c1[_0x2692('0x23')],_0x135a92['filters']));if(_0xe27c1[_0x2692('0x23')]['filter']){_0x522f83[_0x2692('0x3f')]=_[_0x2692('0x43')](_0x522f83[_0x2692('0x3f')],{'$or':_[_0x2692('0x1c')](_0x522f83['attributes'],function(_0x1212cf){var _0x5e86ef={};_0x5e86ef[_0x1212cf]={'$like':'%'+_0xe27c1['query'][_0x2692('0x42')]+'%'};return _0x5e86ef;})});}_0x522f83=_[_0x2692('0x43')]({},_0x522f83,_0xe27c1[_0x2692('0x2f')]);return _0x5b4d01[_0x2692('0x75')](_0x522f83);}})[_0x2692('0x14')](function(_0x4a9c2b){if(_0x4a9c2b){_0xd15623=_0x4a9c2b[_0x2692('0x2e')];if(!_0xe27c1['query'][_0x2692('0x4e')]('nolimit')){_0x522f83[_0x2692('0xf')]=qs[_0x2692('0xf')](_0xe27c1['query']['limit']);_0x522f83[_0x2692('0xe')]=qs[_0x2692('0xe')](_0xe27c1[_0x2692('0x23')][_0x2692('0xe')]);}return _0x5b4d01[_0x2692('0x75')](_0x522f83);}})[_0x2692('0x14')](function(_0x29987c){if(_0x29987c){return _0x29987c?{'count':_0xd15623,'rows':_0x29987c}:null;}})['then'](respondWithResult(_0x1e7399,null))[_0x2692('0x26')](handleError(_0x1e7399,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6e63b69..377ead3 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 _0x958a=['setMaxListeners','save','remove','emit','hook','exports','WhatsappQueue'];(function(_0x288f2a,_0x2797bf){var _0x290687=function(_0x1d81c9){while(--_0x1d81c9){_0x288f2a['push'](_0x288f2a['shift']());}};_0x290687(++_0x2797bf);}(_0x958a,0x1a3));var _0xa958=function(_0x172876,_0x5bead6){_0x172876=_0x172876-0x0;var _0x3fec53=_0x958a[_0x172876];return _0x3fec53;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xa958('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xa958('0x1')](0x0);var events={'afterCreate':_0xa958('0x2'),'afterUpdate':'update','afterDestroy':_0xa958('0x3')};function emitEvent(_0x280467){return function(_0x4df3ca,_0x1165c7,_0x511b95){WhatsappQueueEvents[_0xa958('0x4')](_0x280467+':'+_0x4df3ca['id'],_0x4df3ca);WhatsappQueueEvents[_0xa958('0x4')](_0x280467,_0x4df3ca);_0x511b95(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xa958('0x5')](e,emitEvent(event));}}module[_0xa958('0x6')]=WhatsappQueueEvents; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 5471683..dd965b5 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 _0xb552=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0xb552,0xfe));var _0x2b55=function(_0x52d3e8,_0x1aa1bc){_0x52d3e8=_0x52d3e8-0x0;var _0x498ea2=_0xb552[_0x52d3e8];return _0x498ea2;};'use strict';var _=require(_0x2b55('0x0'));var util=require('util');var logger=require(_0x2b55('0x1'))(_0x2b55('0x2'));var moment=require(_0x2b55('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b55('0x4'));var fs=require('fs');var path=require(_0x2b55('0x5'));var rimraf=require(_0x2b55('0x6'));var config=require(_0x2b55('0x7'));var attributes=require(_0x2b55('0x8'));module[_0x2b55('0x9')]=function(_0x57a453,_0x4c35ce){return _0x57a453['define'](_0x2b55('0xa'),attributes,{'tableName':_0x2b55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c32d0f7..5e5b911 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 _0x095e=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','ShowWhatsappQueue','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x095e,0x154));var _0xe095=function(_0x5de6eb,_0x43a0b1){_0x5de6eb=_0x5de6eb-0x0;var _0x5e5b22=_0x095e[_0x5de6eb];return _0x5e5b22;};'use strict';var _=require(_0xe095('0x0'));var util=require(_0xe095('0x1'));var moment=require(_0xe095('0x2'));var BPromise=require('bluebird');var rs=require(_0xe095('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe095('0x4'));var logger=require(_0xe095('0x5'))(_0xe095('0x6'));var config=require(_0xe095('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe095('0x8')][_0xe095('0x9')]({'port':0x232a});config['redis']=_[_0xe095('0xa')](config[_0xe095('0xb')],{'host':_0xe095('0xc'),'port':0x18eb});var socket=require(_0xe095('0xd'))(new Redis(config[_0xe095('0xb')]));require(_0xe095('0xe'))[_0xe095('0xf')](socket);function respondWithRpcPromise(_0x7c718e,_0x592c4e,_0x49cf03){return new BPromise(function(_0x510a59,_0x1b29ac){return client[_0xe095('0x10')](_0x7c718e,_0x49cf03)['then'](function(_0x58f0d7){logger[_0xe095('0x11')](_0xe095('0x12'),_0x592c4e,_0xe095('0x13'));logger[_0xe095('0x14')](_0xe095('0x15'),_0x592c4e,_0xe095('0x13'),JSON['stringify'](_0x58f0d7));if(_0x58f0d7[_0xe095('0x16')]){if(_0x58f0d7['error'][_0xe095('0x17')]===0x1f4){logger[_0xe095('0x16')](_0xe095('0x12'),_0x592c4e,_0x58f0d7[_0xe095('0x16')][_0xe095('0x18')]);return _0x1b29ac(_0x58f0d7[_0xe095('0x16')]['message']);}logger[_0xe095('0x16')](_0xe095('0x12'),_0x592c4e,_0x58f0d7[_0xe095('0x16')][_0xe095('0x18')]);return _0x510a59(_0x58f0d7[_0xe095('0x16')][_0xe095('0x18')]);}else{logger[_0xe095('0x11')](_0xe095('0x12'),_0x592c4e,'request\x20sent');_0x510a59(_0x58f0d7['result'][_0xe095('0x18')]);}})[_0xe095('0x19')](function(_0x1c81c4){logger[_0xe095('0x16')](_0xe095('0x12'),_0x592c4e,_0x1c81c4);_0x1b29ac(_0x1c81c4);});});}exports[_0xe095('0x1a')]=function(_0x353a7f){var _0x3c44ac=this;return new Promise(function(_0x335aa7,_0x35f3cb){return db[_0xe095('0x1b')][_0xe095('0x1c')]({'raw':_0x353a7f[_0xe095('0x1d')]?_0x353a7f[_0xe095('0x1d')][_0xe095('0x1e')]===undefined?!![]:![]:!![],'where':_0x353a7f['options']?_0x353a7f['options'][_0xe095('0x1f')]||null:null,'attributes':_0x353a7f[_0xe095('0x1d')]?_0x353a7f[_0xe095('0x1d')]['attributes']||null:null,'limit':_0x353a7f[_0xe095('0x1d')]?_0x353a7f[_0xe095('0x1d')][_0xe095('0x20')]||null:null,'include':_0x353a7f[_0xe095('0x1d')]?_0x353a7f['options'][_0xe095('0x21')]?_[_0xe095('0x22')](_0x353a7f[_0xe095('0x1d')][_0xe095('0x21')],function(_0x4b7bb4){return{'model':db[_0x4b7bb4[_0xe095('0x23')]],'as':_0x4b7bb4['as'],'attributes':_0x4b7bb4['attributes'],'include':_0x4b7bb4[_0xe095('0x21')]?_[_0xe095('0x22')](_0x4b7bb4[_0xe095('0x21')],function(_0xb83c92){return{'model':db[_0xb83c92[_0xe095('0x23')]],'as':_0xb83c92['as'],'attributes':_0xb83c92['attributes'],'include':_0xb83c92[_0xe095('0x21')]?_[_0xe095('0x22')](_0xb83c92['include'],function(_0x385fd5){return{'model':db[_0x385fd5[_0xe095('0x23')]],'as':_0x385fd5['as'],'attributes':_0x385fd5[_0xe095('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe095('0x25')](function(_0x3abf32){logger[_0xe095('0x11')]('GetWhatsappQueue',_0x353a7f);logger[_0xe095('0x14')](_0xe095('0x1a'),_0x353a7f,JSON[_0xe095('0x26')](_0x3abf32));_0x335aa7(_0x3abf32);})[_0xe095('0x19')](function(_0x27008c){logger[_0xe095('0x16')]('GetWhatsappQueue',_0x27008c[_0xe095('0x18')],_0x353a7f);_0x35f3cb(_0x3c44ac[_0xe095('0x16')](0x1f4,_0x27008c[_0xe095('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x343c20){var _0x4ea340=this;return new Promise(function(_0x17cf75,_0x3a8b41){return db['WhatsappQueue']['find']({'raw':_0x343c20[_0xe095('0x1d')]?_0x343c20['options'][_0xe095('0x1e')]===undefined?!![]:![]:!![],'where':_0x343c20[_0xe095('0x1d')]?_0x343c20[_0xe095('0x1d')][_0xe095('0x1f')]||null:null,'attributes':_0x343c20['options']?_0x343c20[_0xe095('0x1d')]['attributes']||null:null,'include':_0x343c20[_0xe095('0x1d')]?_0x343c20[_0xe095('0x1d')][_0xe095('0x21')]?_[_0xe095('0x22')](_0x343c20['options'][_0xe095('0x21')],function(_0x4fd0ea){return{'model':db[_0x4fd0ea['model']],'as':_0x4fd0ea['as'],'attributes':_0x4fd0ea[_0xe095('0x24')],'include':_0x4fd0ea[_0xe095('0x21')]?_[_0xe095('0x22')](_0x4fd0ea[_0xe095('0x21')],function(_0x47957b){return{'model':db[_0x47957b[_0xe095('0x23')]],'as':_0x47957b['as'],'attributes':_0x47957b[_0xe095('0x24')],'include':_0x47957b[_0xe095('0x21')]?_[_0xe095('0x22')](_0x47957b[_0xe095('0x21')],function(_0x29a985){return{'model':db[_0x29a985[_0xe095('0x23')]],'as':_0x29a985['as'],'attributes':_0x29a985[_0xe095('0x24')]};}):[]};}):[]};}):[]:[]})[_0xe095('0x25')](function(_0x44f38e){logger[_0xe095('0x11')](_0xe095('0x27'),_0x343c20);logger[_0xe095('0x14')](_0xe095('0x27'),_0x343c20,JSON['stringify'](_0x44f38e));_0x17cf75(_0x44f38e);})[_0xe095('0x19')](function(_0x2bd1ce){logger[_0xe095('0x16')](_0xe095('0x27'),_0x2bd1ce[_0xe095('0x18')],_0x343c20);_0x3a8b41(_0x4ea340[_0xe095('0x16')](0x1f4,_0x2bd1ce['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8d9c1a1..71c0afd 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 _0xcac7=['update','register','whatsappQueue:','save','remove'];(function(_0x55763b,_0x4b1520){var _0xbd7ad2=function(_0x1dc8ba){while(--_0x1dc8ba){_0x55763b['push'](_0x55763b['shift']());}};_0xbd7ad2(++_0x4b1520);}(_0xcac7,0x157));var _0x7cac=function(_0x20fb30,_0x40a6f3){_0x20fb30=_0x20fb30-0x0;var _0x5b47c7=_0xcac7[_0x20fb30];return _0x5b47c7;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x7cac('0x0'),_0x7cac('0x1'),_0x7cac('0x2')];function createListener(_0x31d509,_0x52d2ba){return function(_0x53ef48){_0x52d2ba['emit'](_0x31d509,_0x53ef48);};}function removeListener(_0xb34783,_0x4e1ea5){return function(){WhatsappQueueEvents['removeListener'](_0xb34783,_0x4e1ea5);};}exports[_0x7cac('0x3')]=function(_0x578418){for(var _0x2f3e2f=0x0,_0x4aeec1=events['length'];_0x2f3e2f<_0x4aeec1;_0x2f3e2f++){var _0x129803=events[_0x2f3e2f];var _0x242f59=createListener(_0x7cac('0x4')+_0x129803,_0x578418);WhatsappQueueEvents['on'](_0x129803,_0x242f59);}}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e322fd0..46f4bdb 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 _0xcb8b=['index','/:id','isAuthenticated','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get'];(function(_0x4ba845,_0x2ba597){var _0x38b3c0=function(_0x2a10f4){while(--_0x2a10f4){_0x4ba845['push'](_0x4ba845['shift']());}};_0x38b3c0(++_0x2ba597);}(_0xcb8b,0x117));var _0xbcb8=function(_0x4c86bd,_0xe3f94f){_0x4c86bd=_0x4c86bd-0x0;var _0x4b08bd=_0xcb8b[_0x4c86bd];return _0x4b08bd;};'use strict';var multer=require(_0xbcb8('0x0'));var util=require('util');var path=require(_0xbcb8('0x1'));var timeout=require(_0xbcb8('0x2'));var express=require('express');var router=express[_0xbcb8('0x3')]();var fs_extra=require(_0xbcb8('0x4'));var auth=require(_0xbcb8('0x5'));var interaction=require(_0xbcb8('0x6'));var config=require('../../config/environment');var controller=require(_0xbcb8('0x7'));router[_0xbcb8('0x8')]('/',auth['isAuthenticated'](),controller[_0xbcb8('0x9')]);router[_0xbcb8('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbcb8('0x8')](_0xbcb8('0xa'),auth[_0xbcb8('0xb')](),controller['show']);router['post']('/',auth[_0xbcb8('0xb')](),controller['create']);router[_0xbcb8('0xc')](_0xbcb8('0xa'),auth[_0xbcb8('0xb')](),controller[_0xbcb8('0xd')]);router[_0xbcb8('0xe')](_0xbcb8('0xa'),auth[_0xbcb8('0xb')](),controller['destroy']);module[_0xbcb8('0xf')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 42ea46a..103ce19 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3de680,_0xe5cd77){var _0x5148a3=function(_0x1587f7){while(--_0x1587f7){_0x3de680['push'](_0x3de680['shift']());}};_0x5148a3(++_0xe5cd77);}(_0x7a54,0x106));var _0x47a5=function(_0x561484,_0x4b2ccd){_0x561484=_0x561484-0x0;var _0x424e06=_0x7a54[_0x561484];return _0x424e06;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 84e2cdd..3d6fe24 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 _0xf4f4=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xdb50e1,_0x112a80){var _0x2a50fc=function(_0xd47d89){while(--_0xd47d89){_0xdb50e1['push'](_0xdb50e1['shift']());}};_0x2a50fc(++_0x112a80);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x6b2214,_0x2ee8a2){_0x6b2214=_0x6b2214-0x0;var _0x994db4=_0xf4f4[_0x6b2214];return _0x994db4;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x28')]();});}};}function handleEntityNotFound(_0x2ec92a,_0x113ff7){return function(_0x31b30e){if(!_0x31b30e){_0x2ec92a[_0x4f4f('0x29')](0x194);}return _0x31b30e;};}function handleError(_0x50a8ce,_0x39fb9f){_0x39fb9f=_0x39fb9f||0x1f4;return function(_0x237cf9){logger[_0x4f4f('0x2a')](_0x237cf9[_0x4f4f('0x2b')]);if(_0x237cf9[_0x4f4f('0x2c')]){delete _0x237cf9['name'];}_0x50a8ce[_0x4f4f('0x1b')](_0x39fb9f)[_0x4f4f('0x2d')](_0x237cf9);};}exports[_0x4f4f('0x2e')]=function(_0x5deda9,_0x534075){var _0x4c2490={},_0x73b8bb={},_0x5b4f6a={'count':0x0,'rows':[]};var _0x354266=_[_0x4f4f('0x2f')](db[_0x4f4f('0x30')]['rawAttributes'],function(_0x460546){return{'name':_0x460546[_0x4f4f('0x31')],'type':_0x460546['type'][_0x4f4f('0x32')]};});_0x73b8bb[_0x4f4f('0x33')]=_[_0x4f4f('0x2f')](_0x354266,'name');_0x73b8bb[_0x4f4f('0x34')]=_[_0x4f4f('0x35')](_0x5deda9['query']);_0x73b8bb['filters']=_[_0x4f4f('0x36')](_0x73b8bb[_0x4f4f('0x33')],_0x73b8bb[_0x4f4f('0x34')]);_0x4c2490[_0x4f4f('0x37')]=_[_0x4f4f('0x36')](_0x73b8bb[_0x4f4f('0x33')],qs[_0x4f4f('0x38')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x38')]));_0x4c2490[_0x4f4f('0x37')]=_0x4c2490['attributes']['length']?_0x4c2490[_0x4f4f('0x37')]:_0x73b8bb['model'];if(!_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x39')](_0x4f4f('0x3a'))){_0x4c2490[_0x4f4f('0x1e')]=qs[_0x4f4f('0x1e')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x1e')]);_0x4c2490[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x1c')]);}_0x4c2490[_0x4f4f('0x3b')]=qs['sort'](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x3c')]);_0x4c2490[_0x4f4f('0x3d')]=qs[_0x4f4f('0x3e')](_[_0x4f4f('0x3f')](_0x5deda9[_0x4f4f('0x34')],_0x73b8bb[_0x4f4f('0x3e')]),_0x354266);if(_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x40')]){_0x4c2490['where']=_[_0x4f4f('0x41')](_0x4c2490[_0x4f4f('0x3d')],{'$or':_[_0x4f4f('0x2f')](_0x354266,function(_0x5eb174){if(_0x5eb174['type']!==_0x4f4f('0x42')){var _0x95a296={};_0x95a296[_0x5eb174[_0x4f4f('0x2c')]]={'$like':'%'+_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x40')]+'%'};return _0x95a296;}})});}_0x4c2490=_[_0x4f4f('0x41')]({},_0x4c2490,_0x5deda9[_0x4f4f('0x43')]);var _0x1ff7f3={'where':_0x4c2490[_0x4f4f('0x3d')]};return db[_0x4f4f('0x30')][_0x4f4f('0x1f')](_0x1ff7f3)[_0x4f4f('0x27')](function(_0x4e352e){_0x5b4f6a[_0x4f4f('0x1f')]=_0x4e352e;if(_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x44')]){_0x4c2490[_0x4f4f('0x45')]=[{'all':!![]}];}return db[_0x4f4f('0x30')]['findAll'](_0x4c2490);})['then'](function(_0x134710){_0x5b4f6a[_0x4f4f('0x46')]=_0x134710;return _0x5b4f6a;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x534075,_0x4c2490))[_0x4f4f('0x47')](handleError(_0x534075,null));};exports['show']=function(_0x1aaf2c,_0x480919){var _0x10de24={'raw':!![],'where':{'id':_0x1aaf2c['params']['id']}},_0x5a7c94={};_0x5a7c94[_0x4f4f('0x33')]=_['keys'](db[_0x4f4f('0x30')][_0x4f4f('0x48')]);_0x5a7c94['query']=_[_0x4f4f('0x35')](_0x1aaf2c[_0x4f4f('0x34')]);_0x5a7c94['filters']=_[_0x4f4f('0x36')](_0x5a7c94[_0x4f4f('0x33')],_0x5a7c94[_0x4f4f('0x34')]);_0x10de24[_0x4f4f('0x37')]=_[_0x4f4f('0x36')](_0x5a7c94[_0x4f4f('0x33')],qs[_0x4f4f('0x38')](_0x1aaf2c[_0x4f4f('0x34')][_0x4f4f('0x38')]));_0x10de24[_0x4f4f('0x37')]=_0x10de24[_0x4f4f('0x37')][_0x4f4f('0x49')]?_0x10de24[_0x4f4f('0x37')]:_0x5a7c94[_0x4f4f('0x33')];if(_0x1aaf2c[_0x4f4f('0x34')]['includeAll']){_0x10de24[_0x4f4f('0x45')]=[{'all':!![]}];}_0x10de24=_['merge']({},_0x10de24,_0x1aaf2c['options']);return db[_0x4f4f('0x30')][_0x4f4f('0x4a')](_0x10de24)['then'](handleEntityNotFound(_0x480919,null))[_0x4f4f('0x27')](respondWithResult(_0x480919,null))[_0x4f4f('0x47')](handleError(_0x480919,null));};exports[_0x4f4f('0x4b')]=function(_0x2721b5,_0x222511){return db['WhatsappQueueReport'][_0x4f4f('0x4b')](_0x2721b5[_0x4f4f('0x4c')],{})[_0x4f4f('0x27')](respondWithResult(_0x222511,0xc9))[_0x4f4f('0x47')](handleError(_0x222511,null));};exports[_0x4f4f('0x26')]=function(_0x433787,_0x29314b){if(_0x433787[_0x4f4f('0x4c')]['id']){delete _0x433787[_0x4f4f('0x4c')]['id'];}return db['WhatsappQueueReport'][_0x4f4f('0x4a')]({'where':{'id':_0x433787[_0x4f4f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29314b,null))['then'](saveUpdates(_0x433787['body'],null))[_0x4f4f('0x27')](respondWithResult(_0x29314b,null))[_0x4f4f('0x47')](handleError(_0x29314b,null));};exports[_0x4f4f('0x4e')]=function(_0x5c5077,_0x389ec6){return db['WhatsappQueueReport'][_0x4f4f('0x4a')]({'where':{'id':_0x5c5077[_0x4f4f('0x4d')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x389ec6,null))[_0x4f4f('0x27')](removeEntity(_0x389ec6,null))[_0x4f4f('0x47')](handleError(_0x389ec6,null));};exports[_0x4f4f('0x4f')]=function(_0x21408b,_0x88054a){return db[_0x4f4f('0x30')]['describe']()['then'](respondWithResult(_0x88054a,null))[_0x4f4f('0x47')](handleError(_0x88054a,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 68d4868..ec5a3f5 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 _0xa8cd=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x5b7327,_0x3da7cc){var _0x1518a1=function(_0x32345a){while(--_0x32345a){_0x5b7327['push'](_0x5b7327['shift']());}};_0x1518a1(++_0x3da7cc);}(_0xa8cd,0x7d));var _0xda8c=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xa8cd[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0xda8c('0x0'));var util=require('util');var logger=require(_0xda8c('0x1'))(_0xda8c('0x2'));var moment=require(_0xda8c('0x3'));var BPromise=require('bluebird');var rp=require(_0xda8c('0x4'));var fs=require('fs');var path=require(_0xda8c('0x5'));var rimraf=require('rimraf');var config=require(_0xda8c('0x6'));var attributes=require(_0xda8c('0x7'));module['exports']=function(_0x4d7e4c,_0x1cda23){return _0x4d7e4c[_0xda8c('0x8')](_0xda8c('0x9'),attributes,{'tableName':_0xda8c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 8dffc15..3bda66f 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 _0x462e=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','catch','CreateWhatsappQueueReport','body','options','message','WhatsappQueueReport','update','where','attributes','limit','debug','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x4f4ece,_0x13daec){var _0xf8d6a0=function(_0x1e8fc7){while(--_0x1e8fc7){_0x4f4ece['push'](_0x4f4ece['shift']());}};_0xf8d6a0(++_0x13daec);}(_0x462e,0x13c));var _0xe462=function(_0x3ba07e,_0x56bb35){_0x3ba07e=_0x3ba07e-0x0;var _0x5ad3d8=_0x462e[_0x3ba07e];return _0x5ad3d8;};'use strict';var _=require(_0xe462('0x0'));var util=require(_0xe462('0x1'));var moment=require(_0xe462('0x2'));var BPromise=require(_0xe462('0x3'));var rs=require(_0xe462('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe462('0x5'))['db'];var utils=require(_0xe462('0x6'));var logger=require(_0xe462('0x7'))(_0xe462('0x8'));var config=require('../../config/environment');var jayson=require(_0xe462('0x9'));var client=jayson[_0xe462('0xa')][_0xe462('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdb3d0b,_0x2b8821,_0x54552c){return new BPromise(function(_0x42838f,_0x253deb){return client[_0xe462('0xc')](_0xdb3d0b,_0x54552c)[_0xe462('0xd')](function(_0x5ced15){logger[_0xe462('0xe')](_0xe462('0xf'),_0x2b8821,_0xe462('0x10'));logger['debug'](_0xe462('0x11'),_0x2b8821,_0xe462('0x10'),JSON[_0xe462('0x12')](_0x5ced15));if(_0x5ced15['error']){if(_0x5ced15[_0xe462('0x13')][_0xe462('0x14')]===0x1f4){logger[_0xe462('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2b8821,_0x5ced15[_0xe462('0x13')]['message']);return _0x253deb(_0x5ced15[_0xe462('0x13')]['message']);}logger[_0xe462('0x13')](_0xe462('0xf'),_0x2b8821,_0x5ced15[_0xe462('0x13')]['message']);return _0x42838f(_0x5ced15[_0xe462('0x13')]['message']);}else{logger[_0xe462('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2b8821,_0xe462('0x10'));_0x42838f(_0x5ced15['result']['message']);}})[_0xe462('0x15')](function(_0x5573ed){logger[_0xe462('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2b8821,_0x5573ed);_0x253deb(_0x5573ed);});});}exports[_0xe462('0x16')]=function(_0x114dbc){var _0x3f1266=this;return new Promise(function(_0x1283f0,_0x1ad7ee){return db['WhatsappQueueReport']['create'](_0x114dbc[_0xe462('0x17')],{'raw':_0x114dbc[_0xe462('0x18')]?_0x114dbc['options']['raw']===undefined?!![]:![]:!![]})[_0xe462('0xd')](function(_0x5eb4e7){logger[_0xe462('0xe')](_0xe462('0x16'),_0x114dbc);logger['debug'](_0xe462('0x16'),_0x114dbc,JSON['stringify'](_0x5eb4e7));_0x1283f0(_0x5eb4e7);})[_0xe462('0x15')](function(_0x4a8ec4){logger[_0xe462('0x13')]('CreateWhatsappQueueReport',_0x4a8ec4[_0xe462('0x19')],_0x114dbc);_0x1ad7ee(_0x3f1266[_0xe462('0x13')](0x1f4,_0x4a8ec4[_0xe462('0x19')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x5c605b){var _0x8e2604=this;return new Promise(function(_0x56a283,_0x51a128){return db[_0xe462('0x1a')][_0xe462('0x1b')](_0x5c605b[_0xe462('0x17')],{'raw':_0x5c605b['options']?_0x5c605b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c605b[_0xe462('0x18')]?_0x5c605b['options'][_0xe462('0x1c')]||null:null,'attributes':_0x5c605b[_0xe462('0x18')]?_0x5c605b['options'][_0xe462('0x1d')]||null:null,'limit':_0x5c605b[_0xe462('0x18')]?_0x5c605b[_0xe462('0x18')][_0xe462('0x1e')]||null:null})[_0xe462('0xd')](function(_0x491af6){logger[_0xe462('0xe')]('UpdateWhatsappQueueReport',_0x5c605b);logger[_0xe462('0x1f')](_0xe462('0x20'),_0x5c605b,JSON[_0xe462('0x12')](_0x491af6));_0x56a283(_0x491af6);})['catch'](function(_0x2cf110){logger[_0xe462('0x13')]('UpdateWhatsappQueueReport',_0x2cf110[_0xe462('0x19')],_0x5c605b);_0x51a128(_0x8e2604[_0xe462('0x13')](0x1f4,_0x2cf110['message']));});});}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6faa2ba..39e20fe 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 _0xf48d=['/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0xf48d,0x192));var _0xdf48=function(_0x566622,_0x399507){_0x566622=_0x566622-0x0;var _0x1851dd=_0xf48d[_0x566622];return _0x1851dd;};'use strict';var multer=require(_0xdf48('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdf48('0x1'));var express=require(_0xdf48('0x2'));var router=express[_0xdf48('0x3')]();var fs_extra=require(_0xdf48('0x4'));var auth=require(_0xdf48('0x5'));var interaction=require(_0xdf48('0x6'));var config=require(_0xdf48('0x7'));var controller=require(_0xdf48('0x8'));router[_0xdf48('0x9')]('/',auth[_0xdf48('0xa')](),controller[_0xdf48('0xb')]);router[_0xdf48('0x9')](_0xdf48('0xc'),auth[_0xdf48('0xa')](),controller[_0xdf48('0xd')]);router[_0xdf48('0x9')]('/:id',auth[_0xdf48('0xa')](),controller[_0xdf48('0xe')]);router[_0xdf48('0xf')]('/',auth[_0xdf48('0xa')](),controller[_0xdf48('0x10')]);router[_0xdf48('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xdf48('0x12'),auth[_0xdf48('0xa')](),controller[_0xdf48('0x13')]);module[_0xdf48('0x14')]=router; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c30a628..f21a451 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 _0xd7a0=['DATE','sequelize','exports','ENUM','agent','queue'];(function(_0x10fa23,_0x33fbdf){var _0x9d966f=function(_0x42fe15){while(--_0x42fe15){_0x10fa23['push'](_0x10fa23['shift']());}};_0x9d966f(++_0x33fbdf);}(_0xd7a0,0x163));var _0x0d7a=function(_0x19eafc,_0x22b84a){_0x19eafc=_0x19eafc-0x0;var _0x56ff62=_0xd7a0[_0x19eafc];return _0x56ff62;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module[_0x0d7a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0d7a('0x2')]('account',_0x0d7a('0x3'),_0x0d7a('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0d7a('0x5')]}}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9d9e4a0..8abbf5a 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 _0x2200=['pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0xcd6010,_0x3cfc81){var _0xe3a132=function(_0x4bcf06){while(--_0x4bcf06){_0xcd6010['push'](_0xcd6010['shift']());}};_0xe3a132(++_0x3cfc81);}(_0x2200,0x17b));var _0x0220=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x2200[_0x58a4fe];return _0x697de2;};'use strict';var emlformat=require(_0x0220('0x0'));var rimraf=require(_0x0220('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0220('0x2'));var rp=require(_0x0220('0x3'));var moment=require(_0x0220('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0220('0x5'));var util=require(_0x0220('0x6'));var path=require(_0x0220('0x7'));var sox=require(_0x0220('0x8'));var csv=require(_0x0220('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0220('0xa'));var squel=require(_0x0220('0xb'));var crypto=require('crypto');var jsforce=require(_0x0220('0xc'));var deskjs=require(_0x0220('0xd'));var toCsv=require(_0x0220('0x9'));var querystring=require('querystring');var Papa=require(_0x0220('0xe'));var Redis=require('ioredis');var authService=require(_0x0220('0xf'));var qs=require(_0x0220('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0220('0x11'));var logger=require(_0x0220('0x12'))(_0x0220('0x13'));var utils=require('../../config/utils');var config=require(_0x0220('0x14'));var licenseUtil=require(_0x0220('0x15'));var db=require(_0x0220('0x16'))['db'];function respondWithStatusCode(_0x4c926c,_0x5c69af){_0x5c69af=_0x5c69af||0xcc;return function(_0x5d977d){if(_0x5d977d){return _0x4c926c[_0x0220('0x17')](_0x5c69af);}return _0x4c926c[_0x0220('0x18')](_0x5c69af)[_0x0220('0x19')]();};}function respondWithResult(_0x3e62a7,_0x1a79c8){_0x1a79c8=_0x1a79c8||0xc8;return function(_0x589e75){if(_0x589e75){return _0x3e62a7[_0x0220('0x18')](_0x1a79c8)[_0x0220('0x1a')](_0x589e75);}};}function respondWithFilteredResult(_0x3189e7,_0xcf4fbd){return function(_0x37199d){if(_0x37199d){var _0x56e7ee=typeof _0xcf4fbd[_0x0220('0x1b')]==='undefined'&&typeof _0xcf4fbd[_0x0220('0x1c')]==='undefined';var _0x31c266=_0x37199d[_0x0220('0x1d')];var _0x3b06c8=_0x56e7ee?0x0:_0xcf4fbd[_0x0220('0x1b')];var _0xeff9e3=_0x56e7ee?_0x37199d[_0x0220('0x1d')]:_0xcf4fbd[_0x0220('0x1b')]+_0xcf4fbd['limit'];var _0x461ba4;if(_0xeff9e3>=_0x31c266){_0xeff9e3=_0x31c266;_0x461ba4=0xc8;}else{_0x461ba4=0xce;}_0x3189e7[_0x0220('0x18')](_0x461ba4);return _0x3189e7[_0x0220('0x1e')](_0x0220('0x1f'),_0x3b06c8+'-'+_0xeff9e3+'/'+_0x31c266)[_0x0220('0x1a')](_0x37199d);}return null;};}function patchUpdates(_0x58f82e){return function(_0x4b9ef3){try{jsonpatch['apply'](_0x4b9ef3,_0x58f82e,!![]);}catch(_0x14dfac){return BPromise[_0x0220('0x20')](_0x14dfac);}return _0x4b9ef3[_0x0220('0x21')]();};}function saveUpdates(_0x5129e0,_0x58fbf5){return function(_0x53145c){if(_0x53145c){return _0x53145c[_0x0220('0x22')](_0x5129e0)[_0x0220('0x23')](function(_0x2bb136){return _0x2bb136;});}return null;};}function removeEntity(_0xc04ade,_0x560a15){return function(_0x2e4b3c){if(_0x2e4b3c){return _0x2e4b3c[_0x0220('0x24')]()[_0x0220('0x23')](function(){_0xc04ade[_0x0220('0x18')](0xcc)[_0x0220('0x19')]();});}};}function handleEntityNotFound(_0x1b4329,_0x4030dc){return function(_0x40ef1d){if(!_0x40ef1d){_0x1b4329[_0x0220('0x17')](0x194);}return _0x40ef1d;};}function handleError(_0x4b9e20,_0x419689){_0x419689=_0x419689||0x1f4;return function(_0x220fdf){logger['error'](_0x220fdf[_0x0220('0x25')]);if(_0x220fdf[_0x0220('0x26')]){delete _0x220fdf['name'];}_0x4b9e20['status'](_0x419689)[_0x0220('0x27')](_0x220fdf);};}exports[_0x0220('0x28')]=function(_0x2ef452,_0x41c64a){var _0x16ed46={},_0x53bb82={},_0x276a63={'count':0x0,'rows':[]};var _0x4c1677=_[_0x0220('0x29')](db[_0x0220('0x2a')][_0x0220('0x2b')],function(_0x125b20){return{'name':_0x125b20[_0x0220('0x2c')],'type':_0x125b20[_0x0220('0x2d')][_0x0220('0x2e')]};});_0x53bb82['model']=_[_0x0220('0x29')](_0x4c1677,_0x0220('0x26'));_0x53bb82[_0x0220('0x2f')]=_[_0x0220('0x30')](_0x2ef452['query']);_0x53bb82[_0x0220('0x31')]=_[_0x0220('0x32')](_0x53bb82['model'],_0x53bb82[_0x0220('0x2f')]);_0x16ed46['attributes']=_[_0x0220('0x32')](_0x53bb82[_0x0220('0x33')],qs[_0x0220('0x34')](_0x2ef452[_0x0220('0x2f')][_0x0220('0x34')]));_0x16ed46['attributes']=_0x16ed46[_0x0220('0x35')][_0x0220('0x36')]?_0x16ed46['attributes']:_0x53bb82[_0x0220('0x33')];if(!_0x2ef452['query'][_0x0220('0x37')]('nolimit')){_0x16ed46[_0x0220('0x1c')]=qs[_0x0220('0x1c')](_0x2ef452[_0x0220('0x2f')][_0x0220('0x1c')]);_0x16ed46[_0x0220('0x1b')]=qs[_0x0220('0x1b')](_0x2ef452['query'][_0x0220('0x1b')]);}_0x16ed46[_0x0220('0x38')]=qs[_0x0220('0x39')](_0x2ef452[_0x0220('0x2f')][_0x0220('0x39')]);_0x16ed46[_0x0220('0x3a')]=qs[_0x0220('0x31')](_[_0x0220('0x3b')](_0x2ef452[_0x0220('0x2f')],_0x53bb82[_0x0220('0x31')]),_0x4c1677);if(_0x2ef452[_0x0220('0x2f')][_0x0220('0x3c')]){_0x16ed46[_0x0220('0x3a')]=_[_0x0220('0x3d')](_0x16ed46[_0x0220('0x3a')],{'$or':_[_0x0220('0x29')](_0x4c1677,function(_0x5f19ee){if(_0x5f19ee[_0x0220('0x2d')]!=='VIRTUAL'){var _0x4b1475={};_0x4b1475[_0x5f19ee['name']]={'$like':'%'+_0x2ef452['query']['filter']+'%'};return _0x4b1475;}})});}_0x16ed46=_[_0x0220('0x3d')]({},_0x16ed46,_0x2ef452[_0x0220('0x3e')]);var _0x5d3b65={'where':_0x16ed46[_0x0220('0x3a')]};return db[_0x0220('0x2a')][_0x0220('0x1d')](_0x5d3b65)[_0x0220('0x23')](function(_0x538e0d){_0x276a63[_0x0220('0x1d')]=_0x538e0d;if(_0x2ef452[_0x0220('0x2f')][_0x0220('0x3f')]){_0x16ed46['include']=[{'all':!![]}];}return db[_0x0220('0x2a')][_0x0220('0x40')](_0x16ed46);})[_0x0220('0x23')](function(_0x49a9b1){_0x276a63[_0x0220('0x41')]=_0x49a9b1;return _0x276a63;})[_0x0220('0x23')](respondWithFilteredResult(_0x41c64a,_0x16ed46))[_0x0220('0x42')](handleError(_0x41c64a,null));};exports[_0x0220('0x43')]=function(_0x4fc4fd,_0x4a18f0){var _0x19e2e5={'raw':!![],'where':{'id':_0x4fc4fd[_0x0220('0x44')]['id']}},_0x344b6e={};_0x344b6e[_0x0220('0x33')]=_[_0x0220('0x30')](db[_0x0220('0x2a')][_0x0220('0x2b')]);_0x344b6e[_0x0220('0x2f')]=_['keys'](_0x4fc4fd[_0x0220('0x2f')]);_0x344b6e['filters']=_[_0x0220('0x32')](_0x344b6e[_0x0220('0x33')],_0x344b6e[_0x0220('0x2f')]);_0x19e2e5[_0x0220('0x35')]=_[_0x0220('0x32')](_0x344b6e['model'],qs[_0x0220('0x34')](_0x4fc4fd[_0x0220('0x2f')][_0x0220('0x34')]));_0x19e2e5[_0x0220('0x35')]=_0x19e2e5[_0x0220('0x35')][_0x0220('0x36')]?_0x19e2e5[_0x0220('0x35')]:_0x344b6e[_0x0220('0x33')];if(_0x4fc4fd[_0x0220('0x2f')][_0x0220('0x3f')]){_0x19e2e5['include']=[{'all':!![]}];}_0x19e2e5=_[_0x0220('0x3d')]({},_0x19e2e5,_0x4fc4fd[_0x0220('0x3e')]);return db[_0x0220('0x2a')][_0x0220('0x45')](_0x19e2e5)[_0x0220('0x23')](handleEntityNotFound(_0x4a18f0,null))[_0x0220('0x23')](respondWithResult(_0x4a18f0,null))[_0x0220('0x42')](handleError(_0x4a18f0,null));};exports['create']=function(_0x307424,_0x221218){return db[_0x0220('0x2a')][_0x0220('0x46')](_0x307424[_0x0220('0x47')],{})[_0x0220('0x23')](respondWithResult(_0x221218,0xc9))[_0x0220('0x42')](handleError(_0x221218,null));};exports[_0x0220('0x22')]=function(_0x5d732f,_0x715f1d){if(_0x5d732f[_0x0220('0x47')]['id']){delete _0x5d732f[_0x0220('0x47')]['id'];}return db[_0x0220('0x2a')]['find']({'where':{'id':_0x5d732f[_0x0220('0x44')]['id']}})[_0x0220('0x23')](handleEntityNotFound(_0x715f1d,null))['then'](saveUpdates(_0x5d732f[_0x0220('0x47')],null))[_0x0220('0x23')](respondWithResult(_0x715f1d,null))[_0x0220('0x42')](handleError(_0x715f1d,null));};exports[_0x0220('0x24')]=function(_0x2d3f32,_0x27e2ab){return db[_0x0220('0x2a')]['find']({'where':{'id':_0x2d3f32[_0x0220('0x44')]['id']}})[_0x0220('0x23')](handleEntityNotFound(_0x27e2ab,null))[_0x0220('0x23')](removeEntity(_0x27e2ab,null))['catch'](handleError(_0x27e2ab,null));};exports[_0x0220('0x48')]=function(_0x19eb54,_0x2ca80a){return db[_0x0220('0x2a')][_0x0220('0x48')]()['then'](respondWithResult(_0x2ca80a,null))[_0x0220('0x42')](handleError(_0x2ca80a,null));}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 473c04c..75a2326 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 _0x80f7=['report_whatsapp_transfer','uniqueid','lodash','moment','bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x23419d,_0x1c2bc2){var _0x522d8e=function(_0xa869c7){while(--_0xa869c7){_0x23419d['push'](_0x23419d['shift']());}};_0x522d8e(++_0x1c2bc2);}(_0x80f7,0x10a));var _0x780f=function(_0x1ba5ba,_0x566734){_0x1ba5ba=_0x1ba5ba-0x0;var _0x5991c6=_0x80f7[_0x1ba5ba];return _0x5991c6;};'use strict';var _=require(_0x780f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x780f('0x1'));var BPromise=require(_0x780f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x780f('0x3'));var rimraf=require(_0x780f('0x4'));var config=require(_0x780f('0x5'));var attributes=require(_0x780f('0x6'));module[_0x780f('0x7')]=function(_0x5bce15,_0x3e9226){return _0x5bce15[_0x780f('0x8')](_0x780f('0x9'),attributes,{'tableName':_0x780f('0xa'),'paranoid':![],'indexes':[{'name':_0x780f('0xb'),'fields':[_0x780f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ab77c18..6b95834 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 _0x94d2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x94d2,0x1e0));var _0x294d=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x94d2[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x294d('0x0'));var util=require(_0x294d('0x1'));var moment=require(_0x294d('0x2'));var BPromise=require(_0x294d('0x3'));var rs=require(_0x294d('0x4'));var fs=require('fs');var Redis=require(_0x294d('0x5'));var db=require(_0x294d('0x6'))['db'];var utils=require(_0x294d('0x7'));var logger=require(_0x294d('0x8'))('rpc');var config=require(_0x294d('0x9'));var jayson=require(_0x294d('0xa'));var client=jayson[_0x294d('0xb')][_0x294d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40a465,_0x557e9f,_0x595119){return new BPromise(function(_0x29dc16,_0x37538f){return client[_0x294d('0xd')](_0x40a465,_0x595119)[_0x294d('0xe')](function(_0x5ab517){logger['info'](_0x294d('0xf'),_0x557e9f,_0x294d('0x10'));logger[_0x294d('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x557e9f,_0x294d('0x10'),JSON['stringify'](_0x5ab517));if(_0x5ab517[_0x294d('0x12')]){if(_0x5ab517['error'][_0x294d('0x13')]===0x1f4){logger[_0x294d('0x12')](_0x294d('0xf'),_0x557e9f,_0x5ab517[_0x294d('0x12')][_0x294d('0x14')]);return _0x37538f(_0x5ab517['error'][_0x294d('0x14')]);}logger[_0x294d('0x12')](_0x294d('0xf'),_0x557e9f,_0x5ab517[_0x294d('0x12')][_0x294d('0x14')]);return _0x29dc16(_0x5ab517[_0x294d('0x12')][_0x294d('0x14')]);}else{logger['info'](_0x294d('0xf'),_0x557e9f,_0x294d('0x10'));_0x29dc16(_0x5ab517[_0x294d('0x15')][_0x294d('0x14')]);}})[_0x294d('0x16')](function(_0x161d38){logger[_0x294d('0x12')](_0x294d('0xf'),_0x557e9f,_0x161d38);_0x37538f(_0x161d38);});});} \ No newline at end of file +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 diff --git a/server/app.js b/server/app.js index 4588775..17b9fe7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdad2=['filter','exitCode','length','pm2_env','name','Online\x20apps:','online','join','map','status','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','seedDB','default','info','start'];(function(_0x143afa,_0x1f8aea){var _0x2ba526=function(_0x15c61e){while(--_0x15c61e){_0x143afa['push'](_0x143afa['shift']());}};_0x2ba526(++_0x1f8aea);}(_0xdad2,0x14c));var _0x2dad=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdad2[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var db=require(_0x2dad('0x0'))['db'];var seedDb=require(_0x2dad('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x2dad('0x2'));var config=require(_0x2dad('0x3'));var logger=require(_0x2dad('0x4'))('app');var pm2=require(_0x2dad('0x5'));var pm2Config=require(_0x2dad('0x6'));var schedule=require('./config/schedule');var chat=require(_0x2dad('0x7'));var whatsapp=require(_0x2dad('0x8'));var transcribe=require(_0x2dad('0x9'));var provider=require(_0x2dad('0xa'));function main(){return db['sequelize']['sync']()[_0x2dad('0xb')](function(){if(config[_0x2dad('0xc')]){return seedDb[_0x2dad('0xd')]();}})[_0x2dad('0xb')](function(){return checkLicense[_0x2dad('0xd')]();})[_0x2dad('0xb')](function(){return rpc['listen']();})[_0x2dad('0xb')](function(_0x57d1a2){logger[_0x2dad('0xe')](_0x57d1a2);return chat[_0x2dad('0xf')]();})['then'](function(){return whatsapp[_0x2dad('0xf')]();})[_0x2dad('0xb')](function(){return schedule[_0x2dad('0xf')]();})['then'](function(){return transcribe[_0x2dad('0xf')]();})[_0x2dad('0xb')](function(){return provider['start']();})[_0x2dad('0xb')](function(_0x2fabe2){logger[_0x2dad('0xe')](_0x2fabe2);return pm2[_0x2dad('0xf')](pm2Config);})['then'](function(_0x711ee2){var _0x2c727d=_0x711ee2[_0x2dad('0x10')](function(_0x1ea049){return typeof _0x1ea049[_0x2dad('0x11')]==='number'&&_0x1ea049['exitCode']>=0x0;});if(_0x2c727d[_0x2dad('0x12')]>0x0){throw new Error(_0x2c727d['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x2c727d,function(_0xa5dc24){return'\x22'+_0xa5dc24[_0x2dad('0x13')][_0x2dad('0x14')]+'\x22';}));}logger[_0x2dad('0xe')](_0x2dad('0x15'),_['map'](_[_0x2dad('0x10')](_0x711ee2,{'status':_0x2dad('0x16')}),'name')[_0x2dad('0x17')]());logger['info']('Offline\x20apps:',_[_0x2dad('0x18')](_[_0x2dad('0x10')](_0x711ee2,function(_0x2cc5db){return _0x2cc5db[_0x2dad('0x19')]!==_0x2dad('0x16');}),_0x2dad('0x14'))['join']()||'None');console[_0x2dad('0x1a')]('App\x20Ready!');})['catch'](function(_0x18a0f9){console[_0x2dad('0x1a')](_0x2dad('0x1b'),_0x18a0f9);logger['error'](_0x2dad('0x1c'),_0x18a0f9);process['exit'](0x1);});}main(); \ No newline at end of file +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 diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a309b18..e255218 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 _0xb62e=['nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','join','promisify','sign','secret','session','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','role','fullname','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','closed','then','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','pass','Wrong\x20credentials.','status','query','apikey','getUuid','Setting','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce'];(function(_0x1d598a,_0x927c9f){var _0x33b4e6=function(_0xa5706c){while(--_0xa5706c){_0x1d598a['push'](_0x1d598a['shift']());}};_0x33b4e6(++_0x927c9f);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var db=require(_0xeb62('0x0'))['db'];var config=require(_0xeb62('0x1'));var hardwareConf=require(_0xeb62('0x2'));var licenseUtil=require(_0xeb62('0x3'));var encryptor=require('../encryptor');var _=require(_0xeb62('0x4'));var jwt=require(_0xeb62('0x5'));var expressJwt=require(_0xeb62('0x6'));var compose=require(_0xeb62('0x7'));var basicAuth=require(_0xeb62('0x8'));var crypto=require(_0xeb62('0x9'));var BPromise=require('bluebird');var util=require(_0xeb62('0xa'));var moment=require(_0xeb62('0xb'));var validateJwt=expressJwt({'secret':config[_0xeb62('0xc')]['session']});var userAttributes=['id',_0xeb62('0xd'),_0xeb62('0xe'),_0xeb62('0xf'),_0xeb62('0x10'),'email','userpic',_0xeb62('0x11'),_0xeb62('0x12'),_0xeb62('0x13'),_0xeb62('0x14'),_0xeb62('0x15'),_0xeb62('0x16'),_0xeb62('0x17'),_0xeb62('0x18'),_0xeb62('0x19'),_0xeb62('0x1a'),'lastLoginAt',_0xeb62('0x1b'),_0xeb62('0x1c'),_0xeb62('0x1d'),_0xeb62('0x1e'),'alias',_0xeb62('0x1f'),_0xeb62('0x20'),_0xeb62('0x21'),'phoneBarEnableRecording',_0xeb62('0x22'),_0xeb62('0x23'),_0xeb62('0x24'),'phoneBarPrefixRequired',_0xeb62('0x25'),_0xeb62('0x26'),_0xeb62('0x27'),_0xeb62('0x28'),_0xeb62('0x29'),_0xeb62('0x2a'),_0xeb62('0x2b'),_0xeb62('0x2c'),_0xeb62('0x2d'),_0xeb62('0x2e'),_0xeb62('0x2f'),_0xeb62('0x30'),_0xeb62('0x31'),'chatAutoanswer',_0xeb62('0x32'),_0xeb62('0x33'),_0xeb62('0x34'),_0xeb62('0x35'),_0xeb62('0x36'),_0xeb62('0x37'),_0xeb62('0x38'),'faxAutoanswer','faxAutoanswerDelay',_0xeb62('0x39'),_0xeb62('0x3a'),_0xeb62('0x3b')];exports[_0xeb62('0x3c')]=function(){return this[_0xeb62('0x3d')](!![])['use'](function(_0x5e7aee,_0x4664ce,_0x132861){if(_0x5e7aee[_0xeb62('0x3e')]){_0x132861();}else{return db[_0xeb62('0x3f')]['findOne']({'where':{'id':_0x5e7aee['params']['id']},'attributes':['id',_0xeb62('0x40'),'disposition'],'raw':!![]})[_0xeb62('0x41')](function(_0x4b0f46){if(_0x4b0f46&&_0x4b0f46[_0xeb62('0x40')]){return _0x4664ce['status'](_0x4b0f46[_0xeb62('0x42')]===_0xeb62('0x43')?0x195:0x193)[_0xeb62('0x44')]({'message':_0x4b0f46['disposition']===_0xeb62('0x43')?_0xeb62('0x45'):_0xeb62('0x46')});}else{_0x132861();}})[_0xeb62('0x47')](function(_0x42f486){_0x132861(_0x42f486);});}});};exports[_0xeb62('0x3d')]=function isAuthenticated(_0x511202){return compose()[_0xeb62('0x48')](function(_0x1616ee,_0x57169a,_0x157474){var _0x2b51b2;if(_0x1616ee[_0xeb62('0x49')][_0xeb62('0x4a')]){if(_[_0xeb62('0x4b')](_0x1616ee['headers']['authorization'],_0xeb62('0x4c'))){var _0x357cf4=basicAuth(_0x1616ee);db[_0xeb62('0x4d')][_0xeb62('0x4e')]({'where':{'name':_0x357cf4[_0xeb62('0xf')]}})[_0xeb62('0x41')](function(_0x1ae51e){if(!_0x1ae51e||!_0x1ae51e['authenticate'](_0x357cf4[_0xeb62('0x4f')])){return _0x57169a['status'](0x191)['json']({'message':_0xeb62('0x50')});}_0x1616ee[_0xeb62('0x3e')]={'id':_0x1ae51e['id']};_0x157474();})['catch'](function(_0x1ade38){_0x157474(_0x1ade38);});}else if(_['startsWith'](_0x1616ee[_0xeb62('0x49')][_0xeb62('0x4a')],'Bearer')){validateJwt(_0x1616ee,_0x57169a,_0x157474);}else{if(_0x511202){_0x157474();}else{return _0x57169a[_0xeb62('0x51')](0x193)[_0xeb62('0x44')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1616ee[_0xeb62('0x52')][_0xeb62('0x53')]){try{var _0x38b116={'audience':hardwareConf[_0xeb62('0x54')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x1616ee[_0xeb62('0x52')][_0xeb62('0x53')],_0x38b116)['then'](function(_0x4acc96){return db[_0xeb62('0x4d')][_0xeb62('0x4e')]({'where':{'id':_0x4acc96['sub']}})[_0xeb62('0x41')](function(_0x30cff0){_0x2b51b2=_0x30cff0;return db[_0xeb62('0x55')][_0xeb62('0x56')]({'where':{'id':0x1},'attributes':[_0xeb62('0x57'),_0xeb62('0x58')],'raw':!![]});})[_0xeb62('0x41')](function(_0x4b22c8){if(!_0x2b51b2||!_['isEqual'](_0x2b51b2[_0xeb62('0x59')],_0x4acc96[_0xeb62('0x5a')])){return _0x57169a[_0xeb62('0x51')](0x191)[_0xeb62('0x44')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x2b51b2[_0xeb62('0x5b')]){return _0x57169a['status'](0x191)[_0xeb62('0x44')]({'message':_0xeb62('0x5c')});}if(_0x2b51b2[_0xeb62('0x5d')]){if(_0x4b22c8[_0xeb62('0x58')]>0x0){if(moment(_0x2b51b2[_0xeb62('0x5e')])[_0xeb62('0x5f')](_0x4b22c8[_0xeb62('0x58')],_0xeb62('0x60'))>moment()){return _0x57169a['status'](0x191)[_0xeb62('0x44')]({'message':_0xeb62('0x5c')});}}else{return _0x57169a[_0xeb62('0x51')](0x191)[_0xeb62('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1616ee['user']={'id':_0x2b51b2['id']};_0x157474();});})[_0xeb62('0x47')](function(){return _0x57169a[_0xeb62('0x51')](0x191)['json']({'message':_0xeb62('0x5c')});});}catch(_0x44a325){_0x157474(_0x44a325);}}else if(_0x511202){_0x157474();}else{return _0x57169a['status'](0x193)[_0xeb62('0x44')]({'message':'Unknown\x20authorization\x20format'});}})[_0xeb62('0x48')](function(_0x47b815,_0x114544,_0x5dde1d){if(_0x47b815[_0xeb62('0x3e')]){db[_0xeb62('0x4d')][_0xeb62('0x4e')]({'where':{'id':_0x47b815['user']['id']},'attributes':userAttributes})['then'](function(_0x3148e7){if(!_0x3148e7){return _0x114544[_0xeb62('0x51')](0x194)[_0xeb62('0x44')]({'message':_0xeb62('0x61')});}_0x47b815[_0xeb62('0x3e')]=_0x3148e7;_0x5dde1d();})['catch'](function(_0x29fdb8){_0x5dde1d(_0x29fdb8);});}else if(_0x511202){_0x5dde1d();}else{return _0x114544['status'](0x194)[_0xeb62('0x44')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xeb62('0x62')]=function canUpdate(){return compose()['use'](function(_0x26c77d,_0x4dbcac,_0x2f04ce){return licenseUtil[_0xeb62('0x63')]()[_0xeb62('0x41')](function(_0x153539){if(_0x153539[_0xeb62('0x64')]){_0x2f04ce();}else{return _0x4dbcac[_0xeb62('0x51')](0x193)['json']({'message':_0xeb62('0x65')});}})[_0xeb62('0x47')](function(_0x574573){_0x2f04ce(_0x574573);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d4c5a,_0x24dff5,_0x12562f){return licenseUtil['getLicense']()[_0xeb62('0x41')](function(_0x495618){if(_0x495618[_0xeb62('0x66')]){_0x12562f();}else{return _0x24dff5[_0xeb62('0x51')](0x193)[_0xeb62('0x44')]({'message':'Forbidden'});}})[_0xeb62('0x47')](function(_0x5f47cf){_0x12562f(_0x5f47cf);});});};exports[_0xeb62('0x67')]=function(_0x2cf2b5,_0x7fb53f,_0x18c40d){_0x2cf2b5[_0xeb62('0x67')]=!![];return _0x18c40d();};exports[_0xeb62('0x68')]=function signToken(_0x321e55){return signJwt(_0x321e55);};exports[_0xeb62('0x69')]=function(_0x19c6fb,_0x3a29ac){if(!_0x19c6fb[_0xeb62('0x3e')]){return _0x3a29ac[_0xeb62('0x51')](0x194)['json']({'message':_0xeb62('0x6a')});}var _0x50bfec={'payload':{'id':_0x19c6fb['user']['id'],'role':_0x19c6fb[_0xeb62('0x3e')][_0xeb62('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x50bfec)['then'](function(_0x373505){_0x3a29ac[_0xeb62('0x6b')]('motion.token',_0x373505);_0x3a29ac[_0xeb62('0x6c')](_0xeb62('0x6d'));})[_0xeb62('0x47')](function(_0x60617){return _0x3a29ac[_0xeb62('0x51')](0x1f4)[_0xeb62('0x6e')](_0x60617);});};exports[_0xeb62('0x6f')]=function(_0x190e65){if(_['isNil'](_0x190e65[_0xeb62('0x59')])||_['isNil'](_0x190e65[_0xeb62('0x70')])){return null;}else{return createJwt(_0x190e65);}};exports[_0xeb62('0x71')]=function(_0x9be47c){_0x9be47c[_0xeb62('0x59')]=generateNonce();_0x9be47c[_0xeb62('0x70')]=generateIssuedAt();return createJwt(_0x9be47c);};exports[_0xeb62('0x72')]=function(_0xc3aee0,_0xf12d72){var _0x595d58=_0xc3aee0['query']['apikey'];if(_0x595d58){var _0x5033eb={'nonce':_0xf12d72[_0xeb62('0x59')],'iat':_0xf12d72['apiKeyIat'],'audience':hardwareConf[_0xeb62('0x54')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x595d58,_0x5033eb)[_0xeb62('0x41')](function(){return generateApiKey(_0xf12d72);});}else{throw{'message':_0xeb62('0x73')};}};exports[_0xeb62('0x74')]=function(_0x595797){var _0x116139=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x116139[_0xeb62('0x75')](_0x595797))throw new db['Sequelize'][(_0xeb62('0x76'))](_0xeb62('0x77'));return;};exports[_0xeb62('0x78')]=function(_0x366312,_0x55370c,_0x3be3e1){var _0x1b20c4=encryptor['decryptString'](_0x55370c)[_0xeb62('0x79')](',');for(var _0x5d1415=0x0;_0x5d1415<_0x3be3e1;_0x5d1415++){if(!_0x1b20c4[_0x5d1415])break;if(_0x366312[_0xeb62('0x7a')]()===_0x1b20c4[_0x5d1415][_0xeb62('0x7a')]()){var _0x3a450b=util[_0xeb62('0x7b')](_0xeb62('0x7c'),_0x3be3e1);if(_0x3be3e1===0x1){_0x3a450b=_0xeb62('0x7d');}throw new db[(_0xeb62('0x7e'))][(_0xeb62('0x76'))](_0x3a450b);}}return;};exports[_0xeb62('0x7f')]=function(_0x15c93f,_0x200b43){var _0x3ae984=_0x200b43?encryptor[_0xeb62('0x80')](_0x200b43)[_0xeb62('0x79')](','):[];if(_0x3ae984['length']===0x5){_0x3ae984['splice'](-0x1,0x1);}_0x3ae984['unshift'](_0x15c93f);return encryptor['encryptString'](_0x3ae984[_0xeb62('0x81')](','));};function signJwt(_0x5f363d){var _0x10cc40=BPromise[_0xeb62('0x82')](jwt[_0xeb62('0x83')],{'context':jwt});var _0x316494=_0x5f363d[_0xeb62('0x84')]||config[_0xeb62('0xc')][_0xeb62('0x85')];return new BPromise(function(_0x8a64de,_0x349916){_0x10cc40(_0x5f363d[_0xeb62('0x86')],_0x316494,_0x5f363d['options'])[_0xeb62('0x41')](function(_0x12b745){_0x8a64de(_0x12b745);})[_0xeb62('0x47')](function(_0x606495){_0x349916(_0x606495);});});}function verifyJwt(_0x4aba1f,_0x40e185,_0x2e5456){var _0x3ff00a=BPromise[_0xeb62('0x82')](jwt[_0xeb62('0x87')],{'context':jwt});var _0x1679a7=_0x2e5456||config[_0xeb62('0xc')][_0xeb62('0x85')];return new BPromise(function(_0x2e1fb8,_0x2b788e){_0x3ff00a(_0x4aba1f,_0x1679a7,_0x40e185)[_0xeb62('0x41')](function(_0x510275){_0x2e1fb8(_0x510275);})[_0xeb62('0x47')](function(_0x33419f){_0x2b788e(_0x33419f);});});}function generateNonce(){return crypto[_0xeb62('0x88')](0x10)[_0xeb62('0x89')](_0xeb62('0x8a'));}function generateIssuedAt(){return Math[_0xeb62('0x8b')](Date[_0xeb62('0x8c')]()/0x3e8)[_0xeb62('0x89')]();}function createJwt(_0x1183f4){var _0x8c5182={'payload':{'iat':_0x1183f4['apiKeyIat'],'nonce':_0x1183f4[_0xeb62('0x59')]},'options':{'algorithm':_0xeb62('0x8d'),'subject':_0x1183f4['id'][_0xeb62('0x89')](),'issuer':hardwareConf[_0xeb62('0x54')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x8c5182)[_0xeb62('0x41')](function(_0x317f35){return{'iat':_0x1183f4[_0xeb62('0x70')],'nonce':_0x1183f4[_0xeb62('0x59')],'token':_0x317f35};});} \ No newline at end of file +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 diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 0925238..1e65df1 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 _0xa387=['getFilteredContacts','rows','catch','describe','keys','filter','startsWith','map','CmCustomField','findOne','slice','all','length','cf_','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','parseAdvancedSearchFilter','search','parseQueryParameters','where','fields','user','skip','checkListsRestrictions','then','ids','countFilteredContacts','count','User','buildContactsQuery'];(function(_0x4bd710,_0x237f88){var _0x30f143=function(_0x5ac459){while(--_0x5ac459){_0x4bd710['push'](_0x4bd710['shift']());}};_0x30f143(++_0x237f88);}(_0xa387,0x12f));var _0x7a38=function(_0x2a6fc6,_0x31f3ac){_0x2a6fc6=_0x2a6fc6-0x0;var _0x5758a6=_0xa387[_0x2a6fc6];return _0x5758a6;};'use strict';var _=require(_0x7a38('0x0'));var sqlUtils=require(_0x7a38('0x1'));var db=require(_0x7a38('0x2'))['db'];exports[_0x7a38('0x3')]=function(_0x45878e,_0x374a28,_0x1132c5,_0x31c4bb){var _0x379644={'count':0x0,'rows':[]};var _0xacefcd=sqlUtils[_0x7a38('0x4')](_0x374a28,_0x45878e);if(_0xacefcd){return Promise[_0x7a38('0x5')](_0x379644);}var _0xbc9bba=sqlUtils[_0x7a38('0x6')]();var _0x5d8a4f={};var _0x4c1899=![];var _0x124f62=![];return Promise['resolve']()['then'](function(){if(_0x45878e['search']){return sqlUtils[_0x7a38('0x7')](_0x45878e[_0x7a38('0x8')],_0x31c4bb);}else{return sqlUtils[_0x7a38('0x9')](_0x45878e,_0x31c4bb);}})['then'](function(_0x16fc3d){_0xbc9bba[_0x7a38('0xa')](_0x16fc3d['default']);_0xbc9bba[_0x7a38('0xa')](_0x16fc3d[_0x7a38('0xb')]);_0xbc9bba[_0x7a38('0xa')](_0x16fc3d['filter']);_0xbc9bba[_0x7a38('0xa')](_0x16fc3d['user']['clause']);_0x5d8a4f=_0x16fc3d['tags'];_0x124f62=_0x16fc3d[_0x7a38('0xc')][_0x7a38('0xd')];return sqlUtils[_0x7a38('0xe')](_0x374a28,_0x45878e,_0x124f62);})[_0x7a38('0xf')](function(_0x27a97c){_0xbc9bba[_0x7a38('0xa')](_0x27a97c);var _0x2647eb=_0x45878e[_0x7a38('0x8')]?_0x5d8a4f[_0x7a38('0x10')]:_0x45878e['tag'];_0x4c1899=_0x2647eb?!![]:![];return sqlUtils[_0x7a38('0x11')](_0xbc9bba,_0x2647eb);})[_0x7a38('0xf')](function(_0xb6f161){_0x379644[_0x7a38('0x12')]=_0xb6f161;if(_0x379644[_0x7a38('0x12')]===0x0){return;}if(_0x45878e[_0x7a38('0x13')]){_0x124f62=!![];}return sqlUtils[_0x7a38('0x14')](_0xbc9bba,_0x45878e[_0x7a38('0xb')],_0x1132c5,_0x4c1899,_0x5d8a4f['clause'],_0x124f62);})['then'](function(_0x454c1d){if(!_0x454c1d){return[];}return sqlUtils[_0x7a38('0x15')](_0x454c1d,_0x45878e,_0x1132c5);})[_0x7a38('0xf')](function(_0x596e7b){_0x379644[_0x7a38('0x16')]=_0x596e7b;return _0x379644;})[_0x7a38('0x17')](function(_0x68c9eb){throw _0x68c9eb;});};exports['describe']=function(){var _0x2e7ef0={};var _0x43c09b=[];return db['CmContact'][_0x7a38('0x18')]()[_0x7a38('0xf')](function(_0x1dbef5){_0x2e7ef0=_0x1dbef5;var _0x3ac19f=Object[_0x7a38('0x19')](_0x2e7ef0)[_0x7a38('0x1a')](function(_0x11ae85){return _[_0x7a38('0x1b')](_0x11ae85,'cf_')?_0x11ae85:undefined;});var _0x363f16=_0x3ac19f[_0x7a38('0x1c')](function(_0x511ded){return db[_0x7a38('0x1d')][_0x7a38('0x1e')]({'where':{'id':_0x511ded[_0x7a38('0x1f')](0x3)},'raw':!![]});});return Promise[_0x7a38('0x20')](_0x363f16);})[_0x7a38('0xf')](function(_0x269c47){for(var _0x474cf2=0x0;_0x474cf2<_0x269c47[_0x7a38('0x21')];_0x474cf2++){if(_0x269c47[_0x474cf2]){var _0x3e1802=_0x7a38('0x22')+_0x269c47[_0x474cf2]['id'];_0x2e7ef0[_0x3e1802]['fieldType']=_0x269c47[_0x474cf2][_0x7a38('0x23')];}}_0x43c09b=_['map'](Object[_0x7a38('0x19')](_0x2e7ef0),function(_0x2fc824){return{'name':_0x2fc824,'type':_0x2e7ef0[_0x2fc824]['type']};});return _0x43c09b;})[_0x7a38('0x17')](function(_0x24010f){throw _0x24010f;});}; \ No newline at end of file +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 diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 793d5b2..c9e584f 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 _0x1e8b=['User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','fields','then','filter','search','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','subqry.','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','sequelize','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','ListId','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','updatedAt','deletedAt','TagIds','includes','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)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','buildExpression','value','start','end','Tag','map','tags','clause','ids','and','uc.UserId\x20=\x20?','user','skip','keys','some','compact','Contact','push'];(function(_0x5e8602,_0x2ce012){var _0x4434fb=function(_0x5ea1cb){while(--_0x5ea1cb){_0x5e8602['push'](_0x5e8602['shift']());}};_0x4434fb(++_0x2ce012);}(_0x1e8b,0x1bd));var _0xb1e8=function(_0x267ec8,_0x12ad4f){_0x267ec8=_0x267ec8-0x0;var _0x1473b4=_0x1e8b[_0x267ec8];return _0x1473b4;};'use strict';var _=require(_0xb1e8('0x0'));var squel=require(_0xb1e8('0x1'));var as=require(_0xb1e8('0x2'));var qs=require(_0xb1e8('0x3'));var utils=require(_0xb1e8('0x4'));var db=require(_0xb1e8('0x5'))['db'];function skipContactsQuery(_0x3c735d,_0x4039c8){var _0x5ac0ef=![];if(_0x3c735d['role']==='agent'&&!_0x4039c8['search']&&!_0x4039c8[_0xb1e8('0x6')]&&_0x4039c8['autocomplete']!=='true'){_0x5ac0ef=!![];}return _0x5ac0ef;}function getContactsSubquery(){return squel[_0xb1e8('0x7')]()[_0xb1e8('0x8')](_0xb1e8('0x9'),'c')[_0xb1e8('0xa')](_0xb1e8('0xb'));}function applyJoinClauses(_0x5ee7b8,_0x9a5098){var _0x472cac=_0x9a5098?'c':_0xb1e8('0xc');_0x5ee7b8[_0xb1e8('0xd')](_0xb1e8('0xe'),'uc',_0xb1e8('0xf')+_0x472cac+_0xb1e8('0x10'))['left_join']('cm_contact_has_tags','ct',_0xb1e8('0x11')+_0x472cac+_0xb1e8('0x10'))['left_join'](_0xb1e8('0x12'),'t',_0xb1e8('0x13'));return _0x5ee7b8;}function addFieldsToQuery(_0x3e3994,_0x3836da,_0x1d159a,_0x52395e,_0x5eeff5){var _0x383765=_0x5eeff5?'c':_0xb1e8('0xc');if(!_0x3836da){_0x3836da=['id',_0xb1e8('0x14'),_0xb1e8('0x15'),_0xb1e8('0x16'),_0xb1e8('0x17'),'fax','email',_0xb1e8('0x6'),'CompanyId','createdAt',_0xb1e8('0x18'),_0xb1e8('0x19'),_0xb1e8('0x1a')];}else if(!_0x3836da[_0xb1e8('0x1b')]('id')){_0x3836da['push']('id');}var _0x366a4b=_0x1d159a&&_0x5eeff5||!_0x1d159a&&!_0x5eeff5;if(_0x52395e){_0x366a4b=_0x52395e&&_0x5eeff5||!_0x52395e&&!_0x5eeff5;}_0x3836da[_0xb1e8('0x1c')](function(_0x30ca9b){if(_0x30ca9b===_0xb1e8('0x1a')){if(_0x366a4b){_0x3e3994[_0xb1e8('0x1d')](_0xb1e8('0x1e'),_0x30ca9b);}else if(_0x1d159a||_0x52395e){_0x3e3994[_0xb1e8('0x1d')](_0x383765+'.'+_0x30ca9b);}}else{_0x3e3994[_0xb1e8('0x1d')](_0x383765+'.'+_0x30ca9b);}});return _0x3e3994;}function getSqlClauses(){var _0x1726e6={'default':squel[_0xb1e8('0x1f')](),'fields':squel[_0xb1e8('0x1f')](),'filter':squel[_0xb1e8('0x1f')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xb1e8('0x1f')](),'skip':![]}};return _0x1726e6;}function parseTagParameter(_0x39d179){var _0x4e0674=squel[_0xb1e8('0x1f')]();if(_0x39d179){var _0x4c202b=utils[_0xb1e8('0x20')](_0x39d179);_0x4c202b[_0xb1e8('0x1c')](function(_0x43d6af){_0x4e0674['or'](_0xb1e8('0x21'),'%,'+_0x43d6af+',%');});}return _0x4e0674;}function parseSearchFilter(_0x56e451){var _0x30890d=squel[_0xb1e8('0x1f')]();if(_0x56e451){var _0x53f116=_0x56e451['replace']('\x5c','\x5c\x5c')[_0xb1e8('0x22')](/'/g,'\x27\x27');if(_0x53f116[_0xb1e8('0x23')]('\x20')[_0xb1e8('0x24')]>0x1){_0x30890d['or'](_0xb1e8('0x25'),qs[_0xb1e8('0x26')](_0x53f116,!![]),null);}else{if(qs[_0xb1e8('0x27')](_0x53f116)){_0x30890d['or'](_0xb1e8('0x28'),_0x53f116+'%');_0x30890d['or'](_0xb1e8('0x29'),_0x53f116+'%');_0x30890d['or']('c.mobile\x20LIKE\x20?',_0x53f116+'%');_0x30890d['or']('c.fax\x20LIKE\x20?',_0x53f116+'%');}else if(qs[_0xb1e8('0x2a')](_0x53f116)){_0x30890d['or'](_0xb1e8('0x2b'),_0x53f116+'%');}else{_0x30890d['or']('c.firstName\x20LIKE\x20?','%'+_0x53f116+'%');_0x30890d['or'](_0xb1e8('0x2c'),'%'+_0x53f116+'%');_0x30890d['or'](_0xb1e8('0x2b'),'%'+_0x53f116+'%');}}}return _0x30890d;}function parseAdvancedSearchFilter(_0x3cf378,_0xd09880){var _0x4164a8=getSqlClauses();var _0x2a2691=as['parseSearch'](_0x3cf378);var _0x4e7066=_0x2a2691[_0xb1e8('0x2d')];for(var _0x3cd0df=0x0;_0x3cd0df<_0x2a2691[_0xb1e8('0x2e')][_0xb1e8('0x24')];_0x3cd0df++){var _0x3f2e7f=_0x2a2691[_0xb1e8('0x2e')][_0x3cd0df];var _0x4a968a='c';var _0x38d052=_[_0xb1e8('0x2f')](_0xd09880,[_0xb1e8('0x30'),_0x3f2e7f[_0xb1e8('0x1d')]]);if(_0x38d052){if(_0x3f2e7f['field']===_0xb1e8('0x31')||_0x38d052['fieldType']===_0xb1e8('0x32')){_0x3f2e7f[_0xb1e8('0x33')]='DATE';}var _0x48152e=as[_0xb1e8('0x34')](_0x4a968a,_0x38d052['type'],_0x3f2e7f);_0x4164a8['default'][_0x4e7066](_0x48152e['text'],_0x48152e[_0xb1e8('0x35')][_0xb1e8('0x36')],_0x48152e[_0xb1e8('0x35')][_0xb1e8('0x37')]);}else{if(_0x3f2e7f['field']===_0xb1e8('0x38')){var _0x11de9b=_0x3f2e7f[_0xb1e8('0x35')][_0xb1e8('0x23')](',')[_0xb1e8('0x39')](function(_0x6a7602){return Number(_0x6a7602);});var _0x117775=parseTagParameter(_0x11de9b);_0x4164a8[_0xb1e8('0x3a')][_0xb1e8('0x3b')]['and'](_0x117775);_0x4164a8[_0xb1e8('0x3a')][_0xb1e8('0x3c')]=_0x11de9b;}else if(_0x3f2e7f['field']==='User'){_0x4164a8['user'][_0xb1e8('0x3b')][_0xb1e8('0x3d')](_0xb1e8('0x3e'),_0x3f2e7f[_0xb1e8('0x35')]);_0x4164a8[_0xb1e8('0x3f')][_0xb1e8('0x40')]=!![];}}}return _0x4164a8;}function parseModelFields(_0x3294fe,_0x5443ce){var _0x1ccd46=squel['expr']();var _0x280c55=_(_0x3294fe)[_0xb1e8('0x41')]()[_0xb1e8('0x39')](function(_0x36a7a5){return _[_0xb1e8('0x42')](_0x5443ce,['name',_0x36a7a5])?_0x36a7a5:undefined;})[_0xb1e8('0x43')]()[_0xb1e8('0x35')]();if(_0x3294fe[_0xb1e8('0x44')]){_0x280c55[_0xb1e8('0x45')](_0xb1e8('0x44'));}if(_0x3294fe[_0xb1e8('0x46')]){_0x280c55['push'](_0xb1e8('0x46'));}if(_0x280c55[_0xb1e8('0x24')]>0x0){_0x280c55[_0xb1e8('0x1c')](function(_0x2f6920){if(_0x2f6920===_0xb1e8('0x6')){_0x1ccd46[_0xb1e8('0x3d')](_0xb1e8('0x47'),[][_0xb1e8('0x48')](_0x3294fe[_0x2f6920]));}else if(_0x2f6920===_0xb1e8('0x44')){var _0x4d0d9f='%'+_0x3294fe[_0x2f6920]+'%';_0x1ccd46['and'](_0xb1e8('0x49'),_0x4d0d9f);}else if(_0x2f6920===_0xb1e8('0x46')){_0x1ccd46[_0xb1e8('0x3d')]('uc.UserId\x20=\x20?',_0x3294fe[_0x2f6920]);}else{_0x1ccd46[_0xb1e8('0x3d')]('c.'+_0x2f6920+_0xb1e8('0x4a'),_0x3294fe[_0x2f6920]);}});}return _0x1ccd46;}function parseQueryParameters(_0x5c1297,_0x3b72e2){var _0x176cec=getSqlClauses();return Promise[_0xb1e8('0x4b')]()['then'](function(){return parseModelFields(_0x5c1297,_0x3b72e2);})['then'](function(_0x44ea04){_0x176cec[_0xb1e8('0x4c')][_0xb1e8('0x3d')](_0x44ea04);return parseTagParameter(_0x5c1297['tag']);})[_0xb1e8('0x4d')](function(_0x785c6d){_0x176cec[_0xb1e8('0x3a')][_0xb1e8('0x3b')]['and'](_0x785c6d);return parseSearchFilter(_0x5c1297[_0xb1e8('0x4e')]);})[_0xb1e8('0x4d')](function(_0x38d9d7){_0x176cec['filter']=_0x38d9d7;return _0x176cec;});}function checkListsRestrictions(_0x1a4a28,_0xde0fec,_0x1bcde1){var _0x2c271a=squel[_0xb1e8('0x1f')]();return Promise[_0xb1e8('0x4b')]()['then'](function(){if(_0xde0fec[_0xb1e8('0x4f')]&&_0x1a4a28['role']==='agent'&&!_0x1bcde1){return _0x1a4a28['getLists']({'attributes':['id'],'raw':!![]});}})[_0xb1e8('0x4d')](function(_0x50bb2b){if(_0x50bb2b){if(_0x50bb2b[_0xb1e8('0x24')]===0x0){_0x2c271a[_0xb1e8('0x3d')](_0xb1e8('0x50'));}else{_0x2c271a['and'](_0xb1e8('0x47'),_[_0xb1e8('0x39')](_0x50bb2b,'id'));}}})[_0xb1e8('0x4d')](function(){return _0x2c271a;});}function buildContactsQuery(_0x266988,_0xf63ef,_0x1675e3,_0x5621e1,_0x526a53,_0x4b911f){if(_0xf63ef){_0xf63ef=_0x1675e3[_0xb1e8('0x51')];}_0x266988=addFieldsToQuery(_0x266988,_0xf63ef,_0x5621e1,_0x4b911f,!![]);var _0x3dcd72=squel['select']();_0x3dcd72=addFieldsToQuery(_0x3dcd72,_0xf63ef,_0x5621e1,_0x4b911f,![]);if(_0x5621e1||_0x4b911f){_0x266988=applyJoinClauses(_0x266988,!![]);_0x266988[_0xb1e8('0x52')]('c.id');if(_0x1675e3['limit']){_0x3dcd72[_0xb1e8('0x53')](_0x1675e3[_0xb1e8('0x53')]);}if(_0x1675e3[_0xb1e8('0x54')]){_0x3dcd72[_0xb1e8('0x54')](_0x1675e3[_0xb1e8('0x54')]);}}else{_0x3dcd72=applyJoinClauses(_0x3dcd72,![]);_0x3dcd72[_0xb1e8('0x52')](_0xb1e8('0x55'));if(_0x1675e3[_0xb1e8('0x53')]){_0x266988[_0xb1e8('0x53')](_0x1675e3[_0xb1e8('0x53')]);}if(_0x1675e3[_0xb1e8('0x54')]){_0x266988['offset'](_0x1675e3[_0xb1e8('0x54')]);}}_0x3dcd72[_0xb1e8('0x56')](_0x526a53);if(_0x1675e3[_0xb1e8('0x57')]){_0x1675e3[_0xb1e8('0x57')][_0xb1e8('0x1c')](function(_0x831ab4){_0x266988[_0xb1e8('0x57')]('c.'+_0x831ab4[0x0],_0x831ab4[0x1]==='DESC'?![]:!![]);_0x3dcd72['order'](_0xb1e8('0x58')+_0x831ab4[0x0],_0x831ab4[0x1]===_0xb1e8('0x59')?![]:!![]);});}_0x3dcd72[_0xb1e8('0x8')](_0x266988,_0xb1e8('0xc'));return _0x3dcd72;}function getFilteredContacts(_0x56d7e3){var _0x196438=[];return db[_0xb1e8('0x38')][_0xb1e8('0x5a')]({'attributes':['id','name',_0xb1e8('0x5b')],'raw':!![]})['then'](function(_0x20ed37){_0x196438=_[_0xb1e8('0x5c')](_0x20ed37,'id');var _0x555688={'type':db[_0xb1e8('0x5d')][_0xb1e8('0x5e')][_0xb1e8('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb1e8('0x60')][_0xb1e8('0x61')](_0x56d7e3[_0xb1e8('0x62')](),_0x555688);})['then'](function(_0x1edc87){_0x1edc87[_0xb1e8('0x1c')](function(_0x382a05){if(_0x382a05[_0xb1e8('0x1a')]){_0x382a05[_0xb1e8('0x63')]=[];_0x382a05[_0xb1e8('0x1a')][_0xb1e8('0x23')](',')['forEach'](function(_0x2e6983){_0x382a05[_0xb1e8('0x63')][_0xb1e8('0x45')](_0x196438[_0x2e6983]);});}delete _0x382a05[_0xb1e8('0x1a')];});return _0x1edc87;});}function countFilteredContacts(_0x2123ab,_0x3bb247){var _0xc97163=_0x2123ab['clone']();_0xc97163[_0xb1e8('0x1d')](_0xb1e8('0x64'));_0xc97163=applyJoinClauses(_0xc97163,!![]);_0x2123ab[_0xb1e8('0x52')]('c.id');var _0x14f23a=utils[_0xb1e8('0x20')](_0x3bb247);if(!_[_0xb1e8('0x65')](_0x14f23a)){_0xc97163['where'](_0xb1e8('0x66'),_0x14f23a);}var _0x45605b={'type':db[_0xb1e8('0x5d')]['QueryTypes'][_0xb1e8('0x5f')],'raw':!![]};return db[_0xb1e8('0x60')][_0xb1e8('0x61')](_0xc97163[_0xb1e8('0x62')](),_0x45605b)[_0xb1e8('0x4d')](function(_0x1ae425){return _0x1ae425[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +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 diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f739b63..97b9660 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 _0x7b16=['binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','encryptString','secret','update','base64','decryptString','utf8','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7b16,0x177));var _0x67b1=function(_0x29fd64,_0x2446ad){_0x29fd64=_0x29fd64-0x0;var _0x2b00b7=_0x7b16[_0x29fd64];return _0x2b00b7;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x67b1('0x0'));var _=require(_0x67b1('0x1'));var config=require('../../config/environment');var logger=require(_0x67b1('0x2'))(_0x67b1('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x67b1('0x4')][_0x67b1('0x5')],'algorithm':_0x67b1('0x6')};const fileOptions={'algorithm':_0x67b1('0x7')};if(config[_0x67b1('0x8')]&&config[_0x67b1('0x8')][_0x67b1('0x9')]){var isSupported=isAlgorithmSupported(config[_0x67b1('0x8')][_0x67b1('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x67b1('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x67b1('0xa')](',\x20');logger[_0x67b1('0xb')](config['encrypt'][_0x67b1('0x9')],_0x67b1('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4142c8){return AES_SUPPORTED_RX['test'](_0x4142c8);}function getSupportedCiphers(){return crypto[_0x67b1('0xd')]()[_0x67b1('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0xecdea7){return getSupportedCiphers()[_0x67b1('0xf')](_0xecdea7)>-0x1;}function combineOptions(_0x3160c7){var _0x2aa7dc={};for(var _0x28cf9f in fileOptions){if(fileOptions[_0x67b1('0x10')](_0x28cf9f)){_0x2aa7dc[_0x28cf9f]=fileOptions[_0x28cf9f];}}if(_0x3160c7){for(var _0x40a61a in _0x3160c7){if(_0x3160c7[_0x67b1('0x10')](_0x40a61a)){_0x2aa7dc[_0x40a61a]=_0x3160c7[_0x40a61a];}}}return _0x2aa7dc;}exports[_0x67b1('0x11')]=function(_0x1fa6fb,_0x45a664,_0x1d9a58,_0x368bb0){return new BPromise(function(_0x3508e1,_0x5658e0){_0x368bb0=combineOptions(_0x368bb0);var _0x1923a6=new Buffer(_0x1d9a58);var _0x43c089=fs['createReadStream'](_0x1fa6fb);var _0x80d197=fs[_0x67b1('0x12')](_0x45a664);var _0x1e6e47=crypto[_0x67b1('0x13')](_0x368bb0[_0x67b1('0x9')],_0x1923a6);_0x43c089['on'](_0x67b1('0x14'),function(_0x2a5643){var _0x3824de=new Buffer(_0x1e6e47['update'](_0x2a5643),_0x67b1('0x15'));_0x80d197['write'](_0x3824de);});_0x43c089['on'](_0x67b1('0x16'),function(){try{var _0x43d365=new Buffer(_0x1e6e47[_0x67b1('0x17')](_0x67b1('0x15')),_0x67b1('0x15'));_0x80d197[_0x67b1('0x18')](_0x43d365);_0x80d197[_0x67b1('0x16')]();_0x80d197['on'](_0x67b1('0x19'),function(){return _0x3508e1(_0x45a664);});}catch(_0x2d4e86){fs[_0x67b1('0x1a')](_0x45a664);return _0x5658e0(_0x2d4e86);}});});};exports[_0x67b1('0x1b')]=function(_0x768b37,_0x3a001d,_0x4b157c,_0x6323a5){return new BPromise(function(_0x22811c,_0x22a643){_0x6323a5=combineOptions(_0x6323a5);var _0x22288d=new Buffer(_0x4b157c);var _0x4447a0=fs[_0x67b1('0x1c')](_0x768b37);var _0x1bc539=fs['createWriteStream'](_0x3a001d);var _0x323c7c=crypto[_0x67b1('0x1d')](_0x6323a5[_0x67b1('0x9')],_0x22288d);_0x4447a0['on'](_0x67b1('0x14'),function(_0x59d37d){var _0x5716df=new Buffer(_0x323c7c['update'](_0x59d37d),_0x67b1('0x15'));_0x1bc539[_0x67b1('0x18')](_0x5716df);});_0x4447a0['on'](_0x67b1('0x16'),function(){try{var _0x261ae4=new Buffer(_0x323c7c['final'](_0x67b1('0x15')),_0x67b1('0x15'));_0x1bc539[_0x67b1('0x18')](_0x261ae4);_0x1bc539['end']();_0x1bc539['on'](_0x67b1('0x19'),function(){return _0x22811c(_0x3a001d);});}catch(_0x3321aa){fs[_0x67b1('0x1a')](_0x3a001d);return _0x22a643(_0x3321aa);}});});};exports[_0x67b1('0x1e')]=function(_0x27dc7f,_0x30c98f,_0x5b49f2){var _0x5cc0a0=_0x5b49f2||stringOptions[_0x67b1('0x9')];var _0xe43fa=_0x30c98f||stringOptions[_0x67b1('0x1f')];var _0x42bbb1=crypto[_0x67b1('0x13')](_0x5cc0a0,_0xe43fa);var _0x4a71a8=_0x42bbb1[_0x67b1('0x20')](_0x27dc7f,'utf8',_0x67b1('0x21'));_0x4a71a8+=_0x42bbb1[_0x67b1('0x17')](_0x67b1('0x21'));return _0x4a71a8;};exports[_0x67b1('0x22')]=function(_0x1dfefa,_0x4333eb,_0x29ee31){var _0x1880f8=_0x29ee31||stringOptions['algorithm'];var _0xf4e0c8=_0x4333eb||stringOptions[_0x67b1('0x1f')];var _0x238647=crypto[_0x67b1('0x1d')](_0x1880f8,_0xf4e0c8);var _0x2ceb4d=_0x238647[_0x67b1('0x20')](_0x1dfefa,_0x67b1('0x21'),_0x67b1('0x23'));_0x2ceb4d+=_0x238647[_0x67b1('0x17')](_0x67b1('0x23'));return _0x2ceb4d;}; \ No newline at end of file +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 diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6752675..4ff6468 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 _0xa16a=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','mkdirSync','join','each','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','inspect','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0xa16a,0x1c1));var _0xaa16=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0xa16a[_0x2ff739];return _0x12dc13;};'use strict';var util=require(_0xaa16('0x0'));var path=require(_0xaa16('0x1'));var _=require('lodash');var csv=require(_0xaa16('0x2'));var fs=require('fs');var BPromise=require(_0xaa16('0x3'));var zipdir=require(_0xaa16('0x4'));var rimraf=require(_0xaa16('0x5'));var db=require(_0xaa16('0x6'))['db'];var dbH=require(_0xaa16('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xaa16('0x7')][0x2]);var QUERY=process[_0xaa16('0x7')][0x3];var PATH=process[_0xaa16('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x514fce,_0x3432cc){var _0x3f55b7={'status':_0x514fce};var _0x44acf0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3432cc){_0x3f55b7['savename']=_0x3432cc;}return db[_0xaa16('0x8')]['update'](_0x3f55b7,_0x44acf0);}function main(){var _0x4d6b27=0x1388;var _0x39ebcc;logger[_0xaa16('0x9')](util[_0xaa16('0xa')](_0xaa16('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xaa16('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaa16('0xd'),_0xaa16('0xe')]})['then'](function(_0x2f5dcd){if(_0x2f5dcd){_0x39ebcc=_0x2f5dcd;_0x4d6b27=_0x39ebcc[_0xaa16('0xe')]||0x1388;}})[_0xaa16('0xf')](function(){return dbH[_0xaa16('0x10')][_0xaa16('0x11')](util['format'](_0xaa16('0x12'),QUERY),{'type':dbH[_0xaa16('0x10')][_0xaa16('0x13')][_0xaa16('0x14')]});})[_0xaa16('0xf')](function(_0x138f07){if(!_0x138f07[0x0]['num']){return analyticExtractedReport(_0xaa16('0x15'));}var _0x5ae9d2=[];var _0x39ab45=0x0;if(_0x39ebcc[_0xaa16('0xd')]){if(_0x138f07&&_0x138f07[_0xaa16('0x16')]){var _0x3c9836=_['range'](_0x138f07[0x0][_0xaa16('0x17')]/_0x4d6b27);var _0x3290a0=Number['isInteger'](_0x138f07[0x0][_0xaa16('0x17')]/_0x4d6b27)?_0x138f07[0x0]['num']%_0x4d6b27:0x0;_0x3c9836[_0xaa16('0x18')](function(_0x44d2d6){if(_0x44d2d6>0x0){_0x39ab45+=_0x4d6b27;}_0x5ae9d2[_0xaa16('0x19')](dbH[_0xaa16('0x10')]['query'](util['format'](_0xaa16('0x1a'),QUERY,_0x4d6b27,_0x39ab45),{'type':dbH[_0xaa16('0x10')][_0xaa16('0x13')][_0xaa16('0x14')]}));});if(_0x3290a0>0x0){_0x39ab45+=_0x4d6b27;_0x5ae9d2[_0xaa16('0x19')](dbH['sequelize'][_0xaa16('0x11')](util[_0xaa16('0xa')](_0xaa16('0x1a'),QUERY,_0x3290a0,_0x39ab45),{'type':dbH[_0xaa16('0x10')][_0xaa16('0x13')]['SELECT']}));}}}else{_0x5ae9d2[_0xaa16('0x19')](dbH[_0xaa16('0x10')][_0xaa16('0x11')](QUERY,{'type':dbH[_0xaa16('0x10')]['QueryTypes'][_0xaa16('0x14')]}));}var _0x40871e=path['dirname'](PATH);var _0x30c8ab=path[_0xaa16('0x1b')](PATH,'.csv');var _0x511076=_0x39ebcc['split']&&_0x5ae9d2['length']>0x1;var _0x337e2e=[];if(!fs[_0xaa16('0x1c')](path['join'](_0x40871e,_0x30c8ab))&&_0x511076){fs[_0xaa16('0x1d')](path[_0xaa16('0x1e')](_0x40871e,_0x30c8ab));}return BPromise[_0xaa16('0x1f')](_0x5ae9d2,function(_0x18043f){_0x337e2e[_0xaa16('0x19')](_0x18043f);})[_0xaa16('0xf')](function(){for(var _0x46a50b=0x0;_0x46a50b<_0x337e2e['length'];_0x46a50b+=0x1){var _0x47bcef;var _0x20051c=_0x337e2e[_0x46a50b];if(_0x511076){_0x47bcef=path['join'](_0x40871e,_0x30c8ab,util[_0xaa16('0xa')]('%s%d.%s',_0x30c8ab,_0x46a50b,_0xaa16('0x20')));}else{_0x47bcef=path[_0xaa16('0x1e')](_0x40871e,util['format'](_0xaa16('0x21'),_0x30c8ab,_0xaa16('0x20')));}fs['writeFileSync'](_0x47bcef,csv(_0x20051c));}})[_0xaa16('0xf')](function(){if(_0x511076){return new Promise(function(_0x1bd20f){zipdir(path[_0xaa16('0x1e')](_0x40871e,_0x30c8ab),{'saveTo':path[_0xaa16('0x1e')](_0x40871e,util[_0xaa16('0xa')](_0xaa16('0x21'),_0x30c8ab,_0xaa16('0x22')))},function(_0x13ad12,_0x4fec6d){rimraf(path['join'](_0x40871e,_0x30c8ab),function(){});_0x1bd20f('zip\x20finished');});});}})[_0xaa16('0xf')](function(){logger[_0xaa16('0x9')](util['format'](_0xaa16('0x23'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xaa16('0x24'),_0x511076?util[_0xaa16('0xa')](_0xaa16('0x21'),_0x30c8ab,_0x511076?_0xaa16('0x22'):_0xaa16('0x20')):null);});})[_0xaa16('0x25')](function(_0xa0d7c9){logger['info'](util[_0xaa16('0xa')](_0xaa16('0x26'),EXTRACTED_REPORT_ID,_0xaa16('0x27')),util[_0xaa16('0x28')](_0xa0d7c9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xaa16('0x29')](function(){process[_0xaa16('0x2a')](EXIT_CODE);});}main(); \ No newline at end of file +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 diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 49699f1..7dcbb58 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 _0xb977=['createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','toString','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','path','catch','lodash','moment','html-to-pdfmake','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','auto','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','basename','.pdf','existsSync','join','each'];(function(_0x545efb,_0x5486cc){var _0x3e7880=function(_0x3dd386){while(--_0x3dd386){_0x545efb['push'](_0x545efb['shift']());}};_0x3e7880(++_0x5486cc);}(_0xb977,0xdc));var _0x7b97=function(_0x207ac4,_0x54e6d9){_0x207ac4=_0x207ac4-0x0;var _0x3e337c=_0xb977[_0x207ac4];return _0x3e337c;};'use strict';var _=require(_0x7b97('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x7b97('0x1'));var htmlToPdfmake=require(_0x7b97('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x7b97('0x3'));var rimraf=require(_0x7b97('0x4'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x7b97('0x5')];var BPromise=require(_0x7b97('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7b97('0x7'))[_0x7b97('0x8')];var logger=require('../../config/logger')(_0x7b97('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x7b97('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7b97('0xa')][0x4];var NAME=process[_0x7b97('0xa')][0x5];var FORMAT=_0x7b97('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x492ef5,_0x542905){var _0x422561={'status':_0x492ef5};var _0x495409={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x542905){_0x422561[_0x7b97('0xc')]=_0x542905;}return db[_0x7b97('0xd')][_0x7b97('0xe')](_0x422561,_0x495409);}function getHeaders(_0x24f0d4){return _[_0x7b97('0xf')](_0x24f0d4,function(_0x29186c){return{'text':_0x29186c,'style':_0x7b97('0x10')};});}function getRows(_0x3e18b6,_0x42a3fd){return _['map'](_0x42a3fd,function(_0x27ab07){return _(_0x27ab07)[_0x7b97('0x11')](_0x3e18b6)[_0x7b97('0xf')](function(_0x2aca0f){return _0x2aca0f?_['toString'](_0x2aca0f):'';})[_0x7b97('0x12')]();});}function createTable(_0x29c318,_0x569d86){var _0x5e3022={'widths':_[_0x7b97('0x13')](Array(_0x29c318['length']),0x91),'heights':function(_0x307a52){return _0x307a52===0x0?_0x7b97('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f65f9=getHeaders(_0x29c318);_0x5e3022[_0x7b97('0x15')][_0x7b97('0x16')](_0x3f65f9);var _0x105c02=getRows(_0x29c318,_0x569d86);_0x5e3022[_0x7b97('0x15')]=_0x5e3022[_0x7b97('0x15')][_0x7b97('0x17')](_0x105c02);return _0x5e3022;}function createTables(_0x477609){var _0x33fbe1=[];var _0x2ea385=_[_0x7b97('0x18')](Object['keys'](_0x477609[0x0]),0x5);_0x2ea385[_0x7b97('0x19')](function(_0x2ea6f4){_0x33fbe1['push'](createTable(_0x2ea6f4,_0x477609));});return _0x33fbe1;}function getPDFDocDefinition(_0x447d3f){var _0x57d952=util['format'](_0x7b97('0x1a'),NAME,EXTRACTED_REPORT[_0x7b97('0x1b')],moment(EXTRACTED_REPORT['startDate'])[_0x7b97('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x7b97('0x1d')])[_0x7b97('0x1c')](FORMAT));var _0x1e90af=[];for(var _0x4fbb69=0x0;_0x4fbb69<_0x447d3f[_0x7b97('0x1e')];_0x4fbb69++){var _0x3ecb0b=[];if(_0x4fbb69===0x0){_0x3ecb0b[_0x7b97('0x16')]({'text':_0x57d952,'style':_0x7b97('0x1f')});}var _0x3f44d8={'table':_0x447d3f[_0x4fbb69]};if(_0x4fbb69>0x0){_0x3f44d8[_0x7b97('0x20')]=_0x7b97('0x21');_0x3f44d8[_0x7b97('0x22')]=[0x0,0x46,0x0,0x0];}_0x3ecb0b[_0x7b97('0x16')](_0x3f44d8);_0x1e90af[_0x7b97('0x16')](_0x3ecb0b);}return{'pageSize':'A4','pageOrientation':_0x7b97('0x23'),'content':_0x1e90af,'footer':function(_0x1f1fd1,_0x406732){return{'text':_0x1f1fd1['toString']()+_0x7b97('0x24')+_0x406732,'style':'footer'};},'defaultStyle':{'font':_0x7b97('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7b97('0x26')},'footer':{'alignment':_0x7b97('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3e482c){var _0x2fc8fe=0x1388;var _0xb93172;if(!_0x3e482c[0x0][_0x7b97('0x28')]){return analyticExtractedReport(_0x7b97('0x29'));}return db[_0x7b97('0x2a')][_0x7b97('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7b97('0x2c'),_0x7b97('0x2d')]})[_0x7b97('0x2e')](function(_0x13480d){if(_0x13480d){_0xb93172=_0x13480d;_0x2fc8fe=_0xb93172[_0x7b97('0x2d')]||0x3e8;}})[_0x7b97('0x2e')](function(){var _0x2e1374=[];var _0x1472b0=0x0;if(_0xb93172[_0x7b97('0x2c')]){if(_0x3e482c&&_0x3e482c[_0x7b97('0x1e')]){var _0x5b5983=_[_0x7b97('0x2f')](_0x3e482c[0x0][_0x7b97('0x28')]/_0x2fc8fe);var _0x4bd183=Number['isInteger'](_0x3e482c[0x0][_0x7b97('0x28')]/_0x2fc8fe)?_0x3e482c[0x0][_0x7b97('0x28')]%_0x2fc8fe:0x0;_0x5b5983['forEach'](function(_0x487bf1){if(_0x487bf1>0x0){_0x1472b0+=_0x2fc8fe;}_0x2e1374[_0x7b97('0x16')](dbH[_0x7b97('0x30')]['query'](util[_0x7b97('0x1c')](_0x7b97('0x31'),QUERY,_0x2fc8fe,_0x1472b0),{'type':dbH[_0x7b97('0x30')][_0x7b97('0x32')]['SELECT']}));});if(_0x4bd183>0x0){_0x1472b0+=_0x2fc8fe;_0x2e1374[_0x7b97('0x16')](dbH[_0x7b97('0x30')][_0x7b97('0x33')](util[_0x7b97('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4bd183,_0x1472b0),{'type':dbH['sequelize'][_0x7b97('0x32')][_0x7b97('0x34')]}));}}}else{_0x2e1374[_0x7b97('0x16')](dbH[_0x7b97('0x30')][_0x7b97('0x33')](QUERY,{'type':dbH[_0x7b97('0x30')][_0x7b97('0x32')][_0x7b97('0x34')]}));}var _0x9cd44b=path[_0x7b97('0x35')](PATH);var _0x39c8ca=path[_0x7b97('0x36')](PATH,_0x7b97('0x37'));var _0x251a44=_0xb93172[_0x7b97('0x2c')]&&_0x2e1374['length']>0x1;var _0x27c67b=[];if(!fs[_0x7b97('0x38')](path['join'](_0x9cd44b,_0x39c8ca))&&_0x251a44){fs['mkdirSync'](path[_0x7b97('0x39')](_0x9cd44b,_0x39c8ca));}return BPromise[_0x7b97('0x3a')](_0x2e1374,function(_0x304445){_0x27c67b[_0x7b97('0x16')](_0x304445);})['then'](function(){var _0x1a1a93=[];for(var _0x38f4bc=0x0;_0x38f4bc<_0x27c67b[_0x7b97('0x1e')];_0x38f4bc+=0x1){var _0x541849=_0x27c67b[_0x38f4bc];var _0x18568d=createTables(_['flatten'](_0x541849));var _0x353c7e;var _0x58b20b=getPDFDocDefinition(_0x18568d);var _0x1c064b=getPDFPrinter();var _0x5c0a68=_0x1c064b[_0x7b97('0x3b')](_0x58b20b);if(_0x251a44){_0x353c7e=path[_0x7b97('0x39')](_0x9cd44b,_0x39c8ca,util[_0x7b97('0x1c')](_0x7b97('0x3c'),_0x39c8ca,_0x38f4bc,_0x7b97('0x3d')));}else{_0x353c7e=path[_0x7b97('0x39')](_0x9cd44b,util[_0x7b97('0x1c')](_0x7b97('0x3e'),_0x39c8ca,_0x7b97('0x3d')));}_0x1a1a93['push'](writePDFDocument(_0x5c0a68,_0x353c7e));}return Promise[_0x7b97('0x3f')](_0x1a1a93);})[_0x7b97('0x2e')](function(){if(_0x251a44){return new Promise(function(_0x4b65cf){zipdir(path[_0x7b97('0x39')](_0x9cd44b,_0x39c8ca),{'saveTo':path[_0x7b97('0x39')](_0x9cd44b,util[_0x7b97('0x1c')](_0x7b97('0x3e'),_0x39c8ca,_0x7b97('0x40')))},function(){rimraf(path[_0x7b97('0x39')](_0x9cd44b,_0x39c8ca),function(){});_0x4b65cf(_0x7b97('0x41'));});});}})[_0x7b97('0x2e')](function(){if(!_0x251a44)return;rimraf(path[_0x7b97('0x39')](_0x9cd44b,_0x39c8ca),function(){});})[_0x7b97('0x2e')](function(){logger[_0x7b97('0x42')](util['format'](_0x7b97('0x43'),EXTRACTED_REPORT_ID,_0x7b97('0x44')));return analyticExtractedReport(_0x7b97('0x45'),_0x251a44?util[_0x7b97('0x1c')]('%s.%s',_0x39c8ca,_0x251a44?_0x7b97('0x40'):_0x7b97('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x7b97('0x1c')](_0x7b97('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x7b97('0xd')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7b97('0x2e')](function(_0x10e9f2){EXTRACTED_REPORT=_0x10e9f2;return dbH[_0x7b97('0x30')][_0x7b97('0x33')](util[_0x7b97('0x1c')](_0x7b97('0x47'),QUERY),{'type':dbH['sequelize'][_0x7b97('0x32')]['SELECT']});})['then'](extractReport)['catch'](function(_0x2b48fd){logger['info'](util[_0x7b97('0x1c')](_0x7b97('0x48'),EXTRACTED_REPORT_ID,_0x7b97('0x44')),util[_0x7b97('0x49')](_0x2b48fd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7b97('0x4a'));})[_0x7b97('0x4b')](function(){process[_0x7b97('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x108296=new PdfPrinter({'Arial':{'normal':__dirname+_0x7b97('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x7b97('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x108296;}function getPDFDocDefinitionFromHTML(_0x3de9ef,_0x238dec){var _0x515981=util[_0x7b97('0x1c')](_0x7b97('0x4f'),_0x238dec[_0x7b97('0x50')],_0x238dec['interactionId']);var _0x52b694=moment()[_0x7b97('0x1c')](_0x7b97('0x51'))[_0x7b97('0x52')]();var _0x34e6a5=htmlToPdfmake(_0x3de9ef,{'window':window,'tableAutoSize':!![]});return{'content':[_0x34e6a5],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7b97('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7b97('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7b97('0x53')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x7b97('0x1f')}];},'footer':function(_0x116aa9,_0x48a09c){return[{'text':util[_0x7b97('0x1c')](_0x7b97('0x54'),_0x515981,_0x116aa9,_0x48a09c,_0x52b694),'style':_0x7b97('0x55')}];}};}function writePDFDocument(_0xa38875,_0x395b30){return new Promise(function(_0x2f6cdb,_0x354a3c){var _0x39be39=_0xa38875[_0x7b97('0x56')](fs[_0x7b97('0x57')](_0x395b30));_0x39be39['on'](_0x7b97('0x58'),function(){_0x2f6cdb('finish');});_0x39be39['on'](_0x7b97('0x59'),function(_0x3815cd){_0x354a3c(_0x3815cd);});_0xa38875[_0x7b97('0x5a')]();});}exports['createPdfFromHTML']=function(_0x35980d,_0x38c3a9){var _0x5bb508=getPDFPrinter();var _0x5623c5=getPDFDocDefinitionFromHTML(_0x35980d,_0x38c3a9);var _0x2539cc=_0x5bb508[_0x7b97('0x3b')](_0x5623c5);return writePDFDocument(_0x2539cc,_0x38c3a9[_0x7b97('0x5b')])[_0x7b97('0x5c')](function(_0x581b16){throw _0x581b16;});}; \ No newline at end of file +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 diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f6ea209..19e8b93 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 _0xf280=['then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','%s.%s','zip','zip\x20finished','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Setting','find','split','splitSizeXlsx'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf280,0x84));var _0x0f28=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0xf280[_0x59dccc];return _0xc97bcb;};'use strict';var util=require('util');var path=require(_0x0f28('0x0'));var _=require(_0x0f28('0x1'));var fs=require('fs');var json2xls=require(_0x0f28('0x2'));var BPromise=require(_0x0f28('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x0f28('0x4'));var db=require(_0x0f28('0x5'))['db'];var dbH=require(_0x0f28('0x5'))['dbH'];var logger=require(_0x0f28('0x6'))(_0x0f28('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0f28('0x8')][0x2]);var QUERY=process[_0x0f28('0x8')][0x3];var PATH=process[_0x0f28('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe851a8,_0x2d0d37){var _0xc312eb={'status':_0xe851a8};var _0x3c3e74={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d0d37){_0xc312eb[_0x0f28('0x9')]=_0x2d0d37;}return db[_0x0f28('0xa')][_0x0f28('0xb')](_0xc312eb,_0x3c3e74);}function main(){var _0x4325c0=0x1388;var _0x4fcc3b;logger[_0x0f28('0xc')](util[_0x0f28('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x0f28('0xe')][_0x0f28('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0f28('0x10'),_0x0f28('0x11')]})[_0x0f28('0x12')](function(_0x194bf6){if(_0x194bf6){_0x4fcc3b=_0x194bf6;_0x4325c0=_0x4fcc3b[_0x0f28('0x11')]||0x1388;}})[_0x0f28('0x12')](function(){return dbH['sequelize'][_0x0f28('0x13')](util[_0x0f28('0xd')](_0x0f28('0x14'),QUERY),{'type':dbH[_0x0f28('0x15')][_0x0f28('0x16')][_0x0f28('0x17')]});})['then'](function(_0x29d3c2){if(!_0x29d3c2[0x0][_0x0f28('0x18')]){return analyticExtractedReport(_0x0f28('0x19'));}var _0x372491=[];var _0x166de7=0x0;if(_0x4fcc3b['split']){if(_0x29d3c2&&_0x29d3c2[_0x0f28('0x1a')]){var _0x5d56ac=_[_0x0f28('0x1b')](_0x29d3c2[0x0]['num']/_0x4325c0);var _0x323115=Number['isInteger'](_0x29d3c2[0x0][_0x0f28('0x18')]/_0x4325c0)?_0x29d3c2[0x0]['num']%_0x4325c0:0x0;_0x5d56ac[_0x0f28('0x1c')](function(_0x2d7507){if(_0x2d7507>0x0){_0x166de7+=_0x4325c0;}_0x372491[_0x0f28('0x1d')](dbH[_0x0f28('0x15')][_0x0f28('0x13')](util[_0x0f28('0xd')](_0x0f28('0x1e'),QUERY,_0x4325c0,_0x166de7),{'type':dbH['sequelize'][_0x0f28('0x16')]['SELECT']}));});if(_0x323115>0x0){_0x166de7+=_0x4325c0;_0x372491[_0x0f28('0x1d')](dbH[_0x0f28('0x15')][_0x0f28('0x13')](util[_0x0f28('0xd')](_0x0f28('0x1e'),QUERY,_0x323115,_0x166de7),{'type':dbH['sequelize']['QueryTypes'][_0x0f28('0x17')]}));}}}else{_0x372491[_0x0f28('0x1d')](dbH[_0x0f28('0x15')][_0x0f28('0x13')](QUERY,{'type':dbH[_0x0f28('0x15')][_0x0f28('0x16')][_0x0f28('0x17')]}));}var _0x3bcd0f=path[_0x0f28('0x1f')](PATH);var _0x57a1e5=path[_0x0f28('0x20')](PATH,'.xlsx');var _0x49098c=_0x4fcc3b['split']&&_0x372491[_0x0f28('0x1a')]>0x1;var _0x2e1a38=[];if(!fs[_0x0f28('0x21')](path[_0x0f28('0x22')](_0x3bcd0f,_0x57a1e5))&&_0x49098c){fs[_0x0f28('0x23')](path[_0x0f28('0x22')](_0x3bcd0f,_0x57a1e5));}return BPromise['each'](_0x372491,function(_0x30fb2c){_0x2e1a38['push'](_0x30fb2c);})[_0x0f28('0x12')](function(){for(var _0x262a4d=0x0;_0x262a4d<_0x2e1a38[_0x0f28('0x1a')];_0x262a4d+=0x1){var _0x284b38;var _0x460a97=_0x2e1a38[_0x262a4d];if(_0x49098c){_0x284b38=path[_0x0f28('0x22')](_0x3bcd0f,_0x57a1e5,util[_0x0f28('0xd')](_0x0f28('0x24'),_0x57a1e5,_0x262a4d,'xlsx'));}else{_0x284b38=path[_0x0f28('0x22')](_0x3bcd0f,util[_0x0f28('0xd')]('%s.%s',_0x57a1e5,_0x0f28('0x25')));}fs[_0x0f28('0x26')](_0x284b38,json2xls(_0x460a97),'binary');}})[_0x0f28('0x12')](function(){if(_0x49098c){return new Promise(function(_0x55401e){zipdir(path[_0x0f28('0x22')](_0x3bcd0f,_0x57a1e5),{'saveTo':path[_0x0f28('0x22')](_0x3bcd0f,util[_0x0f28('0xd')](_0x0f28('0x27'),_0x57a1e5,_0x0f28('0x28')))},function(_0x3537aa,_0x379397){rimraf(path[_0x0f28('0x22')](_0x3bcd0f,_0x57a1e5),function(){});_0x55401e(_0x0f28('0x29'));});});}})[_0x0f28('0x12')](function(){logger[_0x0f28('0xc')](util[_0x0f28('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0f28('0x2a')));return analyticExtractedReport(_0x0f28('0x2b'),_0x49098c?util[_0x0f28('0xd')](_0x0f28('0x27'),_0x57a1e5,_0x49098c?_0x0f28('0x28'):'xlsx'):null);});})[_0x0f28('0x2c')](function(_0x44c247){logger[_0x0f28('0xc')](util['format'](_0x0f28('0x2d'),EXTRACTED_REPORT_ID,_0x0f28('0x2a')),util[_0x0f28('0x2e')](_0x44c247,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0f28('0x2f'));})[_0x0f28('0x30')](function(){process[_0x0f28('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +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 diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e122026..86fd879 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 _0x921e=['bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','exten','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','length','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','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','Hangup','concat','transaction'];(function(_0x30d012,_0x4c4bbf){var _0x3e8bca=function(_0x1865b0){while(--_0x1865b0){_0x30d012['push'](_0x30d012['shift']());}};_0x3e8bca(++_0x4c4bbf);}(_0x921e,0xca));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe921('0x0'));var util=require(_0xe921('0x1'));function rewrite(_0x120118,_0x3a7d88){var _0x52f4d5=this;return _0x120118[_0xe921('0x2')][_0xe921('0x3')][_0xe921('0x4')]({'raw':!![]})['then'](function(_0x374f21){_0x52f4d5[_0xe921('0x5')]=_0x374f21;return _0x120118[_0xe921('0x2')][_0xe921('0x6')][_0xe921('0x4')]({'where':{'IntervalId':_0x3a7d88[_0xe921('0x7')]},'raw':!![]});})[_0xe921('0x8')](function(_0x6f9cd0){return _0x120118['models'][_0xe921('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xe921('0x9')](_['map'](_0x6f9cd0,_0xe921('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xe921('0x8')](function(_0xefe63){var _0xf664fd=_[_0xe921('0xb')](_0xefe63,{'priority':'1'});var _0xd847ad=_['filter'](_0xefe63,{'isApp':0x1});var _0x5aba43=_[_0xe921('0xc')](_0xd847ad,_0xe921('0xa'));var _0x34d817=['queue',_0xe921('0xd')];var _0x405f38=[];var _0x1ba8df=[];for(var _0x1de9ca in _0x5aba43){if(_0x5aba43[_0xe921('0xe')](_0x1de9ca)){_0x52f4d5[_0xe921('0xf')]=0x2;_0x52f4d5[_0xe921('0x10')]=[];_0x52f4d5[_0xe921('0x11')]=_[_0xe921('0x12')](_0xf664fd,{'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')]});_0x52f4d5[_0xe921('0x10')]['push']({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':util[_0xe921('0x15')](_0xe921('0x16'),_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')]),'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});if(_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')]===_0xe921('0x19')){_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0xe921('0x1b')+_0x5aba43[_0x1de9ca][0x0]['VoiceExtensionId'],'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0]['exten'],'priority':_0x52f4d5['priority']++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});}else if(_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')]===_0xe921('0x1c')){if(_0x52f4d5[_0xe921('0x11')]){_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':'Set','appdata':_0xe921('0x1d')+(_0x52f4d5['extension'][_0xe921('0x1e')]?_0xe921('0x1f')+_0x52f4d5[_0xe921('0x11')]['cutdigits']+'}':_0xe921('0x20')),'context':_0x5aba43[_0x1de9ca][0x0]['context'],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});}_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0xe921('0x1b')+_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')],'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0]['exten'],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});var _0x428697=_0x52f4d5['priority']++;_0x52f4d5[_0xe921('0x10')]['push']({'type':_0x5aba43[_0x1de9ca][0x0]['type'],'app':'ExecIf','appdata':_0xe921('0x21')+(_0x428697+0x2)+'):Goto('+(_0x428697+0x1)+')','context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x428697,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});if(_0x52f4d5[_0xe921('0x11')]){_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0x52f4d5[_0xe921('0x11')]['cutdigits']?_0xe921('0x22')+_0x52f4d5[_0xe921('0x11')][_0xe921('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});}_0x52f4d5['extensions'][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0xe921('0x23')+_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')],'context':_0x5aba43[_0x1de9ca][0x0]['context'],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});if(_0x52f4d5[_0xe921('0x11')]&&_0x52f4d5['extension'][_0xe921('0xe')](_0xe921('0x24'))&&_0x52f4d5[_0xe921('0x11')][_0xe921('0x24')]!==_0xe921('0x25')){_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0xe921('0x26'),'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0]['VoiceExtensionId']});_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0xe921('0x27')+_0x52f4d5[_0xe921('0x11')][_0xe921('0x24')]||_0xe921('0x28'),'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0]['exten'],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});}}_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0]['type'],'app':_0xe921('0x14'),'appdata':_0xe921('0x29'),'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0]['VoiceExtensionId']});_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0]['type'],'app':_0xe921('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5['priority']++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0]['VoiceExtensionId']});_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0]['type'],'app':_0xe921('0x14'),'appdata':_0xe921('0x2a'),'context':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x17')],'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'priority':_0x52f4d5[_0xe921('0xf')]++,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});for(var _0x4671c1=0x0,_0x234337=0x0;_0x4671c1<_0x5aba43[_0x1de9ca]['length'];_0x4671c1+=0x1,_0x234337=0x0){var _0x42595a=_0x5aba43[_0x1de9ca][_0x4671c1];if(_0x42595a[_0xe921('0x13')]){_0x42595a[_0xe921('0x13')]=_0x42595a[_0xe921('0x13')][_0xe921('0x2b')]();}var _0x24a179=[];var _0x2b4124=[];delete _0x42595a['id'];delete _0x42595a['createdAt'];delete _0x42595a[_0xe921('0x2c')];var _0x499ee6=_0x42595a['interval']!==_0xe921('0x2d')?[_0x42595a[_0xe921('0x2e')]]:_0x42595a[_0xe921('0x7')]?_['map'](_[_0xe921('0xb')](_0x52f4d5[_0xe921('0x5')],{'IntervalId':_0x42595a[_0xe921('0x7')]}),_0xe921('0x2e')):[];if(_0x42595a[_0xe921('0xe')](_0xe921('0x2f'))){if(_0x42595a[_0xe921('0x2f')]&&_0x42595a[_0xe921('0x2f')]!=='--'){_0x24a179[_0xe921('0x1a')]({'type':_0x42595a[_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':_0xe921('0x30')+_0x42595a[_0xe921('0x2f')],'context':_0x42595a[_0xe921('0x17')],'exten':_0x42595a['exten'],'priority':_0x499ee6[_0xe921('0x31')]+_0x52f4d5[_0xe921('0xf')]+_0x234337++,'VoiceExtensionId':_0x42595a['VoiceExtensionId']});}}if(_0x42595a[_0xe921('0x13')]===_0xe921('0x1c')&&_0x42595a[_0xe921('0xe')](_0xe921('0x32'))){if(_0x42595a[_0xe921('0x32')]){_0x24a179['push']({'type':_0x42595a[_0xe921('0x13')],'app':_0xe921('0x33'),'appdata':_0xe921('0x34')+_0x42595a[_0xe921('0x32')]+')','context':_0x42595a[_0xe921('0x17')],'exten':_0x42595a[_0xe921('0xa')],'priority':_0x499ee6[_0xe921('0x31')]+_0x52f4d5[_0xe921('0xf')]+_0x234337++,'VoiceExtensionId':_0x42595a[_0xe921('0x18')]});}else{_0x24a179[_0xe921('0x1a')]({'type':_0x42595a[_0xe921('0x13')],'app':_0xe921('0x33'),'appdata':_0xe921('0x35'),'context':_0x42595a[_0xe921('0x17')],'exten':_0x42595a[_0xe921('0xa')],'priority':_0x499ee6[_0xe921('0x31')]+_0x52f4d5[_0xe921('0xf')]+_0x234337++,'VoiceExtensionId':_0x42595a['VoiceExtensionId']});}}if(_0x42595a[_0xe921('0xe')](_0xe921('0x36'))){if(_0x34d817['indexOf'](_0x42595a['app']['toLowerCase']())>=0x0&&_0x42595a[_0xe921('0x37')]!==_0xe921('0x38')){if(_0x42595a[_0xe921('0x36')]){_0x24a179[_0xe921('0x1a')]({'type':_0x42595a['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x42595a['context'],'exten':_0x42595a['exten'],'priority':_0x499ee6['length']+_0x52f4d5[_0xe921('0xf')]+_0x234337++,'VoiceExtensionId':_0x42595a[_0xe921('0x18')]});_0x24a179[_0xe921('0x1a')]({'type':_0x42595a[_0xe921('0x13')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x42595a[_0xe921('0x17')],'exten':_0x42595a[_0xe921('0xa')],'priority':_0x499ee6[_0xe921('0x31')]+_0x52f4d5['priority']+_0x234337++,'VoiceExtensionId':_0x42595a[_0xe921('0x18')]});}else{_0x24a179[_0xe921('0x1a')]({'type':_0x42595a[_0xe921('0x13')],'app':_0xe921('0x33'),'appdata':_0xe921('0x39'),'context':_0x42595a[_0xe921('0x17')],'exten':_0x42595a['exten'],'priority':_0x499ee6[_0xe921('0x31')]+_0x52f4d5[_0xe921('0xf')]+_0x234337++,'VoiceExtensionId':_0x42595a['VoiceExtensionId']});_0x24a179[_0xe921('0x1a')]({'type':_0x42595a[_0xe921('0x13')],'app':_0xe921('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x42595a[_0xe921('0x17')],'exten':_0x42595a[_0xe921('0xa')],'priority':_0x499ee6[_0xe921('0x31')]+_0x52f4d5[_0xe921('0xf')]+_0x234337++,'VoiceExtensionId':_0x42595a[_0xe921('0x18')]});}}}for(var _0xbde6b7=0x0;_0xbde6b7<_0x499ee6[_0xe921('0x31')];_0xbde6b7+=0x1){var _0x200219=_0x52f4d5[_0xe921('0xf')]+_0x499ee6[_0xe921('0x31')];var _0x508a20=_0xbde6b7===_0x499ee6[_0xe921('0x31')]-0x1?_0x52f4d5[_0xe921('0xf')]+_0x24a179[_0xe921('0x31')]+_0x2b4124['length']+0x2:_0x52f4d5[_0xe921('0xf')]+_0xbde6b7+0x1;_0x24a179['splice'](_0xbde6b7,0x0,{'type':_0x42595a['type'],'app':'GotoIfTime','appdata':_0x499ee6[_0xbde6b7]+'?'+_0x42595a[_0xe921('0x17')]+_0xe921('0x3a')+_0x200219+':'+_0x42595a[_0xe921('0x17')]+_0xe921('0x3a')+_0x508a20,'exten':_0x42595a[_0xe921('0xa')],'context':_0x42595a[_0xe921('0x17')],'priority':_0x52f4d5[_0xe921('0xf')]+_0xbde6b7,'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});}_0x42595a['priority']=_0x24a179['length']?_['last'](_0x24a179)[_0xe921('0xf')]+0x1:_0x52f4d5[_0xe921('0xf')];_0x52f4d5[_0xe921('0xf')]=(_0x2b4124['length']?_['last'](_0x2b4124)[_0xe921('0xf')]:_0x42595a[_0xe921('0xf')])+0x1;_0x52f4d5['extensions']=_['concat'](_0x52f4d5[_0xe921('0x10')],_0x24a179,[_0x42595a],_0x2b4124);}_0x52f4d5[_0xe921('0x10')][_0xe921('0x1a')]({'type':_0x5aba43[_0x1de9ca][0x0]['type'],'app':_0xe921('0x3b'),'exten':_0x5aba43[_0x1de9ca][0x0][_0xe921('0xa')],'context':_0x5aba43[_0x1de9ca][0x0]['context'],'priority':_0x52f4d5[_0xe921('0xf')],'VoiceExtensionId':_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]});_0x405f38['push'](_0x5aba43[_0x1de9ca][0x0][_0xe921('0x18')]);_0x1ba8df=_[_0xe921('0x3c')](_0x1ba8df,_0x52f4d5[_0xe921('0x10')]);}}return _0x120118[_0xe921('0x3d')](function(_0x7af8ed){return _0x120118[_0xe921('0x2')][_0xe921('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x405f38}},'transaction':_0x7af8ed})[_0xe921('0x8')](function(_0xf8152e){return _0x120118[_0xe921('0x2')][_0xe921('0x6')][_0xe921('0x3e')](_[_0xe921('0x3f')](_0x1ba8df,_0xe921('0xf')),{'transaction':_0x7af8ed});});});})[_0xe921('0x40')](function(_0x4249e3){console['error'](_0x4249e3);});}exports[_0xe921('0x41')]=rewrite; \ No newline at end of file +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 diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6002eb8..01b1f7c 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 _0xb611=['The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','create','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','id\x20IN\x20?','calleridnum','cm_hopper_final','ContactId','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','sequelize','query','catch','onlyIfOpen','VoiceQueueId','push','all','get','always','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CmContact','createReadStream','parse','pause','info','CSV\x20parse\x20error','bluebird','util','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xb611,0x129));var _0x1b61=function(_0x39628c,_0x2eb8c4){_0x39628c=_0x39628c-0x0;var _0x2b0532=_0xb611[_0x39628c];return _0x2b0532;};'use strict';var BPromise=require(_0x1b61('0x0'));var util=require(_0x1b61('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x1b61('0x2'));var Redis=require('ioredis');var db=require(_0x1b61('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x1b61('0x4'))(_0x1b61('0x5'));config[_0x1b61('0x6')]=_['defaults'](config[_0x1b61('0x6')],{'host':_0x1b61('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1b61('0x8'))[_0x1b61('0x9')](socket);try{if(!process[_0x1b61('0xa')][0x2]||process[_0x1b61('0xa')][0x2]==='undefined'||process[_0x1b61('0xa')][0x2]==='null'){throw new Error(_0x1b61('0xb'));}var FILEPATH=process[_0x1b61('0xa')][0x2];if(!process[_0x1b61('0xa')][0x3]||process[_0x1b61('0xa')][0x3]===_0x1b61('0xc')||process[_0x1b61('0xa')][0x3]===_0x1b61('0xd')||!process[_0x1b61('0xa')][0x4]||process[_0x1b61('0xa')][0x4]===_0x1b61('0xc')||process[_0x1b61('0xa')][0x4]==='null'){throw new Error(_0x1b61('0xe'));}var FIELDS=_[_0x1b61('0xf')](process[_0x1b61('0xa')][0x3][_0x1b61('0x10')](','),process[_0x1b61('0xa')][0x4]['split'](','));if(!process[_0x1b61('0xa')][0x5]||process[_0x1b61('0xa')][0x5]===_0x1b61('0xc')||process[_0x1b61('0xa')][0x5]===_0x1b61('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x1b61('0xa')][0x5];var COMPANYID=process[_0x1b61('0xa')][0x6]&&process[_0x1b61('0xa')][0x6]!==_0x1b61('0xc')&&process[_0x1b61('0xa')][0x6]!==_0x1b61('0xd')?process[_0x1b61('0xa')][0x6]:null;var DUPLICATES=process[_0x1b61('0xa')][0x7]&&process['argv'][0x7]!==_0x1b61('0xc')&&process[_0x1b61('0xa')][0x7]!=='null'?process[_0x1b61('0xa')][0x7]:null;if(!process[_0x1b61('0xa')][0x8]||process[_0x1b61('0xa')][0x8]==='undefined'||process[_0x1b61('0xa')][0x8]===_0x1b61('0xd')){throw new Error(_0x1b61('0x11'));}var SOCKET_TIMESTAMP=process[_0x1b61('0xa')][0x8];}catch(_0x41a579){logger[_0x1b61('0x12')](_0x41a579);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(_0x347e7b,_0x436fc2,_0x541604,_0x493c27){var _0x3ba564={'message':_0x436fc2};_0x3ba564[_0x347e7b]=!![];if(_0x541604){_0x3ba564[_0x1b61('0x13')]=_0x541604;}if(_0x493c27){_0x3ba564[_0x1b61('0x14')]=_0x493c27;}return _0x3ba564;}function isEmail(_0x526531){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x526531);}function checkRow(_0xed111c,_0x19fda2,_0x2ab06a){return new BPromise(function(_0x317d42,_0x4c5187){if(_['isNil'](_0xed111c)){return _0x4c5187(handleCheckRowError('error',_0x1b61('0x15'),null,_0x2ab06a));}if(_0xed111c['errors']&&_0xed111c[_0x1b61('0x16')]['length']){var _0x3a352d=_['map'](_0xed111c['errors'],'message')[_0x1b61('0x17')](';');return _0x4c5187(handleCheckRowError('error',_0x3a352d,null,_0x2ab06a));}var _0x5d5312={};for(var _0x10e337 in FIELDS){if(FIELDS[_0x1b61('0x18')](_0x10e337)&&FIELDS[_0x10e337]){_0x5d5312[_0x10e337]=_0xed111c[_0x1b61('0x19')][0x0][FIELDS[_0x10e337]]||_0xed111c[_0x1b61('0x19')][0x0]['\ufeff'+FIELDS[_0x10e337]];}}if(!_0x5d5312['firstName']){return _0x4c5187(handleCheckRowError(_0x1b61('0x12'),_0x1b61('0x1a'),null,_0x2ab06a));}if(!_0x5d5312[_0x1b61('0x1b')]){return _0x4c5187(handleCheckRowError('error',_0x1b61('0x1c'),null,_0x2ab06a));}if(_0x5d5312[_0x1b61('0x1d')]){var _0x352103=moment(_0x5d5312[_0x1b61('0x1d')],'YYYY-MM-DD');if(!_0x352103[_0x1b61('0x1e')]()){return _0x4c5187(handleCheckRowError(_0x1b61('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2ab06a));}}if(_0x5d5312[_0x1b61('0x1f')]){if(!isEmail(_0x5d5312[_0x1b61('0x1f')])){return _0x4c5187(handleCheckRowError(_0x1b61('0x12'),_0x1b61('0x20'),null,_0x2ab06a));}}_0x5d5312[_0x1b61('0x21')]=LISTID;_0x5d5312[_0x1b61('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1b61('0x23')]&&_0x19fda2){var _0x3295d7={};for(var _0x343afe=0x0,_0x471b5a=DUPLICATES[_0x1b61('0x23')];_0x343afe<_0x471b5a;_0x343afe+=0x1){_0x3295d7[DUPLICATES[_0x343afe]]=_0x5d5312[DUPLICATES[_0x343afe]];}var _0x17fd1a=_[_0x1b61('0x24')](_0x19fda2,_0x3295d7);if(_0x17fd1a){return _0x4c5187(handleCheckRowError(_0x1b61('0x25'),'Duplicate\x20Contact',_0x17fd1a,_0x2ab06a));}}return db['CmContact'][_0x1b61('0x26')](_0x5d5312,{'raw':!![],'hooks':![],'fields':_[_0x1b61('0x27')](_0x5d5312)})[_0x1b61('0x28')](function(_0xcc086){if(DUPLICATES&&DUPLICATES[_0x1b61('0x23')]&&_0x19fda2){_0x19fda2['push'](_[_0x1b61('0x29')](_0x5d5312,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xcc086['id'];return _0x317d42();})['catch'](function(_0x1e388c){return _0x4c5187(handleCheckRowError(_0x1b61('0x12'),_0x1b61('0x2a')+(_0x1e388c['message']||JSON['stringify'](_0x1e388c)),null,_0x2ab06a));});});}function checkHopper(){function _0x49fb87(){return function(_0xd37264){logger['error'](_0x1b61('0x2b'),_0x1b61('0x2c'),util['inspect'](_0xd37264,{'showHidden':![],'depth':null}));};}var _0x32c8fe=function(_0x2287f6,_0x23a53b){var _0x45c4b3=squel['insert']()[_0x1b61('0x2d')](_0x1b61('0x2e'))[_0x1b61('0x2f')]([_0x1b61('0x1b'),_0x1b61('0x30'),'ContactId',_0x1b61('0x21'),_0x23a53b,_0x1b61('0x31'),_0x1b61('0x32')],squel[_0x1b61('0x33')]()[_0x1b61('0x34')](_0x1b61('0x1b'),'phone')[_0x1b61('0x34')]('NOW()',_0x1b61('0x30'))['field']('id','ContactId')[_0x1b61('0x34')](LISTID[_0x1b61('0x35')](),_0x1b61('0x21'))[_0x1b61('0x34')](_0x2287f6['id'][_0x1b61('0x35')](),_0x23a53b)['field']('NOW()','createdAt')[_0x1b61('0x34')](_0x1b61('0x36'),'updatedAt')[_0x1b61('0x37')](_0x1b61('0x38'))[_0x1b61('0x39')](_0x1b61('0x3a'))[_0x1b61('0x39')](_0x1b61('0x3b'),LISTID[_0x1b61('0x35')]())[_0x1b61('0x39')](_0x1b61('0x3c'))[_0x1b61('0x39')](_0x1b61('0x3d'),squel['select']()[_0x1b61('0x34')](_0x1b61('0x1b'))[_0x1b61('0x37')](_0x1b61('0x2e'))[_0x1b61('0x39')](_0x23a53b+_0x1b61('0x3e'),_0x2287f6['id'][_0x1b61('0x35')]())))[_0x1b61('0x35')]();return _0x45c4b3;};var _0x384f0d=function(_0x519c41,_0x16e77b){var _0x402d57=squel[_0x1b61('0x3f')]()[_0x1b61('0x2d')](_0x1b61('0x2e'))[_0x1b61('0x2f')]([_0x1b61('0x1b'),_0x1b61('0x30'),'ContactId',_0x1b61('0x21'),_0x16e77b,_0x1b61('0x31'),'updatedAt'],squel[_0x1b61('0x33')]()[_0x1b61('0x34')](_0x1b61('0x1b'),_0x1b61('0x1b'))[_0x1b61('0x34')]('NOW()',_0x1b61('0x30'))['field']('id','ContactId')['field'](LISTID[_0x1b61('0x35')](),_0x1b61('0x21'))[_0x1b61('0x34')](_0x519c41['id'][_0x1b61('0x35')](),_0x16e77b)['field'](_0x1b61('0x36'),'createdAt')[_0x1b61('0x34')](_0x1b61('0x36'),'updatedAt')[_0x1b61('0x37')](_0x1b61('0x38'))[_0x1b61('0x39')]('deletedAt\x20IS\x20NULL')[_0x1b61('0x39')](_0x1b61('0x3b'),LISTID[_0x1b61('0x35')]())['where'](_0x1b61('0x40'),squel['str'](hopperContacts))[_0x1b61('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x1b61('0x39')](_0x1b61('0x3d'),squel[_0x1b61('0x33')]()[_0x1b61('0x34')](_0x1b61('0x41'))[_0x1b61('0x37')](_0x1b61('0x42'))['where'](_0x16e77b+_0x1b61('0x3e'),_0x519c41['id'][_0x1b61('0x35')]()))[_0x1b61('0x39')](_0x1b61('0x3d'),squel[_0x1b61('0x33')]()[_0x1b61('0x34')](_0x1b61('0x1b'))['from']('cm_hopper')[_0x1b61('0x39')](_0x16e77b+_0x1b61('0x3e'),_0x519c41['id'][_0x1b61('0x35')]())))['toString']();return _0x402d57;};function _0xf06cc3(_0x20069d,_0x4a7164){var _0x70b974=squel[_0x1b61('0x3f')]()[_0x1b61('0x2d')](_0x1b61('0x2e'))[_0x1b61('0x2f')]([_0x1b61('0x1b'),_0x1b61('0x30'),_0x1b61('0x43'),_0x1b61('0x21'),_0x4a7164,_0x1b61('0x31'),_0x1b61('0x32')],squel[_0x1b61('0x33')]()[_0x1b61('0x34')](_0x1b61('0x1b'),_0x1b61('0x1b'))[_0x1b61('0x34')](_0x1b61('0x36'),'scheduledAt')[_0x1b61('0x34')]('id',_0x1b61('0x43'))[_0x1b61('0x34')](LISTID[_0x1b61('0x35')](),'ListId')['field'](_0x20069d['id'][_0x1b61('0x35')](),_0x4a7164)['field'](_0x1b61('0x36'),_0x1b61('0x31'))[_0x1b61('0x34')](_0x1b61('0x36'),_0x1b61('0x32'))[_0x1b61('0x37')](_0x1b61('0x38'))[_0x1b61('0x39')](_0x1b61('0x3a'))['where'](_0x1b61('0x3b'),LISTID[_0x1b61('0x35')]())['where']('id\x20IN\x20?',squel[_0x1b61('0x44')](hopperContacts))[_0x1b61('0x39')](_0x1b61('0x3c')))[_0x1b61('0x35')]();return _0x70b974;}function _0x3b74f6(_0x54a317,_0x3354e7){var _0x206441=squel[_0x1b61('0x3f')]()['into'](_0x1b61('0x45'))['fromQuery']([_0x1b61('0x1b'),_0x1b61('0x43'),'ListId',_0x3354e7,_0x1b61('0x31'),_0x1b61('0x32')],squel['select']()[_0x1b61('0x34')]('phone','phone')[_0x1b61('0x34')]('id',_0x1b61('0x43'))[_0x1b61('0x34')](LISTID['toString'](),_0x1b61('0x21'))['field'](_0x54a317['id'][_0x1b61('0x35')](),_0x3354e7)[_0x1b61('0x34')](_0x1b61('0x36'),_0x1b61('0x31'))['field'](_0x1b61('0x36'),_0x1b61('0x32'))[_0x1b61('0x37')](_0x1b61('0x38'))[_0x1b61('0x39')](_0x1b61('0x3a'))['where'](_0x1b61('0x3b'),LISTID[_0x1b61('0x35')]())['where']('id\x20IN\x20?',squel[_0x1b61('0x44')](hopperContacts))[_0x1b61('0x39')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x206441;}return db[_0x1b61('0x46')][_0x1b61('0x47')]({'where':{'type':_0x1b61('0x48')},'attributes':['id',_0x1b61('0x49')],'include':[{'model':db[_0x1b61('0x4a')],'as':_0x1b61('0x4b'),'where':{'id':LISTID}}]})[_0x1b61('0x28')](function(_0x16761c){var _0x41b776=[];if(_0x16761c){var _0x1f27a8;for(var _0x44eaa8=0x0,_0x12d7fb;_0x44eaa8<_0x16761c['length'];_0x44eaa8+=0x1){_0x12d7fb=_0x16761c[_0x44eaa8]['get']({'plain':!![]});switch(_0x12d7fb[_0x1b61('0x49')]){case'always':_0x41b776['push'](db[_0x1b61('0x4c')][_0x1b61('0x4d')](_0x384f0d(_0x12d7fb,'VoiceQueueId'))[_0x1b61('0x28')](function(){})[_0x1b61('0x4e')](_0x49fb87()));break;case _0x1b61('0x4f'):_0x41b776['push'](db[_0x1b61('0x4c')]['query'](_0x32c8fe(_0x12d7fb,_0x1b61('0x50')))[_0x1b61('0x28')](function(){})[_0x1b61('0x4e')](_0x49fb87()));break;default:_0x41b776[_0x1b61('0x51')](db['sequelize'][_0x1b61('0x4d')](_0xf06cc3(_0x12d7fb,_0x1b61('0x50')))[_0x1b61('0x28')](function(){})[_0x1b61('0x4e')](_0x49fb87()));}}}return _0x41b776;})[_0x1b61('0x52')]()[_0x1b61('0x28')](function(){return db['VoiceQueue'][_0x1b61('0x47')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1b61('0x28')](function(_0x87f53c){var _0x5e0a79=[];if(_0x87f53c){var _0x1790af;for(var _0x57140b=0x0,_0x3e0e03;_0x57140b<_0x87f53c[_0x1b61('0x23')];_0x57140b+=0x1){_0x3e0e03=_0x87f53c[_0x57140b][_0x1b61('0x53')]({'plain':!![]});_0x5e0a79['push'](db['sequelize'][_0x1b61('0x4d')](_0x3b74f6(_0x3e0e03,_0x1b61('0x50')))[_0x1b61('0x28')](function(){})[_0x1b61('0x4e')](_0x49fb87()));}}return _0x5e0a79;})[_0x1b61('0x52')]();})[_0x1b61('0x28')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x1b61('0x49')],'include':[{'model':db[_0x1b61('0x4a')],'as':_0x1b61('0x4b'),'where':{'id':LISTID}}]})['then'](function(_0x16e597){var _0x173730=[];if(_0x16e597){for(var _0x5cd892=0x0,_0x556d5a;_0x5cd892<_0x16e597['length'];_0x5cd892+=0x1){_0x556d5a=_0x16e597[_0x5cd892]['get']({'plain':!![]});switch(_0x556d5a[_0x1b61('0x49')]){case _0x1b61('0x54'):_0x173730[_0x1b61('0x51')](db[_0x1b61('0x4c')]['query'](_0x384f0d(_0x556d5a,_0x1b61('0x55')))[_0x1b61('0x28')](function(){})[_0x1b61('0x4e')](_0x49fb87()));break;case _0x1b61('0x4f'):_0x173730[_0x1b61('0x51')](db[_0x1b61('0x4c')][_0x1b61('0x4d')](_0x32c8fe(_0x556d5a,_0x1b61('0x55')))['then'](function(){})[_0x1b61('0x4e')](_0x49fb87()));break;default:_0x173730['push'](db[_0x1b61('0x4c')][_0x1b61('0x4d')](_0xf06cc3(_0x556d5a,_0x1b61('0x55')))[_0x1b61('0x28')](function(){})[_0x1b61('0x4e')](_0x49fb87()));}}}return _0x173730;})[_0x1b61('0x52')]();})[_0x1b61('0x28')](function(){return db[_0x1b61('0x56')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x1b61('0x4a')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x3aee95){var _0x1d0b21=[];if(_0x3aee95){for(var _0x24d378=0x0,_0x3d854f;_0x24d378<_0x3aee95[_0x1b61('0x23')];_0x24d378+=0x1){_0x3d854f=_0x3aee95[_0x24d378][_0x1b61('0x53')]({'plain':!![]});_0x1d0b21['push'](db[_0x1b61('0x4c')]['query'](_0x3b74f6(_0x3d854f,_0x1b61('0x55')))['then'](function(){})[_0x1b61('0x4e')](_0x49fb87()));}}return _0x1d0b21;})[_0x1b61('0x52')]();})[_0x1b61('0x4e')](function(_0x5f33b3){logger[_0x1b61('0x12')](_0x1b61('0x57'),_0x1b61('0x58'),_0x5f33b3[_0x1b61('0x59')]);});}var processPromises=function(_0x425595){return BPromise[_0x1b61('0x52')](promises)[_0x1b61('0x28')](function(_0x516e17){})['catch'](function(_0x3c2a6b){logger[_0x1b61('0x12')](_0x1b61('0x5a'),JSON[_0x1b61('0x5b')](_0x3c2a6b));})[_0x1b61('0x5c')](function(){socket['emit'](_0x1b61('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x425595){return _0x425595[_0x1b61('0x5e')]();}});};var endCsv=function(){return BPromise[_0x1b61('0x5f')]()[_0x1b61('0x28')](function(){if(hopperContacts){return checkHopper();}})[_0x1b61('0x28')](function(){socket[_0x1b61('0x60')](_0x1b61('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1b61('0x61')](FILEPATH);}catch(_0x1e0c09){logger[_0x1b61('0x12')](_0x1b61('0x62'),JSON[_0x1b61('0x5b')](_0x1e0c09));}finally{process['exit'](0x0);}});};process['on'](_0x1b61('0x63'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x1b61('0x5f')]()[_0x1b61('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1b61('0x10')](',');return db[_0x1b61('0x64')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1b61('0x28')](function(_0x5232fd){var _0xb2a663=fs[_0x1b61('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1b61('0x66')](_0xb2a663,{'header':!![],'skipEmptyLines':!![],'step':function(_0x137906,_0x20cc7e){total+=0x1;var _0x28de52=total;promises[_0x1b61('0x51')](checkRow(_0x137906,_0x5232fd,_0x28de52)[_0x1b61('0x28')](function(){success+=0x1;})[_0x1b61('0x4e')](function(_0x5bbd58){if(_0x5bbd58[_0x1b61('0x12')]){errors+=0x1;delete _0x5bbd58['error'];}else if(_0x5bbd58['duplicate']){duplicates+=0x1;delete _0x5bbd58[_0x1b61('0x25')];}rows[_0x1b61('0x51')](_0x5bbd58);}));if(total%0xc8===0x0){_0x20cc7e[_0x1b61('0x67')]();return processPromises(_0x20cc7e);}},'complete':function(){return processPromises()[_0x1b61('0x28')](function(){logger[_0x1b61('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2ad4f,_0xe9b77){logger[_0x1b61('0x68')](_0x1b61('0x69'),JSON[_0x1b61('0x5b')](_0x2ad4f));endCsv();}});})[_0x1b61('0x4e')](function(_0x22fdc5){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x1b61('0x5b')](_0x22fdc5));});}main(); \ No newline at end of file +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 diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ff13fa1..55367db 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 _0xfc84=['message','exit','errors','code','sequelize','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','isNil','set','offset','dialTimezone','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','header','ContactItemType','name','_description','writeFileSync','data','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','itemTypeId','description','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','VoiceQueueId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../config/environment','../../../config/logger','import','redis','defaults','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','length','push','all','split','then','CmContactHasItem','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','updatedAt','.CmListId','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','fromQuery','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfc84,0x1cf));var _0x4fc8=function(_0x597212,_0x420b34){_0x597212=_0x597212-0x0;var _0x3f4e39=_0xfc84[_0x597212];return _0x3f4e39;};'use strict';var fs=require('fs');var path=require(_0x4fc8('0x0'));var _=require(_0x4fc8('0x1'));var Papa=require(_0x4fc8('0x2'));var util=require(_0x4fc8('0x3'));var BPromise=require(_0x4fc8('0x4'));var moment=require(_0x4fc8('0x5'));var squel=require(_0x4fc8('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x4fc8('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x4fc8('0x8'))(_0x4fc8('0x9'));config[_0x4fc8('0xa')]=_[_0x4fc8('0xb')](config[_0x4fc8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fc8('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x4fc8('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4fc8('0xd')](_0x4fc8('0xc'));function isEmail(_0xd5ec0d){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xd5ec0d);}function selectNotIn(_0x576c96,_0x364ea8,_0x197600,_0x2b1c99,_0x1636b9){return squel[_0x4fc8('0xe')]()[_0x4fc8('0xf')](_0x4fc8('0x10'))[_0x4fc8('0x11')](_0x2b1c99)[_0x4fc8('0x12')](_0x364ea8,null,_0x364ea8+_0x4fc8('0x13')+_0x2b1c99+'.'+_0x197600)[_0x4fc8('0x14')](_0x2b1c99+'.'+_0x197600+_0x4fc8('0x15')+_0x576c96+'.'+_0x197600)[_0x4fc8('0x14')](_0x364ea8+_0x4fc8('0x16')+_0x1636b9[_0x4fc8('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1834b2,_0x1e6516){promisesAdditionalPhones=[];return db['CmContact'][_0x4fc8('0x17')]({'raw':!![],'attributes':['id',_0x4fc8('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0xe4e9fe){if(_0xe4e9fe!==null){var _0x528e6f=[];for(var _0x4d1c2=0x0;_0x4d1c2<_0xe4e9fe[_0x4fc8('0x19')];_0x4d1c2++){var _0xa27a49=_0xe4e9fe[_0x4d1c2];_0x528e6f[_0x4fc8('0x1a')](insertAdditionalPhones(_0xa27a49));}}Promise[_0x4fc8('0x1b')](_0x528e6f)['then'](function(){_0x1834b2({'val':0x1});});});});}function insertAdditionalPhones(_0x1e3e88){return new Promise(function(_0x533ba6,_0x545c11){var _0x3d0e63=_0x1e3e88[_0x4fc8('0x18')];var _0x1273a5=_0x3d0e63[_0x4fc8('0x1c')](';');var _0x383e09=[];orderBy=0x0;for(var _0x2c1318=0x0;_0x2c1318<_0x1273a5['length'];_0x2c1318++){_0x383e09['push'](splitAdditionalPhone(_0x1e3e88['id'],_0x1273a5[_0x2c1318]));}Promise[_0x4fc8('0x1b')](_0x383e09)[_0x4fc8('0x1d')](function(){_0x533ba6({'val':_0x1273a5['length']});});});}function splitAdditionalPhone(_0x5d8a48,_0xb604ae){return new Promise(function(_0x154109,_0x499cc1){var _0x492287=_0xb604ae[_0x4fc8('0x1c')](':');var _0x384ef5=_0x492287[0x0];var _0x4e54ea=_0x492287[0x1];if(!_['isNil'](_0x4e54ea)){var _0x36dca5=_0x4e54ea[_0x4fc8('0x1c')]('|');var _0x58d97b=[];for(var _0x11cab3=0x0;_0x11cab3<_0x36dca5[_0x4fc8('0x19')];_0x11cab3++){if(_0x36dca5[_0x11cab3]!==''){var _0x10b5b3=_['filter'](promisesAdditionalPhones,{'contactId':_0x5d8a48,'phone':_0x36dca5[_0x11cab3]});if(_0x10b5b3[_0x4fc8('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x4fc8('0x1a')]({'contactId':_0x5d8a48,'contactTypeId':_0x384ef5,'phone':_0x36dca5[_0x11cab3],'orderBy':orderBy});}}}_0x154109({'ok':0x1});}else _0x154109({'res':0x0});});}function createAdditionalPhone(_0x5101cb,_0x2df38a,_0x483945,_0x3a6956){var _0x48c9ff='';var _0x5765ec='';var _0x4c711d=_0x483945[_0x4fc8('0x1c')]('§');_0x48c9ff=_0x4c711d[0x0];if(_0x4c711d[_0x4fc8('0x19')]==0x2)_0x5765ec=_0x4c711d[0x1];return new Promise(function(_0x4d6de8,_0x173caf){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x5101cb,'item':_0x48c9ff}})[_0x4fc8('0x1d')](function(_0x5e5de0){if(_0x5e5de0){return db[_0x4fc8('0x1e')]['update']({'ItemTypeId':_0x2df38a,'description':_0x5765ec,'OrderBy':_0x3a6956},{'where':{'CmContactId':_0x5101cb,'item':_0x48c9ff}})[_0x4fc8('0x1d')](function(_0x25873c){_0x4d6de8({'res':_0x4fc8('0x1f')});});}else{return db[_0x4fc8('0x1e')]['create']({'CmContactId':_0x5101cb,'item':_0x48c9ff,'description':_0x5765ec,'ItemTypeId':_0x2df38a,'OrderBy':_0x3a6956,'ItemClass':'PHONE'})[_0x4fc8('0x1d')](function(_0x4dd6f5){_0x4d6de8({'res':_0x4fc8('0x20')});});}});});}function insertCmHopper(_0x4e1dac,_0x57615c,_0x25430a,_0x4e4cdd,_0x1915d6){var _0x19a62c=[_0x4fc8('0x21'),_0x4fc8('0x22'),_0x4fc8('0x23'),'cm_contacts.ListId',_0x57615c+'.'+_0x4e4cdd,_0x4fc8('0x24'),'cm_contacts.updatedAt',_0x4fc8('0x25'),_0x4fc8('0x26'),'\x22'+_0x1915d6+'\x22'];return squel[_0x4fc8('0x27')]()[_0x4fc8('0x28')]('cm_hopper')['fromQuery']([_0x4fc8('0x10'),_0x4fc8('0x29'),_0x4fc8('0x2a'),_0x4fc8('0x2b'),_0x4e4cdd,_0x4fc8('0x2c'),'updatedAt',_0x4fc8('0x2d'),_0x4fc8('0x2e'),_0x4fc8('0x2f')],squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')](_0x19a62c)[_0x4fc8('0x11')](_0x57615c)[_0x4fc8('0x12')](_0x4fc8('0x31'),null,_0x4fc8('0x32')+_0x57615c+'.CmListId')[_0x4fc8('0x12')](_0x25430a,null,_0x25430a+_0x4fc8('0x13')+_0x57615c+'.'+_0x4e4cdd)['where'](_0x57615c+_0x4fc8('0x33'),_0x4e1dac)[_0x4fc8('0x14')](_0x4fc8('0x34'),NOW)['where'](_0x4fc8('0x35'),selectNotIn(_0x57615c,_0x25430a,_0x4e4cdd,_0x4fc8('0x36'),[_0x4fc8('0x37'),_0x4fc8('0x38')]))[_0x4fc8('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x57615c,_0x25430a,_0x4e4cdd,'cm_hopper',[_0x4fc8('0x37')])))[_0x4fc8('0x39')]();}function insertCmHopperBlack(_0x3b917e,_0x4d75ce,_0x38a6e4,_0xcb2c66){var _0x343a83=[_0x4fc8('0x21'),_0x4fc8('0x23'),_0x4fc8('0x3a'),_0x4d75ce+'.'+_0xcb2c66,_0x4fc8('0x24'),_0x4fc8('0x3b')];return squel[_0x4fc8('0x27')]()['into'](_0x4fc8('0x3c'))['fromQuery'](['phone','ContactId','ListId',_0xcb2c66,_0x4fc8('0x2c'),_0x4fc8('0x3d')],squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')](_0x343a83)[_0x4fc8('0x11')](_0x4d75ce)[_0x4fc8('0x12')](_0x4fc8('0x31'),null,_0x4fc8('0x32')+_0x4d75ce+_0x4fc8('0x3e'))[_0x4fc8('0x12')](_0x38a6e4,null,_0x38a6e4+'.id\x20=\x20'+_0x4d75ce+'.'+_0xcb2c66)[_0x4fc8('0x14')](_0x4d75ce+'.CmListId\x20=\x20?',_0x3b917e)[_0x4fc8('0x14')](_0x4fc8('0x34'),NOW)[_0x4fc8('0x14')](_0x4fc8('0x35'),squel[_0x4fc8('0xe')]()[_0x4fc8('0xf')]('phone')[_0x4fc8('0x11')]('cm_hopper_black')[_0x4fc8('0x14')](_0x4fc8('0x3f'),_0x3b917e)[_0x4fc8('0x14')](_0xcb2c66+_0x4fc8('0x15')+_0x4d75ce+'.'+_0xcb2c66)))[_0x4fc8('0x39')]();}function insertTzCmHopper(_0x568d56,_0x2ba745,_0x528e3b,_0x2bbdec,_0x5c974e,_0x289d31){var _0x527e6a=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x289d31+_0x4fc8('0x40'),_0x4fc8('0x23'),'cm_contacts.ListId',_0x2ba745+'.'+_0x2bbdec,_0x4fc8('0x24'),_0x4fc8('0x3b'),_0x4fc8('0x25'),_0x4fc8('0x26'),'\x22'+_0x5c974e+'\x22'];var _0x479d8a=squel[_0x4fc8('0x27')]()['into']('cm_hopper')[_0x4fc8('0x41')](['phone','scheduledat','ContactId','ListId',_0x2bbdec,_0x4fc8('0x2c'),_0x4fc8('0x3d'),_0x4fc8('0x2d'),_0x4fc8('0x2e'),'recallme'],squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')](_0x527e6a)['from'](_0x2ba745)['join'](_0x4fc8('0x31'),null,_0x4fc8('0x32')+_0x2ba745+_0x4fc8('0x3e'))[_0x4fc8('0x12')](_0x528e3b,null,_0x528e3b+_0x4fc8('0x13')+_0x2ba745+'.'+_0x2bbdec)[_0x4fc8('0x12')](_0x289d31,null,_0x289d31+_0x4fc8('0x13')+_0x2ba745+'.'+_0x2bbdec)[_0x4fc8('0x14')](_0x2ba745+_0x4fc8('0x33'),_0x568d56)[_0x4fc8('0x14')](_0x4fc8('0x34'),NOW)['where'](_0x4fc8('0x35'),selectNotIn(_0x2ba745,_0x528e3b,_0x2bbdec,_0x4fc8('0x36'),[_0x4fc8('0x37'),_0x4fc8('0x38')]))[_0x4fc8('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2ba745,_0x528e3b,_0x2bbdec,'cm_hopper',[_0x4fc8('0x37')])))['toString']();return _0x479d8a;}function insertTzCmHopperBlack(_0x4f1576,_0x58b1ae,_0x31ffd7,_0x2be36c){var _0x38dafc=['cm_contacts.phone',_0x4fc8('0x23'),_0x4fc8('0x3a'),_0x58b1ae+'.'+_0x2be36c,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x4fc8('0x27')]()[_0x4fc8('0x28')](_0x4fc8('0x3c'))['fromQuery']([_0x4fc8('0x10'),_0x4fc8('0x2a'),_0x4fc8('0x2b'),_0x2be36c,_0x4fc8('0x2c'),'updatedAt'],squel[_0x4fc8('0xe')]()['fields'](_0x38dafc)[_0x4fc8('0x11')](_0x58b1ae)['join']('cm_contacts',null,_0x4fc8('0x32')+_0x58b1ae+_0x4fc8('0x3e'))[_0x4fc8('0x12')](_0x31ffd7,null,_0x31ffd7+_0x4fc8('0x13')+_0x58b1ae+'.'+_0x2be36c)[_0x4fc8('0x14')](_0x58b1ae+'.CmListId\x20=\x20?',_0x4f1576)[_0x4fc8('0x14')](_0x4fc8('0x34'),NOW)[_0x4fc8('0x14')](_0x4fc8('0x35'),squel[_0x4fc8('0xe')]()[_0x4fc8('0xf')](_0x4fc8('0x10'))[_0x4fc8('0x11')](_0x4fc8('0x3c'))['where'](_0x4fc8('0x3f'),_0x4f1576)['where'](_0x2be36c+'\x20=\x20'+_0x58b1ae+'.'+_0x2be36c)))[_0x4fc8('0x39')]();}function insertCmHopperAdditionalPhones(_0x514300){var _0x156ad6=[_0x4fc8('0x42'),_0x4fc8('0x43'),_0x4fc8('0x44'),_0x4fc8('0x45'),_0x4fc8('0x46')];return squel[_0x4fc8('0x27')]()['into'](_0x4fc8('0x47'))['fromQuery']([_0x4fc8('0x48'),'phone',_0x4fc8('0x49'),_0x4fc8('0x2c'),'updatedAt'],squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')](_0x156ad6)[_0x4fc8('0x11')]('cm_hopper')[_0x4fc8('0x12')]('cm_contacts',null,_0x4fc8('0x4a'))[_0x4fc8('0x12')](_0x4fc8('0x4b'),null,_0x4fc8('0x4c'))[_0x4fc8('0x14')](_0x4fc8('0x4d'),_0x514300)[_0x4fc8('0x14')](_0x4fc8('0x34'),NOW))[_0x4fc8('0x39')]();}function insertCmContact(_0x1db273,_0x4e7ae6,_0x4e06de,_0x24d845){var _0x58df14=_[_0x4fc8('0x4e')](_[_0x4fc8('0x4f')](_0x24d845),['ListId',_0x4fc8('0x50'),_0x4fc8('0x2c'),'updatedAt','scheduledAt']);return squel[_0x4fc8('0x27')]()[_0x4fc8('0x28')](_0x4fc8('0x31'))[_0x4fc8('0x41')](_0x58df14,squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')](_0x58df14)[_0x4fc8('0x11')](_0x4e7ae6)[_0x4fc8('0x14')]('('+_0x4e06de[_0x4fc8('0x12')](',')+_0x4fc8('0x51'),squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')](_0x4e06de)[_0x4fc8('0x11')]('cm_contacts')[_0x4fc8('0x14')](_0x4fc8('0x3f'),_0x1db273)[_0x4fc8('0x14')](_0x4fc8('0x52')))[_0x4fc8('0x14')](_0x4fc8('0x53'),squel[_0x4fc8('0xe')]()[_0x4fc8('0xf')](_0x4fc8('0x54'),_0x4fc8('0x55'))['from'](_0x4e7ae6)[_0x4fc8('0x56')](_0x4e06de['join'](','))))[_0x4fc8('0x39')]();}function handleStop(){logger[_0x4fc8('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x39fa33){logger[_0x4fc8('0x58')](_0x39fa33[_0x4fc8('0x59')]);process[_0x4fc8('0x5a')](0x1);}function handleError(_0x4af630,_0x1e4dca){stats[_0x4fc8('0x5b')]['push']({'name':_0x1e4dca[_0x4fc8('0x5c')],'message':_0x1e4dca['message'],'row':_0x4af630});}function handleQuery(_0x78c2ab){logger[_0x4fc8('0x57')](_0x78c2ab);return db[_0x4fc8('0x5d')][_0x4fc8('0x5e')](_0x78c2ab)['spread'](function(_0x2bad3c){results[_0x4fc8('0x1a')](_0x2bad3c);})[_0x4fc8('0x5f')](function(_0x51ff38){logger[_0x4fc8('0x58')](_0x51ff38['message']);});}function updateTzCampaigns(_0x3351f1){return new Promise(function(_0x47fe01,_0x52960d){var _0x5f1b6c=squel[_0x4fc8('0xe')]()[_0x4fc8('0x30')]([_0x4fc8('0x60'),'campaigns.dialTimezone'])[_0x4fc8('0x11')](_0x4fc8('0x61'))[_0x4fc8('0x12')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x4fc8('0x62')+_0x3351f1);db[_0x4fc8('0x5d')][_0x4fc8('0x5e')](_0x5f1b6c[_0x4fc8('0x39')]())[_0x4fc8('0x63')](function(_0x16c0e5){var _0x274604=[];for(var _0x4137d1=0x0;_0x4137d1<_0x16c0e5[_0x4fc8('0x19')];_0x4137d1++){_0x274604[_0x4fc8('0x1a')](getTimezoneData(_0x16c0e5[_0x4137d1],tmp_campaigns));}BPromise[_0x4fc8('0x1b')](_0x274604)[_0x4fc8('0x1d')](function(){_0x47fe01({'val':0x1});});})[_0x4fc8('0x5f')](function(_0x203dbc){logger[_0x4fc8('0x58')](_0x203dbc['message']);_0x47fe01({'val':0x0});});});}function updateTzVoiceQueues(_0x139732){return new Promise(function(_0x5d1ff8,_0x261f86){var _0x1aea7d=squel[_0x4fc8('0xe')]()['fields']([_0x4fc8('0x64'),_0x4fc8('0x65')])[_0x4fc8('0x11')](_0x4fc8('0x66'))['join'](_0x4fc8('0x67'),null,_0x4fc8('0x68'))[_0x4fc8('0x14')](_0x4fc8('0x69')+_0x139732);db[_0x4fc8('0x5d')][_0x4fc8('0x5e')](_0x1aea7d[_0x4fc8('0x39')]())[_0x4fc8('0x63')](function(_0x3a9e84){var _0xb63e23=[];for(var _0x1beb97=0x0;_0x1beb97<_0x3a9e84[_0x4fc8('0x19')];_0x1beb97++){_0xb63e23[_0x4fc8('0x1a')](getTimezoneData(_0x3a9e84[_0x1beb97],tmp_voice_queues));}BPromise[_0x4fc8('0x1b')](_0xb63e23)[_0x4fc8('0x1d')](function(){_0x5d1ff8({'val':0x1});});})[_0x4fc8('0x5f')](function(_0x4e86f2){logger[_0x4fc8('0x58')](_0x4e86f2[_0x4fc8('0x59')]);_0x5d1ff8({'val':0x0});});});}function getTimezoneData(_0x7a9863,_0x5cdb16){return new Promise(function(_0x4f438e,_0x5a66b0){var _0x38784e=shared[_0x4fc8('0x6a')];var _0x3a33fd=_0x38784e[_0x7a9863['dialTimezone']];if(_[_0x4fc8('0x6b')](_0x3a33fd)){_0x4f438e({'ret':0x1});}else{var _0x1aa7a6=_0x3a33fd['utcOffset'];var _0x5336c1=squel[_0x4fc8('0x27')]()['into'](_0x5cdb16)['set']('id',_0x7a9863['id'])[_0x4fc8('0x6c')](_0x4fc8('0x6d'),_0x1aa7a6)[_0x4fc8('0x6c')](_0x4fc8('0x6e'),_0x7a9863[_0x4fc8('0x6e')])[_0x4fc8('0x39')]();return db['sequelize'][_0x4fc8('0x5e')](_0x5336c1)[_0x4fc8('0x63')](function(_0x267256){_0x4f438e({'ret':0x1});})[_0x4fc8('0x5f')](function(_0x2fcfd9){logger[_0x4fc8('0x58')](_0x2fcfd9[_0x4fc8('0x59')]);_0x5a66b0({'ret':0x1});});}});}function handleTZQuery(_0x2fe938){logger[_0x4fc8('0x57')](_0x2fe938);return db[_0x4fc8('0x5d')][_0x4fc8('0x5e')](_0x2fe938)[_0x4fc8('0x63')](function(_0x305d5e){})[_0x4fc8('0x5f')](function(_0x385641){logger[_0x4fc8('0x58')](_0x385641[_0x4fc8('0x59')]);});}function main(_0x1c715a,_0x3a00a8,_0x2d251d,_0x1b2965){logger[_0x4fc8('0x57')](_0x4fc8('0x6f'),_0x1c715a,JSON[_0x4fc8('0x70')](_0x3a00a8));process[_0x4fc8('0x71')](_0x4fc8('0x72'));var _0x162cc6=_0x3a00a8[_0x4fc8('0x73')];var _0x25395d=_[_0x4fc8('0x74')](_0x162cc6);var _0x15362b=_0x3a00a8[_0x4fc8('0x75')];var _0x18450b=path['join'](config['root'],_0x4fc8('0x76'),_0x15362b+'.csv');hasTZ=_[_0x4fc8('0x4f')](_0x162cc6)['includes'](_0x4fc8('0x6e'));var _0x40644b=_[_0x4fc8('0x4f')](_0x162cc6)[_0x4fc8('0x12')]();logger[_0x4fc8('0x57')](_0x4fc8('0x77'),_0x40644b);db[_0x4fc8('0x78')][_0x4fc8('0x17')]({'raw':!![],'attributes':['id','name']})[_0x4fc8('0x1d')](function(_0x2b40fb){for(var _0x1acb9e=0x0;_0x1acb9e<_0x2b40fb[_0x4fc8('0x19')];_0x1acb9e++){if(_0x2b40fb[_0x1acb9e][_0x4fc8('0x79')]in _0x162cc6){contactItemTypes[_0x4fc8('0x1a')](_0x2b40fb[_0x1acb9e]);delete _0x25395d[_0x2b40fb[_0x1acb9e][_0x4fc8('0x79')]];hasAdditionalPhones=!![];}for(var _0x626111 in _0x162cc6){if(_0x2b40fb[_0x1acb9e][_0x4fc8('0x79')]+_0x4fc8('0x7a')===_0x626111){phoneDescriptions['push']({'itemTypeId':_0x2b40fb[_0x1acb9e]['id'],'description':_0x626111});delete _0x25395d[_0x626111];}}}if(hasAdditionalPhones)_0x25395d['AdditionalPhones']='';var _0x1b39c2=_[_0x4fc8('0x4f')](_0x25395d)[_0x4fc8('0x12')]();logger['info'](_0x4fc8('0x77'),_0x1b39c2);fs[_0x4fc8('0x7b')](_0x18450b,_0x1b39c2+'\x0a');Papa['parse'](fs['createReadStream'](_0x1c715a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x212327,_0x5ac9f2){try{for(var _0x10048a=0x0,_0x929449=[];_0x10048a<_0x212327[_0x4fc8('0x7c')][_0x4fc8('0x19')];_0x10048a++){stats['rows']+=0x1;if(_0x212327['errors'][_0x10048a]){handleError(_0x212327[_0x4fc8('0x7c')][_0x10048a],_0x212327[_0x4fc8('0x5b')][_0x10048a]);}else{var _0x4683ec=[];var _0x284762=[];var _0x2b74ec={};for(var _0x375167 in _0x162cc6){let _0x3274d5=contactItemTypes[_0x4fc8('0x7d')](_0xc13a8e=>_0xc13a8e[_0x4fc8('0x79')]===_0x375167);let _0x45a908=contactItemTypes[_0x4fc8('0x7d')](_0x4cc037=>_0x4cc037[_0x4fc8('0x79')]+_0x4fc8('0x7a')===_0x375167);if(_['isNil'](_0x3274d5)&&_[_0x4fc8('0x6b')](_0x45a908)){if(_0x162cc6[_0x4fc8('0x7e')](_0x375167)){if(_0x212327[_0x4fc8('0x7c')][_0x10048a][_0x162cc6[_0x375167]]){var _0x386c20=_[_0x4fc8('0x7f')](_0x212327[_0x4fc8('0x7c')][_0x10048a][_0x162cc6[_0x375167]][_0x4fc8('0x80')](/"/g,'\x27'));switch(_0x375167){case _0x4fc8('0x29'):var _0x12f873=moment(_0x386c20,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x12f873['isValid']()){_0x929449[_0x4fc8('0x1a')]('\x22'+_0x386c20+'\x22');}else{_0x4683ec[_0x4fc8('0x1a')](_0x4fc8('0x81'));}break;case _0x4fc8('0x2d'):var _0x41fb74=parseInt(_0x386c20);_0x386c20=_[_0x4fc8('0x82')](_0x41fb74)||_0x41fb74<0x0||_0x41fb74>0x4?_0x1b2965?0x3:0x2:_0x41fb74;_0x929449[_0x4fc8('0x1a')]('\x22'+_0x386c20+'\x22');break;case'UserId':var _0x575f4d=parseInt(_0x386c20);if(_[_0x4fc8('0x83')](_0x575f4d)&&_[_0x4fc8('0x84')](_0x2d251d,_0x575f4d)){_0x929449[_0x4fc8('0x1a')]('\x22'+_0x575f4d+'\x22');}else{_0x4683ec[_0x4fc8('0x1a')](_0x4fc8('0x85'));}break;case _0x4fc8('0x86'):if(isEmail(_0x386c20)){_0x929449[_0x4fc8('0x1a')]('\x22'+_0x386c20+'\x22');}else{_0x4683ec['push'](_0x4fc8('0x87'));}break;case _0x4fc8('0x88'):var _0x33610f=moment(_0x386c20,_0x4fc8('0x89'),!![]);if(_0x33610f['isValid']()){_0x929449[_0x4fc8('0x1a')]('\x22'+_0x386c20+'\x22');}else{_0x4683ec[_0x4fc8('0x1a')](_0x4fc8('0x8a'));}break;case'dialTimezone':var _0x1226fe=shared['timezones'];var _0x30b91a=_0x1226fe[_0x386c20];if(!_['isNil'](_0x30b91a)){var _0x15a2e3=_0x30b91a[_0x4fc8('0x8b')];_0x929449[_0x4fc8('0x1a')]('\x22'+_0x386c20+'\x22');_0x929449['push']('\x22'+_0x15a2e3+'\x22');}break;default:_0x929449[_0x4fc8('0x1a')]('\x22'+_0x386c20+'\x22');}}else{switch(_0x375167){case _0x4fc8('0x8c'):case'phone':_0x4683ec[_0x4fc8('0x1a')](_0x375167+'\x20not\x20specified');break;default:_0x929449[_0x4fc8('0x1a')]('\x22\x22');}}}}else{var _0x5bc6f0='';if(!_[_0x4fc8('0x6b')](_0x3274d5)){if(!_0x2b74ec[_0x4fc8('0x7e')](_0x3274d5['id'])){if(!_[_0x4fc8('0x6b')](_0x212327['data'][_0x10048a][_0x162cc6[_0x375167]])){var _0x386c20=_[_0x4fc8('0x7f')](_0x212327['data'][_0x10048a][_0x162cc6[_0x375167]][_0x4fc8('0x80')](/"/g,'\x27'));var _0x28ecb7=phoneDescriptions['find'](_0x1d7a88=>_0x1d7a88[_0x4fc8('0x8d')]===_0x3274d5['id']);if(!_[_0x4fc8('0x6b')](_0x28ecb7)){var _0x4dbd0f=_['trim'](_0x212327[_0x4fc8('0x7c')][_0x10048a][_0x162cc6[_0x28ecb7[_0x4fc8('0x8e')]]][_0x4fc8('0x80')](/"/g,'\x27'));if(!_[_0x4fc8('0x6b')](_0x4dbd0f))_0x386c20=_0x386c20+'§'+_0x4dbd0f;}if(_0x5bc6f0=='')_0x5bc6f0=_0x386c20;else _0x5bc6f0+='|'+_0x386c20;}_0x284762['push'](_0x3274d5['id']+':'+_0x5bc6f0);_0x2b74ec[_0x3274d5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x929449['push']('\x22'+_0x284762[_0x4fc8('0x12')](';')+'\x22');}if(_0x4683ec[_0x4fc8('0x19')]){handleError(_0x212327['data'][_0x10048a],{'code':'SystemRow','message':_0x4683ec['join']()});}else{fs[_0x4fc8('0x8f')](_0x18450b,_0x929449[_0x4fc8('0x12')]()+'\x0a');}_0x929449=[];}if(!(stats[_0x4fc8('0x90')]%0xc8)){socket[_0x4fc8('0x91')](_0x4fc8('0x92')+_0x15362b,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x4fc8('0x93'));_0x5ac9f2[_0x4fc8('0x94')]();}}catch(_0x524045){handleError(_0x212327[_0x4fc8('0x7c')][_0x10048a],{'code':_0x4fc8('0x95'),'message':_0x524045['message']});logger[_0x4fc8('0x58')]('step',_0x524045[_0x4fc8('0x59')]);}},'complete':function(){try{var _0x5c751b=[];var _0x565f12=[];var _0x11134c='cm_contacts';if(_0x3a00a8[_0x4fc8('0x96')]&&_0x3a00a8['duplicates']['length']){_0x11134c='cm_contacts_'+_0x15362b;_0x5c751b['push'](_0x4fc8('0x97')+_0x11134c+_0x4fc8('0x98'));}tmp_campaigns='campaigns_'+_0x15362b;tmp_voice_queues=_0x4fc8('0x99')+_0x15362b;_0x565f12[_0x4fc8('0x1a')](_0x4fc8('0x97')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x565f12[_0x4fc8('0x1a')](_0x4fc8('0x97')+tmp_voice_queues+_0x4fc8('0x9a'));BPromise[_0x4fc8('0x9b')](_0x565f12,handleTZQuery)[_0x4fc8('0x1d')](function(_0x2ed1a0){updateTzCampaigns(_0x3a00a8[_0x4fc8('0x2b')])['then'](function(_0x32405a){updateTzVoiceQueues(_0x3a00a8[_0x4fc8('0x2b')])['then'](function(_0x3dae63){if(hasTZ)_0x1b39c2=_0x1b39c2[_0x4fc8('0x80')]('dialTimezone',_0x4fc8('0x9c'));var _0x3e6487=util[_0x4fc8('0xd')](_0x4fc8('0x9d'),_0x18450b,_0x11134c,_0x1b39c2,_0x3a00a8[_0x4fc8('0x2b')],_0x3a00a8[_0x4fc8('0x50')]||null,NOW,NOW);if(_[_0x4fc8('0x6b')](_0x162cc6[_0x4fc8('0x29')])){_0x3e6487+=_0x4fc8('0x9e');}_0x5c751b[_0x4fc8('0x1a')](_0x3e6487);if(_0x3a00a8['duplicates']&&_0x3a00a8['duplicates'][_0x4fc8('0x19')]){_0x5c751b[_0x4fc8('0x1a')](insertCmContact(_0x3a00a8['ListId'],_0x11134c,_0x3a00a8[_0x4fc8('0x96')],_0x162cc6));_0x5c751b[_0x4fc8('0x1a')]('DROP\x20TABLE\x20'+_0x11134c+';');}BPromise[_0x4fc8('0x9b')](_0x5c751b,handleQuery)['then'](function(_0x47dfbc){BPromise['all']([handleAdditionalPhones()])[_0x4fc8('0x1d')](function(){_0x5c751b=[];for(var _0x2db672=0x0;_0x2db672\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','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','../../../config/environment','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','error','message','split','then','filter','CmContactHasItem','findOne','update','updated','PHONE'];(function(_0x10f95d,_0x1a2b22){var _0x3f55fb=function(_0x722f89){while(--_0x722f89){_0x10f95d['push'](_0x10f95d['shift']());}};_0x3f55fb(++_0x1a2b22);}(_0xd232,0x74));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var fs=require('fs');var path=require(_0x2d23('0x0'));var _=require('lodash');var Papa=require(_0x2d23('0x1'));var util=require(_0x2d23('0x2'));var BPromise=require(_0x2d23('0x3'));var moment=require(_0x2d23('0x4'));var squel=require(_0x2d23('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0x2d23('0x6'));var logger=require('../../../config/logger')('import');config[_0x2d23('0x7')]=_[_0x2d23('0x8')](config[_0x2d23('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d23('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x2d23('0xa')](_0x2d23('0xb'));var tempTableName=_0x2d23('0xc')+moment()[_0x2d23('0xa')](_0x2d23('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x218df5){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))*$/[_0x2d23('0xe')](_0x218df5);}function selectNotIn(_0x48e0c4,_0x186306,_0x12fab5,_0x3e8253,_0xf65b86){return squel[_0x2d23('0xf')]()[_0x2d23('0x10')](_0x2d23('0x11'))[_0x2d23('0x12')](_0x3e8253)[_0x2d23('0x13')](_0x186306,null,_0x186306+_0x2d23('0x14')+_0x3e8253+'.'+_0x12fab5)[_0x2d23('0x15')](_0x3e8253+'.'+_0x12fab5+_0x2d23('0x16')+_0x48e0c4+'.'+_0x12fab5)['where'](_0x186306+_0x2d23('0x17')+_0xf65b86[_0x2d23('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3cd5b2,_0x344b0c){promisesAdditionalPhones=[];promisesContact=[];return db[_0x2d23('0x18')]['query'](_0x2d23('0x19')+tempTableName)['spread'](function(_0x1b8ac4){if(_0x1b8ac4!==null){var _0x4d0298=[];for(var _0x3ff03e=0x0;_0x3ff03e<_0x1b8ac4[_0x2d23('0x1a')];_0x3ff03e++){var _0x4f5d39=_0x1b8ac4[_0x3ff03e];if(!_['isNil'](_0x4f5d39[_0x2d23('0x11')])){if(!_[_0x2d23('0x1b')](_0x4f5d39[_0x2d23('0x1c')]))_0x4d0298[_0x2d23('0x1d')](insertAdditionalPhones(_0x4f5d39));promisesContact[_0x2d23('0x1d')]({'contact':_0x4f5d39});}}}Promise[_0x2d23('0x1e')](_0x4d0298)['then'](function(){_0x3cd5b2({'val':0x1});});})['catch'](function(_0x3cae33){logger[_0x2d23('0x1f')](_0x3cae33[_0x2d23('0x20')]);});});}function insertAdditionalPhones(_0x5eec6d){return new Promise(function(_0x512e4d,_0x44025e){var _0x3132eb=_0x5eec6d[_0x2d23('0x1c')];if(_[_0x2d23('0x1b')](_0x3132eb))_0x44025e({'val':0x0});else{var _0x57f8c7=_0x3132eb[_0x2d23('0x21')](';');var _0x42eb0d=[];orderBy=0x0;for(var _0x4bc017=0x0;_0x4bc017<_0x57f8c7['length'];_0x4bc017++){_0x42eb0d[_0x2d23('0x1d')](splitAdditionalPhone(_0x5eec6d['id'],_0x57f8c7[_0x4bc017]));}Promise['all'](_0x42eb0d)[_0x2d23('0x22')](function(){_0x512e4d({'val':_0x57f8c7[_0x2d23('0x1a')]});});}});}function splitAdditionalPhone(_0x5a1f1e,_0x32e440){return new Promise(function(_0x2034d4,_0x3aef1d){var _0x5ba94b=_0x32e440[_0x2d23('0x21')](':');var _0x5006fd=_0x5ba94b[0x0];var _0x387504=_0x5ba94b[0x1];if(_0x387504!==''){var _0x4e6c3b=_0x387504[_0x2d23('0x21')]('|');var _0x391d3c=[];for(var _0x5cd513=0x0;_0x5cd513<_0x4e6c3b['length'];_0x5cd513++){if(_0x4e6c3b[_0x5cd513]!==''){var _0x40bee3=_[_0x2d23('0x23')](promisesAdditionalPhones,{'contactId':_0x5a1f1e,'phone':_0x4e6c3b[_0x5cd513]});if(_0x40bee3['length']==0x0){orderBy++;promisesAdditionalPhones[_0x2d23('0x1d')]({'contactId':_0x5a1f1e,'contactTypeId':_0x5006fd,'phone':_0x4e6c3b[_0x5cd513],'orderBy':orderBy});}}}_0x2034d4({'ok':0x1});}else _0x2034d4({'res':0x0});});}function createAdditionalPhone(_0x5f2aed,_0x2a20ca,_0x5e01a7,_0x4a67cf){var _0x39c09c='';var _0x8ad129='';var _0x38b76d=_0x5e01a7[_0x2d23('0x21')]('§');_0x39c09c=_0x38b76d[0x0];if(_0x38b76d[_0x2d23('0x1a')]==0x2)_0x8ad129=_0x38b76d[0x1];return new Promise(function(_0x196cde,_0x479958){return db[_0x2d23('0x24')][_0x2d23('0x25')]({'where':{'CmContactId':_0x5f2aed,'item':_0x39c09c}})[_0x2d23('0x22')](function(_0x3326d2){if(_0x3326d2){return db[_0x2d23('0x24')][_0x2d23('0x26')]({'ItemTypeId':_0x2a20ca,'description':_0x8ad129,'OrderBy':_0x4a67cf},{'where':{'CmContactId':_0x5f2aed,'item':_0x39c09c}})['then'](function(_0x359cf2){_0x196cde({'res':_0x2d23('0x27')});});}else{return db[_0x2d23('0x24')]['create']({'CmContactId':_0x5f2aed,'item':_0x39c09c,'ItemTypeId':_0x2a20ca,'description':_0x8ad129,'OrderBy':_0x4a67cf,'ItemClass':_0x2d23('0x28')})[_0x2d23('0x22')](function(_0x4eb42c){_0x196cde({'res':_0x2d23('0x29')});});}});});}function updateContact(_0x33f559){return new Promise(function(_0x222c43,_0x5b67d7){var _0x2bd97a=_0x33f559['id'];delete _0x33f559['id'];return db[_0x2d23('0x2a')][_0x2d23('0x26')](_0x33f559,{'where':{'id':_0x2bd97a}})[_0x2d23('0x22')](function(_0x5e2352){updatedRows+=0x1;return db[_0x2d23('0x2b')]['update']({'phone':_0x33f559[_0x2d23('0x11')]},{'where':{'ContactId':_0x2bd97a}})['then'](function(_0x268ef8){_0x222c43({'ret':'OK'});});});});}function insertCmHopper(_0x1d58c5,_0x48744c,_0x53f697,_0x473af0,_0xff8095){var _0x278da1=['cm_contacts.phone',_0x2d23('0x2c'),_0x2d23('0x2d'),_0x2d23('0x2e'),_0x48744c+'.'+_0x473af0,_0x2d23('0x2f'),'cm_contacts.updatedAt',_0x2d23('0x30'),_0x2d23('0x31'),'\x22'+_0xff8095+'\x22'];return squel[_0x2d23('0x32')]()[_0x2d23('0x33')](_0x2d23('0x34'))[_0x2d23('0x35')](['phone','scheduledat',_0x2d23('0x36'),'ListId',_0x473af0,_0x2d23('0x37'),_0x2d23('0x38'),_0x2d23('0x39'),_0x2d23('0x3a'),_0x2d23('0x3b')],squel[_0x2d23('0xf')]()[_0x2d23('0x3c')](_0x278da1)[_0x2d23('0x12')](_0x48744c)['join']('cm_contacts',null,_0x2d23('0x3d')+_0x48744c+'.CmListId')[_0x2d23('0x13')](_0x53f697,null,_0x53f697+_0x2d23('0x14')+_0x48744c+'.'+_0x473af0)[_0x2d23('0x15')](_0x48744c+_0x2d23('0x3e'),_0x1d58c5)['where'](_0x2d23('0x3f'),NOW)[_0x2d23('0x15')](_0x2d23('0x40'),selectNotIn(_0x48744c,_0x53f697,_0x473af0,_0x2d23('0x34'),[_0x2d23('0x41'),_0x2d23('0x42')]))[_0x2d23('0x15')](_0x2d23('0x40'),selectNotIn(_0x48744c,_0x53f697,_0x473af0,_0x2d23('0x34'),[_0x2d23('0x41')])))[_0x2d23('0x43')]();}function insertCmHopperBlack(_0x228227,_0x48c7b4,_0x2f89b9,_0x5a40c4){var _0x5b8b52=[_0x2d23('0x44'),'cm_contacts.id',_0x2d23('0x2e'),_0x48c7b4+'.'+_0x5a40c4,_0x2d23('0x2f'),_0x2d23('0x45')];return squel['insert']()[_0x2d23('0x33')]('cm_hopper_black')[_0x2d23('0x35')](['phone',_0x2d23('0x36'),_0x2d23('0x46'),_0x5a40c4,_0x2d23('0x37'),_0x2d23('0x38')],squel[_0x2d23('0xf')]()['fields'](_0x5b8b52)[_0x2d23('0x12')](_0x48c7b4)[_0x2d23('0x13')](_0x2d23('0x47'),null,_0x2d23('0x3d')+_0x48c7b4+'.CmListId')[_0x2d23('0x13')](_0x2f89b9,null,_0x2f89b9+'.id\x20=\x20'+_0x48c7b4+'.'+_0x5a40c4)[_0x2d23('0x15')](_0x48c7b4+_0x2d23('0x3e'),_0x228227)['where'](_0x2d23('0x3f'),NOW)[_0x2d23('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x2d23('0xf')]()[_0x2d23('0x10')]('phone')[_0x2d23('0x12')]('cm_hopper_black')[_0x2d23('0x15')](_0x2d23('0x48'),_0x228227)[_0x2d23('0x15')](_0x5a40c4+_0x2d23('0x49'),_0x48c7b4+'.'+_0x5a40c4)))[_0x2d23('0x43')]();}function insertCmHopperAdditionalPhones(_0x123d2a){var _0x10f21e=[_0x2d23('0x4a'),_0x2d23('0x4b'),_0x2d23('0x4c'),_0x2d23('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0x2d23('0x32')]()[_0x2d23('0x33')](_0x2d23('0x4e'))['fromQuery']([_0x2d23('0x4f'),_0x2d23('0x11'),_0x2d23('0x50'),'createdAt',_0x2d23('0x38')],squel[_0x2d23('0xf')]()['fields'](_0x10f21e)[_0x2d23('0x12')](_0x2d23('0x34'))[_0x2d23('0x13')]('cm_contacts',null,_0x2d23('0x51'))[_0x2d23('0x13')](_0x2d23('0x52'),null,_0x2d23('0x53'))[_0x2d23('0x15')](_0x2d23('0x54'),_0x123d2a)['where'](_0x2d23('0x3f'),NOW))[_0x2d23('0x43')]();}function insertCmContact(_0x49d3aa,_0x5549b0,_0x19d9fa,_0x55838f){var _0x4f03fd=_['concat'](_[_0x2d23('0x55')](_0x55838f),['ListId','CompanyId','createdAt',_0x2d23('0x38')]);return squel[_0x2d23('0x32')]()[_0x2d23('0x33')](_0x2d23('0x47'))[_0x2d23('0x35')](_0x4f03fd,squel[_0x2d23('0xf')]()['fields'](_0x4f03fd)[_0x2d23('0x12')](_0x5549b0)[_0x2d23('0x15')]('('+_0x19d9fa[_0x2d23('0x13')](',')+_0x2d23('0x56'),squel[_0x2d23('0xf')]()[_0x2d23('0x3c')](_0x19d9fa)[_0x2d23('0x12')]('cm_contacts')[_0x2d23('0x15')](_0x2d23('0x48'),_0x49d3aa))[_0x2d23('0x15')](_0x2d23('0x57'),squel['select']()[_0x2d23('0x10')](_0x2d23('0x58'),'min_id')[_0x2d23('0x12')](_0x5549b0)[_0x2d23('0x59')](_0x19d9fa['join'](','))))['toString']();}function handleStop(){logger[_0x2d23('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x25b26d){logger[_0x2d23('0x1f')](_0x25b26d[_0x2d23('0x20')]);process[_0x2d23('0x5b')](0x1);}function handleError(_0x4d3bd3,_0x43779c){stats[_0x2d23('0x5c')][_0x2d23('0x1d')]({'name':_0x43779c[_0x2d23('0x5d')],'message':_0x43779c[_0x2d23('0x20')],'row':_0x4d3bd3});}function handleQuery(_0x1eaf10){logger['info'](_0x1eaf10);return db[_0x2d23('0x18')]['query'](_0x1eaf10)[_0x2d23('0x5e')](function(_0x4f83fe){results[_0x2d23('0x1d')](_0x4f83fe);})[_0x2d23('0x5f')](function(_0x4e5f72){logger[_0x2d23('0x1f')](_0x4e5f72[_0x2d23('0x20')]);});}function main(_0x2aa57d,_0x4485e8,_0xf3e553,_0x333548){logger[_0x2d23('0x5a')]('main',_0x2aa57d,JSON[_0x2d23('0x60')](_0x4485e8));process[_0x2d23('0x61')]('start');var _0x56d5da=_0x4485e8[_0x2d23('0x62')];var _0x348666=_[_0x2d23('0x63')](_0x56d5da);var _0x4c3242=_0x4485e8[_0x2d23('0x64')];var _0x2c3fe4=path[_0x2d23('0x13')](config[_0x2d23('0x65')],'server/files/tmp',_0x4c3242+_0x2d23('0x66'));logger[_0x2d23('0x5a')]('body',_0x4485e8);db[_0x2d23('0x67')][_0x2d23('0x68')]({'raw':!![],'attributes':['id',_0x2d23('0x69')]})[_0x2d23('0x22')](function(_0x26a4ae){for(var _0x456376=0x0;_0x456376<_0x26a4ae['length'];_0x456376++){if(_0x26a4ae[_0x456376][_0x2d23('0x69')]in _0x56d5da){contactItemTypes['push'](_0x26a4ae[_0x456376]);delete _0x348666[_0x26a4ae[_0x456376]['name']];hasAdditionalPhones=!![];}for(var _0x3f23f5 in _0x56d5da){if(_0x26a4ae[_0x456376][_0x2d23('0x69')]+_0x2d23('0x6a')===_0x3f23f5){phoneDescriptions[_0x2d23('0x1d')]({'itemTypeId':_0x26a4ae[_0x456376]['id'],'description':_0x3f23f5});delete _0x348666[_0x3f23f5];}}}if(hasAdditionalPhones)_0x348666[_0x2d23('0x1c')]='';var _0x159258=_['keys'](_0x348666)[_0x2d23('0x13')]();logger[_0x2d23('0x5a')](_0x2d23('0x6b'),_0x159258);fs['writeFileSync'](_0x2c3fe4,_0x159258+'\x0a');Papa[_0x2d23('0x6c')](fs[_0x2d23('0x6d')](_0x2aa57d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2826ec,_0x54b801){try{for(var _0xa566ff=0x0,_0x273d79=[];_0xa566ff<_0x2826ec[_0x2d23('0x6e')][_0x2d23('0x1a')];_0xa566ff++){stats['rows']+=0x1;if(_0x2826ec[_0x2d23('0x5c')][_0xa566ff]){handleError(_0x2826ec[_0x2d23('0x6e')][_0xa566ff],_0x2826ec[_0x2d23('0x5c')][_0xa566ff]);}else{var _0x5159f6=[];var _0x4ed277=[];var _0x1c0eeb={};for(var _0xe900bd in _0x56d5da){let _0x3bd89c=contactItemTypes['find'](_0x3cd3fa=>_0x3cd3fa['name']===_0xe900bd);let _0x456024=contactItemTypes[_0x2d23('0x6f')](_0x209f81=>_0x209f81['name']+'_description'===_0xe900bd);if(_['isNil'](_0x3bd89c)&&_['isNil'](_0x456024)){if(_0x56d5da['hasOwnProperty'](_0xe900bd)){if(_0x2826ec['data'][_0xa566ff][_0x56d5da[_0xe900bd]]){var _0x2b11cb=_['trim'](_0x2826ec[_0x2d23('0x6e')][_0xa566ff][_0x56d5da[_0xe900bd]][_0x2d23('0x70')](/"/g,'\x27'));switch(_0xe900bd){case _0x2d23('0x71'):var _0x3fe114=moment(_0x2b11cb,_0x2d23('0xb'),!![]);if(_0x3fe114[_0x2d23('0x72')]()){_0x273d79[_0x2d23('0x1d')]('\x22'+_0x2b11cb+'\x22');}else{_0x5159f6[_0x2d23('0x1d')](_0x2d23('0x73'));}break;case _0x2d23('0x39'):var _0x755dc5=parseInt(_0x2b11cb);_0x2b11cb=_['isNaN'](_0x755dc5)||_0x755dc5<0x0||_0x755dc5>0x4?_0x333548?0x3:0x2:_0x755dc5;_0x273d79['push']('\x22'+_0x2b11cb+'\x22');break;case'UserId':var _0x485141=parseInt(_0x2b11cb);if(_[_0x2d23('0x74')](_0x485141)&&_[_0x2d23('0x75')](_0xf3e553,_0x485141)){_0x273d79[_0x2d23('0x1d')]('\x22'+_0x485141+'\x22');}else{_0x5159f6[_0x2d23('0x1d')]('agent\x20not\x20exists');}break;case _0x2d23('0x76'):if(isEmail(_0x2b11cb)){_0x273d79[_0x2d23('0x1d')]('\x22'+_0x2b11cb+'\x22');}else{_0x5159f6[_0x2d23('0x1d')](_0x2d23('0x77'));}break;case _0x2d23('0x78'):var _0x31007c=moment(_0x2b11cb,_0x2d23('0x79'),!![]);if(_0x31007c[_0x2d23('0x72')]()){_0x273d79[_0x2d23('0x1d')]('\x22'+_0x2b11cb+'\x22');}else{_0x5159f6['push'](_0x2d23('0x7a'));}break;default:_0x273d79[_0x2d23('0x1d')]('\x22'+_0x2b11cb+'\x22');}}else{switch(_0xe900bd){case _0x2d23('0x7b'):case _0x2d23('0x11'):_0x5159f6[_0x2d23('0x1d')](_0xe900bd+_0x2d23('0x7c'));break;default:_0x273d79['push']('\x22\x22');}}}}else{var _0xf01b60='';if(!_[_0x2d23('0x1b')](_0x3bd89c)){if(!_0x1c0eeb[_0x2d23('0x7d')](_0x3bd89c['id'])){for(var _0x5d8144=0x0;_0x5d8144<_0x56d5da[_0xe900bd][_0x2d23('0x1a')];_0x5d8144++){var _0x2b11cb=_[_0x2d23('0x7e')](_0x2826ec[_0x2d23('0x6e')][_0xa566ff][_0x56d5da[_0xe900bd][_0x5d8144]][_0x2d23('0x70')](/"/g,'\x27'));var _0x1f538d=phoneDescriptions[_0x2d23('0x6f')](_0x48872b=>_0x48872b[_0x2d23('0x7f')]===_0x3bd89c['id']);if(!_['isNil'](_0x1f538d)){var _0x2ba691=_['trim'](_0x2826ec[_0x2d23('0x6e')][_0xa566ff][_0x56d5da[_0x1f538d[_0x2d23('0x80')]][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x2ba691))_0x2b11cb=_0x2b11cb+'§'+_0x2ba691;}if(_0xf01b60=='')_0xf01b60=_0x2b11cb;else _0xf01b60+='|'+_0x2b11cb;}_0x4ed277[_0x2d23('0x1d')](_0x3bd89c['id']+':'+_0xf01b60);_0x1c0eeb[_0x3bd89c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x273d79[_0x2d23('0x1d')]('\x22'+_0x4ed277[_0x2d23('0x13')](';')+'\x22');}if(_0x5159f6[_0x2d23('0x1a')]){handleError(_0x2826ec[_0x2d23('0x6e')][_0xa566ff],{'code':_0x2d23('0x81'),'message':_0x5159f6[_0x2d23('0x13')]()});}else{fs[_0x2d23('0x82')](_0x2c3fe4,_0x273d79[_0x2d23('0x13')]()+'\x0a');}_0x273d79=[];}if(!(stats['rows']%0xc8)){socket[_0x2d23('0x83')](_0x2d23('0x84')+_0x4c3242,stats);stats[_0x2d23('0x5c')]=[];}}if(stopped){logger[_0x2d23('0x5a')](_0x2d23('0x85'));_0x54b801[_0x2d23('0x86')]();}}catch(_0x112ab8){handleError(_0x2826ec[_0x2d23('0x6e')][_0xa566ff],{'code':_0x2d23('0x87'),'message':_0x112ab8[_0x2d23('0x20')]});logger[_0x2d23('0x1f')]('step',_0x112ab8[_0x2d23('0x20')]);}},'complete':function(){try{var _0x386e31=[];var _0x67cbf=tempTableName;_0x386e31[_0x2d23('0x1d')](_0x2d23('0x88')+_0x67cbf+_0x2d23('0x89'));logger[_0x2d23('0x5a')]('CIS\x20len',contactItemTypes[_0x2d23('0x1a')]);var _0xdcb56c=util[_0x2d23('0xa')](_0x2d23('0x8a'),_0x2c3fe4,_0x67cbf,_0x159258,_0x4485e8[_0x2d23('0x46')],_0x4485e8['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x56d5da[_0x2d23('0x71')])){_0xdcb56c+=_0x2d23('0x8b');}_0x386e31[_0x2d23('0x1d')](_0xdcb56c);BPromise['each'](_0x386e31,handleQuery)[_0x2d23('0x22')](function(_0x3bc1ca){BPromise[_0x2d23('0x1e')]([handleAdditionalPhones()])[_0x2d23('0x22')](function(){_0x386e31=[];for(var _0x1d5908=0x0;_0x1d5908\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\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.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','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.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','COUNT(*)','getSelectedTags','t.id\x20IN\x20?','QueryTypes','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','select','field','color','from','tools_tags','user_has_','_interactions','u.id','ui.','left_join','users','length','where','map','getInteractionsTables','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','me.','it.','\x20=\x20i.id','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','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(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','name','buildExpression','type','text','start','unreadMessages','value','read','Contact','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','end','Tag','tags','clause','ids','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','and','\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','chat','Websites','Accounts'];(function(_0x4ec9d3,_0x38dc23){var _0x285760=function(_0x382227){while(--_0x382227){_0x4ec9d3['push'](_0x4ec9d3['shift']());}};_0x285760(++_0x38dc23);}(_0x8ecb,0xea));var _0xb8ec=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x8ecb[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var squel=require(_0xb8ec('0x0'));var as=require(_0xb8ec('0x1'));var qs=require(_0xb8ec('0x2'));var updateInteraction=require(_0xb8ec('0x3'))[_0xb8ec('0x4')];var utils=require(_0xb8ec('0x5'));var db=require(_0xb8ec('0x6'))['db'];function skipInteractionsQuery(_0x26cc89,_0x3dce8b,_0x1de089){var _0x16e3bd=![];var _0x279b1e=utils[_0xb8ec('0x7')](_0x26cc89);if(_0x3dce8b[_0xb8ec('0x8')]==='agent'&&!_0x1de089['search']&&!_0x1de089[_0x279b1e]){_0x16e3bd=!![];}return _0x16e3bd;}function getTagsQuery(){return squel[_0xb8ec('0x9')]()['field']('id')[_0xb8ec('0xa')]('name')[_0xb8ec('0xa')](_0xb8ec('0xb'))[_0xb8ec('0xc')](_0xb8ec('0xd'));}function getUsersQuery(_0x3fe12f,_0x28e7f1){var _0x4774a3=utils['getInteractionFK'](_0x3fe12f);var _0x1c90aa=_0xb8ec('0xe')+_0x3fe12f+_0xb8ec('0xf');var _0x48e15d=squel[_0xb8ec('0x9')]()[_0xb8ec('0xa')](_0xb8ec('0x10'))[_0xb8ec('0xa')]('u.fullname')['field'](_0xb8ec('0x11')+_0x4774a3)[_0xb8ec('0xc')](_0x1c90aa,'ui')[_0xb8ec('0x12')](_0xb8ec('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x28e7f1[_0xb8ec('0x14')]>0x0){_0x48e15d[_0xb8ec('0x15')](_0xb8ec('0x11')+_0x4774a3+'\x20IN\x20?',_[_0xb8ec('0x16')](_0x28e7f1,'id'));}return _0x48e15d;}function getInteractionsQuery(_0xbfc486){var _0x422af0=utils[_0xb8ec('0x17')](_0xbfc486);var _0x2ac6e6=utils[_0xb8ec('0x7')](_0xbfc486);var _0x20cef0=utils[_0xb8ec('0x18')](_0xbfc486);return squel[_0xb8ec('0x9')]()['from'](_0x422af0[_0xb8ec('0x19')],'i')[_0xb8ec('0x12')](_0xb8ec('0x1a'),'c',_0xb8ec('0x1b'))[_0xb8ec('0x12')](_0xb8ec('0x13'),'o',_0xb8ec('0x1c'))[_0xb8ec('0x12')](_0x422af0[_0xb8ec('0x1d')],'a','a.id\x20=\x20i.'+_0x2ac6e6)[_0xb8ec('0x12')](_0x422af0['messages'],'me',_0xb8ec('0x1e')+_0x20cef0+'\x20=\x20i.id')['left_join'](_0x422af0['interactionsTags'],'it',_0xb8ec('0x1f')+_0x20cef0+_0xb8ec('0x20'))['left_join'](_0xb8ec('0xd'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x35dd43={'body':squel[_0xb8ec('0x21')](),'contact':squel[_0xb8ec('0x21')](),'default':squel[_0xb8ec('0x21')](),'fields':squel[_0xb8ec('0x21')](),'filter':squel[_0xb8ec('0x21')](),'read':squel[_0xb8ec('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xb8ec('0x21')]()};return _0x35dd43;}function parseTagParameter(_0x51e0fe){var _0x2921f2=squel[_0xb8ec('0x21')]();if(_0x51e0fe){var _0x17aec4=utils['getSelectedTags'](_0x51e0fe);_0x17aec4[_0xb8ec('0x22')](function(_0x29355b){_0x2921f2['or'](_0xb8ec('0x23'),'%,'+_0x29355b+',%');});}return _0x2921f2;}function parseReadParameter(_0x363f78){var _0x1d3893='';if(_0x363f78){_0x1d3893=_0xb8ec('0x24');if(_0x363f78==='1'){_0x1d3893=_0x1d3893['replace'](_0xb8ec('0x25'),'=');}else{_0x1d3893=_0x1d3893[_0xb8ec('0x26')](_0xb8ec('0x25'),'>');}}return _0x1d3893;}function parseSearchFilter(_0x4f2cbb,_0x2aafc4){var _0x3be876=squel[_0xb8ec('0x21')]();if(_0x2aafc4){var _0xfff609=_0x2aafc4[_0xb8ec('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb8ec('0x27')](_0xfff609)){_0x3be876['or'](_0xb8ec('0x28'),_0xfff609+'%');if([_0xb8ec('0x29'),_0xb8ec('0x2a')][_0xb8ec('0x2b')](_0x4f2cbb)){_0x3be876['or']('i.phone\x20LIKE\x20?',_0xfff609+'%');}else if(_0x4f2cbb===_0xb8ec('0x2c')){_0x3be876['or'](_0xb8ec('0x2d'),_0xfff609+'%');}else if(_0x4f2cbb===_0xb8ec('0x2e')){_0x3be876['or']('i.from\x20LIKE\x20?',_0xfff609+'%');}}else if(_0x4f2cbb===_0xb8ec('0x2f')&&qs[_0xb8ec('0x30')](_0xfff609)){_0x3be876['or'](_0xb8ec('0x31'),_0xfff609+'%');}else{if(_0x4f2cbb===_0xb8ec('0x2f')){_0x3be876['or'](_0xb8ec('0x32'),qs[_0xb8ec('0x33')](_0xfff609,!![]))['or'](_0xb8ec('0x34'),qs[_0xb8ec('0x33')](_0xfff609));}else if(_0x4f2cbb!==_0xb8ec('0x2c')){_0x3be876['or'](_0xb8ec('0x35'),qs[_0xb8ec('0x33')](_0xfff609));}_0x3be876['or'](_0xb8ec('0x36'),qs['getFullTextValue'](_0xfff609,!![]),null);}}return _0x3be876;}function parseAdvancedSearchFilter(_0x547d78,_0x2efd63){var _0x2525fb=getSqlClauses();var _0x5296f2=as[_0xb8ec('0x37')](_0x547d78);var _0x56b37a=_0x5296f2[_0xb8ec('0x38')];for(var _0x33ca67=0x0;_0x33ca67<_0x5296f2[_0xb8ec('0x39')][_0xb8ec('0x14')];_0x33ca67++){var _0xa76fd7=_0x5296f2['conditions'][_0x33ca67];var _0x5eb106='i';var _0x1d4b5c=_['find'](_0x2efd63,[_0xb8ec('0x3a'),_0xa76fd7[_0xb8ec('0xa')]]);if(_0x1d4b5c){var _0x215b0d=as[_0xb8ec('0x3b')](_0x5eb106,_0x1d4b5c[_0xb8ec('0x3c')],_0xa76fd7);_0x2525fb['default'][_0x56b37a](_0x215b0d[_0xb8ec('0x3d')],_0x215b0d['value'][_0xb8ec('0x3e')],_0x215b0d['value']['end']);}else{switch(_0xa76fd7[_0xb8ec('0xa')]){case _0xb8ec('0x3f'):var _0x2a539d=parseReadParameter(_0xa76fd7[_0xb8ec('0x40')]);_0x2525fb[_0xb8ec('0x41')]['and'](_0x2a539d);break;case _0xb8ec('0x42'):if(_0xa76fd7['operator']==='$substring'){if(_0xa76fd7['value'][_0xb8ec('0x43')]('\x20')[_0xb8ec('0x14')]>0x1){_0x2525fb[_0xb8ec('0x44')][_0x56b37a](_0xb8ec('0x36'),qs[_0xb8ec('0x33')](_0xa76fd7[_0xb8ec('0x40')],!![]),null);}else{var _0x5049a8='%'+_0xa76fd7[_0xb8ec('0x40')]+'%';_0x2525fb[_0xb8ec('0x44')][_0x56b37a](_0xb8ec('0x45'),_0x5049a8,_0x5049a8,_0x5049a8);}}else{_0x1d4b5c=_[_0xb8ec('0x46')](_0x2efd63,[_0xb8ec('0x3a'),_0xb8ec('0x47')]);_0xa76fd7[_0xb8ec('0xa')]=_0xb8ec('0x47');_0x215b0d=as[_0xb8ec('0x3b')](_0x5eb106,_0x1d4b5c['type'],_0xa76fd7);_0x2525fb[_0xb8ec('0x44')][_0x56b37a](_0x215b0d['text'],_0x215b0d[_0xb8ec('0x40')][_0xb8ec('0x3e')],_0x215b0d['value'][_0xb8ec('0x48')]);}break;case _0xb8ec('0x49'):var _0x11a33a=_0xa76fd7['value'][_0xb8ec('0x43')](',')[_0xb8ec('0x16')](function(_0x33fc29){return Number(_0x33fc29);});var _0x274339=parseTagParameter(_0x11a33a);_0x2525fb[_0xb8ec('0x4a')][_0xb8ec('0x4b')]['and'](_0x274339);_0x2525fb[_0xb8ec('0x4a')][_0xb8ec('0x4c')]=_0x11a33a;break;case _0xb8ec('0x4d'):if(_0xa76fd7['operator']===_0xb8ec('0x4e')){_0x2525fb[_0xb8ec('0x4f')][_0x56b37a](_0xb8ec('0x50'),'%'+_0xa76fd7[_0xb8ec('0x40')]+'%',null);}else{_0x1d4b5c=_[_0xb8ec('0x46')](_0x2efd63,[_0xb8ec('0x3a'),_0xb8ec('0x51')]);_0xa76fd7[_0xb8ec('0xa')]='UserId';_0x215b0d=as[_0xb8ec('0x3b')](_0x5eb106,_0x1d4b5c[_0xb8ec('0x3c')],_0xa76fd7);_0x2525fb[_0xb8ec('0x4f')][_0x56b37a](_0x215b0d[_0xb8ec('0x3d')],_0x215b0d[_0xb8ec('0x40')][_0xb8ec('0x3e')],_0x215b0d[_0xb8ec('0x40')]['end']);}break;case _0xb8ec('0x52'):case _0xb8ec('0x53'):_0x215b0d=as[_0xb8ec('0x3b')]('me',null,_0xa76fd7);_0x2525fb['body'][_0x56b37a](_0x215b0d[_0xb8ec('0x3d')],_0x215b0d[_0xb8ec('0x40')][_0xb8ec('0x3e')],_0x215b0d['value'][_0xb8ec('0x48')]);break;}}}return _0x2525fb;}function parseModelFields(_0x57c6f1,_0x1bf118,_0x5667da){var _0x332c1f=utils['getAccountFK'](_0x57c6f1);var _0x529475=squel[_0xb8ec('0x21')]();var _0x251852=_(_0x1bf118)[_0xb8ec('0x54')]()['map'](function(_0x1d61b3){return _[_0xb8ec('0x55')](_0x5667da,['name',_0x1d61b3])?_0x1d61b3:undefined;})[_0xb8ec('0x56')]()[_0xb8ec('0x40')]();if(_0x251852[_0xb8ec('0x14')]>0x0){_0x251852[_0xb8ec('0x22')](function(_0x456d73){if(_0x456d73===_0x332c1f){_0x529475[_0xb8ec('0x57')]('i.'+_0x332c1f+_0xb8ec('0x58'),[]['concat'](_0x1bf118[_0x456d73]));}else if(_0x456d73===_0xb8ec('0x59')){var _0x1fe061=JSON[_0xb8ec('0x5a')](_0x1bf118[_0x456d73])['$gte'];var _0x490073=JSON[_0xb8ec('0x5a')](_0x1bf118[_0x456d73])[_0xb8ec('0x5b')];_0x529475['and'](_0xb8ec('0x5c'),_0x1fe061,_0x490073);}else{if(_0x1bf118[_0x456d73]===_0xb8ec('0x5d')){_0x529475[_0xb8ec('0x57')]('i.'+_0x456d73+_0xb8ec('0x5e'));}else{_0x529475[_0xb8ec('0x57')]('i.'+_0x456d73+_0xb8ec('0x5f'),_0x1bf118[_0x456d73]);}}});}return _0x529475;}function parseQueryParameters(_0xc713b7,_0x52d864,_0x586b14){var _0x2324e7=getSqlClauses();return Promise[_0xb8ec('0x60')]()[_0xb8ec('0x61')](function(){return parseModelFields(_0xc713b7,_0x52d864,_0x586b14);})[_0xb8ec('0x61')](function(_0x38f4da){_0x2324e7[_0xb8ec('0x62')][_0xb8ec('0x57')](_0x38f4da);return parseReadParameter(_0x52d864['read']);})['then'](function(_0x32fc02){_0x2324e7[_0xb8ec('0x41')]['and'](_0x32fc02);return parseTagParameter(_0x52d864[_0xb8ec('0x63')]);})[_0xb8ec('0x61')](function(_0x1d62ed){_0x2324e7[_0xb8ec('0x4a')][_0xb8ec('0x4b')][_0xb8ec('0x57')](_0x1d62ed);return parseSearchFilter(_0xc713b7,_0x52d864[_0xb8ec('0x64')]);})[_0xb8ec('0x61')](function(_0x10a1d1){_0x2324e7['filter']=_0x10a1d1;return _0x2324e7;});}function checkAccountsRestrictions(_0x182dde,_0x2653a7,_0x1afc3c){var _0x4ac45e=utils['getAccountFK'](_0x182dde);var _0x1db40e='get'+_['capitalize'](_0x182dde)+(_0x182dde===_0xb8ec('0x65')?_0xb8ec('0x66'):_0xb8ec('0x67'));var _0x58d346=squel[_0xb8ec('0x21')]();return Promise[_0xb8ec('0x60')]()[_0xb8ec('0x61')](function(){if(_0x1afc3c['search']&&_0x2653a7[_0xb8ec('0x8')]===_0xb8ec('0x68')){return _0x2653a7[_0x1db40e]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x7fffb5){if(_0x7fffb5){if(_0x7fffb5[_0xb8ec('0x14')]===0x0){_0x58d346['and']('i.'+_0x4ac45e+_0xb8ec('0x5e'));}else{_0x58d346['and']('i.'+_0x4ac45e+_0xb8ec('0x58'),_['map'](_0x7fffb5,'id'));}}else if(!_0x1afc3c[_0x4ac45e]){_0x58d346[_0xb8ec('0x57')]('i.'+_0x4ac45e+_0xb8ec('0x69'));}})[_0xb8ec('0x61')](function(){return _0x58d346;});}function getClosedOrderClause(_0x368cdb,_0x202954){var _0x461734='';var _0x587f32=[_0xb8ec('0x6a'),_0xb8ec('0x6b'),'i.disposition'];if(_0x368cdb===_0xb8ec('0x2f')){_0x587f32[_0xb8ec('0x6c')]('i.substatus');}if(_0x202954[_0xb8ec('0x6d')]==='0'&&_0x368cdb===_0xb8ec('0x2f')){_0x461734=_0xb8ec('0x6e');}else{if(_0x202954[_0xb8ec('0x6d')]==='1'){_0x587f32[_0xb8ec('0x6f')]();}_0x461734=_0xb8ec('0x70')+_0x587f32[_0xb8ec('0x71')](',\x20')+')';}return _0x461734;}function getFilteredInteractions(_0x1f6dde,_0x4eae11,_0x2323b7,_0x1aa491){var _0x500492=utils['getInteractionFK'](_0x1f6dde);var _0x3da7b1=_[_0xb8ec('0x72')](_0x1f6dde)+_0xb8ec('0x73');var _0x563a65=[];var _0x4e0494=getTagsQuery();var _0x29daa8={'type':db[_0xb8ec('0x74')]['QueryTypes'][_0xb8ec('0x75')],'raw':!![]};var _0x235cdb=[];var _0x16e92a=[];return db[_0xb8ec('0x76')][_0xb8ec('0x77')](_0x4e0494[_0xb8ec('0x78')](),_0x29daa8)[_0xb8ec('0x61')](function(_0x455f47){_0x563a65=_[_0xb8ec('0x79')](_0x455f47,'id');_0x29daa8=_[_0xb8ec('0x7a')](_0x29daa8,{'model':db[_0x3da7b1],'mapToModel':!![],'nest':!![]});if(_0x2323b7[_0xb8ec('0x62')]){_0x1aa491[_0xb8ec('0x7b')][_0xb8ec('0x22')](function(_0x340ed8){_0x4eae11[_0xb8ec('0xa')]('i.'+_0x340ed8);});}else{_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x7c'),_0xb8ec('0x3f'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x7d'),_0xb8ec('0x7e'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x7f'),_0xb8ec('0x80'));if(_0x1f6dde===_0xb8ec('0x2f')){_0x4eae11['field'](_0xb8ec('0x81'),'Account.email');_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x82'),_0xb8ec('0x83'));_0x4eae11['field'](_0xb8ec('0x84'));_0x4eae11['field'](_0xb8ec('0x85'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x86'));_0x4eae11['field'](_0xb8ec('0x87'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x88'));_0x4eae11['field'](_0xb8ec('0x89'));_0x4eae11[_0xb8ec('0xa')]('i.lastMsgAt');_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x8a'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x8b'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x8c'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x6b'));_0x4eae11['field'](_0xb8ec('0x6a'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x6e'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x8d'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x8e'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x8f'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x90'));}else if(_0x1f6dde===_0xb8ec('0x2e')){_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x91'),_0xb8ec('0x83'));}else{_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x92'),'contactName');}if(_0x1f6dde!==_0xb8ec('0x2f')){_0x4eae11[_0xb8ec('0xa')]('i.*');}_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x93'),'Contact.firstName');_0x4eae11[_0xb8ec('0xa')]('c.lastName',_0xb8ec('0x94'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x95'),_0xb8ec('0x96'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x97'),'Contact.phone');_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x98'),'Contact.mobile');_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x99'),_0xb8ec('0x9a'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x9b'),_0xb8ec('0x9c'));_0x4eae11[_0xb8ec('0xa')](_0xb8ec('0x9d'),'Owner.internal');_0x4eae11[_0xb8ec('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb8ec('0x9e'));}if(_0x1aa491['limit']){_0x4eae11[_0xb8ec('0x9f')](_0x1aa491['limit']);}if(_0x1aa491[_0xb8ec('0xa0')]){_0x4eae11[_0xb8ec('0xa0')](_0x1aa491[_0xb8ec('0xa0')]);}return db[_0xb8ec('0x76')]['query'](_0x4eae11['toString'](),_0x29daa8);})[_0xb8ec('0x61')](function(_0x4647ba){_0x235cdb=_0x4647ba;var _0x166a5e=getUsersQuery(_0x1f6dde,_0x235cdb);return db[_0xb8ec('0x76')][_0xb8ec('0x77')](_0x166a5e[_0xb8ec('0x78')](),_0x29daa8);})[_0xb8ec('0x61')](function(_0x3850cd){_0x16e92a=_['groupBy'](_0x3850cd,_0x500492);if(_0x1f6dde===_0xb8ec('0x2f')){return db[_0xb8ec('0xa1')][_0xb8ec('0xa2')]({'attributes':[_0xb8ec('0xa3')],'raw':!![]});}})['then'](function(_0x4fc498){var _0x3626b0=_0x4fc498?_0x4fc498[_0xb8ec('0xa3')]:undefined;var _0x5189b6=_0x235cdb['map'](function(_0x3435c7){return updateInteraction(_0x3435c7,_0x563a65,_0x16e92a,_0x3626b0);});return Promise[_0xb8ec('0xa4')](_0x5189b6);});}function countFilteredInteractions(_0x471515,_0x4d5e05){var _0x3070f4=_0x471515['clone']();_0x3070f4[_0xb8ec('0xa')](_0xb8ec('0xa5'));_0x3070f4[_0xb8ec('0xa')](_0xb8ec('0x7c'),_0xb8ec('0x3f'));var _0x3a9b28=utils[_0xb8ec('0xa6')](_0x4d5e05);if(!_['isEmpty'](_0x3a9b28)){_0x3070f4[_0xb8ec('0x15')](_0xb8ec('0xa7'),_0x3a9b28);}var _0x322753={'type':db['Sequelize'][_0xb8ec('0xa8')]['SELECT'],'raw':!![]};return db[_0xb8ec('0x76')][_0xb8ec('0x77')](_0x3070f4[_0xb8ec('0x78')](),_0x322753);}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 _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 diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index ccdc8f3..8e9e980 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 _0x3578=['updateInteraction','TagIds','../../mysqldb','fullname','split','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','disposition','answered','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','catch'];(function(_0x581cf1,_0x51a280){var _0x46f801=function(_0x17c897){while(--_0x17c897){_0x581cf1['push'](_0x581cf1['shift']());}};_0x46f801(++_0x51a280);}(_0x3578,0x1ca));var _0x8357=function(_0x50a1f6,_0x238fd8){_0x50a1f6=_0x50a1f6-0x0;var _0x84f8d4=_0x3578[_0x50a1f6];return _0x84f8d4;};'use strict';var _=require('lodash');var db=require(_0x8357('0x0'))['db'];function getInteractionUsers(_0x5ddaa2,_0x3a51b1){return new Promise(function(_0x41766d,_0x19733f){try{var _0x50c581=[];if(_0x3a51b1[_0x5ddaa2]){_0x50c581=_0x3a51b1[_0x5ddaa2]['map'](function(_0x37079d){return{'id':_0x37079d['id'],'fullname':_0x37079d[_0x8357('0x1')]};});}return _0x41766d(_0x50c581);}catch(_0x3485b9){_0x19733f(_0x3485b9);}});}function getInteractionTags(_0xa7208c,_0x4ce16b){var _0x5aca84=[];if(_0xa7208c){_0xa7208c[_0x8357('0x2')](',')[_0x8357('0x3')](function(_0x7fcbc){_0x5aca84[_0x8357('0x4')](_0x4ce16b[_0x7fcbc]);});}return _0x5aca84;}function updateWaitingCounter(_0x4523fa){if(_0x4523fa[_0x8357('0x5')]){_0x4523fa[_0x8357('0x5')]-=0x1;}}function updateInteractionCounters(_0xd1bce1){_0xd1bce1[_0x8357('0x5')]=0x0;_0xd1bce1[_0x8357('0x6')]=0x0;_0xd1bce1['answered']=0x0;_0xd1bce1[_0x8357('0x7')]=0x0;_0xd1bce1[_0x8357('0x8')]=0x0;_0xd1bce1[_0x8357('0x9')]=0x0;if(_0xd1bce1[_0x8357('0xa')]){if(_0xd1bce1[_0x8357('0xb')]==='abandoned'){_0xd1bce1[_0x8357('0x8')]+=0x1;updateWaitingCounter(_0xd1bce1);}if(_0xd1bce1['UserId']){_0xd1bce1[_0x8357('0xc')]+=0x1;if(_0xd1bce1[_0x8357('0x6')]){_0xd1bce1[_0x8357('0x6')]-=0x1;}}else{if(_0xd1bce1[_0x8357('0xb')]){_0xd1bce1[_0x8357('0x7')]+=0x1;updateWaitingCounter(_0xd1bce1);}}}else{if(!_0xd1bce1[_0x8357('0xd')]){_0xd1bce1[_0x8357('0x5')]+=0x1;}if(_0xd1bce1['UserId']){_0xd1bce1['talking']+=0x1;updateWaitingCounter(_0xd1bce1);}}_0xd1bce1[_0x8357('0x9')]+=0x1;return _0xd1bce1;}function getLastMessageText(_0x8f2f06){return db[_0x8357('0xe')][_0x8357('0xf')]({'where':{'$and':[{'MailInteractionId':_0x8f2f06['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8357('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8357('0x11')],'order':_0x8357('0x12'),'raw':!![]})[_0x8357('0x13')](function(_0x5955cf){if(_0x5955cf&&_0x5955cf[_0x8357('0x11')]){_0x8f2f06[_0x8357('0x14')]=_['trimStart'](_0x5955cf['plainBody']);}return _0x8f2f06;})[_0x8357('0x15')](function(_0x265433){throw _0x265433;});}exports[_0x8357('0x16')]=function(_0x2dcf98,_0x16dcd6,_0x6dfd7a,_0x30394b){return new Promise(function(_0x2f7c56,_0x156a5a){return getInteractionUsers(_0x2dcf98['id'],_0x6dfd7a)[_0x8357('0x13')](function(_0x2bdbe3){_0x2dcf98['Users']=_0x2bdbe3;return getInteractionTags(_0x2dcf98[_0x8357('0x17')],_0x16dcd6);})[_0x8357('0x13')](function(_0x59b22e){_0x2dcf98['Tags']=_0x59b22e;delete _0x2dcf98[_0x8357('0x17')];return updateInteractionCounters(_0x2dcf98);})[_0x8357('0x13')](function(_0x4d132b){if(_0x30394b){return getLastMessageText(_0x4d132b);}else{return _0x4d132b;}})['then'](function(_0x39cd13){_0x2f7c56(_0x39cd13);})['catch'](function(_0x52965c){_0x156a5a(_0x52965c);});});}; \ No newline at end of file +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 diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index cd117bd..e2ac42f 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 _0xbf77=['unknown','accounts','_interactions','_interaction_has_tags','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','mail-interactions','fax-interactions','../../config/logger','chat','Website','capitalize','InteractionId','upperFirst'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xbf77,0x6a));var _0x7bf7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xbf77[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x7bf7('0x0'));var db=require(_0x7bf7('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require('../../config/logger')(_0x7bf7('0x2')),'fax':require('../../config/logger')(_0x7bf7('0x3')),'sms':require(_0x7bf7('0x4'))('sms-interactions'),'chat':require(_0x7bf7('0x4'))('chat-interactions'),'whatsapp':require(_0x7bf7('0x4'))('whatsapp-interactions')};function getAccountFK(_0x314313){return _['capitalize'](_0x314313)+(_0x314313===_0x7bf7('0x5')?_0x7bf7('0x6'):'Account')+'Id';}function getInteractionFK(_0x23f2c0){return _[_0x7bf7('0x7')](_0x23f2c0)+_0x7bf7('0x8');}function getInteractionId(_0x327c1c,_0x64d8ea,_0x4166f2){if(_0x327c1c&&_0x327c1c[_[_0x7bf7('0x9')](_0x4166f2)+_0x7bf7('0x8')]){return _0x327c1c[_[_0x7bf7('0x9')](_0x4166f2)+_0x7bf7('0x8')];}else if(_0x327c1c&&_0x327c1c['id']){return _0x327c1c['id'];}else if(_0x64d8ea&&_0x64d8ea['id']){return _0x64d8ea['id'];}else{return _0x7bf7('0xa');}}function getInteractionsTables(_0x538279){return{'accounts':_0x538279+'_'+(_0x538279===_0x7bf7('0x5')?'websites':_0x7bf7('0xb')),'interactions':_0x538279+_0x7bf7('0xc'),'interactionsTags':_0x538279+_0x7bf7('0xd'),'messages':_0x538279+_0x7bf7('0xe'),'userInteractions':'user_has_'+_0x538279+_0x7bf7('0xc')};}function getSelectedTags(_0x525122){var _0x17f9ca=[];if(_0x525122){_0x17f9ca=Array['isArray'](_0x525122)?_0x525122:[_0x525122];}return _0x17f9ca;}function log(_0x44f6f5,_0x51f8c4,_0x1bd295,_0xb62bcd,_0x392798,_0x5d9f02){loggers[_0x392798[_0x7bf7('0xf')]()][_0x44f6f5](_0x7bf7('0x10'),_0x5d9f02['toUpperCase'](),_0x51f8c4?_0x51f8c4['id']:null,_0x51f8c4?_0x51f8c4[_0x7bf7('0x11')]:null,_0x51f8c4?_0x51f8c4[_0x7bf7('0x12')]:null,getInteractionId(_0x1bd295,_0xb62bcd,_0x392798),_0x1bd295?JSON[_0x7bf7('0x13')](_0x1bd295):_0x7bf7('0x14'));}function updateUser(_0x4e2c9e,_0x100f3d,_0x321707,_0x19d0e4,_0x2f42fd){db[_['upperFirst'](_0x19d0e4)+_0x7bf7('0x15')][_0x7bf7('0x16')]({'where':{'id':getInteractionId(_0x100f3d,_0x321707,_0x19d0e4)}})[_0x7bf7('0x17')](function(_0x13d327){if(_0x13d327){return _0x13d327[_0x7bf7('0x18')]({'UserId':_0x4e2c9e?_0x4e2c9e['id']:null});}})[_0x7bf7('0x17')](function(_0x855820){if(_0x855820){log(_0x7bf7('0x19'),_0x4e2c9e,_0x100f3d,_0x321707,_0x19d0e4,_0x2f42fd);}})[_0x7bf7('0x1a')](function(){log(_0x7bf7('0x1b'),_0x4e2c9e,_0x100f3d,_0x321707,_0x19d0e4,_0x2f42fd);});}module[_0x7bf7('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +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 diff --git a/server/components/license/service.js b/server/components/license/service.js index 8deb772..e7752ee 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 _0xad07=['aes-256-ctr','format','update','base64','utf8','parse','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','license','data1','split','createDecipher'];(function(_0x4b3e49,_0x9e566c){var _0x57e339=function(_0x1430e9){while(--_0x1430e9){_0x4b3e49['push'](_0x4b3e49['shift']());}};_0x57e339(++_0x9e566c);}(_0xad07,0x162));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x7ad0('0x0'));var util=require('util');var compose=require(_0x7ad0('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4e34f1,_0x594b29){if(_0x4e34f1&&_0x594b29){if(_0x594b29['data1']&&_0x594b29[_0x7ad0('0x2')]){var _0x5b3639=_0x594b29[_0x7ad0('0x3')];var _0x893349=_0x594b29[_0x7ad0('0x2')];var _0x56f36f=_0x5b3639[_0x7ad0('0x4')]('-')[0x4];var _0x28d94e=_0x5b3639[_0x7ad0('0x4')]('-')[0x0];var _0x3516a2=crypto[_0x7ad0('0x5')](_0x7ad0('0x6'),util[_0x7ad0('0x7')]('%s:%s:%s',_0x56f36f,_0x5b3639,_0x28d94e));var _0x153734=_0x3516a2[_0x7ad0('0x8')](_0x893349,_0x7ad0('0x9'),_0x7ad0('0xa'));_0x153734+=_0x3516a2['final'](_0x7ad0('0xa'));var _0x343c58=JSON[_0x7ad0('0xb')](_0x153734);return _0x343c58['hasOwnProperty'](_0x4e34f1)?_0x343c58[_0x4e34f1]:null;}}return null;}function isLimit(_0x408b59,_0x14e072,_0x5472cf,_0x23c797){var _0x4594fa=_0x14e072;return compose()[_0x7ad0('0xc')](function(_0x20d9a9,_0x173abc,_0x1fe5d1){return db[_0x7ad0('0xd')][_0x7ad0('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x7ad0('0xf')](function(_0x5cefdf){var _0x59fe43=getValueFromLicense(_0x408b59,_0x5cefdf);return _0x59fe43?_0x59fe43:_0x4594fa;})[_0x7ad0('0xf')](function(_0x17eda5){_0x4594fa=_0x17eda5;return _0x5472cf['count'](_0x23c797);})[_0x7ad0('0xf')](function(_0x57b7e6){if(_0x57b7e6>=_0x4594fa){return _0x173abc['status'](0x193)[_0x7ad0('0x10')]({'message':util[_0x7ad0('0x7')](_0x7ad0('0x11'),_0x408b59)});}_0x1fe5d1();})[_0x7ad0('0x12')](function(_0x386222){_0x1fe5d1(_0x386222);});});}function isUserLimit(){return isLimit(_0x7ad0('0x13'),0x1,db[_0x7ad0('0x14')],{'where':{'$or':[{'role':_0x7ad0('0x15')},{'role':_0x7ad0('0x16')}]}});}exports[_0x7ad0('0x17')]=isUserLimit; \ No newline at end of file +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 diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ae78f8a..8859ab5 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 _0xec3a=['$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','format','hours','seconds','lodash','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','operator','$between','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','field','text','\x20OR\x20','\x20IS\x20NULL)'];(function(_0x4111ed,_0x21ee5f){var _0x56eb9d=function(_0x52d555){while(--_0x52d555){_0x4111ed['push'](_0x4111ed['shift']());}};_0x56eb9d(++_0x21ee5f);}(_0xec3a,0x1af));var _0xaec3=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xec3a[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xaec3('0x0'));var moment=require('moment');exports[_0xaec3('0x1')]=function(_0x49b3b2){var _0x36209d={'conditions':[]};_0x36209d[_0xaec3('0x2')]=_['startsWith'](_0x49b3b2,_0xaec3('0x3'))?'or':_0xaec3('0x4');var _0x5a7df7=_0x49b3b2[_0xaec3('0x5')](_0xaec3('0x6'),'')['replace'](_0xaec3('0x3'),'')[_0xaec3('0x7')]('||');for(var _0x763038=0x0;_0x763038<_0x5a7df7[_0xaec3('0x8')];_0x763038++){var _0x5da06f=_0x5a7df7[_0x763038][_0xaec3('0x7')](':=');var _0x3a1bae=_0x5da06f[0x0];var _0x32787d=_0x5da06f[_0xaec3('0x9')](0x1);_0x32787d[_0xaec3('0xa')](function(_0x456864){var _0x3e94e8=_0x456864[_0xaec3('0x7')]('[')[_0xaec3('0xb')]();var _0x468b59=_0x456864[_0xaec3('0xc')](/\[(.*?)\]/g);_0x468b59[_0xaec3('0xa')](function(_0x5f396d){var _0x92ce52=_0x5f396d[_0xaec3('0x7')]('[')[_0xaec3('0xd')](function(_0x5d0a51){return _0x5d0a51[_0xaec3('0xe')](']')>-0x1;})[_0xaec3('0xf')](function(_0x2d219f){return _0x2d219f[_0xaec3('0x7')](']')[0x0];})[0x0];_0x36209d[_0xaec3('0x10')]['push']({'field':_0x3a1bae,'operator':_0x3e94e8,'value':_0x92ce52});});});}return _0x36209d;};exports[_0xaec3('0x11')]=function(_0x1dee8b,_0x5005af,_0x40a583){var _0x40bb11={};if(_0x5005af==='DATE'){if(_0x40a583[_0xaec3('0x12')]==='$eq'){_0x40a583[_0xaec3('0x12')]=_0xaec3('0x13');_0x40a583[_0xaec3('0x14')]+=','+_0x40a583[_0xaec3('0x14')];}else if(_[_0xaec3('0x15')]([_0xaec3('0x16'),_0xaec3('0x17')],_0x40a583[_0xaec3('0x12')])){_0x40a583['value']=moment(_0x40a583[_0xaec3('0x14')])[_0xaec3('0x18')](0x1,_0xaec3('0x19'))['format'](_0xaec3('0x1a'));}}if(_0x40a583[_0xaec3('0x1b')]){_0x5005af=_0x40a583[_0xaec3('0x1b')];_0x40bb11['text']=_0xaec3('0x1c')+_0x1dee8b+'.'+_0x40a583[_0xaec3('0x1d')]+'\x20AS\x20'+_0x40a583[_0xaec3('0x1b')]+')\x20'+parseOperator(_0x40a583[_0xaec3('0x12')]);}else{_0x40bb11[_0xaec3('0x1e')]=_0x1dee8b+'.'+_0x40a583['field']+'\x20'+parseOperator(_0x40a583[_0xaec3('0x12')]);}if(_['includes'](['$ne','$notIn'],_0x40a583[_0xaec3('0x12')]))_0x40bb11[_0xaec3('0x1e')]='('+_0x40bb11['text']+_0xaec3('0x1f')+_0x1dee8b+'.'+_0x40a583[_0xaec3('0x1d')]+_0xaec3('0x20');_0x40bb11[_0xaec3('0x14')]=parseValue(_0x5005af,_0x40a583[_0xaec3('0x12')],_0x40a583[_0xaec3('0x14')]);return _0x40bb11;};function parseOperator(_0x28a974){var _0x39868e;switch(_0x28a974){case _0xaec3('0x21'):_0x39868e=_0xaec3('0x22');break;case _0xaec3('0x23'):_0x39868e=_0xaec3('0x24');break;case _0xaec3('0x25'):_0x39868e=_0xaec3('0x26');break;case _0xaec3('0x27'):_0x39868e=_0xaec3('0x28');break;case _0xaec3('0x29'):case _0xaec3('0x2a'):case _0xaec3('0x2b'):_0x39868e=_0xaec3('0x2c');break;case'$lt':_0x39868e=_0xaec3('0x2d');break;case _0xaec3('0x16'):_0x39868e=_0xaec3('0x2e');break;case _0xaec3('0x17'):_0x39868e=_0xaec3('0x2f');break;case _0xaec3('0x30'):_0x39868e=_0xaec3('0x31');break;case _0xaec3('0x13'):_0x39868e=_0xaec3('0x32');break;}return _0x39868e;}function parseValue(_0x498c52,_0x4072a6,_0x153f8f){var _0x315e6e={'start':undefined,'end':undefined};switch(_0x4072a6){case _0xaec3('0x21'):case _0xaec3('0x23'):_0x315e6e[_0xaec3('0x33')]=_0x153f8f[_0xaec3('0x7')](',');break;case _0xaec3('0x29'):_0x315e6e[_0xaec3('0x33')]='%'+_0x153f8f+'%';break;case _0xaec3('0x2a'):_0x315e6e[_0xaec3('0x33')]=_0x153f8f+'%';break;case'$endsWith':_0x315e6e[_0xaec3('0x33')]='%'+_0x153f8f;break;case _0xaec3('0x13'):var _0x58b1dd=_0x153f8f[_0xaec3('0x7')](',');var _0x153f8f=_0x58b1dd[_0xaec3('0xb')]();var _0xbe8646=_0x58b1dd[_0xaec3('0x34')]();if(_0x498c52===_0xaec3('0x35')){_0x153f8f=moment(_0x153f8f)[_0xaec3('0x36')](0x0,!![])[_0xaec3('0x37')]();_0xbe8646=moment(_0xbe8646)[_0xaec3('0x36')](0x0,!![])[_0xaec3('0x18')](0x17,_0xaec3('0x38'))['add'](0x3b,'minutes')[_0xaec3('0x18')](0x3b,_0xaec3('0x39'))[_0xaec3('0x37')]();}_0x315e6e={'start':_0x153f8f,'end':_0xbe8646};break;default:_0x315e6e[_0xaec3('0x33')]=_0x153f8f;break;}return _0x315e6e;} \ No newline at end of file +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 diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4128a08..0168bde 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 _0x22a9=['name','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','col','DESC','ASC','omit','isEmpty','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','push','replace','join','query','$id','intersection','attributes','hasOwnProperty','nolimit','offset','order','where','pick','filter','object','includes','columns','value','merge','VIRTUAL','lower','options','include','lodash','moment','../../mysqldb','parse','keys','model','fields','raw','filters','find','type','$gte','format','utc','$lte','YYYY-MM-DD','subtract'];(function(_0x499aef,_0x528f19){var _0x10bdb8=function(_0x572c82){while(--_0x572c82){_0x499aef['push'](_0x499aef['shift']());}};_0x10bdb8(++_0x528f19);}(_0x22a9,0x17b));var _0x922a=function(_0xb147cb,_0x2938c2){_0xb147cb=_0xb147cb-0x0;var _0x59d94e=_0x22a9[_0xb147cb];return _0x59d94e;};'use strict';var _=require(_0x922a('0x0'));var sequelize=require('sequelize');var moment=require(_0x922a('0x1'));var db=require(_0x922a('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x8b3965){var _0x2a5936=['ne'];try{var _0x1a457b=JSON[_0x922a('0x3')](_0x8b3965);var _0x3d8e73=Object[_0x922a('0x4')](_0x1a457b)[0x0];return _0x2a5936['includes'](_0x3d8e73);}catch(_0x40248b){return![];}}function getOperatorValue(_0x3ae2f9){var _0x2b4b63=JSON['parse'](_0x3ae2f9);var _0x251450=Object[_0x922a('0x4')](_0x2b4b63)[0x0];var _0x4ce15f=_0x2b4b63[_0x251450];return{['$'+_0x251450]:_0x4ce15f};}function parseIncludeModel(_0x4bcbcf){var _0x4f9347=JSON[_0x922a('0x3')](_0x4bcbcf);return{'model':db[_0x4f9347[_0x922a('0x5')]],'as':_0x4f9347['alias'],'attributes':_0x4f9347[_0x922a('0x6')],'raw':_0x4f9347[_0x922a('0x7')]};}exports['fields']=function(_0x18ca19){var _0x394ac2=null;if(_0x18ca19){_0x394ac2=_0x18ca19['split'](',');}return _0x394ac2;};exports[_0x922a('0x8')]=function(_0x11572d,_0x2cb0fc){var _0xf43615={};if(!_['isEmpty'](_0x11572d)){_['forOwn'](_0x11572d,function(_0xa02e68,_0xdd810a){try{if(_0x2cb0fc){var _0x44dccc=_[_0x922a('0x9')](_0x2cb0fc,{'name':_0xdd810a})||{};if(hasSequelizeOperator(_0xa02e68)){_0xf43615[_0xdd810a]=getOperatorValue(_0xa02e68);}else if(_0x44dccc[_0x922a('0xa')]==='DATE'&&_['isPlainObject'](_0xa02e68)){var _0x2c4a78=JSON['parse'](_0xa02e68);var _0x132516={'$gte':moment(moment(_0x2c4a78[_0x922a('0xb')])[_0x922a('0xc')]('YYYY-MM-DD'))[_0x922a('0xd')]()['format'](),'$lte':moment(moment(_0x2c4a78[_0x922a('0xe')])['format'](_0x922a('0xf')))[_0x922a('0xd')]()[_0x922a('0x10')](0x1,'s')[_0x922a('0xc')]()};_0xf43615[_0xdd810a]=_0x132516;}else if(_0x44dccc[_0x922a('0x11')]===_0x922a('0x12')){_0xf43615[_0xdd810a]=_0xa02e68;}else{_0xf43615[_0xdd810a]=_[_0x922a('0x13')](_0xa02e68)?_0xa02e68:JSON[_0x922a('0x3')](_0xa02e68);}}else{_0xf43615[_0xdd810a]=_[_0x922a('0x13')](_0xa02e68)?_0xa02e68:JSON[_0x922a('0x3')](_0xa02e68);}}catch(_0xd02e75){_0xf43615[_0xdd810a]=_0xa02e68[_0x922a('0x14')](',');}});}return _0xf43615;};exports[_0x922a('0x15')]=function(_0x15cb72){_0x15cb72=parseInt(_0x15cb72,0xa);if(!_0x15cb72||_0x15cb72<0x0){_0x15cb72=LIMIT_VALUE;}return _0x15cb72;};exports['offset']=function(_0x2bd671){_0x2bd671=parseInt(_0x2bd671,0xa);if(!_0x2bd671||_0x2bd671<0x0){_0x2bd671=0x0;}return _0x2bd671;};exports[_0x922a('0x16')]=function(_0x449d0a){var _0x301cdd,_0x2a6d40=null;if(_0x449d0a){_0x301cdd=_0x449d0a['split'](',');_0x2a6d40=_[_0x922a('0x17')](_0x301cdd,function(_0x29fce0){if(_0x29fce0[_0x922a('0x18')]('-')===0x0){return[_0x29fce0===_0x922a('0x19')?sequelize[_0x922a('0x1a')](sequelize[_0x922a('0x1b')](_0x922a('0x19')),'unsigned'):_0x29fce0['substr'](0x1),_0x922a('0x1c')];}else{return[_0x29fce0===_0x922a('0x19')?sequelize[_0x922a('0x1a')](sequelize['col'](_0x922a('0x19')),'unsigned'):_0x29fce0,_0x922a('0x1d')];}});}return _0x2a6d40;};exports[_0x922a('0x1e')]=function(_0x13c30f,_0x72edd1){if(_[_0x922a('0x1f')](_0x13c30f)){return _0x13c30f;}if(_[_0x922a('0x13')](_0x13c30f)){for(var _0x5d381e=0x0;_0x5d381e<_0x13c30f[_0x922a('0x20')];_0x5d381e+=0x1){_0x13c30f[_0x5d381e]=this['omit'](_0x13c30f[_0x5d381e],_0x72edd1);}return _0x13c30f;}if(!_[_0x922a('0x21')](_0x13c30f)){return _0x13c30f;}if(_[_0x922a('0x22')](_0x72edd1)){_0x72edd1=[_0x72edd1];}if(!_['isArray'](_0x72edd1)){return _0x13c30f;}for(var _0x4d326d=0x0;_0x4d326d<_0x72edd1[_0x922a('0x20')];_0x4d326d+=0x1){_[_0x922a('0x23')](_0x13c30f,_0x72edd1[_0x4d326d]);}for(var _0x231b3a in _0x13c30f){if(_0x13c30f['hasOwnProperty'](_0x231b3a)){_0x13c30f[_0x231b3a]=this['omit'](_0x13c30f[_0x231b3a],_0x72edd1);}}return _0x13c30f;};exports[_0x922a('0x24')]=function(_0x428013){return _0x428013[_0x922a('0x25')](RegExp(_0x922a('0x26')))?!![]:![];};exports[_0x922a('0x27')]=function(_0x14a75f){return _0x14a75f[_0x922a('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x922a('0x28')]=function(_0x23ae24,_0x50451d){var _0x3e3dae=[];var _0x1bcc60=/[ `!@#$%^&*()_\-?~]/;var _0x3a5f38=_0x50451d?_0x922a('0x29'):_0x922a('0x2a');_0x23ae24[_0x922a('0x14')](/[ ,]+/)['forEach'](function(_0x3ff2d2){_0x3ff2d2=_0x3ff2d2['replace'](/([^:]")"+/g,'$1');_0x3ff2d2='+'+_0x3ff2d2+'*';var _0x3dd159=_0x3ff2d2[_0x922a('0x25')](_0x1bcc60);if(_0x3dd159){_0x3ff2d2='\x22'+_0x3ff2d2+'\x22';}_0x3e3dae[_0x922a('0x2b')](_0x3ff2d2);});_0x3a5f38=_0x3a5f38[_0x922a('0x2c')](_0x922a('0x2a'),_0x3e3dae[_0x922a('0x2d')]('\x20'));return _0x3a5f38;};exports['getOptions']=function(_0x309899,_0xc89b85,_0x375e63){var _0x250de5={},_0x9da3c9={};if(_0xc89b85[_0x922a('0x2e')][_0x922a('0x2f')]){_0xc89b85[_0x922a('0x2e')]['id']=_0xc89b85[_0x922a('0x2e')][_0x922a('0x2f')];delete _0xc89b85['query'][_0x922a('0x2f')];}_0x250de5[_0x922a('0x5')]=_[_0x922a('0x17')](_0x309899,_0x922a('0x11'));_0x250de5['query']=_[_0x922a('0x4')](_0xc89b85[_0x922a('0x2e')]);_0x250de5[_0x922a('0x8')]=_[_0x922a('0x30')](_0x250de5[_0x922a('0x5')],_0x250de5['query']);_0x9da3c9[_0x922a('0x31')]=_['intersection'](_0x250de5['model'],this[_0x922a('0x6')](_0xc89b85['query']['fields']));_0x9da3c9[_0x922a('0x31')]=_0x9da3c9[_0x922a('0x31')]['length']?_0x9da3c9[_0x922a('0x31')]:_0x250de5[_0x922a('0x5')];if(!_0xc89b85['query'][_0x922a('0x32')](_0x922a('0x33'))){_0x9da3c9[_0x922a('0x15')]=this[_0x922a('0x15')](_0xc89b85['query'][_0x922a('0x15')]);_0x9da3c9[_0x922a('0x34')]=this[_0x922a('0x34')](_0xc89b85[_0x922a('0x2e')]['offset']);}_0x9da3c9[_0x922a('0x35')]=this['sort'](_0xc89b85[_0x922a('0x2e')]['sort']);_0x9da3c9[_0x922a('0x36')]=this[_0x922a('0x8')](_[_0x922a('0x37')](_0xc89b85['query'],_0x250de5[_0x922a('0x8')]),_0x309899);if(_0xc89b85['query'][_0x922a('0x38')]){var _0x3c118e=_0x309899;var _0x142da1=_0xc89b85[_0x922a('0x2e')][_0x922a('0x38')];if(typeof _0x142da1===_0x922a('0x39')){_0x3c118e=_[_0x922a('0x38')](_0x309899,function(_0xa29453){return _[_0x922a('0x3a')](_0x142da1[_0x922a('0x3b')],_0xa29453['name']);});_0x142da1=_0x142da1[_0x922a('0x3c')];}_0x9da3c9[_0x922a('0x36')]=_[_0x922a('0x3d')](_0x9da3c9[_0x922a('0x36')],{'$or':_['map'](_0x3c118e,function(_0x2adc8f){if(_0x2adc8f[_0x922a('0xa')]!==_0x922a('0x3e')){if(_0x375e63){return sequelize[_0x922a('0x36')](sequelize['fn'](_0x922a('0x3f'),sequelize[_0x922a('0x1b')](_0x2adc8f['name'])),{'$like':sequelize['fn']('lower','%'+_0xc89b85[_0x922a('0x2e')][_0x922a('0x38')]+'%')});}else{var _0x2c6d03={};_0x2c6d03[_0x2adc8f['name']]={'$like':'%'+_0xc89b85[_0x922a('0x2e')]['filter']+'%'};return _0x2c6d03;}}})});}_0x9da3c9=_[_0x922a('0x3d')]({},_0x9da3c9,_0xc89b85[_0x922a('0x40')]);return _0x9da3c9;};exports[_0x922a('0x41')]=function(_0x335198){var _0x2ba5e6=[];if(_0x335198['includeAll']){_0x2ba5e6[_0x922a('0x2b')]({'all':!![]});}else if(_0x335198[_0x922a('0x41')]){if(Array[_0x922a('0x13')](_0x335198[_0x922a('0x41')])){_0x2ba5e6=Object[_0x922a('0x4')](_0x335198[_0x922a('0x41')])['map'](function(_0x290c22){return parseIncludeModel(_0x335198[_0x922a('0x41')][_0x290c22]);});}else{var _0x52e997=parseIncludeModel(_0x335198[_0x922a('0x41')]);_0x2ba5e6[_0x922a('0x2b')](_0x52e997);}}return _0x2ba5e6;}; \ No newline at end of file +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 diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 68e2a8d..55c9729 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 _0xf360=['pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','fullname','sort','pause','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','idle','voiceStatus','chatStatus','mailStatus','openchannelStatus','whatsappStatus','error','result','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','findOne','getAgents','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name'];(function(_0x9cff0e,_0x4cbcee){var _0x3fb20c=function(_0x5d2298){while(--_0x5d2298){_0x9cff0e['push'](_0x9cff0e['shift']());}};_0x3fb20c(++_0x4cbcee);}(_0xf360,0x12f));var _0x0f36=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf360[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x0f36('0x0'));var jayson=require(_0x0f36('0x1'));var db=require(_0x0f36('0x2'))['db'];var amiClient=jayson[_0x0f36('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x0f36('0x3')][_0x0f36('0x4')]({'port':0x232c});function isAgentPaused(_0x477bfd,_0x335ed7){var _0x276333=[_0x477bfd[_0x0f36('0x5')],_0x477bfd[_0x0f36('0x6')],_0x477bfd[_0x0f36('0x7')],_0x477bfd[_0x0f36('0x8')],_0x477bfd[_0x0f36('0x9')],_0x477bfd[_0x0f36('0xa')],_0x477bfd[_0x0f36('0xb')]];if(!_0x335ed7)return _[_0x0f36('0xc')](_0x276333);var _0x3941fa=_[_0x0f36('0xd')](_0x276333);return _0x3941fa[_0x0f36('0xe')]>0x0&&_0x3941fa[_0x0f36('0xe')]<_0x276333['length']?!![]:![];}function isIdle(_0x29e456){return _0x29e456==='idle'||_0x29e456===_0x0f36('0xf')||_0x29e456===_0x0f36('0x10')||_0x29e456===_0x0f36('0x11')||_[_0x0f36('0x12')](_0x29e456);}function isAgentIdle(_0x1a1a9c){if(_0x1a1a9c['voiceStatus']!==_0x0f36('0x13')&&_0x1a1a9c[_0x0f36('0xa')]){_0x1a1a9c[_0x0f36('0x14')]='pause';return![];}return _[_0x0f36('0xc')]([_0x1a1a9c[_0x0f36('0x15')],_0x1a1a9c['faxStatus'],_0x1a1a9c[_0x0f36('0x16')],_0x1a1a9c[_0x0f36('0x17')],_0x1a1a9c['smsStatus'],_0x1a1a9c[_0x0f36('0x14')],_0x1a1a9c[_0x0f36('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})['then'](function(_0x31c2ee){if(_0x31c2ee[_0x0f36('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x359723=_0x31c2ee[_0x0f36('0x1a')];return routingClient['request'](_0x0f36('0x1b'),{})[_0x0f36('0x1c')](function(_0x46650d){if(_0x46650d[_0x0f36('0x19')]){throw new Error(_0x0f36('0x1d'));}var _0x678088=_0x46650d[_0x0f36('0x1a')];return _[_0x0f36('0x1e')]({},_0x359723,_0x678088);});})['catch'](function(_0xa2cbd6){throw _0xa2cbd6;});}exports[_0x0f36('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x3fbedd){var _0x54a70c=_0x0f36('0xf');if(isAgentPaused(_0x3fbedd))_0x54a70c='pause';else if(isAgentPaused(_0x3fbedd,!![]))_0x54a70c=_0x0f36('0x20');else if(isAgentIdle(_0x3fbedd))_0x54a70c='idle';else _0x54a70c=_0x0f36('0x21');return _0x54a70c;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x218487,_0x567419){var _0x24a36d=_[_0x0f36('0x22')](_0x218487)?_0x218487:[_0x218487];var _0x1d0e0d=_[_0x0f36('0x23')](_0x567419)+_0x0f36('0x24');var _0xa6dc45=_['map'](_0x24a36d,function(_0x18be70){return db[_0x1d0e0d][_0x0f36('0x25')]({'where':{'id':_0x18be70}})[_0x0f36('0x1c')](function(_0xc6a9b4){if(!_0xc6a9b4)return[];return _0xc6a9b4[_0x0f36('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0xa6dc45)[_0x0f36('0x1c')](function(_0x3c9afb){var _0x51ef6b=_(_0x3c9afb)['flatten']()[_0x0f36('0x27')]('id')[_0x0f36('0x28')]()[_0x0f36('0x29')]();return _0x51ef6b;});}exports[_0x0f36('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3a010a,_0x11a27a,_0xa04f9c){try{if(_0x11a27a[_0x0f36('0xe')]>0x0){_0x3a010a=_0x3a010a[_0x0f36('0xd')](function(_0x1929e3){return _0x11a27a[_0x0f36('0x2b')](_0x1929e3['id']);});}var _0x2f5d86=_0x3a010a[_0x0f36('0xd')](function(_0x2e0d53){var _0x26dafb=_0x0f36('0x21');if(isAgentIdle(_0x2e0d53)){_0x26dafb=_0x0f36('0x13');}return _0x26dafb===_0xa04f9c;});return _['map'](_0x2f5d86,'id');}catch(_0x216c88){throw _0x216c88;}}exports[_0x0f36('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xaf44be,_0x17d761,_0x52a2b1){return Promise[_0x0f36('0x2d')]()[_0x0f36('0x1c')](function(){if(_0x17d761[_0x0f36('0xe')]>0x0){_0xaf44be=_0xaf44be[_0x0f36('0xd')](function(_0x7b761f){return _0x17d761[_0x0f36('0x2b')](_0x7b761f['id']);});}return _0xaf44be;})[_0x0f36('0x1c')](function(){return db[_0x0f36('0x2e')][_0x0f36('0x2f')]({'attributes':['id',_0x0f36('0x30'),'fullname',_0x0f36('0x5'),_0x0f36('0x6'),_0x0f36('0x7'),_0x0f36('0x8'),_0x0f36('0x9'),_0x0f36('0xa'),_0x0f36('0xb'),_0x0f36('0x31')],'where':{'id':{'$in':_[_0x0f36('0x27')](_0xaf44be,'id')}},'raw':!![]});})['then'](function(_0x242ee5){return _0x242ee5[_0x0f36('0x27')](function(_0x1520eb){var _0x18197b=_[_0x0f36('0x32')](_0xaf44be,['id',_0x1520eb['id']]);var _0x5117a3=filterAgentAttributes(_0x18197b);_[_0x0f36('0x1e')](_0x1520eb,_0x5117a3);_0x1520eb[_0x0f36('0x33')]=getAgentStatus(_0x1520eb);return _0x1520eb;});})[_0x0f36('0x1c')](function(_0x1978cd){var _0x36d297=sortAgentsByStatus(_0x1978cd,_0x52a2b1);return _['map'](_0x36d297,'id');})['catch'](function(_0x35171b){throw _0x35171b;});}exports[_0x0f36('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xeae915){var _0x3551e0={'fields':[],'order':null};var _0x407474=_0xeae915[_0x0f36('0x35')](',');_0x3551e0[_0x0f36('0x36')]=_[_0x0f36('0xd')](_0x407474,function(_0x539b0b){if(!_0x539b0b[_0x0f36('0x2b')]('globalStatus')){return!![];}_0x3551e0[_0x0f36('0x37')]=_[_0x0f36('0x38')](_0x539b0b,'-')?_0x0f36('0x39'):'ASC';return![];});return _0x3551e0;}exports[_0x0f36('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x36b100){if(!_0x36b100){_0x36b100=_0x0f36('0x3b');}if(_0x36b100[_0x0f36('0x2b')]('fullname')&&!_0x36b100[_0x0f36('0x2b')](_0x0f36('0x3c'))){var _0x36a4bf=_0x36b100[_0x0f36('0x3d')](0x0,_0x36b100[_0x0f36('0x3e')](_0x0f36('0x3f')));_0x36b100+=','+_0x36a4bf+_0x0f36('0x3c');}return _0x36b100;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x41d662,_0x1c6ab2){var _0x3f7fd9=_0x41d662[_0x0f36('0x40')](function(_0x294470,_0x4bfaf2){if(_0x294470[_0x0f36('0x33')]===_0x4bfaf2[_0x0f36('0x33')]){if(_0x294470[_0x0f36('0x33')]===_0x0f36('0x41')){if(_0x1c6ab2==='DESC'){return(_0x294470[_0x0f36('0x31')]||'')<(_0x4bfaf2[_0x0f36('0x31')]||'')||_0x294470[_0x0f36('0x3f')][_0x0f36('0x42')]()>_0x4bfaf2[_0x0f36('0x3f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x294470['pauseType']||'')<(_0x4bfaf2['pauseType']||'')||_0x294470[_0x0f36('0x3f')][_0x0f36('0x42')]()>_0x4bfaf2[_0x0f36('0x3f')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x1c6ab2===_0x0f36('0x39')){return _0x294470[_0x0f36('0x3f')][_0x0f36('0x42')]()<_0x4bfaf2[_0x0f36('0x3f')][_0x0f36('0x42')]()?0x1:-0x1;}else{return _0x294470[_0x0f36('0x3f')][_0x0f36('0x42')]()<_0x4bfaf2[_0x0f36('0x3f')][_0x0f36('0x42')]()?-0x1:0x1;}}}else{if(_0x1c6ab2===_0x0f36('0x39')){return _0x294470[_0x0f36('0x33')]<_0x4bfaf2[_0x0f36('0x33')]?0x1:-0x1;}else{return _0x294470[_0x0f36('0x33')]<_0x4bfaf2[_0x0f36('0x33')]?-0x1:0x1;}}});return _0x3f7fd9;}exports[_0x0f36('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x45d02c){var _0x23bf0d=[_0x0f36('0x44'),_0x0f36('0x45'),_0x0f36('0x46'),_0x0f36('0x47'),_0x0f36('0x31'),'lastPauseAt',_0x0f36('0x3c'),_0x0f36('0x48'),'chatPause',_0x0f36('0x8'),_0x0f36('0x7'),'smsPause',_0x0f36('0xb'),_0x0f36('0x6'),_0x0f36('0xa'),_0x0f36('0x49'),'openchannelCapacity','mailCapacity','smsCapacity',_0x0f36('0x4a'),_0x0f36('0x4b'),_0x0f36('0x4c'),'openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity',_0x0f36('0x15'),_0x0f36('0x17'),'mailStatus','smsStatus',_0x0f36('0x18'),_0x0f36('0x4d'),_0x0f36('0x14'),_0x0f36('0x4e'),_0x0f36('0x4f'),'mailStatusTime',_0x0f36('0x50'),'whatsappStatusTime','faxStatusTime',_0x0f36('0x51'),'queue',_0x0f36('0x52'),_0x0f36('0x53'),_0x0f36('0x54'),'phoneBarEnableAutomaticScreenRecording',_0x0f36('0x55')];var _0xa40df5=[_0x0f36('0x5'),'openchannelPause','mailPause',_0x0f36('0x9'),'whatsappPause','faxPause','voicePause',_0x0f36('0x45')];var _0x41665a=_(_0x45d02c)['omit'](_0xa40df5)[_0x0f36('0x56')](_0x23bf0d)[_0x0f36('0x29')]();return _0x41665a;}exports[_0x0f36('0x57')]=filterAgentAttributes; \ No newline at end of file +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 diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 3497735..c7dd842 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 _0x8fe5=['request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','outbound','get','loggedInDb','waiting','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','busy','inUse','invalid','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x8fe5,0x17f));var _0x58fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8fe5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x58fe('0x0'));var jayson=require(_0x58fe('0x1'));var util=require(_0x58fe('0x2'));var amiClient=jayson[_0x58fe('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x58fe('0x3')][_0x58fe('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x58fe('0x5'),'loggedIn',_0x58fe('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x58fe('0x7'),_0x58fe('0x8'),_0x58fe('0x9'),'loggedInDb','notInUse',_0x58fe('0xa'),_0x58fe('0xb'),_0x58fe('0xc'),_0x58fe('0xd'),_0x58fe('0xe'),_0x58fe('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x58fe('0x10'),_0x58fe('0x11'),_0x58fe('0x12'),_0x58fe('0x13'),_0x58fe('0x14'),_0x58fe('0x15'),_0x58fe('0x16'),'startPredictive',_0x58fe('0x17'),'erlangCalls','erlangCallToSecond',_0x58fe('0x18'),_0x58fe('0x19'),_0x58fe('0x1a'),_0x58fe('0x1b'),'dialPredictiveIntervalMinThreshold',_0x58fe('0x1c'),_0x58fe('0x1d'),_0x58fe('0x1e'),'predictiveIntervalDroppedCallsTimeout',_0x58fe('0x1f'),_0x58fe('0x20'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x36e1cd,_0x4eca6d){var _0x25d637=_0x4eca6d==='voice'?amiClient:routingClient;return _0x25d637[_0x58fe('0x21')](_[_0x58fe('0x22')](_0x4eca6d)+_0x58fe('0x23'),_0x36e1cd)['then'](function(_0x13af2c){if(_0x13af2c['error'])throw new Error(util[_0x58fe('0x24')](_0x58fe('0x25'),_0x4eca6d));return _0x13af2c[_0x58fe('0x26')];})[_0x58fe('0x27')](function(_0x3c470a){throw _0x3c470a;});}exports[_0x58fe('0x28')]=getRealtimeQueues;function initializeQueues(_0x137be3,_0x167c3a,_0x4edb2d,_0x29c0e0){var _0x723a48=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4edb2d===_0x58fe('0x29')){if(_0x29c0e0===_0x58fe('0x2a')){_0x723a48=_0x723a48[_0x58fe('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x29c0e0===_0x58fe('0x2c')){_0x723a48=_0x723a48[_0x58fe('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x137be3['map'](function(_0xbbe293){var _0x1419cc=_0xbbe293[_0x58fe('0x2d')]({'plain':!![]});_0x1419cc[_0x58fe('0x6')]=0x0;_0x1419cc[_0x58fe('0x2e')]=0x0;_0x1419cc['loggedIn']=0x0;_0x1419cc[_0x58fe('0x5')]=0x0;_0x1419cc[_0x58fe('0x2f')]=0x0;if(_0x4edb2d==='voice'){_0x1419cc[_0x58fe('0xd')]=0x0;_0x1419cc[_0x58fe('0x7')]=0x0;if(_0x29c0e0===_0x58fe('0x2c')){_0x1419cc['pTalking']=0x0;_0x1419cc['originated']=0x0;}}var _0xadf9fb=_[_0x58fe('0x30')](_0x167c3a,['id',_0x1419cc['id']]);if(_0xadf9fb){_[_0x58fe('0x31')](_0x1419cc,_[_0x58fe('0x32')](_0xadf9fb,_0x723a48));}return _0x1419cc;});}exports[_0x58fe('0x33')]=initializeQueues; \ No newline at end of file +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 diff --git a/server/config/express.js b/server/config/express.js index d2040a7..00dad5b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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(_0x19c7a8,_0x10508d){var _0x1462ce=function(_0x33f2c8){while(--_0x33f2c8){_0x19c7a8['push'](_0x19c7a8['shift']());}};_0x1462ce(++_0x10508d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 +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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index c9d0c48..d7201f8 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 _0x6c2a=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','model','join','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','md5'];(function(_0xfb10b5,_0x8bfac4){var _0x470ffa=function(_0x1ca6d5){while(--_0x1ca6d5){_0xfb10b5['push'](_0xfb10b5['shift']());}};_0x470ffa(++_0x8bfac4);}(_0x6c2a,0x1b1));var _0xa6c2=function(_0xa56ba,_0x5cc58a){_0xa56ba=_0xa56ba-0x0;var _0x3a7aa1=_0x6c2a[_0xa56ba];return _0x3a7aa1;};'use strict';var _=require(_0xa6c2('0x0'));var os=require('os');var crypto=require(_0xa6c2('0x1'));var machine=require(_0xa6c2('0x2'));var exec=require(_0xa6c2('0x3'))[_0xa6c2('0x4')];var config=require(_0xa6c2('0x5'));function getInterfaces(){var _0x128766=[];var _0xa8d0a6=os['networkInterfaces']();var _0x40c315=_[_0xa6c2('0x6')](_['keys'](_0xa8d0a6));for(var _0x4008fe=0x0;_0x4008fe<_0x40c315['length'];_0x4008fe++){var _0x7550f9=_0xa8d0a6[_0x40c315[_0x4008fe]][_0xa6c2('0x7')](function(_0x3477cd){return _0x3477cd[_0xa6c2('0x8')]===_0xa6c2('0x9')&&_0x3477cd[_0xa6c2('0xa')]===![];});_0x128766=_0x128766[_0xa6c2('0xb')](_0x7550f9);}return _0x128766;}function getFirstInterface(){var _0x1bc49a=_[_0xa6c2('0xc')](getInterfaces());return{'macAddress':_0x1bc49a&&_0x1bc49a['mac']?_0x1bc49a[_0xa6c2('0xd')]:_0xa6c2('0xe'),'ipAddress':_0x1bc49a&&_0x1bc49a['address']?_0x1bc49a[_0xa6c2('0xf')]:'127.0.0.1'};}exports[_0xa6c2('0x10')]=getFirstInterface;function getCPUhash(){var _0x5cf1fe=_['orderBy'](os['cpus']()[_0xa6c2('0x11')](function(_0xaa45f8){return _0xaa45f8[_0xa6c2('0x12')];}))[_0xa6c2('0x13')](':');return crypto['createHash']('md5')[_0xa6c2('0x14')](_0x5cf1fe)[_0xa6c2('0x15')](_0xa6c2('0x16'));}exports[_0xa6c2('0x17')]=function(){var _0x5063a1=os[_0xa6c2('0x18')]();var _0x2f4337=/[0-9a-f-]{36}/;if(config[_0xa6c2('0x19')]&&_0x2f4337[_0xa6c2('0x1a')](config['licenseToken'])){return config[_0xa6c2('0x19')];}else if(_0x5063a1==='win32'){return exec(_0xa6c2('0x1b'),{'encoding':_0xa6c2('0x1c')})[_0xa6c2('0x1d')]('\x0d\x0a','');}else{var _0x366c18=getFirstInterface();var _0x4210b8=getCPUhash();var _0x4f75a9=_0x4210b8+'|'+os[_0xa6c2('0x1e')]()+'|'+_0x366c18[_0xa6c2('0x1f')]+'|'+_0x366c18[_0xa6c2('0x20')];var _0x2b6657=crypto[_0xa6c2('0x21')](_0xa6c2('0x22'))[_0xa6c2('0x14')](_0x4f75a9)[_0xa6c2('0x15')](_0xa6c2('0x16'));return _0x2b6657['substring'](0x0,0x8)+'-'+_0x2b6657['substring'](0x8,0xc)+'-'+_0x2b6657[_0xa6c2('0x23')](0xc,0x10)+'-'+_0x2b6657[_0xa6c2('0x23')](0x10,0x14)+'-'+_0x2b6657[_0xa6c2('0x23')](0x14);}}; \ No newline at end of file +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 diff --git a/server/config/license/index.js b/server/config/license/index.js index 3f40e7d..40dbf5a 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 _0xd51d=['%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','../logger','license','format','exports'];(function(_0x1adc99,_0x522e56){var _0x5de18f=function(_0x58cccd){while(--_0x58cccd){_0x1adc99['push'](_0x1adc99['shift']());}};_0x5de18f(++_0x522e56);}(_0xd51d,0x1d6));var _0xdd51=function(_0x2531f7,_0x746c05){_0x2531f7=_0x2531f7-0x0;var _0x2ee3b6=_0xd51d[_0x2531f7];return _0x2ee3b6;};'use strict';var util=require(_0xdd51('0x0'));var moment=require(_0xdd51('0x1'));var rp=require(_0xdd51('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xdd51('0x3'))(module,_0xdd51('0x4'));var db=require(_0xdd51('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xdd51('0x6'));var logger=require(_0xdd51('0x7'))(_0xdd51('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3f7b40){return new BPromise(function(_0x55b987,_0xd45522){var _0xd8705=util[_0xdd51('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x3f7b40,module[_0xdd51('0xa')][_0xdd51('0x4')]);if(oldToken){_0xd8705=util[_0xdd51('0x9')](_0xdd51('0xb'),HOST,_0x3f7b40,module[_0xdd51('0xa')][_0xdd51('0x4')],oldToken);}var _0x10a2f6={'uri':_0xd8705,'method':_0xdd51('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x10a2f6)[_0xdd51('0xd')](function(_0xa10179){_0x55b987(_0xa10179);})[_0xdd51('0xe')](function(_0x5dcfef){_0xd45522(_0x5dcfef);});});}function manageLicense(_0x2e3089,_0x20156d){var _0x5e364d=_0x20156d[_0xdd51('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x5e364d[_0xdd51('0x10')]!==_0x2e3089&&!_0x5e364d[_0xdd51('0x11')]){oldToken=_0x5e364d[_0xdd51('0x10')];}httpRequest(_0x2e3089)[_0xdd51('0xd')](function(_0x4e371a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4e371a[_0xdd51('0x12')]){isOldTokenSent=![];if(!_0x5e364d[_0xdd51('0x8')]&&_0x5e364d[_0xdd51('0x8')]!=_0x4e371a[_0xdd51('0x8')]||_0x5e364d[_0xdd51('0x8')]&&_0x5e364d[_0xdd51('0x11')]){logger[_0xdd51('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5e364d[_0xdd51('0x8')]&&!_0x5e364d['data2']&&_0x5e364d[_0xdd51('0x8')]!=_0x4e371a[_0xdd51('0x8')]){logger[_0xdd51('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5e364d[_0xdd51('0x8')]&&!_0x5e364d['data2']&&_0x5e364d[_0xdd51('0x8')]==_0x4e371a[_0xdd51('0x8')]){return _0x20156d;}return _0x20156d[_0xdd51('0x14')]({'data1':_0x2e3089,'data2':null,'license':_0x4e371a[_0xdd51('0x8')]});}else{if(_0x4e371a[_0xdd51('0x8')]||_0x5e364d['license']){if(!_0x5e364d[_0xdd51('0x11')]){if(_0x5e364d[_0xdd51('0x10')]==_0x2e3089){GRAY_PERIOD_REASON=_0xdd51('0x15');logger[_0xdd51('0x13')](_0xdd51('0x16'));}else{GRAY_PERIOD_REASON=_0xdd51('0x17');logger['info'](_0xdd51('0x18'),_0x5e364d[_0xdd51('0x10')],_0x2e3089);}logger[_0xdd51('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xdd51('0x19')](),moment()[_0xdd51('0x9')](_0xdd51('0x1a')));return _0x20156d[_0xdd51('0x14')]({'data2':encryptor[_0xdd51('0x1b')](moment()['format'](_0xdd51('0x1a')))});}else{if(moment()[_0xdd51('0x1c')](encryptor[_0xdd51('0x1d')](_0x5e364d['data2']),_0xdd51('0x1e'))>DAYS){logger[_0xdd51('0x13')]('DEMO\x20START\x20AT\x20%s',moment()[_0xdd51('0x9')](_0xdd51('0x1a')));isOldTokenSent=![];return _0x20156d['update']({'data1':_0x2e3089,'data2':null,'license':null});}}}else{if(_0x5e364d[_0xdd51('0x10')]!=_0x2e3089){logger[_0xdd51('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5e364d[_0xdd51('0x10')],_0x2e3089);return _0x20156d[_0xdd51('0x14')]({'data1':_0x2e3089,'data2':null,'license':null});}}}return _0x20156d;})['then'](function(_0x7f58af){_0x20156d=_0x7f58af;})[_0xdd51('0xe')](function(_0xa5ea49){logger[_0xdd51('0x1f')](_0xa5ea49['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xdd51('0x20')](),_0x20156d);},TIME);});}function defaultLicense(){var _0x389411=hardware['getUuid']();if(_0x389411){return db[_0xdd51('0x21')][_0xdd51('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x389411}})[_0xdd51('0x23')](function(_0x2689a0,_0x5e1db9){logger[_0xdd51('0x13')](_0xdd51('0x24'),_0x389411);manageLicense(_0x389411,_0x2689a0);})['catch'](function(_0x4115e8){logger['error'](_0x4115e8['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +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 diff --git a/server/config/license/util.js b/server/config/license/util.js index d683d1e..5bd181b 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 _0x29e3=['COUNT','col','role','count','user','telephone','users','forEach','admin','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','License','defaults','then','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','add','days','grayReason','changed','disabled','message','User','findAll','sequelize'];(function(_0x282601,_0x52dd65){var _0x1ddb0a=function(_0x558aa4){while(--_0x558aa4){_0x282601['push'](_0x282601['shift']());}};_0x1ddb0a(++_0x52dd65);}(_0x29e3,0x157));var _0x329e=function(_0x56d836,_0x25c5ed){_0x56d836=_0x56d836-0x0;var _0x10dd98=_0x29e3[_0x56d836];return _0x10dd98;};'use strict';var util=require(_0x329e('0x0'));var _=require(_0x329e('0x1'));var moment=require('moment');var BPromise=require(_0x329e('0x2'));var hardware=require(_0x329e('0x3'));var encryptor=require(_0x329e('0x4'));var db=require(_0x329e('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x329e('0x6'),'machineUuid':hardware[_0x329e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x329e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5c9b81){return new BPromise(function(_0x4e05b3,_0x2aa013){return db[_0x329e('0x8')]['find'](_[_0x329e('0x9')](_0x5c9b81,{'raw':!![],'where':{'id':0x1}}))[_0x329e('0xa')](function(_0x3207ef){return checkLicense(_0x3207ef,null);})[_0x329e('0xa')](function(_0x323bcb){_0x4e05b3(_0x323bcb);return;})['catch'](function(_0x4a320b){_0x2aa013(_0x4a320b);});});}function checkLicense(_0x243efc,_0x25504d){if(!_0x243efc){demoLicense['uuid']=_0x243efc[_0x329e('0xb')];return demoLicense;}try{var _0x1b226d=_0x25504d||_0x243efc[_0x329e('0xc')];if(_[_0x329e('0xd')](_0x1b226d)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x14e6bd=_0x243efc[_0x329e('0xb')];var _0x1d0f32=_0x243efc[_0x329e('0xe')];var _0x59b1ca=_0x14e6bd[_0x329e('0xf')]('-')[0x4];var _0x2d5f9=_0x14e6bd[_0x329e('0xf')]('-')[0x0];var _0x17d13f=encryptor[_0x329e('0x10')](_0x1b226d,util[_0x329e('0x11')](_0x329e('0x12'),_0x59b1ca,_0x14e6bd,_0x2d5f9));var _0x1bd2ea=JSON[_0x329e('0x13')](_0x17d13f);_0x1bd2ea[_0x329e('0x14')]=![];_0x1bd2ea[_0x329e('0x15')]=_0x14e6bd;_0x1bd2ea[_0x329e('0x16')]=hardware[_0x329e('0x7')]();if(_0x1d0f32){var _0x5a4e25=encryptor[_0x329e('0x10')](_0x1d0f32);_0x1bd2ea[_0x329e('0x17')]=_0x5a4e25;_0x1bd2ea['deadline']=moment(_0x5a4e25)[_0x329e('0x18')](0x7,_0x329e('0x19'))[_0x329e('0x11')]();_0x1bd2ea[_0x329e('0x1a')]=_0x1bd2ea['uuid']!=_0x1bd2ea[_0x329e('0x16')]?_0x329e('0x1b'):_0x329e('0x1c');}return _0x1bd2ea;}catch(_0x38d4fe){breakingLicense[_0x329e('0x15')]=_0x243efc[_0x329e('0xb')];breakingLicense[_0x329e('0x1d')]=_0x38d4fe['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x135412,_0x512c88){getLicense()[_0x329e('0xa')](function(_0x116b53){return db[_0x329e('0x1e')][_0x329e('0x1f')]({'attributes':['role',[db[_0x329e('0x20')]['fn'](_0x329e('0x21'),db[_0x329e('0x20')][_0x329e('0x22')](_0x329e('0x23'))),_0x329e('0x24')]],'group':'role','where':{'role':{'$or':['admin',_0x329e('0x25'),_0x329e('0x26')]}},'raw':!![]})[_0x329e('0xa')](function(_0xbabae9){var _0x59648a={'user':_0x116b53[_0x329e('0x27')]||0x0,'telephone':_0x116b53['telephones']||0x0};_0xbabae9[_0x329e('0x28')](function(_0x3e2476){var _0x5446c0=_0x3e2476[_0x329e('0x23')]===_0x329e('0x29')?'user':_0x3e2476[_0x329e('0x23')];_0x59648a[_0x5446c0]-=_0x3e2476['count'];if(_0x59648a[_0x5446c0]<0x0)_0x59648a[_0x5446c0]=0x0;});_0x135412(_0x59648a);return;});})[_0x329e('0x2a')](function(_0x2c005c){_0x512c88(_0x2c005c);});});}function checkUserLimits(_0x30ae8e){return new BPromise(function(_0x4b047e,_0x392dec){getLimits()['then'](function(_0x35fe0a){var _0x10552d=_[_0x329e('0x2b')](_[_0x329e('0x2c')](_0x30ae8e,'role'),[_0x329e('0x29'),_0x329e('0x25'),_0x329e('0x26')]);var _0x34e9a3=(_0x10552d[_0x329e('0x29')]||0x0)+(_0x10552d[_0x329e('0x25')]||0x0);var _0x2230f0=_0x10552d[_0x329e('0x26')]||0x0;if(_0x34e9a3>_0x35fe0a[_0x329e('0x25')])return _0x392dec(_0x329e('0x2d'));if(_0x2230f0>_0x35fe0a[_0x329e('0x26')])return _0x392dec('License\x20limit\x20reached\x20for\x20telephones');return _0x4b047e();})['catch'](function(_0x4e9296){_0x392dec(_0x4e9296);});});}module[_0x329e('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +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 diff --git a/server/config/local.env.js b/server/config/local.env.js index a44c623..d855185 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 _0x958a=['exports','http://localhost:9000','app-id','secret'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0x958a,0x128));var _0xa958=function(_0x63ce73,_0x345075){_0x63ce73=_0x63ce73-0x0;var _0x17fcc3=_0x958a[_0x63ce73];return _0x17fcc3;};'use strict';module[_0xa958('0x0')]={'DOMAIN':_0xa958('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa958('0x2'),'GOOGLE_SECRET':_0xa958('0x3'),'DEBUG':''}; \ No newline at end of file +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 diff --git a/server/config/logger.js b/server/config/logger.js index 2025c3c..c80eb86 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf04=['exports','../utils/loggers','fileLogger'];(function(_0x51c323,_0x392692){var _0x40d798=function(_0x346128){while(--_0x346128){_0x51c323['push'](_0x51c323['shift']());}};_0x40d798(++_0x392692);}(_0xcf04,0x67));var _0x4cf0=function(_0x195b4b,_0x1f0f17){_0x195b4b=_0x195b4b-0x0;var _0x5746d3=_0xcf04[_0x195b4b];return _0x5746d3;};'use strict';var fileLogger=require(_0x4cf0('0x0'))[_0x4cf0('0x1')];module[_0x4cf0('0x2')]=fileLogger; \ No newline at end of file +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 diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index acae1ea..4b6999a 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 _0xa503=['agi','../../services/agi/index.js','../../services/email/index.js','routing','../../services/xdr/index.js','exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x3d6974,_0x224c77){var _0x494446=function(_0x2b6640){while(--_0x2b6640){_0x3d6974['push'](_0x3d6974['shift']());}};_0x494446(++_0x224c77);}(_0xa503,0x156));var _0x3a50=function(_0x38ef64,_0x4dd68d){_0x38ef64=_0x38ef64-0x0;var _0x2651a6=_0xa503[_0x38ef64];return _0x2651a6;};'use strict';var path=require(_0x3a50('0x0'));var cfg=require(_0x3a50('0x1'));var env={'NODE_PATH':path[_0x3a50('0x2')](path[_0x3a50('0x3')](cfg[_0x3a50('0x4')],_0x3a50('0x5')))};var pm2config={'apps':[{'name':_0x3a50('0x6'),'script':path[_0x3a50('0x3')](__dirname,_0x3a50('0x7')),'env':env},{'name':_0x3a50('0x8'),'script':path[_0x3a50('0x3')](__dirname,_0x3a50('0x9')),'env':env},{'name':_0x3a50('0xa'),'script':path[_0x3a50('0x3')](__dirname,_0x3a50('0xb')),'env':env},{'name':'email','script':path[_0x3a50('0x3')](__dirname,_0x3a50('0xc')),'env':env},{'name':_0x3a50('0xd'),'script':path[_0x3a50('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':'xdr','script':path['join'](__dirname,_0x3a50('0xe')),'env':env}]};module[_0x3a50('0xf')]=pm2config; \ No newline at end of file +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 diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 867a8b3..efc1107 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 _0xebf8=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','then','disconnect'];(function(_0x1f43d5,_0x2d030f){var _0x5bca65=function(_0x478099){while(--_0x478099){_0x1f43d5['push'](_0x1f43d5['shift']());}};_0x5bca65(++_0x2d030f);}(_0xebf8,0x1e3));var _0x8ebf=function(_0x6f1a43,_0x202190){_0x6f1a43=_0x6f1a43-0x0;var _0x411529=_0xebf8[_0x6f1a43];return _0x411529;};'use strict';var pm2=require(_0x8ebf('0x0'));var BPromise=require(_0x8ebf('0x1'));var config=require(_0x8ebf('0x2'));function connect(){return new BPromise(function(_0x692a65,_0x5f5a6c){return pm2[_0x8ebf('0x3')](function(_0x11f08f){if(_0x11f08f){return _0x5f5a6c(_0x11f08f);}return _0x692a65('connected');});});};exports[_0x8ebf('0x4')]=function(_0x267cb2){return connect()[_0x8ebf('0x5')](function(){return new BPromise(function(_0x28cd35,_0x213639){return pm2[_0x8ebf('0x4')](_0x267cb2,function(_0x370304,_0x54b985){if(_0x370304){return _0x213639(_0x370304);}pm2[_0x8ebf('0x6')]();return _0x28cd35(_0x54b985);});});});};exports[_0x8ebf('0x7')]=function(_0x315e03){return connect()[_0x8ebf('0x5')](function(){return new BPromise(function(_0x116d69,_0x4eb6a0){return pm2[_0x8ebf('0x7')](_0x315e03,function(_0x148d30,_0x5ee524){if(_0x148d30){return _0x4eb6a0(_0x148d30);}pm2[_0x8ebf('0x6')]();return _0x116d69(_0x5ee524);});});});};exports[_0x8ebf('0x8')]=function(_0x339ada){return connect()[_0x8ebf('0x5')](function(){return new BPromise(function(_0x3a6f96,_0x119cad){return pm2[_0x8ebf('0x8')](_0x339ada,function(_0x1338e2,_0x1d96da){if(_0x1338e2){return _0x119cad(_0x1338e2);}pm2['disconnect']();return _0x3a6f96(_0x1d96da);});});});};exports['list']=function(){return connect()[_0x8ebf('0x5')](function(){return new BPromise(function(_0x1a1101,_0x5c62a6){return pm2[_0x8ebf('0x9')](function(_0x41cb22,_0xc8eaa8){if(_0x41cb22){return _0x5c62a6(_0x41cb22);}pm2[_0x8ebf('0x6')]();return _0x1a1101(_0xc8eaa8);});});});};exports[_0x8ebf('0xa')]=function(_0x15a36a){return connect()['then'](function(){return new BPromise(function(_0x24d3e5,_0x100469){return pm2['describe'](_0x15a36a,function(_0x141007,_0x50f825){if(_0x141007){return _0x100469(_0x141007);}pm2['disconnect']();return _0x24d3e5(_0x50f825);});});});};exports[_0x8ebf('0xb')]=function(_0x41c0e2){return connect()['then'](function(){return new BPromise(function(_0x5c777b,_0x2d9ca8){return pm2[_0x8ebf('0xb')](_0x41c0e2,function(_0x5ed76d,_0x3fac9a){if(_0x5ed76d){return _0x2d9ca8(_0x5ed76d);}pm2[_0x8ebf('0x6')]();return _0x5c777b(_0x3fac9a);});});});};exports[_0x8ebf('0xc')]=function(){return connect()[_0x8ebf('0x5')](function(){return new BPromise(function(_0x5e89f5,_0x1b98e7){return pm2[_0x8ebf('0xc')](function(_0x318e38){if(_0x318e38){return _0x1b98e7(_0x318e38);}return _0x5e89f5(_0x8ebf('0xd'));});});});}; \ No newline at end of file +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 diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c05591b..d0b232a 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 _0xa2bc=['defaults','find','chatTimeout','ChatInteraction','findAll','subtract','minutes','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','redis'];(function(_0x19d58c,_0x4b8060){var _0x1aed3e=function(_0x2fa498){while(--_0x2fa498){_0x19d58c['push'](_0x19d58c['shift']());}};_0x1aed3e(++_0x4b8060);}(_0xa2bc,0x1b9));var _0xca2b=function(_0x44499e,_0x5654d5){_0x44499e=_0x44499e-0x0;var _0x3df5ba=_0xa2bc[_0x44499e];return _0x3df5ba;};'use strict';var _=require(_0xca2b('0x0'));var moment=require('moment');var Redis=require(_0xca2b('0x1'));var util=require(_0xca2b('0x2'));var config=require('../../config/environment');var db=require(_0xca2b('0x3'))['db'];var logger=require(_0xca2b('0x4'))(_0xca2b('0x5'));config[_0xca2b('0x6')]=_[_0xca2b('0x7')](config[_0xca2b('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca2b('0x6')]));function closeInteractions(){var _0x2b1bdc=0x0;var _0x15c36b=[];return db['Setting'][_0xca2b('0x8')]({'raw':!![],'attributes':['id',_0xca2b('0x9')],'where':{'id':0x1}})['then'](function(_0x4a2fdd){_0x2b1bdc=_0x4a2fdd[_0xca2b('0x9')];if(_0x2b1bdc){return db[_0xca2b('0xa')][_0xca2b('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xca2b('0xc')](_0x4a2fdd[_0xca2b('0x9')],_0xca2b('0xd'))}}});}else{return[];}})['then'](function(_0xd6a994){if(_0xd6a994&&_0xd6a994[_0xca2b('0xe')]){_0x15c36b=_[_0xca2b('0xf')](_0xd6a994||[],'id');logger[_0xca2b('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x15c36b[_0xca2b('0x11')]());return db[_0xca2b('0xa')][_0xca2b('0x12')]({'closeReason':_0xca2b('0x13'),'disposition':_0xca2b('0x14'),'closed':!![],'closedAt':moment()[_0xca2b('0x15')](_0xca2b('0x16'))},{'where':{'id':_0x15c36b}});}})['then'](function(){if(_0x15c36b&&_0x15c36b[_0xca2b('0xe')]){logger[_0xca2b('0x10')](_0xca2b('0x17'),_0x15c36b[_0xca2b('0x11')]());for(var _0x40930a=0x0;_0x40930a<_0x15c36b[_0xca2b('0xe')];_0x40930a++){io['emit'](_0xca2b('0x18'),{'id':_0x15c36b[_0x40930a],'closed':!![]});}}})['catch'](function(_0x8bece2){logger[_0xca2b('0x19')](_0xca2b('0x1a'),_0x8bece2?util['inspect'](_0x8bece2,{'showHidden':![],'depth':null}):'');});}exports[_0xca2b('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +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 diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 3346e30..c08571b 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 _0xe521=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x2c5456,_0x4c4f03){var _0x3d522f=function(_0x4e9f76){while(--_0x4e9f76){_0x2c5456['push'](_0x2c5456['shift']());}};_0x3d522f(++_0x4c4f03);}(_0xe521,0x69));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';function start(){var _0x3776fb=require(_0x1e52('0x0'));return _0x3776fb[_0x1e52('0x1')]();}module[_0x1e52('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +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 diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 36055f2..3a49928 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 _0x0cee=['error\x20mail','info','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','deleteJob','update','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','name','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','existsSync','message','text','stringify','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','SendMail','error'];(function(_0x5839fe,_0x285cec){var _0x44b9ac=function(_0x520eba){while(--_0x520eba){_0x5839fe['push'](_0x5839fe['shift']());}};_0x44b9ac(++_0x285cec);}(_0x0cee,0x12f));var _0xe0ce=function(_0x39bb40,_0x314505){_0x39bb40=_0x39bb40-0x0;var _0x2bf6ed=_0x0cee[_0x39bb40];return _0x2bf6ed;};'use strict';var fs=require('fs');var util=require(_0xe0ce('0x0'));var path=require(_0xe0ce('0x1'));var _=require(_0xe0ce('0x2'));var moment=require(_0xe0ce('0x3'));var CronJobManager=require(_0xe0ce('0x4'));var jayson=require(_0xe0ce('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0xe0ce('0x6'));var db=require(_0xe0ce('0x7'))['db'];var analyticCustomReportController=require(_0xe0ce('0x8'));var analyticDefaultReportController=require(_0xe0ce('0x9'));var client=jayson[_0xe0ce('0xa')][_0xe0ce('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x64f82c,_0x415f34){return function(){logger['info'](_0xe0ce('0xc'),_0x64f82c[_0xe0ce('0xd')]);var _0x52f779=!![];var _0x318835=_0x64f82c[_0xe0ce('0xe')][_0xe0ce('0xf')]();var _0x429a83={'account':_0x318835,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x64f82c['MailAccount'][_0xe0ce('0x10')],_0x64f82c[_0xe0ce('0xe')][_0xe0ce('0xd')]||_0x64f82c[_0xe0ce('0xe')][_0xe0ce('0x11')][_0xe0ce('0x12')]),'to':_0x64f82c[_0xe0ce('0xd')],'cc':_0x64f82c['cc'],'bcc':_0x64f82c[_0xe0ce('0x13')],'subject':util[_0xe0ce('0x14')](_0xe0ce('0x15'),_0x415f34[_0xe0ce('0x10')],_0x64f82c[_0xe0ce('0x16')],_0x64f82c['subtractUnit'])}};var _0x4c8662=path[_0xe0ce('0x17')](__dirname,_0xe0ce('0x18'));var _0x4d2cca=_0x415f34['savename'];var _0x81269b=util[_0xe0ce('0x14')](_0xe0ce('0x19'),path[_0xe0ce('0x1a')](_0x415f34[_0xe0ce('0x1b')],path['extname'](_0x415f34[_0xe0ce('0x1b')])),'zip');var _0x5ff437=path[_0xe0ce('0x17')](_0x4c8662,_0x4d2cca);var _0x2182e1=path[_0xe0ce('0x17')](_0x4c8662,_0x81269b);if(fs[_0xe0ce('0x1c')](_0x5ff437)){_0x415f34['status']='Sent';_0x429a83[_0xe0ce('0x1d')]['attachments']=[{'filename':_0x4d2cca,'path':_0x5ff437}];_0x429a83['message'][_0xe0ce('0x1e')]=util[_0xe0ce('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xe0ce('0x1f')](_0x415f34,null,0x2));}else if(fs[_0xe0ce('0x1c')](_0x2182e1)){_0x415f34[_0xe0ce('0x20')]=_0xe0ce('0x21');_0x429a83[_0xe0ce('0x1d')]['attachments']=[{'filename':_0x81269b,'path':_0x2182e1}];}else{_0x429a83[_0xe0ce('0x1d')]['text']=_0xe0ce('0x22');if(!_0x64f82c['sendIfEmpty']){_0x52f779=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x52f779){return client['request'](_0xe0ce('0x23'),_0x429a83)['then'](function(_0x174b74){if(_0x174b74[_0xe0ce('0x24')]){return logger[_0xe0ce('0x24')](_0xe0ce('0x25'),JSON[_0xe0ce('0x1f')](_0x174b74));}return logger[_0xe0ce('0x26')](_0xe0ce('0x27'));})[_0xe0ce('0x28')](function(_0x417fe3){return logger[_0xe0ce('0x24')](_0xe0ce('0x25'),JSON[_0xe0ce('0x1f')](_0x417fe3));});}};}function handleError(){return function(_0x47e4e6){return logger[_0xe0ce('0x24')](JSON[_0xe0ce('0x1f')](_0x47e4e6));};}function handleResult(_0x42d3ed){return function(_0x15e824){logger['info'](_0xe0ce('0x29'),JSON[_0xe0ce('0x1f')](_0x15e824));if(_0x42d3ed['MailAccount']&&_0x42d3ed[_0xe0ce('0xe')][_0xe0ce('0x11')]&&!_[_0xe0ce('0x2a')](_0x42d3ed[_0xe0ce('0xd')])){setTimeout(handleSendEmail(_0x42d3ed,_0x15e824),0x3c*0x3e8);}};}function handleJob(_0x649f21){return function(){try{if(_[_0xe0ce('0x2a')](_0x649f21[_0xe0ce('0x16')])){return logger['info'](_0xe0ce('0x2b'));}if(_[_0xe0ce('0x2a')](_0x649f21[_0xe0ce('0x2c')])){return logger[_0xe0ce('0x26')](_0xe0ce('0x2d'));}var _0x1271c3={'startDate':moment()[_0xe0ce('0x2e')](_0x649f21['subtractNumber'],_0x649f21['subtractUnit'])[_0xe0ce('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xe0ce('0x14')](_0xe0ce('0x2f')),'type':_0xe0ce('0x30'),'output':_0x649f21[_0xe0ce('0x31')],'name':_0x649f21[_0xe0ce('0x10')]};if(!_['isNil'](_0x649f21[_0xe0ce('0x32')])){logger[_0xe0ce('0x26')]('exec\x20defaul\x20report\x20id:%s',_0x649f21['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x649f21[_0xe0ce('0x32')]},_0x1271c3)[_0xe0ce('0x33')](handleResult(_0x649f21))['catch'](handleError());}if(!_[_0xe0ce('0x2a')](_0x649f21[_0xe0ce('0x34')])){logger[_0xe0ce('0x26')](_0xe0ce('0x35'),_0x649f21['CustomReportId']);return analyticCustomReportController[_0xe0ce('0x36')]({'id':_0x649f21[_0xe0ce('0x34')]},_0x1271c3)[_0xe0ce('0x33')](handleResult(_0x649f21))[_0xe0ce('0x28')](handleError());}}catch(_0x1c5d74){logger['error'](JSON['stringify'](_0x1c5d74));}return logger[_0xe0ce('0x26')](_0xe0ce('0x37'));};}function getJobs(_0x470a3f){var _0x26df1b={};if(_0x470a3f){_0x26df1b['id']=_0x470a3f;}return db['Schedule'][_0xe0ce('0x38')]({'where':_0x26df1b,'include':[{'model':db[_0xe0ce('0xe')],'attributes':['id','name',_0xe0ce('0xd')],'include':[{'model':db[_0xe0ce('0x39')],'as':'Smtp','include':[{'model':db[_0xe0ce('0x3a')],'as':_0xe0ce('0x3a')}]}]}]})[_0xe0ce('0x33')](function(_0x4e963){var _0x2b61b5=_[_0xe0ce('0x3b')](manager[_0xe0ce('0x3c')]);var _0x5d5a50=_[_0xe0ce('0x3d')](_0x4e963,function(_0x423acd){return _0x423acd['id'][_0xe0ce('0x3e')]();});var _0x25e413=_[_0xe0ce('0x3f')](_0x4e963,function(_0x513aa0){return _0x513aa0['id']['toString']();});var _0x21b4e4=_0x470a3f?_0x5d5a50:_[_0xe0ce('0x40')](_0x5d5a50,_0x2b61b5);var _0x2f8e67=_['intersection'](_0x5d5a50,_0x2b61b5);var _0x1de6b9=_[_0xe0ce('0x40')](_0x2b61b5,_0x5d5a50);var _0x4827de;var _0x525a6e;for(_0x4827de=0x0;_0x4827de<_0x1de6b9[_0xe0ce('0x41')]&&!_0x470a3f;_0x4827de+=0x1){_0x525a6e=_0x1de6b9[_0x4827de][_0xe0ce('0x3e')]();if(manager[_0xe0ce('0x42')](_0x525a6e)){manager[_0xe0ce('0x43')](_0x525a6e);manager['deleteJob'](_0x525a6e);logger[_0xe0ce('0x26')](_0xe0ce('0x44'),_0x525a6e);}}logger[_0xe0ce('0x26')](_0xe0ce('0x45'),JSON[_0xe0ce('0x1f')](_0x21b4e4));for(_0x4827de=0x0;_0x4827de<_0x21b4e4[_0xe0ce('0x41')];_0x4827de+=0x1){_0x525a6e=_0x21b4e4[_0x4827de][_0xe0ce('0x3e')]();logger['info'](_0xe0ce('0x46'),_0x525a6e);if(_0x470a3f){logger[_0xe0ce('0x26')](_0xe0ce('0x47'),_0x470a3f);logger[_0xe0ce('0x26')](JSON[_0xe0ce('0x1f')](_0x25e413[_0x525a6e]));BPromise[_0xe0ce('0x48')]()[_0xe0ce('0x33')](handleJob(_0x25e413[_0x525a6e]));logger['info'](_0xe0ce('0x49'),_0x25e413[_0x525a6e][_0xe0ce('0x10')],_0x25e413[_0x525a6e]['cron']);}else if(_0x25e413[_0x525a6e][_0xe0ce('0x4a')]&&_0x25e413[_0x525a6e][_0xe0ce('0x4b')]&&moment()[_0xe0ce('0x4c')](_0x25e413[_0x525a6e][_0xe0ce('0x4d')],_0x25e413[_0x525a6e][_0xe0ce('0x4e')])){manager['add'](_0x525a6e,_0x25e413[_0x525a6e][_0xe0ce('0x4a')],handleJob(_0x25e413[_0x525a6e]));manager[_0xe0ce('0x4f')](_0x525a6e);logger[_0xe0ce('0x26')](_0xe0ce('0x50'),_0x25e413[_0x525a6e][_0xe0ce('0x10')],_0x25e413[_0x525a6e][_0xe0ce('0x4a')]);}else if(manager[_0xe0ce('0x42')](_0x525a6e)){manager[_0xe0ce('0x43')](_0x525a6e);manager[_0xe0ce('0x51')](_0x525a6e);logger[_0xe0ce('0x26')]('stop\x20cron',_0x25e413[_0x525a6e]['name'],_0x25e413[_0x525a6e][_0xe0ce('0x4a')]);}}for(_0x4827de=0x0,_0x525a6e;_0x4827de<_0x2f8e67[_0xe0ce('0x41')]&&!_0x470a3f;_0x4827de+=0x1){_0x525a6e=_0x2f8e67[_0x4827de][_0xe0ce('0x3e')]();if(manager['exists'](_0x525a6e)){if(_0x25e413[_0x525a6e][_0xe0ce('0x4a')]&&_0x25e413[_0x525a6e]['active']&&moment()[_0xe0ce('0x4c')](_0x25e413[_0x525a6e]['startAt'],_0x25e413[_0x525a6e][_0xe0ce('0x4e')])){manager[_0xe0ce('0x52')](_0x525a6e,_0x25e413[_0x525a6e][_0xe0ce('0x4a')],handleJob(_0x25e413[_0x525a6e]));logger['info']('update\x20cron',_0x25e413[_0x525a6e][_0xe0ce('0x10')],_0x25e413[_0x525a6e][_0xe0ce('0x4a')]);}else{manager[_0xe0ce('0x43')](_0x525a6e);manager[_0xe0ce('0x51')](_0x525a6e);logger['info'](_0xe0ce('0x53'),_0x25e413[_0x525a6e]['name'],_0x25e413[_0x525a6e]['cron']);}}}})[_0xe0ce('0x28')](function(_0x267276){logger[_0xe0ce('0x24')](JSON[_0xe0ce('0x1f')](_0x267276));});}exports[_0xe0ce('0x54')]=function(_0x270b7a){return getJobs(_0x270b7a);};exports[_0xe0ce('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +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 diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 080e6eb..68f6c07 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 _0x8a5c=['VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','format','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','FAILED','FailureReason','resolve','sentiment','Positive','Mixed','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect'];(function(_0x8d1b9c,_0x2be61e){var _0x387ca9=function(_0x375322){while(--_0x375322){_0x8d1b9c['push'](_0x8d1b9c['shift']());}};_0x387ca9(++_0x2be61e);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2c1c7d,_0x2e6245){_0x2c1c7d=_0x2c1c7d-0x0;var _0x492efe=_0x8a5c[_0x2c1c7d];return _0x492efe;};var _=require(_0xc8a5('0x0'));var AWS=require(_0xc8a5('0x1'));var rp=require(_0xc8a5('0x2'));var util=require(_0xc8a5('0x3'));var BPromise=require(_0xc8a5('0x4'));var db=require(_0xc8a5('0x5'))['db'];var logger=require(_0xc8a5('0x6'))(_0xc8a5('0x7'));function getTranscriptionJob(_0x84a3f4,_0x4dd6e0,_0x2b253c,_0x66b54){return new Promise(function(_0x5b6cc2,_0x1b4ed4){var _0xcee97e=new AWS[(_0xc8a5('0x8'))]({'accessKeyId':_0x4dd6e0,'secretAccessKey':_0x84a3f4,'region':_0x2b253c});_0xcee97e[_0xc8a5('0x9')]({'TranscriptionJobName':_0x66b54},function(_0x4d25e4,_0x3ecf08){if(_0x4d25e4){return _0x1b4ed4(_0x4d25e4);}else{return _0x5b6cc2(_0x3ecf08);}});});}function sentiment(_0x28529d,_0xbdcd79,_0x2c1fe9,_0x814714,_0x3b2ba3){return new Promise(function(_0x136146,_0x16fd9a){var _0xea6d98=new AWS['Comprehend']({'accessKeyId':_0xbdcd79,'secretAccessKey':_0x28529d,'region':_0x2c1fe9});_0xea6d98['detectSentiment']({'Text':_0x814714,'LanguageCode':_0x3b2ba3[_0xc8a5('0xa')](0x0,0x2)},function(_0x4a772e,_0xaa6fa2){if(_0x4a772e){return _0x16fd9a(_0x4a772e);}else{return _0x136146(_0xaa6fa2);}});});}function checkTranscribeJob(_0x38a605,_0x1295a9,_0x2c6402){var _0x3e1b4f;return new BPromise(function(_0x5c9d13,_0x16cffa){logger[_0xc8a5('0xb')](util['format'](_0xc8a5('0xc'),_0x38a605['id'],_0x38a605[_0xc8a5('0xd')]));return getTranscriptionJob(_0x2c6402[_0xc8a5('0xe')],_0x2c6402[_0xc8a5('0xf')],_0x1295a9[_0xc8a5('0x10')],_0x38a605[_0xc8a5('0xd')])['then'](function(_0xbc4806){logger[_0xc8a5('0xb')](util['format'](_0xc8a5('0x11'),_0x38a605['id'],_0x38a605[_0xc8a5('0xd')],_0xbc4806['TranscriptionJob'][_0xc8a5('0x12')]));if(!_0x38a605[_0xc8a5('0x13')]){switch(_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x12')]){case _0xc8a5('0x15'):var _0x4b0aa0={'transcribeStatus':_0xbc4806[_0xc8a5('0x14')]['TranscriptionJobStatus'],'fileUri':_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x16')]['TranscriptFileUri']};logger['info'](util[_0xc8a5('0x17')](_0xc8a5('0x18'),_0x38a605['id']));return rp({'uri':_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x16')][_0xc8a5('0x19')],'json':!![]})['then'](function(_0x4fec79){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x1a'),_0x38a605['id']));if(_0x4fec79&&_0x4fec79[_0xc8a5('0x1b')]&&_0x4fec79[_0xc8a5('0x1b')][_0xc8a5('0x1c')]&&_0x4fec79['results'][_0xc8a5('0x1c')][_0xc8a5('0x1d')]){_0x4b0aa0[_0xc8a5('0x13')]='';for(var _0x1e522c=0x0;_0x1e522c<_0x4fec79[_0xc8a5('0x1b')][_0xc8a5('0x1c')][_0xc8a5('0x1d')];_0x1e522c++){_0x4b0aa0[_0xc8a5('0x13')]+=_0x4fec79[_0xc8a5('0x1b')]['transcripts'][_0x1e522c][_0xc8a5('0x1e')]+'';}}return _0x38a605[_0xc8a5('0x1f')](_0x4b0aa0);})[_0xc8a5('0x20')](function(){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x21'),_0x38a605['id']));if(!_0x38a605[_0xc8a5('0x22')]){throw new db['Sequelize']['ValidationError'](_0xc8a5('0x23'));}if(!_0x1295a9['sentiment']||!_0x1295a9['sentimentAccountId']||!_0x1295a9[_0xc8a5('0x24')]||!_0x1295a9[_0xc8a5('0x25')]||!_0x1295a9[_0xc8a5('0x26')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x29'));}if(!_0x4b0aa0['fileText']){throw new Error(_0xc8a5('0x2a'));}if(_0x1295a9[_0xc8a5('0x2b')]===_0x2c6402['id']){return _0x2c6402;}else{return db[_0xc8a5('0x2c')][_0xc8a5('0x2d')]({'where':{'id':_settings[_0xc8a5('0x2b')]}});}})[_0xc8a5('0x20')](function(_0x4b47dc){if(!_0x4b47dc){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x2e'));}if(!_0x4b47dc[_0xc8a5('0xe')]||!_0x4b47dc['data2']){throw new db['Sequelize'][(_0xc8a5('0x28'))](_0xc8a5('0x2f'));}_0x3e1b4f=_0x4b47dc;logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x30'),_0x38a605['id']));return sentiment(_0x3e1b4f['data1'],_0x3e1b4f[_0xc8a5('0xf')],_0x1295a9['sentimentRegion'],_0x4b0aa0[_0xc8a5('0x13')],_0x1295a9[_0xc8a5('0x25')]);})[_0xc8a5('0x20')](function(_0x5a2941){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x31'),_0x38a605['id']));return _0x38a605['update']({'sentiment':_0x5a2941[_0xc8a5('0x32')],'sPositive':_0x5a2941[_0xc8a5('0x33')]['Positive'],'sNegative':_0x5a2941[_0xc8a5('0x33')]['Negative'],'sMixed':_0x5a2941['SentimentScore']['Mixed'],'sNeutral':_0x5a2941['SentimentScore']['Neutral']});})[_0xc8a5('0x20')](function(){logger['info'](util[_0xc8a5('0x17')](_0xc8a5('0x21'),_0x38a605['id']));_0x5c9d13();});case _0xc8a5('0x34'):return _0x38a605[_0xc8a5('0x1f')]({'transcribeStatus':_0xc8a5('0x34'),'failureReason':_0xbc4806[_0xc8a5('0x14')][_0xc8a5('0x35')]})['then'](function(){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x38a605['id']));_0x5c9d13();});default:logger[_0xc8a5('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x38a605['id']));break;}}else{return BPromise[_0xc8a5('0x36')]()[_0xc8a5('0x20')](function(){if(!_0x38a605[_0xc8a5('0x22')]){throw new db['Sequelize']['ValidationError'](_0xc8a5('0x23'));}if(!_0x1295a9[_0xc8a5('0x37')]||!_0x1295a9[_0xc8a5('0x2b')]||!_0x1295a9[_0xc8a5('0x24')]||!_0x1295a9['language']||!_0x1295a9[_0xc8a5('0x26')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x38a605['fileText']){throw new Error(_0xc8a5('0x2a'));}if(_0x1295a9[_0xc8a5('0x2b')]===_0x2c6402['id']){return _0x2c6402;}else{return db[_0xc8a5('0x2c')][_0xc8a5('0x2d')]({'where':{'id':_settings[_0xc8a5('0x2b')]}});}})['then'](function(_0x2f512f){if(!_0x2f512f){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2f512f[_0xc8a5('0xe')]||!_0x2f512f[_0xc8a5('0xf')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x2f'));}_0x3e1b4f=_0x2f512f;logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x30'),_0x38a605['id']));return sentiment(_0x3e1b4f[_0xc8a5('0xe')],_0x3e1b4f[_0xc8a5('0xf')],_0x1295a9[_0xc8a5('0x24')],_0x38a605[_0xc8a5('0x13')],_0x1295a9[_0xc8a5('0x25')]);})[_0xc8a5('0x20')](function(_0x5bc633){logger[_0xc8a5('0xb')](util[_0xc8a5('0x17')](_0xc8a5('0x31'),_0x38a605['id']));return _0x38a605[_0xc8a5('0x1f')]({'sentiment':_0x5bc633[_0xc8a5('0x32')],'sPositive':_0x5bc633[_0xc8a5('0x33')][_0xc8a5('0x38')],'sNegative':_0x5bc633[_0xc8a5('0x33')]['Negative'],'sMixed':_0x5bc633['SentimentScore'][_0xc8a5('0x39')],'sNeutral':_0x5bc633[_0xc8a5('0x33')][_0xc8a5('0x3a')],'transcribeStatus':'COMPLETED'});})[_0xc8a5('0x20')](function(){logger[_0xc8a5('0xb')](util['format'](_0xc8a5('0x21'),_0x38a605['id']));_0x5c9d13();});}})[_0xc8a5('0x3b')](function(_0x3e112f){if(_0x3e112f){if(!_0x3e112f[_0xc8a5('0x3c')]||_0x3e112f['name']!==_0xc8a5('0x3d')){logger[_0xc8a5('0x3e')](util[_0xc8a5('0x17')](_0xc8a5('0x3f'),_0x38a605['id']),util[_0xc8a5('0x40')](_0x3e112f,{'showHidden':![],'depth':null}));}}_0x5c9d13();});});}function checkTranscribe(){var _0x45dddf;var _0x5d2435;var _0x1b44df;return db[_0xc8a5('0x41')][_0xc8a5('0x42')]({'where':{'transcribeStatus':_0xc8a5('0x43')}})[_0xc8a5('0x20')](function(_0x1de54a){if(!_0x1de54a||!_0x1de54a[_0xc8a5('0x1d')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x44'));}_0x45dddf=_0x1de54a;return db[_0xc8a5('0x45')][_0xc8a5('0x2d')]({'where':{'id':0x1}});})[_0xc8a5('0x20')](function(_0x568ce2){if(!_0x568ce2){throw new db[(_0xc8a5('0x27'))]['ValidationError']('Settings\x20not\x20available');}_0x5d2435=_0x568ce2;if(!_0x5d2435['transcribe']||!_0x5d2435[_0xc8a5('0x46')]||!_0x5d2435['transcribeRegion']||!_0x5d2435[_0xc8a5('0x25')]||!_0x5d2435[_0xc8a5('0x26')]){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x47'));}return db[_0xc8a5('0x2c')][_0xc8a5('0x2d')]({'where':{'id':_0x5d2435[_0xc8a5('0x46')]}});})[_0xc8a5('0x20')](function(_0x4f9b24){if(!_0x4f9b24){throw new db[(_0xc8a5('0x27'))][(_0xc8a5('0x28'))](_0xc8a5('0x2e'));}if(!_0x4f9b24[_0xc8a5('0xe')]||!_0x4f9b24[_0xc8a5('0xf')]){throw new db['Sequelize'][(_0xc8a5('0x28'))](_0xc8a5('0x2f'));}_0x1b44df=_0x4f9b24;var _0x21f299=[];_0x45dddf[_0xc8a5('0x48')](function(_0x50218c){_0x21f299['push'](checkTranscribeJob(_0x50218c,_0x5d2435,_0x1b44df));});return BPromise[_0xc8a5('0x49')](_0x21f299);})['catch'](function(_0x43e530){if(_0x43e530){if(!_0x43e530[_0xc8a5('0x3c')]||_0x43e530['name']!==_0xc8a5('0x3d')){logger['error'](util[_0xc8a5('0x40')](_0x43e530,{'showHidden':![],'depth':null}));}}});}exports[_0xc8a5('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +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 diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index dabed06..9205ed8 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 _0x65e2=['findAll','lastMsgAt','subtract','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','WhatsappInteraction'];(function(_0x4cc51a,_0x13da08){var _0x16c6da=function(_0x1231b0){while(--_0x1231b0){_0x4cc51a['push'](_0x4cc51a['shift']());}};_0x16c6da(++_0x13da08);}(_0x65e2,0x1b7));var _0x265e=function(_0x1f10db,_0x3ffb29){_0x1f10db=_0x1f10db-0x0;var _0x37730c=_0x65e2[_0x1f10db];return _0x37730c;};'use strict';var _=require(_0x265e('0x0'));var moment=require(_0x265e('0x1'));var Redis=require(_0x265e('0x2'));var util=require(_0x265e('0x3'));var config=require(_0x265e('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x265e('0x5'))(_0x265e('0x6'));config[_0x265e('0x7')]=_[_0x265e('0x8')](config[_0x265e('0x7')],{'host':_0x265e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x265e('0x7')]));function closeInteractions(){var _0x18e633=[];return db[_0x265e('0xa')][_0x265e('0xb')]({'raw':!![],'attributes':['id',_0x265e('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x265e('0xd')](0x18,_0x265e('0xe'))}}})[_0x265e('0xf')](function(_0x592986){if(_0x592986&&_0x592986[_0x265e('0x10')]){_0x18e633=_['map'](_0x592986||[],'id');logger['info'](_0x265e('0x11'),_0x18e633['join']());return db['WhatsappInteraction'][_0x265e('0x12')]({'closeReason':_0x265e('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x265e('0x14'))},{'where':{'id':_0x18e633}});}})[_0x265e('0xf')](function(){if(_0x18e633&&_0x18e633['length']){logger['info'](_0x265e('0x15'),_0x18e633[_0x265e('0x16')]());for(var _0x25d5e9=0x0;_0x25d5e9<_0x18e633[_0x265e('0x10')];_0x25d5e9++){io[_0x265e('0x17')](_0x265e('0x18'),{'id':_0x18e633[_0x25d5e9],'closed':!![]});}}})[_0x265e('0x19')](function(_0x477e1d){logger[_0x265e('0x1a')](_0x265e('0x1b'),_0x477e1d?util[_0x265e('0x1c')](_0x477e1d,{'showHidden':![],'depth':null}):'');});}exports[_0x265e('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +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 diff --git a/server/config/seedContact.js b/server/config/seedContact.js index d426a04..1242664 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3848=['bulkCreate','contacts2','hopper2','catch','push','Innocenzo','Biondo','innocenzo.biondo','now','destroy','then','CmContact','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x1ac20e,_0x424aa8){var _0x481169=function(_0x360ef8){while(--_0x360ef8){_0x1ac20e['push'](_0x1ac20e['shift']());}};_0x481169(++_0x424aa8);}(_0x3848,0x1be));var _0x8384=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0x3848[_0x35a274];return _0x40d905;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8384('0x0')]({'id':i,'firstName':_0x8384('0x1')+i,'lastName':_0x8384('0x2')+i,'phone':0xf879fb460+i,'email':_0x8384('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8384('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x8384('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8384('0x4')](),'updatedAt':Date[_0x8384('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8384('0x0')]({'id':i,'firstName':_0x8384('0x1')+i,'lastName':_0x8384('0x2')+i,'phone':0xf879fb460+i,'email':_0x8384('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8384('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8384('0x4')](),'updatedAt':Date['now']()});}db['CmContact'][_0x8384('0x5')]({'where':{}})[_0x8384('0x6')](function(){return db[_0x8384('0x7')]['bulkCreate'](contacts);})[_0x8384('0x6')](function(){console[_0x8384('0x8')](_0x8384('0x9'),_0x8384('0xa'));return db[_0x8384('0xb')][_0x8384('0x5')]({'where':{}});})[_0x8384('0x6')](function(){return db[_0x8384('0xb')]['bulkCreate'](hopper);})[_0x8384('0x6')](function(){console[_0x8384('0x8')](_0x8384('0x9'),_0x8384('0xc'));return db[_0x8384('0x7')][_0x8384('0xd')](contacts2);})['then'](function(){console[_0x8384('0x8')](_0x8384('0x9'),_0x8384('0xe'));return db[_0x8384('0xb')][_0x8384('0xd')](hopper2);})['then'](function(){console[_0x8384('0x8')](_0x8384('0x9'),_0x8384('0xf'));})[_0x8384('0x10')](function(_0x15aecf){console[_0x8384('0x8')](_0x15aecf);}); \ No newline at end of file +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 diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 116f7d4..c50fc04 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdec8=['%s%s','%s%s@xcally.com','agent','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','log','util','../mysqldb','push','format'];(function(_0x4fc476,_0xb7cdfd){var _0x2de7d8=function(_0x5c4f8f){while(--_0x5c4f8f){_0x4fc476['push'](_0x4fc476['shift']());}};_0x2de7d8(++_0xb7cdfd);}(_0xdec8,0xac));var _0x8dec=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xdec8[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0x8dec('0x0'));var db=require(_0x8dec('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8dec('0x2')]({'name':util[_0x8dec('0x3')](_0x8dec('0x4'),'agent',i),'fullname':util[_0x8dec('0x3')](_0x8dec('0x4'),'agent',i),'email':util[_0x8dec('0x3')](_0x8dec('0x5'),_0x8dec('0x6'),i),'role':_0x8dec('0x6'),'password':_0x8dec('0x7'),'internal':0xfa0+i,'type':_0x8dec('0x8'),'transport':['udp','ws',_0x8dec('0x9')],'disallow':[_0x8dec('0xa')],'allow':[_0x8dec('0xb')],'defaultuser':util[_0x8dec('0x3')]('%s%s',_0x8dec('0x6'),i),'encryption':_0x8dec('0xc'),'avpf':'yes','force_avp':_0x8dec('0xc'),'icesupport':_0x8dec('0xc'),'dtlsenable':_0x8dec('0xc'),'dtlsverify':'no','dtlscertfile':_0x8dec('0xd'),'dtlsprivatekey':_0x8dec('0xe'),'dtlssetup':_0x8dec('0xf'),'callerid':util[_0x8dec('0x3')](_0x8dec('0x10'),util[_0x8dec('0x3')](_0x8dec('0x4'),_0x8dec('0x6'),i),0xfa0+i)});}db[_0x8dec('0x11')][_0x8dec('0x12')](users)[_0x8dec('0x13')](function(){console['log'](_0x8dec('0x14'));})['catch'](function(_0x4898ee){console[_0x8dec('0x15')](_0x4898ee);}); \ No newline at end of file +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 diff --git a/server/config/socketio.js b/server/config/socketio.js index cf68544..9bc0b92 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','role','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','SmsQueues','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','then','where','Campaign'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x2ef3,0xba));var _0x32ef=function(_0x1f4be1,_0x111849){_0x1f4be1=_0x1f4be1-0x0;var _0x45e879=_0x2ef3[_0x1f4be1];return _0x45e879;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var db=require(_0x32ef('0x3'))['db'];var config=require(_0x32ef('0x4'));var queryQueues={'attributes':['id',_0x32ef('0x5')],'include':[{'as':'Agents','model':db[_0x32ef('0x6')],'attributes':['id',_0x32ef('0x5'),'role'],'raw':!![],'where':{'role':_0x32ef('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x32ef('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x32ef('0x5')],'where':{'role':_0x32ef('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x32ef('0x5'),_0x32ef('0x8')],'where':{'type':_0x32ef('0x9')}};function getAssociatedResources(_0x298066,_0x2484a0,_0x2bbb50){return db[_0x32ef('0xa')][_0x32ef('0xb')]({'where':{'name':_0x298066,'userProfileId':_0x2484a0},'raw':!![]})['then'](function(_0x5780e9){if(_0x5780e9){if(_0x5780e9[_0x32ef('0xc')]){switch(_0x298066){case _0x32ef('0xd'):case _0x32ef('0xe'):case _0x32ef('0xf'):case'SmsQueues':case _0x32ef('0x10'):case'OpenchannelQueues':case _0x32ef('0x11'):return db[_0x2bbb50]['findAll'](queryQueues);case _0x32ef('0x12'):return db[_0x2bbb50][_0x32ef('0x13')](queryTelephones);case'Trunks':return db[_0x2bbb50]['findAll'](queryTrunks);case _0x32ef('0x14'):return db[_0x2bbb50]['findAll'](queryCampaigns);}}else{return db[_0x32ef('0x15')][_0x32ef('0x13')]({'attributes':[_0x32ef('0x16')],'where':{'sectionId':_0x5780e9['id']},'raw':!![]})[_0x32ef('0x17')](function(_0x57aff1){if(_0x57aff1){var _0x55bf0b={'where':{'id':_['map'](_0x57aff1,_0x32ef('0x16'))},'raw':!![]};switch(_0x2bbb50){case _0x32ef('0x6'):_0x55bf0b[_0x32ef('0x18')]['role']='telephone';break;case _0x32ef('0x19'):_0x55bf0b[_0x32ef('0x18')][_0x32ef('0x8')]='ivr';break;}return db[_0x2bbb50][_0x32ef('0x13')](_0x55bf0b);}else{return[];}});}}else{return[];}})[_0x32ef('0x17')](function(_0x4f4c98){return _0x4f4c98;});}function joinOrLeaveQueues(_0x304505,_0x314ef1,_0x26aff3,_0x251084){_0x304505[_0x314ef1](util[_0x32ef('0x1a')](_0x32ef('0x1b'),_0x26aff3,_0x251084['name']));if(_0x251084[_0x32ef('0x1c')]){for(var _0x5cc3ef=0x0;_0x5cc3ef<_0x251084[_0x32ef('0x1c')][_0x32ef('0x1d')];_0x5cc3ef+=0x1){_0x304505[_0x314ef1](util['format'](_0x32ef('0x1e'),_0x251084[_0x32ef('0x1c')][_0x5cc3ef][_0x32ef('0x5')]));}}}function joinOrLeave(_0x55f7f2,_0x57f5e5,_0x22f2d7){var _0xb30fab;if(_0x55f7f2[_0x32ef('0x1f')]['query']['id']){db['User'][_0x32ef('0x20')]({'attributes':['id','name','role',_0x32ef('0x21')],'where':{'id':_0x55f7f2[_0x32ef('0x1f')][_0x32ef('0x22')]['id']},'include':[{'model':db[_0x32ef('0x23')],'as':_0x32ef('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x25')],'as':_0x32ef('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x27')],'as':_0x32ef('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x29')],'as':_0x32ef('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x32ef('0x2c')],'as':_0x32ef('0x2d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x12de1a){if(_0x12de1a){_0xb30fab=_0x12de1a;_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x1e'),_0x12de1a[_0x32ef('0x5')]));var _0x50a95b=[];switch(_0x12de1a[_0x32ef('0x2e')]){case _0x32ef('0x2f'):_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));if(queryQueues[_0x32ef('0x32')](_0x32ef('0x33'))){delete queryQueues[_0x32ef('0x33')];}_0x50a95b['push'](db[_0x32ef('0x34')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x36')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x37')][_0x32ef('0x13')](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x38')]['findAll'](queryQueues));_0x50a95b['push'](db[_0x32ef('0x39')]['findAll'](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3a')][_0x32ef('0x13')](queryQueues));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3b')][_0x32ef('0x13')](queryQueues));_0x50a95b['push'](db['User']['findAll'](queryTelephones));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x3c')][_0x32ef('0x13')](queryTrunks));_0x50a95b['push'](db['Campaign'][_0x32ef('0x13')](queryCampaigns));_0x50a95b[_0x32ef('0x35')](db[_0x32ef('0x6')]['findAll'](queryAgents));break;case'user':_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xd'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x34')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xe'),_0x12de1a[_0x32ef('0x21')],'ChatQueue'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0xf'),_0x12de1a[_0x32ef('0x21')],'FaxQueue'));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x3d'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x38')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x10'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x39')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x3e'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3a')));_0x50a95b['push'](getAssociatedResources(_0x32ef('0x11'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3b')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x12'),_0x12de1a[_0x32ef('0x21')],_0x32ef('0x6')));_0x50a95b['push'](getAssociatedResources('Trunks',_0x12de1a[_0x32ef('0x21')],_0x32ef('0x3c')));_0x50a95b[_0x32ef('0x35')](getAssociatedResources(_0x32ef('0x14'),_0x12de1a['userProfileId'],_0x32ef('0x19')));_0x50a95b[_0x32ef('0x35')](db['User'][_0x32ef('0x13')](queryAgents));break;case'agent':_0x55f7f2[_0x57f5e5](_0x32ef('0x30'));_0x55f7f2[_0x57f5e5](_0x32ef('0x31'));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x3f')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x40')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x41')]({'attributes':['id','name']}));_0x50a95b[_0x32ef('0x35')](_0x12de1a['getSmsQueues']({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x42')]({'attributes':['id','name']}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x43')]({'attributes':['id',_0x32ef('0x5')]}));_0x50a95b[_0x32ef('0x35')](_0x12de1a[_0x32ef('0x44')]({'attributes':['id',_0x32ef('0x5')]}));break;}return BPromise[_0x32ef('0x45')](_0x50a95b);}})['then'](function(_0x5cb6fc){if(_0x5cb6fc&&_0x5cb6fc[_0x32ef('0x1d')]){for(var _0x270826=0x0;_0x270826<_0x5cb6fc[_0x32ef('0x1d')];_0x270826+=0x1){for(var _0x13b270=0x0;_0x13b270<_0x5cb6fc[_0x270826][_0x32ef('0x1d')];_0x13b270+=0x1){switch(_0x270826){case 0x0:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x46'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x1:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x47'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x2:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x48'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x3:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x49'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x4:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4a'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x5:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4b'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x6:joinOrLeaveQueues(_0x55f7f2,_0x57f5e5,_0x32ef('0x4c'),_0x5cb6fc[_0x270826][_0x13b270]);break;case 0x7:if(_0xb30fab[_0x32ef('0x2e')]!=='agent')_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4d'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0x8:if(_0xb30fab[_0x32ef('0x2e')]!==_0x32ef('0x7'))_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4e'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0x9:if(_0xb30fab[_0x32ef('0x2e')]!==_0x32ef('0x7'))_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x4f'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x8')],_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;case 0xa:_0x55f7f2[_0x57f5e5](util[_0x32ef('0x1a')](_0x32ef('0x1e'),_0x5cb6fc[_0x270826][_0x13b270][_0x32ef('0x5')]));break;}}}}})[_0x32ef('0x17')](function(){if(_0x57f5e5==='leave'){var _0x515ac9=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x24')],'id');return _0xb30fab[_0x32ef('0x51')](_0x515ac9)[_0x32ef('0x17')](function(){for(var _0x34bd3e=0x0;_0x34bd3e<_0x515ac9[_0x32ef('0x1d')];_0x34bd3e+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x53'),{'ChatInteractionId':Number(_0x515ac9[_0x34bd3e]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x3697a7=_['map'](_0xb30fab[_0x32ef('0x26')],'id');return _0xb30fab[_0x32ef('0x55')](_0x3697a7)[_0x32ef('0x17')](function(){for(var _0x3fe01f=0x0;_0x3fe01f<_0x3697a7[_0x32ef('0x1d')];_0x3fe01f+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3697a7[_0x3fe01f]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x31d5d8=_['map'](_0xb30fab[_0x32ef('0x28')],'id');return _0xb30fab['removeFaxInteractions'](_0x31d5d8)[_0x32ef('0x17')](function(){for(var _0xbe35b=0x0;_0xbe35b<_0x31d5d8['length'];_0xbe35b+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x31d5d8[_0xbe35b]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x17')](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x2bff39=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x2a')],'id');return _0xb30fab[_0x32ef('0x56')](_0x2bff39)[_0x32ef('0x17')](function(){for(var _0x56260f=0x0;_0x56260f<_0x2bff39['length'];_0x56260f+=0x1){_0x22f2d7[_0x32ef('0x52')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2bff39[_0x56260f]),'UserId':Number(_0xb30fab['id'])});}});}})['then'](function(){if(_0x57f5e5===_0x32ef('0x54')){var _0x89d0b3=_[_0x32ef('0x50')](_0xb30fab[_0x32ef('0x57')],'id');return _0xb30fab[_0x32ef('0x58')](_0x89d0b3)[_0x32ef('0x17')](function(){for(var _0x316547=0x0;_0x316547<_0x89d0b3[_0x32ef('0x1d')];_0x316547+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x59'),{'OpenchannelInteractionId':Number(_0x89d0b3[_0x316547]),'UserId':Number(_0xb30fab['id'])});}});}})['then'](function(){if(_0x57f5e5==='leave'){var _0x120d9d=_[_0x32ef('0x50')](_0xb30fab['WhatsappInteractions'],'id');return _0xb30fab[_0x32ef('0x5a')](_0x120d9d)[_0x32ef('0x17')](function(){for(var _0x2b5703=0x0;_0x2b5703<_0x120d9d['length'];_0x2b5703+=0x1){_0x22f2d7[_0x32ef('0x52')](_0x32ef('0x5b'),{'WhatsappInteractionId':Number(_0x120d9d[_0x2b5703]),'UserId':Number(_0xb30fab['id'])});}});}})[_0x32ef('0x5c')](function(_0x52dfe0){_0x55f7f2['log'](_0x52dfe0);});}}function onDisconnect(_0x13ea1a,_0x47d8bf){joinOrLeave(_0x13ea1a,_0x32ef('0x54'),_0x47d8bf);}function onConnect(_0x5bb114){joinOrLeave(_0x5bb114,'join');}exports[_0x32ef('0x5d')]=function(_0x208989){_0x208989['on'](_0x32ef('0x5e'),function(_0x5dca6a){_0x5dca6a[_0x32ef('0x5f')](0x0);_0x5dca6a[_0x32ef('0x60')]=_0x5dca6a[_0x32ef('0x61')]['connection'][_0x32ef('0x62')]+':'+_0x5dca6a[_0x32ef('0x61')]['connection']['remotePort'];_0x5dca6a[_0x32ef('0x63')]=new Date();_0x5dca6a[_0x32ef('0x64')]=function(_0x2518a0){console[_0x32ef('0x64')](_0x32ef('0x65')+_0x5dca6a[_0x32ef('0x66')]['name']+'['+_0x5dca6a[_0x32ef('0x60')]+']',_0x2518a0);};_0x5dca6a['on'](_0x32ef('0x67'),function(){onDisconnect(_0x5dca6a,_0x208989);_0x5dca6a[_0x32ef('0x64')](_0x32ef('0x68'));});onConnect(_0x5dca6a);_0x5dca6a[_0x32ef('0x64')](_0x32ef('0x69'));});}; \ No newline at end of file +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 diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6d15727..dd632cf 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 _0x5261=['motionChannel','direction','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','undefined','interface','format','SIP/%s','name','agent','outgoingmessage','AfterCreateMessage','event','offlineMessage','catch','changed','closed','substatus','contact','AfterUpdate','User','find','fullname','email','internal','model','hook','callback','toLowerCase','condition','../logger','triggers','client','Chat','ChatInteraction','afterUpdate','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','newinteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','get','channel'];(function(_0x40be1c,_0x143c9f){var _0xbdc778=function(_0x238cce){while(--_0x238cce){_0x40be1c['push'](_0x40be1c['shift']());}};_0xbdc778(++_0x143c9f);}(_0x5261,0xb5));var _0x1526=function(_0x1dbe8,_0x5105d9){_0x1dbe8=_0x1dbe8-0x0;var _0x287a9a=_0x5261[_0x1dbe8];return _0x287a9a;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0x1526('0x0'))(_0x1526('0x1'));var client=jayson[_0x1526('0x2')]['http']({'port':0x232a});var triggers=[{'channel':_0x1526('0x3'),'model':_0x1526('0x4'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x1526('0x5'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1526('0x3'),'model':_0x1526('0x6'),'event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateMessage},{'channel':_0x1526('0x3'),'model':_0x1526('0x9'),'event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateOfflineMessage},{'channel':_0x1526('0xa'),'model':_0x1526('0xb'),'event':_0x1526('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1526('0xa'),'model':'SmsInteraction','event':_0x1526('0x5'),'condition':_0x1526('0xc'),'callback':afterUpdate},{'channel':_0x1526('0xa'),'model':_0x1526('0xd'),'event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':'afterCreate','condition':_0x1526('0xe'),'callback':afterCreate},{'channel':_0x1526('0xf'),'model':_0x1526('0x10'),'event':_0x1526('0x5'),'condition':_0x1526('0xc'),'callback':afterUpdate},{'channel':_0x1526('0xf'),'model':_0x1526('0x11'),'event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateMessage},{'channel':_0x1526('0x12'),'model':_0x1526('0x13'),'event':'afterCreate','condition':_0x1526('0xe'),'callback':afterCreate},{'channel':_0x1526('0x12'),'model':'FaxInteraction','event':_0x1526('0x5'),'condition':_0x1526('0xc'),'callback':afterUpdate},{'channel':_0x1526('0x12'),'model':_0x1526('0x14'),'event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateMessage},{'channel':_0x1526('0x15'),'model':_0x1526('0x16'),'event':'afterCreate','condition':_0x1526('0xe'),'callback':afterCreate},{'channel':_0x1526('0x15'),'model':_0x1526('0x16'),'event':_0x1526('0x5'),'condition':_0x1526('0xc'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateMessage},{'channel':_0x1526('0x17'),'model':_0x1526('0x18'),'event':_0x1526('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x1526('0x17'),'model':'OpenchannelInteraction','event':_0x1526('0x5'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x1526('0x17'),'model':_0x1526('0x19'),'event':_0x1526('0x7'),'condition':_0x1526('0x8'),'callback':afterCreateMessage}];function request(_0x18195d){return client[_0x1526('0x1a')](_0x1526('0x1b'),_0x18195d)[_0x1526('0x1c')](function(_0x297421){logger[_0x1526('0x1d')](_0x1526('0x1e'),_0x1526('0x1b'),_0x297421);if(_0x297421[_0x1526('0x1f')]){if(_0x297421['error'][_0x1526('0x20')]===0x1f4){logger[_0x1526('0x1f')](_0x1526('0x1e'),'EventManager',_0x297421[_0x1526('0x1f')]);}}})['catch'](function(_0x3f52cb){logger[_0x1526('0x1f')]('Trigger,\x20%s','EventManager',_0x3f52cb);});}function afterCreateMessage(_0x186600){return function(_0x5ec1b0){_0x5ec1b0=_0x5ec1b0[_0x1526('0x21')]({'plain':!![]});_0x5ec1b0[_0x1526('0x22')]=_0x186600;_0x5ec1b0[_0x1526('0x23')]=_0x186600;_0x5ec1b0['event']=_0x5ec1b0[_0x1526('0x24')];Promise[_0x1526('0x25')]()[_0x1526('0x1c')](function(){if(typeof _0x5ec1b0['ContactId']==='undefined')return null;var _0x59f0ad=_0x1526('0x26')+_0x5ec1b0[_0x1526('0x27')];return db[_0x1526('0x28')][_0x1526('0x29')](_0x59f0ad,{'type':db[_0x1526('0x2a')][_0x1526('0x2b')][_0x1526('0x2c')],'raw':!![]});})[_0x1526('0x1c')](function(_0x1120ad){if(_0x1120ad){_0x5ec1b0['contact']=_0x1120ad[0x0];}if(typeof _0x5ec1b0[_0x1526('0x2d')]===_0x1526('0x2e'))return;return getAgent(_0x5ec1b0[_0x1526('0x2d')]);})[_0x1526('0x1c')](function(_0x26d063){if(_0x26d063){_0x5ec1b0[_0x1526('0x2f')]=util[_0x1526('0x30')](_0x1526('0x31'),_0x26d063[_0x1526('0x32')]);_0x5ec1b0[_0x1526('0x33')]=_0x26d063;_0x5ec1b0[_0x1526('0x22')]=_0x186600;return request({'event':'incomingmessage','message':_0x5ec1b0});}else{return request({'event':_0x1526('0x34'),'message':_0x5ec1b0});}})['catch'](function(_0x2321d9){logger['error'](_0x1526('0x1e'),_0x1526('0x35'),_0x2321d9);});};}function afterCreateOfflineMessage(_0x19e468){return function(_0x23d004){_0x23d004=_0x23d004[_0x1526('0x21')]({'plain':!![]});_0x23d004[_0x1526('0x22')]=_0x19e468;_0x23d004['motionChannel']=_0x19e468;_0x23d004[_0x1526('0x36')]=_0x1526('0x37');return request({'event':_0x23d004[_0x1526('0x36')],'message':_0x23d004});};}function afterCreate(_0x24b3b5,_0x51985b){return function(_0x5dc996){_0x5dc996=_0x5dc996[_0x1526('0x21')]({'plain':!![]});_0x5dc996[_0x1526('0x22')]=_0x24b3b5;_0x5dc996[_0x1526('0x23')]=_0x24b3b5;_0x5dc996[_0x1526('0x36')]='opened';Promise[_0x1526('0x25')]()[_0x1526('0x1c')](function(){var _0x2cf336=_0x1526('0x26')+_0x5dc996[_0x1526('0x27')];return db['sequelize'][_0x1526('0x29')](_0x2cf336,{'type':db[_0x1526('0x2a')]['QueryTypes']['SELECT'],'raw':!![]});})[_0x1526('0x1c')](function(_0x5500b6){if(_0x5500b6){_0x5dc996['contact']=_0x5500b6[0x0];}if(typeof _0x5dc996['UserId']===_0x1526('0x2e'))return;return getAgent(_0x5dc996[_0x1526('0x2d')]);})['then'](function(_0x2d4367){if(_0x2d4367){_0x5dc996[_0x1526('0x2f')]=util['format']('SIP/%s',_0x2d4367[_0x1526('0x32')]);_0x5dc996[_0x1526('0x33')]=_0x2d4367;}return request({'event':_0x51985b,'message':_0x5dc996});})[_0x1526('0x38')](function(_0x1f4dba){logger['error'](_0x1526('0x1e'),'AfterCreate',_0x1f4dba);});};}function afterUpdate(_0x18822b){return function(_0x7061d0){var _0x2c2c9c=_0x7061d0[_0x1526('0x39')]('closed')&&_0x7061d0[_0x1526('0x3a')];var _0x259453=_0x7061d0[_0x1526('0x39')]('substatus');if(_0x2c2c9c||_0x259453){var _0x4ebb70=_0x2c2c9c?'closedinteraction':_0x1526('0x3b');var _0x34fc80=_0x7061d0[_0x1526('0x21')]({'plain':!![]});_0x34fc80[_0x1526('0x22')]=_0x18822b;_0x34fc80[_0x1526('0x23')]=_0x18822b;_0x34fc80[_0x1526('0x36')]=_0x2c2c9c?'closed':'substatus';var _0x476c6f=_0x1526('0x26')+_0x34fc80[_0x1526('0x27')];return db[_0x1526('0x28')][_0x1526('0x29')](_0x476c6f,{'type':db[_0x1526('0x2a')][_0x1526('0x2b')][_0x1526('0x2c')],'raw':!![]})[_0x1526('0x1c')](function(_0x4c7fae){if(_0x4c7fae){_0x34fc80[_0x1526('0x3c')]=_0x4c7fae[0x0];}if(typeof _0x34fc80['UserId']===_0x1526('0x2e'))return;return getAgent(_0x34fc80['UserId']);})[_0x1526('0x1c')](function(_0x36684e){if(_0x36684e){_0x34fc80[_0x1526('0x2f')]=util[_0x1526('0x30')](_0x1526('0x31'),_0x36684e['name']);_0x34fc80[_0x1526('0x33')]=_0x36684e;}return request({'event':_0x4ebb70,'message':_0x34fc80});})['catch'](function(_0x1e7482){logger[_0x1526('0x1f')]('Trigger,\x20%s',_0x1526('0x3d'),_0x1e7482);});}};}function getAgent(_0x296ce5){return db[_0x1526('0x3e')][_0x1526('0x3f')]({'where':{'id':_0x296ce5},'attributes':['id',_0x1526('0x32'),_0x1526('0x40'),_0x1526('0x41'),_0x1526('0x42')],'raw':!![]})[_0x1526('0x1c')](function(_0x1c385e){return _0x1c385e;});}exports['default']=function(){for(var _0x2e45d7=0x0;_0x2e45d7=_0x2cc5b1[_0x877f('0x10')]){throw Error(_0x877f('0x11'));}_0x33faa8(_0x23bb4e);})['catch'](function(_0x24624f){_0x32113b(_0x24624f);});});}; \ No newline at end of file +var _0x8359=['agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','../mysqldb','./license/util','mail','chat','fax','openchannel','getChannels','toLowerCase','clearBlockUser','blockedAt','updateAttributes','getLicense','role'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x8359,0x135));var _0x9835=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x8359[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var BPromise=require(_0x9835('0x0'));var db=require(_0x9835('0x1'))['db'];var util=require(_0x9835('0x2'));var channels=['voice',_0x9835('0x3'),_0x9835('0x4'),_0x9835('0x5'),'sms','whatsapp',_0x9835('0x6')];exports[_0x9835('0x7')]=function(){return channels;};exports['isValidChannel']=function(_0x15fea3){_0x15fea3=_0x15fea3[_0x9835('0x8')]();return _['includes'](channels,_0x15fea3);};exports[_0x9835('0x9')]=function(_0x410acd,_0x333cfd,_0xbbf2f2,_0x545f35){var _0x4c4b22={'loginAttempts':_0x333cfd,'blocked':_0xbbf2f2};if(!_['isUndefined'](_0x545f35)){_0x4c4b22[_0x9835('0xa')]=_0x545f35;}return _0x410acd[_0x9835('0xb')](_0x4c4b22);};exports[_0x9835('0xc')]=function(_0x32be1c){return new BPromise(function(_0x559eee,_0x2190bb){var _0x5b4ed5=0x0;if(_0x32be1c[_0x9835('0xd')]!==_0x9835('0xe')){_0x559eee(_0x32be1c);}db[_0x9835('0xf')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x32be1c['id']}}})[_0x9835('0x10')](function(_0x475b96){_0x5b4ed5=_0x475b96;return util[_0x9835('0xc')]();})[_0x9835('0x10')](function(_0xa25458){if(_0xa25458&&_0xa25458[_0x9835('0x11')]&&_0x5b4ed5>=_0xa25458[_0x9835('0x11')]){throw Error(_0x9835('0x12'));}_0x559eee(_0x32be1c);})['catch'](function(_0x1e1daf){_0x2190bb(_0x1e1daf);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 7cf6a8c..c4d762c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x44a082,_0x4e7c0c){var _0x5ce558=function(_0x51f90e){while(--_0x51f90e){_0x44a082['push'](_0x44a082['shift']());}};_0x5ce558(++_0x4e7c0c);}(_0xadb5,0xad));var _0x5adb=function(_0x2a8e51,_0x1df9e6){_0x2a8e51=_0x2a8e51-0x0;var _0x392f45=_0xadb5[_0x2a8e51];return _0x392f45;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +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 diff --git a/server/errors/index.js b/server/errors/index.js index 7e6f95b..9dad88b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2470=['json','send','exports','404','status','render'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x2470,0xb6));var _0x0247=function(_0x1d36f4,_0x52ab75){_0x1d36f4=_0x1d36f4-0x0;var _0x440c94=_0x2470[_0x1d36f4];return _0x440c94;};'use strict';module[_0x0247('0x0')][0x194]=function pageNotFound(_0x1d4b81,_0x587cad){var _0x159b50=_0x0247('0x1');var _0x5df2b5=0x194;var _0x521f05={'status':_0x5df2b5};_0x587cad[_0x0247('0x2')](_0x521f05[_0x0247('0x2')]);_0x587cad[_0x0247('0x3')](_0x159b50,{},function(_0x190ebe,_0x5ea37c){if(_0x190ebe){return _0x587cad[_0x0247('0x2')](_0x521f05[_0x0247('0x2')])[_0x0247('0x4')](_0x521f05);}_0x587cad[_0x0247('0x5')](_0x5ea37c);});}; \ No newline at end of file +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 diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3662966..259a874 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(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_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 diff --git a/server/routes.js b/server/routes.js index 5fb451c..6985bba 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3140=['./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','/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/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/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/webbar','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.5.0','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/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/voiceAgentReport','/api/voice/queues/reports','/api/trunks','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','./api/faxInteraction','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/conditions'];(function(_0x38ec42,_0x4c12ec){var _0xdf2997=function(_0x23e462){while(--_0x23e462){_0x38ec42['push'](_0x38ec42['shift']());}};_0xdf2997(++_0x4c12ec);}(_0x3140,0xaf));var _0x0314=function(_0x22d202,_0xfcd670){_0x22d202=_0x22d202-0x0;var _0x3cb212=_0x3140[_0x22d202];return _0x3cb212;};'use strict';var path=require(_0x0314('0x0'));var express=require(_0x0314('0x1'));var errors=require(_0x0314('0x2'));var config=require(_0x0314('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x0314('0x4'));exports[_0x0314('0x5')]=function(_0x1c0f66){return setupLoggers(_0x1c0f66)[_0x0314('0x6')](function(){_0x1c0f66[_0x0314('0x7')](_0x0314('0x8'),require(_0x0314('0x9')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xa'),require(_0x0314('0xb')));_0x1c0f66[_0x0314('0x7')]('/api/voice/contexts',require(_0x0314('0xc')));_0x1c0f66[_0x0314('0x7')]('/api/voice/extensions',require('./api/voiceExtension'));_0x1c0f66[_0x0314('0x7')]('/api/voice/mohs',require(_0x0314('0xd')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xe'),require(_0x0314('0xf')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x10'),require('./api/voiceRecording'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x11'),require(_0x0314('0x12')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x13'),require(_0x0314('0x14')));_0x1c0f66[_0x0314('0x7')]('/api/voice/mails/messages',require(_0x0314('0x15')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x16'),require(_0x0314('0x17')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x18'),require(_0x0314('0x19')));_0x1c0f66[_0x0314('0x7')]('/api/voice/agents/reports',require(_0x0314('0x1a')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x1b'),require('./api/voiceQueueReport'));_0x1c0f66[_0x0314('0x7')]('/api/members/reports',require('./api/memberReport'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x1c'),require('./api/trunk'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x1d'),require('./api/voiceTransferReport'));_0x1c0f66[_0x0314('0x7')]('/api/mail/out_servers',require(_0x0314('0x1e')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x1f'),require(_0x0314('0x20')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x21'),require('./api/mailQueue'));_0x1c0f66['use'](_0x0314('0x22'),require(_0x0314('0x23')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x24'),require(_0x0314('0x25')));_0x1c0f66[_0x0314('0x7')]('/api/mail/messages',require(_0x0314('0x26')));_0x1c0f66[_0x0314('0x7')]('/api/mail/applications',require(_0x0314('0x27')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x28'),require(_0x0314('0x29')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x2a'),require('./api/dashboard'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x2b'),require(_0x0314('0x2c')));_0x1c0f66['use'](_0x0314('0x2d'),require(_0x0314('0x2e')));_0x1c0f66['use']('/api/fax/applications',require(_0x0314('0x2f')));_0x1c0f66[_0x0314('0x7')]('/api/fax/interactions',require(_0x0314('0x30')));_0x1c0f66[_0x0314('0x7')]('/api/fax/messages',require('./api/faxMessage'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x31'),require('./api/faxQueue'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x32'),require(_0x0314('0x33')));_0x1c0f66['use'](_0x0314('0x34'),require(_0x0314('0x35')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x36'),require('./api/smsApplication'));_0x1c0f66[_0x0314('0x7')]('/api/sms/interactions',require('./api/smsInteraction'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x37'),require(_0x0314('0x38')));_0x1c0f66['use'](_0x0314('0x39'),require('./api/smsQueue'));_0x1c0f66[_0x0314('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x1c0f66[_0x0314('0x7')]('/api/openchannel/applications',require(_0x0314('0x3a')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x3b'),require(_0x0314('0x3c')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x3d'),require(_0x0314('0x3e')));_0x1c0f66['use'](_0x0314('0x3f'),require(_0x0314('0x40')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x41'),require(_0x0314('0x42')));_0x1c0f66[_0x0314('0x7')]('/api/openchannel/reports/queue',require(_0x0314('0x43')));_0x1c0f66['use'](_0x0314('0x44'),require('./api/chatApplication'));_0x1c0f66[_0x0314('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x1c0f66['use'](_0x0314('0x45'),require(_0x0314('0x46')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x47'),require(_0x0314('0x48')));_0x1c0f66['use'](_0x0314('0x49'),require(_0x0314('0x4a')));_0x1c0f66[_0x0314('0x7')]('/api/chat/groups',require(_0x0314('0x4b')));_0x1c0f66['use'](_0x0314('0x4c'),require('./api/chatProactiveAction'));_0x1c0f66[_0x0314('0x7')]('/api/cm/companies',require('./api/cmCompany'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x4d'),require('./api/cmContact'));_0x1c0f66[_0x0314('0x7')]('/api/cm/hopper',require(_0x0314('0x4e')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x4f'),require(_0x0314('0x50')));_0x1c0f66[_0x0314('0x7')]('/api/cm/hopper_final',require(_0x0314('0x51')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x52'),require('./api/cmHopperHistory'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x53'),require(_0x0314('0x54')));_0x1c0f66['use'](_0x0314('0x55'),require('./api/action'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x56'),require(_0x0314('0x57')));_0x1c0f66['use'](_0x0314('0x58'),require(_0x0314('0x59')));_0x1c0f66['use']('/api/dispositions',require('./api/disposition'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x5a'),require(_0x0314('0x5b')));_0x1c0f66['use'](_0x0314('0x5c'),require(_0x0314('0x5d')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x5e'),require(_0x0314('0x5f')));_0x1c0f66['use'](_0x0314('0x60'),require(_0x0314('0x61')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x62'),require(_0x0314('0x63')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x64'),require('./api/schedule'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x65'),require('./api/sound'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x66'),require(_0x0314('0x67')));_0x1c0f66['use']('/api/contact_item_types',require(_0x0314('0x68')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x69'),require(_0x0314('0x6a')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x6b'),require(_0x0314('0x6c')));_0x1c0f66['use'](_0x0314('0x6d'),require('./api/template'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x6e'),require(_0x0314('0x6f')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x70'),require('./api/variable'));_0x1c0f66['use'](_0x0314('0x71'),require(_0x0314('0x72')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x73'),require('./api/integrationReport'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x74'),require(_0x0314('0x75')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x76'),require(_0x0314('0x77')));_0x1c0f66[_0x0314('0x7')]('/api/analytics/extracted_reports',require(_0x0314('0x78')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x79'),require('./api/analyticMetric'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x7a'),require('./api/analyticFieldReport'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x7b'),require(_0x0314('0x7c')));_0x1c0f66[_0x0314('0x7')]('/api/integrations/salesforce/accounts',require(_0x0314('0x7d')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x7e'),require(_0x0314('0x7f')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x80'),require(_0x0314('0x81')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x82'),require(_0x0314('0x83')));_0x1c0f66['use'](_0x0314('0x84'),require(_0x0314('0x85')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x86'),require(_0x0314('0x87')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x88'),require('./api/intDeskAccount'));_0x1c0f66['use']('/api/integrations/desk/configurations',require(_0x0314('0x89')));_0x1c0f66[_0x0314('0x7')]('/api/integrations/desk/fields',require(_0x0314('0x8a')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x8b'),require('./api/intZohoAccount'));_0x1c0f66['use'](_0x0314('0x8c'),require(_0x0314('0x8d')));_0x1c0f66['use'](_0x0314('0x8e'),require('./api/intZohoField'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x8f'),require(_0x0314('0x90')));_0x1c0f66[_0x0314('0x7')]('/api/integrations/zendesk/configurations',require(_0x0314('0x91')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x92'),require('./api/intZendeskField'));_0x1c0f66[_0x0314('0x7')](_0x0314('0x93'),require(_0x0314('0x94')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x95'),require(_0x0314('0x96')));_0x1c0f66[_0x0314('0x7')]('/api/integrations/freshdesk/fields',require(_0x0314('0x97')));_0x1c0f66['use']('/api/integrations/vtiger/accounts',require(_0x0314('0x98')));_0x1c0f66['use'](_0x0314('0x99'),require(_0x0314('0x9a')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x9b'),require(_0x0314('0x9c')));_0x1c0f66[_0x0314('0x7')](_0x0314('0x9d'),require(_0x0314('0x9e')));_0x1c0f66['use']('/api/integrations/servicenow/configurations',require(_0x0314('0x9f')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xa0'),require('./api/intServicenowField'));_0x1c0f66['use']('/api/integrations/dynamics365/accounts',require(_0x0314('0xa1')));_0x1c0f66[_0x0314('0x7')]('/api/integrations/dynamics365/configurations',require(_0x0314('0xa2')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xa3'),require(_0x0314('0xa4')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xa5'),require('./api/intFreshsalesAccount'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xa6'),require(_0x0314('0xa7')));_0x1c0f66['use'](_0x0314('0xa8'),require(_0x0314('0xa9')));_0x1c0f66[_0x0314('0x7')]('/api/networks',require(_0x0314('0xaa')));_0x1c0f66[_0x0314('0x7')]('/api/chat/reports/queue',require(_0x0314('0xab')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xac'),require(_0x0314('0xad')));_0x1c0f66[_0x0314('0x7')]('/api/jscripty/answers/reports',require(_0x0314('0xae')));_0x1c0f66[_0x0314('0x7')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xaf'),require(_0x0314('0xb0')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xb1'),require(_0x0314('0xb2')));_0x1c0f66[_0x0314('0x7')]('/api/square/reports',require(_0x0314('0xb3')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xb4'),require(_0x0314('0xb5')));_0x1c0f66['use'](_0x0314('0xb6'),require(_0x0314('0xb7')));_0x1c0f66['use'](_0x0314('0xb8'),require(_0x0314('0xb9')));_0x1c0f66['use']('/api/square/odbc',require(_0x0314('0xba')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xbb'),require('./api/squareProject'));_0x1c0f66['use'](_0x0314('0xbc'),require(_0x0314('0xbd')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xbe'),require(_0x0314('0xbf')));_0x1c0f66['use'](_0x0314('0xc0'),require(_0x0314('0xc1')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xc2'),require(_0x0314('0xc3')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xc4'),require(_0x0314('0xc5')));_0x1c0f66[_0x0314('0x7')]('/api/migrations',require(_0x0314('0xc6')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xc7'),require(_0x0314('0xc8')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xc9'),require(_0x0314('0xca')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xcb'),require(_0x0314('0xcc')));_0x1c0f66[_0x0314('0x7')]('/api/chat/reports/transfer',require(_0x0314('0xcd')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xce'),require('./api/faxTransferReport'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xcf'),require(_0x0314('0xd0')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xd1'),require(_0x0314('0xd2')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xd3'),require(_0x0314('0xd4')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xd5'),require('./api/voicePrefix'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xd6'),require(_0x0314('0xd7')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xd8'),require('./api/userProfileSection'));_0x1c0f66[_0x0314('0x7')]('/api/userProfile/resources',require(_0x0314('0xd9')));_0x1c0f66['use']('/api/userNotifications',require(_0x0314('0xda')));_0x1c0f66['use'](_0x0314('0xdb'),require(_0x0314('0xdc')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xdd'),require('./api/whatsappApplication'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xde'),require('./api/whatsappInteraction'));_0x1c0f66[_0x0314('0x7')]('/api/whatsapp/messages',require(_0x0314('0xdf')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xe0'),require(_0x0314('0xe1')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xe2'),require('./api/whatsappTransferReport'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xe3'),require(_0x0314('0xe4')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xe5'),require(_0x0314('0xe6')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xe7'),require(_0x0314('0xe8')));_0x1c0f66['use'](_0x0314('0xe9'),require(_0x0314('0xea')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xeb'),require(_0x0314('0xec')));_0x1c0f66[_0x0314('0x7')]('/api/auth/google',require(_0x0314('0xed')));_0x1c0f66['use'](_0x0314('0xee'),require(_0x0314('0xef')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xf0'),require(_0x0314('0xf1')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xf2'),require(_0x0314('0xf3')));_0x1c0f66['use'](_0x0314('0xf4'),require(_0x0314('0xf5')));_0x1c0f66[_0x0314('0x7')](_0x0314('0xf6'),require('./api/system'));_0x1c0f66[_0x0314('0x7')](_0x0314('0xf7'),require('./api/pm2'));_0x1c0f66[_0x0314('0x7')]('/api/webbar',require(_0x0314('0xf8')));_0x1c0f66[_0x0314('0x7')]('/api/logs',clientSideLogs);_0x1c0f66[_0x0314('0x7')]('/apidoc',express[_0x0314('0xf9')](path[_0x0314('0xfa')](config[_0x0314('0xfb')],_0x0314('0xfc'))));_0x1c0f66[_0x0314('0x7')](_0x0314('0xfd'),express[_0x0314('0xf9')](path[_0x0314('0xfa')](config[_0x0314('0xfb')],_0x0314('0xfd'))));_0x1c0f66[_0x0314('0x7')]('/demo',express['static'](path[_0x0314('0xfa')](config['root'],_0x0314('0xfe'))));_0x1c0f66[_0x0314('0x7')](_0x0314('0xff'),express['static'](path[_0x0314('0xfa')](config[_0x0314('0xfb')],_0x0314('0x100'),_0x0314('0x101'))));_0x1c0f66[_0x0314('0x7')](_0x0314('0x102'),express[_0x0314('0xf9')](path['join'](config[_0x0314('0xfb')],'/server/files/plugins')));_0x1c0f66['route'](_0x0314('0x103'))[_0x0314('0x104')](errors[0x194]);_0x1c0f66[_0x0314('0x105')]('/*')[_0x0314('0x104')](function(_0x413c8b,_0x8aaa2a){_0x8aaa2a[_0x0314('0x106')](path[_0x0314('0x107')](_0x1c0f66[_0x0314('0x104')](_0x0314('0x108'))+_0x0314('0x109')));});return _0x1c0f66;});}; \ No newline at end of file +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 diff --git a/server/rpc/index.js b/server/rpc/index.js index a3f311f..61564a5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e51=['listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.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/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','port'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5e51,0x86));var _0x15e5=function(_0x42152e,_0x509b93){_0x42152e=_0x42152e-0x0;var _0x57bb09=_0x5e51[_0x42152e];return _0x57bb09;};'use strict';var jayson=require(_0x15e5('0x0'));var _=require(_0x15e5('0x1'));var config=require(_0x15e5('0x2'));exports['listen']=function(){return new Promise(function(_0x320e02,_0x48b7ac){var _0x5788c2={};_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x4')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x5')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x6')));_0x5788c2=_['merge'](_0x5788c2,require('../api/voiceRecording/voiceRecording.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x7')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5788c2=_['merge'](_0x5788c2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x8')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x9')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/trunk/trunk.rpc'));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0xa')));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0xb')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/mailServerIn/mailServerIn.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0xc')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/mailQueue/mailQueue.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/mailInteraction/mailInteraction.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0xd')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0xe')));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0xf')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x10')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x11')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x12')));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0x13')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/faxQueue/faxQueue.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x14')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x15')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x16')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x17')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/smsQueue/smsQueue.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x18')));_0x5788c2=_['merge'](_0x5788c2,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x19')));_0x5788c2=_['merge'](_0x5788c2,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x1a')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x1b')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/chatQueue/chatQueue.rpc'));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0x1c')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x1d')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x1e')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x1f')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x20')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x21')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/pause/pause.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x22')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x5788c2=_['merge'](_0x5788c2,require('../api/template/template.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x23')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x24')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x25')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x26')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x27')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x28')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0x29')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x2a')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x2b')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x2c')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x2d')));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0x2e')));_0x5788c2=_['merge'](_0x5788c2,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x2f')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/squareOdbc/squareOdbc.rpc'));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x30')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x31')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x32')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x33')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x34')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x35')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x36')));_0x5788c2=_['merge'](_0x5788c2,require(_0x15e5('0x37')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x38')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require(_0x15e5('0x39')));_0x5788c2=_[_0x15e5('0x3')](_0x5788c2,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x200a32=jayson[_0x15e5('0x3a')](_0x5788c2)[_0x15e5('0x3b')]();var _0x43dc74=config['rpc'][_0x15e5('0x3c')]||config['port']+0x1;var _0x308fff=config['rpc']['ip']||'localhost';_0x200a32['on']('error',function(_0x4b819d){return _0x48b7ac(_0x4b819d);});_0x200a32[_0x15e5('0x3d')](_0x43dc74,_0x308fff,function(){console[_0x15e5('0x3e')](_0x15e5('0x3f'),_0x308fff,_0x43dc74);require('../config/triggers')[_0x15e5('0x40')]();return _0x320e02('RPC\x20listening\x20on\x20'+_0x308fff+':'+_0x43dc74);});});}; \ No newline at end of file +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 diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 906083b..9483b21 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 _0xaee9=['function','no\x20code','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','prototype','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','format','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','label','util','events','EventEmitter','./reply','call','setEncoding','utf8','emit','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper'];(function(_0x525480,_0x2cfcf9){var _0x3b4598=function(_0x94bb65){while(--_0x94bb65){_0x525480['push'](_0x525480['shift']());}};_0x3b4598(++_0x2cfcf9);}(_0xaee9,0xd9));var _0x9aee=function(_0x33cba9,_0x3d6a45){_0x33cba9=_0x33cba9-0x0;var _0x38d339=_0xaee9[_0x33cba9];return _0x38d339;};'use strict';var util=require(_0x9aee('0x0'));var _=require('lodash');var EventEmitter=require(_0x9aee('0x1'))[_0x9aee('0x2')];var AGIReply=require(_0x9aee('0x3'));var AGIError=require('./error');function AGIChannel(_0x4c8079){var _0xeb702=this,_0x2fea95=new AGIReply(),_0x2d75db=![],_0x17ea8c={};EventEmitter[_0x9aee('0x4')](_0xeb702);_0x4c8079[_0x9aee('0x5')]('utf8');_0x4c8079['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2fea95[_0x9aee('0x5')](_0x9aee('0x6'));_0x2fea95['on']('headers',function(_0x421f5c){for(var _0x14ca52 in _0x421f5c){_0xeb702[_0x14ca52]=_0x421f5c[_0x14ca52];}_0xeb702[_0x9aee('0x7')]('ready');});_0x2fea95['on'](_0x9aee('0x8'),function(_0x40d079){if(_0x40d079[_0x9aee('0x9')]()==_0x9aee('0xa')){_0xeb702[_0x9aee('0x7')](_0x9aee('0xa'));return;}if(_0x40d079[_0x9aee('0xb')](0x0,0xb)==_0x9aee('0xc')){_0x2d75db=!![];}if(_0x2d75db){_0x17ea8c['rx']+=_0x40d079+'\x0a';if(_0x40d079['search'](_0x9aee('0xd'))!=-0x1){_0x2d75db=![];}}else{_0x17ea8c['rx']=_0x40d079;}if(_0x2d75db){return;}if(typeof _0x17ea8c['cb']==_0x9aee('0xe')){var _0x8cc574=_0x17ea8c['rx'][_0x9aee('0xb')](0x0,0x3),_0x5d4f3b=null,_0x40dd16=null;_0x8cc574=parseInt(_0x8cc574);if(isNaN(_0x8cc574)){_0x17ea8c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9aee('0xf')});return;}if(_0x8cc574!=0xc8){_0x17ea8c['cb'](null,{'code':_0x8cc574,'result':-0x1,'extra':'KO'});return;}_0x5d4f3b=_0x17ea8c['rx']['substring'](0x4)['replace']('result=','');if(_0x5d4f3b['indexOf']('\x20')!=-0x1){_0x5d4f3b=_0x5d4f3b['substr'](0x0,_0x5d4f3b[_0x9aee('0x10')]('\x20'));}if(_['startsWith'](_0x5d4f3b,'-1')){_0x5d4f3b=parseInt(_0x5d4f3b);}_0x40dd16=_0x17ea8c['rx'][_0x9aee('0x11')]('\x20');if(_0x40dd16[_0x9aee('0x12')]==0x3){_0x40dd16=_0x40dd16[0x2][_0x9aee('0xb')](0x1,_0x40dd16[0x2]['length']-0x1);}else if(_0x40dd16[_0x9aee('0x12')]>0x3){var _0x233486=/\((.+)\)/;var _0x62e200=_0x17ea8c['rx'][_0x9aee('0x13')](_0x233486);if(_0x62e200){_0x40dd16=_0x62e200[0x1];}else{_0x40dd16=null;}}else{_0x40dd16=null;}_0x17ea8c['cb'](null,{'code':_0x8cc574,'result':_0x5d4f3b,'extra':_0x40dd16});}});_0x4c8079['on'](_0x9aee('0x14'),function(_0x1c0e75){_0xeb702[_0x9aee('0x7')](_0x9aee('0x14'),new AGIError(_0x9aee('0x15'),_0x1c0e75[_0x9aee('0x16')]));});_0x4c8079['on'](_0x9aee('0x17'),function(){_0xeb702[_0x9aee('0x7')](_0x9aee('0x17'),new AGIError(_0x9aee('0x18')));});_0x4c8079['on'](_0x9aee('0x19'),function(){_0xeb702[_0x9aee('0x7')](_0x9aee('0x19'),new AGIError(_0x9aee('0x1a')));_0x4c8079[_0x9aee('0x1b')]();});_0x4c8079[_0x9aee('0x1c')](_0x2fea95);this[_0x9aee('0x1d')]=function(_0x4f433c,_0x918653){var _0x4f433c=_0x4f433c||'',_0x918653=typeof _0x918653=='function'?_0x918653:new Function();_0x17ea8c={'tx':_0x4f433c,'rx':'','cb':_0x918653};_0x4c8079[_0x9aee('0x1e')](_0x4f433c+'\x0a');},this[_0x9aee('0x17')]=function(){_0x4c8079[_0x9aee('0x1b')]();};}util[_0x9aee('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x3b29d9){return this[_0x9aee('0x1d')][_0x9aee('0x20')](this,_0x3b29d9);};AGIChannel[_0x9aee('0x21')][_0x9aee('0x22')]=function(){return this[_0x9aee('0x23')](_0x9aee('0x24'));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x25')]=function(_0x3cb2ab,_0x21cfbc,_0x7c37f7){_0x3cb2ab=_0x3cb2ab===undefined?_0x9aee('0x26'):_0x3cb2ab;_0x21cfbc=_0x21cfbc===undefined?'5':_0x21cfbc;_0x7c37f7=_0x7c37f7===undefined?'1':_0x7c37f7;return this[_0x9aee('0x23')](util['format'](_0x9aee('0x27'),_0x3cb2ab,_0x21cfbc*0x3e8,_0x7c37f7));};AGIChannel[_0x9aee('0x21')]['noop']=function(_0x7e8d3c){_0x7e8d3c=_0x7e8d3c||'NO\x20MESSAGE';return this[_0x9aee('0x23')](util[_0x9aee('0x28')](_0x9aee('0x29'),_0x7e8d3c));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x2a')]=function(_0x111d5a,_0x50c345){if(_[_0x9aee('0x2b')](_0x50c345)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x111d5a,_0x50c345[_0x9aee('0x2c')](',')));}return this[_0x9aee('0x23')](util['format'](_0x9aee('0x2d'),_0x111d5a,_0x50c345));};AGIChannel[_0x9aee('0x21')]['setContext']=function(_0x3e4f6a){return this[_0x9aee('0x23')](util[_0x9aee('0x28')](_0x9aee('0x2e'),_0x3e4f6a));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x2f')]=function(_0x4aa563){return this[_0x9aee('0x23')](util['format'](_0x9aee('0x30'),_0x4aa563));};AGIChannel[_0x9aee('0x21')]['setPriority']=function(_0x1021cc){return this[_0x9aee('0x23')](util['format'](_0x9aee('0x31'),_0x1021cc));};AGIChannel['prototype']['hangup']=function(){return this[_0x9aee('0x23')](_0x9aee('0x32'));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x33')]=function(_0x32853b,_0x4dd47e){var _0x11b27a=_[_0x9aee('0x34')](_0x4dd47e)||_[_0x9aee('0x35')](_0x4dd47e)?_0x4dd47e[_0x9aee('0x36')]():_0x4dd47e;return this[_0x9aee('0x23')](util[_0x9aee('0x28')](_0x9aee('0x37'),_0x32853b,_0x11b27a?_0x11b27a[_0x9aee('0x36')]()[_0x9aee('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x9aee('0x39')]=function(_0x1753cc,_0x4dc22b){return this[_0x9aee('0x23')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x1753cc,_0x4dc22b));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x3a')]=function(_0x382d11,_0x3f65b7){return this['sendRequest'](util['format'](_0x9aee('0x3b'),_0x382d11,_0x3f65b7));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x3c')]=function(_0x1c51a5,_0x25a0bd){return this[_0x9aee('0x23')](util[_0x9aee('0x28')](_0x9aee('0x3d'),_0x1c51a5,_0x25a0bd));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x3e')]=function(_0x5854a3,_0x305f78,_0x5a1770){_0x305f78=_0x305f78||this[_0x9aee('0x3f')];_0x5a1770=_0x5a1770||0x1;this[_0x9aee('0x40')](_0x5854a3);this[_0x9aee('0x2f')](_0x305f78);this['setPriority'](_0x5a1770);return this[_0x9aee('0x41')](util['format'](_0x9aee('0x42'),_0x5854a3,_0x305f78,_0x5a1770));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x43')]=function(_0x2f8e8d){return this['sendRequest'](util['format'](_0x9aee('0x44'),_0x2f8e8d));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x45')]=function(_0xa3f2b1,_0x2a0684,_0x47e220,_0x28c4cd,_0x4d142a,_0x2908ae){_0x2a0684=_0x2a0684||_0x9aee('0x46');_0x47e220=_0x47e220||'';_0x28c4cd=_0x28c4cd===undefined?-0x1:_0x28c4cd==='-1'?-0x1:_0x28c4cd*0x3e8;_0x4d142a=_0x4d142a===undefined?'':'s='+_0x4d142a;_0x2908ae=_0x2908ae?'BEEP':'';return this[_0x9aee('0x23')](util[_0x9aee('0x28')](_0x9aee('0x47'),_0xa3f2b1,_0x2a0684,_0x47e220,_0x28c4cd,_0x2908ae,_0x4d142a));};AGIChannel[_0x9aee('0x21')][_0x9aee('0x48')]=function(_0x10e7da,_0x58e791){_0x58e791=_0x58e791||'';return this[_0x9aee('0x23')](util['format'](_0x9aee('0x49'),_0x10e7da,_0x58e791));};AGIChannel['prototype'][_0x9aee('0x4a')]=function(_0x35ae5c){return this[_0x9aee('0x2a')](_0x9aee('0x4b'),_0x35ae5c);};AGIChannel[_0x9aee('0x21')]['wait']=function(_0x30c19b){return this[_0x9aee('0x2a')]('WAIT',_0x30c19b);};AGIChannel['prototype']['error']=function(_0x26355,_0x44df4a){this['noop'](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x26355['id'],_0x26355[_0x9aee('0x4c')],_0x44df4a));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +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 diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 505f875..d1b7041 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 _0x1be9=['apply','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x31fbf8,_0x8dc165){var _0x28c4f4=function(_0x3d8b39){while(--_0x3d8b39){_0x31fbf8['push'](_0x31fbf8['shift']());}};_0x28c4f4(++_0x8dc165);}(_0x1be9,0x135));var _0x91be=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1be9[_0x24f31b];return _0x488401;};'use strict';var util=require(_0x91be('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x91be('0x1'),'E_AGI_SERVER_ERROR':_0x91be('0x2'),'E_AGI_SERVER_CLOSE':_0x91be('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x91be('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x91be('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x91be('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x91be('0x7'),'E_AGI_COMMAND_EMPTY':_0x91be('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x91be('0x9'),'E_AGI_IVR_ENTRY':_0x91be('0xa')};function AGIError(_0x2466fe){var _0x2466fe=_0x2466fe||null,_0x2cc7bd=_0x2cc7bd||[],_0x2feeb6=0x1,_0x107c68='';if(!error[_0x2466fe]){_0x2466fe=_0x91be('0xb');}_0x2cc7bd['push'](error[_0x2466fe]);while(arguments[_0x2feeb6]){_0x2cc7bd[_0x91be('0xc')](arguments[_0x2feeb6]);_0x2feeb6++;}_0x107c68=util[_0x91be('0xd')][_0x91be('0xe')](util,_0x2cc7bd);this[_0x91be('0xf')]=_0x107c68;this['name']=_0x2466fe;}module[_0x91be('0x10')]=AGIError; \ No newline at end of file +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 diff --git a/server/services/agi/events.js b/server/services/agi/events.js index b212127..c975203 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 _0x9375=['error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','lodash','events','ioredis','./error','redis','defaults','localhost','emit'];(function(_0x2efad3,_0x224bcf){var _0x4e18bc=function(_0x405779){while(--_0x405779){_0x2efad3['push'](_0x2efad3['shift']());}};_0x4e18bc(++_0x224bcf);}(_0x9375,0xd8));var _0x5937=function(_0x17de59,_0x4af0d2){_0x17de59=_0x17de59-0x0;var _0x5cca3c=_0x9375[_0x17de59];return _0x5cca3c;};'use strict';var _=require(_0x5937('0x0'));var EventEmitter=require(_0x5937('0x1'))['EventEmitter'];var Redis=require(_0x5937('0x2'));var AGIError=require(_0x5937('0x3'));var config=require('../../config/environment');config[_0x5937('0x4')]=_[_0x5937('0x5')](config[_0x5937('0x4')],{'host':_0x5937('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x48993f){if(_0x48993f)return eventEmitter[_0x5937('0x7')](_0x5937('0x8'),new AGIError(_0x5937('0x9'),_0x48993f));});sub['on'](_0x5937('0xa'),function(_0x1bbb26,_0x1fc785){if(_0x1bbb26!==_0x5937('0xb'))return;try{var _0x5b530e=JSON[_0x5937('0xc')](_0x1fc785);eventEmitter[_0x5937('0x7')](_0x5937('0xd'),_0x5b530e);}catch(_0x424f65){eventEmitter[_0x5937('0x7')](_0x5937('0x8'),new AGIError(_0x5937('0x9'),_0x424f65));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +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 diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4f1560e..8b59e6f 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 _0xb02d=['getsecretdigits','edges','numberOfEdges','prototype','vertices','addEdge','push','size','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','split','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','agi','menu','getdigits'];(function(_0xb5e270,_0x4327c7){var _0x1056c9=function(_0xe32b03){while(--_0xe32b03){_0xb5e270['push'](_0xb5e270['shift']());}};_0x1056c9(++_0x4327c7);}(_0xb02d,0x98));var _0xdb02=function(_0x1c2972,_0x2ed23e){_0x1c2972=_0x1c2972-0x0;var _0x101c6d=_0xb02d[_0x1c2972];return _0x101c6d;};'use strict';var _=require(_0xdb02('0x0'));var logger=require('../../../config/logger')(_0xdb02('0x1'));var verticesWithRetry=[_0xdb02('0x2'),_0xdb02('0x3'),_0xdb02('0x4')];var Graph=function(){this['vertices']={};this[_0xdb02('0x5')]={};this[_0xdb02('0x6')]=0x0;};Graph[_0xdb02('0x7')]['addVertex']=function(_0x324422){this[_0xdb02('0x8')][_0x324422['id']]=_0x324422;this[_0xdb02('0x5')][_0x324422['id']]=[];};Graph[_0xdb02('0x7')][_0xdb02('0x9')]=function(_0x244530,_0x37515d,_0x395685){this[_0xdb02('0x5')][_0x244530][_0xdb02('0xa')]({'target':_0x37515d,'condition':_0x395685});this['numberOfEdges']+=0x1;};Graph[_0xdb02('0x7')][_0xdb02('0xb')]=function(){return _[_0xdb02('0xb')](this[_0xdb02('0x8')]);};Graph[_0xdb02('0x7')]['relations']=function(){return this['numberOfEdges'];};Graph[_0xdb02('0x7')][_0xdb02('0xc')]=function(_0x1af037){return this['vertices'][_0x1af037];};Graph['prototype'][_0xdb02('0xd')]=function(_0x401907,_0x5a6bd3){if(!this[_0xdb02('0x8')][_0x401907]){return logger['info'](_0xdb02('0xe'));}var _0x792cfd=_0x5a6bd3(this['vertices'][_0x401907]);if(!_0x792cfd){return logger[_0xdb02('0xf')](_0xdb02('0x10'));}if(this[_0xdb02('0x5')][_0x401907][_0xdb02('0x11')]===0x0){return logger[_0xdb02('0xf')]('no\x20edge/s\x20available');}for(var _0x145f97=0x0,_0x58aaef=[],_0x3c82e4=![];_0x145f97\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','production','handleUnpublished','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]'];(function(_0x4989e9,_0x4fcf88){var _0x55ce45=function(_0xa8741f){while(--_0xa8741f){_0x4989e9['push'](_0x4989e9['shift']());}};_0x55ce45(++_0x4fcf88);}(_0xc220,0x130));var _0x0c22=function(_0x2b8fa3,_0x3f196e){_0x2b8fa3=_0x2b8fa3-0x0;var _0xb90926=_0xc220[_0x2b8fa3];return _0xb90926;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x0c22('0x0'));var config=require(_0x0c22('0x1'));var logger=require('../../config/logger')(_0x0c22('0x2'));var utilLicense=require(_0x0c22('0x3'));var rpc=require(_0x0c22('0x4'));var Project=require(_0x0c22('0x5'));var AGIEmitter=require(_0x0c22('0x6'))[_0x0c22('0x7')];var projects=[];config['agi']=_[_0x0c22('0x8')](config[_0x0c22('0x2')],{'ip':_0x0c22('0x9'),'port':0x11dd});AGIEmitter['on'](_0x0c22('0xa'),projectUpdateHandler);function connectionHandler(_0x5d5e3c){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5d5e3c);agiHandler(_0x5d5e3c);}catch(_0x4411a4){logger['error'](_0x4411a4[_0x0c22('0xb')]);}});});}function projectUpdateHandler(_0x314547){try{var _0x2cc040=_[_0x0c22('0xc')](projects,['id',_0x314547['id']]);if(_0x2cc040>-0x1){if(_0x314547[_0x0c22('0xd')]===!![]){projects[_0x0c22('0xe')](_0x2cc040,0x1);}else{projects[_0x2cc040]=_0x314547;}}else{projects[_0x0c22('0xf')](_0x314547);}}catch(_0x2df452){logger['error'](_0x2df452['stack']);}}function listeningHandler(){console['log'](_0x0c22('0x10'),config[_0x0c22('0x2')][_0x0c22('0x11')]);logger[_0x0c22('0x12')](util[_0x0c22('0x13')](_0x0c22('0x14'),config['agi']['ip'],config[_0x0c22('0x2')][_0x0c22('0x11')]));}function errorHandler(_0x2c18f5){if(_0x2c18f5&&_0x2c18f5[_0x0c22('0x15')]&&_0x2c18f5['message']){logger['error'](util[_0x0c22('0x13')](_0x0c22('0x16'),_0x2c18f5['name'],_0x2c18f5[_0x0c22('0x17')]));}else{logger[_0x0c22('0x18')](util['format'](_0x0c22('0x19'),_0x2c18f5[_0x0c22('0xb')]));}}function closeHandler(){logger[_0x0c22('0x12')](util['format'](_0x0c22('0x1a'),this[_0x0c22('0x1b')],this['calleridname'],this[_0x0c22('0x1c')],this[_0x0c22('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5acd1c){logger[_0x0c22('0x18')](_0x5acd1c[_0x0c22('0xb')]);}}function timeoutHandler(){logger[_0x0c22('0x12')](util['format'](_0x0c22('0x1e'),this[_0x0c22('0x1b')],this[_0x0c22('0x1f')],this[_0x0c22('0x1c')],this[_0x0c22('0x1d')],this[_0x0c22('0x20')]));}function hangupHandler(){logger[_0x0c22('0x12')](util[_0x0c22('0x13')](_0x0c22('0x21'),this[_0x0c22('0x1b')],this['calleridname'],this[_0x0c22('0x1c')],this[_0x0c22('0x1d')],this[_0x0c22('0x20')]));this[_0x0c22('0x22')]=!![];}function createSquareReport(_0xaf1dda,_0x20bf6c){rpc[_0x0c22('0x23')](_0xaf1dda)[_0x0c22('0x24')](function(_0xf239b2){if(_0x20bf6c){_0x20bf6c(null,_0xf239b2);}})[_0x0c22('0x25')](function(_0x180558){if(_0x20bf6c){_0x20bf6c(null,_0x180558);}});}function setChannelVariables(_0x353f43){for(var _0x4f8262 in _0x353f43){if(_0x353f43['hasOwnProperty'](_0x4f8262)){if(_0x4f8262[_0x0c22('0x26')](_0x0c22('0x27'))===0x0){_0x353f43[_0x4f8262['substring'](0x4)]=_0x353f43[_0x4f8262];delete _0x353f43[_0x4f8262];}}}}function agiHandler(_0x22572b){logger[_0x0c22('0x28')](_0x0c22('0x29'),JSON['stringify'](_0x22572b,null,0x2));logger[_0x0c22('0x12')](util[_0x0c22('0x13')](_0x0c22('0x2a'),_0x22572b['arg_1'],_0x22572b[_0x0c22('0x1f')],_0x22572b['callerid'],_0x22572b['dnid'],_0x22572b[_0x0c22('0x20')]));_0x22572b['on'](_0x0c22('0x18'),errorHandler);_0x22572b['on'](_0x0c22('0x2b'),closeHandler);_0x22572b['on'](_0x0c22('0x2c'),timeoutHandler);_0x22572b['evtHangup']=![];_0x22572b['on'](_0x0c22('0x2d'),hangupHandler);var _0x104632=_[_0x0c22('0x2e')](projects,[_0x0c22('0x15'),_0x22572b[_0x0c22('0x1b')]]);if(!_0x104632)return Project['handleNotFound'](_0x22572b);if(!_0x104632[_0x0c22('0x2f')])return Project[_0x0c22('0x30')](_0x22572b);return Project['initialize'](_0x104632,_0x22572b);}function main(){var _0x38a633;return utilLicense['getLicense']()['then'](function(_0xf4acdf){if(!_0xf4acdf)return;if(_0xf4acdf[_0x0c22('0x31')]){if(_0xf4acdf['callysquare']&&_0xf4acdf[_0x0c22('0x32')]>0x0){logger[_0x0c22('0x12')](util[_0x0c22('0x13')](_0x0c22('0x33'),_0xf4acdf[_0x0c22('0x32')]));_0x38a633=_0xf4acdf['callysquare'];}else{logger[_0x0c22('0x12')](_0x0c22('0x34'));}}else{logger[_0x0c22('0x12')](_0x0c22('0x35'));_0x38a633=-0x1;}})[_0x0c22('0x24')](function(){return Project[_0x0c22('0x36')]();})['then'](function(_0x24990c){projects=_0x24990c;return;})[_0x0c22('0x25')](function(_0x27a818){logger['error'](_0x0c22('0x37'),_0x27a818[_0x0c22('0xb')]);})[_0x0c22('0x38')](function(){var _0x5283f9=require(_0x0c22('0x39'))(config['agi'][_0x0c22('0x11')],config[_0x0c22('0x2')]['ip'],_0x38a633);_0x5283f9['on']('error',errorHandler);_0x5283f9['on'](_0x0c22('0x3a'),listeningHandler);_0x5283f9['on'](_0x0c22('0x3b'),connectionHandler);_0x5283f9['on'](_0x0c22('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0xc3c4=['port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','message','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\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 diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 866035a..305c314 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 _0xeb99=['http','request','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xeb99,0x8c));var _0x9eb9=function(_0x180cd0,_0x386c6e){_0x180cd0=_0x180cd0-0x0;var _0x49fc32=_0xeb99[_0x180cd0];return _0x49fc32;};'use strict';var BPromise=require(_0x9eb9('0x0'));var jayson=require(_0x9eb9('0x1'));var client=jayson[_0x9eb9('0x2')][_0x9eb9('0x3')]({'port':0x232b});function request(_0x2313d4,_0x51d8cb){return new BPromise(function(_0x474578,_0x14a23a){return client[_0x9eb9('0x4')](_0x2313d4,_0x51d8cb)['then'](function(_0x4f32db){if(_0x4f32db['error']){return _0x14a23a(_0x4f32db[_0x9eb9('0x5')][_0x9eb9('0x6')]);}else{return _0x474578(_0x4f32db[_0x9eb9('0x7')]);}})[_0x9eb9('0x8')](function(_0x2d5f40){return _0x14a23a(_0x2d5f40);});});}exports[_0x9eb9('0x9')]=function(_0x4485c1,_0x37d179){return request(_0x9eb9('0xa'),{'account':_0x4485c1,'message':_0x37d179});}; \ No newline at end of file +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 diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 82a3adf..00bd375 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 _0x3538=['vertex','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','close','Project\x20%s\x20not\x20published','continueAt','exports','moment','xml2json','../../config/logger','./rpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','retry','omit','mxCell','hasOwnProperty','isArray','length','target','addEdge','mxGraphModel','root','inspect','production','debug','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','callerid','dnid','uniqueid','traverseBFS','start','clear','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname'];(function(_0x54763f,_0x5ecbae){var _0x1c82ab=function(_0x3546d4){while(--_0x3546d4){_0x54763f['push'](_0x54763f['shift']());}};_0x1c82ab(++_0x5ecbae);}(_0x3538,0x78));var _0x8353=function(_0xd4b160,_0x2a26f3){_0xd4b160=_0xd4b160-0x0;var _0x1a87be=_0x3538[_0xd4b160];return _0x1a87be;};'use strict';var _=require('lodash');var moment=require(_0x8353('0x0'));var parser=require(_0x8353('0x1'));var util=require('util');var logger=require(_0x8353('0x2'))('agi');var rpc=require(_0x8353('0x3'));var mailRpc=require('./mailRpc');var Graph=require(_0x8353('0x4'));var Vertices=require(_0x8353('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x8353('0x6')]()[_0x8353('0x7')](function(_0x5a88f2){logger[_0x8353('0x8')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5a88f2[_0x8353('0x9')]);return[];});}function addVertex(_0x421c8a,_0x37f60d,_0x1f16ff){_0x37f60d[_0x8353('0xa')]=_0x1f16ff;if(_0x37f60d['hasOwnProperty'](_0x8353('0xb'))){_0x37f60d['maxRetry']=parseInt(_0x37f60d[_0x8353('0xb')],0xa);}_0x421c8a['addVertex'](_[_0x8353('0xc')](_0x37f60d,_0x8353('0xd')));}function initGraph(_0x56ffed,_0x46793c){var _0x97e189=new Graph();for(var _0x5325ee in _0x56ffed){if(_0x56ffed[_0x8353('0xe')](_0x5325ee)){if(_[_0x8353('0xf')](_0x56ffed[_0x5325ee])){for(var _0x2416e1=0x0;_0x2416e1<_0x56ffed[_0x5325ee][_0x8353('0x10')];_0x2416e1+=0x1){addVertex(_0x97e189,_0x56ffed[_0x5325ee][_0x2416e1],_0x5325ee);}}else{addVertex(_0x97e189,_0x56ffed[_0x5325ee],_0x5325ee);}}}for(var _0x8c549b=0x0;_0x8c549b<_0x46793c['length'];_0x8c549b+=0x1){if(_0x46793c[_0x8c549b]['source']&&_0x46793c[_0x8c549b][_0x8353('0x11')]){_0x97e189[_0x8353('0x12')](_0x46793c[_0x8c549b]['source'],_0x46793c[_0x8c549b][_0x8353('0x11')],_0x46793c[_0x8c549b]['value']);}}return _0x97e189;}function getRoot(_0x58090e){return parser['toJson'](_0x58090e,{'object':!![]})[_0x8353('0x13')][_0x8353('0x14')];}function inspect(_0x28fb88){return util[_0x8353('0x15')](_0x28fb88,{'showHidden':![],'depth':null});}function initialize(_0x186b98,_0x1c2c20){var _0x4c3215=getRoot(_0x186b98[_0x8353('0x16')]);if(!_0x4c3215||!_0x4c3215['start'])return;var _0x5e8a7f,_0x4b64bb,_0x2952fe;logger[_0x8353('0x17')](_0x8353('0x14'),JSON['stringify'](_0x4c3215,null,0x2));_0x1c2c20[_0x8353('0x18')]=moment()['format'](_0x8353('0x19'));_0x5e8a7f=initGraph(_[_0x8353('0xc')](_0x4c3215,_0x8353('0xd')),_0x4c3215[_0x8353('0xd')]);_0x4b64bb=new Vertices(_0x1c2c20,rpc,mailRpc);logger[_0x8353('0x1a')](util[_0x8353('0x1b')](_0x8353('0x1c'),_0x1c2c20['arg_1'],_0x1c2c20['calleridname'],_0x1c2c20[_0x8353('0x1d')],_0x1c2c20[_0x8353('0x1e')],_0x1c2c20[_0x8353('0x1f')]));_0x5e8a7f[_0x8353('0x20')](_0x4c3215[_0x8353('0x21')]['id'],function(_0x116407){try{_0x116407=_0x4b64bb[_0x8353('0x22')](_0x116407);logger[_0x8353('0x17')]('vertex',JSON[_0x8353('0x23')](_0x116407,null,0x2));if(_0x116407[_0x8353('0xa')]==='gotoc'){logger[_0x8353('0x1a')](_0x8353('0x24'));_0x1c2c20[_0x8353('0x25')]=_0x116407[_0x8353('0x25')]||_0x1c2c20[_0x8353('0x25')];_0x1c2c20[_0x8353('0x26')]=_0x116407[_0x8353('0x26')];_0x1c2c20[_0x8353('0x27')]=_0x116407['priority']?_0x116407[_0x8353('0x27')]-0x1:0x1;return null;}else if(_0x116407&&_0x4b64bb[_0x116407[_0x8353('0xa')]]){_0x2952fe=_0x4b64bb[_0x116407['agicommand']](_0x116407);logger[_0x8353('0x1a')](_0x8353('0x28'),JSON[_0x8353('0x23')](_0x2952fe,null,0x2));if(_0x2952fe&&_0x2952fe['code']===AGI_CODE_SUCCESS&&_0x2952fe[_0x8353('0x29')]!==AGI_RESULT_ERROR&&!_0x1c2c20[_0x8353('0x2a')]){logger[_0x8353('0x17')](_0x8353('0x28'),inspect(_0x2952fe));return _[_0x8353('0x2b')](_0x2952fe[_0x8353('0x29')])?null:_0x2952fe[_0x8353('0x29')]['toString']();}else{logger[_0x8353('0x8')]('response',inspect(_0x2952fe));return null;}}else{logger['error'](_0x8353('0x2c'));return null;}}catch(_0x5d1868){logger[_0x8353('0x8')](_0x5d1868[_0x8353('0x9')]);return null;}});if(_0x4c3215[_0x8353('0x2d')]){logger[_0x8353('0x1a')](util[_0x8353('0x1b')](_0x8353('0x2e'),_0x1c2c20['arg_1'],_0x1c2c20[_0x8353('0x2f')],_0x1c2c20[_0x8353('0x1d')],_0x1c2c20[_0x8353('0x1e')],_0x1c2c20['uniqueid']));_0x5e8a7f['traverseBFS'](_0x4c3215['finally']['id'],function(_0x4db820){try{_0x4db820=_0x4b64bb[_0x8353('0x22')](_0x4db820);logger[_0x8353('0x17')](_0x8353('0x30'),JSON['stringify'](_0x4db820,null,0x2));if(_0x4db820&&_0x4b64bb[_0x4db820[_0x8353('0xa')]]){_0x2952fe=_0x4b64bb[_0x4db820[_0x8353('0xa')]](_0x4db820);if(_0x2952fe){logger[_0x8353('0x17')](_0x8353('0x28'),inspect(_0x2952fe));return _[_0x8353('0x2b')](_0x2952fe[_0x8353('0x29')])?null:_0x2952fe['result'][_0x8353('0x31')]();}else{logger[_0x8353('0x8')](_0x8353('0x28'),inspect(_0x2952fe));return null;}}else{logger[_0x8353('0x8')](_0x8353('0x2c'));return null;}}catch(_0x2dea79){logger['error'](_0x2dea79[_0x8353('0x9')]);return null;}});}logger[_0x8353('0x1a')](util[_0x8353('0x1b')](_0x8353('0x32'),_0x1c2c20[_0x8353('0x33')],_0x1c2c20[_0x8353('0x2f')],_0x1c2c20[_0x8353('0x1d')],_0x1c2c20[_0x8353('0x1e')],_0x1c2c20['uniqueid']));logger[_0x8353('0x1a')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1c2c20[_0x8353('0x25')],_0x1c2c20['extension'],parseInt(_0x1c2c20[_0x8353('0x27')],0xa)+0x1));_0x1c2c20['continueAt'](_0x1c2c20[_0x8353('0x25')],_0x1c2c20[_0x8353('0x26')],parseInt(_0x1c2c20['priority'],0xa)+0x1);_0x1c2c20[_0x8353('0x34')]();}function handleNotFound(_0x7df7e6){logger['error'](util[_0x8353('0x1b')]('Project\x20%s\x20not\x20found',_0x7df7e6['arg_1']));_0x7df7e6['continueAt'](_0x7df7e6[_0x8353('0x25')],_0x7df7e6[_0x8353('0x26')],parseInt(_0x7df7e6[_0x8353('0x27')],0xa)+0x1);_0x7df7e6['close']();}function handleUnpublished(_0x27e52c){logger['error'](util[_0x8353('0x1b')](_0x8353('0x35'),_0x27e52c[_0x8353('0x33')]));_0x27e52c[_0x8353('0x36')](_0x27e52c[_0x8353('0x25')],_0x27e52c[_0x8353('0x26')],parseInt(_0x27e52c[_0x8353('0x27')],0xa)+0x1);_0x27e52c[_0x8353('0x34')]();}module[_0x8353('0x37')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +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 diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 71b2bf3..f5a8688 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 _0xc7cf=['substring','length','split','trim','slice','emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf'];(function(_0x3edd5e,_0x184f64){var _0x5e0ee6=function(_0xf9323d){while(--_0xf9323d){_0x3edd5e['push'](_0x3edd5e['shift']());}};_0x5e0ee6(++_0x184f64);}(_0xc7cf,0x148));var _0xfc7c=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0xc7cf[_0x411e71];return _0x226ae3;};'use strict';var util=require(_0xfc7c('0x0'));var Transform=require(_0xfc7c('0x1'))[_0xfc7c('0x2')];function AGIReply(_0x453274){Transform[_0xfc7c('0x3')](this,_0x453274);this[_0xfc7c('0x4')]='';this[_0xfc7c('0x5')]=![];}util[_0xfc7c('0x6')](AGIReply,Transform);AGIReply[_0xfc7c('0x7')][_0xfc7c('0x8')]=function(_0x367cbb,_0x52b98a,_0x1a64c8){var _0x57d121='\x0a',_0x3d5da1=['\x0a\x0a',_0xfc7c('0x9')],_0xcdf751=-0x1,_0x4f3e7f=-0x1,_0x1ec7ff='',_0x601a13=0x0,_0x34ef0c='',_0xd85cb0='';this[_0xfc7c('0x4')]+=_0x367cbb[_0xfc7c('0xa')]();_0x34ef0c=this[_0xfc7c('0x4')];if(!this['_inBody']){_0x601a13=0x0;while(_0x3d5da1[_0x601a13]){while((_0x4f3e7f=_0x34ef0c[_0xfc7c('0xb')](_0x3d5da1[_0x601a13]))!=-0x1){_0x1ec7ff=_0x3d5da1[_0x601a13];_0xd85cb0=_0x34ef0c[_0xfc7c('0xc')](0x0,_0x4f3e7f);_0x34ef0c=_0x34ef0c[_0xfc7c('0xc')](_0x4f3e7f+_0x1ec7ff[_0xfc7c('0xd')]);var _0x1c5cdc=_0xd85cb0[_0xfc7c('0xe')](_0x57d121),_0x16c685=0x0,_0x5557b1={},_0x3d2c66='',_0x4997fe='',_0x167b3a=-0x1;while(_0x1c5cdc[_0x16c685]){_0x167b3a=_0x1c5cdc[_0x16c685]['indexOf'](':');if(_0x167b3a!=-0x1){_0x3d2c66=_0x1c5cdc[_0x16c685]['slice'](0x0,_0x167b3a)[_0xfc7c('0xf')]();_0x4997fe=_0x1c5cdc[_0x16c685][_0xfc7c('0x10')](_0x167b3a+0x1)[_0xfc7c('0xf')]();if(_0x3d2c66[_0xfc7c('0xd')]>0x0){_0x5557b1[_0x3d2c66]=_0x4997fe;}}else{}_0x16c685++;}this[_0xfc7c('0x11')](_0xfc7c('0x12'),_0x5557b1);this['_inBody']=!![];}_0x601a13++;}this['_localBuffer']=_0x34ef0c;}else{while((_0xcdf751=_0x34ef0c['indexOf'](_0x57d121))!=-0x1){_0xd85cb0=_0x34ef0c[_0xfc7c('0xc')](0x0,_0xcdf751);this['emit']('line',_0xd85cb0);_0x34ef0c=_0x34ef0c[_0xfc7c('0xc')](_0xcdf751+_0x57d121[_0xfc7c('0xd')]);}this[_0xfc7c('0x4')]=_0x34ef0c;}_0x1a64c8();};module[_0xfc7c('0x13')]=AGIReply; \ No newline at end of file +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 diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0972759..e9fb24e 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 _0xf6d1=['getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xf6d1,0x99));var _0x1f6d=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xf6d1[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x1f6d('0x0'));var moment=require(_0x1f6d('0x1'));var jayson=require(_0x1f6d('0x2'));var client=jayson[_0x1f6d('0x3')][_0x1f6d('0x4')]({'port':0x2329});function request(_0x44d691,_0xd760e6){return new Promise(function(_0x4fa5a2,_0x1b8190){return client['request'](_0x44d691,_0xd760e6)[_0x1f6d('0x5')](function(_0x34f815){if(_0x34f815[_0x1f6d('0x6')]){return _0x1b8190(_0x34f815[_0x1f6d('0x6')][_0x1f6d('0x7')]);}else{return _0x4fa5a2(_0x34f815[_0x1f6d('0x8')]);}})[_0x1f6d('0x9')](function(_0x234155){return _0x1b8190(_0x234155);});});}exports[_0x1f6d('0xa')]=function(){return request(_0x1f6d('0xb'),{'options':{'raw':![],'attributes':['id',_0x1f6d('0xc'),_0x1f6d('0xd')]}});};exports['getSquareProject']=function(_0x25ec55){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x25ec55},'attributes':[_0x1f6d('0xd')]}});};exports['getMailAccountById']=function(_0x270fb6){return request(_0x1f6d('0xe'),{'options':{'raw':![],'where':{'id':_0x270fb6},'include':[{'model':_0x1f6d('0xf'),'as':_0x1f6d('0x10'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x1f6d('0xc'),_0x1f6d('0x11')],'smtp':!![]}});};exports[_0x1f6d('0x12')]=function(_0x29b297){return request(_0x1f6d('0x13'),{'options':{'where':{'id':_0x29b297},'attributes':[_0x1f6d('0xc')]}});};exports[_0x1f6d('0x14')]=function(_0x3d88da){return request(_0x1f6d('0x15'),{'options':{'where':{'id':_0x3d88da},'attributes':[_0x1f6d('0xc')]}});};exports['getVariableById']=function(_0x33f334){return request(_0x1f6d('0x16'),{'options':{'where':{'id':_0x33f334},'attributes':[_0x1f6d('0xc')]}});};exports['getSquareOdbcById']=function(_0x2b867a){return request(_0x1f6d('0x17'),{'options':{'where':{'id':_0x2b867a},'attributes':['dsn']}});};exports[_0x1f6d('0x18')]=function(_0x35e432){return request(_0x1f6d('0x19'),{'options':{'where':{'id':_0x35e432},'attributes':[_0x1f6d('0xc')]}});};exports[_0x1f6d('0x1a')]=function(_0x125d8e){return request('GetContactByPhone',{'options':{'where':{'phone':_0x125d8e[_0x1f6d('0x1b')]},'attributes':['id']}});};exports[_0x1f6d('0x1c')]=function(_0x2cd064){return request(_0x1f6d('0x1d'),{'options':{'where':{'id':_0x2cd064},'attributes':[_0x1f6d('0xc')]}});};exports['getSoundById']=function(_0x290f37){return request(_0x1f6d('0x1e'),{'options':{'where':{'id':_0x290f37},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x14990c){return request(_0x1f6d('0x1f'),{'options':{'raw':![],'where':{'id':_0x14990c},'include':[{'model':_0x1f6d('0x20'),'as':'Intervals'}]}});};exports[_0x1f6d('0x21')]=function(_0x564c36){return request(_0x1f6d('0x22'),{'options':{'where':{'id':_0x564c36},'attributes':['id',_0x1f6d('0xc')]}});};exports['createSmsMessage']=function(_0x69e26d){return request(_0x1f6d('0x23'),{'body':_0x69e26d});};exports[_0x1f6d('0x24')]=function(_0x4ff7f9){return request(_0x1f6d('0x25'),{'body':_0x4ff7f9});};exports[_0x1f6d('0x26')]=function(_0x24543f){return request(_0x1f6d('0x27'),{'body':_[_0x1f6d('0x28')](_0x24543f,{'project_name':_0x24543f['arg_1'],'prev_project_name':_0x24543f['arg_2']||'','is_subproject':_0x24543f[_0x1f6d('0x29')]?!![]:![],'leaveAt':moment()[_0x1f6d('0x2a')](_0x1f6d('0x2b'))})});};exports[_0x1f6d('0x2c')]=function(_0x2bdb44){return request(_0x1f6d('0x2d'),{'body':_0x2bdb44});};exports[_0x1f6d('0x2e')]=function(_0x3718dc){return request(_0x1f6d('0x2f'),{'body':_0x3718dc});};exports[_0x1f6d('0x30')]=function(_0x23596d){return request(_0x1f6d('0x31'),{'options':{'raw':![],'where':{'phone':_0x23596d[_0x1f6d('0x1b')],'ListId':_0x23596d['ListId']}}})[_0x1f6d('0x5')](function(_0x31dbe6){if(_0x31dbe6){return _0x31dbe6;}return request(_0x1f6d('0x32'),{'body':_0x23596d});});};exports[_0x1f6d('0x33')]=function(_0x1e4465){return request(_0x1f6d('0x34'),{'options':{'where':{'id':_0x1e4465},'attributes':['name']}});};exports[_0x1f6d('0x35')]=function(_0x5951f2,_0x4d053c){return request(_0x1f6d('0x36'),{'body':{'interface':_0x4d053c},'options':{'where':_0x5951f2}});};exports[_0x1f6d('0x37')]=function(_0x12446d,_0x533bdf,_0x3b1513){return request('PauseUser',{'body':{'type':_0x533bdf,'uniqueid':_0x3b1513},'options':{'where':_0x12446d}});};exports[_0x1f6d('0x38')]=function(_0x242991){return request('UnpauseUser',{'body':{},'options':{'where':_0x242991}});};exports[_0x1f6d('0x39')]=function(_0x50f605){return request(_0x1f6d('0x3a'),{'body':{},'options':{'where':_0x50f605}});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index f9c40f4..6dfe301 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 _0x158f=['exports','./lex'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x158f,0x137));var _0xf158=function(_0x1f8c9f,_0x200587){_0x1f8c9f=_0x1f8c9f-0x0;var _0xd89fa3=_0x158f[_0x1f8c9f];return _0xd89fa3;};var polly=require('./polly');var lex=require(_0xf158('0x0'));module[_0xf158('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index bf96a05..d99d63d 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 _0xe5b5=['exports','./lib/api'];(function(_0x50e14b,_0x2ded64){var _0xc9d6c8=function(_0x450302){while(--_0x450302){_0x50e14b['push'](_0x50e14b['shift']());}};_0xc9d6c8(++_0x2ded64);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xe5b5[_0x45f951];return _0x24756c;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 81c307b..7d08060 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(_0x3afada,_0x27d0f7){var _0x48f44b=function(_0x186e52){while(--_0x186e52){_0x3afada['push'](_0x3afada['shift']());}};_0x48f44b(++_0x27d0f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_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 diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index c2a0f5e..4418b4f 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x2d1519,_0x1b22dd,_0x5a86ff,_0x474df3,_0x5c154a,_0x1c4ac4,_0x58a6b7){return polly(_0x2d1519,_0x1b22dd,_0x5a86ff,_0x474df3,_0x5c154a,_0x1c4ac4,_0x58a6b7);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index d2971b2..90ede4a 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 _0xa168=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0xda949e,_0x299c5b){var _0x127fff=function(_0x2e79d1){while(--_0x2e79d1){_0xda949e['push'](_0xda949e['shift']());}};_0x127fff(++_0x299c5b);}(_0xa168,0xf3));var _0x8a16=function(_0x4fde83,_0x2d9011){_0x4fde83=_0x4fde83-0x0;var _0x3b33e3=_0xa168[_0x4fde83];return _0x3b33e3;};'use strict';var fs=require('fs');var path=require(_0x8a16('0x0'));var BPromise=require(_0x8a16('0x1'));var rs=require(_0x8a16('0x2'));var AWS=require(_0x8a16('0x3'));function pollyResult(_0x39e0a8,_0x4fc52b,_0x1df4c4){return new BPromise(function(_0x5b3193,_0x4e5926){_0x39e0a8[_0x8a16('0x4')](_0x4fc52b,function(_0x25826c,_0x496206){if(_0x25826c){_0x4e5926(_0x25826c);}else if(_0x496206){if(_0x496206[_0x8a16('0x5')]instanceof Buffer){fs[_0x8a16('0x6')](_0x1df4c4,_0x496206[_0x8a16('0x5')],function(_0x54cbe7){if(_0x54cbe7){_0x4e5926(_0x54cbe7);}else{_0x5b3193();}});}else{_0x4e5926(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4e5926(new Error(_0x8a16('0x7')));}});});}module[_0x8a16('0x8')]=function(_0x4de8e9,_0x24e1c8,_0x2247b2,_0x27704d,_0x216051,_0x4f110f,_0x5e7bd1){var _0x39b761=new AWS[(_0x8a16('0x9'))]({'accessKeyId':_0x4de8e9,'secretAccessKey':_0x24e1c8,'region':_0x2247b2});var _0x33dd7f={'Text':_0x216051,'TextType':_0x4f110f||'text','OutputFormat':_0x8a16('0xa'),'VoiceId':_0x27704d};return pollyResult(_0x39b761,_0x33dd7f,_0x5e7bd1);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index fce0919..13586ca 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 _0xbee4=['exports'];(function(_0x1c5ca3,_0x18dcc2){var _0x5db079=function(_0x10bbce){while(--_0x10bbce){_0x1c5ca3['push'](_0x1c5ca3['shift']());}};_0x5db079(++_0x18dcc2);}(_0xbee4,0x1f2));var _0x4bee=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xbee4[_0x5c351c];return _0x26f3b3;};'use strict';var asr=require('./lib/api');module[_0x4bee('0x0')]=function(_0x3cf447,_0x62f953,_0x2804dd,_0x56e07e){return asr(_0x3cf447,_0x62f953,_0x2804dd);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 55e84a6..45f07af 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 _0x8e0d=['url','exports','filepath\x20should\x20be\x20a\x20string','string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','/v1/speech:recognize?key='];(function(_0x2c931f,_0x12d1c9){var _0x5f1470=function(_0x3b5d03){while(--_0x3b5d03){_0x2c931f['push'](_0x2c931f['shift']());}};_0x5f1470(++_0x12d1c9);}(_0x8e0d,0x82));var _0xd8e0=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x8e0d[_0x599e60];return _0x468e19;};'use strict';var url=require(_0xd8e0('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xd8e0('0x1')]=function(_0x11f7df,_0x549e82,_0x3ee520){return new BPromise(function(_0x180f36,_0x14598d){var _0xe9c59f;if(typeof _0x11f7df!=='string'||_0x11f7df['length']===0x0){return _0x14598d(_0xd8e0('0x2'));}if(typeof _0x549e82!==_0xd8e0('0x3')||_0x549e82[_0xd8e0('0x4')]===0x0){return _0x14598d(_0xd8e0('0x5'));}if(typeof _0x3ee520!=='undefined'&&(typeof _0x3ee520!==_0xd8e0('0x3')||_0x3ee520[_0xd8e0('0x4')]===0x0)){return _0x14598d(_0xd8e0('0x6'));}try{_0xe9c59f=fs[_0xd8e0('0x7')](_0x11f7df)[_0xd8e0('0x8')]('base64');}catch(_0x332007){return _0x14598d(_0x332007);}return _0x180f36({'method':'POST','uri':host+_0xd8e0('0x9')+_0x549e82,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3ee520},'audio':{'content':_0xe9c59f}},'json':!![]});});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 71cd59d..b9871e5 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 _0xcdec=['exports','./asr'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcdec,0x1e5));var _0xccde=function(_0x3d50c6,_0x599f9b){_0x3d50c6=_0x3d50c6-0x0;var _0x40f6e8=_0xcdec[_0x3d50c6];return _0x40f6e8;};var asr=require(_0xccde('0x0'));module[_0xccde('0x1')]={'asr':asr}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0377cb8..9954f82 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 _0xa26a=['message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','score','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','tildeASR','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','end','host','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','chmodSync','777','toString','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','text:synthesize','then','resolve','tmp','.mp3','from','writeFile','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','null','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','catch','[%s]\x20%s:%s','name'];(function(_0x4f0bf4,_0xaf03d8){var _0x3e9c27=function(_0x1d7a6f){while(--_0x1d7a6f){_0x4f0bf4['push'](_0x4f0bf4['shift']());}};_0x3e9c27(++_0xaf03d8);}(_0xa26a,0x1c5));var _0xaa26=function(_0x4fb4bf,_0x3ffd80){_0x4fb4bf=_0x4fb4bf-0x0;var _0x361738=_0xa26a[_0x4fb4bf];return _0x361738;};'use strict';var apiai=require(_0xaa26('0x0'));var BPromise=require(_0xaa26('0x1'));var dialogflow=require(_0xaa26('0x2'));var fs=require('fs');var http=require(_0xaa26('0x3'));var https=require(_0xaa26('0x4'));var md5=require(_0xaa26('0x5'));var path=require(_0xaa26('0x6'));var querystring=require(_0xaa26('0x7'));var rp=require(_0xaa26('0x8'));var rs=require(_0xaa26('0x9'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0xaa26('0xa'))[_0xaa26('0xb')];var util=require(_0xaa26('0xc'));var aws=require('./aws');var google=require(_0xaa26('0xd'));var sestek=require(_0xaa26('0xe'));var tilde=require(_0xaa26('0xf'));var logger=require(_0xaa26('0x10'))(_0xaa26('0x11'));var ISPEECH_API=_0xaa26('0x12');function downloadFile(_0x77dae0,_0x5244e0){return new BPromise(function(_0x388c95,_0x40e92){var _0x5c2b63=urlParse(_0x77dae0);var _0x4a23a4=_0x5c2b63[_0xaa26('0x13')]===_0xaa26('0x14')?https:http;var _0xc43bb1={'host':_0x5c2b63['host'],'path':_0x5c2b63[_0xaa26('0x6')],'headers':{'user-agent':_0xaa26('0x15')}};_0x4a23a4['get'](_0xc43bb1,function(_0x1821ff){if(_0x1821ff[_0xaa26('0x16')]!==0xc8){logger['error'](_0xaa26('0x17')+_0x77dae0+_0xaa26('0x18')+_0x1821ff['statusCode']+'\x20('+_0x1821ff[_0xaa26('0x19')]+')');_0x40e92(new Error(_0xaa26('0x17')+_0x77dae0+_0xaa26('0x18')+_0x1821ff['statusCode']+'\x20('+_0x1821ff[_0xaa26('0x19')]+')'));return;}var _0x1e2be6=fs[_0xaa26('0x1a')](_0x5244e0);_0x1e2be6['on'](_0xaa26('0x1b'),function(){logger[_0xaa26('0x1c')](_0xaa26('0x1d'));_0x1e2be6[_0xaa26('0x1e')](_0x388c95);});_0x1e2be6['on'](_0xaa26('0x1f'),function(_0x23122c){fs[_0xaa26('0x20')](_0x5244e0);logger[_0xaa26('0x1f')](_0xaa26('0x21'),_0x23122c);_0x40e92(_0x23122c);});_0x1821ff['pipe'](_0x1e2be6);})['on'](_0xaa26('0x1f'),function(_0x13df97){logger[_0xaa26('0x1f')](_0x13df97);_0x40e92(_0x13df97);})[_0xaa26('0x22')]();});}function uploadFile(_0x52e802){return new BPromise(function(_0x32146d,_0x44fb74){var _0x2d9bdd=urlParse(_0x52e802);var _0x4a5d15=_0x2d9bdd[_0xaa26('0x13')]===_0xaa26('0x14')?https:http;var _0x409f6a={'host':_0x2d9bdd[_0xaa26('0x23')],'path':_0x2d9bdd[_0xaa26('0x6')],'headers':{'user-agent':_0xaa26('0x15')}};_0x4a5d15[_0xaa26('0x24')](_0x409f6a,function(_0x22fd6f){if(_0x22fd6f['statusCode']!==0xc8){_0x44fb74(new Error(_0xaa26('0x17')+_0x52e802+_0xaa26('0x18')+_0x22fd6f[_0xaa26('0x16')]+'\x20('+_0x22fd6f[_0xaa26('0x19')]+')'));return;}var _0x23402b='';_0x22fd6f['on'](_0xaa26('0x25'),function(_0x55b6b8){_0x23402b+=_0x55b6b8;});_0x22fd6f['on'](_0xaa26('0x22'),function(){_0x32146d(_0x23402b);});})['on']('error',function(_0x471367){_0x44fb74(_0x471367);})[_0xaa26('0x22')]();});}function convertFile(_0xf5454e,_0x259646){return new BPromise(function(_0x36428e,_0x594345){var _0xf86cf=sox[_0xaa26('0x26')](_0xf5454e,_0x259646,{'sampleRate':0x1f40,'format':_0xaa26('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf86cf['on'](_0xaa26('0x1f'),function(_0x11ecb8){logger[_0xaa26('0x1f')](_0xaa26('0x28'),_0x11ecb8);_0x594345(_0x11ecb8);});_0xf86cf['on']('end',function(){logger['info'](_0xaa26('0x29'));_0x36428e();});_0xf86cf[_0xaa26('0x2a')]();});}function base64Decode(_0x272b58,_0x199aac){var _0x1ede28=path['resolve'](__dirname,'tmp',rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x2c'));fs[_0xaa26('0x2d')](_0x1ede28,_0x272b58,_0xaa26('0x2e'));return convertFile(_0x1ede28,_0x199aac)['then'](function(){try{fs['unlink'](_0x1ede28);fs[_0xaa26('0x2f')](_0x199aac,_0xaa26('0x30'));}catch(_0x5cd036){logger[_0xaa26('0x1f')](_0x5cd036);}return _0x199aac['split']('.')[0x0];});}function base64Encode(_0x351891){var _0x599e43=fs['readFileSync'](_0x351891);return new Buffer(_0x599e43)[_0xaa26('0x31')](_0xaa26('0x2e'));}exports['googleCloudTTS']=function(_0x5952ff,_0x39a584,_0x16de0c,_0x193f92,_0x57f32f,_0x2fca25){var _0x142dcd,_0xb32f96;var _0x46607d=_0xaa26('0x32');var _0x513cce='?key='+_0x5952ff;var _0x59f616={};if(_0x39a584===_0xaa26('0x33')){_0x59f616[_0xaa26('0x34')]={'ssml':_0x16de0c};}else{_0x59f616[_0xaa26('0x34')]={'text':_0x16de0c};};_0x59f616['voice']={'languageCode':_0x193f92,'ssmlGender':_0x57f32f};_0x59f616[_0xaa26('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2bc9fa={'url':_0x46607d+_0xaa26('0x36')+_0x513cce,'method':'POST','json':!![],'body':_0x59f616};return rp(_0x2bc9fa)[_0xaa26('0x37')](function(_0x478b7b){return new BPromise(function(_0x20d7e5,_0x34db87){_0x142dcd=path[_0xaa26('0x38')](__dirname,_0xaa26('0x39'),rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x3a'));var _0x550bab=Buffer[_0xaa26('0x3b')](_0x478b7b['audioContent'],_0xaa26('0x2e'));return fs[_0xaa26('0x3c')](_0x142dcd,_0x550bab,function(_0x251c70){_0x34db87(_0x251c70);},function(_0x591885){fs[_0xaa26('0x2f')](_0x142dcd,_0xaa26('0x30'));_0x20d7e5(_0x591885);});});})['then'](function(_0x211039){_0xb32f96=path[_0xaa26('0x38')](__dirname,_0xaa26('0x39'),rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x2c'));return convertFile(_0x142dcd,_0xb32f96);})[_0xaa26('0x37')](function(){try{fs[_0xaa26('0x20')](_0x142dcd);fs[_0xaa26('0x2f')](_0xb32f96,_0xaa26('0x30'));}catch(_0x36a147){logger[_0xaa26('0x1f')](_0x36a147);}logger[_0xaa26('0x1c')]('googleCloudTTS\x20path',_0xb32f96['split']('.')[0x0]);return _0xb32f96[_0xaa26('0x3d')]('.')[0x0];});};exports[_0xaa26('0x3e')]=function(_0x394d92,_0x5c6ab3){var _0x28db81=_0xaa26('0x3f');var _0x85095b,_0x2acda8;var _0x51da21;var _0x592fa8={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x28db81,'headers':{'Content-Type':_0xaa26('0x40')},'body':_0xaa26('0x41')+encodeURIComponent(JSON['stringify']([[[_0xaa26('0x42'),JSON['stringify']([_0x394d92,_0x5c6ab3||'en',![],_0xaa26('0x43')]),null,'generic']]]))};return rp(_0x592fa8)[_0xaa26('0x37')](function(_0x1270ce){try{_0x51da21=eval(_0x1270ce['slice'](0x5))[0x0][0x2];}catch(_0x25553d){throw new Error(_0xaa26('0x44')+_0x1270ce[_0xaa26('0x25')]);}if(!_0x51da21){if(_0x394d92['length']>0xc8){throw new Error(_0xaa26('0x45'));}else{throw new Error(_0xaa26('0x46')+_0x5c6ab3+'\x22\x20might\x20not\x20exist');}}try{_0x51da21=eval(_0x51da21)[0x0];}catch(_0x36f21d){throw new Error(_0xaa26('0x44')+res[_0xaa26('0x25')]);}const _0x2c335d=_0x51da21;_0x85095b=path[_0xaa26('0x38')](__dirname,_0xaa26('0x39'),rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x3a'));fs['writeFileSync'](_0x85095b,_0x51da21,{'encoding':_0xaa26('0x2e')});_0x2acda8=path[_0xaa26('0x38')](__dirname,'tmp',rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x2c'));return convertFile(_0x85095b,_0x2acda8);})[_0xaa26('0x37')](function(){try{fs[_0xaa26('0x20')](_0x85095b);fs[_0xaa26('0x2f')](_0x2acda8,_0xaa26('0x30'));}catch(_0x171647){logger[_0xaa26('0x1f')](_0x171647);}logger[_0xaa26('0x1c')]('goggleTTS\x20path',_0x2acda8[_0xaa26('0x3d')]('.')[0x0]);return _0x2acda8['split']('.')[0x0];});};exports[_0xaa26('0x47')]=function(_0x722a2e,_0x9ff190,_0x269bd6){return google[_0xaa26('0x48')](_0x722a2e,_0x9ff190,_0x269bd6)[_0xaa26('0x37')](function(_0x45f468){logger[_0xaa26('0x1c')](_0x45f468[_0xaa26('0x49')]);return rp(_0x45f468);})[_0xaa26('0x37')](function(_0x3bfe3b){var _0x40c155='';var _0x5a1bb3=0x0;try{fs[_0xaa26('0x20')](_0x722a2e);}catch(_0x3049db){logger[_0xaa26('0x1f')](_0x3049db);}if(_0x3bfe3b&&_0x3bfe3b[_0xaa26('0x4a')]){_0x40c155=_0x3bfe3b[_0xaa26('0x4a')][_0xaa26('0x4b')](function(_0x32cfe1){return _0x32cfe1&&_0x32cfe1[_0xaa26('0x4c')][0x0]&&_0x32cfe1['alternatives'][0x0][_0xaa26('0x4d')]?_0x32cfe1[_0xaa26('0x4c')][0x0][_0xaa26('0x4d')]:'';})['join']('\x0a');_0x5a1bb3=_0x3bfe3b[_0xaa26('0x4a')][_0xaa26('0x4b')](function(_0x51e557){return _0x51e557&&_0x51e557[_0xaa26('0x4c')][0x0]&&_0x51e557[_0xaa26('0x4c')][0x0][_0xaa26('0x4e')]?_0x51e557['alternatives'][0x0][_0xaa26('0x4e')]:0x0;})[_0xaa26('0x4f')]('\x0a');}logger['info']('googleASR\x20transcription',_0x40c155);logger[_0xaa26('0x1c')]('googleASR\x20confidence',_0x5a1bb3);return{'transcript':_0x40c155,'confidence':_0x5a1bb3};})[_0xaa26('0x50')](function(_0x3af1a1){logger[_0xaa26('0x1f')](_0xaa26('0x51'),_0x3af1a1['statusCode'],_0x3af1a1[_0xaa26('0x52')],_0x3af1a1[_0xaa26('0x53')]);});};exports[_0xaa26('0x54')]=function(_0x1c0fd9,_0x19276f,_0x469d20,_0x8e4339){var _0x4c5577=apiai(_0x19276f,{'language':_0x8e4339||'en'});return _0x4c5577[_0xaa26('0x55')](_0x469d20,{'sessionId':md5(_0x1c0fd9)})['then'](function(_0xc2fdf8){logger[_0xaa26('0x1c')](JSON[_0xaa26('0x56')](_0xc2fdf8));return{'source':_0xc2fdf8[_0xaa26('0x57')][_0xaa26('0x58')],'resolvedQuery':_0xc2fdf8[_0xaa26('0x57')][_0xaa26('0x59')],'action':_0xc2fdf8['result'][_0xaa26('0x5a')],'actionIncomplete':_0xc2fdf8[_0xaa26('0x57')][_0xaa26('0x5b')],'speech':_0xc2fdf8['result']['fulfillment']['speech'],'score':_0xc2fdf8[_0xaa26('0x57')][_0xaa26('0x5c')],'statusCode':_0xc2fdf8['status'][_0xaa26('0x5d')],'endConversation':_0xc2fdf8[_0xaa26('0x57')][_0xaa26('0x5e')][_0xaa26('0x5f')]||![],'isFallbackIntent':_0xc2fdf8[_0xaa26('0x57')][_0xaa26('0x5e')][_0xaa26('0x60')]};});};exports['googleDialogflowV2']=function(_0x5d1519,_0x51f110,_0x2626e7,_0x3893cd,_0x47c84b,_0x5df82c){var _0x351831=_0x3893cd[_0xaa26('0x61')](/\\n/g,'\x0a');var _0x5c2c93={'credentials':{'private_key':_0x351831,'client_email':_0x2626e7}};var _0x2fd6b6=new dialogflow[(_0xaa26('0x62'))](_0x5c2c93);var _0x38ecbd=_0x2fd6b6[_0xaa26('0x63')](_0x51f110,md5(_0x5d1519));var _0x2c528b={'session':_0x38ecbd,'queryInput':{'text':{'text':_0x47c84b,'languageCode':_0x5df82c}}};return _0x2fd6b6[_0xaa26('0x64')](_0x2c528b)[_0xaa26('0x37')](function(_0x35ee8f){if(_0x35ee8f&&_0x35ee8f[_0xaa26('0x65')]){logger[_0xaa26('0x1c')](_0xaa26('0x66'),JSON['stringify'](_0x35ee8f));var _0x3aae23=_0x35ee8f[0x0];if(_0x3aae23){var _0x135291={'action':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x5a')],'allRequiredParamsPresent':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x68')],'endConversation':_0x3aae23['queryResult'][_0xaa26('0x69')]&&_0x3aae23['queryResult'][_0xaa26('0x69')]['fields']?_0x3aae23[_0xaa26('0x67')][_0xaa26('0x69')][_0xaa26('0x6a')][_0xaa26('0x6b')][_0xaa26('0x6c')]:![],'fulfillmentText':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x6d')],'intentName':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x6e')][_0xaa26('0x52')],'intentDisplayName':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x6e')][_0xaa26('0x6f')],'isFallbackIntent':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x6e')][_0xaa26('0x70')],'languageCode':_0x3aae23[_0xaa26('0x67')]['languageCode'],'queryText':_0x3aae23[_0xaa26('0x67')][_0xaa26('0x71')],'responseId':_0x3aae23[_0xaa26('0x72')],'score':_0x3aae23[_0xaa26('0x67')]['intentDetectionConfidence'],'speech':_0x3aae23[_0xaa26('0x67')]['fulfillmentText'],'providerResponse':JSON[_0xaa26('0x56')](_0x35ee8f)};return _0x135291;}}});};exports[_0xaa26('0x73')]=function(_0x453820,_0x4c69e1,_0x459f53,_0x1c0577){return tilde[_0xaa26('0x48')](_0x453820,_0x4c69e1,_0x459f53,_0x1c0577)[_0xaa26('0x37')](function(_0x1f7074){try{fs[_0xaa26('0x20')](_0x453820);}catch(_0x5260b0){logger[_0xaa26('0x1f')](_0x5260b0);}logger[_0xaa26('0x1c')]('Tilde\x20ASR\x20transcription',_0x1f7074[_0xaa26('0x4d')]);logger[_0xaa26('0x1c')](_0xaa26('0x74'),_0x1f7074[_0xaa26('0x4e')]);return _0x1f7074;});};exports['awsPolly']=function(_0x3fdad0,_0x1d7f44,_0x24f35f,_0x1dc58d,_0x3f2015,_0x20c4f5){var _0x25a108=path[_0xaa26('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0xaa26('0x3a'));var _0x466412;return aws[_0xaa26('0x75')](_0x3fdad0,_0x1d7f44,_0x24f35f,_0x1dc58d,_0x3f2015,_0x20c4f5,_0x25a108)[_0xaa26('0x37')](function(){_0x466412=path[_0xaa26('0x38')](__dirname,_0xaa26('0x39'),rs['generate'](0x4)+_0xaa26('0x2c'));return convertFile(_0x25a108,_0x466412);})[_0xaa26('0x37')](function(){try{fs[_0xaa26('0x20')](_0x25a108);fs['chmodSync'](_0x466412,_0xaa26('0x30'));}catch(_0x39e97c){logger[_0xaa26('0x1f')](_0x39e97c);}return _0x466412[_0xaa26('0x3d')]('.')[0x0];});};exports[_0xaa26('0x76')]=function(_0x446211,_0x21a98b,_0x47fc8b,_0x3c47df,_0x42e7df,_0x48036e){return aws[_0xaa26('0x77')](_0x446211,_0x21a98b,_0x47fc8b,_0x3c47df,_0x42e7df,_0x48036e)[_0xaa26('0x37')](function(_0x1fc922){logger[_0xaa26('0x1c')](JSON[_0xaa26('0x56')](_0x1fc922));return _0x1fc922;});};exports[_0xaa26('0x78')]=function(_0x476d3d,_0x536c14,_0x11b697,_0x59215f){var _0x16703a=util[_0xaa26('0x79')](_0xaa26('0x7a'),ISPEECH_API,_0x476d3d,encodeURIComponent(_0x536c14),_0x11b697,_0x59215f);var _0x16a065=path['resolve'](__dirname,_0xaa26('0x39'),rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x3a'));var _0x5120e8;return downloadFile(_0x16703a,_0x16a065)['then'](function(){_0x5120e8=path['resolve'](__dirname,_0xaa26('0x39'),rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x2c'));return convertFile(_0x16a065,_0x5120e8);})[_0xaa26('0x37')](function(){try{fs[_0xaa26('0x20')](_0x16a065);fs[_0xaa26('0x2f')](_0x5120e8,_0xaa26('0x30'));}catch(_0x16cd36){logger[_0xaa26('0x1f')](_0x16cd36);}return _0x5120e8[_0xaa26('0x3d')]('.')[0x0];});};exports[_0xaa26('0x7b')]=function(_0x4fe16c,_0x196db2,_0x42b1f7,_0x4e689c){var _0x58d127=util[_0xaa26('0x79')](_0xaa26('0x7c'),ISPEECH_API,_0x196db2,_0x42b1f7,base64Encode(_0x4fe16c),_0x4e689c?util['format']('model=%s',encodeURIComponent(_0x4e689c)):'freeform=3');return uploadFile(_0x58d127)[_0xaa26('0x37')](function(_0x2fb87e){return querystring[_0xaa26('0xb')](_0x2fb87e);});};exports[_0xaa26('0x7d')]=function(_0x3ad8e5,_0x3b74b7){return sestek[_0xaa26('0x7e')](_0x3ad8e5,_0x3b74b7)[_0xaa26('0x37')](function(_0x23361a){logger[_0xaa26('0x1c')](JSON[_0xaa26('0x56')](_0x23361a));var _0x2f58ee={'speech':_0x23361a[_0xaa26('0x7f')],'action':_0x23361a[_0xaa26('0x80')]?_0x23361a[_0xaa26('0x80')][_0xaa26('0x81')]:undefined,'actiondata':_0x23361a[_0xaa26('0x80')]?_0x23361a[_0xaa26('0x80')][_0xaa26('0x82')]:undefined};if(_0x23361a[_0xaa26('0x80')]&&_0x23361a[_0xaa26('0x80')][_0xaa26('0x83')]){return base64Decode(_0x23361a[_0xaa26('0x80')]['AudioFromTts']['Data'],path[_0xaa26('0x38')](__dirname,_0xaa26('0x39'),rs[_0xaa26('0x2b')](0x4)+_0xaa26('0x2c')))['then'](function(_0x2b52ba){_0x2f58ee[_0xaa26('0x84')]=_0x2b52ba;return _0x2f58ee;});}return _0x2f58ee;});};exports[_0xaa26('0x85')]=function(){return __dirname;}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 9c92911..ab28300 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 _0x9137=['exports'];(function(_0x5c5796,_0x12092d){var _0x405d40=function(_0x143f24){while(--_0x143f24){_0x5c5796['push'](_0x5c5796['shift']());}};_0x405d40(++_0x12092d);}(_0x9137,0x76));var _0x7913=function(_0x313866,_0x3ecd92){_0x313866=_0x313866-0x0;var _0x5a818f=_0x9137[_0x313866];return _0x5a818f;};var nda=require('./nda');module[_0x7913('0x0')]={'nda':nda}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 0290f0e..8d9ad13 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 _0x01d3=['ndauth_url','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','resolve'];(function(_0x13f23e,_0x7336bb){var _0x36cc13=function(_0x1f2901){while(--_0x1f2901){_0x13f23e['push'](_0x13f23e['shift']());}};_0x36cc13(++_0x7336bb);}(_0x01d3,0xdb));var _0x301d=function(_0x63c794,_0x14f52c){_0x63c794=_0x63c794-0x0;var _0x16f319=_0x01d3[_0x63c794];return _0x16f319;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x301d('0x0'))(_0x301d('0x1'));module[_0x301d('0x2')]=function(_0x5912f4,_0x33a51f){var _0x27dc62={'method':_0x301d('0x3'),'uri':url[_0x301d('0x4')](_0x33a51f[_0x301d('0x5')],'/token'),'form':{'grant_type':_0x301d('0x6'),'username':_0x33a51f[_0x301d('0x7')],'password':_0x33a51f[_0x301d('0x6')]},'json':!![]};return rp(_0x27dc62)[_0x301d('0x8')](function(_0x12b21b){var _0x49a253={'method':_0x301d('0x3'),'uri':url[_0x301d('0x4')](_0x33a51f[_0x301d('0x9')],_0x301d('0xa')),'body':{'type':_0x33a51f[_0x301d('0xb')]||_0x301d('0xc'),'channelId':_0x301d('0xd'),'conversation':{'id':_0x5912f4[_0x301d('0xe')]},'from':{'id':_0x5912f4[_0x301d('0xf')],'name':_0x5912f4['calleridname']},'recipient':{'id':_0x5912f4[_0x301d('0x10')],'name':_0x5912f4[_0x301d('0x11')]},'text':_0x33a51f['text'],'channelData':{}},'headers':{'Authorization':_0x301d('0x12')+_0x12b21b[_0x301d('0x13')]},'json':!![]};if(_0x33a51f[_0x301d('0x14')]){_0x49a253[_0x301d('0x15')]['channelData'][_0x301d('0x16')]=_0x33a51f[_0x301d('0x14')];}if(_0x33a51f[_0x301d('0x17')]=='1'){_0x49a253[_0x301d('0x15')][_0x301d('0x18')][_0x301d('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x301d('0x1a')};}if(_0x33a51f['custom_action']){_0x49a253[_0x301d('0x15')][_0x301d('0x18')]['CustomAction']=_0x33a51f[_0x301d('0x1b')];if(_0x33a51f[_0x301d('0x1c')]){_0x49a253[_0x301d('0x15')][_0x301d('0x18')][_0x301d('0x1d')]=_0x33a51f[_0x301d('0x1c')];}}logger[_0x301d('0x1e')](JSON[_0x301d('0x1f')](_0x49a253));return rp(_0x49a253);});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index cc3e3b6..b4f15a3 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 _0xed07=['./lib/api','exports'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xed07,0x1d0));var _0x7ed0=function(_0x224343,_0x2e6aeb){_0x224343=_0x224343-0x0;var _0x13885e=_0xed07[_0x224343];return _0x13885e;};'use strict';var asr=require(_0x7ed0('0x0'));module[_0x7ed0('0x1')]=function(_0x1572ce,_0x2552c2,_0x4f5c91,_0x5e4941){return asr(_0x1572ce,_0x2552c2,_0x4f5c91,_0x5e4941);}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index be8aa6e..45672ee 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 _0x0f11=['result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status'];(function(_0x4ccc7a,_0x2b65d2){var _0x1f8000=function(_0x3463aa){while(--_0x3463aa){_0x4ccc7a['push'](_0x4ccc7a['shift']());}};_0x1f8000(++_0x2b65d2);}(_0x0f11,0xd1));var _0x10f1=function(_0x555d5c,_0x1947e5){_0x555d5c=_0x555d5c-0x0;var _0x38b70b=_0x0f11[_0x555d5c];return _0x38b70b;};'use strict';var BPromise=require(_0x10f1('0x0'));var _=require(_0x10f1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x10f1('0x2'));var crypto=require(_0x10f1('0x3'));var logger=require(_0x10f1('0x4'))('agi');module['exports']=function(_0x14dc47,_0x5ae7d9,_0xb52d27,_0x16c4b4){return new BPromise(function(_0x1f0634,_0x14a004){logger[_0x10f1('0x5')](_0x10f1('0x6'),_0x16c4b4||_0x10f1('0x7'));var _0x1f484a=new WebSocket(_0x16c4b4||_0x10f1('0x7'),{'perMessageDeflate':![]});var _0x3587f2='';var _0x20ad52='0';var _0xedb9c1='1';var _0xc82568=_0x10f1('0x8');function _0x20fa3d(_0x256aad){var _0x4ade82=crypto['createHash'](_0x10f1('0x9'));_0x4ade82[_0x10f1('0xa')](_0x256aad);return _0x4ade82[_0x10f1('0xb')](_0x10f1('0xc'));}function _0x3d32fd(){try{logger[_0x10f1('0x5')](_0x10f1('0xd'));var _0x5160af=moment()[_0x10f1('0xe')]();var _0x1a01b7=_0x20fa3d(_0x5160af+_0x5ae7d9+_0xb52d27);_0x1f484a[_0x10f1('0xf')](JSON['stringify']({'appID':_0x5ae7d9,'timestamp':_0x5160af,'appKey':_0x1a01b7}));var _0x2fb25c=fs[_0x10f1('0x10')](_0x14dc47);_0x2fb25c['on'](_0x10f1('0x11'),function(_0x1b2f28){_0x1f484a[_0x10f1('0xf')](_0x1b2f28);});_0x2fb25c['on'](_0x10f1('0x12'),function(){_0x1f484a[_0x10f1('0xf')](_0x10f1('0x13'));});}catch(_0x168ca5){logger[_0x10f1('0x14')](_0x10f1('0x15'),JSON[_0x10f1('0x16')](_0x168ca5));_0x1f484a[_0x10f1('0x17')]();}}function _0x393c4f(_0x315b25){try{if(_0x315b25){var _0xe242ec=JSON['parse'](_0x315b25);switch(_0xe242ec[_0x10f1('0x18')]){case 0x0:if(_0xe242ec[_0x10f1('0x19')]){if(_0xe242ec[_0x10f1('0x19')][_0x10f1('0x1a')]){logger[_0x10f1('0x5')](_0x10f1('0x1b'),JSON[_0x10f1('0x16')](_0xe242ec[_0x10f1('0x19')]['hypotheses']));_0x3587f2=_0xe242ec['result']['hypotheses'][0x0][_0x10f1('0x1c')];_0x20ad52=_0xe242ec[_0x10f1('0x19')][_0x10f1('0x1d')][0x0][_0x10f1('0x1e')];_0xedb9c1='0';_0xc82568=_0x10f1('0x1f');_0x1f484a['terminate']();}}break;case 0x1:logger[_0x10f1('0x5')](_0x10f1('0x8'));_0xedb9c1='1';_0xc82568=_0x10f1('0x8');break;case 0x2:logger[_0x10f1('0x5')](_0x10f1('0x20'));_0xedb9c1='2';_0xc82568='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x10f1('0x21'));_0xedb9c1='9';_0xc82568=_0x10f1('0x21');break;case 0xa:logger[_0x10f1('0x5')]('Authentication\x20failed.');_0xedb9c1='10';_0xc82568='Authentication\x20failed.';break;case 0xb:logger['info'](_0x10f1('0x22'));_0xedb9c1='11';_0xc82568='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x440132){logger[_0x10f1('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x10f1('0x16')](_0x440132));_0x1f484a[_0x10f1('0x17')]();}}function _0x17b348(){logger[_0x10f1('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x1f0634({'transcript':_0x3587f2,'confidence':_0x20ad52,'status':_0xedb9c1,'status_message':_0xc82568});}function _0x5bc924(_0x4777ef){logger[_0x10f1('0x14')](_0x10f1('0x23'));if(!_[_0x10f1('0x24')](_0x4777ef)){logger[_0x10f1('0x14')](_[_0x10f1('0x25')](_0x4777ef)?JSON['stringify'](_0x4777ef):_0x4777ef);}}_0x1f484a['on']('open',_0x3d32fd);_0x1f484a['on'](_0x10f1('0x26'),_0x393c4f);_0x1f484a['on'](_0x10f1('0x12'),_0x17b348);_0x1f484a['on'](_0x10f1('0x14'),_0x5bc924);});}; \ No newline at end of file +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 diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 566ce7c..134fb4d 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 _0x1d37=['exports','./asr'];(function(_0x385fed,_0x3a4757){var _0x52fa25=function(_0x3ae7a7){while(--_0x3ae7a7){_0x385fed['push'](_0x385fed['shift']());}};_0x52fa25(++_0x3a4757);}(_0x1d37,0x13b));var _0x71d3=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x1d37[_0x4eab61];return _0x342426;};var asr=require(_0x71d3('0x0'));module[_0x71d3('0x1')]={'asr':asr}; \ No newline at end of file +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 diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9f1bcc4..3ce5c13 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +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 diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 38d546e..618122a 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 _0x029b=['file_id','no\x20file\x20audio\x20selected','getData','no\x20variable\x20selected\x20for\x20the\x20result','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','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','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','odbc','randomstring','mustache','request-promise','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','rpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','name','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','Intervals','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','createSquareMessage','callback_','random','isEmpty','lastName','phone','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','format','%s/%s@from-sip/n','exec','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','parse','headers','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','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','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','DIAL','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20found','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','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','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','beep','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','AGENT\x20%s\x20FOUND\x20BY','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block'];(function(_0x18695d,_0x3ca968){var _0x20ddf6=function(_0x414a83){while(--_0x414a83){_0x18695d['push'](_0x18695d['shift']());}};_0x20ddf6(++_0x3ca968);}(_0x029b,0x66));var _0xb029=function(_0x160a8b,_0xdb8f0e){_0x160a8b=_0x160a8b-0x0;var _0x596582=_0x029b[_0x160a8b];return _0x596582;};'use strict';var fs=require('fs');var util=require(_0xb029('0x0'));var _=require(_0xb029('0x1'));var sh=require('shelljs');var odbc=require(_0xb029('0x2'))();var rs=require(_0xb029('0x3'));var moment=require('moment');var Mustache=require(_0xb029('0x4'));var rp=require(_0xb029('0x5'));var logger=require('../../config/logger')('agi');var config=require(_0xb029('0x6'));var scripts=require(_0xb029('0x7'));var FILES_PATH=_0xb029('0x8');var recursiveMapAttributes=[_0xb029('0x9'),_0xb029('0xa')];var verticesWithRetry=['menu',_0xb029('0xb'),'getsecretdigits'];var AGIVertices=function(_0x3fffd9,_0x480ead,_0x2c3772){this['channel']=_0x3fffd9;this[_0xb029('0xc')]=_0x480ead;this['mailRpc']=_0x2c3772;};AGIVertices[_0xb029('0xd')][_0xb029('0xe')]=function(_0x5a2625,_0x266df5){this[_0xb029('0xc')][_0xb029('0xf')](_0x5a2625)[_0xb029('0x10')](function(_0x4399d2){_0x266df5(null,_0x4399d2?_0x4399d2['name']:![]);})[_0xb029('0x11')](function(_0x4b6202){_0x266df5(_0x4b6202);});};AGIVertices[_0xb029('0xd')][_0xb029('0x12')]=function(_0x18e228,_0x8dfbf1){this['rpc'][_0xb029('0x13')](_0x18e228)[_0xb029('0x10')](function(_0xe31318){_0x8dfbf1(null,_0xe31318?_0xe31318['name']:![]);})[_0xb029('0x11')](function(_0x3afa2b){_0x8dfbf1(_0x3afa2b);});};AGIVertices[_0xb029('0xd')][_0xb029('0x14')]=function(_0x138573,_0x2b78f1){this[_0xb029('0xc')][_0xb029('0x15')](_0x138573)[_0xb029('0x10')](function(_0x4b205e){_0x2b78f1(null,_0x4b205e?_0x4b205e['name']:![]);})[_0xb029('0x11')](function(_0x5373cd){_0x2b78f1(_0x5373cd);});};AGIVertices[_0xb029('0xd')][_0xb029('0x16')]=function(_0x230fe6,_0x497ca0){this['rpc'][_0xb029('0x17')](_0x230fe6)[_0xb029('0x10')](function(_0x4c583){_0x497ca0(null,_0x4c583?_0x4c583[_0xb029('0x18')]:![]);})[_0xb029('0x11')](function(_0xad23b2){_0x497ca0(_0xad23b2);});};AGIVertices['prototype']['getUser']=function(_0x4c8cae,_0x5a79fa){this[_0xb029('0xc')][_0xb029('0x19')](_0x4c8cae)[_0xb029('0x10')](function(_0x4201f4){_0x5a79fa(null,_0x4201f4?_0x4201f4['name']:![]);})[_0xb029('0x11')](function(_0x379ef3){_0x5a79fa(_0x379ef3);});};AGIVertices[_0xb029('0xd')][_0xb029('0x1a')]=function(_0x455622,_0x26bb54){this[_0xb029('0xc')][_0xb029('0x1b')](_0x455622)[_0xb029('0x10')](function(_0x3671e6){_0x26bb54(null,_0x3671e6?_0x3671e6[_0xb029('0x1c')]:![]);})[_0xb029('0x11')](function(_0x279e4a){_0x26bb54(_0x279e4a);});};AGIVertices['prototype'][_0xb029('0x1d')]=function(_0x2eb298,_0x47f874){var _0x4fd06e=this;this[_0xb029('0xc')][_0xb029('0x1e')](_0x2eb298)[_0xb029('0x10')](function(_0x45cb0c){_0x47f874(null,_0x45cb0c?_0x4fd06e[_0xb029('0x1f')](_0x45cb0c['save_name']):![]);})[_0xb029('0x11')](function(_0x4a4100){_0x47f874(_0x4a4100);});};AGIVertices[_0xb029('0xd')][_0xb029('0x20')]=function(_0x3381a2,_0x599bf1){this[_0xb029('0xc')][_0xb029('0x21')](_0x3381a2)['then'](function(_0x236217){_0x599bf1(null,_0x236217?_0x236217:![]);})['catch'](function(_0x1ee866){_0x599bf1(_0x1ee866);});};AGIVertices['prototype'][_0xb029('0x22')]=function(_0x3b0bfe,_0x392d0f,_0x2324f3){this[_0xb029('0x23')][_0xb029('0x22')](_0x3b0bfe,_0x392d0f)[_0xb029('0x10')](function(){_0x2324f3(null);})[_0xb029('0x11')](function(_0x4d5271){_0x2324f3(_0x4d5271);});};AGIVertices[_0xb029('0xd')][_0xb029('0x24')]=function(_0x130663,_0x53753a){this[_0xb029('0xc')][_0xb029('0x25')](_0x130663)['then'](function(_0x2f17b0){if(_0x2f17b0){if(_0x2f17b0['IntervalId']){_0x53753a(null,[_0x2f17b0[_0xb029('0x26')]]);}else{_0x53753a(null,_['map'](_0x2f17b0[_0xb029('0x27')],_0xb029('0x26')));}}else{_0x53753a(null,![]);}})[_0xb029('0x11')](function(_0xae3440){_0x53753a(_0xae3440);});};AGIVertices[_0xb029('0xd')][_0xb029('0x1f')]=function(_0x2c589e){return util['format'](_0xb029('0x28'),FILES_PATH,_0x2c589e);};AGIVertices[_0xb029('0xd')]['getQueryOdbc']=function(_0x38f4eb,_0x3d773b,_0x35105c){odbc[_0xb029('0x29')](_0x38f4eb,function(_0x5a92cd){if(_0x5a92cd){logger[_0xb029('0x2a')](_0xb029('0x2b'),_0x5a92cd);_0x35105c(_0x5a92cd);}else{logger[_0xb029('0x2c')]('ODBC\x20connection\x20successfully');odbc[_0xb029('0x2d')](_0x3d773b,function(_0xe60f15,_0x326f2e){if(_0xe60f15){logger[_0xb029('0x2c')](_0xb029('0x2e'),_0x3d773b);_0x35105c(_0xe60f15);}else{logger[_0xb029('0x2c')](_0xb029('0x2f'),_0x3d773b);odbc[_0xb029('0x30')](function(_0x3f42ef){if(_0x3f42ef){logger[_0xb029('0x2a')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3f42ef);}_0x35105c(null,_0x326f2e);});}});}});};AGIVertices[_0xb029('0xd')][_0xb029('0x31')]=function(_0x117b1a,_0x4fb83f){this['rpc']['getSmsAccountById'](_0x117b1a)[_0xb029('0x10')](function(_0x41a857){_0x4fb83f(null,_0x41a857?_0x41a857:![]);})['catch'](function(_0x1a7285){_0x4fb83f(_0x1a7285);});};AGIVertices[_0xb029('0xd')][_0xb029('0x32')]=function(_0x3bc456,_0x1a6cfc){this['rpc'][_0xb029('0x32')](_0x3bc456)[_0xb029('0x10')](function(_0x584b8a){_0x1a6cfc(null,_0x584b8a);})[_0xb029('0x11')](function(_0x13b4ec){_0x1a6cfc(_0x13b4ec);});};AGIVertices[_0xb029('0xd')]['createSquareDetailsReport']=function(_0x100680,_0x72212c,_0x5e5b54){this['rpc'][_0xb029('0x33')]({'uniqueid':this[_0xb029('0x34')][_0xb029('0x35')],'node':_0x100680[_0xb029('0x36')],'application':_0x100680['agicommand'],'data':_0x72212c||null,'project_name':this['channel'][_0xb029('0x37')],'callerid':this['channel'][_0xb029('0x38')]})['then'](function(_0x1521dc){if(_0x5e5b54){_0x5e5b54(null,_0x1521dc);}})[_0xb029('0x11')](function(_0x9f770a){if(_0x5e5b54){_0x5e5b54(_0x9f770a);}});};AGIVertices[_0xb029('0xd')][_0xb029('0x39')]=function(_0xd1a5e9,_0x5f294b,_0x316ffd,_0x47f7f2){this['rpc'][_0xb029('0x39')]({'uniqueid':this['channel'][_0xb029('0x35')],'callerid':this['channel'][_0xb029('0x38')],'calleridname':this[_0xb029('0x34')][_0xb029('0x3a')],'context':this[_0xb029('0x34')]['context'],'extension':this[_0xb029('0x34')][_0xb029('0x3b')],'priority':this[_0xb029('0x34')][_0xb029('0x3c')],'accountcode':this[_0xb029('0x34')][_0xb029('0x3d')],'dnid':this[_0xb029('0x34')][_0xb029('0x3e')],'projectName':this[_0xb029('0x34')][_0xb029('0x37')],'saveName':_0x5f294b,'filename':_0xd1a5e9['file']||_0x5f294b,'savePath':_0x316ffd})[_0xb029('0x10')](function(_0x2345cd){_0x47f7f2(null,_0x2345cd);})[_0xb029('0x11')](function(_0x3172a2){_0x47f7f2(_0x3172a2);});};AGIVertices['prototype'][_0xb029('0x3f')]=function(_0x59acea,_0x5f6e93,_0x32236f,_0x17352c,_0xb48687){this[_0xb029('0xc')]['createSquareMessage']({'uniqueid':this['channel'][_0xb029('0x35')],'body':_0x59acea,'direction':_0x5f6e93,'providerName':_0x32236f,'providerResponse':_0x17352c})[_0xb029('0x10')](function(_0x24341f){if(_0xb48687){_0xb48687(null,_0x24341f);}})[_0xb029('0x11')](function(_0x207559){if(_0xb48687){_0xb48687(_0x207559);}});};AGIVertices[_0xb029('0xd')]['createCmContact']=function(_0x1da15c,_0x1b584d){this[_0xb029('0xc')]['createCmContact']({'firstName':_['isEmpty'](_0x1da15c[_0xb029('0x1c')])||_['isNil'](_0x1da15c[_0xb029('0x1c')])?_0xb029('0x40')+Math[_0xb029('0x41')]():_0x1da15c['name'],'lastName':_[_0xb029('0x42')](_0x1da15c[_0xb029('0x43')])||_['isNil'](_0x1da15c[_0xb029('0x43')])?null:_0x1da15c[_0xb029('0x43')],'phone':_0x1da15c[_0xb029('0x44')],'ListId':_0x1da15c['list_id'],'scheduledat':_0x1da15c[_0xb029('0x45')],'callbackUniqueid':this[_0xb029('0x34')][_0xb029('0x35')],'tags':_0xb029('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x1da15c[_0xb029('0x45')][_0xb029('0x47')](),'priority':_0x1da15c[_0xb029('0x48')]})['then'](function(_0x1b7502){_0x1b584d(null,_0x1b7502);})['catch'](function(_0x7dbf28){_0x1b584d(_0x7dbf28);});};AGIVertices[_0xb029('0xd')][_0xb029('0x49')]=function(_0x464dfc,_0x34ccda){this[_0xb029('0xc')][_0xb029('0x4a')](_0x464dfc)['then'](function(_0x4f41ad){_0x34ccda(null,_0x4f41ad?_0x4f41ad['name']:![]);})[_0xb029('0x11')](function(_0x5034f2){_0x34ccda(_0x5034f2);});};AGIVertices[_0xb029('0xd')][_0xb029('0x4b')]=function(_0x307c5d,_0x48e07b,_0x208878){var _0x894515={'role':_0xb029('0x4c')};_0x894515[_0x307c5d]=this[_0xb029('0x34')]['callerid'];this[_0xb029('0xc')][_0xb029('0x4b')](_0x894515,_0x48e07b,this[_0xb029('0x34')][_0xb029('0x35')])[_0xb029('0x10')](function(_0xa6836e){_0x208878(null,_[_0xb029('0x4d')](_0xa6836e)?![]:!![]);})[_0xb029('0x11')](function(_0x5c5903){logger[_0xb029('0x2a')](_0x5c5903);_0x208878(null,![]);});};AGIVertices[_0xb029('0xd')]['agentUnpause']=function(_0x1e1b56,_0x12af4e){var _0x1b940e={'role':_0xb029('0x4c')};_0x1b940e[_0x1e1b56]=this[_0xb029('0x34')][_0xb029('0x38')];this[_0xb029('0xc')][_0xb029('0x4e')](_0x1b940e)['then'](function(_0x2a0c04){_0x12af4e(null,_['isNil'](_0x2a0c04)?![]:!![]);})[_0xb029('0x11')](function(_0x2470ed){logger[_0xb029('0x2a')](_0x2470ed);_0x12af4e(null,![]);});};AGIVertices['prototype'][_0xb029('0x4f')]=function(_0x25fd83,_0x58ff64){var _0x5772d4={'role':_0xb029('0x4c')};_0x5772d4[_0x25fd83]=this[_0xb029('0x34')]['callerid'];this[_0xb029('0xc')]['agentLogout'](_0x5772d4)['then'](function(_0xd04b62){_0x58ff64(null,_[_0xb029('0x4d')](_0xd04b62)?![]:!![]);})[_0xb029('0x11')](function(_0x28ee6a){logger[_0xb029('0x2a')](_0x28ee6a);_0x58ff64(null,![]);});};AGIVertices[_0xb029('0xd')][_0xb029('0x50')]=function(_0x4fe301,_0x3a313e){var _0x34d2eb={'role':'agent'};_0x34d2eb[_0x4fe301]=this[_0xb029('0x34')][_0xb029('0x38')];var _0x214715=_0x4fe301!='internal'?util[_0xb029('0x51')](_0xb029('0x52'),'LOCAL',this[_0xb029('0x34')][_0xb029('0x38')]):undefined;this['rpc'][_0xb029('0x50')](_0x34d2eb,_0x214715)[_0xb029('0x10')](function(_0x1be4a9){_0x3a313e(null,_[_0xb029('0x4d')](_0x1be4a9)?![]:!![]);})[_0xb029('0x11')](function(_0x5822f4){logger[_0xb029('0x2a')](_0x5822f4);_0x3a313e(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x42584e,_0x24ac4c){sh[_0xb029('0x53')](_['trim'](_0x42584e),function(_0x44c05f,_0x4327db){var _0x5eaac6=_0x4327db['replace'](/(\r\n|\n|\r)/gm,'');_0x24ac4c(null,_0x5eaac6);});};AGIVertices[_0xb029('0xd')]['googleCloudTTS']=function(_0x3592ad,_0x4bf4a4){scripts['googleCloudTTS'](_0x3592ad[_0xb029('0x54')],_0x3592ad['google_cloud_tts_text_type']||_0xb029('0x55'),_0x3592ad[_0xb029('0x55')],_0x3592ad[_0xb029('0x56')]||_0xb029('0x57'),_0x3592ad[_0xb029('0x58')]||_0xb029('0x59'),_0x3592ad[_0xb029('0x5a')]||_0xb029('0x5b'))[_0xb029('0x10')](function(_0x4cdc1d){_0x4bf4a4(null,_0x4cdc1d);})[_0xb029('0x11')](function(_0x39fc55){_0x4bf4a4(_0x39fc55);});};AGIVertices[_0xb029('0xd')][_0xb029('0x5c')]=function(_0x1a6346,_0x417b25){scripts[_0xb029('0x5c')](_0x1a6346[_0xb029('0x55')],_0x1a6346[_0xb029('0x5d')]||'en',0x1)['then'](function(_0xc22e2e){_0x417b25(null,_0xc22e2e);})[_0xb029('0x11')](function(_0x217d00){_0x417b25(_0x217d00);});};AGIVertices['prototype'][_0xb029('0x5e')]=function(_0x32985b,_0x14a0f3){var _0x3bb758={'uri':_0x32985b[_0xb029('0x5f')],'method':_0x32985b[_0xb029('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x32985b[_0xb029('0x61')])==='number'&&parseInt(_0x32985b[_0xb029('0x61')])>=0x1?parseInt(_0x32985b['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xb029('0x62')]([_0xb029('0x63'),'PUT'],_0x3bb758[_0xb029('0x60')]['toUpperCase']())){try{_0x3bb758['body']=_0x32985b[_0xb029('0xa')]?JSON[_0xb029('0x64')](_0x32985b[_0xb029('0xa')]):{};}catch(_0x10fa3d){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x10fa3d);}}try{_0x3bb758[_0xb029('0x65')]=_0x32985b['rawHeaders']?JSON[_0xb029('0x64')](_0x32985b[_0xb029('0x9')]):{};}catch(_0x3270c6){logger[_0xb029('0x2a')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3270c6);}if(_0x32985b[_0xb029('0x66')]){try{var _0x5849c9=require(_0x32985b['computedVariables'])[_0xb029('0x67')](this,_0x3bb758);_0x3bb758[_0xb029('0x68')]=Mustache[_0xb029('0x69')](_0x32985b[_0xb029('0x5f')],_0x5849c9,{},['$$','$$']);if(_0x3bb758['headers']){_0x3bb758['headers']=JSON[_0xb029('0x64')](Mustache[_0xb029('0x69')](JSON[_0xb029('0x6a')](_0x3bb758[_0xb029('0x65')]),_0x5849c9,{},['$$','$$']));}if(_0x3bb758[_0xb029('0x6b')]){_0x3bb758['body']=JSON[_0xb029('0x64')](Mustache[_0xb029('0x69')](JSON['stringify'](_0x3bb758[_0xb029('0x6b')]),_0x5849c9,{},['$$','$$']));}}catch(_0x2e840b){logger[_0xb029('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2e840b);}}rp(_0x3bb758)[_0xb029('0x10')](function(_0x311409){var _0x49eb95={'statusCode':_0x311409[_0xb029('0x6c')]||0xc8,'statusMessage':_0x311409[_0xb029('0x6d')]||'OK','headers':_0x311409[_0xb029('0x65')]||{},'body':_0x311409[_0xb029('0x6b')]||{}};_0x14a0f3(null,_0x49eb95);})[_0xb029('0x11')](function(_0x20048e){var _0x4f5fcc={'statusCode':_0x20048e['statusCode']||0x1f4,'statusMessage':_0x20048e[_0xb029('0x6e')]||_0xb029('0x6f'),'headers':_0x20048e[_0xb029('0x70')][_0xb029('0x65')]||{},'body':_0x20048e['options'][_0xb029('0x6b')]||{}};_0x14a0f3(null,_0x4f5fcc);});};AGIVertices[_0xb029('0xd')][_0xb029('0x71')]=function(_0x398fa5,_0x590d0f){scripts[_0xb029('0x71')](this[_0xb029('0x34')][_0xb029('0x35')],_0x398fa5['key'],_0x398fa5[_0xb029('0x55')],_0x398fa5[_0xb029('0x72')]||'en')[_0xb029('0x10')](function(_0x43e3b3){_0x590d0f(null,_0x43e3b3);})[_0xb029('0x11')](function(_0x28641b){_0x590d0f(_0x28641b);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x50c6ce,_0x2f31ef){scripts[_0xb029('0x73')](this[_0xb029('0x34')]['uniqueid'],_0x50c6ce[_0xb029('0x74')],_0x50c6ce[_0xb029('0x75')],_0x50c6ce[_0xb029('0x76')],_0x50c6ce['text'],_0x50c6ce[_0xb029('0x77')]||'en')[_0xb029('0x10')](function(_0x1d811c){_0x2f31ef(null,_0x1d811c);})[_0xb029('0x11')](function(_0x5f2d37){_0x2f31ef(_0x5f2d37);});};AGIVertices['prototype'][_0xb029('0x78')]=function(_0x4950d,_0xcc41b3){scripts[_0xb029('0x78')](this['channel'],_0x4950d)[_0xb029('0x10')](function(_0x3c5f8c){_0xcc41b3(null,_0x3c5f8c);})[_0xb029('0x11')](function(_0x39cc2b){_0xcc41b3(_0x39cc2b);});};AGIVertices['prototype']['ispeechTTS']=function(_0x32bba6,_0x590e0f){scripts[_0xb029('0x79')](_0x32bba6[_0xb029('0x7a')],_0x32bba6[_0xb029('0x55')],_0x32bba6[_0xb029('0x7b')]||_0xb029('0x57'),_0x32bba6[_0xb029('0x7c')])[_0xb029('0x10')](function(_0x3cfc44){_0x590e0f(null,_0x3cfc44);})[_0xb029('0x11')](function(_0x35aafe){_0x590e0f(_0x35aafe);});};AGIVertices[_0xb029('0xd')][_0xb029('0x7d')]=function(_0x54d108,_0x1ddefc,_0xc7838c){scripts[_0xb029('0x7d')](_0x1ddefc,_0x54d108[_0xb029('0x7a')],_0x54d108[_0xb029('0x7e')]||_0xb029('0x57'),this['isConfigured'](_0x54d108[_0xb029('0x7f')])?_0x54d108['model']:undefined)[_0xb029('0x10')](function(_0x5bcfbb){_0xc7838c(null,_0x5bcfbb);})[_0xb029('0x11')](function(_0x4e26a3){_0xc7838c(_0x4e26a3);});};AGIVertices['prototype'][_0xb029('0x80')]=function(_0x168220,_0x4f9520){scripts['awsPolly'](_0x168220[_0xb029('0x81')],_0x168220[_0xb029('0x82')],_0x168220['aws_polly_region'],_0x168220['aws_polly_voice']||_0xb029('0x83'),_0x168220['text'],_0x168220[_0xb029('0x84')]||_0xb029('0x55'))[_0xb029('0x10')](function(_0x491c1d){_0x4f9520(null,_0x491c1d);})[_0xb029('0x11')](function(_0x3617f0){_0x4f9520(_0x3617f0);});};AGIVertices['prototype'][_0xb029('0x85')]=function(_0x13b2eb,_0xf830d6){scripts[_0xb029('0x85')](this[_0xb029('0x34')]['uniqueid'],_0x13b2eb[_0xb029('0x81')],_0x13b2eb[_0xb029('0x82')],_0x13b2eb[_0xb029('0x86')],_0x13b2eb[_0xb029('0x55')],_0x13b2eb[_0xb029('0x87')])[_0xb029('0x10')](function(_0x205523){_0xf830d6(null,_0x205523);})['catch'](function(_0x2f49a6){_0xf830d6(_0x2f49a6);});};AGIVertices[_0xb029('0xd')]['googleASR']=function(_0x1eb8e5,_0xb22d1e,_0x25238e){scripts[_0xb029('0x88')](_0xb22d1e,_0x1eb8e5[_0xb029('0x7a')],_0x1eb8e5[_0xb029('0x89')]||'en-US')[_0xb029('0x10')](function(_0x10c101){_0x25238e(null,_0x10c101);})[_0xb029('0x11')](function(_0x160f40){_0x25238e(_0x160f40);});};AGIVertices[_0xb029('0xd')][_0xb029('0x8a')]=function(_0x165085,_0x4c99ed,_0x39b5dd){scripts[_0xb029('0x8a')](_0x4c99ed,_0x165085[_0xb029('0x8b')],_0x165085[_0xb029('0x8c')],_0x165085[_0xb029('0x68')])['then'](function(_0x49b03e){_0x39b5dd(null,_0x49b03e);})[_0xb029('0x11')](function(_0x2343ca){_0x39b5dd(_0x2343ca);});};AGIVertices[_0xb029('0xd')][_0xb029('0x8d')]=function(_0x2beeec){var _0x3b2807=_[_0xb029('0x62')](verticesWithRetry,_0x2beeec['agicommand'])?_0x2beeec:_[_0xb029('0x8e')](_0x2beeec);for(var _0x3534a2 in _0x3b2807){if(_0x3b2807[_0xb029('0x8f')](_0x3534a2)){if(_0x3b2807[_0x3534a2]&&_[_0xb029('0x90')](_0x3b2807[_0x3534a2])){if(_[_0xb029('0x62')](recursiveMapAttributes,_0x3534a2)){_0x3b2807[_0x3534a2]=this[_0xb029('0x91')](_0x3b2807[_0x3534a2]);}else{_0x3b2807[_0x3534a2]=this[_0xb029('0x92')](_0x3b2807[_0x3534a2]);}}}}return _0x3b2807;};AGIVertices[_0xb029('0xd')][_0xb029('0x93')]=function(_0x248a72){for(var _0x27e8be in _0x248a72){if(_0x248a72['hasOwnProperty'](_0x27e8be)){if(_[_0xb029('0x94')](_0x248a72[_0x27e8be])){this[_0xb029('0x93')](_0x248a72[_0x27e8be]);}else if(_[_0xb029('0x95')](_0x248a72[_0x27e8be])){for(var _0x208514=0x0;_0x208514<_0x248a72[_0x27e8be][_0xb029('0x96')];_0x208514++){this[_0xb029('0x93')](_0x248a72[_0x27e8be][_0x208514]);}}else if(_[_0xb029('0x90')](_0x248a72[_0x27e8be])){_0x248a72[_0x27e8be]=this['replaceAllVariables'](_0x248a72[_0x27e8be]);}}}};AGIVertices[_0xb029('0xd')][_0xb029('0x97')]=function(_0x3532c5,_0x1e40ba){for(var _0x26d122 in _0x3532c5){if(_0x3532c5[_0xb029('0x8f')](_0x26d122)){if(_[_0xb029('0x94')](_0x3532c5[_0x26d122])){if(!_[_0xb029('0x42')](_0x3532c5[_0x26d122])){this[_0xb029('0x97')](_0x3532c5[_0x26d122],util[_0xb029('0x51')](_0xb029('0x98'),_0x1e40ba,_0x26d122));}}else if(_[_0xb029('0x95')](_0x3532c5[_0x26d122])){for(var _0x16c999=0x0;_0x16c999<_0x3532c5[_0x26d122][_0xb029('0x96')];_0x16c999++){this[_0xb029('0x97')](_0x3532c5[_0x26d122][_0x16c999],util[_0xb029('0x51')](_0xb029('0x98'),_0x1e40ba,_0x26d122+'['+_0x16c999+']'));}}else{if(!_[_0xb029('0x4d')](_0x3532c5[_0x26d122])){this[_0xb029('0x34')]['setVariable'](util[_0xb029('0x51')](_0xb029('0x98'),_0x1e40ba,_0x26d122),_0x3532c5[_0x26d122]);}}}}};AGIVertices[_0xb029('0xd')][_0xb029('0x91')]=function(_0x2550da){try{var _0x32895b=JSON[_0xb029('0x64')](_0x2550da);this[_0xb029('0x93')](_0x32895b);return JSON[_0xb029('0x6a')](_0x32895b);}catch(_0x33dcf8){return this[_0xb029('0x92')](_0x2550da);}};AGIVertices[_0xb029('0xd')][_0xb029('0x92')]=function(_0x4a2473){var _0x4133f5=_0x4a2473[_0xb029('0x99')]('{');for(var _0x21edda=0x1;_0x21edda<_0x4133f5[_0xb029('0x96')];_0x21edda+=0x1){var _0xb82034=_0x4133f5[_0x21edda][_0xb029('0x99')]('}');if(_0xb82034[_0xb029('0x96')]>0x1){_0x4a2473=_0x4a2473[_0xb029('0x9a')]('{'+_0xb82034[0x0]+'}',this[_0xb029('0x34')][_0xb029('0xe')](_0xb82034[0x0])[_0xb029('0x9b')]||_0xb82034[0x0]);}}if(_0x4133f5[_0xb029('0x96')]===0x1){return _0x4a2473[_0xb029('0x47')]();}return this[_0xb029('0x92')](_0x4a2473);};AGIVertices[_0xb029('0xd')]['getAndSetVariable']=function(_0x5efb43,_0x19581b){var _0x97076f=this['channel'][_0xb029('0xe')](_0x5efb43);if(_0x97076f[_0xb029('0x9c')]===-0x1){return _0x97076f;}logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x9d'),_0x19581b,_0x97076f['extra']));return this[_0xb029('0x34')][_0xb029('0x9e')](_0x19581b,_0x97076f[_0xb029('0x9b')]);};AGIVertices[_0xb029('0xd')]['isConfigured']=function(_0x26f20b){return _0x26f20b&&_0x26f20b!=='0'&&_0x26f20b!=='-1'&&_0x26f20b!=='';};AGIVertices['prototype']['maxRetry']=function(_0x11a40c){this['createSquareDetailsReport'][_0xb029('0x67')](this,_0x11a40c,'-');_0x11a40c[_0xb029('0x9f')]=_0x11a40c[_0xb029('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x2407de){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xa1'),_0x2407de[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x2407de[_0xb029('0x55')])){return this['channel'][_0xb029('0xa3')](_0xb029('0xa4'));}var _0x33c19c='\x22'+_0x2407de[_0xb029('0x55')]+'\x22';if(this['isConfigured'](_0x2407de[_0xb029('0x70')])){_0x33c19c+=','+_0x2407de[_0xb029('0x70')];}var _0x276374=this[_0xb029('0x34')][_0xb029('0x53')](_0xb029('0xa5'),_0x33c19c);if(_0x276374[_0xb029('0x9c')]===-0x1){return _0x276374;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xa6'),_0x33c19c));};AGIVertices[_0xb029('0xd')][_0xb029('0xa7')]=function(_0x26ede7){logger[_0xb029('0x2c')](util['format'](_0xb029('0xa8'),_0x26ede7['label']));if(!this[_0xb029('0xa2')](_0x26ede7[_0xb029('0xa9')])){return this[_0xb029('0x34')]['noop'](_0xb029('0xaa'));}var _0x227bab=_0x26ede7[_0xb029('0xa9')];if(this[_0xb029('0xa2')](_0x26ede7[_0xb029('0x70')])){_0x227bab+=','+_0x26ede7[_0xb029('0x70')];}var _0x6806b0=this['channel']['exec'](_0xb029('0xab'),_0x227bab);if(_0x6806b0['result']===-0x1){return _0x6806b0;}var _0x58f9b7=this['getAndSetVariable'](_0xb029('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x58f9b7[_0xb029('0x9c')]===-0x1){return _0x58f9b7;}var _0x251470=this[_0xb029('0xad')](_0xb029('0xae'),_0xb029('0xaf'));if(_0x251470[_0xb029('0x9c')]===-0x1){return _0x251470;}var _0x14c180=this[_0xb029('0xad')](_0xb029('0xb0'),_0xb029('0xb1'));if(_0x14c180[_0xb029('0x9c')]===-0x1){return _0x14c180;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xb2'),_0x227bab));};AGIVertices['prototype']['agi']=function(_0x49e166){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x49e166[_0xb029('0x36')]));return this['channel'][_0xb029('0xb3')]([_0x49e166[_0xb029('0xb4')],_0x49e166[_0xb029('0xb5')]]);};AGIVertices[_0xb029('0xd')][_0xb029('0xb6')]=function(_0x19dcf7){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xb7'),_0x19dcf7[_0xb029('0x36')]));if(this['isConfigured'](_0x19dcf7[_0xb029('0x61')])){logger[_0xb029('0x2c')](util['format'](_0xb029('0xb8'),_0x19dcf7[_0xb029('0x61')]));var _0x441ceb=this[_0xb029('0x34')][_0xb029('0xb9')](_0x19dcf7['timeout']);if(_0x441ceb[_0xb029('0x9c')]===-0x1){return _0x441ceb;}}return this['channel']['answer']();};AGIVertices[_0xb029('0xd')]['callback']=function(_0x45c5f7){logger['info'](util[_0xb029('0x51')](_0xb029('0xba'),_0x45c5f7[_0xb029('0x36')]));if(!this['isConfigured'](_0x45c5f7[_0xb029('0xbb')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x45c5f7,'no\x20list\x20selected');}_0x45c5f7[_0xb029('0x45')]=moment();if(this[_0xb029('0xa2')](_0x45c5f7[_0xb029('0xbc')])){_0x45c5f7[_0xb029('0x45')]=moment()[_0xb029('0xbd')](_0x45c5f7[_0xb029('0xbc')],'minutes');}if(!this[_0xb029('0xa2')](_0x45c5f7['callback_priority'])){_0x45c5f7[_0xb029('0x48')]=0x2;}this[_0xb029('0xbe')][_0xb029('0x67')](this,_0x45c5f7);return this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0xbf'),_0x45c5f7[_0xb029('0x44')],_0x45c5f7[_0xb029('0xbb')],_0x45c5f7['scheduledAt']));};AGIVertices['prototype']['custom_app']=function(_0x4a5446){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xc0'),_0x4a5446[_0xb029('0x36')]));var _0x1ff336=this[_0xb029('0x34')][_0xb029('0x53')](_0x4a5446[_0xb029('0xc1')],_0x4a5446[_0xb029('0x70')]);if(_0x1ff336[_0xb029('0x9c')]===-0x1){return _0x1ff336;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xc2'),_0x4a5446[_0xb029('0xc1')],_0x4a5446[_0xb029('0x70')]));};AGIVertices['prototype'][_0xb029('0xc3')]=function(_0x195941){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x195941[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x195941[_0xb029('0x55')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xa4'));}var _0x5eb0f8='\x22'+_0x195941['text']+'\x22';if(this[_0xb029('0xa2')](_0x195941[_0xb029('0x70')])){_0x5eb0f8+=','+_0x195941['options'];}var _0x33fc88=this[_0xb029('0x34')][_0xb029('0x53')](_0xb029('0xa5'),_0x5eb0f8);if(_0x33fc88['result']===-0x1){return _0x33fc88;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xa6'),_0x5eb0f8));};AGIVertices[_0xb029('0xd')][_0xb029('0xc4')]=function(_0x3e27fb){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xc5'),_0x3e27fb[_0xb029('0x36')]));if(!this['isConfigured'](_0x3e27fb[_0xb029('0x55')])){return this[_0xb029('0x34')]['noop'](_0xb029('0xa4'));}var _0x18aca2='\x22'+_0x3e27fb[_0xb029('0x55')]+'\x22';if(this['isConfigured'](_0x3e27fb[_0xb029('0x70')])){_0x18aca2+=','+_0x3e27fb[_0xb029('0x70')];}var _0x551dab=this[_0xb029('0x34')]['exec'](_0xb029('0xa5'),_0x18aca2);if(_0x551dab[_0xb029('0x9c')]===-0x1){return _0x551dab;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x18aca2));};AGIVertices[_0xb029('0xd')][_0xb029('0xc6')]=function(_0x4e46a6){logger[_0xb029('0x2c')](util['format'](_0xb029('0xc7'),_0x4e46a6['label']));if(!this[_0xb029('0xa2')](_0x4e46a6[_0xb029('0xa9')])){return this[_0xb029('0x34')][_0xb029('0xa3')]('no\x20grammar\x20configured');}var _0x13ea18=_0x4e46a6[_0xb029('0xa9')];if(this['isConfigured'](_0x4e46a6[_0xb029('0x70')])){_0x13ea18+=','+_0x4e46a6[_0xb029('0x70')];}var _0x356733=this[_0xb029('0x34')][_0xb029('0x53')](_0xb029('0xab'),_0x13ea18);if(_0x356733['result']===-0x1){return _0x356733;}var _0x72a1d6=this[_0xb029('0xad')](_0xb029('0xac'),_0xb029('0xc8'));if(_0x72a1d6[_0xb029('0x9c')]===-0x1){return _0x72a1d6;}var _0x1bf4db=this[_0xb029('0xad')](_0xb029('0xae'),_0xb029('0xc9'));if(_0x1bf4db[_0xb029('0x9c')]===-0x1){return _0x1bf4db;}var _0x46ff10=this[_0xb029('0xad')]('RECOG_INSTANCE()',_0xb029('0xca'));if(_0x46ff10[_0xb029('0x9c')]===-0x1){return _0x46ff10;}return this['channel']['noop'](util['format'](_0xb029('0xb2'),_0x13ea18));};AGIVertices[_0xb029('0xd')][_0xb029('0xcb')]=function(_0x1f92d3){logger[_0xb029('0x2c')](util['format'](_0xb029('0xcc'),_0x1f92d3[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x1f92d3['grammar'])){return this['channel']['noop'](_0xb029('0xaa'));}var _0x2f40d9=_0x1f92d3[_0xb029('0xa9')];if(this['isConfigured'](_0x1f92d3['options'])){_0x2f40d9+=','+_0x1f92d3[_0xb029('0x70')];}var _0x3cc41b=this[_0xb029('0x34')]['exec']('MRCPRecog',_0x2f40d9);if(_0x3cc41b['result']===-0x1){return _0x3cc41b;}var _0x2b9b93=this[_0xb029('0xad')](_0xb029('0xac'),'SESTEK_ASR_CONFIDENCE');if(_0x2b9b93[_0xb029('0x9c')]===-0x1){return _0x2b9b93;}var _0x4848d2=this[_0xb029('0xad')](_0xb029('0xae'),_0xb029('0xcd'));if(_0x4848d2['result']===-0x1){return _0x4848d2;}var _0x1e9de6=this['getAndSetVariable'](_0xb029('0xb0'),_0xb029('0xce'));if(_0x1e9de6[_0xb029('0x9c')]===-0x1){return _0x1e9de6;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xb2'),_0x2f40d9));};AGIVertices[_0xb029('0xd')][_0xb029('0xcf')]=function(_0x216df9){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xd0'),_0x216df9[_0xb029('0x36')]));if(!this['isConfigured'](_0x216df9[_0xb029('0xd1')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x216df9,_0xb029('0xd2'));}var _0x51d103=this[_0xb029('0x16')][_0xb029('0x67')](this,_0x216df9[_0xb029('0xd1')]);if(!_0x51d103){return this[_0xb029('0x34')]['error'](_0x216df9,_0xb029('0xd3'));}if(!this[_0xb029('0xa2')](_0x216df9['query'])){return this['channel'][_0xb029('0x2a')](_0x216df9,_0xb029('0xd4'));}var _0x4b3da3=_0x216df9[_0xb029('0x2d')][_0xb029('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('query:\x20%s',_0x4b3da3));var _0x20996b=this[_0xb029('0xd6')][_0xb029('0x67')](this,_0x51d103,_0x4b3da3);this['createSquareDetailsReport'][_0xb029('0x67')](this,_0x216df9,_0x4b3da3);if(!this[_0xb029('0xa2')](_0x216df9[_0xb029('0xd7')])){return this['channel'][_0xb029('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x49fd3b=this[_0xb029('0xe')]['sync'](this,_0x216df9[_0xb029('0xd7')]);if(!_0x49fd3b){return this['channel'][_0xb029('0x2a')](_0x216df9,_0xb029('0xd8'));}var _0x1ceb3f=this;_0x20996b[_0xb029('0xd9')](function(_0x5d6a95,_0x391105){Object['keys'](_0x5d6a95)[_0xb029('0xd9')](function(_0x565653){_0x1ceb3f['channel']['setVariable'](util[_0xb029('0x51')](_0xb029('0xda'),_0x49fd3b,_0x391105,_0x565653),_0x5d6a95[_0x565653]);});});this[_0xb029('0x34')][_0xb029('0x9e')](util['format']('%s_ROWS_COUNT',_0x49fd3b),_0x20996b[_0xb029('0x96')]);return this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')](_0xb029('0xdb'),_0x49fd3b));};AGIVertices[_0xb029('0xd')]['dial']=function(_0x3d56d6){logger[_0xb029('0xdc')](util[_0xb029('0x51')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3d56d6[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x3d56d6[_0xb029('0xdd')])){return this[_0xb029('0x34')]['error'](_0x3d56d6,_0xb029('0xde'));}var _0x1df018=this[_0xb029('0xdf')]['sync'](this,_0x3d56d6['sip_id']);if(!_0x1df018){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x3d56d6,_0xb029('0xe0'));}var _0x55ce00=this[_0xb029('0x34')][_0xb029('0x53')]('DIAL',[util[_0xb029('0x51')](_0xb029('0xe1'),_0x1df018),_0x3d56d6[_0xb029('0x61')],_0x3d56d6[_0xb029('0xe2')],_0x3d56d6['url']]);if(_0x55ce00['result']===-0x1){return _0x55ce00;}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xb029('0xd')]['dialogflow']=function(_0xa394d9){logger['info'](util['format'](_0xb029('0xe3'),_0xa394d9['label']));if(!this[_0xb029('0xa2')](_0xa394d9['key'])){return this[_0xb029('0x34')][_0xb029('0xa3')]('no\x20key\x20configured');}if(!this[_0xb029('0xa2')](_0xa394d9[_0xb029('0x55')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xa4'));}this[_0xb029('0x34')][_0xb029('0xe4')]=!![];this[_0xb029('0x33')](_0xa394d9);this['createSquareMessage'](_0xa394d9[_0xb029('0x55')],'in','','');this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xe5'),_0xa394d9[_0xb029('0x55')]));var _0x36a7ad=this['googleDialogflow'][_0xb029('0x67')](this,_0xa394d9);if(_0x36a7ad){for(var _0xf677a6 in _0x36a7ad){if(_0x36a7ad[_0xb029('0x8f')](_0xf677a6)){this[_0xb029('0x34')][_0xb029('0x9e')](util[_0xb029('0x51')]('DIALOGFLOW_%s',_0xf677a6[_0xb029('0xe6')]()),_0x36a7ad[_0xf677a6]);}}this[_0xb029('0x3f')](_0x36a7ad[_0xb029('0xe7')],_0xb029('0xe8'),_0xb029('0xe9'),'');return this['channel']['noop'](util[_0xb029('0x51')]('Dialogflow\x20Result\x20%s',_0x36a7ad[_0xb029('0xe7')]));}return this[_0xb029('0x34')]['error'](_0xa394d9,_0xb029('0xea'));};AGIVertices[_0xb029('0xd')][_0xb029('0xeb')]=function(_0x232714){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xec'),_0x232714[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x232714[_0xb029('0x74')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xed'));}if(!this[_0xb029('0xa2')](_0x232714[_0xb029('0x75')])){return this[_0xb029('0x34')][_0xb029('0xa3')]('no\x20client_email\x20configured');}if(!this[_0xb029('0xa2')](_0x232714['private_key'])){return this[_0xb029('0x34')]['noop'](_0xb029('0xee'));}if(!this['isConfigured'](_0x232714[_0xb029('0x77')])){return this['channel']['noop'](_0xb029('0xef'));}if(!this[_0xb029('0xa2')](_0x232714[_0xb029('0x55')])){return this[_0xb029('0x34')]['noop']('no\x20text\x20configured');}this[_0xb029('0x34')][_0xb029('0xe4')]=!![];this[_0xb029('0x33')](_0x232714);this[_0xb029('0x3f')](_0x232714[_0xb029('0x55')],'in','','');this['channel'][_0xb029('0xa3')](util['format'](_0xb029('0xf0'),_0x232714[_0xb029('0x55')]));var _0x4f6e40=this['googleDialogflowV2'][_0xb029('0x67')](this,_0x232714);if(_0x4f6e40){for(var _0x5741c9 in _0x4f6e40){if(_0x4f6e40[_0xb029('0x8f')](_0x5741c9)){if(_0x5741c9!==_0xb029('0xf1')){this['channel']['setVariable'](util[_0xb029('0x51')](_0xb029('0xf2'),_0x5741c9[_0xb029('0xe6')]()),_0x4f6e40[_0x5741c9]);}}}this[_0xb029('0x3f')](_0x4f6e40['speech'],_0xb029('0xe8'),_0xb029('0xeb'),_0x4f6e40[_0xb029('0xf1')]);return this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0xf3'),_0x4f6e40[_0xb029('0xe7')]));}return this[_0xb029('0x34')][_0xb029('0x2a')](_0x232714,_0xb029('0xf4'));};AGIVertices['prototype'][_0xb029('0xf5')]=function(_0x5aab5c){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0xf6'),_0x5aab5c[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x5aab5c[_0xb029('0xf7')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xf8'));}if(!this[_0xb029('0xa2')](_0x5aab5c[_0xb029('0xf9')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xfa'));}if(!this[_0xb029('0xa2')](_0x5aab5c[_0xb029('0xfb')])){return this[_0xb029('0x34')][_0xb029('0xa3')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x5aab5c[_0xb029('0xfc')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xa4'));}this[_0xb029('0x34')][_0xb029('0xe4')]=!![];this[_0xb029('0x33')](_0x5aab5c);this[_0xb029('0x3f')](_0x5aab5c[_0xb029('0x55')],'in','','');this[_0xb029('0x34')]['noop'](util['format'](_0xb029('0xfd'),_0x5aab5c[_0xb029('0x55')]));var _0x29e21e=this[_0xb029('0x78')][_0xb029('0x67')](this,_0x5aab5c);if(_0x29e21e){for(var _0x567a99 in _0x29e21e){if(_0x29e21e[_0xb029('0x8f')](_0x567a99)){this[_0xb029('0x34')]['setVariable'](util[_0xb029('0x51')](_0xb029('0xfe'),_0x567a99['toUpperCase']()),_0x29e21e[_0x567a99]);}}this['createSquareMessage'](_0x29e21e[_0xb029('0xe7')],_0xb029('0xe8'),_0xb029('0xf5'),'');if(_0x29e21e[_0xb029('0xff')]){this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x100'),_0x29e21e[_0xb029('0xff')]));var _0x3ff51c=this[_0xb029('0x34')][_0xb029('0x101')](_0x29e21e[_0xb029('0xff')]);try{fs[_0xb029('0x102')](_0x29e21e['audiofile']+'.wav');}catch(_0x25d332){logger[_0xb029('0x2a')](_0x25d332);}return _0x3ff51c;}else{return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('SestekNDA\x20Result\x20%s',_0x29e21e[_0xb029('0xe7')]));}}return this[_0xb029('0x34')][_0xb029('0x2a')](_0x5aab5c,_0xb029('0x103'));};AGIVertices[_0xb029('0xd')][_0xb029('0x104')]=function(_0x5dc1eb){logger['info'](util[_0xb029('0x51')](_0xb029('0x105'),_0x5dc1eb[_0xb029('0x36')]));return this[_0xb029('0x34')]['noop'](_0xb029('0x104'));};AGIVertices['prototype'][_0xb029('0x106')]=function(_0x515e7f){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x107'),_0x515e7f['label']));var _0x18b21b='';if(_0x515e7f[_0xb029('0x108')]){if(!this[_0xb029('0xa2')](_0x515e7f[_0xb029('0x108')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x515e7f,_0xb029('0x109'));}else{var _0x2476fb=parseInt(_0x515e7f[_0xb029('0x108')],0xa);if(isNaN(_0x2476fb)){_0x18b21b=_0x515e7f[_0xb029('0x108')];}else{_0x18b21b=this['getTrunk'][_0xb029('0x67')](this,_0x515e7f[_0xb029('0x108')]);if(!_0x18b21b){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x515e7f,_0xb029('0x10a'));}}}}else if(_0x515e7f[_0xb029('0x10b')]){_0x18b21b=_0x515e7f[_0xb029('0x10b')];}else{return this[_0xb029('0x34')][_0xb029('0x2a')](_0x515e7f,_0xb029('0x109'));}var _0x26c2d5=this[_0xb029('0x34')][_0xb029('0x53')](_0xb029('0x10c'),[util[_0xb029('0x51')]('SIP/%s/%s',_0x18b21b,_0x515e7f[_0xb029('0x44')]),_0x515e7f[_0xb029('0x61')],_0x515e7f['opts'],_0x515e7f[_0xb029('0x5f')]]);if(_0x26c2d5[_0xb029('0x9c')]===-0x1){return _0x26c2d5;}return this['channel']['noop'](util[_0xb029('0x51')](_0xb029('0x10d'),'DIAL'));};AGIVertices[_0xb029('0xd')]['finally']=function(_0x27fa95){logger['info'](util[_0xb029('0x51')](_0xb029('0x10e'),_0x27fa95[_0xb029('0x36')]));return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x10f'));};AGIVertices[_0xb029('0xd')][_0xb029('0xb')]=function(_0x54e789){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x110'),_0x54e789[_0xb029('0x36')]));if(_0x54e789['retry']===0x0){return this[_0xb029('0xa0')](_0x54e789);}_0x54e789['retry']-=0x1;if(!this['isConfigured'](_0x54e789['file_id'])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x54e789,'no\x20file\x20audio\x20selected');}var _0x42874b=this['getSound'][_0xb029('0x67')](this,_0x54e789['file_id']);if(!_0x42874b){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x54e789,_0xb029('0x111'));}if(!this[_0xb029('0xa2')](_0x54e789['variable_id'])){return this['channel'][_0xb029('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1ac279=this[_0xb029('0x34')]['getData'](_0x42874b,_0x54e789[_0xb029('0x112')],_0x54e789['maxdigit']);var _0x535734=_0x1ac279[_0xb029('0x9c')]?_0x1ac279[_0xb029('0x9c')][_0xb029('0x47')]():'';logger['info'](_0xb029('0x113'),JSON['stringify'](_0x1ac279));if(_0x1ac279['result']===-0x1){this[_0xb029('0x33')][_0xb029('0x67')](this,_0x54e789,_0x535734);return _0x1ac279;}else if(_0x1ac279['extra']===_0xb029('0x61')){_0x1ac279[_0xb029('0x9c')]=_0x535734[_0xb029('0x96')]>=parseInt(_0x54e789[_0xb029('0x114')])?'x':'i';}else{_0x1ac279[_0xb029('0x9c')]=_0x535734[_0xb029('0x96')]>=parseInt(_0x54e789[_0xb029('0x114')])&&_0x535734['length']<=parseInt(_0x54e789[_0xb029('0x115')])?'x':'i';}var _0x2f4e51=this[_0xb029('0xe')][_0xb029('0x67')](this,_0x54e789[_0xb029('0xd7')]);if(!_0x2f4e51){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x54e789,_0xb029('0xd8'));}this[_0xb029('0x34')][_0xb029('0x9e')](_0x2f4e51,_0x535734);if(this[_0xb029('0xa2')](_0x54e789[_0xb029('0x116')])){var _0x4aa198=parseInt(_0x54e789[_0xb029('0x116')],0xa);var _0x1fcade=rs[_0xb029('0x117')]({'charset':'*','length':_0x4aa198});var _0x307d23=_0x535734[_0xb029('0x96')];if(_0x307d23>0x0){if(_0x307d23>_0x4aa198){this[_0xb029('0x33')][_0xb029('0x67')](this,_0x54e789,_0x54e789[_0xb029('0x118')]===_0xb029('0x119')?_0x1fcade+_0x535734[_0xb029('0x11a')](_0x4aa198):_0x535734[_0xb029('0x11a')](0x0,_0x307d23-_0x4aa198)+_0x1fcade);}else{this[_0xb029('0x33')][_0xb029('0x67')](this,_0x54e789,rs[_0xb029('0x117')]({'charset':'*','length':_0x307d23}));}}else{this[_0xb029('0x33')][_0xb029('0x67')](this,_0x54e789,'');}}else{this[_0xb029('0x33')][_0xb029('0x67')](this,_0x54e789,_0x535734);}return _0x1ac279;};AGIVertices[_0xb029('0xd')]['getsecretdigits']=function(_0x1e414f){logger[_0xb029('0x2c')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1e414f[_0xb029('0x36')]));return this[_0xb029('0xb')](_0x1e414f);};AGIVertices[_0xb029('0xd')][_0xb029('0x11b')]=function(_0x293644){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x11c'),_0x293644[_0xb029('0x36')]));this['createSquareDetailsReport'][_0xb029('0x67')](this,_0x293644,_0x293644[_0xb029('0x11d')]);return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x11e'),_0x293644[_0xb029('0x11d')]));};AGIVertices[_0xb029('0xd')][_0xb029('0x11f')]=function(_0x43dc5d){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x120'),_0x43dc5d[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x43dc5d[_0xb029('0x81')])||!this[_0xb029('0xa2')](_0x43dc5d[_0xb029('0x82')])){return this['channel']['noop'](_0xb029('0x121'));}if(!this['isConfigured'](_0x43dc5d['text'])){return this[_0xb029('0x34')]['noop'](_0xb029('0xa4'));}this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('Trying\x20aws\x20Polly\x20%s',_0x43dc5d[_0xb029('0x55')]));var _0x3907e3=this[_0xb029('0x80')][_0xb029('0x67')](this,_0x43dc5d);if(_0x3907e3){this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x122'),_0x3907e3));var _0x25195b=this[_0xb029('0x34')][_0xb029('0x101')](_0x3907e3);try{fs['unlink'](_0x3907e3+_0xb029('0x123'));}catch(_0x3d0311){logger[_0xb029('0x2a')](_0x3d0311);}return _0x25195b;}return this['channel'][_0xb029('0x2a')](_0x43dc5d,_0xb029('0x124'));};AGIVertices[_0xb029('0xd')]['awslex']=function(_0x549767){logger['info'](util[_0xb029('0x51')](_0xb029('0x125'),_0x549767[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x549767['aws_access_key_id'])||!this['isConfigured'](_0x549767[_0xb029('0x82')])){return this[_0xb029('0x34')]['noop'](_0xb029('0x121'));}if(!this[_0xb029('0xa2')](_0x549767['aws_bot_name'])){return this['channel'][_0xb029('0xa3')](_0xb029('0x126'));}if(!this[_0xb029('0xa2')](_0x549767[_0xb029('0x55')])){return this[_0xb029('0x34')]['noop'](_0xb029('0xa4'));}this[_0xb029('0x34')][_0xb029('0xe4')]=!![];this[_0xb029('0x33')](_0x549767);this[_0xb029('0x3f')](_0x549767['text'],'in','','');this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x127'),_0x549767[_0xb029('0x55')]));var _0x5f11cd=this[_0xb029('0x85')][_0xb029('0x67')](this,_0x549767);if(_0x5f11cd){for(var _0x27cc93 in _0x5f11cd){if(_0x5f11cd['hasOwnProperty'](_0x27cc93)&&_['isString'](_0x5f11cd[_0x27cc93])){this[_0xb029('0x34')]['setVariable'](util[_0xb029('0x51')](_0xb029('0x128'),_0x27cc93[_0xb029('0xe6')]()),_0x5f11cd[_0x27cc93]);}}if(_[_0xb029('0x4d')](_0x5f11cd[_0xb029('0x6e')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x129'));}else{this['createSquareMessage'](_0x5f11cd[_0xb029('0x6e')],'out',_0xb029('0x12a'),'');return this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0x12b'),_0x5f11cd['message']));}}return this['channel'][_0xb029('0x2a')](_0x549767,_0xb029('0x12c'));};AGIVertices[_0xb029('0xd')][_0xb029('0x12d')]=function(_0x299d7b){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x299d7b[_0xb029('0x36')],_0x299d7b['timeout']));if(!this[_0xb029('0xa2')](_0x299d7b[_0xb029('0x7a')])){return this[_0xb029('0x34')]['noop']('no\x20key\x20configured');}var _0x238163=_0xb029('0x12e');var _0x49e134=util['format'](_0xb029('0x12f'),FILES_PATH,rs[_0xb029('0x117')](0x4));var _0x7d8888=util[_0xb029('0x51')](_0xb029('0x98'),_0x49e134,_0x238163);var _0x2bed17=!![];if(_0x299d7b['beep']===_0xb029('0x130')){_0x2bed17=![];}var _0x41d8ff=this[_0xb029('0x34')][_0xb029('0x131')](_0x49e134,_0x238163,_0x299d7b[_0xb029('0x132')],_0x299d7b[_0xb029('0x61')],undefined,_0x2bed17);if(_0x41d8ff[_0xb029('0x9c')]!==-0x1){this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x133'),_0x7d8888));var _0x5de555=this[_0xb029('0x88')][_0xb029('0x67')](this,_0x299d7b,_0x7d8888);if(_0x5de555){for(var _0xdb21aa in _0x5de555){if(_0x5de555[_0xb029('0x8f')](_0xdb21aa)){this['channel'][_0xb029('0x9e')](util[_0xb029('0x51')](_0xb029('0x134'),_0xdb21aa[_0xb029('0xe6')]()),_0x5de555[_0xdb21aa]);}}return this['channel'][_0xb029('0xa3')](util['format'](_0xb029('0x135'),JSON['stringify'](_0x5de555)));}}return _0x41d8ff;};AGIVertices[_0xb029('0xd')][_0xb029('0x136')]=function(_0x404ad6){logger['info'](util[_0xb029('0x51')](_0xb029('0x137'),_0x404ad6[_0xb029('0x36')]));if(!this['isConfigured'](_0x404ad6[_0xb029('0x8b')])){return this[_0xb029('0x34')]['noop']('no\x20appid\x20configured');}if(!this[_0xb029('0xa2')](_0x404ad6['appsecret'])){return this[_0xb029('0x34')]['noop'](_0xb029('0x138'));}var _0x504136=_0xb029('0x12e');var _0x42bdc4=util[_0xb029('0x51')](_0xb029('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x20b3bf=util[_0xb029('0x51')](_0xb029('0x98'),_0x42bdc4,_0x504136);var _0x289557=!![];if(_0x404ad6[_0xb029('0x139')]==='NOBEEP'){_0x289557=![];}var _0x32de13=this[_0xb029('0x34')]['recordFile'](_0x42bdc4,_0x504136,_0x404ad6[_0xb029('0x132')],_0x404ad6[_0xb029('0x61')],undefined,_0x289557);if(_0x32de13[_0xb029('0x9c')]!==-0x1){this[_0xb029('0x34')][_0xb029('0xa3')](util['format']('tilde\x20%s\x20file\x20created',_0x20b3bf));var _0x4280f5=this[_0xb029('0x8a')]['sync'](this,_0x404ad6,_0x20b3bf);if(_0x4280f5){for(var _0x2c7c0d in _0x4280f5){if(_0x4280f5[_0xb029('0x8f')](_0x2c7c0d)){this[_0xb029('0x34')][_0xb029('0x9e')](util['format']('TILDE_ASR_%s',_0x2c7c0d[_0xb029('0xe6')]()),_0x4280f5[_0x2c7c0d]);}}return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x13a'),JSON[_0xb029('0x6a')](_0x4280f5)));}}return _0x32de13;};AGIVertices[_0xb029('0xd')]['gotoc']=function(_0x167b2c){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x13b'),_0x167b2c[_0xb029('0x36')]));return this['channel']['continueAt'](_0x167b2c[_0xb029('0x13c')],_0x167b2c['extension'],_0x167b2c[_0xb029('0x3c')]);};AGIVertices[_0xb029('0xd')]['gotoif']=function(_0x26b0e7){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x13d'),_0x26b0e7[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x26b0e7['condition'])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x26b0e7,_0xb029('0x13e'));}try{var _0x4e8ce4=eval(_0x26b0e7[_0xb029('0x13f')])?_0xb029('0x140'):_0xb029('0x141');this[_0xb029('0x34')][_0xb029('0xa3')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x26b0e7[_0xb029('0x13f')],_0x4e8ce4));return{'code':0xc8,'result':_0x4e8ce4};}catch(_0x51fdea){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xb029('0xd')]['gotoiftime']=function(_0x3286c7){logger[_0xb029('0x2c')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x3286c7[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x3286c7[_0xb029('0x142')])){return this['channel'][_0xb029('0x2a')](_0x3286c7,'no\x20interval\x20configured');}var _0x5d25cd=this[_0xb029('0x24')][_0xb029('0x67')](this,_0x3286c7[_0xb029('0x142')]);if(!_0x5d25cd){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x3286c7,'no\x20intervals\x20found');}for(var _0xbcd3c0=0x0;_0xbcd3c0<_0x5d25cd[_0xb029('0x96')];_0xbcd3c0+=0x1){var _0x563739=this[_0xb029('0x34')][_0xb029('0xe')](util[_0xb029('0x51')](_0xb029('0x143'),_0x5d25cd[_0xbcd3c0]));if(_0x563739['result']===-0x1){return _0x563739;}logger['info'](util[_0xb029('0x51')](_0xb029('0x144'),_0x5d25cd[_0xbcd3c0],_0x563739[_0xb029('0x9b')]));if(_0x563739['extra']===_0xb029('0x140')){logger['info'](util[_0xb029('0x51')](_0xb029('0x144'),_0x5d25cd[_0xbcd3c0],_0xb029('0x140')));this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x144'),_0x5d25cd[_0xbcd3c0],_0xb029('0x140')));return{'code':0xc8,'result':_0xb029('0x140')};}else{logger[_0xb029('0x2c')](util[_0xb029('0x51')]('IFTIME\x20%s\x20%s',_0x5d25cd[_0xbcd3c0],_0xb029('0x141')));this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x144'),_0x5d25cd[_0xbcd3c0],_0xb029('0x141')));}}return{'code':0xc8,'result':_0xb029('0x141')};};AGIVertices[_0xb029('0xd')]['hangup']=function(_0x127bcd){logger[_0xb029('0x2c')](util['format'](_0xb029('0x145'),_0x127bcd['label']));return this[_0xb029('0x34')][_0xb029('0x146')]();};AGIVertices[_0xb029('0xd')][_0xb029('0x147')]=function(_0xf92b38){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xf92b38[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0xf92b38['key'])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x148'));}var _0x166926=_0xb029('0x12e');var _0x2bcc19=util[_0xb029('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x39578f=util[_0xb029('0x51')](_0xb029('0x98'),_0x2bcc19,_0x166926);var _0x1715b5=!![];if(_0xf92b38[_0xb029('0x139')]===_0xb029('0x130')){_0x1715b5=![];}var _0x159e76=this[_0xb029('0x34')][_0xb029('0x131')](_0x2bcc19,_0x166926,_0xf92b38[_0xb029('0x132')],_0xf92b38['timeout'],undefined,_0x1715b5);if(_0x159e76['result']!==-0x1){this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0x149'),_0x39578f));var _0x2edc75=this[_0xb029('0x7d')]['sync'](this,_0xf92b38,_0x39578f);if(_0x2edc75){for(var _0x3aa759 in _0x2edc75){if(_0x2edc75['hasOwnProperty'](_0x3aa759)){this[_0xb029('0x34')]['setVariable'](util[_0xb029('0x51')]('ISPEECH_ASR_%s',_0x3aa759[_0xb029('0xe6')]()),_0x2edc75[_0x3aa759]);}}return this['channel'][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x14a'),JSON[_0xb029('0x6a')](_0x2edc75)));}}return _0x159e76;};AGIVertices[_0xb029('0xd')][_0xb029('0x14b')]=function(_0x58b68d){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x14c'),_0x58b68d[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x58b68d[_0xb029('0x7a')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x148'));}if(!this['isConfigured'](_0x58b68d['text'])){return this[_0xb029('0x34')]['noop'](_0xb029('0xa4'));}this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('Trying\x20ispeech\x20TTS\x20%s',_0x58b68d[_0xb029('0x55')]));var _0x151dc9=this['ispeechTTS'][_0xb029('0x67')](this,_0x58b68d);if(_0x151dc9){this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0x149'),_0x151dc9));var _0x21525b=this[_0xb029('0x34')][_0xb029('0x101')](_0x151dc9,_0x58b68d[_0xb029('0x132')]);try{fs['unlink'](_0x151dc9+'.wav');}catch(_0x3cb5cd){logger[_0xb029('0x2a')](_0x3cb5cd);}return _0x21525b;}return this[_0xb029('0x34')]['error'](_0x58b68d,_0xb029('0x14d'));};AGIVertices[_0xb029('0xd')][_0xb029('0x14e')]=function(_0x37025a){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x37025a[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x37025a[_0xb029('0x14f')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x37025a,_0xb029('0x150'));}logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x151'),this[_0xb029('0x34')][_0xb029('0x38')],_0x37025a['findBy']));var _0x4ea870=this[_0xb029('0x50')][_0xb029('0x67')](this,_0x37025a['findBy']);if(_0x4ea870){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb029('0x34')]['callerid'],_0x37025a[_0xb029('0x14f')]));this['channel'][_0xb029('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb029('0x38')],_0x37025a[_0xb029('0x14f')]));return{'code':0xc8,'result':_0xb029('0x152')};}else{logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x153'),this['channel']['callerid'],_0x37025a[_0xb029('0x14f')]));this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')](_0xb029('0x153'),this[_0xb029('0x34')][_0xb029('0x38')],_0x37025a[_0xb029('0x14f')]));return{'code':0xc8,'result':_0xb029('0x154')};}};AGIVertices[_0xb029('0xd')][_0xb029('0x155')]=function(_0x57f219){logger['info'](util[_0xb029('0x51')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x57f219[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x57f219[_0xb029('0x14f')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x57f219,_0xb029('0x150'));}logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x151'),this[_0xb029('0x34')]['callerid'],_0x57f219[_0xb029('0x14f')]));var _0x3c3c3f=this['agentLogout'][_0xb029('0x67')](this,_0x57f219[_0xb029('0x14f')]);if(_0x3c3c3f){logger['info'](util[_0xb029('0x51')](_0xb029('0x156'),this['channel'][_0xb029('0x38')],_0x57f219[_0xb029('0x14f')]));this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x156'),this[_0xb029('0x34')]['callerid'],_0x57f219[_0xb029('0x14f')]));return{'code':0xc8,'result':_0xb029('0x152')};}else{logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x153'),this[_0xb029('0x34')][_0xb029('0x38')],_0x57f219[_0xb029('0x14f')]));this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')](_0xb029('0x153'),this[_0xb029('0x34')][_0xb029('0x38')],_0x57f219[_0xb029('0x14f')]));return{'code':0xc8,'result':_0xb029('0x154')};}};AGIVertices['prototype'][_0xb029('0x157')]=function(_0x1ca97c){logger['info'](util[_0xb029('0x51')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1ca97c[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x1ca97c[_0xb029('0x158')])){return this[_0xb029('0x34')]['error'](_0x1ca97c,_0xb029('0x159'));}this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x15a'),_0x1ca97c[_0xb029('0x158')]));var _0x589a9f=eval(_0x1ca97c[_0xb029('0x158')]);if(!this[_0xb029('0xa2')](_0x1ca97c[_0xb029('0xd7')])){return this[_0xb029('0x34')][_0xb029('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x222baa=this[_0xb029('0xe')][_0xb029('0x67')](this,_0x1ca97c[_0xb029('0xd7')]);if(!_0x222baa){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x1ca97c,_0xb029('0xd8'));}if(_[_0xb029('0x95')](_0x589a9f)){var _0x4c15d4=this;_0x589a9f[_0xb029('0xd9')](function(_0xea0aa8,_0x1f573d){_0x4c15d4[_0xb029('0x34')][_0xb029('0x9e')](util['format'](_0xb029('0x15b'),_0x222baa,_0x1f573d),_0xea0aa8);});return this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')](_0xb029('0x15c'),_0x222baa));}else{return this[_0xb029('0x34')][_0xb029('0x9e')](_0x222baa,_0x589a9f);}};AGIVertices[_0xb029('0xd')]['menu']=function(_0x23a50c){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x15d'),_0x23a50c[_0xb029('0x36')]));if(_0x23a50c[_0xb029('0x9f')]===0x0){return this[_0xb029('0xa0')](_0x23a50c);}_0x23a50c[_0xb029('0x9f')]-=0x1;if(!this['isConfigured'](_0x23a50c[_0xb029('0x15e')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x23a50c,_0xb029('0x15f'));}var _0x3e5962=this['getSound'][_0xb029('0x67')](this,_0x23a50c[_0xb029('0x15e')]);if(!_0x3e5962){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x23a50c,_0xb029('0x111'));}var _0x5cb226=this[_0xb029('0x34')][_0xb029('0x160')](_0x3e5962,_0x23a50c[_0xb029('0x112')],_0x23a50c['digit']);var _0x5ea105=_0x5cb226['result'];if(_0x5cb226[_0xb029('0x9c')]===-0x1){this['createSquareDetailsReport'][_0xb029('0x67')](this,_0x23a50c,'-1');return _0x5cb226;}else if(_0x5cb226['extra']===_0xb029('0x61')){_0x5cb226[_0xb029('0x9c')]=_0x5cb226[_0xb029('0x9c')][_0xb029('0x96')]>0x0?_0x5cb226[_0xb029('0x9c')]:'t';}else if(_[_0xb029('0x42')](_0x5cb226[_0xb029('0x9c')])){_0x5cb226[_0xb029('0x9c')]='#';_0x5ea105='#';}if(!this[_0xb029('0xa2')](_0x23a50c[_0xb029('0xd7')])){this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x161'));}else{var _0x296522=this[_0xb029('0xe')][_0xb029('0x67')](this,_0x23a50c['variable_id']);if(!_0x296522){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x23a50c,_0xb029('0xd8'));}this['channel'][_0xb029('0x9e')](_0x296522,_0x5ea105);}this[_0xb029('0x33')][_0xb029('0x67')](this,_0x23a50c,_0x5ea105);return _0x5cb226;};AGIVertices['prototype'][_0xb029('0xa3')]=function(_0xe293e0){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xe293e0[_0xb029('0x36')]));return this[_0xb029('0x34')]['noop'](_0xe293e0[_0xb029('0x162')]||_0xe293e0[_0xb029('0x36')]);};AGIVertices[_0xb029('0xd')]['pause']=function(_0x56d3eb){logger['info'](util['format'](_0xb029('0x163'),_0x56d3eb[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x56d3eb['findBy'])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x56d3eb,'no\x20find\x20by\x20configured');}logger['info'](util[_0xb029('0x51')](_0xb029('0x151'),this[_0xb029('0x34')][_0xb029('0x38')],_0x56d3eb[_0xb029('0x14f')]));var _0x74a7ba=this['getPause']['sync'](this,_0x56d3eb[_0xb029('0x164')]);var _0x4a49df=this[_0xb029('0x4b')][_0xb029('0x67')](this,_0x56d3eb[_0xb029('0x14f')],_0x74a7ba);if(_0x4a49df){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb029('0x38')],_0x56d3eb[_0xb029('0x14f')]));this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb029('0x34')][_0xb029('0x38')],_0x56d3eb[_0xb029('0x14f')]));return{'code':0xc8,'result':_0xb029('0x152')};}else{logger[_0xb029('0x2c')](util[_0xb029('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb029('0x34')][_0xb029('0x38')],_0x56d3eb[_0xb029('0x14f')]));this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')](_0xb029('0x156'),this[_0xb029('0x34')]['callerid'],_0x56d3eb[_0xb029('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xb029('0xd')][_0xb029('0x165')]=function(_0x2c9a4e){logger['info'](util[_0xb029('0x51')](_0xb029('0x166'),_0x2c9a4e[_0xb029('0x36')]));if(!this['isConfigured'](_0x2c9a4e[_0xb029('0x15e')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x2c9a4e,_0xb029('0x15f'));}var _0x2fb256=this[_0xb029('0x1d')][_0xb029('0x67')](this,_0x2c9a4e['file_id']);if(!_0x2fb256){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x2c9a4e,_0xb029('0x111'));}var _0x3a0d3a=this['channel'][_0xb029('0x53')]('PLAYBACK',[_0x2fb256,_0x2c9a4e[_0xb029('0xe2')]]);if(_0x3a0d3a['result']===-0x1){return _0x3a0d3a;}return this['channel'][_0xb029('0xa3')](util[_0xb029('0x51')]('Executed\x20command\x20%s\x20%s',_0xb029('0x167'),_0x2fb256));};AGIVertices[_0xb029('0xd')][_0xb029('0x168')]=function(_0x3b42bb){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x169'),_0x3b42bb[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x3b42bb[_0xb029('0x16a')])){return this[_0xb029('0x34')]['error'](_0x3b42bb,'no\x20queue\x20selected');}var _0x71e927='';var _0x228381=parseInt(_0x3b42bb[_0xb029('0x16a')],0xa);if(isNaN(_0x228381)){_0x71e927=_0x3b42bb[_0xb029('0x16a')];}else{_0x71e927=this[_0xb029('0x12')][_0xb029('0x67')](this,_0x3b42bb['queue_id']);if(!_0x71e927){return this['channel']['error'](_0x3b42bb,_0xb029('0x16b'));}}var _0x2c3d5d='';if(this[_0xb029('0xa2')](_0x3b42bb['file_id'])){var _0x5f0841=this['getSound'][_0xb029('0x67')](this,_0x3b42bb[_0xb029('0x15e')]);if(_0x5f0841){_0x2c3d5d=_0x5f0841;}}this[_0xb029('0x33')]['sync'](this,_0x3b42bb,_0x71e927);if(_0x3b42bb[_0xb029('0xe2')][_0xb029('0x16c')]('x')<0x0){_0x3b42bb[_0xb029('0xe2')]+='x';}if(_0x3b42bb[_0xb029('0xe2')][_0xb029('0x16c')]('X')<0x0){_0x3b42bb[_0xb029('0xe2')]+='X';}this[_0xb029('0x34')][_0xb029('0x9e')](_0xb029('0x16d'),_0x71e927?_0x71e927[_0xb029('0x16e')]():'');var _0x32afa5=this[_0xb029('0x34')][_0xb029('0x53')](_0xb029('0x16f'),[_0x71e927,_0x3b42bb[_0xb029('0xe2')],_0x3b42bb[_0xb029('0x5f')],_0x2c3d5d,_0x3b42bb[_0xb029('0x61')],_0x3b42bb['agi'],_0x3b42bb[_0xb029('0x170')],_0x3b42bb[_0xb029('0x171')],'',_0x3b42bb[_0xb029('0x172')]]);if(_0x32afa5[_0xb029('0x9c')]===-0x1){return _0x32afa5;}return this['channel']['noop'](util[_0xb029('0x51')](_0xb029('0xc2'),'QUEUE',_0x71e927));};AGIVertices[_0xb029('0xd')]['record']=function(_0x3b07c0){logger[_0xb029('0x2c')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x3b07c0[_0xb029('0x36')]));var _0x44a67e=_0x3b07c0[_0xb029('0x173')]||'wav';var _0x1a2d68=util[_0xb029('0x51')]('%s_%s',this[_0xb029('0x34')]['uniqueid'],rs[_0xb029('0x117')](0x5));var _0xb5b524=util[_0xb029('0x51')]('%s/recordings/%s.%s',FILES_PATH,_0x1a2d68,_0x44a67e);var _0x1ae498=util['format'](_0xb029('0x12f'),FILES_PATH,_0x1a2d68);this['createSquareRecording'][_0xb029('0x67')](this,_0x3b07c0,_0x1a2d68,_0xb5b524);this[_0xb029('0x34')][_0xb029('0x9e')]('RECORDING_SAVENAME',_0x1a2d68);logger[_0xb029('0x2c')](_0xb029('0x174'),_0x1ae498,_0x44a67e,_0x3b07c0[_0xb029('0x175')],_0x3b07c0['timeout']);return this['channel'][_0xb029('0x131')](_0x1ae498,_0x44a67e,_0x3b07c0[_0xb029('0x175')],_0x3b07c0[_0xb029('0x61')],undefined,!![]);};AGIVertices[_0xb029('0xd')][_0xb029('0x176')]=function(_0x2d5b03){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x177'),_0x2d5b03[_0xb029('0x36')]));if(!this['isConfigured'](_0x2d5b03[_0xb029('0x5f')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x178'));}var _0x5ebb18=this[_0xb029('0x5e')][_0xb029('0x67')](this,_0x2d5b03);logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x179'),util[_0xb029('0x17a')](_0x5ebb18,{'showHidden':![],'depth':null})));if(!this[_0xb029('0xa2')](_0x2d5b03[_0xb029('0xd7')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x17b'));}var _0x3211d0=this[_0xb029('0xe')][_0xb029('0x67')](this,_0x2d5b03[_0xb029('0xd7')]);if(!_0x3211d0){return this['channel'][_0xb029('0x2a')](_0x2d5b03,'no\x20variable\x20found');}this[_0xb029('0x34')]['setVariable'](util[_0xb029('0x51')](_0xb029('0x17c'),_0x3211d0),_0x5ebb18[_0xb029('0x6c')]?_0x5ebb18['statusCode']:_0xb029('0x17d'));this[_0xb029('0x34')]['setVariable'](util[_0xb029('0x51')](_0xb029('0x17e'),_0x3211d0),_0x5ebb18[_0xb029('0x6d')]?_0x5ebb18[_0xb029('0x6d')]:'OK');if(_0x5ebb18['body']){try{this['saveRestApiResult'](_0x5ebb18[_0xb029('0x6b')],_0x3211d0);}catch(_0x2f9ee8){logger[_0xb029('0x2a')](util['format'](_0xb029('0x17f'),_0x3211d0));}}return this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0xdb'),_0x3211d0));};AGIVertices[_0xb029('0xd')][_0xb029('0x180')]=function(_0x6044a8){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x6044a8['label']));return this[_0xb029('0x34')]['sayDigits'](_0x6044a8[_0xb029('0x181')][_0xb029('0xd5')](/\s+/g,''),_0x6044a8[_0xb029('0x175')]);};AGIVertices['prototype'][_0xb029('0x182')]=function(_0x1ad56e){logger[_0xb029('0x2c')](util['format'](_0xb029('0x183'),_0x1ad56e[_0xb029('0x36')]));return this[_0xb029('0x34')][_0xb029('0x184')](_0x1ad56e[_0xb029('0x185')][_0xb029('0xd5')](/\s+/g,''),_0x1ad56e['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x5ad47e){logger[_0xb029('0x2c')](util['format'](_0xb029('0x186'),_0x5ad47e[_0xb029('0x36')]));return this[_0xb029('0x34')]['sayPhonetic'](_0x5ad47e[_0xb029('0x55')],_0x5ad47e['escape_digits']);};AGIVertices[_0xb029('0xd')][_0xb029('0x187')]=function(_0x22798b){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x22798b['label']));if(!this[_0xb029('0xa2')](_0x22798b['account_id'])){return this[_0xb029('0x34')]['noop'](_0xb029('0x188'));}var _0x4314ad=this[_0xb029('0x20')][_0xb029('0x67')](this,_0x22798b['account_id']);if(!_0x4314ad||!_0x4314ad[_0xb029('0x189')]){return this['channel'][_0xb029('0x2a')](_0x22798b,'no\x20mail\x20account\x20found');}var _0x5a8e4f={'from':util[_0xb029('0x51')](_0xb029('0x18a'),_0x4314ad[_0xb029('0x1c')],_0x4314ad[_0xb029('0x18b')]||_0x4314ad[_0xb029('0x189')][_0xb029('0x18c')]),'to':_0x22798b['to']||'','cc':_0x22798b['cc']||'','bcc':_0x22798b[_0xb029('0x18d')]||'','subject':_0x22798b[_0xb029('0x18e')],'html':_0x22798b['text'],'text':_0x22798b[_0xb029('0x55')]};if(this['isConfigured'](_0x22798b[_0xb029('0x18f')])){}logger[_0xb029('0xdc')](_0xb029('0x190'),JSON['stringify'](_0x5a8e4f));this[_0xb029('0x33')][_0xb029('0x67')](this,_0x22798b,_0x22798b[_0xb029('0x191')]);this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x192'),_0x4314ad[_0xb029('0x1c')]));this[_0xb029('0x22')][_0xb029('0x67')](this,_0x4314ad[_0xb029('0x193')],_0x5a8e4f);return this[_0xb029('0x34')]['noop'](_0xb029('0x194'));};AGIVertices['prototype'][_0xb029('0x195')]=function(_0x17d91e){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x17d91e['label']));return this['channel']['noop'](_0xb029('0x196'));};AGIVertices[_0xb029('0xd')][_0xb029('0x197')]=function(_0x19cbc6){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x198'),_0x19cbc6[_0xb029('0x36')]));if(!this['isConfigured'](_0x19cbc6[_0xb029('0x199')])){return this['channel'][_0xb029('0xa3')](_0xb029('0x19a'));}var _0xeb00b4=this[_0xb029('0x31')][_0xb029('0x67')](this,_0x19cbc6[_0xb029('0x199')]);if(!_0xeb00b4){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x19cbc6,_0xb029('0x19b'));}var _0x4038f7={'body':_0x19cbc6[_0xb029('0x19c')],'phone':_0x19cbc6['to']||'','SmsAccountId':_0xeb00b4['id']};logger[_0xb029('0xdc')](_0xb029('0x19d'),JSON[_0xb029('0x6a')](_0x4038f7));this[_0xb029('0x33')][_0xb029('0x67')](this,_0x19cbc6,_0x19cbc6[_0xb029('0x199')]);this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x19e'),_0xeb00b4[_0xb029('0x1c')]));this[_0xb029('0x32')][_0xb029('0x67')](this,_0x4038f7);return this[_0xb029('0x34')][_0xb029('0xa3')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x3e41e8){logger[_0xb029('0x2c')](util['format'](_0xb029('0x19f'),_0x3e41e8[_0xb029('0x36')]));if(!this['isConfigured'](_0x3e41e8[_0xb029('0xd7')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x3e41e8,_0xb029('0x1a0'));}var _0x1a8ef4=this[_0xb029('0xe')][_0xb029('0x67')](this,_0x3e41e8[_0xb029('0xd7')]);if(!_0x1a8ef4){return this['channel'][_0xb029('0x2a')](_0x3e41e8,'no\x20variable\x20found');}return this[_0xb029('0x34')][_0xb029('0x9e')](_0x1a8ef4,_0x3e41e8[_0xb029('0x1a1')]);};AGIVertices[_0xb029('0xd')][_0xb029('0x1a2')]=function(_0x295131){logger[_0xb029('0x2c')](util['format'](_0xb029('0x1a3'),_0x295131[_0xb029('0x36')]));this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x1a4'));var _0x5881c3=this[_0xb029('0x34')][_0xb029('0xe')](_0xb029('0x1a5'));if(!_['isEmpty'](_0x5881c3[_0xb029('0x9b')])){this[_0xb029('0x34')][_0xb029('0x35')]=_0x5881c3['extra'];}if(_0x295131['answer']===_0xb029('0x1a6')){this[_0xb029('0x34')][_0xb029('0xa3')]('Answer');return this[_0xb029('0x34')][_0xb029('0xb6')]();}return this[_0xb029('0x34')]['noop'](_0xb029('0x1a7'));};AGIVertices[_0xb029('0xd')][_0xb029('0x1a8')]=function(_0x5bb7dc){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x1a9'),_0x5bb7dc[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x5bb7dc[_0xb029('0x1aa')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x5bb7dc,_0xb029('0x1ab'));}var _0x55d3f7=this[_0xb029('0x14')][_0xb029('0x67')](this,_0x5bb7dc[_0xb029('0x1aa')]);if(!this['isConfigured'](_0x55d3f7)){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x5bb7dc,util[_0xb029('0x51')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5bb7dc[_0xb029('0x1aa')]));}if(_0x55d3f7===this['channel']['arg_1']){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x5bb7dc,_0xb029('0x1ac'));}this['createSquareDetailsReport'][_0xb029('0x67')](this,_0x5bb7dc,_0x55d3f7);var _0x41d5fd=this[_0xb029('0x34')]['exec'](_0xb029('0x1ad'),util[_0xb029('0x51')](_0xb029('0x1ae'),config[_0xb029('0xb3')]['host']||_0xb029('0x1af'),_0x55d3f7,this[_0xb029('0x34')][_0xb029('0x37')]));if(_0x41d5fd[_0xb029('0x9c')]===-0x1){return _0x41d5fd;}return this['channel'][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0xc2'),_0xb029('0x1ad'),_0x55d3f7));};AGIVertices['prototype'][_0xb029('0x1b0')]=function(_0x1b95a3){logger[_0xb029('0x2c')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1b95a3[_0xb029('0x36')]));var _0x1bc0a2=this[_0xb029('0x1b1')][_0xb029('0x67')](this,_0x1b95a3[_0xb029('0xb4')]);this['createSquareDetailsReport'][_0xb029('0x67')](this,_0x1b95a3,_0x1b95a3[_0xb029('0xb4')]);if(this[_0xb029('0xa2')](_0x1b95a3['variable_id'])){var _0x41bd6c=this[_0xb029('0xe')]['sync'](this,_0x1b95a3[_0xb029('0xd7')]);if(_0x41bd6c){this[_0xb029('0x34')][_0xb029('0x9e')](_0x41bd6c,_0x1bc0a2);return this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x1b2'),_0x1b95a3[_0xb029('0xb4')],_0x41bd6c));}}return this['channel'][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x1b3'),_0x1b95a3['command']));};AGIVertices['prototype'][_0xb029('0x1b4')]=function(_0x4f61a9){logger[_0xb029('0x2c')](util[_0xb029('0x51')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x4f61a9[_0xb029('0x36')]));_0x4f61a9[_0xb029('0x55')]=_0x4f61a9[_0xb029('0x55')][_0xb029('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb029('0xa2')](_0x4f61a9[_0xb029('0x54')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0x1b5'));}if(!this[_0xb029('0xa2')](_0x4f61a9['text'])){return this[_0xb029('0x34')][_0xb029('0xa3')]('no\x20text\x20configured');}this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x1b6'),_0x4f61a9[_0xb029('0x55')]));var _0x50ffb3=this['googleCloudTTS'][_0xb029('0x67')](this,_0x4f61a9);if(_0x50ffb3){this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')](_0xb029('0x1b7'),_0x50ffb3));var _0x4f4640=this[_0xb029('0x34')]['streamFile'](_0x50ffb3);try{fs[_0xb029('0x102')](_0x50ffb3+_0xb029('0x123'));}catch(_0x1304f0){logger[_0xb029('0x2a')](_0x1304f0);}return _0x4f4640;}return this[_0xb029('0x34')]['error'](_0x4f61a9,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb029('0xd')][_0xb029('0x1b8')]=function(_0x20709f){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x1b9'),_0x20709f[_0xb029('0x36')]));_0x20709f[_0xb029('0x55')]=_0x20709f[_0xb029('0x55')][_0xb029('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb029('0xa2')](_0x20709f[_0xb029('0x55')])){return this[_0xb029('0x34')][_0xb029('0xa3')](_0xb029('0xa4'));}this[_0xb029('0x34')][_0xb029('0xa3')](util['format'](_0xb029('0x1ba'),_0x20709f['text']));var _0x38430f=this[_0xb029('0x5c')][_0xb029('0x67')](this,_0x20709f);if(_0x38430f){this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x1bb'),_0x38430f));var _0x82940f=this[_0xb029('0x34')][_0xb029('0x101')](_0x38430f);try{fs['unlink'](_0x38430f+_0xb029('0x123'));}catch(_0x427580){logger[_0xb029('0x2a')](_0x427580);}return _0x82940f;}return this[_0xb029('0x34')][_0xb029('0x2a')](_0x20709f,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb029('0xd')]['unpause']=function(_0x210be3){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x1bc'),_0x210be3['label']));if(!this['isConfigured'](_0x210be3[_0xb029('0x14f')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x210be3,_0xb029('0x150'));}logger['info'](util[_0xb029('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb029('0x34')]['callerid'],_0x210be3[_0xb029('0x14f')]));var _0x3019ca=this['agentUnpause'][_0xb029('0x67')](this,_0x210be3[_0xb029('0x14f')]);if(_0x3019ca){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x156'),this[_0xb029('0x34')][_0xb029('0x38')],_0x210be3[_0xb029('0x14f')]));this[_0xb029('0x34')][_0xb029('0xa3')](util[_0xb029('0x51')](_0xb029('0x156'),this[_0xb029('0x34')][_0xb029('0x38')],_0x210be3[_0xb029('0x14f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb029('0x51')](_0xb029('0x153'),this[_0xb029('0x34')]['callerid'],_0x210be3['findBy']));this['channel'][_0xb029('0xa3')](util['format'](_0xb029('0x153'),this[_0xb029('0x34')][_0xb029('0x38')],_0x210be3['findBy']));return{'code':0xc8,'result':_0xb029('0x154')};}};AGIVertices['prototype'][_0xb029('0x1bd')]=function(_0x5e32a4){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x1be'),_0x5e32a4[_0xb029('0x36')]));var _0x18433e=this[_0xb029('0x34')]['exec'](_0xb029('0x1bf'),[_0x5e32a4[_0xb029('0x1c0')],_0x5e32a4[_0xb029('0x70')]]);if(_0x18433e['result']===-0x1){return _0x18433e;}return this[_0xb029('0x34')]['noop'](util[_0xb029('0x51')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x5e32a4['mailbox']));};AGIVertices[_0xb029('0xd')][_0xb029('0x1c1')]=function(_0x56bdec){logger[_0xb029('0x2c')](util[_0xb029('0x51')](_0xb029('0x1c2'),_0x56bdec[_0xb029('0x36')]));if(!this[_0xb029('0xa2')](_0x56bdec[_0xb029('0xd7')])){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x56bdec,'no\x20variable\x20selected');}var _0x4bda4c=this[_0xb029('0xe')][_0xb029('0x67')](this,_0x56bdec['variable_id']);if(!_0x4bda4c){return this[_0xb029('0x34')][_0xb029('0x2a')](_0x56bdec,'no\x20variable\x20found');}var _0x5a7a35=this['channel']['getVariable'](_0x4bda4c);return{'code':0xc8,'result':_0x5a7a35[_0xb029('0x9b')]?_0x5a7a35[_0xb029('0x9b')]:'-'};};String[_0xb029('0xd')]['replaceAll']=function(_0x21a981,_0x4ec0b0){return this[_0xb029('0x99')](_0x21a981)[_0xb029('0x1c3')](_0x4ec0b0);};module['exports']=AGIVertices; \ No newline at end of file +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 diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8de773c..4225863 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 _0xba18=['mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','updateAcw','lastPauseAt','timer','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','prototype','startAcw','interface','queue','ACW'];(function(_0x40dfea,_0x5bbbb9){var _0x4b1a97=function(_0x3de1d0){while(--_0x3de1d0){_0x40dfea['push'](_0x40dfea['shift']());}};_0x4b1a97(++_0x5bbbb9);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var moment=require(_0x8ba1('0x1'));var ami=require(_0x8ba1('0x2'));var logger=require(_0x8ba1('0x3'))(_0x8ba1('0x4'));var RpcUser=require(_0x8ba1('0x5'));var RpcVoiceAgentReport=require(_0x8ba1('0x6'));function Acw(_0x3b5254){this['voiceQueues']=_0x3b5254[_0x8ba1('0x7')];this[_0x8ba1('0x8')]=_0x3b5254[_0x8ba1('0x8')];this[_0x8ba1('0x9')]=_0x3b5254[_0x8ba1('0x9')];this[_0x8ba1('0xa')]={};ami['on']('agentconnect',this[_0x8ba1('0xb')][_0x8ba1('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest']['bind'](this));ami['on'](_0x8ba1('0xd'),this[_0x8ba1('0xe')]['bind'](this));ami['on'](_0x8ba1('0xf'),this[_0x8ba1('0x10')][_0x8ba1('0xc')](this));ami['on'](_0x8ba1('0x11'),this[_0x8ba1('0x12')]['bind'](this));ami['on'](_0x8ba1('0x13'),this[_0x8ba1('0x14')][_0x8ba1('0xc')](this));ami['on'](_0x8ba1('0x15'),this[_0x8ba1('0x16')][_0x8ba1('0xc')](this));}function getDiff(_0x58e32b){var _0x108541=moment()[_0x8ba1('0x17')](0x0);var _0x2e81d1=moment(_0x58e32b)[_0x8ba1('0x17')](0x0);return _0x108541['diff'](_0x2e81d1,'seconds');}Acw['prototype'][_0x8ba1('0x18')]=function(_0x398f40,_0x5a3a8a){var _0x1b885b=this;var _0xc72b8d=getDiff(_0x1b885b[_0x8ba1('0x9')][_0x398f40][_0x8ba1('0x19')]);clearTimeout(_0x1b885b[_0x8ba1('0x9')][_0x398f40][_0x8ba1('0x1a')]);_0x1b885b[_0x8ba1('0x9')][_0x398f40]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0xc72b8d},_0x1b885b[_0x8ba1('0x9')][_0x398f40][_0x8ba1('0x1b')],_0x398f40)['then'](function(_0xd8bda0){logger[_0x8ba1('0x1c')](_0x8ba1('0x1d'),_0x5a3a8a,_0xc72b8d,_0xd8bda0);})[_0x8ba1('0x1e')](function(_0x1dc1b4){logger[_0x8ba1('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x5a3a8a,_0x1dc1b4);})[_0x8ba1('0x20')](function(){delete _0x1b885b['timers'][_0x398f40];});};Acw[_0x8ba1('0x21')][_0x8ba1('0x22')]=function(_0x121cc4){try{var _0x3dd1d8=this;var _0x4e66e1=this[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x23')];var _0x3e1e64=this[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x24')];var _0x3b70ea=this[_0x8ba1('0x7')][_0x3e1e64];var _0x1c51ef=![];var _0x273e67=_0x8ba1('0x25');if(_0x3b70ea[_0x8ba1('0x26')]&&_0x3b70ea['mandatoryDispositionPause']['name']){_0x1c51ef=!![];_0x273e67=_0x3b70ea[_0x8ba1('0x27')][_0x8ba1('0x28')];}if(!_0x3dd1d8['agents'][_0x4e66e1]){return Promise[_0x8ba1('0x29')]();}return RpcUser[_0x8ba1('0x2a')](_0x3dd1d8[_0x8ba1('0x8')][_0x4e66e1]['id'])[_0x8ba1('0x2b')](function(_0x15e419){if(!_0x15e419||_0x15e419[_0x8ba1('0x2c')]){logger[_0x8ba1('0x1c')](_0x8ba1('0x2d'),_0x121cc4,_0x4e66e1,_0x3e1e64);return;}logger[_0x8ba1('0x1c')](_0x8ba1('0x2e'),_0x121cc4,_0x4e66e1,_0x3e1e64);var _0x3e8e6d=_0x3dd1d8[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x2f')]&&_0x3dd1d8[_0x8ba1('0xa')][_0x121cc4]['destlinkedid']?_0x3dd1d8[_0x8ba1('0xa')][_0x121cc4][_0x8ba1('0x30')]:_0x121cc4;return RpcUser[_0x8ba1('0x31')](_0x3dd1d8[_0x8ba1('0x8')][_0x4e66e1],_0x273e67,_0x3e8e6d);})[_0x8ba1('0x2b')](function(_0x24bf95){if(_0x1c51ef||!_0x24bf95){return;}_0x3dd1d8['timers'][_0x4e66e1]={};logger[_0x8ba1('0x1c')](_0x8ba1('0x32'),_0x121cc4,_0x3dd1d8['voiceQueues'][_0x3e1e64][_0x8ba1('0x33')],_0x4e66e1,_0x3e1e64);_0x3dd1d8['timers'][_0x4e66e1][_0x8ba1('0x1a')]=setTimeout(_0x3dd1d8[_0x8ba1('0x34')]['bind'](_0x3dd1d8,_0x4e66e1),_0x3dd1d8[_0x8ba1('0x7')][_0x3e1e64][_0x8ba1('0x33')]*0x3e8);_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x19')]=moment()[_0x8ba1('0x35')]('YYYY-MM-DD\x20HH:mm:ss');_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x1b')]=_0x121cc4;_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x24')]=_0x3e1e64;_0x3dd1d8[_0x8ba1('0x9')][_0x4e66e1][_0x8ba1('0x18')]=_0x3dd1d8[_0x8ba1('0x18')][_0x8ba1('0xc')](_0x3dd1d8,_0x4e66e1,_0x121cc4);})['catch'](function(){logger[_0x8ba1('0x1f')](_0x8ba1('0x32'),_0x121cc4,_0x3dd1d8[_0x8ba1('0x7')][_0x3e1e64][_0x8ba1('0x33')],_0x4e66e1,_0x3e1e64);})[_0x8ba1('0x20')](function(){delete _0x3dd1d8[_0x8ba1('0xa')][_0x121cc4];});}catch(_0x215656){logger[_0x8ba1('0x1f')](_0x8ba1('0x36'),_0x215656[_0x8ba1('0x37')]);}};Acw['prototype'][_0x8ba1('0x34')]=function(_0x22cbd1){try{var _0x146104=this;if(_0x146104[_0x8ba1('0x9')][_0x22cbd1]){_0x146104[_0x8ba1('0x9')][_0x22cbd1][_0x8ba1('0x1a')]=![];var _0x3034aa=_0x146104[_0x8ba1('0x9')][_0x22cbd1][_0x8ba1('0x1b')];var _0x3db733=_0x146104['timers'][_0x22cbd1]['queue'];var _0x11ce52=_0x146104[_0x8ba1('0x7')][_0x3db733][_0x8ba1('0x33')];logger[_0x8ba1('0x1c')](_0x8ba1('0x38'),_0x3034aa,_0x22cbd1);RpcUser[_0x8ba1('0x39')](this[_0x8ba1('0x8')][_0x22cbd1]);RpcVoiceAgentReport[_0x8ba1('0x3a')]({'acwtime':_0x11ce52,'agentacw':!![]},_0x3034aa,_0x22cbd1)[_0x8ba1('0x2b')](function(_0x2305ff){logger[_0x8ba1('0x1c')](_0x8ba1('0x1d'),_0x3034aa,_0x11ce52,_0x2305ff);})[_0x8ba1('0x1e')](function(_0x2a4cd8){logger['error'](_0x8ba1('0x3b'),_0x3034aa,_0x2a4cd8);});}else{logger[_0x8ba1('0x1f')](_0x8ba1('0x3c'),_0x22cbd1);if(_0x146104[_0x8ba1('0x9')]){logger['info']('[ACW][TIMERS]',JSON[_0x8ba1('0x3d')](_0x146104[_0x8ba1('0x9')]));}}}catch(_0x1d1ffd){logger[_0x8ba1('0x1f')](_0x8ba1('0x3e'),_0x1d1ffd['message']);}};Acw[_0x8ba1('0x21')][_0x8ba1('0xb')]=function(_0x16bdb1){try{if(this['voiceQueues'][_0x16bdb1[_0x8ba1('0x24')]]&&(this[_0x8ba1('0x7')][_0x16bdb1[_0x8ba1('0x24')]][_0x8ba1('0x4')]||this[_0x8ba1('0x7')][_0x16bdb1[_0x8ba1('0x24')]]['mandatoryDisposition'])){if(this[_0x8ba1('0x8')][_0x16bdb1['interface']]){this[_0x8ba1('0xa')][_0x16bdb1[_0x8ba1('0x1b')]]={'queue':_0x16bdb1[_0x8ba1('0x24')],'interface':_0x16bdb1[_0x8ba1('0x23')],'destlinkedid':_0x16bdb1[_0x8ba1('0x30')]};}}}catch(_0x162d7f){logger['error'](_0x8ba1('0x3f'),_0x162d7f[_0x8ba1('0x37')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x25200b){try{if(this[_0x8ba1('0x7')][_0x25200b[_0x8ba1('0x24')]]&&(this[_0x8ba1('0x7')][_0x25200b[_0x8ba1('0x24')]][_0x8ba1('0x4')]||this[_0x8ba1('0x7')][_0x25200b[_0x8ba1('0x24')]][_0x8ba1('0x26')])){if(this[_0x8ba1('0x8')][_0x25200b[_0x8ba1('0x23')]]){this[_0x8ba1('0xa')][_0x25200b[_0x8ba1('0x1b')]]={'queue':_0x25200b['queue'],'interface':_0x25200b[_0x8ba1('0x23')]};}}}catch(_0x3bb667){logger[_0x8ba1('0x1f')](_0x8ba1('0x40'),_0x3bb667[_0x8ba1('0x37')]);}};Acw[_0x8ba1('0x21')][_0x8ba1('0x41')]=function(_0x1ff2a8){try{if(this[_0x8ba1('0xa')][_0x1ff2a8[_0x8ba1('0x1b')]]&&_[_0x8ba1('0x42')](this[_0x8ba1('0xa')][_0x1ff2a8[_0x8ba1('0x1b')]][_0x8ba1('0x2f')])){logger['info'](_0x8ba1('0x43'),_0x1ff2a8[_0x8ba1('0x1b')]);this['startAcw'](_0x1ff2a8[_0x8ba1('0x1b')]);}else if(this[_0x8ba1('0xa')][_0x1ff2a8[_0x8ba1('0x44')]]&&_[_0x8ba1('0x42')](this[_0x8ba1('0xa')][_0x1ff2a8['linkedid']]['attended'])){logger[_0x8ba1('0x1c')](_0x8ba1('0x45'),_0x1ff2a8['linkedid']);this[_0x8ba1('0x22')](_0x1ff2a8[_0x8ba1('0x44')]);}}catch(_0x391f3e){logger['error'](_0x8ba1('0x46'),_0x391f3e[_0x8ba1('0x37')]);}};Acw[_0x8ba1('0x21')]['syncHangup']=function(_0x368e59){try{if(this[_0x8ba1('0xa')][_0x368e59[_0x8ba1('0x1b')]]&&this[_0x8ba1('0xa')][_0x368e59['uniqueid']][_0x8ba1('0x2f')]){logger[_0x8ba1('0x1c')](_0x8ba1('0x47'),_0x368e59[_0x8ba1('0x1b')]);this[_0x8ba1('0x22')](_0x368e59['uniqueid']);}else if(this[_0x8ba1('0xa')][_0x368e59[_0x8ba1('0x44')]]&&this[_0x8ba1('0xa')][_0x368e59[_0x8ba1('0x44')]]['attended']){logger[_0x8ba1('0x1c')](_0x8ba1('0x48'),_0x368e59[_0x8ba1('0x44')]);this[_0x8ba1('0x22')](_0x368e59[_0x8ba1('0x44')]);}}catch(_0x13d1df){logger['error'](_0x8ba1('0x49'),_0x13d1df['message']);}};Acw['prototype'][_0x8ba1('0x12')]=function(_0x568594){try{if(!_[_0x8ba1('0x4a')](this[_0x8ba1('0xa')][_0x568594['transfereeuniqueid']])){this[_0x8ba1('0x22')](_0x568594['transfereeuniqueid']);if(this['channels'][_0x568594[_0x8ba1('0x4b')]]){this['channels'][_0x568594[_0x8ba1('0x4b')]][_0x8ba1('0x2f')]=!![];this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4c')]]=this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4b')]];delete this['channels'][_0x568594[_0x8ba1('0x4b')]];}}else if(!_['isNil'](this[_0x8ba1('0xa')][_0x568594['transfertargetuniqueid']])){this[_0x8ba1('0x22')](_0x568594['transfertargetuniqueid']);if(this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4d')]]){this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4d')]][_0x8ba1('0x2f')]=!![];this['channels'][_0x568594['transfereeuniqueid']]=this['channels'][_0x568594['origtransfereruniqueid']];delete this[_0x8ba1('0xa')][_0x568594[_0x8ba1('0x4d')]];}}}catch(_0x27b704){logger[_0x8ba1('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x27b704[_0x8ba1('0x37')]);}};Acw[_0x8ba1('0x21')][_0x8ba1('0x14')]=function(_0x21cc83){try{if(this['channels'][_0x21cc83['transfereruniqueid']]){logger['info'](_0x8ba1('0x4e'),JSON['stringify'](_0x21cc83[_0x8ba1('0x4f')]));this[_0x8ba1('0x22')](_0x21cc83[_0x8ba1('0x4f')]);}else if(this['channels'][_0x21cc83[_0x8ba1('0x50')]]){logger['info'](_0x8ba1('0x51'),JSON[_0x8ba1('0x3d')](_0x21cc83[_0x8ba1('0x50')]));this[_0x8ba1('0x22')](_0x21cc83[_0x8ba1('0x50')]);}}catch(_0x49faf1){logger[_0x8ba1('0x1f')](_0x8ba1('0x52'),_0x49faf1[_0x8ba1('0x37')]);}};Acw['prototype'][_0x8ba1('0x10')]=function(_0x24f3fa){try{if(this[_0x8ba1('0x7')][_0x24f3fa[_0x8ba1('0x24')]]&&this[_0x8ba1('0x7')][_0x24f3fa[_0x8ba1('0x24')]]['autopause']===_0x8ba1('0x53')){if(this[_0x8ba1('0x8')][_0x24f3fa['interface']]){logger[_0x8ba1('0x1c')](_0x8ba1('0x54'),_0x24f3fa[_0x8ba1('0x1b')],_0x24f3fa[_0x8ba1('0x23')],_0x24f3fa['queue']);return RpcUser[_0x8ba1('0x31')](this[_0x8ba1('0x8')][_0x24f3fa[_0x8ba1('0x23')]],_0x8ba1('0x55'),_0x24f3fa[_0x8ba1('0x1b')]);}}}catch(_0x1434bc){logger['error'](_0x8ba1('0x56'),_0x1434bc[_0x8ba1('0x37')]);}};module[_0x8ba1('0x57')]=Acw; \ No newline at end of file +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 diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 626e396..07eeb4e 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 _0x0ee8=['asterisk-manager','bluebird','util','ami','../../config/environment','asterisk','port','keepConnected','Action','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','username','actionSipShowRegistry','actionDeviceStateList','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','once','close','connect','shutdown','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch'];(function(_0x5c1c0f,_0x28fc84){var _0x17c48a=function(_0x374396){while(--_0x374396){_0x5c1c0f['push'](_0x5c1c0f['shift']());}};_0x17c48a(++_0x28fc84);}(_0x0ee8,0xba));var _0x80ee=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0ee8[_0x46698a];return _0x356db0;};'use strict';var Manager=require(_0x80ee('0x0'));var BPromise=require(_0x80ee('0x1'));var util=require(_0x80ee('0x2'));var logger=require('../../config/logger')(_0x80ee('0x3'));var config=require(_0x80ee('0x4'));var ami=new Manager(config[_0x80ee('0x5')][_0x80ee('0x6')],config[_0x80ee('0x5')]['ip'],config[_0x80ee('0x5')]['username'],config[_0x80ee('0x5')]['password'],!![]);ami[_0x80ee('0x7')]();ami[_0x80ee('0x8')]=BPromise['promisify'](ami[_0x80ee('0x9')]);function error(_0x10041f){logger[_0x80ee('0xa')](util[_0x80ee('0xb')](_0x80ee('0xc'),config[_0x80ee('0x5')]['username'],config['asterisk']['ip'],config[_0x80ee('0x5')][_0x80ee('0x6')],util['inspect'](_0x10041f,![],null)));}function close(){logger[_0x80ee('0xa')](util[_0x80ee('0xb')](_0x80ee('0xd'),config[_0x80ee('0x5')][_0x80ee('0xe')],config['asterisk']['ip'],config[_0x80ee('0x5')][_0x80ee('0x6')]));}ami[_0x80ee('0xf')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x80ee('0x10')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x80ee('0x11')});};};ami[_0x80ee('0x12')]=function(){return function(){return ami['Action']({'action':_0x80ee('0x13')});};};ami[_0x80ee('0x14')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(){logger[_0x80ee('0x15')](util[_0x80ee('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x80ee('0xe')],config[_0x80ee('0x5')]['ip'],config[_0x80ee('0x5')]['port']));ami[_0x80ee('0x16')]('error',error);ami['once'](_0x80ee('0x17'),close);}ami['on'](_0x80ee('0x18'),connect);ami['on'](_0x80ee('0x19'),function(_0x502dcf){logger[_0x80ee('0x15')](util[_0x80ee('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x80ee('0x5')][_0x80ee('0xe')],config['asterisk']['ip'],config[_0x80ee('0x5')]['port'],util[_0x80ee('0x1a')](_0x502dcf,![],null)));});ami['on'](_0x80ee('0x1b'),function(){logger[_0x80ee('0x15')](util['format'](_0x80ee('0x1c'),config[_0x80ee('0x5')]['username'],config[_0x80ee('0x5')]['ip'],config[_0x80ee('0x5')][_0x80ee('0x6')]));return Promise['resolve']()[_0x80ee('0x1d')](ami[_0x80ee('0xf')]())[_0x80ee('0x1d')](ami[_0x80ee('0x10')]())[_0x80ee('0x1d')](ami['actionSipPeerStatus']())[_0x80ee('0x1d')](ami['actionQueueSummary']())['then'](ami[_0x80ee('0x14')]())[_0x80ee('0x1e')](function(_0x2ca7c0){logger['error']('[ami.js][fullybooted]',util[_0x80ee('0x1a')](_0x2ca7c0,{'showHidden':![],'depth':null}));});});ami[_0x80ee('0x16')](_0x80ee('0xa'),error);ami[_0x80ee('0x16')]('close',close);module['exports']=ami; \ No newline at end of file +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 diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a43da20..1e8335e 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xac4a,0x13f));var _0xaac4=function(_0x473466,_0x342dc8){_0x473466=_0x473466-0x0;var _0x241195=_0xac4a[_0x473466];return _0x241195;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _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 diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 476f97e..9b29cc9 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 _0x33c0=['inUse','talking','pTalking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','undefined','sequence','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','Agent','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','assign','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','erlangAbandonmentRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','busyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','floor','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','unlockContact','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','socket.io-emitter','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','hangup','syncHangup','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\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','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','temp','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','trunks','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','isArray','length','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','push','timezones','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','syncAgentConnect','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','reason','agent','agiafterat','queue','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete]','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','voiceQueue','queueCallerAbandonCreateState','rescheduleContact','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','verifyAdditionalPhones','countabandonedretry','dialAbandonedMaxRetry','add','dialAbandonedRetryFrequency','ContactId','CampaignId','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','roundrobin','stateinterface','locked','isNil','paused','rrmemory','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','amd','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','outboundAnswerCallsDay','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','moveContactManagedDialer','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr][createHistory]','running','getQueueCampaignStatusMessage','statusMessage'];(function(_0x262bd6,_0x29af4b){var _0x820517=function(_0x406dfe){while(--_0x406dfe){_0x262bd6['push'](_0x262bd6['shift']());}};_0x820517(++_0x29af4b);}(_0x33c0,0xe3));var _0x033c=function(_0x2e04a7,_0x4a7270){_0x2e04a7=_0x2e04a7-0x0;var _0x51fc14=_0x33c0[_0x2e04a7];return _0x51fc14;};'use strict';var util=require(_0x033c('0x0'));var _=require(_0x033c('0x1'));var uuid=require(_0x033c('0x2'));var moment=require(_0x033c('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x033c('0x4'));var hopperUtils=require(_0x033c('0x5'));var ut=require(_0x033c('0x6'));var config=require(_0x033c('0x7'));var logger=require(_0x033c('0x8'))('dialer');var loggerBooked=require(_0x033c('0x8'))(_0x033c('0x9'));var loggerPredictive=require(_0x033c('0x8'))('predictive');var loggerPredictiveCalls=require(_0x033c('0x8'))(_0x033c('0xa'));var loggerSyncQueueSummary=require(_0x033c('0x8'))(_0x033c('0xb'));var ami=require(_0x033c('0xc'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x033c('0xd'))(new Redis(config[_0x033c('0xe')]));var cmHopper=require(_0x033c('0xf'));var voiceQueueRt=require(_0x033c('0x10'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x033c('0x11'));var Action=require('./models/action');var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x033c('0x12'));var QueueCallerAbandon=require(_0x033c('0x13'));var Hangup=require(_0x033c('0x14'));var ipAgi=process[_0x033c('0x15')][_0x033c('0x16')]||_0x033c('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x033c('0x18')]=function(_0x2fdc91){this[_0x033c('0x19')]=this[_0x033c('0x19')]?this[_0x033c('0x19')]['finally'](_0x2fdc91):_0x2fdc91();};function Dialer(_0x5c228a,_0x5017e2){this['sequence']=new Sequence();this[_0x033c('0x1a')]=_0x5017e2;this[_0x033c('0x1b')]=_0x5c228a[_0x033c('0x1b')];this[_0x033c('0x1c')]=_0x5c228a[_0x033c('0x1c')];this[_0x033c('0x1d')]=_0x5c228a['agents'];this['trunks']=_0x5c228a['trunks'];this[_0x033c('0x1e')]=config[_0x033c('0x1e')]||0x2;this[_0x033c('0x1f')]={};this['actions']={};this[_0x033c('0x20')]={};this[_0x033c('0x21')]={};this['optionPredictive']={};this[_0x033c('0x22')]={};this['startProgressive']={};this[_0x033c('0x23')]={};this[_0x033c('0x24')]={};this['queueBookedRR']={};this[_0x033c('0x25')]={};ami['on'](_0x033c('0x26'),this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0x033c('0x27')][_0x033c('0x28')](this));ami['on']('originateresponse',this[_0x033c('0x29')][_0x033c('0x28')](this));ami['on'](_0x033c('0x2a'),this['syncAgentComplete']['bind'](this));ami['on'](_0x033c('0x2b'),this[_0x033c('0xb')][_0x033c('0x28')](this));ami['on'](_0x033c('0x2c'),this['syncQueueSummaryComplete'][_0x033c('0x28')](this));ami['on'](_0x033c('0x2d'),this[_0x033c('0x2e')]['bind'](this));ami['on']('newexten',this[_0x033c('0x2f')][_0x033c('0x28')](this));ami['on']('varset',this[_0x033c('0x30')]['bind'](this));ami['on']('queuemember',this[_0x033c('0x31')]['bind'](this));ami['on'](_0x033c('0x32'),this[_0x033c('0x33')][_0x033c('0x28')](this));this[_0x033c('0x34')]();this[_0x033c('0x35')]();RpcSetting[_0x033c('0x36')]()[_0x033c('0x37')](function(_0x40e039){previewRecallmeReminderInterval=_0x40e039['previewRecallmeReminderInterval'];});}function isNotNull(_0x5c874e){return _0x5c874e!==null&&!_[_0x033c('0x38')](_0x5c874e);}function msgResponse(_0x275a63,_0x345b4a,_0x669846){return{'action':_0x275a63,'response':_0x345b4a,'message':_0x669846,'stack':_0x669846};}function emit(_0xa1db8b,_0x444011,_0x32af9d){io['to'](_0xa1db8b)['emit'](_0x444011,_0x32af9d);}function emitOutboundVoiceQueueSummary(_0xff45d1){if(_0xff45d1[_0x033c('0x39')]===_0x033c('0x3a')){logger[_0x033c('0x3b')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x033c('0x3c')](_0xff45d1,{'showHidden':![],'depth':null}));emit(util[_0x033c('0x3d')](_0x033c('0x3e'),_0xff45d1[_0x033c('0x3f')]),_0x033c('0x40'),_0xff45d1);}}function checkGetDataPredictive(_0x2b0c2c){if(isNotNull(_0x2b0c2c)&&!_[_0x033c('0x41')](_0x2b0c2c)){loggerPredictive[_0x033c('0x42')](_0x033c('0x43'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b0c2c[_0x033c('0x44')]);loggerPredictive[_0x033c('0x42')](_0x033c('0x45'),_0x2b0c2c[_0x033c('0x46')]);loggerPredictive[_0x033c('0x42')](_0x033c('0x47'),_0x2b0c2c['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x033c('0x42')](_0x033c('0x48'),_0x2b0c2c[_0x033c('0x49')]);loggerPredictive[_0x033c('0x42')](_0x033c('0x4a'),_0x2b0c2c['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x033c('0x42')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b0c2c['predictiveIntervalAvgTalktime']);loggerPredictive[_0x033c('0x42')](_0x033c('0x4b'));if(_0x2b0c2c[_0x033c('0x44')]>0x0){if(!_[_0x033c('0x38')](_0x2b0c2c[_0x033c('0x4c')])&&_0x2b0c2c[_0x033c('0x4c')]>0x0){return!![];}loggerPredictive[_0x033c('0x42')](_0x033c('0x4d'));if(!_[_0x033c('0x38')](_0x2b0c2c[_0x033c('0x4e')])&&_0x2b0c2c[_0x033c('0x4e')]>0x0){return!![];}loggerPredictive[_0x033c('0x42')](_0x033c('0x4f'));}else{loggerPredictive[_0x033c('0x42')](_0x033c('0x50'));}}else{loggerPredictive[_0x033c('0x42')](_0x033c('0x51'));}return![];}function mergeDataErlangB(_0x289799){return function(_0x40a48f){loggerPredictive[_0x033c('0x42')](_0x033c('0x52'));loggerPredictive[_0x033c('0x42')](_0x033c('0x53'),_0x40a48f['erlangCalls']);loggerPredictive['info'](_0x033c('0x54'),_0x40a48f['erlangCallToSecond']);loggerPredictive[_0x033c('0x42')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x40a48f['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x40a48f['erlangBusyFactor']);loggerPredictive['info'](_0x033c('0x55'),_0x40a48f['erlangAbandonmentRate']);loggerPredictive[_0x033c('0x42')](_0x033c('0x4b'));_[_0x033c('0x56')](_0x289799,_0x40a48f);};}function ifInterval(_0x19217e,_0x26a235){if(_[_0x033c('0x38')](_0x26a235)){return![];}return utils[_0x033c('0x57')](undefined,_0x26a235)<_0x19217e*0x3c;}function clearPredictiveAttributes(_0x2ef671){if(_0x2ef671[_0x033c('0x58')]){_0x2ef671[_0x033c('0x58')]=undefined;loggerPredictive['debug'](_0x2ef671['name'],_0x033c('0x59'));}if(_0x2ef671[_0x033c('0x22')]){_0x2ef671[_0x033c('0x22')]=undefined;loggerPredictive[_0x033c('0x3b')](_0x2ef671['name'],_0x033c('0x5a'));}if(_0x2ef671[_0x033c('0x5b')]){clearInterval(_0x2ef671[_0x033c('0x5b')]);_0x2ef671[_0x033c('0x5b')]=undefined;loggerPredictive[_0x033c('0x3b')](_0x2ef671[_0x033c('0x3f')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x16f355,_0x52989f){return function(_0x46fa08){loggerPredictive[_0x033c('0x5c')](_0x52989f[_0x033c('0x3f')],_0x16f355);loggerPredictive[_0x033c('0x5c')](_0x46fa08[_0x033c('0x5d')]);clearPredictiveAttributes(_0x52989f);};}function loggerCatch(_0x185626){return function(_0x224077){logger[_0x033c('0x5c')](_0x185626,util[_0x033c('0x3c')](_0x224077,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xc975f6,_0x320668,_0x4e4736){return function(_0xd66522){utils['checkContactLowerLimitOriginate'](_0x320668,_0x4e4736,0x0);_0x320668[_0x033c('0x5e')]=0x0;logger[_0x033c('0x5c')](_0xc975f6,util['inspect'](_0xd66522,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x26cb3){return function(_0x4fbeda){if(isNotNull(_0x4fbeda)&&isNotNull(_0x4fbeda[0x0])){if(_0x4fbeda[0x0][_0x033c('0x5f')]>0x0){_0x26cb3[_0x033c('0x60')]=utils[_0x033c('0x61')]['CONTACTS_RESCHEDULED'];logger[_0x033c('0x42')](_0x033c('0x62')+_0x26cb3['name'],_0x4fbeda[0x0][_0x033c('0x5f')],_0x033c('0x63'));}else{_0x26cb3[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x64')];logger['info'](_0x033c('0x65')+_0x26cb3[_0x033c('0x3f')]);}}};}function createObjHistory(_0x2d60be,_0x34e2f1,_0x4e5c83,_0x42c6c2,_0x94531b){_0x2d60be['message']=_0x4e5c83;var _0x145bde=new Action(_0x2d60be,_0x34e2f1);var _0x29cde8=new History(_0x145bde);_0x29cde8[_0x033c('0x66')]=_0x42c6c2;_0x29cde8[_0x033c('0x67')]=_0x94531b;_0x29cde8[_0x033c('0x68')]=_0x145bde[_0x033c('0x69')];return _0x29cde8;}function unlockQueueStatus(_0x2e1abd,_0x35b8c8){setTimeout(function(){if(_[_0x033c('0x38')](_0x2e1abd[_0x033c('0x6a')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x35b8c8);}_0x2e1abd[_0x033c('0x6a')]=!![];loggerBooked[_0x033c('0x42')](_0x033c('0x6b'),_0x35b8c8,JSON[_0x033c('0x6c')](_[_0x033c('0x6d')](_0x2e1abd,[_0x033c('0x3f'),_0x033c('0x6a')])));},0x1f3);}function checkInterval(_0x59ca7a){return function(){if(!isNotNull(_0x59ca7a[_0x033c('0x6e')])){_0x59ca7a[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x6f')];throw _0x59ca7a['name']+_0x033c('0x70');}if(!isNotNull(_0x59ca7a[_0x033c('0x6e')][_0x033c('0x71')])){_0x59ca7a[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x6f')];throw _0x59ca7a[_0x033c('0x3f')]+_0x033c('0x70');}if(!isNotNull(_['isEmpty'](_0x59ca7a[_0x033c('0x6e')][_0x033c('0x71')]))){_0x59ca7a[_0x033c('0x60')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x59ca7a['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x33e0fa){return function(){if(!utils[_0x033c('0x72')](_0x33e0fa)){_0x33e0fa[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x73')];throw _0x33e0fa['name']+_0x033c('0x74');}};}function emitCampaignSummary(_0x451ed1){if(utils[_0x033c('0x75')](_0x451ed1)){emit(util[_0x033c('0x3d')](_0x033c('0x76'),_0x451ed1['name']),_0x033c('0x77'),_0x451ed1);}}function loggerCatchQueueSummary(_0x1f8859,_0x35689f){return function(_0x5ec277){clearPredictiveAttributes(_0x35689f);emitCampaignSummary(_0x35689f);loggerSyncQueueSummary[_0x033c('0x3b')](_0x1f8859,util[_0x033c('0x3c')](_0x5ec277,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5f2b9d){if(_0x5f2b9d[_0x033c('0x78')]){if(_0x5f2b9d['originated']===0x0){_0x5f2b9d['sendMessageOneNotActive']=![];_0x5f2b9d[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x73')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5f2b9d[_0x033c('0x3f')],_0x033c('0x79'));}else{_0x5f2b9d[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x7a')];loggerSyncQueueSummary[_0x033c('0x3b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5f2b9d[_0x033c('0x3f')],_0x033c('0x7b'));}emitCampaignSummary(_0x5f2b9d);}}function myreject(_0x517619){return function(_0x1ff365){return _0x517619(msgResponse(_0x033c('0x7c'),_0x033c('0x7d'),JSON[_0x033c('0x6c')](_0x1ff365)));};}Dialer[_0x033c('0x7e')][_0x033c('0x7f')]=function(_0x2b08c5){return!_['isUndefined'](_0x2b08c5)&&_0x2b08c5&&!_[_0x033c('0x38')](_0x2b08c5[_0x033c('0x3f')])&&!_[_0x033c('0x38')](_0x2b08c5[_0x033c('0x80')])&&_0x2b08c5['active']&&(this[_0x033c('0x81')][util[_0x033c('0x3d')](_0x033c('0x82'),_0x2b08c5[_0x033c('0x3f')])][_0x033c('0x83')]===_0x033c('0x84')||this[_0x033c('0x81')][util[_0x033c('0x3d')]('SIP/%s',_0x2b08c5[_0x033c('0x3f')])]['status']===_0x033c('0x85'));};Dialer[_0x033c('0x7e')][_0x033c('0x86')]=function(_0x5cbfd6){var _0x159763=this;return function(){if(!_0x159763[_0x033c('0x7f')](_0x5cbfd6[_0x033c('0x87')])){if(!_0x159763['isTrunkReachable'](_0x5cbfd6['TrunkBackup'])){_0x5cbfd6['message']=utils[_0x033c('0x61')][_0x033c('0x88')];throw _0x5cbfd6['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x033c('0x7e')][_0x033c('0x89')]=function(_0xe3e992,_0x20c242,_0x17ad76,_0x28ae2f){var _0x1edc27=this;return function(){var _0x1b83ad=!![];return _0x1edc27[_0x033c('0x8a')](_0xe3e992,_0x20c242,_0x17ad76,_0x28ae2f,_0x1b83ad);};};Dialer[_0x033c('0x7e')][_0x033c('0x8b')]=function(_0x36706d,_0xe7b7b,_0x367f75,_0xc7b92a){var _0x5e4e79=this;return function(){var _0xfa4be8=![];return _0x5e4e79[_0x033c('0x8a')](_0x36706d['Intervals'],_0xe7b7b,_0x367f75,_0xc7b92a,_0xfa4be8);};};Dialer[_0x033c('0x7e')]['ifTimeIvr']=function(_0x5bc2d5,_0x5a7bfb,_0x4445c9,_0x40ba86,_0x8add83){var _0x4b9b3d=[];return new Promise(function(_0x898987,_0x1af3d4){if(!isNotNull(_0x5bc2d5)){_0x40ba86['message']=utils['CAMPAIGN_STATUS'][_0x033c('0x6f')];return _0x1af3d4(msgResponse(_0x033c('0x8c'),_0x033c('0x8d'),_0x4445c9+_0x033c('0x8e')));}if(_[_0x033c('0x41')](_0x5bc2d5)){_0x40ba86[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x8f')];return _0x1af3d4(msgResponse(_0x033c('0x8c'),_0x033c('0x8d'),_0x4445c9+_0x033c('0x90')));}if(_0x5a7bfb&&_[_0x033c('0x38')](config['timezones'][_0x5a7bfb])){_0x40ba86['message']=utils[_0x033c('0x61')][_0x033c('0x91')];return _0x1af3d4(msgResponse(_0x033c('0x8c'),_0x033c('0x8d'),_0x4445c9+'\x20Timezone\x20unknow\x20'+_0x5a7bfb));}if(_[_0x033c('0x92')](_0x5bc2d5)){for(var _0x399028=0x0;_0x399028<_0x5bc2d5[_0x033c('0x93')];_0x399028+=0x1){_0x4b9b3d['push'](ami[_0x033c('0x94')]({'action':_0x033c('0x95'),'command':util['format'](_0x033c('0x96'),_0x5bc2d5[_0x399028][_0x033c('0x97')],!_[_0x033c('0x38')](config['timezones'][_0x5a7bfb])?_0x5a7bfb:'')})[_0x033c('0x37')](function(_0x442f20){return _0x442f20[_0x033c('0x98')][_0x033c('0x99')](_0x033c('0x9a'))>=0x0;})[_0x033c('0x9b')](myreject(_0x1af3d4)));}}else{_0x4b9b3d[_0x033c('0x9c')](ami[_0x033c('0x94')]({'action':_0x033c('0x95'),'command':util[_0x033c('0x3d')](_0x033c('0x96'),_0x5bc2d5,!_[_0x033c('0x38')](config[_0x033c('0x9d')][_0x5a7bfb])?_0x5a7bfb:'')})[_0x033c('0x37')](function(_0x186fdf){return _0x186fdf[_0x033c('0x98')]['indexOf']('true')>=0x0;})[_0x033c('0x9b')](myreject(_0x1af3d4)));}Promise[_0x033c('0x9e')](_0x4b9b3d)[_0x033c('0x37')](function(_0x3fad63){var _0x5f4470=_[_0x033c('0x9f')](_0x3fad63);if(_0x5f4470){return _0x898987(_0x5f4470);}else{_0x40ba86[_0x033c('0x60')]=_0x8add83?utils[_0x033c('0x61')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x033c('0x61')]['OVERTIME_INTERVAL'];return _0x1af3d4(msgResponse(_0x033c('0xa0'),_0x033c('0x8d'),_0x033c('0xa1')+_0x8add83+'\x20'+_0x4445c9+_0x033c('0xa2')+util['inspect'](_0x5bc2d5,{'showHidden':![],'depth':null})+_0x033c('0xa3')+_0x5a7bfb));}})[_0x033c('0x9b')](function(_0x1b6584){return _0x1af3d4(msgResponse(_0x033c('0x8c'),_0x033c('0x8d'),JSON[_0x033c('0x6c')](_0x1b6584)));});});};Dialer['prototype'][_0x033c('0x34')]=function(){var _0x4fef6b=this;return cmHopper[_0x033c('0xa4')]({'active':![]},{'where':{'active':!![]}})[_0x033c('0x37')](function(){setInterval(function(){_0x4fef6b[_0x033c('0xa5')]();},0x3e8);});};Dialer[_0x033c('0x7e')]['syncCampaigns']=function(){var _0x1b39f4=this;var _0x57a4c6;for(var _0xd00d92 in this[_0x033c('0x1c')]){if(typeof this[_0x033c('0x1c')][_0xd00d92]!=='undefined'){_0x57a4c6=this[_0x033c('0x1c')][_0xd00d92];if(utils[_0x033c('0x75')](_0x57a4c6)&&utils[_0x033c('0x72')](_0x57a4c6)){_0x57a4c6[_0x033c('0x78')]=!![];Promise[_0x033c('0xa6')]()[_0x033c('0x37')](checkIsIVRCampaignActive(_0x57a4c6))[_0x033c('0x37')](checkInterval(_0x57a4c6))[_0x033c('0x37')](_0x1b39f4[_0x033c('0x86')](_0x57a4c6))[_0x033c('0x37')](_0x1b39f4[_0x033c('0x89')](_0x57a4c6[_0x033c('0xa7')],_0x57a4c6[_0x033c('0xa8')],_0x57a4c6[_0x033c('0x3f')],_0x57a4c6))['then'](_0x1b39f4[_0x033c('0x8b')](_0x57a4c6[_0x033c('0x6e')],_0x57a4c6[_0x033c('0xa8')],_0x57a4c6[_0x033c('0x3f')],_0x57a4c6))[_0x033c('0x37')](_0x1b39f4[_0x033c('0xa9')](_0x57a4c6))[_0x033c('0x9b')](loggerCatchQueueSummary(_0x033c('0xaa'),_0x57a4c6));}else{notSendMessagesCampaign(_0x57a4c6);}}}};Dialer[_0x033c('0x7e')][_0x033c('0xab')]=function(_0x2ef4c8){if(_0x2ef4c8[_0x033c('0xac')]!==_0x033c('0xad')){clearPredictiveAttributes(_0x2ef4c8);}switch(_0x2ef4c8['dialMethod']){case _0x033c('0xae'):this[_0x033c('0xaf')](_0x2ef4c8,0x1);break;case _0x033c('0xb0'):this[_0x033c('0xaf')](_0x2ef4c8,_0x2ef4c8[_0x033c('0xb1')]);break;case _0x033c('0xad'):this[_0x033c('0xad')](_0x2ef4c8);break;case'booked':this[_0x033c('0xaf')](_0x2ef4c8,0x1);break;default:logger['error'](_0x033c('0xb2'),_0x2ef4c8[_0x033c('0x3f')],_0x033c('0xb3'));}};Dialer['prototype']['ifTime']=function(_0x1d84f6,_0x59ae74){var _0x4a672a=_0x1d84f6[_0x033c('0xa8')];var _0x40f798=_0x59ae74?_0x1d84f6[_0x033c('0xa7')]:_0x1d84f6[_0x033c('0x6e')][_0x033c('0x71')];logger['silly'](_0x033c('0xb4'),_0x40f798,_0x4a672a,_0x1d84f6['name'],util['format'](_0x033c('0xb5'),_0x1d84f6[_0x033c('0x3f')],_0x1d84f6['id']));var _0x1945ff=null;return Interval['intervalIftime'](_0x40f798,_0x4a672a)[_0x033c('0x37')](function(_0x46f690){if(_0x46f690===!![]){return _0x46f690;}else{_0x1d84f6['message']=_0x59ae74?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x033c('0x61')][_0x033c('0xb6')];_0x1945ff=msgResponse(_0x033c('0xa0'),'Failure',_0x033c('0xa1')+_0x59ae74+'\x20'+_0x1d84f6[_0x033c('0x3f')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x033c('0x3c')](_0x40f798,{'showHidden':![],'depth':null})+_0x033c('0xa3')+_0x4a672a);}if(_0x1945ff!==null){logger['silly'](_0x033c('0xb7'),_0x1945ff);_0x1945ff['isGlobal']=_0x59ae74;throw _0x1945ff;}})[_0x033c('0x9b')](function(_0x4316a1){logger[_0x033c('0x5c')](_0x033c('0xb8'),_0x4316a1);throw msgResponse(_0x033c('0x7c'),'Error',util[_0x033c('0x3c')](_0x4316a1,{'showHidden':![],'depth':null}));});};Dialer[_0x033c('0x7e')][_0x033c('0xb9')]=function(_0x67a1c1){if(this[_0x033c('0x1b')][_0x67a1c1['queue']]){if(this[_0x033c('0x21')][_0x67a1c1[_0x033c('0xba')]]&&this[_0x033c('0x21')][_0x67a1c1['uniqueid']]['type']!==_0x033c('0xbb')){this[_0x033c('0xbc')](this[_0x033c('0x1b')][_0x67a1c1['queue']]);this['uniqueId'][_0x67a1c1[_0x033c('0xba')]]['answertime']=moment()[_0x033c('0x3d')](_0x033c('0xbd'));}}};Dialer['prototype'][_0x033c('0xbe')]=function(_0x402a50){var _0x849e5f=this[_0x033c('0x21')][_0x402a50[_0x033c('0xba')]];if(this[_0x033c('0x1b')][_0x402a50['queue']]){if(_0x849e5f&&_0x849e5f[_0x033c('0x39')]!==_0x033c('0xbb')){delete this[_0x033c('0x21')][_0x402a50[_0x033c('0xba')]];this[_0x033c('0x1b')][_0x402a50['queue']]['outboundAnswerCallsDay']+=0x1;var _0x40214d=new AgentComplete(_0x849e5f,_0x402a50);if(_0x402a50[_0x033c('0xbf')]===_0x033c('0xc0')){_0x40214d[_0x033c('0xc1')]=this[_0x033c('0x1b')][_0x402a50[_0x033c('0xc2')]][_0x033c('0xc3')]&&this[_0x033c('0x1b')][_0x402a50['queue']][_0x033c('0xc4')]?moment()[_0x033c('0x3d')](_0x033c('0xbd')):undefined;}hopperUtils[_0x033c('0xc5')](_0x40214d)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x40214d)[_0x033c('0x9b')](loggerCatch(_0x033c('0xc6')));}}};Dialer['prototype'][_0x033c('0x27')]=function(_0x5ed72c){var _0xea0e4a=this[_0x033c('0x21')][_0x5ed72c['uniqueid']];var _0x58b364=this;var _0x445ec2=![];var _0x525854;var _0x2699c4;if(this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]]){if(_0xea0e4a&&_0xea0e4a['type']!==_0x033c('0xbb')){delete this['uniqueId'][_0x5ed72c['uniqueid']];this[_0x033c('0xbc')](this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]]);_0xea0e4a[_0x033c('0xc7')]=moment()[_0x033c('0x3d')](_0x033c('0xbd'));var _0x1bab7d=new QueueCallerAbandon(_0xea0e4a,_0x5ed72c);if(utils['getSeconds'](_0xea0e4a[_0x033c('0xc7')],_0xea0e4a['responsetime'])>=_0xea0e4a[_0x033c('0xc8')]){this[_0x033c('0x1b')][_0x5ed72c['queue']][_0x033c('0xc9')]+=0x1;this['voiceQueues'][_0x5ed72c[_0x033c('0xc2')]][_0x033c('0xca')]+=0x1;this['voiceQueues'][_0x5ed72c[_0x033c('0xc2')]][_0x033c('0xcb')]+=0x1;_0x1bab7d[_0x033c('0x66')]=0xa;_0x1bab7d['statedesc']='Drop';_0x1bab7d[_0x033c('0xcc')]=_0x033c('0xcd');_0x1bab7d['agiafterat']=this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]]['dialQueueProject2']?moment()[_0x033c('0x3d')](_0x033c('0xbd')):undefined;_0x1bab7d[_0x033c('0xce')]+=0x1;_0x1bab7d[_0x033c('0xcf')]+=0x1;_0x525854=this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]]['dialDropRetryFrequency'];_0x2699c4=this[_0x033c('0x1b')][_0x5ed72c['queue']][_0x033c('0xd0')];hopperUtils['verifyAdditionalPhones'](_0x1bab7d,_0x1bab7d[_0x033c('0x66')],_0xea0e4a[_0x033c('0xd1')])[_0x033c('0x37')](function(_0x76b913){_0x445ec2=_0x76b913['additional']==0x1;if(_0x1bab7d[_0x033c('0xce')]>=_0x58b364[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]]['dialDropMaxRetry']){_0x58b364[_0x033c('0xd2')](_0x1bab7d,_0x76b913['additional']);}else{hopperUtils[_0x033c('0xd3')]({'active':![],'countdropretry':_0x1bab7d[_0x033c('0xce')],'scheduledat':moment()['add'](_0x58b364['voiceQueues'][_0x5ed72c[_0x033c('0xc2')]][_0x033c('0xd4')],_0x033c('0xd5'))[_0x033c('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xea0e4a['ContactId'],'ListId':_0xea0e4a[_0x033c('0xd6')],'VoiceQueueId':_0xea0e4a[_0x033c('0xd7')]||undefined,'CampaignId':_0xea0e4a['CampaignId']||undefined})['catch'](loggerCatch(_0x033c('0xd8')));var _0x12bcb8=new History(_0x1bab7d);_0x12bcb8[_0x033c('0x66')]=0xa;_0x12bcb8[_0x033c('0x67')]=_0x033c('0xd9');_0x12bcb8[_0x033c('0x69')]=moment()['format'](_0x033c('0xbd'));_0x12bcb8[_0x033c('0x68')]=_0x12bcb8['starttime'];_0x12bcb8[_0x033c('0xda')]=_0x1bab7d[_0x033c('0xda')];_0x12bcb8[_0x033c('0xdb')]=_0x1bab7d[_0x033c('0xdb')];hopperUtils[_0x033c('0xc5')](_0x12bcb8)[_0x033c('0x9b')](loggerCatch(_0x033c('0xdc')));}})[_0x033c('0x37')](function(){if(_0x445ec2)hopperUtils[_0x033c('0xdd')](_0x1bab7d,_0x525854,_0x2699c4)[_0x033c('0x37')](function(){return 0x1;});});}else{this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]][_0x033c('0x49')]+=0x1;this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]][_0x033c('0xde')]+=0x1;_0x1bab7d[_0x033c('0x66')]=0xb;_0x1bab7d[_0x033c('0x67')]=_0x033c('0xdf');_0x1bab7d[_0x033c('0xcc')]=_0x033c('0xe0');_0x1bab7d['countabandonedretry']+=0x1;_0x1bab7d[_0x033c('0xcf')]+=0x1;_0x525854=this['voiceQueues'][_0x5ed72c['queue']]['dialAbandonedRetryFrequency'];_0x2699c4=this[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x033c('0xe1')](_0x1bab7d,_0x1bab7d[_0x033c('0x66')],_0xea0e4a[_0x033c('0xd1')])[_0x033c('0x37')](function(_0x35559d){if(_0x1bab7d[_0x033c('0xe2')]>=_0x58b364[_0x033c('0x1b')][_0x5ed72c['queue']][_0x033c('0xe3')]){_0x58b364['queueCallerAbandonCreateState'](_0x1bab7d,_0x35559d['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1bab7d['countabandonedretry'],'scheduledat':moment()[_0x033c('0xe4')](_0x58b364[_0x033c('0x1b')][_0x5ed72c[_0x033c('0xc2')]][_0x033c('0xe5')],_0x033c('0xd5'))[_0x033c('0x3d')](_0x033c('0xbd')),'ContactId':_0xea0e4a[_0x033c('0xe6')],'ListId':_0xea0e4a[_0x033c('0xd6')],'VoiceQueueId':_0xea0e4a[_0x033c('0xd7')]||undefined,'CampaignId':_0xea0e4a[_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x43bb7c=new History(_0x1bab7d);_0x43bb7c[_0x033c('0x66')]=0xb;_0x43bb7c[_0x033c('0x67')]=_0x033c('0xdf');_0x43bb7c['starttime']=moment()[_0x033c('0x3d')](_0x033c('0xbd'));_0x43bb7c[_0x033c('0x68')]=_0x43bb7c[_0x033c('0x69')];_0x43bb7c[_0x033c('0xda')]=_0x1bab7d[_0x033c('0xda')];_0x43bb7c[_0x033c('0xdb')]=_0x1bab7d[_0x033c('0xdb')];hopperUtils[_0x033c('0xc5')](_0x43bb7c)[_0x033c('0x9b')](loggerCatch(_0x033c('0xe8')));}})[_0x033c('0x37')](function(){if(_0x445ec2)hopperUtils['swapAdditionalPhones'](_0x1bab7d,_0x525854,_0x2699c4)['then'](function(){return 0x1;});});}}}};Dialer[_0x033c('0x7e')][_0x033c('0x2f')]=function(_0x2f069d){if(this[_0x033c('0xe9')][_0x2f069d[_0x033c('0xba')]]){this[_0x033c('0xe9')][_0x2f069d[_0x033c('0xba')]][_0x033c('0xea')]=_0x2f069d[_0x033c('0xea')];}if(this['uniqueId'][_0x2f069d[_0x033c('0xba')]]){this[_0x033c('0x21')][_0x2f069d[_0x033c('0xba')]][_0x033c('0xea')]=_0x2f069d[_0x033c('0xea')];}};Dialer['prototype'][_0x033c('0x31')]=function(_0xcaf013){if(!this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]]){return;}var _0x276f3a=this[_0x033c('0x1b')][this['actions'][_0xcaf013[_0x033c('0xeb')]][_0x033c('0xc2')]][_0x033c('0xec')]||'rrmemory';if(_0x276f3a===_0x033c('0xed')){if(this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]]&&_['isNil'](this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]]['locked'])&&_0xcaf013[_0x033c('0x83')]==='1'&&_0xcaf013['paused']==='0'){if(this[_0x033c('0x1d')][_0xcaf013[_0x033c('0xee')]]){if(!this[_0x033c('0x1d')][_0xcaf013[_0x033c('0xee')]][_0x033c('0xef')]){this[_0x033c('0x1d')][_0xcaf013[_0x033c('0xee')]][_0x033c('0xef')]=!![];this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]][_0x033c('0xef')]=!![];this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]][_0x033c('0xee')]=_0xcaf013[_0x033c('0xee')];}}}}else if(_0x276f3a==='rrmemory'){if(this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]]){if(this[_0x033c('0x1d')][_0xcaf013[_0x033c('0xee')]]){this['actions'][_0xcaf013['actionid']][_0x033c('0xee')]=_0xcaf013[_0x033c('0xee')];if(_[_0x033c('0xf0')](this[_0x033c('0x24')][this[_0x033c('0xe9')][_0xcaf013['actionid']][_0x033c('0xc2')]])){this[_0x033c('0x24')][this['actions'][_0xcaf013['actionid']][_0x033c('0xc2')]]=[];}this['queueBooked'][this['actions'][_0xcaf013['actionid']]['queue']][_0x033c('0x9c')](_[_0x033c('0x56')](_[_0x033c('0x6d')](this[_0x033c('0xe9')][_0xcaf013[_0x033c('0xeb')]],['idHopper',_0x033c('0xee')]),{'status':_0xcaf013[_0x033c('0x83')],'paused':_0xcaf013[_0x033c('0xf1')]}));}}}};Dialer[_0x033c('0x7e')]['syncQueueStatusComplete']=function(_0x5d496c){if(!this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]]){return;}var _0x2f25af=this;var _0x56182d=this['voiceQueues'][this['actions'][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]];var _0x2218b3=_0x56182d[_0x033c('0xec')]||_0x033c('0xf2');if(_0x2218b3===_0x033c('0xed')){if(this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]]&&this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xee')]){this[_0x033c('0x1a')][_0x033c('0xf3')](this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xf4')],this['actions'][_0x5d496c[_0x033c('0xeb')]]['stateinterface'])[_0x033c('0x9b')](function(_0x574b23){logger[_0x033c('0x5c')](_0x033c('0xf5'),util['inspect'](_0x574b23,{'showHidden':![],'depth':null}));})[_0x033c('0xf6')](function(){_0x2f25af['updateOriginated'](_0x2f25af['voiceQueues'][_0x2f25af[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]);_0x2f25af['agents'][_0x2f25af['actions'][_0x5d496c['actionid']][_0x033c('0xee')]]['locked']=![];delete _0x2f25af['actions'][_0x5d496c[_0x033c('0xeb')]];unlockQueueStatus(_0x56182d);});}else{this[_0x033c('0xbc')](this[_0x033c('0x1b')][this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]);hopperUtils[_0x033c('0xd3')]({'active':![],'ContactId':this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]]['ContactId'],'ListId':this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xd6')],'VoiceQueueId':this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xd7')]||undefined,'CampaignId':this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]];unlockQueueStatus(_0x56182d);}}else if(_0x2218b3==='rrmemory'){var _0x28c61a;if(this[_0x033c('0xe9')][_0x5d496c['actionid']]&&!_[_0x033c('0x41')](this['queueBooked'][this['actions'][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]])){if(this['queueBookedRR'][_0x2f25af[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]){this[_0x033c('0xf7')][_0x2f25af[_0x033c('0xe9')][_0x5d496c['actionid']]['queue']]=this['queueBookedRR'][this['actions'][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]?this['queueBookedRR'][this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]:this[_0x033c('0x24')][this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]?this['queueBooked'][this[_0x033c('0xe9')][_0x5d496c[_0x033c('0xeb')]][_0x033c('0xc2')]]['_rr']||0x0:0x0;}this[_0x033c('0x24')][this[_0x033c('0xe9')][_0x5d496c['actionid']][_0x033c('0xc2')]]['_rr']=this['queueBookedRR'][this[_0x033c('0xe9')][_0x5d496c['actionid']][_0x033c('0xc2')]];for(var _0x3372f4=0x0;_0x3372f4=_0x1ccfa8[_0x033c('0x11f')]){_0x351fa8[_0x033c('0x120')](_0x2dce35,_0x27ce33,_0x109701,_0x033c('0x121'));}else{if(_0x2dce35[_0x033c('0x11d')]>=_0x1ccfa8[_0x033c('0x122')]){_0x351fa8['createStateFinal'](_0x2dce35,_0x27ce33,_0x109701,'reason\x2019\x20machine....');}else{hopperUtils[_0x033c('0xd3')]({'active':![],'countmachineretry':_0x2dce35[_0x033c('0x11d')],'scheduledat':moment()['add'](_0x1ccfa8[_0x033c('0x123')],_0x033c('0xd5'))[_0x033c('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2dce35['ContactId'],'ListId':_0x2dce35[_0x033c('0xd6')],'VoiceQueueId':_0x2dce35[_0x033c('0xd7')]||undefined,'CampaignId':_0x2dce35[_0x033c('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x27ce33({'reschedule':0x1});}}});}if(_0xa0ddf9['type']===_0x033c('0xbb')&&this[_0x033c('0x1c')][_0xa0ddf9['queue']][_0x033c('0x108')]&&_0x5c7232['value']===_0x033c('0x109')){delete this[_0x033c('0x21')][_0x5c7232['uniqueid']];this[_0x033c('0xbc')](this['campaigns'][_0xa0ddf9[_0x033c('0xc2')]]);_0x5e6dba=new Hangup(_0xa0ddf9,_0x5c7232);_0x5e6dba[_0x033c('0x66')]=0x12;_0x5e6dba[_0x033c('0x67')]='HangupInAMD';_0x5e6dba[_0x033c('0x10c')]=_0x033c('0x10d');ami[_0x033c('0x117')](_0x033c('0x10e'),ut[_0x033c('0x10f')](_0x5e6dba,_0x033c('0x116')));this[_0x033c('0x110')](_0x5e6dba,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0xa0ddf9['type']==='ivr'&&this[_0x033c('0x1c')][_0xa0ddf9['queue']][_0x033c('0x108')]&&_0x5c7232[_0x033c('0x113')]===_0x033c('0x114')){return new Promise(function(_0x2680dd,_0x416547){delete _0x351fa8[_0x033c('0x21')][_0x5c7232[_0x033c('0xba')]];_0x351fa8['updateOriginated'](_0x351fa8[_0x033c('0x1c')][_0xa0ddf9[_0x033c('0xc2')]]);_0x351fa8['campaigns'][_0xa0ddf9[_0x033c('0xc2')]][_0x033c('0x124')]+=0x1;_0x351fa8[_0x033c('0x1c')][_0xa0ddf9['queue']][_0x033c('0x10a')]+=0x1;var _0x474e94=_0x351fa8[_0x033c('0x1c')][_0xa0ddf9[_0x033c('0xc2')]];var _0x31ac19=new Hangup(_0xa0ddf9,_0x5c7232);_0x31ac19['state']=0x13;_0x31ac19[_0x033c('0x67')]=_0x033c('0x115');_0x31ac19[_0x033c('0x10c')]=_0x033c('0x10d');_0x31ac19['countmachineretry']+=0x1;_0x31ac19[_0x033c('0xcf')]+=0x1;_0x31ac19['amd']=!![];ami[_0x033c('0x117')](_0x033c('0x10e'),ut[_0x033c('0x10f')](_0x31ac19,'amd'));hopperUtils['createHistory'](_0x31ac19)[_0x033c('0x9b')](loggerCatch(_0x033c('0x118')));if(_0x31ac19[_0x033c('0x119')]+_0x31ac19[_0x033c('0x11a')]+_0x31ac19[_0x033c('0x11b')]+_0x31ac19[_0x033c('0x11c')]+_0x31ac19[_0x033c('0xce')]+_0x31ac19[_0x033c('0xe2')]+_0x31ac19[_0x033c('0x11d')]+_0x31ac19[_0x033c('0x11e')]>=_0x474e94[_0x033c('0x11f')]){_0x351fa8['stateGlobal'](_0x31ac19,_0x2680dd,_0x416547,_0x033c('0x121'));}else{if(_0x31ac19[_0x033c('0x11d')]>=_0x474e94['dialMachineMaxRetry']){_0x351fa8[_0x033c('0x125')](_0x31ac19,_0x2680dd,_0x416547,_0x033c('0x126'));}else{hopperUtils[_0x033c('0xd3')]({'active':![],'countmachineretry':_0x31ac19[_0x033c('0x11d')],'scheduledat':moment()[_0x033c('0xe4')](_0x474e94[_0x033c('0x123')],_0x033c('0xd5'))[_0x033c('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x31ac19[_0x033c('0xe6')],'ListId':_0x31ac19[_0x033c('0xd6')],'VoiceQueueId':_0x31ac19['VoiceQueueId']||undefined,'CampaignId':_0x31ac19['CampaignId']||undefined})[_0x033c('0x9b')](loggerCatch(_0x033c('0x127')));_0x2680dd({'reschedule':0x1});}}});}}};Dialer[_0x033c('0x7e')][_0x033c('0x2e')]=function(_0x4634f6){var _0x4f223c=this['uniqueId'][_0x4634f6[_0x033c('0xba')]];var _0x5d4da9;if(_0x4f223c&&_0x4f223c[_0x033c('0x39')]===_0x033c('0xbb')){delete this[_0x033c('0x21')][_0x4634f6[_0x033c('0xba')]];this[_0x033c('0xbc')](this['campaigns'][_0x4f223c[_0x033c('0xc2')]]);this[_0x033c('0x1c')][_0x4f223c[_0x033c('0xc2')]][_0x033c('0x128')]+=0x1;_0x5d4da9=new Hangup(_0x4f223c,_0x4634f6);hopperUtils[_0x033c('0xc5')](_0x5d4da9)[_0x033c('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x033c('0x129')](_0x5d4da9)[_0x033c('0x9b')](loggerCatch('[syncHangupIvr]'));}if(_0x4f223c&&_0x4f223c['type']!=='ivr'&&isNotNull(this[_0x033c('0x1b')][_0x4f223c[_0x033c('0xc2')]][_0x033c('0x12a')])){delete this[_0x033c('0x21')][_0x4634f6[_0x033c('0xba')]];this[_0x033c('0xbc')](this['voiceQueues'][_0x4f223c[_0x033c('0xc2')]]);this['voiceQueues'][_0x4f223c[_0x033c('0xc2')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x4f223c[_0x033c('0xc2')]][_0x033c('0x10a')]+=0x1;_0x5d4da9=new Hangup(_0x4f223c,_0x4634f6);_0x5d4da9[_0x033c('0x66')]=0x10;_0x5d4da9[_0x033c('0x67')]=_0x033c('0x12b');_0x5d4da9[_0x033c('0x10c')]=_0x033c('0x12c');hopperUtils[_0x033c('0xc5')](_0x5d4da9)[_0x033c('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x5d4da9)[_0x033c('0x9b')](loggerCatch(_0x033c('0x12d')));}if(_0x4f223c&&_0x4f223c[_0x033c('0x39')]!=='ivr'&&!isNotNull(this[_0x033c('0x1b')][_0x4f223c[_0x033c('0xc2')]]['dialQueueProject'])){delete this[_0x033c('0x21')][_0x4634f6[_0x033c('0xba')]];this[_0x033c('0xbc')](this[_0x033c('0x1b')][_0x4f223c[_0x033c('0xc2')]]);this[_0x033c('0x1b')][_0x4f223c[_0x033c('0xc2')]][_0x033c('0x12e')]+=0x1;_0x5d4da9=new Hangup(_0x4f223c,_0x4634f6);_0x5d4da9[_0x033c('0x66')]=0xc;_0x5d4da9[_0x033c('0x67')]=_0x4634f6[_0x033c('0x12f')];_0x5d4da9['membername']=_0x033c('0x130');hopperUtils[_0x033c('0xc5')](_0x5d4da9)[_0x033c('0x9b')](loggerCatch(_0x033c('0x131')));hopperUtils[_0x033c('0x129')](_0x5d4da9)[_0x033c('0x9b')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x033c('0x7e')][_0x033c('0xb')]=function(_0xf72f5d){var _0x25a093=this;if(!_0x25a093[_0x033c('0x25')][_0xf72f5d[_0x033c('0x3f')]]){_0x25a093[_0x033c('0x25')][_0xf72f5d['name']]={'running':![]};}else if(_0x25a093['queuesSummary'][_0xf72f5d[_0x033c('0x3f')]][_0x033c('0x132')]===!![]){return;}else if(_0x25a093[_0x033c('0x25')][_0xf72f5d['name']][_0x033c('0x132')]===![]){_0x25a093[_0x033c('0x25')][_0xf72f5d[_0x033c('0x3f')]][_0x033c('0x132')]=!![];}var _0x134a39=_0x25a093[_0x033c('0x1b')][_0xf72f5d['name']];var _0x3f1dc1=_0x134a39[_0x033c('0x60')]!==utils[_0x033c('0x61')][_0x033c('0x73')];var _0x1d9de4=utils['isPreviewCampaign'](_0x134a39);_0x134a39['statusMessage']=utils[_0x033c('0x133')](_0x134a39,_0x25a093[_0x033c('0x81')]);Promise[_0x033c('0xa6')]()['then'](function(){if(_0x134a39[_0x033c('0x134')]===utils[_0x033c('0x61')][_0x033c('0x73')]){if(_0x3f1dc1){clearPredictiveAttributes(_0x134a39);_0xf72f5d[_0x033c('0x22')]=undefined;_0xf72f5d[_0x033c('0x58')]=undefined;}if(_0x134a39[_0x033c('0x134')]===utils['CAMPAIGN_STATUS']['INACTIVE']){_0xf72f5d['available']=0x0;_0xf72f5d['paused']=0x0;_0xf72f5d[_0x033c('0x135')]=0x0;_0xf72f5d[_0x033c('0x136')]=0x0;_0xf72f5d[_0x033c('0x137')]=0x0;}}else if(_0x134a39[_0x033c('0x134')]===utils[_0x033c('0x61')]['ACTIVE']&&!_0x1d9de4){return _0x25a093[_0x033c('0x8c')](_0x134a39,!![])[_0x033c('0x37')](function(){return _0x25a093[_0x033c('0x8c')](_0x134a39,![]);})['then'](function(){return _0x25a093[_0x033c('0xab')](_0x134a39);})[_0x033c('0x9b')](function(_0x39fcc2){loggerSyncQueueSummary['debug'](_0x033c('0x138'),util[_0x033c('0x3c')](_0x39fcc2,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x134a39);});}else{clearPredictiveAttributes(_0x134a39);}})[_0x033c('0x37')](function(){var _0x3ec450=_0xf72f5d['compareToOutboundQueue'](_0x134a39);if(_0x3ec450||_0x134a39['queueSummaryCountersUpdated']){_0x134a39[_0x033c('0x139')]=![];_0xf72f5d[_0x033c('0x13a')](_0x134a39);Object['assign'](_0x134a39,_0xf72f5d);emitOutboundVoiceQueueSummary(_0xf72f5d);}_0x25a093[_0x033c('0x25')][_0x134a39[_0x033c('0x3f')]][_0x033c('0x132')]=![];})['catch'](function(_0x4a10c9){logger[_0x033c('0x5c')](_0x033c('0x138'),util[_0x033c('0x3c')](_0x4a10c9,{'showHidden':![],'depth':null}));_0x25a093[_0x033c('0x25')][_0x134a39[_0x033c('0x3f')]][_0x033c('0x132')]=![];});};Dialer[_0x033c('0x7e')][_0x033c('0x13b')]=_[_0x033c('0x13c')](function(){var _0x1094bc=_[_0x033c('0x13d')](this['voiceQueues'],function(_0x19d9b1){return _0x19d9b1[_0x033c('0x13e')];});var _0x40d159=_['filter'](this[_0x033c('0x1d')],function(_0x41dc85){return _0x41dc85[_0x033c('0x13f')]&&_0x41dc85['status']===_0x033c('0x84');});if(_0x1094bc[_0x033c('0x93')]>0x0&&_0x40d159[_0x033c('0x93')]>0x0){return Promise[_0x033c('0xa6')]()[_0x033c('0x37')](cmHopper[_0x033c('0x140')](_[_0x033c('0x141')](_0x1094bc,'id'),previewRecallmeReminderInterval,_['map'](_0x40d159,'id')))[_0x033c('0x37')](function(_0x3f0383){for(var _0x3d0f50=0x0;_0x3d0f50<_0x3f0383[_0x033c('0x93')];_0x3d0f50++){var _0x1ac2eb=_0x3f0383[_0x3d0f50]['Agent'][_0x033c('0x3f')];if(_0x1ac2eb)io['to'](util[_0x033c('0x3d')](_0x033c('0x142'),_0x1ac2eb))[_0x033c('0x117')](_0x033c('0x143'),{'hopper':_0x3f0383[_0x3d0f50]});}})[_0x033c('0x9b')](function(_0x181c43){logger[_0x033c('0x5c')]('checkPreviewRecallReminder',_0x181c43);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x033c('0x7e')][_0x033c('0x35')]=function(){var _0x11b2ca=this;setInterval(function(){_0x11b2ca[_0x033c('0x144')](_0x11b2ca[_0x033c('0x21')],_0x033c('0x145'));_0x11b2ca[_0x033c('0x144')](_0x11b2ca[_0x033c('0xe9')],_0x033c('0x146'));},0x32c8);};Dialer[_0x033c('0x7e')][_0x033c('0x144')]=function(_0x83c9e9,_0x6f631c){var _0x2abb0a=this;for(var _0x4446ac in _0x83c9e9){if(typeof _0x83c9e9[_0x4446ac]!==_0x033c('0x147')){this[_0x033c('0x148')][_0x033c('0x18')](function(){if(!_['isNil'](_0x83c9e9[_0x4446ac])){return ami[_0x033c('0x94')]({'action':_0x033c('0x83'),'channel':_0x83c9e9[_0x4446ac][_0x033c('0xea')]})['catch'](function(_0x44cbb6){if(_0x44cbb6[_0x033c('0x60')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x83c9e9[_0x4446ac]&&_0x83c9e9[_0x4446ac][_0x033c('0x39')]!==_0x033c('0xbb')){_0x2abb0a[_0x033c('0xbc')](_0x2abb0a[_0x033c('0x1b')][_0x83c9e9[_0x4446ac]['queue']]);logger[_0x033c('0x5c')]('[Dialer][checkChannel]',_0x6f631c,_0x4446ac,_0x83c9e9[_0x4446ac][_0x033c('0xc2')]);delete _0x83c9e9[_0x4446ac];}if(_0x83c9e9[_0x4446ac]&&_0x83c9e9[_0x4446ac][_0x033c('0x39')]==='ivr'){_0x2abb0a[_0x033c('0xbc')](_0x2abb0a[_0x033c('0x1c')][_0x83c9e9[_0x4446ac][_0x033c('0xc2')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x6f631c,_0x4446ac,_0x83c9e9[_0x4446ac][_0x033c('0xc2')]);delete _0x83c9e9[_0x4446ac];}},0x2328);}});}});}}};Dialer[_0x033c('0x7e')][_0x033c('0x149')]=function(_0x2b9f80){return Promise[_0x033c('0xa6')]()[_0x033c('0x37')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2b9f80))[_0x033c('0x9b')](loggerCatch(_0x033c('0x14a')));};Dialer[_0x033c('0x7e')][_0x033c('0xbc')]=function(_0x571e1e){if(!_['isUndefined'](_0x571e1e)&&_0x571e1e!==null){if(typeof _0x571e1e['originated']!=='undefined'){if(_0x571e1e[_0x033c('0x14b')]>0x0){_0x571e1e[_0x033c('0x14b')]-=0x1;}else{logger['error'](_0x033c('0x14c'));}}}else{logger[_0x033c('0x5c')](_0x033c('0x14d'));}};Dialer[_0x033c('0x7e')][_0x033c('0x14e')]=function(_0x2a7894,_0x3c2643){var _0x308d17=this;return function(_0x25a20b){_0x308d17['updateOriginated'](_0x3c2643);logger['error'](_0x2a7894,util[_0x033c('0x3c')](_0x25a20b,{'showHidden':![],'depth':null}));};};Dialer[_0x033c('0x7e')][_0x033c('0x14f')]=function(_0xc3a81a,_0x1ae088,_0x45ee6c){var _0x43846d={'state':0x19,'statedesc':_0x033c('0x150')};this[_0x033c('0xbc')](_0x1ae088);this['saveInDb'](_['merge'](_0x43846d,_[_0x033c('0x6d')](_0x45ee6c,[_0x033c('0xe6'),_0x033c('0xd6'),_0x033c('0x151'),_0x033c('0xd7'),_0x033c('0xe7')])),_0x033c('0x152'),_0x033c('0x153'));logger[_0x033c('0x5c')](_0xc3a81a);};Dialer[_0x033c('0x7e')][_0x033c('0x110')]=function(_0x36650a,_0x46f4f9,_0x3e9d52){hopperUtils[_0x033c('0xc5')](_0x36650a)[_0x033c('0x9b')](loggerCatch(_0x46f4f9));hopperUtils[_0x033c('0x129')](_0x36650a)[_0x033c('0x9b')](loggerCatch(_0x3e9d52));};Dialer[_0x033c('0x7e')][_0x033c('0xd2')]=function(_0x51fd51,_0x3cac4e){hopperUtils[_0x033c('0xc5')](_0x51fd51)[_0x033c('0x9b')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3cac4e==0x0){hopperUtils[_0x033c('0x129')](_0x51fd51)['catch'](loggerCatch(_0x033c('0x154')));}};Dialer['prototype'][_0x033c('0x155')]=function(_0xcfba8){return Promise[_0x033c('0xa6')]()[_0x033c('0x37')](cmHopper[_0x033c('0x140')](_0xcfba8['id'],previewRecallmeReminderInterval))['then'](function(_0x53d749){for(var _0xa3a52c=0x0;_0xa3a52c<_0x53d749['length'];_0xa3a52c++){var _0x3378f7=_0x53d749[_0xa3a52c][_0x033c('0x156')][_0x033c('0x3f')];if(_0x3378f7)io['to'](util[_0x033c('0x3d')](_0x033c('0x142'),_0x3378f7))[_0x033c('0x117')](_0x033c('0x143'),{'hopper':_0x53d749[_0xa3a52c]});}})[_0x033c('0x9b')](function(){});};Dialer['prototype'][_0x033c('0xa9')]=function(_0xf85355){var _0x2a37c0=this;return function(){_0x2a37c0['handleIvr'](_0xf85355);};};Dialer['prototype']['actionOriginate']=function(_0x5ae609,_0x55354b){var _0xe81398=this;var _0x14ab9b=uuid['v4']();this[_0x033c('0xe9')][_0x14ab9b]=new Action(_0x5ae609,_0x55354b,_0x14ab9b);return new Promise(function(_0x5496af,_0x48e209){if(_[_0x033c('0x38')](_0x5ae609)&&typeof _0x5ae609!==_0x033c('0x157')){return _0x48e209(msgResponse('originate','Failure',_0x033c('0x158')));}if(_[_0x033c('0x38')](_0x55354b['phone'])||_0x55354b[_0x033c('0x159')]===null){return _0x48e209(msgResponse(_0x033c('0x15a'),'Failure',_0x033c('0x15b')));}var _0x514393={'XMD-CALLERID':_0xe81398[_0x033c('0xe9')][_0x14ab9b][_0x033c('0x15c')](),'XMD-AGI':_0x5ae609[_0x033c('0x12a')]?util[_0x033c('0x3d')](_0x033c('0x15d'),ipAgi,_0x5ae609[_0x033c('0x12a')]):_0x033c('0x15e'),'XMD-AGIAFTER':_0x5ae609[_0x033c('0xc3')]?util['format'](_0x033c('0x15d'),ipAgi,_0x5ae609[_0x033c('0xc3')]):_0x033c('0x15e'),'XMD-QUEUE':utils[_0x033c('0x15f')](_0x5ae609)?util[_0x033c('0x3d')](_0x033c('0x160'),_0x5ae609[_0x033c('0x3f')],_0x5ae609[_0x033c('0x161')]||'',_0x5ae609[_0x033c('0xc4')]?'c':'',_0x5ae609[_0x033c('0xc8')]||0x3):_0x033c('0x15e'),'XMD-CONTACTID':_0x55354b[_0x033c('0xe6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xe81398[_0x033c('0xe9')][_0x14ab9b][_0x033c('0x15c')](),'XMD-AMD':_0x5ae609['dialAMDActive']?_0x033c('0x162'):_0x033c('0x15e'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5ae609[_0x033c('0x108')]){_0x514393['XMD-AMDINITIALSILENCE']=_0x5ae609['dialAMDInitialSilence']||0x9c4;_0x514393[_0x033c('0x163')]=_0x5ae609[_0x033c('0x164')]||0x5dc;_0x514393['XMD-AMDAFTERGREETINGSILENCE']=_0x5ae609[_0x033c('0x165')]||0x320;_0x514393[_0x033c('0x166')]=_0x5ae609[_0x033c('0x167')]||0x1388;_0x514393[_0x033c('0x168')]=_0x5ae609[_0x033c('0x169')]||0x64;_0x514393['XMD-AMDBETWEENWORDSSILENCE']=_0x5ae609['dialAMDBetweenWordsSilence']||0x32;_0x514393['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5ae609[_0x033c('0x16a')]||0x3;_0x514393[_0x033c('0x16b')]=_0x5ae609[_0x033c('0x16c')]||0x100;_0x514393[_0x033c('0x16d')]=_0x5ae609[_0x033c('0x16e')]||0x1388;}if(utils['isOutboundQueue'](_0x5ae609)){_0x514393['XMD-VOICEQUEUEID']=_0x55354b['VoiceQueueId'];}else{_0x514393[_0x033c('0x16f')]=_0x55354b[_0x033c('0xe7')];}var _0x170f0e=utils['setXMDContactVariables'](_0x55354b[_0x033c('0x170')]);Object[_0x033c('0x171')](_0x514393,_0x170f0e);var _0x42a12a=_0xe81398[_0x033c('0x7f')](_0x5ae609[_0x033c('0x87')])?utils[_0x033c('0x172')](_0x5ae609[_0x033c('0x87')][_0x033c('0x173')],_0x5ae609[_0x033c('0x174')],_0x5ae609[_0x033c('0x175')]>0x0?utils[_0x033c('0x176')](_0x5ae609['dialOriginateCallerIdNumber'],_0x5ae609[_0x033c('0x175')]):_0x5ae609[_0x033c('0x177')]):utils[_0x033c('0x172')](_[_0x033c('0xf0')](_0x5ae609[_0x033c('0x178')])?_0x5ae609[_0x033c('0x87')]['callerid']:_0x5ae609['TrunkBackup']['callerid'],_0x5ae609[_0x033c('0x174')],_0x5ae609[_0x033c('0x175')]>0x0?utils[_0x033c('0x176')](_0x5ae609[_0x033c('0x177')],_0x5ae609[_0x033c('0x175')]):_0x5ae609['dialOriginateCallerIdNumber']);if(_0x42a12a){_0x514393[_0x033c('0x179')]=_0xe81398[_0x033c('0xe9')][_0x14ab9b][_0x033c('0x17a')]=utils[_0x033c('0x17b')](_0x42a12a);_0x514393['XMD-ORIGINATECALLERIDNUM']=_0x55354b[_0x033c('0x159')];}_0x5ae609[_0x033c('0x17c')]=_0x514393;return ami[_0x033c('0x94')]({'actionid':_0x14ab9b,'action':'originate','channel':_0xe81398[_0x033c('0x7f')](_0x5ae609[_0x033c('0x87')])?util[_0x033c('0x3d')](_0x033c('0x17d'),_0x5ae609['Trunk'][_0x033c('0x3f')],isNotNull(_0x5ae609[_0x033c('0x17e')])?_0x5ae609[_0x033c('0x17e')]['trim']()||'':'',_0x5ae609[_0x033c('0x17f')]>0x0?_0x55354b[_0x033c('0x159')][_0x033c('0x180')](_0x5ae609[_0x033c('0x17f')]):_0x55354b['phone']):util[_0x033c('0x3d')](_0x033c('0x17d'),_[_0x033c('0xf0')](_0x5ae609['TrunkBackup'])?_0x5ae609[_0x033c('0x87')][_0x033c('0x3f')]:_0x5ae609[_0x033c('0x178')][_0x033c('0x3f')],isNotNull(_0x5ae609[_0x033c('0x17e')])?_0x5ae609[_0x033c('0x17e')][_0x033c('0x181')]()||'':'',_0x5ae609['dialCutDigit']>0x0?_0x55354b['phone']['substring'](_0x5ae609['dialCutDigit']):_0x55354b[_0x033c('0x159')]),'callerid':_0x42a12a,'Exten':'xcally-motion-dialer','Context':_0x033c('0x182'),'Priority':'1','variable':_0x514393,'timeout':(_0x5ae609[_0x033c('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x14ab9b})[_0x033c('0x37')](function(_0x54c9df){return _0x5496af(_0x54c9df);})[_0x033c('0x9b')](function(_0x429cf8){_0x5ae609['outboundOriginateFailureCallsDay']+=0x1;var _0x1c27c8=new History(_0xe81398[_0x033c('0xe9')][_0x14ab9b]);logger['error'](util[_0x033c('0x3d')](_0x033c('0x184'),JSON['stringify'](_0x429cf8)));_0x1c27c8[_0x033c('0x66')]=0xe;_0x1c27c8[_0x033c('0x67')]=_0x033c('0x185');_0x1c27c8[_0x033c('0x69')]=moment()['format'](_0x033c('0xbd'));_0x1c27c8[_0x033c('0x68')]=_0x1c27c8['starttime'];hopperUtils[_0x033c('0xc5')](_0x1c27c8)[_0x033c('0x9b')](loggerCatch(_0x033c('0x186')));_0xe81398['moveContactManagedDialer'](_0x1c27c8)[_0x033c('0x9b')](loggerCatch('[originate][error]'))[_0x033c('0xf6')](function(){delete _0xe81398[_0x033c('0xe9')][_0x14ab9b];return _0x48e209(msgResponse('originate',_0x033c('0x7d'),_0x033c('0x187')));});});});};Dialer[_0x033c('0x7e')][_0x033c('0x188')]=function(_0x3ad7a1,_0x5ae22f,_0x5b2a18){var _0x108adf=new History(_0x5ae22f);if(_0x108adf['countbusyretry']+_0x108adf['countcongestionretry']+_0x108adf[_0x033c('0x11b')]+_0x108adf['countnosuchnumberretry']+_0x108adf[_0x033c('0xce')]+_0x108adf['countabandonedretry']+_0x108adf[_0x033c('0x11d')]+_0x108adf[_0x033c('0x11e')]>=_0x5b2a18[_0x033c('0x11f')]-0x1){return!![];}switch(_0x3ad7a1){case 0x3:if(_0x108adf[_0x033c('0x11b')]>=_0x5b2a18['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x033c('0xd3')]({'active':![],'countnoanswerretry':_0x108adf[_0x033c('0x11b')]+=0x1,'scheduledat':moment()[_0x033c('0xe4')](_0x5b2a18['dialNoAnswerRetryFrequency'],'minutes')[_0x033c('0x3d')](_0x033c('0xbd')),'ContactId':_0x108adf[_0x033c('0xe6')],'ListId':_0x108adf['ListId'],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf[_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch(_0x033c('0x189')));break;case 0x5:if(_0x108adf['countbusyretry']>=_0x5b2a18[_0x033c('0x18a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x108adf['countbusyretry']+=0x1,'scheduledat':moment()[_0x033c('0xe4')](_0x5b2a18[_0x033c('0x18b')],_0x033c('0xd5'))[_0x033c('0x3d')](_0x033c('0xbd')),'ContactId':_0x108adf[_0x033c('0xe6')],'ListId':_0x108adf[_0x033c('0xd6')],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf[_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x108adf[_0x033c('0x11a')]>=_0x5b2a18['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x033c('0xd3')]({'active':![],'countcongestionretry':_0x108adf[_0x033c('0x11a')]+=0x1,'scheduledat':moment()['add'](_0x5b2a18[_0x033c('0x18c')],'minutes')[_0x033c('0x3d')](_0x033c('0xbd')),'ContactId':_0x108adf['ContactId'],'ListId':_0x108adf[_0x033c('0xd6')],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf[_0x033c('0xe7')]||undefined})['catch'](loggerCatch(_0x033c('0x18d')));break;case 0x0:if(_0x108adf[_0x033c('0x11c')]>=_0x5b2a18[_0x033c('0x18e')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x108adf[_0x033c('0x11c')]+=0x1,'scheduledat':moment()[_0x033c('0xe4')](_0x5b2a18[_0x033c('0x18f')],'minutes')[_0x033c('0x3d')](_0x033c('0xbd')),'ContactId':_0x108adf[_0x033c('0xe6')],'ListId':_0x108adf[_0x033c('0xd6')],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf[_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch(_0x033c('0x190')));}break;case 0xa:if(_0x108adf[_0x033c('0xce')]>=_0x5b2a18[_0x033c('0x191')]-0x1){return!![];}hopperUtils[_0x033c('0xd3')]({'active':![],'countdropretry':_0x108adf[_0x033c('0xce')]+=0x1,'scheduledat':moment()[_0x033c('0xe4')](_0x5b2a18[_0x033c('0xd4')],_0x033c('0xd5'))['format'](_0x033c('0xbd')),'ContactId':_0x108adf['ContactId'],'ListId':_0x108adf[_0x033c('0xd6')],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf[_0x033c('0xe7')]||undefined})['catch'](loggerCatch(_0x033c('0xd8')));break;case 0xb:if(_0x108adf[_0x033c('0xe2')]>=_0x5b2a18[_0x033c('0xe3')]-0x1){return!![];}hopperUtils[_0x033c('0xd3')]({'active':![],'countabandonedretry':_0x108adf[_0x033c('0xe2')]+=0x1,'scheduledat':moment()[_0x033c('0xe4')](_0x5b2a18['dialAbandonedRetryFrequency'],_0x033c('0xd5'))[_0x033c('0x3d')](_0x033c('0xbd')),'ContactId':_0x108adf[_0x033c('0xe6')],'ListId':_0x108adf[_0x033c('0xd6')],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf[_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x108adf[_0x033c('0x11d')]>=_0x5b2a18['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x033c('0xd3')]({'active':![],'countmachineretry':_0x108adf[_0x033c('0x11d')]+=0x1,'scheduledat':moment()[_0x033c('0xe4')](_0x5b2a18[_0x033c('0x123')],_0x033c('0xd5'))[_0x033c('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x108adf[_0x033c('0xe6')],'ListId':_0x108adf['ListId'],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf['CampaignId']||undefined})['catch'](loggerCatch(_0x033c('0x127')));break;case 0x14:if(_0x108adf[_0x033c('0x11e')]>=_0x5b2a18[_0x033c('0x192')]-0x1){return!![];}hopperUtils[_0x033c('0xd3')]({'active':![],'countagentrejectretry':_0x108adf[_0x033c('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x5b2a18[_0x033c('0x193')],_0x033c('0xd5'))[_0x033c('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x108adf[_0x033c('0xe6')],'ListId':_0x108adf[_0x033c('0xd6')],'VoiceQueueId':_0x108adf[_0x033c('0xd7')]||undefined,'CampaignId':_0x108adf['CampaignId']||undefined})['catch'](loggerCatch(_0x033c('0x194')));break;default:return!![];}};Dialer[_0x033c('0x7e')][_0x033c('0x103')]=function(_0x36bfb0,_0xd841ae,_0x2d75b3){var _0x310a2b=this;var _0x1b9234=new History(_0x36bfb0);var _0x16bc1b=![];var _0x35a669;var _0x437c48;return new Promise(function(_0x1c934d,_0x3f5687){if(_[_0x033c('0x38')](_0xd841ae)&&typeof _0xd841ae!==_0x033c('0x157')){return _0x3f5687(msgResponse('[callProgressDetecting]','Failure',_0x033c('0x195')));}if(_[_0x033c('0x38')](_0x2d75b3)&&typeof _0x2d75b3!==_0x033c('0x157')){return _0x3f5687(msgResponse(_0x033c('0x196'),_0x033c('0x8d'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x1b9234,_0x2d75b3[_0x033c('0xbf')],_0xd841ae)['then'](function(_0x280957){if(_0x280957['additional']==0x1)_0x16bc1b=!![];switch(_0x2d75b3[_0x033c('0xbf')]){case'0':_0xd841ae[_0x033c('0x197')]+=0x1;_0x1b9234[_0x033c('0x66')]=0x0;_0x1b9234[_0x033c('0x67')]=_0x033c('0x198');_0x1b9234[_0x033c('0x11c')]+=0x1;_0x1b9234[_0x033c('0xcf')]+=0x1;ami[_0x033c('0x117')]('custom:agentnosuchnumber',ut[_0x033c('0x10f')](_0x36bfb0,_0x033c('0x199')));_0x35a669=_0xd841ae[_0x033c('0x18f')];_0x437c48=_0xd841ae[_0x033c('0xd0')];hopperUtils['createHistory'](_0x1b9234)[_0x033c('0x9b')](loggerCatch(_0x033c('0x118')));if(_0x310a2b['checkRetriveMax'](0x0,_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234[_0x033c('0x11c')]>=_0xd841ae[_0x033c('0x18e')]){_0x310a2b[_0x033c('0x125')](_0x1b9234,_0x1c934d,_0x3f5687,'reason\x200\x20no\x20such\x20number....');}else{_0x310a2b[_0x033c('0x120')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x19a'));}}break;case'3':_0xd841ae['outboundNoAnswerCallsDay']+=0x1;_0x1b9234[_0x033c('0x66')]=0x3;_0x1b9234[_0x033c('0x67')]=_0x033c('0x19b');_0x1b9234[_0x033c('0x11b')]+=0x1;_0x1b9234['countglobal']+=0x1;var _0x37770d=ut[_0x033c('0x19c')](_0x36bfb0,_0xd841ae);ami[_0x033c('0x117')](_0x033c('0x19d'),_0x37770d);_0x35a669=_0xd841ae[_0x033c('0x19e')];_0x437c48=_0xd841ae['callAdditionalPhoneAfterMin'];hopperUtils[_0x033c('0xc5')](_0x1b9234)[_0x033c('0x9b')](loggerCatch(_0x033c('0x19f')));if(_0x310a2b[_0x033c('0x188')](0x3,_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234[_0x033c('0x11b')]>=_0xd841ae[_0x033c('0x1a0')]){_0x310a2b['createStateFinal'](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1a1'));}else{_0x310a2b[_0x033c('0x120')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1a1'));}}break;case'5':_0xd841ae[_0x033c('0x1a2')]+=0x1;_0x1b9234[_0x033c('0x66')]=0x5;_0x1b9234[_0x033c('0x67')]='Busy';_0x1b9234[_0x033c('0x119')]+=0x1;_0x1b9234['countglobal']+=0x1;ami[_0x033c('0x117')]('custom:agentbusy',ut[_0x033c('0x10f')](_0x36bfb0,'busy'));_0x35a669=_0xd841ae['dialBusyRetryFrequency'];_0x437c48=_0xd841ae[_0x033c('0xd0')];hopperUtils[_0x033c('0xc5')](_0x1b9234)[_0x033c('0x9b')](loggerCatch(_0x033c('0x1a3')));if(_0x310a2b[_0x033c('0x188')](0x5,_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234[_0x033c('0x119')]>=_0xd841ae[_0x033c('0x18a')]){_0x310a2b[_0x033c('0x125')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1a4'));}else{_0x310a2b[_0x033c('0x120')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1a4'));}}break;case'8':_0xd841ae['outboundCongestionCallsDay']+=0x1;_0x1b9234[_0x033c('0x66')]=0x8;_0x1b9234[_0x033c('0x67')]=_0x033c('0x1a5');_0x1b9234[_0x033c('0x11a')]+=0x1;_0x1b9234[_0x033c('0xcf')]+=0x1;_0x35a669=_0xd841ae[_0x033c('0x18c')];_0x437c48=_0xd841ae['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x033c('0x10f')](_0x36bfb0,_0x033c('0x1a6')));hopperUtils[_0x033c('0xc5')](_0x1b9234)[_0x033c('0x9b')](loggerCatch(_0x033c('0x1a7')));if(_0x310a2b[_0x033c('0x188')](0x8,_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234[_0x033c('0x11a')]>=_0xd841ae[_0x033c('0x1a8')]){_0x310a2b[_0x033c('0x125')](_0x1b9234,_0x1c934d,_0x3f5687,'reason\x208\x20congestion');}else{_0x310a2b[_0x033c('0x120')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1a9'));}}break;case'11':_0xd841ae['outboundAbandonedCallsDay']+=0x1;_0x1b9234[_0x033c('0x66')]=0xb;_0x1b9234['statedesc']=_0x033c('0xdf');_0x1b9234[_0x033c('0xe2')]+=0x1;_0x1b9234[_0x033c('0xcf')]+=0x1;_0x35a669=_0xd841ae[_0x033c('0xe5')];_0x437c48=_0xd841ae['callAdditionalPhoneAfterMin'];hopperUtils[_0x033c('0xc5')](_0x1b9234)[_0x033c('0x9b')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x310a2b[_0x033c('0x188')](0xb,_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234['countabandonedretry']>=_0xd841ae['dialAbandonedMaxRetry']){_0x310a2b[_0x033c('0x125')](_0x1b9234,_0x1c934d,_0x3f5687,'reason\x2011\x20abandoned');}else{_0x310a2b['stateGlobal'](_0x1b9234,_0x1c934d,_0x3f5687,'reason\x2011\x20abandoned');}}break;case'20':_0xd841ae[_0x033c('0x1aa')]+=0x1;_0x1b9234[_0x033c('0x66')]=0x14;_0x1b9234['statedesc']=_0x033c('0x1ab');_0x1b9234[_0x033c('0x11e')]+=0x1;_0x1b9234[_0x033c('0xcf')]+=0x1;_0x35a669=_0xd841ae[_0x033c('0x193')];_0x437c48=_0xd841ae[_0x033c('0xd0')];ami['emit'](_0x033c('0x1ac'),ut[_0x033c('0x10f')](_0x36bfb0,'agentreject'));hopperUtils[_0x033c('0xc5')](_0x1b9234)[_0x033c('0x9b')](loggerCatch(_0x033c('0x1ad')));if(_0x310a2b[_0x033c('0x188')](0x14,_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234['countagentrejectretry']>=_0xd841ae[_0x033c('0x192')]){_0x310a2b[_0x033c('0x125')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1ae'));}else{_0x310a2b[_0x033c('0x120')](_0x1b9234,_0x1c934d,_0x3f5687,_0x033c('0x1ae'));}}break;default:_0xd841ae[_0x033c('0x12e')]+=0x1;_0x1b9234[_0x033c('0x66')]=0xc;_0x1b9234[_0x033c('0x67')]=_0x2d75b3['reason'];_0x35a669=_0xd841ae['dialAgentRejectRetryFrequency'];_0x437c48=_0xd841ae['callAdditionalPhoneAfterMin'];hopperUtils[_0x033c('0xc5')](_0x1b9234)[_0x033c('0x9b')](loggerCatch(_0x033c('0x1af')));if(_0x310a2b[_0x033c('0x188')](_0x2d75b3[_0x033c('0xbf')],_0x36bfb0,_0xd841ae)&&!_0x16bc1b){if(_0x1b9234[_0x033c('0x119')]+_0x1b9234[_0x033c('0x11a')]+_0x1b9234[_0x033c('0x11b')]+_0x1b9234['countnosuchnumberretry']+_0x1b9234[_0x033c('0xce')]+_0x1b9234[_0x033c('0xe2')]+_0x1b9234['countmachineretry']+_0x1b9234['countagentrejectretry']>=_0xd841ae[_0x033c('0x11f')]){_0x310a2b['stateGlobal'](_0x1b9234,_0x1c934d,_0x3f5687,_0x2d75b3[_0x033c('0xbf')]);}else{_0x310a2b[_0x033c('0x125')](_0x1b9234,_0x1c934d,_0x3f5687,_0x2d75b3['reason']);}}}})[_0x033c('0x37')](function(){if(_0x16bc1b){hopperUtils[_0x033c('0xdd')](_0x1b9234,_0x35a669,_0x437c48)[_0x033c('0x37')](function(){return _0x1c934d(0x1);});}});});};Dialer[_0x033c('0x7e')][_0x033c('0x120')]=function(_0x37b2de,_0x5630c0,_0x1c6a9b,_0x30303d){var _0x2236cd=new Final(_0x37b2de);_0x2236cd[_0x033c('0x66')]=0xf;_0x2236cd[_0x033c('0x67')]='Global';this[_0x033c('0x125')](_0x2236cd,_0x5630c0,_0x1c6a9b,_0x30303d);};Dialer[_0x033c('0x7e')]['createStateFinal']=function(_0x3aeb8c,_0x251432,_0x485c3d,_0x477133){hopperUtils[_0x033c('0x129')](_0x3aeb8c)[_0x033c('0x37')](function(){return _0x251432(msgResponse('[callProgressDetecting]',_0x033c('0x1b0'),_0x477133));})[_0x033c('0x9b')](function(){return _0x485c3d(msgResponse('[moveContactManagedDialer][0]','Failure','contact\x20not\x20moved'));});};Dialer[_0x033c('0x7e')][_0x033c('0xad')]=function(_0x159fe5){var _0xd0b5b1=_0x159fe5[_0x033c('0x1b1')]/0x64;var _0x4036e9=_0x159fe5[_0x033c('0xca')]/(_0x159fe5['outboundDropCallsDayTimeout']+_0x159fe5[_0x033c('0x124')]);var _0x4fd594=Math['round'](_0x159fe5[_0x033c('0x1b2')]*(_0x159fe5[_0x033c('0x1b3')]/0x64));var _0x4edec5=Math[_0x033c('0x1b4')](_0x159fe5[_0x033c('0x1b2')]*(_0x159fe5[_0x033c('0x1b5')]/0x64));var _0x48cf8a=_0x159fe5['available']+_0x159fe5[_0x033c('0x136')];var _0x3c961f=Math['floor'](_0x159fe5['erlangCalls']*_0x159fe5[_0x033c('0x1b6')]*_0x159fe5['predictiveIntervalHitRate']*_0x159fe5['predictiveIntervalMultiplicativeFactor']);if(_[_0x033c('0x38')](_0x159fe5['startProgressive'])){if(!_[_0x033c('0x38')](_0x159fe5[_0x033c('0x22')])){_0x159fe5[_0x033c('0x22')]=undefined;loggerPredictive[_0x033c('0x5c')](_0x033c('0x1b7'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x159fe5[_0x033c('0x5b')])){loggerPredictive[_0x033c('0x5c')](_0x033c('0x1b7'),_0x033c('0x1b8'));clearInterval(_0x159fe5[_0x033c('0x5b')]);_0x159fe5['handlePredictive']=undefined;}_0x159fe5[_0x033c('0x58')]=moment()[_0x033c('0x3d')](_0x033c('0xbd'));loggerPredictive[_0x033c('0x42')](_0x159fe5['name'],_0x033c('0x1b9'),_0x159fe5[_0x033c('0x58')]);this[_0x033c('0xaf')](_0x159fe5,0x1);}else if(ifInterval(_0x159fe5[_0x033c('0x1ba')],_0x159fe5[_0x033c('0x58')])){this[_0x033c('0xaf')](_0x159fe5,0x1);loggerPredictiveCalls[_0x033c('0x42')](_0x033c('0x1bb'),_0x159fe5['startProgressive'],_0x159fe5[_0x033c('0x3f')]);_0x159fe5[_0x033c('0x1bc')]=0x0;_0x159fe5['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xd0b5b1<_0x4036e9&&_0x159fe5[_0x033c('0x1bd')]===_0x033c('0x1be')){clearPredictiveAttributes(_0x159fe5);loggerPredictive['info'](_0x033c('0x1bf'),_0x033c('0x1c0'),_0x4036e9,_0x033c('0x58'),_0x159fe5[_0x033c('0x3f')]);}else if(_0x3c961f<_0x159fe5['predictiveIntervalErlangCallsDroppedCalls']&&_0x159fe5[_0x033c('0x1bd')]==='dropRate'){clearPredictiveAttributes(_0x159fe5);loggerPredictive[_0x033c('0x42')](_0x033c('0x1c1'),_0x033c('0x1c2'),_0x3c961f,_0x033c('0x1c3'),_0x159fe5[_0x033c('0xcb')],_0x033c('0x58'),_0x159fe5['name']);}else if(!ifInterval(_0x159fe5['dialPredictiveInterval'],_0x159fe5['startProgressive'])&&_[_0x033c('0x38')](_0x159fe5['startPredictive'])&&!_[_0x033c('0x38')](_0x159fe5['startProgressive'])){_0x159fe5[_0x033c('0x22')]=moment()[_0x033c('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x033c('0x42')](_0x159fe5[_0x033c('0x3f')],_0x033c('0x1c4'),_0x159fe5[_0x033c('0x22')]);hopperUtils[_0x033c('0x1c5')](_0x159fe5[_0x033c('0x1ba')])[_0x033c('0x37')](this['getDataPredictive'](_0x159fe5))['then'](mergeDataErlangB(_0x159fe5))[_0x033c('0x37')](this[_0x033c('0x1c6')](_0x159fe5))[_0x033c('0x9b')](loggerCatchPredictive(_0x033c('0x1c7'),_0x159fe5));}else if(!ifInterval(_0x159fe5[_0x033c('0x1ba')],_0x159fe5[_0x033c('0x22')])){_0x159fe5[_0x033c('0xcb')]=0x0;_0x159fe5[_0x033c('0x22')]=moment()['format'](_0x033c('0xbd'));loggerPredictive[_0x033c('0x42')](_0x159fe5[_0x033c('0x3f')],_0x033c('0x1c8'),_0x159fe5[_0x033c('0x22')]);clearInterval(_0x159fe5[_0x033c('0x5b')]);_0x159fe5[_0x033c('0x5b')]=undefined;hopperUtils['avgHandleTime'](_0x159fe5[_0x033c('0x1ba')])[_0x033c('0x37')](this[_0x033c('0x1c9')](_0x159fe5))[_0x033c('0x37')](mergeDataErlangB(_0x159fe5))['then'](this[_0x033c('0x1c6')](_0x159fe5))[_0x033c('0x9b')](loggerCatchPredictive(_0x033c('0x1ca'),_0x159fe5));}else if(_0x159fe5[_0x033c('0x1b2')]&&_0x48cf8a<_0x159fe5['predictiveIntervalAvailable']-_0x4edec5){clearPredictiveAttributes(_0x159fe5);loggerPredictive['info'](_0x159fe5[_0x033c('0x3f')],_0x033c('0x1cb'),_0x48cf8a,_0x033c('0x1cc'),_0x159fe5[_0x033c('0x1b2')],'-',_0x4edec5,'=',_0x159fe5[_0x033c('0x1b2')]-_0x4edec5,')');}else if(_0x159fe5[_0x033c('0x1b2')]&&_0x48cf8a>_0x159fe5[_0x033c('0x1b2')]+_0x4fd594){clearPredictiveAttributes(_0x159fe5);loggerPredictive[_0x033c('0x42')](_0x159fe5[_0x033c('0x3f')],_0x033c('0x1cb'),_0x48cf8a,')\x20are\x20more\x20than\x20threshold\x20(',_0x159fe5[_0x033c('0x1b2')],'+',_0x4fd594,'=',_0x159fe5[_0x033c('0x1b2')]+_0x4fd594,')');}};Dialer[_0x033c('0x7e')]['getDataPredictive']=function(_0xc19d11){var _0x57b2b5=this;return function(_0x4e760c){return new Promise(function(_0x523a95,_0xd2438b){_[_0x033c('0x56')](_0xc19d11,_0x4e760c[0x0]);if(checkGetDataPredictive(_0x4e760c[0x0])){var _0x49ab58=_0xc19d11[_0x033c('0x1b2')]=_0xc19d11[_0x033c('0x136')]+_0xc19d11['available'];var _0x127c57=_0xc19d11[_0x033c('0x1ba')]*0x3c;var _0x34ecbc=_0x4e760c[0x0][_0x033c('0x4c')]+_0x4e760c[0x0][_0x033c('0x4e')];var _0x535376=(_0x4e760c[0x0]['predictiveIntervalAnsweredCalls']+_0x4e760c[0x0][_0x033c('0xc9')]+_0x4e760c[0x0][_0x033c('0x49')])/_0x4e760c[0x0][_0x033c('0x44')];_0xc19d11[_0x033c('0x1cd')]=_0x535376>0x0?_0x535376:0x1;switch(_0xc19d11[_0x033c('0x1bd')]){case'dropRate':var _0x1d6124=_0xc19d11[_0x033c('0x1b1')]/0x64;return _0x57b2b5[_0x033c('0x1ce')](_0x49ab58,_0x127c57,_0x34ecbc,_0x535376,_0x1d6124)['then'](function(_0x8bbfd3){return _0x523a95(_0x8bbfd3);});case'agentBusyFactor':var _0x2bf216=_0xc19d11['dialPredictiveOptimizationPercentage']/0x64;return _0x57b2b5[_0x033c('0x1cf')](_0x49ab58,_0x127c57,_0x34ecbc,_0x535376,_0x2bf216)[_0x033c('0x37')](function(_0x36071f){return _0x523a95(_0x36071f);});default:return _0xd2438b(msgResponse('[getDataPredictive]','Failure',_0x033c('0x1d0')));}}else{return _0xd2438b(msgResponse('[getDataPredictive]','Failure',_0x033c('0x1d1')));}});};};Dialer[_0x033c('0x7e')][_0x033c('0x1d2')]=function(_0x50bd58){var _0x2858bb=this;return function(_0x5c4964){return new Promise(function(_0x310b14,_0x7b2223){_[_0x033c('0x56')](_0x50bd58,_0x5c4964[0x0]);if(checkGetDataPredictive(_0x5c4964[0x0])){loggerPredictive['info'](JSON[_0x033c('0x6c')](_0x5c4964[0x0]));if(_0x50bd58['dialPredictiveOptimization']===_0x033c('0x1be')){return _0x2858bb[_0x033c('0x149')](_0x50bd58['id'])[_0x033c('0x37')](function(_0x420133){var _0x566771=_0x50bd58[_0x033c('0x1d3')]-_0x420133[0x0][_0x033c('0x1d4')];var _0x442340=_0x50bd58[_0x033c('0x1ba')]*0x3c;var _0x5102bd=_0x5c4964[0x0][_0x033c('0x4c')]+_0x5c4964[0x0][_0x033c('0x4e')];var _0x54d9b7=(_0x5c4964[0x0]['predictiveIntervalAnsweredCalls']+_0x5c4964[0x0][_0x033c('0xc9')]+_0x5c4964[0x0][_0x033c('0x49')])/_0x5c4964[0x0]['predictiveIntervalTotalCalls'];var _0x1f9aca=_0x50bd58[_0x033c('0x1b1')]/0x64;_0x50bd58[_0x033c('0x1d5')]=_0x420133[0x0]['outboundQueuePauses']||0x0;_0x50bd58[_0x033c('0x1cd')]=_0x54d9b7>0x0?_0x54d9b7:0x1;return _0x2858bb['abandonmentRate'](_0x566771,_0x442340,_0x5102bd,_0x54d9b7,_0x1f9aca);})[_0x033c('0x37')](function(_0x132b7f){return _0x310b14(_0x132b7f);})[_0x033c('0x9b')](function(_0x54549f){return _0x7b2223(msgResponse(_0x033c('0x1d6'),_0x033c('0x8d'),JSON[_0x033c('0x6c')](_0x54549f)));});}if(_0x50bd58['dialPredictiveOptimization']===_0x033c('0x1d7')){return _0x2858bb[_0x033c('0x149')](_0x50bd58['id'])[_0x033c('0x37')](function(_0x53412d){var _0x512a76=_0x50bd58[_0x033c('0x1d3')]-_0x53412d[0x0][_0x033c('0x1d4')];var _0x1dd7da=_0x50bd58[_0x033c('0x1ba')]*0x3c;var _0x451724=_0x5c4964[0x0][_0x033c('0x4c')]+_0x5c4964[0x0]['predictiveIntervalAvgHoldtime'];var _0x5b8b8d=(_0x5c4964[0x0][_0x033c('0x46')]+_0x5c4964[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5c4964[0x0][_0x033c('0x49')])/_0x5c4964[0x0][_0x033c('0x44')];var _0x53a134=_0x50bd58['dialPredictiveOptimizationPercentage']/0x64;_0x50bd58['predictiveIntervalPauses']=_0x53412d[0x0][_0x033c('0x1d4')]||0x0;_0x50bd58['predictiveIntervalHitRate']=_0x5b8b8d>0x0?_0x5b8b8d:0x1;return _0x2858bb[_0x033c('0x1cf')](_0x512a76,_0x1dd7da,_0x451724,_0x5b8b8d,_0x53a134);})['then'](function(_0x41a864){return _0x310b14(_0x41a864);})[_0x033c('0x9b')](function(_0x2d3dfd){return _0x7b2223(msgResponse(_0x033c('0x1d6'),_0x033c('0x8d'),JSON['stringify'](_0x2d3dfd)));});}}else{return _0x7b2223(msgResponse('[getDataPredictive]',_0x033c('0x8d'),'check\x20failure'));}});};};Dialer['prototype'][_0x033c('0x1c6')]=function(_0x4c54d0){var _0x1a75e6=this;return function(){var _0x1d4ccc=0x0;var _0x1759d4=Math[_0x033c('0x1d8')](_0x4c54d0[_0x033c('0x1d9')]*0x3e8);if(_0x1759d4>0x0){_0x1759d4=_0x1759d4<0x64?0x64:_0x1759d4;loggerPredictive[_0x033c('0x42')](_0x4c54d0[_0x033c('0x3f')],_0x033c('0x1da'),_0x1759d4,_0x033c('0x1db'));_0x4c54d0[_0x033c('0x5b')]=setInterval(function(){_0x1a75e6[_0x033c('0x5b')](_0x4c54d0);loggerPredictiveCalls['info'](_0x033c('0x1dc'),_0x1d4ccc+=0x1);},_0x1759d4);}else{loggerPredictive[_0x033c('0x42')](_0x4c54d0[_0x033c('0x3f')],_0x033c('0x1dd'));}};};Dialer[_0x033c('0x7e')]['checkContactBlack']=function(_0x2dd02b,_0x105974){var _0x4e4966=this;return function(_0x2c6f5e){if(_[_0x033c('0x41')](_0x2c6f5e)){if(_[_0x033c('0xf0')](_0x105974[_0x033c('0x151')])||!_0x105974[_0x033c('0x1de')]){if(_0x2dd02b['dialMethod']===_0x033c('0x9')){_0x2dd02b['queueStatusComplete']=_[_0x033c('0x38')](_0x2dd02b['queueStatusComplete'])?!![]:_0x2dd02b[_0x033c('0x6a')];var _0x20dfaa=uuid['v4']();_0x4e4966['actions'][_0x20dfaa]=new Action(_0x2dd02b,_0x105974,_0x20dfaa);loggerBooked[_0x033c('0x42')]('[booked][checkContactBlack]',_0x20dfaa,_0x033c('0x1df'),JSON['stringify'](_0x2dd02b[_0x033c('0x6a')]),_0x033c('0x1e0'),_0x2dd02b['name']);if(_0x2dd02b[_0x033c('0x6a')]){_0x2dd02b['queueStatusComplete']=![];_0x4e4966[_0x033c('0x24')][_0x4e4966[_0x033c('0xe9')][_0x20dfaa][_0x033c('0xc2')]]=[];ami[_0x033c('0x94')]({'actionid':_0x20dfaa,'action':_0x033c('0x1e1'),'queue':_0x2dd02b[_0x033c('0x3f')]})['catch'](function(){_0x4e4966['updateOriginated'](_0x2dd02b);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4e4966[_0x033c('0xe9')][_0x20dfaa]['ContactId'],'ListId':_0x4e4966['actions'][_0x20dfaa]['ListId'],'VoiceQueueId':_0x4e4966['actions'][_0x20dfaa][_0x033c('0xd7')]||undefined,'CampaignId':_0x4e4966[_0x033c('0xe9')][_0x20dfaa][_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4e4966[_0x033c('0xe9')][_0x20dfaa];});}else{loggerBooked[_0x033c('0x42')](_0x033c('0x1e2'),JSON[_0x033c('0x6c')](_0x2dd02b[_0x033c('0x6a')]),_0x033c('0x1e0'),_0x2dd02b[_0x033c('0x3f')]);_0x4e4966['updateOriginated'](_0x2dd02b);hopperUtils[_0x033c('0xd3')]({'active':![],'ContactId':_0x4e4966[_0x033c('0xe9')][_0x20dfaa][_0x033c('0xe6')],'ListId':_0x4e4966[_0x033c('0xe9')][_0x20dfaa][_0x033c('0xd6')],'VoiceQueueId':_0x4e4966[_0x033c('0xe9')][_0x20dfaa][_0x033c('0xd7')]||undefined,'CampaignId':_0x4e4966[_0x033c('0xe9')][_0x20dfaa][_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch(_0x033c('0x1e3')));delete _0x4e4966['actions'][_0x20dfaa];}}else{return _0x4e4966['actionOriginate'](_0x2dd02b,_0x105974);}}else{if(utils['getSeconds'](undefined,_0x105974[_0x033c('0x1e4')])<_0x2dd02b[_0x033c('0x1e5')]*0x3c){if(_0x105974[_0x033c('0x156')]&&!_0x105974['Agent']['voicePause']){_0x4e4966[_0x033c('0x1a')][_0x033c('0xf3')](_0x105974['id'])[_0x033c('0xf6')](function(){_0x4e4966[_0x033c('0xbc')](_0x2dd02b);});}else{hopperUtils[_0x033c('0x1e6')]({'active':![]},_0x105974['id'],0x1)[_0x033c('0xf6')](function(){_0x4e4966['updateOriginated'](_0x2dd02b);});}}else{_0x2dd02b['outboundReCallsDay']+=0x1;_0x4e4966['updateOriginated'](_0x2dd02b);if(_0x2dd02b['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x105974[_0x033c('0xe6')],'ListId':_0x105974[_0x033c('0xd6')],'VoiceQueueId':_0x105974[_0x033c('0xd7')]||undefined,'CampaignId':_0x105974[_0x033c('0xe7')]||undefined})[_0x033c('0x9b')](loggerCatch(_0x033c('0x1e7')));hopperUtils[_0x033c('0xc5')](createObjHistory(_0x2dd02b,_0x105974,utils[_0x033c('0x61')][_0x033c('0x1e8')],0x17,_0x033c('0x1e9')))[_0x033c('0x9b')](loggerCatch(_0x033c('0x1ea')));}else{_0x4e4966[_0x033c('0x110')](createObjHistory(_0x2dd02b,_0x105974,utils[_0x033c('0x61')][_0x033c('0x1eb')],0x16,_0x033c('0x1ec')),_0x033c('0x1ed'),'[Originate][HistoryRecallClose]');}}}}else{_0x2dd02b['outboundBlacklistCallsDay']+=0x1;_0x4e4966[_0x033c('0x110')](createObjHistory(_0x2dd02b,_0x105974,utils[_0x033c('0x61')][_0x033c('0x1ee')],0xd,_0x033c('0x1ef')),_0x033c('0x1f0'),_0x033c('0x1f1'));throw'inBlackList';}};};Dialer[_0x033c('0x7e')][_0x033c('0x1f2')]=function(_0x3e1e4b){var _0x2abd28=this;var _0x50f6a8=_0x3e1e4b['limitCalls']-_0x3e1e4b[_0x033c('0x14b')];emitCampaignSummary(_0x3e1e4b);if(_0x50f6a8>0x0&&_0x3e1e4b[_0x033c('0x5e')]==0x0){if(_0x50f6a8>this[_0x033c('0x1e')]){_0x50f6a8=this[_0x033c('0x1e')];}_0x3e1e4b[_0x033c('0x5e')]=0x1;hopperUtils[_0x033c('0x1f3')](_0x3e1e4b,_0x50f6a8)['then'](function(_0x3ec4c0){_0x3e1e4b['temp']=0x0;if(_0x3ec4c0){if(!utils[_0x033c('0x1f4')](_0x3ec4c0)){_0x3e1e4b[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x64')];logger[_0x033c('0x42')](_0x033c('0x1f5')+_0x3e1e4b[_0x033c('0x3f')]);}else{_0x3e1e4b['originated']+=_0x3ec4c0['length'];_0x3e1e4b[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x1f6')];for(var _0x1c4a84=0x0;_0x1c4a84<_0x3ec4c0['length'];_0x1c4a84+=0x1){_0x3e1e4b['ivrTotalCallsDays']+=0x1;if(_[_0x033c('0xf0')](_0x3ec4c0[_0x1c4a84])||_[_0x033c('0xf0')](_0x3ec4c0[_0x1c4a84]['Contact'])||_['isNil'](_0x3ec4c0[_0x1c4a84][_0x033c('0x159')])){_0x2abd28[_0x033c('0x14f')](_0x033c('0x1f7'),_0x3e1e4b,_0x3ec4c0[_0x1c4a84]);}else{hopperUtils[_0x033c('0x1f8')](_[_0x033c('0x6d')](_0x3ec4c0[_0x1c4a84],[_0x033c('0xe7'),_0x033c('0x159')]))[_0x033c('0x37')](_0x2abd28[_0x033c('0x1f9')](_0x3e1e4b,_0x3ec4c0[_0x1c4a84]))[_0x033c('0x9b')](_0x2abd28[_0x033c('0x14e')](_0x033c('0x1fa'),_0x3e1e4b));}}}}})[_0x033c('0x9b')](loggerGetContactDialer(_0x033c('0x1fb'),_0x3e1e4b,_0x50f6a8));}};Dialer[_0x033c('0x7e')]['handlePower']=function(_0x585430,_0x99479b){var _0x181a6b=this;var _0xefa3a7=[];if(_0x99479b<0x1||_0x585430['dialMethod']===_0x033c('0x9')){_0x99479b=0x1;}var _0xff1c59=Math[_0x033c('0x1d8')](_0x585430['available']*_0x99479b)-_0x585430[_0x033c('0x14b')];if(_0x585430[_0x033c('0x1fc')]>0x0){var _0x16d774=_0x585430[_0x033c('0x1fc')]-_0x585430[_0x033c('0x14b')]-_0x585430[_0x033c('0x136')]-_0x585430[_0x033c('0x137')];if(_0xff1c59>_0x16d774){_0xff1c59=_0x16d774;}}if(_0xff1c59>0x0&&_0x585430[_0x033c('0x5e')]==0x0){if(_0x585430[_0x033c('0xac')]===_0x033c('0x9')){_0xff1c59=0x1;}if(_0xff1c59>this[_0x033c('0x1e')]){_0xff1c59=this['maxNumberOriginate'];}for(var _0x4ba148 in this[_0x033c('0x1d')]){if(typeof this[_0x033c('0x1d')][_0x4ba148]!==_0x033c('0x147')){if(this['agents'][_0x4ba148][_0x033c('0x66')]===_0x033c('0x1fd')&&this['agents'][_0x4ba148][_0x033c('0x83')]===_0x033c('0x84')){_0xefa3a7[_0x033c('0x9c')](this['agents'][_0x4ba148]['id']);}}}_0x585430[_0x033c('0x5e')]=0x1;hopperUtils[_0x033c('0x1fe')](_0x585430,_0xefa3a7,_0xff1c59)[_0x033c('0x37')](function(_0x270f4b){_0x585430[_0x033c('0x5e')]=0x0;if(_0x270f4b){if(!utils[_0x033c('0x1f4')](_0x270f4b)){hopperUtils['countReScheduled'](_0x585430)[_0x033c('0x37')](sendMessageReschedule(_0x585430))[_0x033c('0x9b')](loggerCatch(_0x033c('0x1ff')));}else{_0x585430[_0x033c('0x14b')]+=_0x270f4b[_0x033c('0x93')];_0x585430[_0x033c('0x60')]=_0x585430[_0x033c('0xac')]===_0x033c('0x9')?utils[_0x033c('0x61')][_0x033c('0x162')]:utils[_0x033c('0x61')][_0x033c('0x1f6')];for(var _0x5a3f9a=0x0;_0x5a3f9a<_0x270f4b['length'];_0x5a3f9a+=0x1){if(_[_0x033c('0xf0')](_0x270f4b[_0x5a3f9a])||_[_0x033c('0xf0')](_0x270f4b[_0x5a3f9a][_0x033c('0x170')])||_[_0x033c('0xf0')](_0x270f4b[_0x5a3f9a]['phone'])){_0x181a6b[_0x033c('0x14f')](_0x033c('0x1f7'),_0x585430,_0x270f4b[_0x5a3f9a]);}else{hopperUtils[_0x033c('0x200')](_[_0x033c('0x6d')](_0x270f4b[_0x5a3f9a],[_0x033c('0xd7'),'phone']))[_0x033c('0x37')](_0x181a6b[_0x033c('0x1f9')](_0x585430,_0x270f4b[_0x5a3f9a]))[_0x033c('0x9b')](_0x181a6b['loggerHandler'](_0x033c('0x1f7'),_0x585430));}}}}})[_0x033c('0x9b')](loggerGetContactDialer(_0x033c('0x201'),_0x585430,_0xff1c59));}};Dialer[_0x033c('0x7e')][_0x033c('0x5b')]=function(_0x5ce2f4){if(_0x5ce2f4[_0x033c('0x1fc')]>0x0){var _0x1fdda8=_0x5ce2f4['dialLimitQueue']-_0x5ce2f4[_0x033c('0x14b')]-_0x5ce2f4['talking'];if(_0x1fdda8>0x0&&_0x5ce2f4[_0x033c('0x5e')]==0x0){this[_0x033c('0x202')](_0x5ce2f4);}else{loggerPredictiveCalls[_0x033c('0x42')](_0x033c('0x203'));}}else{this['tryOriginatePredictive'](_0x5ce2f4);}};Dialer['prototype'][_0x033c('0x202')]=function(_0xeafa9d){var _0x2a9ce0=this;var _0x116905=[];_0xeafa9d[_0x033c('0x14b')]+=0x1;for(var _0x627e53 in this['agents']){if(typeof this[_0x033c('0x1d')][_0x627e53]!==_0x033c('0x147')){if(this[_0x033c('0x1d')][_0x627e53][_0x033c('0x66')]===_0x033c('0x1fd')&&this[_0x033c('0x1d')][_0x627e53][_0x033c('0x83')]===_0x033c('0x84')){_0x116905[_0x033c('0x9c')](this[_0x033c('0x1d')][_0x627e53]['id']);}}}_0xeafa9d[_0x033c('0x5e')]=0x1;return this[_0x033c('0x1fe')](_0xeafa9d['id'],_0x116905,0x1,_0xeafa9d[_0x033c('0x204')],_0xeafa9d)[_0x033c('0x37')](function(_0x56ff02){_0xeafa9d[_0x033c('0x5e')]=0x1;if(_0x56ff02){if(!utils[_0x033c('0x1f4')](_0x56ff02)){utils['checkContactLowerLimitOriginate'](_0xeafa9d,0x1,0x0);return hopperUtils[_0x033c('0x205')](_0xeafa9d)['then'](sendMessageReschedule(_0xeafa9d))['catch'](loggerCatch(_0x033c('0x1ff')));}else{_0xeafa9d[_0x033c('0x60')]=utils[_0x033c('0x61')][_0x033c('0x1f6')];if(_['isNil'](_0x56ff02[0x0])||_[_0x033c('0xf0')](_0x56ff02[0x0][_0x033c('0x170')])||_['isNil'](_0x56ff02[0x0]['phone'])){_0x2a9ce0['emptyContact'](_0x033c('0x1f7'),_0xeafa9d,_0x56ff02[0x0]);}else{return hopperUtils[_0x033c('0x200')](_[_0x033c('0x6d')](_0x56ff02[0x0],[_0x033c('0xd7'),'phone']))[_0x033c('0x37')](_0x2a9ce0['checkContactBlack'](_0xeafa9d,_0x56ff02[0x0]))[_0x033c('0x9b')](_0x2a9ce0[_0x033c('0x14e')](_0x033c('0x206'),_0xeafa9d));}}}})[_0x033c('0x9b')](loggerGetContactDialer(_0x033c('0x207'),_0xeafa9d,0x1));};Dialer[_0x033c('0x7e')][_0x033c('0x1ce')]=function(_0x1cf4b3,_0x477501,_0x421eaa,_0x57c378,_0xcb86a0,_0x2dafc4){loggerPredictive['info'](_0x033c('0x208'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cf4b3);loggerPredictive[_0x033c('0x42')](_0x033c('0x209'),_0x477501);loggerPredictive['info'](_0x033c('0x20a'),_0x421eaa);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x57c378);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',_0xcb86a0);loggerPredictive[_0x033c('0x42')](_0x033c('0x4b'));return new Promise(function(_0x3b409e,_0x1c1b67){if(_0x1cf4b3<=0x0||isNaN(_0x1cf4b3)){return _0x1c1b67(msgResponse(_0x033c('0x20b'),'Error','m\x20=\x20'+_0x1cf4b3));}if(_0x421eaa<=0x0||isNaN(_0x421eaa)){return _0x1c1b67(msgResponse(_0x033c('0x20b'),'Error',_0x033c('0x20c')+_0x421eaa));}if(_0x57c378<=0x0||isNaN(_0x57c378)){return _0x1c1b67(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x57c378));}if(_0x477501<=0x0||isNaN(_0x477501)){return _0x1c1b67(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x477501));}if(_0xcb86a0<=0x0||isNaN(_0xcb86a0)){return _0x1c1b67(msgResponse(_0x033c('0x20b'),_0x033c('0x7d'),_0x033c('0x20d')+_0xcb86a0));}_0x2dafc4=_0x2dafc4||0x0;var _0x4f5dc6=0x1/_0x421eaa;var _0x29e090=0x0;var _0x56df56=0x0;var _0x4bf11f=0x0;var _0x57fe85=0x0;for(var _0x109840=0x0;_0x4bf11f<_0xcb86a0;_0x109840+=0x1){_0x56df56=_0x109840/_0x477501;_0x29e090=(_0x57c378*_0x56df56+_0x2dafc4)/_0x4f5dc6;_0x4bf11f=utils[_0x033c('0x20e')](_0x29e090,_0x1cf4b3);_0x57fe85=_0x29e090/_0x1cf4b3*(0x1-utils['erlangb'](_0x29e090,_0x1cf4b3));}return _0x3b409e({'erlangCalls':_0x109840,'erlangCallToSecond':_0x477501/_0x109840,'erlangAbandonmentRate':_0x4bf11f,'erlangBusyFactor':_0x57fe85});});};Dialer[_0x033c('0x7e')][_0x033c('0x1cf')]=function(_0x1e625e,_0x1c6580,_0x65b502,_0x43ca4d,_0x6162f3,_0x319e39){loggerPredictive[_0x033c('0x42')](_0x033c('0x20f'));loggerPredictive[_0x033c('0x42')](_0x033c('0x210'),_0x1e625e);loggerPredictive['info'](_0x033c('0x209'),_0x1c6580);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',_0x65b502);loggerPredictive[_0x033c('0x42')](_0x033c('0x211'),_0x43ca4d);loggerPredictive['info'](_0x033c('0x212'),_0x6162f3);loggerPredictive[_0x033c('0x42')]('---------------------------');return new Promise(function(_0x39e55a,_0x3ff743){if(_0x1e625e<=0x0||isNaN(_0x1e625e)){return _0x3ff743(msgResponse(_0x033c('0x213'),'Error',_0x033c('0x214')+_0x1e625e));}if(_0x65b502<=0x0||isNaN(_0x65b502)){return _0x3ff743(msgResponse('[busyFactor]',_0x033c('0x7d'),'Ts\x20=\x20'+_0x65b502));}if(_0x43ca4d<=0x0||isNaN(_0x43ca4d)){return _0x3ff743(msgResponse(_0x033c('0x213'),_0x033c('0x7d'),_0x033c('0x215')+_0x43ca4d));}if(_0x1c6580<=0x0||isNaN(_0x1c6580)){return _0x3ff743(msgResponse('[busyFactor]',_0x033c('0x7d'),'interval\x20=\x20'+_0x1c6580));}if(_0x6162f3<=0x0||isNaN(_0x6162f3)){return _0x3ff743(msgResponse('[busyFactor]',_0x033c('0x7d'),_0x033c('0x216')+_0x6162f3));}_0x319e39=_0x319e39||0x0;var _0x4b550e=0x1/_0x65b502;var _0x284fc5=0x0;var _0x5dde42=0x0;var _0x74c1e6=0x0;var _0x34dbe6=0x0;for(var _0x3b3ab8=0x0;_0x34dbe6<_0x6162f3;_0x3b3ab8+=0x1){_0x5dde42=_0x3b3ab8/_0x1c6580;_0x284fc5=(_0x43ca4d*_0x5dde42+_0x319e39)/_0x4b550e;_0x74c1e6=utils[_0x033c('0x20e')](_0x284fc5,_0x1e625e);_0x34dbe6=_0x284fc5/_0x1e625e*(0x1-utils[_0x033c('0x20e')](_0x284fc5,_0x1e625e));}return _0x39e55a({'erlangCalls':_0x3b3ab8,'erlangCallToSecond':_0x1c6580/_0x3b3ab8,'erlangAbandonmentRate':_0x74c1e6,'erlangBusyFactor':_0x34dbe6});});};module[_0x033c('0x217')]=Dialer; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index d26d019..18d2d59 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 _0xffb9=['exports','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffb9,0x7f));var _0x9ffb=function(_0x341198,_0x2ce789){_0x341198=_0x341198-0x0;var _0x3f9771=_0xffb9[_0x341198];return _0x3f9771;};'use strict';var util=require('util');var _=require(_0x9ffb('0x0'));var moment=require(_0x9ffb('0x1'));function checkNameSurname(_0x485477,_0x5a78b8,_0x55edee){var _0x270272='';if(!_[_0x9ffb('0x2')](_0x5a78b8)&&_0x9ffb('0x3')===typeof _0x5a78b8){_0x270272+=_0x5a78b8;}if(!_[_0x9ffb('0x2')](_0x55edee)&&_0x9ffb('0x3')===typeof _0x55edee){_0x270272+='\x20'+_0x55edee;}if(_0x270272!==''){return _0x270272;}return _0x485477;}function Action(_0x439761,_0x25a4a1,_0x484266){this[_0x9ffb('0x4')]=_0x439761;this['uniqueid']=_0x484266||undefined;this[_0x9ffb('0x5')]=checkNameSurname(_0x25a4a1[_0x9ffb('0x6')][_0x9ffb('0x7')],_0x25a4a1[_0x9ffb('0x6')][_0x9ffb('0x8')],_0x25a4a1[_0x9ffb('0x6')]['lastName']);this[_0x9ffb('0x9')]=_0x25a4a1['phone'];this[_0x9ffb('0xa')]=_0x439761['name'];this[_0x9ffb('0xb')]=_0x25a4a1[_0x9ffb('0xb')]||![];this[_0x9ffb('0xc')]=_0x439761[_0x9ffb('0xc')];this[_0x9ffb('0xd')]=_0x439761[_0x9ffb('0xd')]||0x3;this['scheduledat']=_0x25a4a1[_0x9ffb('0xe')];this[_0x9ffb('0xf')]=_0x25a4a1[_0x9ffb('0xf')];this['countcongestionretry']=_0x25a4a1[_0x9ffb('0x10')];this[_0x9ffb('0x11')]=_0x25a4a1[_0x9ffb('0x11')];this['countnosuchnumberretry']=_0x25a4a1[_0x9ffb('0x12')];this['countdropretry']=_0x25a4a1[_0x9ffb('0x13')];this['countabandonedretry']=_0x25a4a1[_0x9ffb('0x14')];this[_0x9ffb('0x15')]=_0x25a4a1['countmachineretry'];this['countagentrejectretry']=_0x25a4a1[_0x9ffb('0x16')];this[_0x9ffb('0x17')]=_0x25a4a1['ContactId'];this['ListId']=_0x25a4a1['ListId'];this['UserId']=_0x25a4a1[_0x9ffb('0x18')];this[_0x9ffb('0x19')]=_0x25a4a1[_0x9ffb('0x19')];this[_0x9ffb('0x1a')]=_0x25a4a1[_0x9ffb('0x1a')];this[_0x9ffb('0x1b')]=_0x25a4a1['id'];this[_0x9ffb('0x1c')]=_0x25a4a1[_0x9ffb('0x6')][_0x9ffb('0x8')]||'';this[_0x9ffb('0x1d')]=moment()[_0x9ffb('0x1e')](_0x9ffb('0x1f'));this[_0x9ffb('0x20')]=_0x25a4a1[_0x9ffb('0x20')];this[_0x9ffb('0x21')]=_0x25a4a1[_0x9ffb('0x21')];this[_0x9ffb('0x22')]=_0x25a4a1[_0x9ffb('0x22')];this[_0x9ffb('0x23')]=_0x25a4a1[_0x9ffb('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x9ffb('0x24')][_0x9ffb('0x25')]=function(){return util['format'](_0x9ffb('0x26'),this[_0x9ffb('0x5')],this[_0x9ffb('0x4')]['dialCutDigit']>0x0?this[_0x9ffb('0x9')]['substring'](this['voiceQueue'][_0x9ffb('0x27')]):this[_0x9ffb('0x9')]);};Action['prototype'][_0x9ffb('0x28')]=function(){return this[_0x9ffb('0xa')];};module[_0x9ffb('0x29')]=Action; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index dc3c982..266b758 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 _0xef2f=['getSeconds','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x447524,_0x1ebb5c){var _0x28fcf1=function(_0x13cac1){while(--_0x13cac1){_0x447524['push'](_0x447524['shift']());}};_0x28fcf1(++_0x1ebb5c);}(_0xef2f,0x1be));var _0xfef2=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xef2f[_0x373dee];return _0x46798f;};'use strict';var moment=require(_0xfef2('0x0'));var utils=require(_0xfef2('0x1'));function AgentComplete(_0x5fc9ac,_0x14714f){this[_0xfef2('0x2')]=0x4;this['statedesc']=_0xfef2('0x3');this['scheduledat']=_0x5fc9ac[_0xfef2('0x4')];this[_0xfef2('0x5')]=_0x5fc9ac['type'];this[_0xfef2('0x6')]=_0x5fc9ac['type']==='outbound'?_0xfef2('0x7'):_0x5fc9ac[_0xfef2('0x5')];this[_0xfef2('0x8')]=_0x5fc9ac[_0xfef2('0x8')];this[_0xfef2('0x9')]=_0x5fc9ac[_0xfef2('0x9')];this[_0xfef2('0xa')]=_0x5fc9ac[_0xfef2('0xa')];this[_0xfef2('0xb')]=_0x5fc9ac['countbusyretry']+_0x5fc9ac[_0xfef2('0x9')]+_0x5fc9ac[_0xfef2('0xa')]+_0x5fc9ac[_0xfef2('0xc')]+_0x5fc9ac[_0xfef2('0xd')]+_0x5fc9ac[_0xfef2('0xe')]+_0x5fc9ac[_0xfef2('0xf')]+_0x5fc9ac[_0xfef2('0x10')];this['countnosuchnumberretry']=_0x5fc9ac['countnosuchnumberretry'];this[_0xfef2('0xd')]=_0x5fc9ac['countdropretry'];this[_0xfef2('0xe')]=_0x5fc9ac[_0xfef2('0xe')];this['countmachineretry']=_0x5fc9ac[_0xfef2('0xf')];this[_0xfef2('0x10')]=_0x5fc9ac[_0xfef2('0x10')];this[_0xfef2('0x11')]=_0x14714f[_0xfef2('0x11')];this[_0xfef2('0x12')]=_0x5fc9ac['name'];this[_0xfef2('0x13')]=_0x5fc9ac[_0xfef2('0x14')];this[_0xfef2('0x15')]=_0x5fc9ac[_0xfef2('0x15')];this[_0xfef2('0x16')]=_0x5fc9ac[_0xfef2('0x16')];this[_0xfef2('0x17')]=_0x5fc9ac['answertime'];this['endtime']=moment()[_0xfef2('0x18')](_0xfef2('0x19'));this[_0xfef2('0x1a')]=utils[_0xfef2('0x1b')](_0x5fc9ac[_0xfef2('0x16')],_0x5fc9ac['starttime']);this['holdtime']=utils[_0xfef2('0x1b')](_0x5fc9ac[_0xfef2('0x17')],_0x5fc9ac['responsetime']);this[_0xfef2('0x1c')]=utils['getSeconds'](this['endtime'],_0x5fc9ac['answertime']);this['queue']=_0x14714f[_0xfef2('0x7')];this[_0xfef2('0x1d')]=_0x14714f[_0xfef2('0x1d')];this['reason']=_0x14714f[_0xfef2('0x1e')];this['callback']=_0x5fc9ac['callback'];this['callbackuniqueid']=_0x5fc9ac[_0xfef2('0x1f')];this[_0xfef2('0x20')]=_0x5fc9ac[_0xfef2('0x20')];this[_0xfef2('0x21')]=_0x5fc9ac['recallme'];this[_0xfef2('0x22')]=_0x5fc9ac[_0xfef2('0x22')];this[_0xfef2('0x23')]=_0x5fc9ac[_0xfef2('0x23')];this[_0xfef2('0x24')]=_0x5fc9ac[_0xfef2('0x24')];this[_0xfef2('0x25')]=_0x5fc9ac['VoiceQueueId'];this['CampaignId']=_0x5fc9ac[_0xfef2('0x26')];this[_0xfef2('0x27')]=_0x5fc9ac[_0xfef2('0x27')]||'';this[_0xfef2('0x28')]=_0x5fc9ac[_0xfef2('0x28')]||'';this[_0xfef2('0x29')]=_0x5fc9ac['agiafterat'];}module[_0xfef2('0x2a')]=AgentComplete; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 4993a08..496d889 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 _0x6087=['state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x61683d,_0xe7e2d5){var _0xfed21e=function(_0x1f7b9d){while(--_0x1f7b9d){_0x61683d['push'](_0x61683d['shift']());}};_0xfed21e(++_0xe7e2d5);}(_0x6087,0x161));var _0x7608=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6087[_0x3ab51d];return _0x29a04e;};'use strict';function Final(_0x166a07){this[_0x7608('0x0')]=_0x166a07[_0x7608('0x0')];this['scheduledat']=_0x166a07[_0x7608('0x1')];this[_0x7608('0x2')]=_0x166a07[_0x7608('0x2')];this[_0x7608('0x3')]=_0x166a07['type']==='outbound'?_0x7608('0x4'):_0x166a07['type'];this[_0x7608('0x5')]=_0x166a07[_0x7608('0x5')];this['countcongestionretry']=_0x166a07[_0x7608('0x6')];this[_0x7608('0x7')]=_0x166a07[_0x7608('0x7')];this[_0x7608('0x8')]=_0x166a07['countbusyretry']+_0x166a07[_0x7608('0x6')]+_0x166a07['countnoanswerretry']+_0x166a07['countnosuchnumberretry']+_0x166a07[_0x7608('0x9')]+_0x166a07[_0x7608('0xa')]+_0x166a07[_0x7608('0xb')]+_0x166a07[_0x7608('0xc')];this[_0x7608('0xd')]=_0x166a07[_0x7608('0xd')];this['countdropretry']=_0x166a07['countdropretry'];this[_0x7608('0xa')]=_0x166a07['countabandonedretry'];this[_0x7608('0xb')]=_0x166a07['countmachineretry'];this[_0x7608('0xc')]=_0x166a07[_0x7608('0xc')];this[_0x7608('0x4')]=_0x166a07[_0x7608('0x4')];this[_0x7608('0xe')]=_0x166a07['calleridname'];this[_0x7608('0xf')]=_0x166a07[_0x7608('0xf')];this[_0x7608('0x10')]=_0x166a07[_0x7608('0x10')];this['responsetime']=_0x166a07[_0x7608('0x11')];this[_0x7608('0x12')]=_0x166a07[_0x7608('0x11')];this[_0x7608('0x13')]=_0x166a07[_0x7608('0x13')]||0x0;this[_0x7608('0x14')]=_0x166a07[_0x7608('0x14')]||0x0;this[_0x7608('0x15')]=_0x166a07['talktime']||0x0;this[_0x7608('0x16')]=_0x166a07['callback'];this[_0x7608('0x17')]=_0x166a07[_0x7608('0x17')];this['callbackat']=_0x166a07[_0x7608('0x18')];this[_0x7608('0x19')]=_0x166a07['recallme'];this[_0x7608('0x1a')]=_0x166a07[_0x7608('0x1a')];this[_0x7608('0x1b')]=_0x166a07[_0x7608('0x1b')];this[_0x7608('0x1c')]=_0x166a07['UserId'];this[_0x7608('0x1d')]=_0x166a07[_0x7608('0x1d')];this['CampaignId']=_0x166a07['CampaignId'];this['originatecalleridnum']=_0x166a07[_0x7608('0x1e')]||'';this[_0x7608('0x1f')]=_0x166a07[_0x7608('0x1f')]||'';this[_0x7608('0x20')]=_0x166a07['state'];this[_0x7608('0x21')]=_0x166a07[_0x7608('0x21')];}module[_0x7608('0x22')]=Final; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 1e8e150..ded2505 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 _0x30b4=['countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','moment','../utils','state','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countdropretry','countmachineretry'];(function(_0x18e5f1,_0x4e437e){var _0x405902=function(_0x1077cf){while(--_0x1077cf){_0x18e5f1['push'](_0x18e5f1['shift']());}};_0x405902(++_0x4e437e);}(_0x30b4,0x1c0));var _0x430b=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0x30b4[_0x36d25e];return _0x4b95b8;};'use strict';var moment=require(_0x430b('0x0'));var utils=require(_0x430b('0x1'));function Hangup(_0x1efcd9,_0x8ae382){this[_0x430b('0x2')]=0x4;this['statedesc']=_0x430b('0x3');this['scheduledat']=_0x1efcd9[_0x430b('0x4')];this[_0x430b('0x5')]=_0x1efcd9[_0x430b('0x5')];this['campaigntype']=_0x1efcd9[_0x430b('0x5')]===_0x430b('0x6')?_0x430b('0x7'):_0x1efcd9[_0x430b('0x5')];this[_0x430b('0x8')]=_0x1efcd9['amd']||![];this[_0x430b('0x9')]=_0x1efcd9[_0x430b('0x9')];this['countcongestionretry']=_0x1efcd9['countcongestionretry'];this[_0x430b('0xa')]=_0x1efcd9[_0x430b('0xa')];this[_0x430b('0xb')]=_0x1efcd9[_0x430b('0x9')]+_0x1efcd9['countcongestionretry']+_0x1efcd9[_0x430b('0xa')]+_0x1efcd9['countnosuchnumberretry']+_0x1efcd9[_0x430b('0xc')]+_0x1efcd9['countabandonedretry']+_0x1efcd9[_0x430b('0xd')]+_0x1efcd9[_0x430b('0xe')];this[_0x430b('0xf')]=_0x1efcd9['countnosuchnumberretry'];this[_0x430b('0xc')]=_0x1efcd9['countdropretry'];this[_0x430b('0x10')]=_0x1efcd9[_0x430b('0x10')];this[_0x430b('0xd')]=_0x1efcd9[_0x430b('0xd')];this[_0x430b('0xe')]=_0x1efcd9[_0x430b('0xe')];this[_0x430b('0x11')]=_0x8ae382[_0x430b('0x11')];this[_0x430b('0x12')]=_0x1efcd9[_0x430b('0x13')];this[_0x430b('0x14')]=_0x1efcd9[_0x430b('0x15')];this[_0x430b('0x16')]=_0x1efcd9[_0x430b('0x16')];this[_0x430b('0x17')]=_0x1efcd9[_0x430b('0x17')];this[_0x430b('0x18')]=moment()['format'](_0x430b('0x19'));this[_0x430b('0x1a')]=utils[_0x430b('0x1b')](_0x1efcd9['responsetime'],_0x1efcd9[_0x430b('0x16')]);this[_0x430b('0x1c')]=0x0;this[_0x430b('0x1d')]=utils[_0x430b('0x1b')](this[_0x430b('0x18')],_0x1efcd9['responsetime']);this[_0x430b('0x7')]=_0x1efcd9[_0x430b('0x7')];this[_0x430b('0x1e')]=_0x430b('0x1f');this[_0x430b('0x20')]=_0x8ae382[_0x430b('0x21')];this['callback']=_0x1efcd9['callback'];this[_0x430b('0x22')]=_0x1efcd9[_0x430b('0x22')];this[_0x430b('0x23')]=_0x1efcd9[_0x430b('0x23')];this[_0x430b('0x24')]=_0x1efcd9[_0x430b('0x24')];this[_0x430b('0x25')]=_0x1efcd9[_0x430b('0x25')];this['ListId']=_0x1efcd9[_0x430b('0x26')];this[_0x430b('0x27')]=_0x1efcd9['UserId'];this['VoiceQueueId']=_0x1efcd9['VoiceQueueId'];this['CampaignId']=_0x1efcd9[_0x430b('0x28')];}module[_0x430b('0x29')]=Hangup; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 6d01450..f909b68 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 _0xac10=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid'];(function(_0x533ffd,_0x547e7b){var _0x1069f5=function(_0x580224){while(--_0x580224){_0x533ffd['push'](_0x533ffd['shift']());}};_0x1069f5(++_0x547e7b);}(_0xac10,0x14b));var _0x0ac1=function(_0x74118b,_0x239694){_0x74118b=_0x74118b-0x0;var _0x257525=_0xac10[_0x74118b];return _0x257525;};'use strict';var utils=require(_0x0ac1('0x0'));function History(_0x44020b){this[_0x0ac1('0x1')]=_0x44020b[_0x0ac1('0x1')];this[_0x0ac1('0x2')]=_0x44020b[_0x0ac1('0x2')]||undefined;this['type']=_0x44020b[_0x0ac1('0x3')];this['campaigntype']=_0x44020b[_0x0ac1('0x3')]===_0x0ac1('0x4')?_0x0ac1('0x5'):_0x44020b[_0x0ac1('0x3')];this[_0x0ac1('0x6')]=_0x44020b['countbusyretry'];this['countcongestionretry']=_0x44020b[_0x0ac1('0x7')];this[_0x0ac1('0x8')]=_0x44020b[_0x0ac1('0x8')];this[_0x0ac1('0x9')]=_0x44020b[_0x0ac1('0x6')]+_0x44020b[_0x0ac1('0x7')]+_0x44020b[_0x0ac1('0x8')]+_0x44020b[_0x0ac1('0xa')]+_0x44020b[_0x0ac1('0xb')]+_0x44020b[_0x0ac1('0xc')]+_0x44020b[_0x0ac1('0xd')]+_0x44020b[_0x0ac1('0xe')];this['countnosuchnumberretry']=_0x44020b[_0x0ac1('0xa')];this['countdropretry']=_0x44020b[_0x0ac1('0xb')];this[_0x0ac1('0xc')]=_0x44020b[_0x0ac1('0xc')];this['countmachineretry']=_0x44020b[_0x0ac1('0xd')];this[_0x0ac1('0xe')]=_0x44020b[_0x0ac1('0xe')];this['queue']=_0x44020b['queue'];this[_0x0ac1('0xf')]=_0x44020b[_0x0ac1('0x10')];this[_0x0ac1('0x11')]=_0x44020b['number'];this[_0x0ac1('0x12')]=_0x44020b[_0x0ac1('0x12')];this[_0x0ac1('0x13')]=_0x44020b['responsetime'];this['endtime']=_0x44020b[_0x0ac1('0x13')];this[_0x0ac1('0x14')]=utils[_0x0ac1('0x15')](_0x44020b[_0x0ac1('0x13')],_0x44020b['starttime']);this[_0x0ac1('0x16')]=0x0;this[_0x0ac1('0x17')]=0x0;this[_0x0ac1('0x18')]=_0x44020b['callback'];this[_0x0ac1('0x19')]=_0x44020b['callbackuniqueid'];this['callbackat']=_0x44020b[_0x0ac1('0x1a')];this[_0x0ac1('0x1b')]=_0x44020b[_0x0ac1('0x1b')];this['ContactId']=_0x44020b[_0x0ac1('0x1c')];this['ListId']=_0x44020b[_0x0ac1('0x1d')];this['UserId']=_0x44020b['UserId'];this[_0x0ac1('0x1e')]=_0x44020b['VoiceQueueId'];this[_0x0ac1('0x1f')]=_0x44020b[_0x0ac1('0x1f')];this[_0x0ac1('0x20')]=_0x44020b['originatecalleridnum']||'';this[_0x0ac1('0x21')]=_0x44020b[_0x0ac1('0x21')]||'';this[_0x0ac1('0x22')]=_0x44020b[_0x0ac1('0x22')];this[_0x0ac1('0x23')]=_0x44020b[_0x0ac1('0x23')];}module[_0x0ac1('0x24')]=History; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 693bfb9..4a9aa6d 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 _0x27f0=['countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','starttime','responsetime','dropreason','endtime','droptime','ringtime','getSeconds','holdtime','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','type','queue','countbusyretry'];(function(_0x1e067e,_0x336bd6){var _0x2c784b=function(_0x533906){while(--_0x533906){_0x1e067e['push'](_0x1e067e['shift']());}};_0x2c784b(++_0x336bd6);}(_0x27f0,0x137));var _0x027f=function(_0x4efd39,_0x17d499){_0x4efd39=_0x4efd39-0x0;var _0xd32981=_0x27f0[_0x4efd39];return _0xd32981;};'use strict';var utils=require(_0x027f('0x0'));function QueueCallerAbandon(_0x10222d,_0x4e2d38){this['scheduledat']=_0x10222d['scheduledat'];this['type']=_0x10222d[_0x027f('0x1')];this['campaigntype']=_0x10222d[_0x027f('0x1')]==='outbound'?_0x027f('0x2'):_0x10222d[_0x027f('0x1')];this['countbusyretry']=_0x10222d[_0x027f('0x3')];this['countcongestionretry']=_0x10222d[_0x027f('0x4')];this[_0x027f('0x5')]=_0x10222d[_0x027f('0x5')];this['countglobal']=_0x10222d[_0x027f('0x3')]+_0x10222d[_0x027f('0x4')]+_0x10222d['countnoanswerretry']+_0x10222d['countnosuchnumberretry']+_0x10222d[_0x027f('0x6')]+_0x10222d[_0x027f('0x7')]+_0x10222d[_0x027f('0x8')]+_0x10222d['countagentrejectretry'];this['countnosuchnumberretry']=_0x10222d['countnosuchnumberretry'];this[_0x027f('0x6')]=_0x10222d[_0x027f('0x6')];this[_0x027f('0x7')]=_0x10222d['countabandonedretry'];this[_0x027f('0x8')]=_0x10222d['countmachineretry'];this['countagentrejectretry']=_0x10222d[_0x027f('0x9')];this['uniqueid']=_0x4e2d38['uniqueid'];this[_0x027f('0xa')]=_0x10222d[_0x027f('0xb')];this['calleridnum']=_0x10222d['number'];this['starttime']=_0x10222d[_0x027f('0xc')];this[_0x027f('0xd')]=_0x10222d[_0x027f('0xd')];this['droptime']=_0x10222d['droptime'];this['dropreason']=_0x10222d[_0x027f('0xe')];this[_0x027f('0xf')]=this[_0x027f('0x10')];this[_0x027f('0x11')]=utils[_0x027f('0x12')](_0x10222d[_0x027f('0xd')],_0x10222d['starttime']);this[_0x027f('0x13')]=utils['getSeconds'](this['droptime'],_0x10222d[_0x027f('0xd')]);this['talktime']=0x0;this[_0x027f('0x2')]=_0x4e2d38['queue'];this['membername']=_0x4e2d38[_0x027f('0x14')];this['reason']=_0x4e2d38['reason'];this[_0x027f('0x15')]=_0x10222d[_0x027f('0x15')];this[_0x027f('0x16')]=_0x10222d[_0x027f('0x16')];this['callbackat']=_0x10222d[_0x027f('0x17')];this['recallme']=_0x10222d[_0x027f('0x18')];this[_0x027f('0x19')]=_0x10222d[_0x027f('0x19')];this[_0x027f('0x1a')]=_0x10222d[_0x027f('0x1a')];this['UserId']=_0x10222d[_0x027f('0x1b')];this[_0x027f('0x1c')]=_0x10222d[_0x027f('0x1c')];this['CampaignId']=_0x10222d[_0x027f('0x1d')];this[_0x027f('0x1e')]=_0x10222d[_0x027f('0x1e')]||'';this[_0x027f('0x1f')]=_0x10222d[_0x027f('0x1f')]||'';this['agiafterat']=_0x10222d[_0x027f('0x20')];this[_0x027f('0x21')]=_0x10222d['state'];this[_0x027f('0x22')]=_0x10222d['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index aefbb57..36837d2 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 _0xc6ac=['../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','catch','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone'];(function(_0x4bc982,_0x8045e2){var _0x1c2b34=function(_0x51455c){while(--_0x51455c){_0x4bc982['push'](_0x4bc982['shift']());}};_0x1c2b34(++_0x8045e2);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x509c38,_0x23636d){_0x509c38=_0x509c38-0x0;var _0xdd233b=_0xc6ac[_0x509c38];return _0xdd233b;};'use strict';var util=require(_0xcc6a('0x0'));var logger=require(_0xcc6a('0x1'))(_0xcc6a('0x2'));var cmHopper=require(_0xcc6a('0x3'));var cmHopperAdditionalPhone=require(_0xcc6a('0x4'));var cmHopperBlack=require(_0xcc6a('0x5'));var cmHopperHistory=require(_0xcc6a('0x6'));function inspectError(_0x31bbcd){return util[_0xcc6a('0x7')](_0x31bbcd,{'showHidden':![],'depth':null});}function getContactDialer(_0x22ee99,_0x2f26ab,_0x188b05){return cmHopper[_0xcc6a('0x8')](_0x22ee99['id'],_0x2f26ab,_0x188b05,_0x22ee99[_0xcc6a('0x9')])['catch'](function(_0x3dd497){_0x22ee99[_0xcc6a('0xa')]=0x0;logger[_0xcc6a('0xb')]('[getContactDialer]',inspectError(_0x3dd497));});}exports[_0xcc6a('0x8')]=getContactDialer;function getContactDialerIvr(_0x210f63,_0x7806a0){return cmHopper[_0xcc6a('0xc')](_0x210f63['id'],_0x7806a0,_0x210f63[_0xcc6a('0x9')])['catch'](function(_0x30a004){_0x210f63[_0xcc6a('0xa')]=0x0;logger[_0xcc6a('0xb')]('[getContactDialerIvr]',inspectError(_0x30a004));});}exports[_0xcc6a('0xc')]=getContactDialerIvr;function countReScheduled(_0x9e9a63){return cmHopper[_0xcc6a('0xd')](_0x9e9a63)['catch'](function(_0x59ce6d){logger[_0xcc6a('0xb')](_0xcc6a('0xe'),inspectError(_0x59ce6d));});}exports[_0xcc6a('0xd')]=countReScheduled;function rescheduleContact(_0x559a0a){return cmHopper['rescheduleContact'](_0x559a0a)[_0xcc6a('0xf')](function(_0xcb9e2e){logger[_0xcc6a('0xb')](_0xcc6a('0x10'),inspectError(_0xcb9e2e));});}exports[_0xcc6a('0x11')]=rescheduleContact;function unlockContact(_0x337ec5,_0x4133fa,_0x403b18){return cmHopper['unlockContact'](_0x337ec5,_0x4133fa,_0x403b18)['catch'](function(_0x4d021a){logger[_0xcc6a('0xb')](_0xcc6a('0x12'),inspectError(_0x4d021a));});}exports[_0xcc6a('0x13')]=unlockContact;function moveContactManagedDialer(_0x3e63d9){return cmHopper[_0xcc6a('0x14')](_0x3e63d9)[_0xcc6a('0xf')](function(_0x2d9585){logger[_0xcc6a('0xb')](_0xcc6a('0x15'),inspectError(_0x2d9585));});}exports[_0xcc6a('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1d20a3){return cmHopperBlack['checkIsBlackList'](_0x1d20a3)[_0xcc6a('0xf')](function(_0x3e1fda){logger[_0xcc6a('0xb')](_0xcc6a('0x16'),inspectError(_0x3e1fda));});}exports[_0xcc6a('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x30b8ed){return cmHopperBlack[_0xcc6a('0x18')](_0x30b8ed)[_0xcc6a('0xf')](function(_0x2254a8){logger[_0xcc6a('0xb')](_0xcc6a('0x19'),inspectError(_0x2254a8));});}exports[_0xcc6a('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x51be9a,_0x41c4c8,_0x3a081e){return cmHopperAdditionalPhone[_0xcc6a('0x1a')](_0x51be9a,_0x41c4c8,_0x3a081e)['catch'](function(_0x10016a){logger[_0xcc6a('0xb')](_0xcc6a('0x1b'),inspectError(_0x10016a));});}exports[_0xcc6a('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x432c23,_0x5fc697,_0x50abc1){return cmHopperAdditionalPhone[_0xcc6a('0x1c')](_0x432c23,_0x5fc697,_0x50abc1)[_0xcc6a('0xf')](function(_0x3514f3){logger['error'](_0xcc6a('0x1d'),inspectError(_0x3514f3));});}exports[_0xcc6a('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x4da301){return cmHopperHistory[_0xcc6a('0x1e')](_0x4da301)[_0xcc6a('0xf')](function(_0x3233d1){logger[_0xcc6a('0xb')]('[avgHandleTime]',inspectError(_0x3233d1));});}exports[_0xcc6a('0x1e')]=avgHandleTime;function createHistory(_0x3cf14c){return cmHopperHistory[_0xcc6a('0x1f')](_0x3cf14c)['catch'](function(_0x2590a2){logger['error']('[createHistory]',inspectError(_0x2590a2));});}exports[_0xcc6a('0x1f')]=createHistory; \ No newline at end of file +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 diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 3560945..5bf8d81 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 _0xaf61=['active','milliseconds','diff','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','TrunkBackup','includes','status','INACTIVE','DISACTIVED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','preview','isPreviewCampaign','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive'];(function(_0x2dc7db,_0x2a8089){var _0x3e7442=function(_0x5d076d){while(--_0x5d076d){_0x2dc7db['push'](_0x2dc7db['shift']());}};_0x3e7442(++_0x2a8089);}(_0xaf61,0x96));var _0x1af6=function(_0x1083d8,_0x304af5){_0x1083d8=_0x1083d8-0x0;var _0x108c3c=_0xaf61[_0x1083d8];return _0x108c3c;};'use strict';var _=require(_0x1af6('0x0'));var moment=require(_0x1af6('0x1'));var util=require('util');var logger=require(_0x1af6('0x2'))(_0x1af6('0x3'));var timezones=require('../../../../config/environment/shared')[_0x1af6('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x1af6('0x5'),'BLACKLIST':_0x1af6('0x6'),'CONTACTS_RESCHEDULED':_0x1af6('0x7'),'DEACTIVATED':_0x1af6('0x8'),'DISACTIVED':_0x1af6('0x9'),'EMPTY_INTERVAL':_0x1af6('0xa'),'INACTIVE':_0x1af6('0xb'),'NO_AGENTS_LOGGED':_0x1af6('0xc'),'NO_AVAILABLE_CONTACTS':_0x1af6('0xd'),'NULL_INTERVAL':_0x1af6('0xe'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x1af6('0xf'),'QUEUE_RECALL':_0x1af6('0x10'),'RECALL_TIMEOUT':_0x1af6('0x11'),'RUNNING':_0x1af6('0x12'),'UNKNOWN_TIMEZONE':_0x1af6('0x13'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x1af6('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x388c3e){return _0x388c3e['dialMethod']===_0x1af6('0x15');}exports[_0x1af6('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x4d4d45){return _0x4d4d45['type']==='ivr';}exports[_0x1af6('0x17')]=isIVRCampaign;function isOutboundQueue(_0x1b2017){return _0x1b2017[_0x1af6('0x18')]==='outbound';}exports[_0x1af6('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x271fc9){return _0x271fc9[_0x1af6('0x1a')];}exports[_0x1af6('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x49b7c6){return _0x49b7c6[_0x1af6('0x1c')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x3087c6,_0x3865ed){var _0x12223c=moment(_0x3087c6)[_0x1af6('0x1d')](0x0);var _0x3fa233=moment(_0x3865ed)['milliseconds'](0x0);return _0x12223c[_0x1af6('0x1e')](_0x3fa233,_0x1af6('0x1f'));}exports[_0x1af6('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x43a858,_0x5bc2d0){var _0x550d09=![];var _0x10d268=_0x43a858['dialMethod']!==_0x5bc2d0[_0x1af6('0x21')]||_0x43a858['dialActive']!==_0x5bc2d0[_0x1af6('0x1a')]||_0x43a858[_0x1af6('0x22')]!==_0x5bc2d0['message'];var _0x324bcc=_0x43a858[_0x1af6('0x23')]!==_0x5bc2d0[_0x1af6('0x23')]||_0x43a858[_0x1af6('0x24')]!==_0x5bc2d0['loggedIn']||_0x43a858['loggedInDb']!==_0x5bc2d0[_0x1af6('0x25')]||_0x43a858[_0x1af6('0x26')]!==_0x5bc2d0[_0x1af6('0x26')]||_0x43a858['talking']!==_0x5bc2d0[_0x1af6('0x27')]||_0x43a858['pTalking']!==_0x5bc2d0[_0x1af6('0x28')]||_0x43a858[_0x1af6('0x29')]!==_0x5bc2d0['waiting']||_0x43a858[_0x1af6('0x2a')]!==_0x5bc2d0[_0x1af6('0x2a')]||_0x43a858[_0x1af6('0x2b')]!==_0x5bc2d0[_0x1af6('0x2b')];if(_0x43a858['Trunk']&&_0x5bc2d0[_0x1af6('0x2c')]){_0x550d09=_0x43a858[_0x1af6('0x2c')][_0x1af6('0x2d')]!==_0x5bc2d0['Trunk'][_0x1af6('0x2d')]||_0x43a858[_0x1af6('0x2c')][_0x1af6('0x1c')]!==_0x5bc2d0['Trunk'][_0x1af6('0x1c')];}return _0x10d268||_0x324bcc||_0x550d09;}exports[_0x1af6('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x52e29a){var _0x4f6094=null;var _0x2075f4=_0x52e29a['dialTimezone'];if(_[_0x1af6('0x2f')](_0x52e29a[_0x1af6('0x30')])||_[_0x1af6('0x2f')](_0x52e29a[_0x1af6('0x31')])||_['isNil'](_0x52e29a[_0x1af6('0x31')][_0x1af6('0x32')])){_0x4f6094=CAMPAIGN_STATUS[_0x1af6('0x33')];}else if(_[_0x1af6('0x34')](_0x52e29a[_0x1af6('0x30')])||_[_0x1af6('0x34')](_0x52e29a[_0x1af6('0x31')]['Intervals'])){_0x4f6094=CAMPAIGN_STATUS[_0x1af6('0x35')];}else if(_0x2075f4&&!timezones[_0x2075f4]){_0x4f6094=CAMPAIGN_STATUS[_0x1af6('0x36')];}return _0x4f6094;}function checkAnyValidTrunk(_0x4bdbbc,_0x3e5b31){var _0x338dde=null;var _0x4565a1=_0x1af6('0x37');var _0x5cdcaa=[_0x1af6('0x38'),'unmonitored'];var _0x81a8c2=!![];if(_0x4bdbbc[_0x1af6('0x2c')]&&_0x4bdbbc[_0x1af6('0x2c')]['active']){_0x4565a1+=_0x4bdbbc[_0x1af6('0x2c')][_0x1af6('0x2d')];_0x338dde=_0x3e5b31[_0x4565a1];_0x81a8c2=_0x5cdcaa['includes'](_0x338dde['status']);}else if(_0x4bdbbc[_0x1af6('0x39')]&&_0x4bdbbc[_0x1af6('0x39')][_0x1af6('0x1c')]){_0x4565a1+=_0x4bdbbc[_0x1af6('0x39')][_0x1af6('0x2d')];_0x338dde=_0x3e5b31[_0x4565a1];_0x81a8c2=_0x5cdcaa[_0x1af6('0x3a')](_0x338dde[_0x1af6('0x3b')]);}return _0x81a8c2;}function getQueueCampaignStatusMessage(_0x2f2581,_0x52c488){var _0x3b5c99=CAMPAIGN_STATUS[_0x1af6('0x5')];var _0x4a82fb=isPreviewCampaign(_0x2f2581);if(!isQueueCampaignActive(_0x2f2581)){if(_0x4a82fb){_0x3b5c99=CAMPAIGN_STATUS[_0x1af6('0x3c')];}else{if(_0x2f2581[_0x1af6('0x2b')]===0x0&&_0x2f2581['talking']===0x0&&_0x2f2581['waiting']===0x0&&(_0x2f2581['pTalking']||0x0)===0x0){_0x3b5c99=CAMPAIGN_STATUS[_0x1af6('0x3c')];}else{_0x3b5c99=CAMPAIGN_STATUS[_0x1af6('0x3d')];}}}else if(_0x2f2581[_0x1af6('0x24')]===0x0){_0x3b5c99=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2f2581,_0x52c488)){_0x3b5c99=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2f2581)){var _0x58f9f3=checkAnyValidQueueCampaignInterval(_0x2f2581);if(_0x58f9f3){_0x3b5c99=_0x58f9f3;}}return _0x3b5c99;}exports[_0x1af6('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4e1f58){var _0x1fb61c=CAMPAIGN_STATUS[_0x1af6('0x3d')];if(_0x4e1f58[_0x1af6('0x2b')]===0x0&&_0x4e1f58[_0x1af6('0x27')]===0x0&&_0x4e1f58['waiting']===0x0&&(_0x4e1f58[_0x1af6('0x28')]||0x0)===0x0){_0x1fb61c=CAMPAIGN_STATUS[_0x1af6('0x3c')];}return _0x1fb61c;}exports[_0x1af6('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4b9f9c){var _0x49fd5f=_0x4b9f9c[_0x1af6('0x40')](/"(.*?)"/);return _0x49fd5f?_0x49fd5f[0x1]:_0x4b9f9c;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x6ef57e,_0x5022be,_0x483e95){if(!_[_0x1af6('0x41')](_0x483e95)&&typeof _0x483e95===_0x1af6('0x42')&&!_[_0x1af6('0x34')](_0x483e95)){if(!_['isUndefined'](_0x5022be)&&typeof _0x5022be===_0x1af6('0x42')&&!_['isEmpty'](_0x5022be)){return util[_0x1af6('0x43')]('\x22%s\x22\x20<%s>',_0x5022be,_0x483e95);}return util[_0x1af6('0x43')](_0x1af6('0x44'),_0x483e95,_0x483e95);}if(!_[_0x1af6('0x41')](_0x6ef57e)&&typeof _0x6ef57e==='string'&&!_[_0x1af6('0x34')](_0x6ef57e)){return _0x6ef57e;}return _0x1af6('0x45');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x36188d,_0x5e430e){var _0x5d3466;var _0x419430;var _0x34d0c2;if(_0x5e430e<=0x0){_0x5e430e=0x1;}_0x5d3466=new RegExp(_0x1af6('0x46')+_0x5e430e+'}$');_0x419430=Math[_0x1af6('0x47')](0xa,_0x5e430e-0x1);_0x34d0c2=Math[_0x1af6('0x47')](0xa,_0x5e430e)-0x1;return util['format']('%s',_['replace'](_0x36188d,_0x5d3466,_['random'](_0x419430,_0x34d0c2)[_0x1af6('0x48')]()));}exports[_0x1af6('0x49')]=getCallerIdRandom;function decrementOriginate(_0x20d8c6){if(_0x20d8c6[_0x1af6('0x2b')]&&_0x20d8c6[_0x1af6('0x2b')]>0x0){_0x20d8c6[_0x1af6('0x2b')]-=0x1;}else{logger[_0x1af6('0x4a')](_0x1af6('0x4b'));}}exports[_0x1af6('0x4c')]=decrementOriginate;function checkContactEmpty(_0x177447){return _0x177447&&_0x177447['length']>0x0;}exports[_0x1af6('0x4d')]=checkContactEmpty;function erlangb(_0x1bd086,_0x545215){if(_0x545215===0x0){return 0x0;}var _0x39d51f=0x1;for(var _0x13ef8b=0x1;_0x13ef8b<=_0x545215;_0x13ef8b+=0x1){_0x39d51f=0x1+_0x39d51f*_0x13ef8b/_0x1bd086;}return 0x1/_0x39d51f;}exports[_0x1af6('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x229391,_0x42b170,_0x3a9038){if(_0x42b170>_0x3a9038){for(var _0x4efd41=0x0;_0x4efd41<_0x42b170-_0x3a9038;_0x4efd41+=0x1){decrementOriginate(_0x229391);}}}exports[_0x1af6('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x22f542){var _0xde7553={};var _0x38b65d=['id',_0x1af6('0x50'),_0x1af6('0x51'),_0x1af6('0x52'),_0x1af6('0x53')];if(_0x22f542){for(var _0x5dea71 in _0x22f542){if(typeof _0x22f542[_0x5dea71]!==_0x1af6('0x54')){if(!_[_0x1af6('0x2f')](_0x22f542[_0x5dea71])&&!_0x38b65d[_0x1af6('0x3a')](_0x5dea71)){_0xde7553[util[_0x1af6('0x43')](_0x1af6('0x55'),_0x1af6('0x56'),_0x5dea71[_0x1af6('0x57')]())]=_0x22f542[_0x5dea71];}}}}return _0xde7553;}exports[_0x1af6('0x58')]=setXMDContactVariables; \ No newline at end of file +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 diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 085ab38..922e548 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(_0x2f2e2f,_0x2f1334){var _0x2ea743=function(_0x20950a){while(--_0x20950a){_0x2f2e2f['push'](_0x2f2e2f['shift']());}};_0x2ea743(++_0x2f1334);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_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 diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 0b648fa..93b18e9 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 _0x4122=['SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','exports','util','lodash','moment','path','tiff2pdf','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','then','notify','fax','error','\x20notify\x20','catch','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x4122,0x158));var _0x2412=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4122[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x2412('0x0'));var _=require(_0x2412('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x2412('0x2'));var path=require(_0x2412('0x3'));var tiff2pdf=require(_0x2412('0x4'));var gs=require('./util/gs');var logger=require(_0x2412('0x5'))('fax');var ami=require(_0x2412('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x2412('0x7'));var ut=require(_0x2412('0x8'));var Action=require(_0x2412('0x9'));var faxAccount=require(_0x2412('0xa'));var attachment=require(_0x2412('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x51dbfa){this[_0x2412('0xc')]={};this['faxAccounts']=_0x51dbfa[_0x2412('0xd')];this[_0x2412('0xe')]=_0x51dbfa[_0x2412('0xe')];this[_0x2412('0xf')]={};ami['on'](_0x2412('0x10'),this['syncNewchannel'][_0x2412('0x11')](this));ami['on'](_0x2412('0x12'),this[_0x2412('0x13')][_0x2412('0x11')](this));ami['on'](_0x2412('0x14'),this[_0x2412('0x15')]['bind'](this));ami['on'](_0x2412('0x16'),this[_0x2412('0x17')][_0x2412('0x11')](this));ami['on'](_0x2412('0x18'),this[_0x2412('0x19')]['bind'](this));ami['on'](_0x2412('0x1a'),this[_0x2412('0x1b')][_0x2412('0x11')](this));ami['on'](_0x2412('0x1c'),this['syncHangup'][_0x2412('0x11')](this));ami['on'](_0x2412('0x1d'),this[_0x2412('0x1e')][_0x2412('0x11')](this));}Fax[_0x2412('0x1f')][_0x2412('0x20')]=function(_0x45f725){if(_0x45f725[_0x2412('0x21')]==='from-voip-provider'){for(var _0x2629b2 in this[_0x2412('0xd')]){if(this['faxAccounts'][_0x2412('0x22')](_0x2629b2)){if(_0x45f725['exten']===this[_0x2412('0xd')][_0x2629b2][_0x2412('0x23')]){this[_0x2412('0xc')][_0x45f725[_0x2412('0x24')]]={};this[_0x2412('0xc')][_0x45f725[_0x2412('0x24')]][_0x2412('0x25')]=_0x45f725['channel'];this[_0x2412('0xc')][_0x45f725['uniqueid']]['id']=this[_0x2412('0xd')][_0x2629b2]['id'];this['channels'][_0x45f725[_0x2412('0x24')]]['name']=this[_0x2412('0xd')][_0x2629b2][_0x2412('0x26')];logger[_0x2412('0x27')](_0x45f725[_0x2412('0x24')],_0x2412('0x28'));}}}}if(this[_0x2412('0xf')][_0x45f725[_0x2412('0x24')]]){this[_0x2412('0xc')][_0x45f725[_0x2412('0x24')]]={};this['channels'][_0x45f725[_0x2412('0x24')]][_0x2412('0x25')]=_0x45f725[_0x2412('0x25')];logger['info'](_0x45f725[_0x2412('0x24')],_0x2412('0x28'));}};Fax[_0x2412('0x1f')][_0x2412('0x13')]=function(_0x55dee0){if(this['channels'][_0x55dee0[_0x2412('0x24')]]){for(var _0x103178 in _0x55dee0[_0x2412('0x29')]){if(_0x55dee0[_0x2412('0x29')][_0x2412('0x22')](_0x103178)){this['channels'][_0x55dee0[_0x2412('0x24')]][_0x103178]=_0x55dee0[_0x2412('0x2a')];}}}};Fax[_0x2412('0x1f')][_0x2412('0x15')]=function(_0x3d408e){if(this[_0x2412('0xc')][_0x3d408e['uniqueid']]){this['channels'][_0x3d408e[_0x2412('0x24')]][_0x2412('0x2b')]=_0x3d408e[_0x2412('0x2b')];this[_0x2412('0xc')][_0x3d408e[_0x2412('0x24')]][_0x2412('0x2c')]=_0x3d408e[_0x2412('0x2c')];}};Fax[_0x2412('0x1f')][_0x2412('0x17')]=function(_0x5f2570){if(this['channels'][_0x5f2570[_0x2412('0x24')]]){for(var _0xd4a155 in _0x5f2570[_0x2412('0x29')]){if(_0x5f2570[_0x2412('0x29')][_0x2412('0x22')](_0xd4a155)){this[_0x2412('0xc')][_0x5f2570[_0x2412('0x24')]][_0xd4a155]=_0x5f2570[_0x2412('0x2a')];}}}};Fax[_0x2412('0x1f')][_0x2412('0x19')]=function(_0x1f0c64){if(this['channels'][_0x1f0c64['uniqueid']]){this['channels'][_0x1f0c64[_0x2412('0x24')]][_0x2412('0x2d')]=_0x1f0c64[_0x2412('0x2d')];this[_0x2412('0xc')][_0x1f0c64['uniqueid']]['status']=_0x1f0c64[_0x2412('0x2e')];this[_0x2412('0xc')][_0x1f0c64['uniqueid']][_0x2412('0x23')]=_0x1f0c64['localstationid'];this[_0x2412('0xc')][_0x1f0c64['uniqueid']]['filename']=_0x1f0c64[_0x2412('0x2f')];logger[_0x2412('0x27')](_0x1f0c64['uniqueid'],_0x2412('0x30'));}};Fax['prototype'][_0x2412('0x1b')]=function(_0xab4625){var _0x68dc5c=this;if(this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]]){var _0x56e696=this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]]['id'];this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]]['remotestationid']=_0xab4625[_0x2412('0x31')];this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]]['pagestransferred']=_0xab4625[_0x2412('0x32')];this['channels'][_0xab4625[_0x2412('0x24')]]['localstationid']=_0xab4625[_0x2412('0x23')];this['channels'][_0xab4625[_0x2412('0x24')]][_0x2412('0x33')]=_0xab4625[_0x2412('0x33')];this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]]['transferrate']=_0xab4625[_0x2412('0x34')];this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]][_0x2412('0x2f')]=_0xab4625[_0x2412('0x2f')];this[_0x2412('0xc')][_0xab4625[_0x2412('0x24')]][_0x2412('0x35')]=_0xab4625[_0x2412('0x35')];if(this[_0x2412('0xc')][_0xab4625['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0xab4625[_0x2412('0x2f')],_0x2412('0x36'),function(_0x1d5911){logger[_0x2412('0x27')](_0xab4625[_0x2412('0x24')],'\x20result\x20conversion\x20file\x20',_0x1d5911[_0x2412('0x37')]);attachment[_0x2412('0x38')]({'name':path[_0x2412('0x39')](_0xab4625[_0x2412('0x2f')])[_0x2412('0x26')],'basename':path[_0x2412('0x39')](_0xab4625['filename'])['name']+'.pdf','type':'application/pdf'})[_0x2412('0x3a')](function(_0x41b0be){faxAccount[_0x2412('0x3b')](_0x56e696,{'from':_0xab4625[_0x2412('0x35')],'mapKey':_0x2412('0x3c'),'body':path[_0x2412('0x39')](_0xab4625[_0x2412('0x2f')])[_0x2412('0x26')]+'.pdf','AttachmentId':_0x41b0be['id']})['catch'](function(_0x323e0c){logger[_0x2412('0x3d')](_0xab4625[_0x2412('0x24')],_0x2412('0x3e'),JSON['stringify'](_0x323e0c));});})[_0x2412('0x3f')](function(_0x259816){logger[_0x2412('0x3d')](_0xab4625[_0x2412('0x24')],'\x20receiveFax\x20',JSON[_0x2412('0x40')](_0x259816));});});}logger[_0x2412('0x27')](_0xab4625[_0x2412('0x24')],_0x2412('0x41'));}};Fax[_0x2412('0x1f')][_0x2412('0x1e')]=function(_0x4f0f74){if(this['actions'][_0x4f0f74[_0x2412('0x24')]]){_[_0x2412('0x42')](this[_0x2412('0xc')][_0x4f0f74[_0x2412('0x24')]],_[_0x2412('0x43')](_0x4f0f74,[_0x2412('0x44'),_0x2412('0x45')]));}};function updateStatus(_0x243162){if(_0x243162['AttachmentId']){faxMessage['update'](_0x243162[_0x2412('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2412('0x3a')](function(_0x35709e){ut[_0x2412('0x47')](_0x2412('0x48'),_0x35709e);})[_0x2412('0x3f')](function(_0x364017){ut[_0x2412('0x47')](_0x2412('0x49'),_0x364017);});}else{ut[_0x2412('0x47')](_0x2412('0x4a'));}}Fax[_0x2412('0x1f')][_0x2412('0x4b')]=function(_0x58e0af,_0x7cb6cc,_0x25a116){var _0x2035b5=this;var _0x55521b={};if(_0x7cb6cc){_0x55521b={'read':_0x7cb6cc};}else{_0x55521b={'failMessage':_0x25a116};}if(this[_0x2412('0xf')][_0x58e0af][_0x2412('0x46')]){faxMessage['update'](this[_0x2412('0xf')][_0x58e0af][_0x2412('0x46')],_0x55521b)[_0x2412('0x3a')](function(_0xd5628b){ut[_0x2412('0x47')]('[Fax][Message][Updated]',_0xd5628b);})[_0x2412('0x3f')](function(_0x91aa7d){ut[_0x2412('0x47')](_0x2412('0x4c'),_0x91aa7d);})[_0x2412('0x4d')](function(){delete _0x2035b5[_0x2412('0xc')][_0x58e0af];delete _0x2035b5['actions'][_0x58e0af];});}else{ut['logger'](_0x2412('0x4e'));delete this[_0x2412('0xc')][_0x58e0af];delete this[_0x2412('0xf')][_0x58e0af];}};Fax[_0x2412('0x1f')][_0x2412('0x4f')]=function(_0x172f45){var _0x27c14f=this;if(this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]]){if(this[_0x2412('0xf')][_0x172f45[_0x2412('0x24')]]){this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]]['id']=this[_0x2412('0xf')][_0x172f45[_0x2412('0x24')]]['id'];this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]][_0x2412('0x26')]=this['actions'][_0x172f45[_0x2412('0x24')]][_0x2412('0x26')];}logger[_0x2412('0x27')](_0x172f45[_0x2412('0x24')],this[_0x2412('0xf')][_0x172f45[_0x2412('0x24')]]?_0x2412('0x50'):_0x2412('0x51'),JSON[_0x2412('0x40')](this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]]));if(this[_0x2412('0xf')][_0x172f45[_0x2412('0x24')]]){if(this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]][_0x2412('0x52')]>0x0&&this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]][_0x2412('0x18')]==='SUCCESS'){this[_0x2412('0x4b')](_0x172f45[_0x2412('0x24')],!![]);}else{this[_0x2412('0x4b')](_0x172f45['uniqueid'],![],this[_0x2412('0xc')][_0x172f45['uniqueid']][_0x2412('0x53')]?_0x2412('0x54')+this[_0x2412('0xc')][_0x172f45[_0x2412('0x24')]][_0x2412('0x53')]:_0x2412('0x55'));}}}};Fax[_0x2412('0x1f')]['send']=function(_0x4d4958){var _0x56033e=this;return new BPromise(function(_0x301dab,_0x41a89f){_0x56033e[_0x2412('0x56')](_0x4d4958,_0x56033e[_0x2412('0xd')][_0x4d4958['FaxAccountId']])[_0x2412('0x3a')](function(_0x5465e5){ut[_0x2412('0x47')](_0x2412('0x57'),_0x5465e5);_0x301dab(ut[_0x2412('0x37')]('Fax\x20received'));})[_0x2412('0x3f')](function(_0x3c12c2){ut['logger'](_0x2412('0x58'),_0x3c12c2);updateStatus(_0x4d4958);_0x41a89f(ut['message']('Fax\x20failed'));});});};Fax[_0x2412('0x1f')][_0x2412('0x59')]=function(_0x833a55){var _0x2f33ad=this;return new BPromise(function(_0x317605,_0x367721){var _0x39311b=_0x2f33ad[_0x2412('0x5a')](_0x2f33ad['faxAccounts'][_0x833a55['FaxAccountId']][_0x2412('0x5b')],_0x833a55);if(_0x39311b['isValid']){_0x317605(ut[_0x2412('0x37')](_0x2412('0x5c')));}else{_0x367721(ut[_0x2412('0x37')](_0x39311b[_0x2412('0x37')]));}});};function originate(_0x20cc4f,_0xbca857,_0x2d9ba2){return new BPromise(function(_0x3b6483,_0x14be43){if(_0x2d9ba2){var _0x8859b9=util[_0x2412('0x5d')](_0x2412('0x5e'),path[_0x2412('0x39')](_0x20cc4f[_0x2412('0x3')])[_0x2412('0x26')],_0x20cc4f[_0x2412('0x3')]);gs[_0x2412('0x5f')](_0x8859b9)[_0x2412('0x3a')](function(){_0x20cc4f[_0x2412('0x3')]=util[_0x2412('0x5d')]('%s/%s.tif',path['parse'](_0x20cc4f[_0x2412('0x3')])['dir'],path[_0x2412('0x39')](_0x20cc4f[_0x2412('0x3')])[_0x2412('0x26')]);_0xbca857[_0x2412('0x60')]=_0x20cc4f['path'];ut[_0x2412('0x47')](_0x2412('0x61'),'');ami[_0x2412('0x62')](ut[_0x2412('0x63')](_0x20cc4f,_0xbca857))['then'](function(_0x5dc8dc){_0x3b6483(_0x5dc8dc);})['catch'](function(_0x82b280){_0x14be43(_0x82b280);});})[_0x2412('0x3f')](function(_0x4b6e39){_0x14be43(_0x4b6e39);});}else{ami[_0x2412('0x62')](ut[_0x2412('0x63')](_0x20cc4f,_0xbca857))[_0x2412('0x3a')](function(_0x2f7869){_0x3b6483(_0x2f7869);})[_0x2412('0x3f')](function(_0x1fd753){_0x14be43(_0x1fd753);});}});}Fax[_0x2412('0x1f')][_0x2412('0x56')]=function(_0x262289,_0x4ade39){var _0x259002=this;return new BPromise(function(_0x54e2f1,_0x56d6bb){var _0x3e7c58=uuid['v4']();var _0x458645=ut[_0x2412('0x64')](_0x262289,_0x4ade39);_0x259002[_0x2412('0xf')][_0x3e7c58]=new Action(_0x3e7c58,_0x4ade39,_0x262289);var _0x580159=_0x259002['actions'][_0x3e7c58];if(path['parse'](_0x262289[_0x2412('0x3')])[_0x2412('0x65')]==='.pdf'){originate(_0x580159,_0x458645,!![])[_0x2412('0x3a')](function(_0x4a7c97){_0x54e2f1(_0x4a7c97);})[_0x2412('0x3f')](function(_0xc9b98e){_0x56d6bb(_0xc9b98e);});}else{originate(_0x580159,_0x458645,![])[_0x2412('0x3a')](function(_0xbb5b87){_0x54e2f1(_0xbb5b87);})[_0x2412('0x3f')](function(_0x13002e){_0x56d6bb(_0x13002e);});}});};Fax[_0x2412('0x1f')]['isTrunkReachable']=function(_0x5551b0){return!_[_0x2412('0x66')](_0x5551b0)&&!_[_0x2412('0x66')](_0x5551b0[_0x2412('0x26')])&&!_['isNil'](_0x5551b0[_0x2412('0x67')])&&_0x5551b0[_0x2412('0x67')]&&!_[_0x2412('0x66')](this[_0x2412('0xe')][util[_0x2412('0x5d')](_0x2412('0x68'),_0x5551b0['name'])])&&!_[_0x2412('0x66')](this[_0x2412('0xe')][util[_0x2412('0x5d')](_0x2412('0x68'),_0x5551b0[_0x2412('0x26')])][_0x2412('0x2e')])&&(this['trunks'][util[_0x2412('0x5d')](_0x2412('0x68'),_0x5551b0[_0x2412('0x26')])][_0x2412('0x2e')]==='reachable'||this[_0x2412('0xe')][util[_0x2412('0x5d')](_0x2412('0x68'),_0x5551b0[_0x2412('0x26')])]['status']===_0x2412('0x69'));};Fax[_0x2412('0x1f')][_0x2412('0x5a')]=function(_0x496075,_0x379b0d){if(!this[_0x2412('0x6a')](_0x496075)){ut[_0x2412('0x47')](_0x2412('0x6b'),_[_0x2412('0x66')](_0x496075)?'':_0x496075['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x2412('0x6c')};}if(_['isNil'](_0x379b0d['fax'])){ut['logger'](_0x2412('0x6d'),JSON[_0x2412('0x40')](_0x379b0d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2412('0x66')](_0x379b0d[_0x2412('0x3')])){ut[_0x2412('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x2412('0x40')](_0x379b0d));return{'isValid':![],'message':_0x2412('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2412('0x6f')]=Fax; \ No newline at end of file +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 diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 19932b3..3ebaf23 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 _0xc9e4=['lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x39c51e,_0x2cd366){var _0x595842=function(_0x59d47e){while(--_0x59d47e){_0x39c51e['push'](_0x39c51e['shift']());}};_0x595842(++_0x2cd366);}(_0xc9e4,0x1a0));var _0x4c9e=function(_0x5b21c9,_0x4352ef){_0x5b21c9=_0x5b21c9-0x0;var _0x241785=_0xc9e4[_0x5b21c9];return _0x241785;};'use strict';var util=require(_0x4c9e('0x0'));var BPromise=require(_0x4c9e('0x1'));var logger=require(_0x4c9e('0x2'))(_0x4c9e('0x3'));var _=require(_0x4c9e('0x4'));var faxAccount=require(_0x4c9e('0x5'));function loggerCatch(_0x288102){return function(_0x1d8ee2){logger[_0x4c9e('0x6')](_0x288102,util[_0x4c9e('0x7')](_0x1d8ee2,{'showHidden':![],'depth':null}));};}exports[_0x4c9e('0x8')]=function(_0x35916c,_0x782f6e){return BPromise['resolve']()[_0x4c9e('0x9')](faxAccount[_0x4c9e('0x8')](_0x35916c,_0x782f6e))[_0x4c9e('0xa')](loggerCatch(_0x4c9e('0xb')));}; \ No newline at end of file +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 diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index b74aaf9..3f20d2d 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 _0x223c=['util','../../../../config/logger','bluebird','child_process','execute','Exec\x20gs','info','\x20Error\x20:'];(function(_0xa97e74,_0x17c03a){var _0x399b97=function(_0x136846){while(--_0x136846){_0xa97e74['push'](_0xa97e74['shift']());}};_0x399b97(++_0x17c03a);}(_0x223c,0x170));var _0xc223=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x223c[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0xc223('0x0'));var logger=require(_0xc223('0x1'))('fax');var BPromise=require(_0xc223('0x2'));var exec=require(_0xc223('0x3'))['exec'];exports[_0xc223('0x4')]=function(_0x15886c){return new BPromise(function(_0x4353d8,_0x375568){exec(_0x15886c,function(_0x1ac8e4,_0x199545,_0x343c9a){logger['info'](_0xc223('0x5'),_0x199545);if(_0x1ac8e4){logger[_0xc223('0x6')](_0xc223('0x5'),_0xc223('0x7'),util['inspect'](_0x1ac8e4,{'showHidden':![],'depth':null}),_0x199545,_0x343c9a);_0x375568(_0x1ac8e4);}_0x4353d8(_0x199545);});});}; \ No newline at end of file +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 diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 91cf210..88f9c07 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 _0x2a8d=['uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','localstationid','lodash','moment','fax','message','logger','info','inspect','headerinfo','minrate','maxrate','modem','gateway','faxdetect','path'];(function(_0x411c2e,_0x4ece66){var _0x5ed361=function(_0x193b6c){while(--_0x193b6c){_0x411c2e['push'](_0x411c2e['shift']());}};_0x5ed361(++_0x4ece66);}(_0x2a8d,0xce));var _0xd2a8=function(_0x1cd7f1,_0x44236f){_0x1cd7f1=_0x1cd7f1-0x0;var _0x5adfde=_0x2a8d[_0x1cd7f1];return _0x5adfde;};'use strict';var util=require('util');var _=require(_0xd2a8('0x0'));var moment=require(_0xd2a8('0x1'));var logger=require('../../../../config/logger')(_0xd2a8('0x2'));exports[_0xd2a8('0x3')]=function(_0x48b351){return{'message':_0x48b351};};exports[_0xd2a8('0x4')]=function(_0x5e3abb,_0x2cce1d){logger[_0xd2a8('0x5')](_0x5e3abb,util[_0xd2a8('0x6')](_0x2cce1d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5dd142,_0x116edd){var _0x143bf1={'XMF-ECM':_0x116edd['ecm'],'XMF-HEADERINFO':_0x116edd[_0xd2a8('0x7')],'XMF-MINRATE':_0x116edd[_0xd2a8('0x8')],'XMF-MAXRATE':_0x116edd[_0xd2a8('0x9')],'XMF-MODEM':util['format']('\x22%s\x22',_0x116edd[_0xd2a8('0xa')]),'XMF-GATEWAY':_0x116edd[_0xd2a8('0xb')],'XMF-FAXDETECT':_0x116edd[_0xd2a8('0xc')],'XMF-T38TIMEOUT':_0x116edd['t38timeout'],'XMF-LOCALSTATIONID':_0x116edd['localstationid'],'XMF-PATH':_0x5dd142[_0xd2a8('0xd')]};return _0x143bf1;};exports['variablesAction']=function(_0x55ff08,_0x1a0747){return{'actionid':_0x55ff08[_0xd2a8('0xe')],'action':_0xd2a8('0xf'),'channel':_0x55ff08[_0xd2a8('0x10')],'Exten':_0xd2a8('0x11'),'Context':_0xd2a8('0x12'),'Priority':'1','callerid':util[_0xd2a8('0x13')](_0xd2a8('0x14'),_0x55ff08[_0xd2a8('0x7')]?_0x55ff08[_0xd2a8('0x7')]:'',_0x55ff08[_0xd2a8('0x15')]),'variable':_0x1a0747,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x55ff08[_0xd2a8('0xe')]};}; \ No newline at end of file +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 diff --git a/server/services/ami/index.js b/server/services/ami/index.js index c40357c..0604852 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 _0xcbe0=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','inspect','listen','sync','catch','[index.js][main]','util','./server','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','initAgents','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xcbe0,0x10a));var _0x0cbe=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xcbe0[_0x1b70e3];return _0x1452ab;};'use strict';var util=require(_0x0cbe('0x0'));var moment=require('moment');var server=require(_0x0cbe('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x0cbe('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x0cbe('0x3'));var Preview=require(_0x0cbe('0x4'));var Fax=require(_0x0cbe('0x5'));var user=require(_0x0cbe('0x6'));var voiceQueue=require(_0x0cbe('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0cbe('0x8'));var trunk=require(_0x0cbe('0x9'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0cbe('0xa'));var faxAccount=require(_0x0cbe('0xb'));var zendesk=require(_0x0cbe('0xc'));var salesforce=require(_0x0cbe('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0cbe('0xe'));var desk=require(_0x0cbe('0xf'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x0cbe('0x10'));var freshsales=require(_0x0cbe('0x11'));var servicenow=require(_0x0cbe('0x12'));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(_0x0cbe('0x13'))(_0x0cbe('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0cbe('0x15')](_0x0cbe('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x0cbe('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0cbe('0x17')]()[_0x0cbe('0x18')](user['getAgents']())[_0x0cbe('0x18')](realtime[_0x0cbe('0x19')]())[_0x0cbe('0x18')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x0cbe('0x18')](trunk[_0x0cbe('0x1a')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x1b')]())[_0x0cbe('0x18')](voiceQueue['getVoiceQueues']())[_0x0cbe('0x18')](realtime[_0x0cbe('0x1c')]())[_0x0cbe('0x18')](trigger['getTriggers']())['then'](realtime[_0x0cbe('0x1d')]())[_0x0cbe('0x18')](template[_0x0cbe('0x1e')]())[_0x0cbe('0x18')](realtime['initTemplates']())[_0x0cbe('0x18')](zendesk['getZendeskAccounts']())[_0x0cbe('0x18')](realtime['initZendeskAccounts']())['then'](salesforce['getSalesforceAccounts']())[_0x0cbe('0x18')](realtime[_0x0cbe('0x1f')]())[_0x0cbe('0x18')](sugarcrm[_0x0cbe('0x20')]())['then'](realtime['initSugarcrmAccounts']())[_0x0cbe('0x18')](freshdesk['getFreshdeskAccounts']())[_0x0cbe('0x18')](realtime[_0x0cbe('0x21')]())[_0x0cbe('0x18')](desk[_0x0cbe('0x22')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x23')]())[_0x0cbe('0x18')](zoho[_0x0cbe('0x24')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x25')]())[_0x0cbe('0x18')](vtiger[_0x0cbe('0x26')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x27')]())[_0x0cbe('0x18')](freshsales[_0x0cbe('0x28')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x29')]())['then'](servicenow[_0x0cbe('0x2a')]())['then'](realtime[_0x0cbe('0x2b')]())[_0x0cbe('0x18')](dynamics365[_0x0cbe('0x2c')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x2d')]())['then'](campaign[_0x0cbe('0x2e')]())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0x0cbe('0x2f')]())[_0x0cbe('0x18')](realtime[_0x0cbe('0x30')]())[_0x0cbe('0x18')](faxAccount['getFaxAccounts']())[_0x0cbe('0x18')](realtime[_0x0cbe('0x31')]())[_0x0cbe('0x18')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x0cbe('0x32')]())['then'](realtime[_0x0cbe('0x33')]())['then'](cmHopperHistory[_0x0cbe('0x34')]())[_0x0cbe('0x18')](realtime['initVoiceQueueHopperHistory']())[_0x0cbe('0x18')](cmHopperHistory['getCampaignHopperHistory']())[_0x0cbe('0x18')](realtime[_0x0cbe('0x35')]())[_0x0cbe('0x18')](voiceCallReport[_0x0cbe('0x36')]())['then'](realtime[_0x0cbe('0x37')]())['catch'](function(_0x19da58){logger[_0x0cbe('0x38')]('[index.js][initParams]',util[_0x0cbe('0x39')](_0x19da58,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0cbe('0x3a')](realtime,preview,fax)[_0x0cbe('0x18')](function(){return initRealtime();})[_0x0cbe('0x18')](function(){return initParams();})[_0x0cbe('0x18')](function(){report[_0x0cbe('0x3b')]();setInterval(initRealtime,0x1388);})[_0x0cbe('0x3c')](function(_0x1b8183){logger[_0x0cbe('0x38')](_0x0cbe('0x3d'),util[_0x0cbe('0x39')](_0x1b8183,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +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 diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 9fba2e5..6717fe3 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 _0x18a5=['redis','localhost','socket.io-emitter','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','voiceStatus','toNumber','format','name','voiceStatusTime','user:%s','emit','user:ami:update','exports','lodash','util','../../../config/environment','defaults'];(function(_0x587f5a,_0x4aafbf){var _0x3d58e5=function(_0x542375){while(--_0x542375){_0x587f5a['push'](_0x587f5a['shift']());}};_0x3d58e5(++_0x4aafbf);}(_0x18a5,0x164));var _0x518a=function(_0x5be4df,_0x9c94dd){_0x5be4df=_0x5be4df-0x0;var _0x243cd6=_0x18a5[_0x5be4df];return _0x243cd6;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x518a('0x2'));config['redis']=_[_0x518a('0x3')](config[_0x518a('0x4')],{'host':_0x518a('0x5'),'port':0x18eb});var io=require(_0x518a('0x6'))(new Redis(config[_0x518a('0x4')]));function Agent(_0x5e2771){this['id']=_0x5e2771['id']||0x0;this['name']=_0x5e2771['name']||'';this[_0x518a('0x7')]=_0x5e2771[_0x518a('0x7')]||'';this[_0x518a('0x8')]=_0x5e2771[_0x518a('0x8')]||'';this[_0x518a('0x9')]=_0x5e2771[_0x518a('0x9')]||'';this[_0x518a('0xa')]=_0x518a('0xb');this[_0x518a('0xc')]=0x0;this[_0x518a('0xd')]=_0x518a('0xb');this[_0x518a('0xe')]='';this[_0x518a('0xf')]='';this[_0x518a('0x10')]='';this[_0x518a('0x11')]='';this['online']=_0x5e2771[_0x518a('0x12')]||![];this['voiceStatus']=_0x518a('0xb');this['voiceStatusTime']=0x0;this[_0x518a('0x13')]='';this[_0x518a('0x14')]='';this[_0x518a('0x15')]=![];this[_0x518a('0x16')]=![];}Agent[_0x518a('0x17')][_0x518a('0x18')]=function(_0x3aa005){if(!_0x3aa005['state']){return;}var _0x19586d=null;var _0x7e2a04=_0x3aa005[_0x518a('0xa')]['toLowerCase']();switch(_0x7e2a04){case _0x518a('0x19'):_0x7e2a04=_0x518a('0x1a');break;case'inuse':_0x7e2a04='talking';break;}if(this[_0x518a('0x1b')]!==_0x7e2a04||_0x3aa005['statePause']){_0x19586d=_[_0x518a('0x1c')](moment()[_0x518a('0x1d')]('x'));}var _0x244e66={'id':this['id'],'name':this[_0x518a('0x1e')],'email':this[_0x518a('0x7')],'accountcode':this[_0x518a('0x8')],'fullname':this[_0x518a('0x9')],'state':this[_0x518a('0xa')],'stateTime':this[_0x518a('0xc')],'status':this[_0x518a('0xd')],'address':this[_0x518a('0xe')],'voiceStatus':_0x7e2a04||this[_0x518a('0x1b')],'voiceStatusTime':_0x19586d||this[_0x518a('0x1f')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x518a('0x14')],'interface':this['interface'],'onhold':this[_0x518a('0x15')]};if(this['voiceStatus']!==_0x7e2a04){this[_0x518a('0x1b')]=_0x7e2a04;io['to'](util[_0x518a('0x1d')](_0x518a('0x20'),_0x244e66[_0x518a('0x1e')]))[_0x518a('0x21')](_0x518a('0x22'),_0x244e66);io['emit']('user:presence',_0x244e66);}};module[_0x518a('0x23')]=Agent; \ No newline at end of file +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 diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 45eeb2d..41f7675 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 _0xe761=['DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0xe761,0xfe));var _0x1e76=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe761[_0x5ddb1c];return _0x354adc;};'use strict';function Campaign(_0x47d719){this['id']=_0x47d719['id']||0x0;this[_0x1e76('0x0')]=_0x47d719[_0x1e76('0x0')]||'';this['type']=_0x47d719[_0x1e76('0x1')]||_0x1e76('0x2');this[_0x1e76('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x1e76('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this['active']=_0x47d719[_0x1e76('0x5')];this[_0x1e76('0x6')]=_0x47d719[_0x1e76('0x6')];this[_0x1e76('0x7')]=_0x47d719[_0x1e76('0x7')]||null;this['dialGlobalInterval']=_0x47d719[_0x1e76('0x8')]?_0x47d719['dialGlobalInterval']:null;this[_0x1e76('0x9')]=_0x47d719['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x47d719[_0x1e76('0xa')];this['dialOriginateTimeout']=_0x47d719['dialOriginateTimeout']||0x1e;this[_0x1e76('0xb')]=_0x47d719[_0x1e76('0xb')];this[_0x1e76('0xc')]=_0x47d719[_0x1e76('0xc')];this[_0x1e76('0xd')]=_0x47d719[_0x1e76('0xd')];this['dialBusyRetryFrequency']=_0x47d719[_0x1e76('0xe')];this['dialNoAnswerMaxRetry']=_0x47d719[_0x1e76('0xf')];this[_0x1e76('0x10')]=_0x47d719[_0x1e76('0x10')];this[_0x1e76('0x11')]=_0x47d719['dialGlobalMaxRetry'];this[_0x1e76('0x12')]=_0x47d719[_0x1e76('0x12')]||0x3;this[_0x1e76('0x13')]=_0x47d719[_0x1e76('0x13')]||0x96;this[_0x1e76('0x14')]=_0x47d719[_0x1e76('0x14')]||0x3;this[_0x1e76('0x15')]=_0x47d719['dialDropRetryFrequency']||0x96;this[_0x1e76('0x16')]=_0x47d719[_0x1e76('0x16')]||0x3;this[_0x1e76('0x17')]=_0x47d719[_0x1e76('0x17')]||0x96;this['dialMachineMaxRetry']=_0x47d719['dialMachineMaxRetry']||0x3;this[_0x1e76('0x18')]=_0x47d719['dialMachineRetryFrequency']||0x96;this[_0x1e76('0x19')]=_0x47d719['dialAgentRejectMaxRetry']||0x3;this[_0x1e76('0x1a')]=_0x47d719[_0x1e76('0x1a')]||0x96;this[_0x1e76('0x1b')]=_0x47d719[_0x1e76('0x1b')]||_0x1e76('0x1c');this[_0x1e76('0x1d')]=_0x47d719[_0x1e76('0x1d')]||undefined;this[_0x1e76('0x1e')]=_0x47d719['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1e76('0x1f')]=_0x47d719[_0x1e76('0x1f')]||undefined;this['TrunkBackup']=_0x47d719[_0x1e76('0x20')]?_0x47d719[_0x1e76('0x20')]:undefined;this[_0x1e76('0x21')]=_0x47d719[_0x1e76('0x21')]?_0x47d719[_0x1e76('0x21')]:undefined;this[_0x1e76('0x22')]=_0x47d719[_0x1e76('0x22')]?_0x47d719['Interval']:undefined;this[_0x1e76('0x23')]=_0x47d719[_0x1e76('0x23')]?_0x47d719[_0x1e76('0x23')]:undefined;this[_0x1e76('0x24')]=_0x47d719[_0x1e76('0x23')]?_0x47d719[_0x1e76('0x23')]['name']:undefined;this['dialAMDActive']=_0x47d719['dialAMDActive']||![];this[_0x1e76('0x25')]=_0x47d719[_0x1e76('0x25')];this[_0x1e76('0x26')]=_0x47d719[_0x1e76('0x26')];this[_0x1e76('0x27')]=_0x47d719[_0x1e76('0x27')];this[_0x1e76('0x28')]=_0x47d719['dialAMDTotalAnalysisTime'];this[_0x1e76('0x29')]=_0x47d719['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x47d719[_0x1e76('0x2a')];this[_0x1e76('0x2b')]=_0x47d719[_0x1e76('0x2b')];this['dialAMDSilenceThreshold']=_0x47d719[_0x1e76('0x2c')];this[_0x1e76('0x2d')]=_0x47d719[_0x1e76('0x2d')];}module[_0x1e76('0x2e')]=Campaign; \ No newline at end of file +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 diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e3fdeb9..ef6436a 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 _0xd844=['uniqueid','linkedid','answered','unmanaged','lastdata','duration','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','accountcode','context'];(function(_0x4eedda,_0x4f1f2c){var _0x859f0=function(_0x177cb6){while(--_0x177cb6){_0x4eedda['push'](_0x4eedda['shift']());}};_0x859f0(++_0x4f1f2c);}(_0xd844,0x6d));var _0x4d84=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd844[_0x57b54c];return _0x59cc19;};'use strict';function Channel(){this[_0x4d84('0x0')]=null;this[_0x4d84('0x1')]='';this['destinationchannel']='';this[_0x4d84('0x2')]=0x0;this[_0x4d84('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x4d84('0x4')]=0x0;this[_0x4d84('0x5')]='';this[_0x4d84('0x6')]=0x0;this[_0x4d84('0x7')]=0x0;this['exten']=0x0;this[_0x4d84('0x8')]=![];this['answertime']=null;this['endtime']=null;this[_0x4d84('0x9')]=![];this['abandoned']=![];this['lastapplication']='';this[_0x4d84('0xa')]='';this[_0x4d84('0xb')]=0x0;this['billableseconds']=0x0;this[_0x4d84('0xc')]=0x0;this['type']=null;this[_0x4d84('0xd')]=null;this[_0x4d84('0xe')]=null;this[_0x4d84('0xf')]=![];this['monitorFilename']=null;this[_0x4d84('0x10')]=null;this[_0x4d84('0x11')]=[];this[_0x4d84('0x12')]=undefined;this[_0x4d84('0x13')]=undefined;this[_0x4d84('0x14')]=undefined;this[_0x4d84('0x15')]=0x0;}module[_0x4d84('0x16')]=Channel; \ No newline at end of file +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 diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ce721ff..c4d68df 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 _0x1a59=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x4613d1,_0x2363b6){var _0x59fbe7=function(_0x2dbd7a){while(--_0x2dbd7a){_0x4613d1['push'](_0x4613d1['shift']());}};_0x59fbe7(++_0x2363b6);}(_0x1a59,0x75));var _0x91a5=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0x1a59[_0x4e0c31];return _0x3fd7df;};'use strict';function DeskAccount(_0x420c7c){this['id']=_0x420c7c['id']||0x0;this[_0x91a5('0x0')]=_0x420c7c[_0x91a5('0x0')]||'';this[_0x91a5('0x1')]=_0x420c7c[_0x91a5('0x1')]||'';this['remoteUri']=_0x420c7c[_0x91a5('0x2')]||'';this[_0x91a5('0x3')]=_0x420c7c[_0x91a5('0x3')]||'';this[_0x91a5('0x4')]=_0x420c7c['password']||'';this[_0x91a5('0x5')]=_0x420c7c[_0x91a5('0x5')]||'';this['consumerSecret']=_0x420c7c[_0x91a5('0x6')]||'';this[_0x91a5('0x7')]=_0x420c7c['token']||'';this[_0x91a5('0x8')]=_0x420c7c['tokenSecret']||'';this[_0x91a5('0x9')]=_0x420c7c[_0x91a5('0x9')]||'';this[_0x91a5('0xa')]=_0x420c7c[_0x91a5('0xa')]||'';this[_0x91a5('0xb')]=_0x420c7c[_0x91a5('0xb')]||{};}module[_0x91a5('0xc')]=DeskAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index eb462e5..a1b4d3f 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 _0xbdd5=['exports','name','username','password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0xbdd5,0xdd));var _0x5bdd=function(_0xc44a64,_0x4e5aa5){_0xc44a64=_0xc44a64-0x0;var _0x348b8c=_0xbdd5[_0xc44a64];return _0x348b8c;};'use strict';function Dynamics365Account(_0x2ace72){this['id']=_0x2ace72['id']||0x0;this[_0x5bdd('0x0')]=_0x2ace72['name']||'';this[_0x5bdd('0x1')]=_0x2ace72[_0x5bdd('0x1')]||'';this[_0x5bdd('0x2')]=_0x2ace72[_0x5bdd('0x2')]||'';this['remoteUri']=_0x2ace72[_0x5bdd('0x3')]||'';this['tenantId']=_0x2ace72['tenantId']||'';this[_0x5bdd('0x4')]=_0x2ace72[_0x5bdd('0x4')]||'';this[_0x5bdd('0x5')]=_0x2ace72[_0x5bdd('0x5')]||{};this[_0x5bdd('0x6')]=_0x2ace72[_0x5bdd('0x6')]||'';this['modernAuthentication']=_0x2ace72[_0x5bdd('0x7')]||![];this[_0x5bdd('0x8')]=_0x2ace72[_0x5bdd('0x8')]||{};this[_0x5bdd('0x9')]=_0x2ace72[_0x5bdd('0x9')]||{};}module[_0x5bdd('0xa')]=Dynamics365Account; \ No newline at end of file +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 diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 28e4750..7142d7b 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 _0x4554=['modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x4554,0x179));var _0x4455=function(_0x5f4cb0,_0x195816){_0x5f4cb0=_0x5f4cb0-0x0;var _0x353b22=_0x4554[_0x5f4cb0];return _0x353b22;};'use strict';function FaxAccount(_0x58b359){this['id']=_0x58b359['id']||0x0;this[_0x4455('0x0')]=_0x58b359['name']||'';this[_0x4455('0x1')]=_0x58b359[_0x4455('0x1')];this[_0x4455('0x2')]=_0x58b359[_0x4455('0x2')];this['headerinfo']=_0x58b359[_0x4455('0x3')];this[_0x4455('0x4')]=_0x58b359['localstationid'];this[_0x4455('0x5')]=_0x58b359['minrate']||0x960;this[_0x4455('0x6')]=_0x58b359[_0x4455('0x6')]||0x3840;this[_0x4455('0x7')]=_0x58b359[_0x4455('0x7')]||_0x4455('0x8');this['gateway']=_0x58b359[_0x4455('0x9')]||'no';this[_0x4455('0xa')]=_0x58b359[_0x4455('0xa')]||'no';this['t38timeout']=_0x58b359['t38timeout']||0x1388;this[_0x4455('0xb')]=_0x58b359[_0x4455('0xb')]||_0x4455('0xc');this[_0x4455('0xd')]=_0x58b359['Trunk']?_0x58b359[_0x4455('0xd')]:undefined;this[_0x4455('0xe')]=_0x58b359[_0x4455('0xe')];this['key']=_0x58b359['key'];}module[_0x4455('0xf')]=FaxAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 306f116..3ee528b 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 _0x3dcb=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x33def1,_0x222885){var _0x3d8078=function(_0x324347){while(--_0x324347){_0x33def1['push'](_0x33def1['shift']());}};_0x3d8078(++_0x222885);}(_0x3dcb,0x89));var _0xb3dc=function(_0x2ea28c,_0x513dbb){_0x2ea28c=_0x2ea28c-0x0;var _0x121590=_0x3dcb[_0x2ea28c];return _0x121590;};'use strict';function FreshdeskAccount(_0x49f74d){this['id']=_0x49f74d['id']||0x0;this[_0xb3dc('0x0')]=_0x49f74d[_0xb3dc('0x0')]||'';this[_0xb3dc('0x1')]=_0x49f74d['username']||'';this[_0xb3dc('0x2')]=_0x49f74d[_0xb3dc('0x3')]||'';this[_0xb3dc('0x4')]=_0x49f74d['remoteUri']||'';this[_0xb3dc('0x5')]=_0x49f74d['serverUrl']||'';this[_0xb3dc('0x6')]=_0x49f74d[_0xb3dc('0x6')]||{};}module[_0xb3dc('0x7')]=FreshdeskAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5d60879..e30835f 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 _0xba18=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x45dace,_0x26f83f){var _0x318da5=function(_0x1c9979){while(--_0x1c9979){_0x45dace['push'](_0x45dace['shift']());}};_0x318da5(++_0x26f83f);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';function FreshsalesAccount(_0x45d612){this['id']=_0x45d612['id']||0x0;this[_0x8ba1('0x0')]=_0x45d612[_0x8ba1('0x0')]||'';this[_0x8ba1('0x1')]=_0x45d612[_0x8ba1('0x1')]||'';this[_0x8ba1('0x2')]=_0x45d612[_0x8ba1('0x3')]||'';this[_0x8ba1('0x4')]=_0x45d612['remoteUri']||'';this[_0x8ba1('0x5')]=_0x45d612[_0x8ba1('0x5')]||'';this[_0x8ba1('0x6')]=_0x45d612[_0x8ba1('0x6')]||{};}module[_0x8ba1('0x7')]=FreshsalesAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8118d16..672ee98 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 _0x7c2a=['queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','priority','holdtime','assigned','lastAssignedTo','motionChannel','routealias','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0xedb90b,_0x6ef085){var _0x3dace9=function(_0x3a7848){while(--_0x3a7848){_0xedb90b['push'](_0xedb90b['shift']());}};_0x3dace9(++_0x6ef085);}(_0x7c2a,0xcd));var _0xa7c2=function(_0x19bdac,_0x3d7a18){_0x19bdac=_0x19bdac-0x0;var _0x3fad11=_0x7c2a[_0x19bdac];return _0x3fad11;};'use strict';function QueueReport(){this['type']=_0xa7c2('0x0');this[_0xa7c2('0x1')]='';this[_0xa7c2('0x2')]='';this[_0xa7c2('0x3')]='';this[_0xa7c2('0x4')]='';this[_0xa7c2('0x5')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xa7c2('0x6')]=0x1;this[_0xa7c2('0x7')]=![];this[_0xa7c2('0x8')]=null;this[_0xa7c2('0x9')]=![];this[_0xa7c2('0xa')]=null;this[_0xa7c2('0xb')]=![];this[_0xa7c2('0xc')]=null;this['originalposition']=0x1;this[_0xa7c2('0xd')]='';this[_0xa7c2('0xe')]='';this[_0xa7c2('0xf')]='';this['accountcode']='';this[_0xa7c2('0x10')]='';this['exten']='';this[_0xa7c2('0x11')]='';this[_0xa7c2('0x12')]=0x0;this[_0xa7c2('0x13')]=![];this[_0xa7c2('0x14')]='';this[_0xa7c2('0x15')]='voice';this[_0xa7c2('0x16')]=null;this['mohtime']=0x0;this['variables']={};}module[_0xa7c2('0x17')]=QueueReport; \ No newline at end of file +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 diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 4196c63..74cc271 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 _0x9ea6=['type','integrationTab','serverUrl','Configurations','exports','name','remoteUri','clientId','securityToken'];(function(_0x1e474e,_0x2f200f){var _0x5b3921=function(_0x10c49d){while(--_0x10c49d){_0x1e474e['push'](_0x1e474e['shift']());}};_0x5b3921(++_0x2f200f);}(_0x9ea6,0x15b));var _0x69ea=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9ea6[_0x2641f9];return _0x585741;};'use strict';function SalesforceAccount(_0x203324){this['id']=_0x203324['id']||0x0;this[_0x69ea('0x0')]=_0x203324['name']||'';this['username']=_0x203324['username']||'';this[_0x69ea('0x1')]=_0x203324[_0x69ea('0x1')]||'';this['password']=_0x203324['password']||'';this['clientId']=_0x203324[_0x69ea('0x2')]||'';this['clientSecret']=_0x203324['clientSecret']||'';this[_0x69ea('0x3')]=_0x203324['securityToken']||'';this[_0x69ea('0x4')]=_0x203324['type']||_0x69ea('0x5');this[_0x69ea('0x6')]=_0x203324['serverUrl']||'';this[_0x69ea('0x7')]=_0x203324[_0x69ea('0x7')]||{};}module[_0x69ea('0x8')]=SalesforceAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 97790ad..e400e22 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 _0xf9c9=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x444e58,_0x577980){var _0x517d8f=function(_0xdb5e57){while(--_0xdb5e57){_0x444e58['push'](_0x444e58['shift']());}};_0x517d8f(++_0x577980);}(_0xf9c9,0x18c));var _0x9f9c=function(_0x5a5c6b,_0x5baa12){_0x5a5c6b=_0x5a5c6b-0x0;var _0x5e24fc=_0xf9c9[_0x5a5c6b];return _0x5e24fc;};'use strict';function ServicenowAccount(_0xf4d4a9){this['id']=_0xf4d4a9['id']||0x0;this[_0x9f9c('0x0')]=_0xf4d4a9[_0x9f9c('0x0')]||'';this[_0x9f9c('0x1')]=_0xf4d4a9[_0x9f9c('0x1')]||'';this[_0x9f9c('0x2')]=_0xf4d4a9[_0x9f9c('0x2')]||'';this[_0x9f9c('0x3')]=_0xf4d4a9['remoteUri']||'';this[_0x9f9c('0x4')]=_0xf4d4a9['serverUrl']||'';this[_0x9f9c('0x5')]=_0xf4d4a9[_0x9f9c('0x5')]||{};}module[_0x9f9c('0x6')]=ServicenowAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 47b295f..90f175e 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 _0x4bbd=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x287605,_0x51015f){var _0x4ce75d=function(_0x623025){while(--_0x623025){_0x287605['push'](_0x287605['shift']());}};_0x4ce75d(++_0x51015f);}(_0x4bbd,0xa7));var _0xd4bb=function(_0x4a8b5a,_0x2b9cfe){_0x4a8b5a=_0x4a8b5a-0x0;var _0x2824ca=_0x4bbd[_0x4a8b5a];return _0x2824ca;};'use strict';function SugarcrmAccount(_0x1c3175){this['id']=_0x1c3175['id']||0x0;this[_0xd4bb('0x0')]=_0x1c3175[_0xd4bb('0x0')]||'';this[_0xd4bb('0x1')]=_0x1c3175[_0xd4bb('0x1')]||'';this['password']=_0x1c3175['password']||'';this['remoteUri']=_0x1c3175[_0xd4bb('0x2')]||'';this[_0xd4bb('0x3')]=_0x1c3175['serverUrl']||'';this[_0xd4bb('0x4')]=_0x1c3175['Configurations']||{};}module[_0xd4bb('0x5')]=SugarcrmAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 9a2d8c7..97ed068 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 _0x4dc0=['accountcode','state','unknown','status','address','name'];(function(_0x17ce52,_0x174d05){var _0x468524=function(_0x5c44b5){while(--_0x5c44b5){_0x17ce52['push'](_0x17ce52['shift']());}};_0x468524(++_0x174d05);}(_0x4dc0,0x13d));var _0x04dc=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x4dc0[_0x49ca18];return _0x145d54;};'use strict';function Telephone(_0x23eacc){this['id']=_0x23eacc['id']||0x0;this['name']=_0x23eacc[_0x04dc('0x0')]||'';this[_0x04dc('0x1')]=_0x23eacc[_0x04dc('0x1')]||'';this[_0x04dc('0x2')]=_0x04dc('0x3');this['stateTime']=0x0;this[_0x04dc('0x4')]=_0x04dc('0x3');this[_0x04dc('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +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 diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index d3d636f..2873949 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(_0xb0a7fc,_0x3c0fad){var _0x13515a=function(_0x4aaa77){while(--_0x4aaa77){_0xb0a7fc['push'](_0xb0a7fc['shift']());}};_0x13515a(++_0x3c0fad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_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 diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 49bdfbc..4b382c4 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x0b0e[_0x45bf86];return _0x1f02b7;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6e9ea7c..19f1726 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 _0xb222=['port','domainport','refresh','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','registry','indexOf','split','host'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb222,0xab));var _0x2b22=function(_0x549261,_0xa94e1e){_0x549261=_0x549261-0x0;var _0x3366c5=_0xb222[_0x549261];return _0x3366c5;};'use strict';function Trunk(_0x189ad8){this['id']=_0x189ad8['id']||0x0;this[_0x2b22('0x0')]=_0x189ad8[_0x2b22('0x0')]||![];this['name']=_0x189ad8[_0x2b22('0x1')]||'';this['state']=_0x2b22('0x2');this[_0x2b22('0x3')]=0x0;this[_0x2b22('0x4')]=_0x2b22('0x2');this[_0x2b22('0x5')]=_0x189ad8[_0x2b22('0x5')]&&_0x189ad8[_0x2b22('0x5')][_0x2b22('0x6')](':')?_0x189ad8[_0x2b22('0x5')][_0x2b22('0x7')](':')[0x0]:'';this[_0x2b22('0x8')]='';this[_0x2b22('0x9')]='';this['domain']='';this[_0x2b22('0xa')]='';this[_0x2b22('0xb')]='';this['stateRegistry']='unknown';this[_0x2b22('0xc')]='';this[_0x2b22('0xd')]='';this[_0x2b22('0xe')]=_0x189ad8[_0x2b22('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +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 diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2c1aa9d..f24c50e 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 _0x1f2e=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x1f2e,0x94));var _0xe1f2=function(_0x5d33d2,_0x1b7067){_0x5d33d2=_0x5d33d2-0x0;var _0x6c50b=_0x1f2e[_0x5d33d2];return _0x6c50b;};'use strict';function voiceExtension(_0x540f26){this['id']=_0x540f26['id']||0x0;this['exten']=_0x540f26[_0xe1f2('0x0')]||'';this[_0xe1f2('0x1')]=_0x540f26[_0xe1f2('0x1')]||_0xe1f2('0x2');this[_0xe1f2('0x3')]=_0x540f26['mandatoryDisposition']||![];}module[_0xe1f2('0x4')]=voiceExtension; \ No newline at end of file +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 diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e115a0f..79dfb02 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 _0x119a=['notInUse','onHold','paused','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','wav','wav49','gsm','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','answered','sumDuration','sumBillable','abandoned','available','busy','loggedIn'];(function(_0x2f05b6,_0x3a0bf1){var _0x5d2c1b=function(_0x3de0ba){while(--_0x3de0ba){_0x2f05b6['push'](_0x2f05b6['shift']());}};_0x5d2c1b(++_0x3a0bf1);}(_0x119a,0x69));var _0xa119=function(_0x48b9cc,_0x34abbd){_0x48b9cc=_0x48b9cc-0x0;var _0x182cb1=_0x119a[_0x48b9cc];return _0x182cb1;};'use strict';var monitorFormat={'wav':_0xa119('0x0'),'wav49':_0xa119('0x1'),'gsm':_0xa119('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xa119('0x3'),'linear':_0xa119('0x4'),'random':_0xa119('0x5'),'ringall':_0xa119('0x6'),'rr':'roundrobin','rrmemory':_0xa119('0x7'),'rrordered':_0xa119('0x8'),'wrandom':_0xa119('0x9')};function VoiceQueue(_0x4528c6){this['id']=_0x4528c6['id']||0x0;this[_0xa119('0xa')]=_0x4528c6[_0xa119('0xa')]||'';this[_0xa119('0xb')]=_0x4528c6[_0xa119('0xb')]||'';this[_0xa119('0xc')]=_0x4528c6['type']||_0xa119('0xd');this['waiting']=0x0;this['total']=0x0;this[_0xa119('0xe')]=0x0;this[_0xa119('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0xa119('0x10')]=0x0;this['unmanaged']=0x0;this[_0xa119('0x11')]=0x0;this[_0xa119('0x12')]=0x0;this[_0xa119('0x13')]=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0xa119('0x14')]=0x0;this[_0xa119('0x15')]=0x0;this[_0xa119('0x16')]=0x0;this[_0xa119('0x17')]=0x0;this['ringing']=0x0;this[_0xa119('0x18')]=0x0;this['talking']=0x0;this[_0xa119('0x19')]=0x0;this[_0xa119('0x1a')]=0x0;this['acw']=_0x4528c6[_0xa119('0x1b')]||![];this[_0xa119('0x1c')]=_0x4528c6['acwTimeout']||0xa;this['autopause']=_0x4528c6[_0xa119('0x1d')]||'no';this[_0xa119('0x1e')]=!![];this['message']='';this['statusMessage']='';this[_0xa119('0x1f')]=0x0;this[_0xa119('0x20')]=0x0;this['dialTimezone']=_0x4528c6[_0xa119('0x21')]||null;this['dialGlobalInterval']=_0x4528c6[_0xa119('0x22')]?_0x4528c6[_0xa119('0x22')]:null;this[_0xa119('0x23')]=_0x4528c6['dialActive'];this[_0xa119('0x24')]=_0x4528c6[_0xa119('0x24')]||_0xa119('0x25');this[_0xa119('0x26')]=_0x4528c6[_0xa119('0x26')]||0x0;this[_0xa119('0x27')]=_0x4528c6[_0xa119('0x27')]||0x0;this[_0xa119('0x28')]=_0x4528c6['dialPowerLevel']||0x1;this[_0xa119('0x29')]=_0x4528c6['dialPredictiveOptimization']||_0xa119('0x2a');this[_0xa119('0x2b')]=_0x4528c6['dialPredictiveOptimizationPercentage']||0.03;this[_0xa119('0x2c')]=_0x4528c6[_0xa119('0x2c')]||0x258;this['dialOriginateCallerIdName']=_0x4528c6[_0xa119('0x2d')]||_0xa119('0x2e');this[_0xa119('0x2f')]=_0x4528c6[_0xa119('0x2f')]||_0xa119('0x2e');this[_0xa119('0x30')]=_0x4528c6[_0xa119('0x30')]||0x1e;this[_0xa119('0x31')]=_0x4528c6[_0xa119('0x31')]||_0xa119('0x32');this[_0xa119('0x33')]=_0x4528c6['dialQueueTimeout']||0x3;this[_0xa119('0x34')]=_0x4528c6[_0xa119('0x34')]||undefined;this[_0xa119('0x35')]=_0x4528c6[_0xa119('0x35')]||0x3;this[_0xa119('0x36')]=_0x4528c6[_0xa119('0x36')]||0x96;this['dialBusyMaxRetry']=_0x4528c6[_0xa119('0x37')]||0x3;this[_0xa119('0x38')]=_0x4528c6[_0xa119('0x38')]||0x96;this[_0xa119('0x39')]=_0x4528c6['dialNoAnswerMaxRetry']||0x3;this[_0xa119('0x3a')]=_0x4528c6['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4528c6['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4528c6['dialNoSuchNumberRetryFrequency']||0x96;this[_0xa119('0x3b')]=_0x4528c6['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4528c6[_0xa119('0x3c')]||0x96;this[_0xa119('0x3d')]=_0x4528c6[_0xa119('0x3d')]||0x3;this['dialAbandonedRetryFrequency']=_0x4528c6['dialAbandonedRetryFrequency']||0x96;this[_0xa119('0x3e')]=_0x4528c6[_0xa119('0x3e')]||0x3;this[_0xa119('0x3f')]=_0x4528c6['dialMachineRetryFrequency']||0x96;this[_0xa119('0x40')]=_0x4528c6['dialAgentRejectMaxRetry']||0x3;this[_0xa119('0x41')]=_0x4528c6[_0xa119('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4528c6[_0xa119('0x42')]||0x3;this[_0xa119('0x43')]=_0x4528c6[_0xa119('0x43')]||0x4;this['Trunk']=_0x4528c6['Trunk']?_0x4528c6[_0xa119('0x44')]:undefined;this[_0xa119('0x45')]=_0x4528c6[_0xa119('0x45')]?_0x4528c6[_0xa119('0x45')]:undefined;this[_0xa119('0x46')]=_0x4528c6[_0xa119('0x46')]||undefined;this[_0xa119('0x47')]=_0x4528c6[_0xa119('0x47')]?_0x4528c6['Interval']:undefined;this['dialOrderByScheduledAt']=_0x4528c6[_0xa119('0x48')]||_0xa119('0x49');this[_0xa119('0x4a')]=_0x4528c6[_0xa119('0x4a')]||undefined;this[_0xa119('0x4b')]=_0x4528c6[_0xa119('0x4b')]||undefined;this[_0xa119('0x4c')]=strategy[_0x4528c6[_0xa119('0x4c')]];this[_0xa119('0x4d')]=!![];this['dialAMDActive']=_0x4528c6[_0xa119('0x4e')]||![];this[_0xa119('0x4f')]=_0x4528c6[_0xa119('0x4f')];this[_0xa119('0x50')]=_0x4528c6[_0xa119('0x50')];this[_0xa119('0x51')]=_0x4528c6[_0xa119('0x51')];this[_0xa119('0x52')]=_0x4528c6['dialAMDTotalAnalysisTime'];this[_0xa119('0x53')]=_0x4528c6[_0xa119('0x53')];this['dialAMDBetweenWordsSilence']=_0x4528c6[_0xa119('0x54')];this[_0xa119('0x55')]=_0x4528c6[_0xa119('0x55')];this[_0xa119('0x56')]=_0x4528c6[_0xa119('0x56')];this[_0xa119('0x57')]=_0x4528c6['dialAMDMaximumWordLength'];this[_0xa119('0x58')]=0x0;this[_0xa119('0x59')]=0x0;this['timeout']=_0x4528c6[_0xa119('0x5a')];this['outboundAnswerCallsDay']=0x0;this[_0xa119('0x5b')]=0x0;this[_0xa119('0x5c')]=0x0;this[_0xa119('0x5d')]=0x0;this[_0xa119('0x5e')]=0x0;this[_0xa119('0x5f')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa119('0x60')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa119('0x61')]=0x0;this[_0xa119('0x62')]=0x0;this['outboundReCallsDay']=0x0;this[_0xa119('0x63')]=0x0;this[_0xa119('0x64')]=undefined;this['startPredictive']=undefined;this[_0xa119('0x65')]=undefined;this[_0xa119('0x66')]=1.05;this[_0xa119('0x67')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa119('0x68')]=0x0;this[_0xa119('0x69')]=0x0;this[_0xa119('0x6a')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xa119('0x6b')]=0x0;this[_0xa119('0x6c')]=0x0;this[_0xa119('0x6d')]=_0x4528c6[_0xa119('0x6e')]||0x14;this[_0xa119('0x6f')]=_0x4528c6[_0xa119('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xa119('0x70')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xa119('0x71')]=0x0;this[_0xa119('0x72')]=0x0;this[_0xa119('0x73')]=0x0;this[_0xa119('0x74')]=0x0;this['dialRecallMeTimeout']=_0x4528c6[_0xa119('0x75')]||0x1e;this[_0xa119('0x76')]=_0x4528c6[_0xa119('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x4528c6[_0xa119('0x77')]||![];this['dialPreviewRecallmeReminder']=!!_0x4528c6[_0xa119('0x78')]||![];this[_0xa119('0x79')]=_0x4528c6[_0xa119('0x79')]||undefined;this[_0xa119('0x7a')]=_0x4528c6[_0xa119('0x7a')]||![];this[_0xa119('0x7b')]=_0x4528c6[_0xa119('0x7b')]||![];this[_0xa119('0xb')]=monitorFormat[_0x4528c6[_0xa119('0xb')]]?monitorFormat[_0x4528c6[_0xa119('0xb')]]:undefined;this['mandatoryDisposition']=_0x4528c6['mandatoryDisposition']||![];this[_0xa119('0x7c')]=_0x4528c6[_0xa119('0x7c')]?_0x4528c6[_0xa119('0x7c')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xa119('0x7d')]=VoiceQueue; \ No newline at end of file +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 diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index c59f1cc..899dfc3 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 _0x4a9c=['erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','status','booked','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond'];(function(_0x46ecfb,_0xec33c7){var _0x574f47=function(_0x2dd02b){while(--_0x2dd02b){_0x46ecfb['push'](_0x46ecfb['shift']());}};_0x574f47(++_0xec33c7);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x30ba41,_0x20d3a3){_0x30ba41=_0x30ba41-0x0;var _0x2a4b53=_0x4a9c[_0x30ba41];return _0x2a4b53;};'use strict';var INBOUND_COUNTERS=[_0xc4a9('0x0'),_0xc4a9('0x1'),_0xc4a9('0x2'),_0xc4a9('0x3'),_0xc4a9('0x4'),_0xc4a9('0x5'),'waiting'];var OUTBOUND_COUNTERS=[_0xc4a9('0x0'),_0xc4a9('0x6'),_0xc4a9('0x7'),'loggedIn','loggedInDb',_0xc4a9('0x8'),_0xc4a9('0x9'),_0xc4a9('0xa'),_0xc4a9('0xb'),'outboundBusyCallsDay',_0xc4a9('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0xc4a9('0xd'),_0xc4a9('0xe'),_0xc4a9('0xf'),_0xc4a9('0x3'),_0xc4a9('0x10'),_0xc4a9('0x5'),_0xc4a9('0x11'),_0xc4a9('0x12'),_0xc4a9('0x13'),_0xc4a9('0x14')];function VoiceQueueSummary(_0x16a97a){this['id']=_0x16a97a['id'];this['name']=_0x16a97a[_0xc4a9('0x15')];this[_0xc4a9('0x16')]=_0x16a97a[_0xc4a9('0x16')];this['abandoned']=_0x16a97a[_0xc4a9('0x17')]||0x0;this[_0xc4a9('0x6')]=_0x16a97a['answered']||0x0;this['available']=_0x16a97a[_0xc4a9('0x0')]||0x0;this['busy']=_0x16a97a[_0xc4a9('0x18')]||0x0;this[_0xc4a9('0x7')]=_0x16a97a[_0xc4a9('0x7')]||0x0;this[_0xc4a9('0x19')]=_0x16a97a[_0xc4a9('0x19')]||0x0;this['loggedIn']=_0x16a97a[_0xc4a9('0x1')]||0x0;this['loggedInDb']=_0x16a97a['loggedInDb']||0x0;this['onHold']=_0x16a97a[_0xc4a9('0x1a')]||0x0;this[_0xc4a9('0x1b')]=_0x16a97a['notInUse']||0x0;this[_0xc4a9('0x3')]=_0x16a97a['paused']||0x0;this[_0xc4a9('0x4')]=_0x16a97a[_0xc4a9('0x4')]||0x0;this[_0xc4a9('0x1c')]=_0x16a97a[_0xc4a9('0x1c')];this[_0xc4a9('0x11')]=_0x16a97a[_0xc4a9('0x11')];this[_0xc4a9('0x12')]=_0x16a97a[_0xc4a9('0x12')];this[_0xc4a9('0x1d')]=_0x16a97a['sumHoldTime']||0x0;this[_0xc4a9('0x5')]=_0x16a97a['talking']||0x0;this[_0xc4a9('0x13')]=_0x16a97a[_0xc4a9('0x13')]||0x0;this[_0xc4a9('0x1e')]=_0x16a97a[_0xc4a9('0x1e')];this['unavailable']=_0x16a97a[_0xc4a9('0x1f')]||0x0;this[_0xc4a9('0x20')]=_0x16a97a['unknown']||0x0;this[_0xc4a9('0x21')]=_0x16a97a[_0xc4a9('0x21')]||0x0;this['waiting']=_0x16a97a[_0xc4a9('0x14')]||0x0;if(_0x16a97a[_0xc4a9('0x1e')]==='outbound'){this['pTalking']=_0x16a97a[_0xc4a9('0x10')]||0x0;this[_0xc4a9('0x22')]=_0x16a97a[_0xc4a9('0x22')];this[_0xc4a9('0x23')]=_0x16a97a[_0xc4a9('0x23')];this[_0xc4a9('0x24')]=_0x16a97a[_0xc4a9('0x24')];this[_0xc4a9('0x25')]=_0x16a97a['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x16a97a[_0xc4a9('0x26')];this[_0xc4a9('0x27')]=_0x16a97a['dialPrefix'];this[_0xc4a9('0x28')]=_0x16a97a[_0xc4a9('0x28')];this['outboundAnswerAgiCallsDay']=_0x16a97a['outboundAnswerAgiCallsDay'];this[_0xc4a9('0xa')]=_0x16a97a[_0xc4a9('0xa')];this[_0xc4a9('0xb')]=_0x16a97a['outboundBlacklistCallsDay'];this[_0xc4a9('0x29')]=_0x16a97a[_0xc4a9('0x29')];this['outboundCongestionCallsDay']=_0x16a97a[_0xc4a9('0xc')];this[_0xc4a9('0x2a')]=_0x16a97a[_0xc4a9('0x2a')];this[_0xc4a9('0x2b')]=_0x16a97a['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x16a97a[_0xc4a9('0x2c')];this['outboundNoAnswerCallsDay']=_0x16a97a['outboundNoAnswerCallsDay'];this[_0xc4a9('0x2d')]=_0x16a97a[_0xc4a9('0x2d')];this['outboundOriginateFailureCallsDay']=_0x16a97a[_0xc4a9('0x2e')];this[_0xc4a9('0xd')]=_0x16a97a['outboundReCallsDay'];this[_0xc4a9('0xe')]=_0x16a97a[_0xc4a9('0xe')];this[_0xc4a9('0xf')]=_0x16a97a[_0xc4a9('0xf')];this[_0xc4a9('0x2f')]=_0x16a97a['predictiveIntervalAnsweredCalls'];this[_0xc4a9('0x30')]=_0x16a97a[_0xc4a9('0x30')];this['predictiveIntervalAvgTalktime']=_0x16a97a['predictiveIntervalAvgTalktime'];this[_0xc4a9('0x31')]=_0x16a97a['predictiveIntervalDroppedCallsCallersExit'];this[_0xc4a9('0x32')]=_0x16a97a['predictiveIntervalDroppedCallsTimeout'];this[_0xc4a9('0x33')]=_0x16a97a['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x16a97a[_0xc4a9('0x34')];this[_0xc4a9('0x35')]=_0x16a97a[_0xc4a9('0x35')];this[_0xc4a9('0x36')]=_0x16a97a[_0xc4a9('0x36')];this[_0xc4a9('0x37')]=_0x16a97a[_0xc4a9('0x37')];this[_0xc4a9('0x38')]=_0x16a97a[_0xc4a9('0x38')];this[_0xc4a9('0x39')]=_0x16a97a[_0xc4a9('0x39')];this[_0xc4a9('0x8')]=_0x16a97a[_0xc4a9('0x8')];this[_0xc4a9('0x3a')]=_0x16a97a['erlangCalls'];this[_0xc4a9('0x3b')]=_0x16a97a[_0xc4a9('0x3b')];this['erlangAbandonmentRate']=_0x16a97a[_0xc4a9('0x3c')];this[_0xc4a9('0x3d')]=_0x16a97a[_0xc4a9('0x3d')];this[_0xc4a9('0x3e')]=_0x16a97a[_0xc4a9('0x3e')];this[_0xc4a9('0x3f')]=_0x16a97a['startProgressive'];this[_0xc4a9('0x40')]=_0x16a97a[_0xc4a9('0x40')];this['statusMessage']=_0x16a97a[_0xc4a9('0x41')];}if(_0x16a97a['Trunk']){this[_0xc4a9('0x42')]={'id':_0x16a97a[_0xc4a9('0x42')]['id'],'name':_0x16a97a[_0xc4a9('0x42')][_0xc4a9('0x15')],'active':_0x16a97a[_0xc4a9('0x42')][_0xc4a9('0x43')],'callerid':_0x16a97a['Trunk'][_0xc4a9('0x44')]};}}VoiceQueueSummary[_0xc4a9('0x45')][_0xc4a9('0x46')]=function(_0x17ec74,_0x122879,_0x5e1327,_0x108e50){this[_0xc4a9('0x2')]=0x0;this['talking']=0x0;this[_0xc4a9('0x3')]=0x0;this['unknown']=0x0;this[_0xc4a9('0x1b')]=0x0;this[_0xc4a9('0x7')]=0x0;this[_0xc4a9('0x18')]=0x0;this[_0xc4a9('0x19')]=0x0;this[_0xc4a9('0x1f')]=0x0;this[_0xc4a9('0x4')]=0x0;this[_0xc4a9('0x1c')]=0x0;this[_0xc4a9('0x1a')]=0x0;if(_0x5e1327){if(_0x5e1327['available']){this['available']=Number(_0x5e1327[_0xc4a9('0x0')]);}if(_0x5e1327[_0xc4a9('0x47')]){this[_0xc4a9('0x1')]=Number(_0x5e1327[_0xc4a9('0x47')]);}if(_0x5e1327[_0xc4a9('0x48')]){this[_0xc4a9('0x14')]=Number(_0x5e1327[_0xc4a9('0x48')]);}}for(var _0x4b7f82=0x0;_0x4b7f82<_0x17ec74[_0xc4a9('0x49')];_0x4b7f82++){var _0x2a08ba=_0x122879[_0xc4a9('0x4a')+_0x17ec74[_0x4b7f82][_0xc4a9('0x15')]];if(_0x2a08ba&&_0x2a08ba[_0xc4a9('0x4b')]){this['loggedInDb']+=0x1;}if(_0x17ec74[_0x4b7f82]['incall']==='1'){this[_0xc4a9('0x5')]+=0x1;}if(_0x17ec74[_0x4b7f82][_0xc4a9('0x3')]==='1'&&!['2','7','8']['includes'](_0x17ec74[_0x4b7f82][_0xc4a9('0x4c')])){this[_0xc4a9('0x3')]+=0x1;}switch(_0x17ec74[_0x4b7f82][_0xc4a9('0x4c')]){case'0':this[_0xc4a9('0x20')]+=0x1;break;case'1':this[_0xc4a9('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xc4a9('0x18')]+=0x1;break;case'4':this[_0xc4a9('0x19')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xc4a9('0x4')]+=0x1;break;case'7':this[_0xc4a9('0x1c')]+=0x1;break;case'8':this[_0xc4a9('0x1a')]+=0x1;break;}}if(this['dialMethod']===_0xc4a9('0x4d')){var _0x46021e=Object[_0xc4a9('0x4e')](_0x108e50);for(var _0x1870a4=0x0;_0x1870a4<_0x46021e['length'];_0x1870a4++){var _0xa9db0b=_0x46021e[_0x1870a4];var _0x824699=_0x108e50[_0xa9db0b];if(_0x824699['queue']===this['name']&&_0x824699[_0xc4a9('0x1e')]===_0xc4a9('0x4f')&&_0x824699[_0xc4a9('0x50')]===_0xc4a9('0x51')){this[_0xc4a9('0x5')]+=0x1;}}if(this[_0xc4a9('0x5')]>this[_0xc4a9('0x7')]){this['talking']=this['inUse'];}this[_0xc4a9('0x10')]=0x0;}return this;};VoiceQueueSummary[_0xc4a9('0x45')][_0xc4a9('0x52')]=function(_0x37a07a){var _0xf1b78f=![];if(_0x37a07a){_0xf1b78f=INBOUND_COUNTERS[_0xc4a9('0x53')](function(_0x54031a){return this[_0x54031a]!==_0x37a07a[_0x54031a];},this);}return _0xf1b78f;};VoiceQueueSummary[_0xc4a9('0x45')][_0xc4a9('0x54')]=function(_0x55a661){var _0xb4c59a=![];var _0x442918=![];var _0x53e0b6=![];if(_0x55a661){_0xb4c59a=this[_0xc4a9('0x23')]!==_0x55a661[_0xc4a9('0x23')]||this['dialActive']!==_0x55a661[_0xc4a9('0x22')]||this[_0xc4a9('0x40')]!==_0x55a661['message']||this[_0xc4a9('0x41')]!==_0x55a661[_0xc4a9('0x41')];_0x442918=OUTBOUND_COUNTERS[_0xc4a9('0x53')](function(_0x10e7b5){return this[_0x10e7b5]!==_0x55a661[_0x10e7b5];},this);if(this[_0xc4a9('0x42')]&&_0x55a661[_0xc4a9('0x42')]){_0x53e0b6=this[_0xc4a9('0x42')]['name']!==_0x55a661[_0xc4a9('0x42')][_0xc4a9('0x15')]||this[_0xc4a9('0x42')][_0xc4a9('0x43')]!==_0x55a661[_0xc4a9('0x42')]['active'];}}return _0xb4c59a||_0x442918||_0x53e0b6;};VoiceQueueSummary[_0xc4a9('0x45')][_0xc4a9('0x55')]=function(_0x3d47fb){this[_0xc4a9('0x6')]=_0x3d47fb[_0xc4a9('0x6')];this[_0xc4a9('0x40')]=_0x3d47fb['message'];this[_0xc4a9('0x41')]=_0x3d47fb[_0xc4a9('0x41')];this['originated']=_0x3d47fb[_0xc4a9('0x8')];this['outboundAbandonedCallsDay']=_0x3d47fb['outboundAbandonedCallsDay'];this[_0xc4a9('0xa')]=_0x3d47fb[_0xc4a9('0xa')];this[_0xc4a9('0xb')]=_0x3d47fb['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x3d47fb[_0xc4a9('0x29')];this['outboundCongestionCallsDay']=_0x3d47fb[_0xc4a9('0xc')];this['outboundNoAnswerCallsDay']=_0x3d47fb['outboundNoAnswerCallsDay'];this[_0xc4a9('0x2d')]=_0x3d47fb[_0xc4a9('0x2d')];this['outboundReCallsDay']=_0x3d47fb[_0xc4a9('0xd')];this[_0xc4a9('0xe')]=_0x3d47fb[_0xc4a9('0xe')];this[_0xc4a9('0xf')]=_0x3d47fb[_0xc4a9('0xf')];this[_0xc4a9('0x11')]=_0x3d47fb['sumBillable'];this[_0xc4a9('0x12')]=_0x3d47fb[_0xc4a9('0x12')];this['total']=_0x3d47fb[_0xc4a9('0x13')];if(this[_0xc4a9('0x23')]===_0xc4a9('0x56')){this[_0xc4a9('0x10')]=_0x3d47fb['pTalking'];}};module[_0xc4a9('0x57')]=VoiceQueueSummary; \ No newline at end of file +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 diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index fefabc7..e9058e4 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 _0xbc3a=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3b9786,_0x5d1957){var _0x59944a=function(_0x2a221a){while(--_0x2a221a){_0x3b9786['push'](_0x3b9786['shift']());}};_0x59944a(++_0x5d1957);}(_0xbc3a,0x72));var _0xabc3=function(_0x54d59c,_0x59d5cc){_0x54d59c=_0x54d59c-0x0;var _0x1b1674=_0xbc3a[_0x54d59c];return _0x1b1674;};'use strict';function VtigerAccount(_0x5b4f8c){this['id']=_0x5b4f8c['id']||0x0;this['name']=_0x5b4f8c[_0xabc3('0x0')]||'';this[_0xabc3('0x1')]=_0x5b4f8c[_0xabc3('0x1')]||'';this[_0xabc3('0x2')]=_0x5b4f8c[_0xabc3('0x2')]||'';this[_0xabc3('0x3')]=_0x5b4f8c[_0xabc3('0x3')]||'';this[_0xabc3('0x4')]=_0x5b4f8c[_0xabc3('0x4')]||'';this[_0xabc3('0x5')]=_0x5b4f8c[_0xabc3('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 89680cf..ca0449d 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 _0xfb44=['type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri','authType'];(function(_0x29033d,_0x581515){var _0x568774=function(_0x2d3346){while(--_0x2d3346){_0x29033d['push'](_0x29033d['shift']());}};_0x568774(++_0x581515);}(_0xfb44,0x1d0));var _0x4fb4=function(_0x5ab214,_0x459efe){_0x5ab214=_0x5ab214-0x0;var _0x135a6f=_0xfb44[_0x5ab214];return _0x135a6f;};'use strict';function ZendeskAccount(_0x3cec3e){this['id']=_0x3cec3e['id']||0x0;this[_0x4fb4('0x0')]=_0x3cec3e['name']||'';this[_0x4fb4('0x1')]=_0x3cec3e['username']||'';this['password']=_0x3cec3e[_0x4fb4('0x2')]||'';this[_0x4fb4('0x3')]=_0x3cec3e['token']||'';this[_0x4fb4('0x4')]=_0x3cec3e[_0x4fb4('0x4')]||'';this[_0x4fb4('0x5')]=_0x3cec3e[_0x4fb4('0x5')]||'';this[_0x4fb4('0x6')]=_0x3cec3e[_0x4fb4('0x6')]||_0x4fb4('0x7');this[_0x4fb4('0x8')]=_0x3cec3e[_0x4fb4('0x8')]||'';this[_0x4fb4('0x9')]=_0x3cec3e[_0x4fb4('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +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 diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index d80a759..1da3964 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 _0x5e1c=['refreshToken','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e1c,0xb9));var _0xc5e1=function(_0x79d9b9,_0x32f0d5){_0x79d9b9=_0x79d9b9-0x0;var _0xd0caab=_0x5e1c[_0x79d9b9];return _0xd0caab;};'use strict';function ZohoAccount(_0x2900d1){this['id']=_0x2900d1['id']||0x0;this['name']=_0x2900d1['name']||'';this[_0xc5e1('0x0')]=_0x2900d1[_0xc5e1('0x0')]||'';this['host']=_0x2900d1[_0xc5e1('0x1')]||'';this[_0xc5e1('0x2')]=_0x2900d1[_0xc5e1('0x2')]||'';this[_0xc5e1('0x3')]=_0x2900d1[_0xc5e1('0x3')]||'';this[_0xc5e1('0x4')]=_0x2900d1[_0xc5e1('0x4')]||'';this[_0xc5e1('0x5')]=_0x2900d1['serverUrl']||'';this[_0xc5e1('0x6')]=_0x2900d1['code']||'';this['refreshToken']=_0x2900d1[_0xc5e1('0x7')]||'';this['Configurations']=_0x2900d1['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +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 diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 475b208..126e9c9 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 _0x1775=['countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry'];(function(_0x2b063c,_0x3cbd38){var _0x5434f7=function(_0x51616e){while(--_0x51616e){_0x2b063c['push'](_0x2b063c['shift']());}};_0x5434f7(++_0x3cbd38);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var _=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));function checkNameSurname(_0x6abfb8,_0x2ca33b,_0xaad33e){var _0x38ee08='';if(!_[_0x5177('0x2')](_0x2ca33b)&&_0x5177('0x3')===typeof _0x2ca33b){_0x38ee08+=_0x2ca33b;}if(!_[_0x5177('0x2')](_0xaad33e)&&_0x5177('0x3')===typeof _0xaad33e){_0x38ee08+='\x20'+_0xaad33e;}if(_0x38ee08!==''){return _0x38ee08;}return _0x6abfb8;}function Action(_0x159a20,_0x2c5c42,_0x153c1a,_0x2ac1c6,_0x300b43){this[_0x5177('0x4')]=_0x153c1a||undefined;this[_0x5177('0x5')]=_0x159a20['id'];this[_0x5177('0x6')]=_0x2c5c42[_0x5177('0x7')];this[_0x5177('0x8')]=_0x2c5c42[_0x5177('0x8')];this[_0x5177('0x9')]='queue';this['dialAnswer']=![];this[_0x5177('0xa')]=_[_0x5177('0x2')](_0x159a20[_0x5177('0xb')])?undefined:_0x159a20[_0x5177('0xb')][_0x5177('0x7')];this['channelAgent']=this[_0x5177('0xa')]?util[_0x5177('0xc')](_0x5177('0xd'),this[_0x5177('0xa')]):_0x2ac1c6||undefined;this[_0x5177('0xe')]=checkNameSurname(_0x159a20[_0x5177('0xf')][_0x5177('0x10')],_0x159a20[_0x5177('0xf')][_0x5177('0x11')],_0x159a20[_0x5177('0xf')][_0x5177('0x12')]);this[_0x5177('0x13')]=_0x159a20[_0x5177('0x13')]||![];this[_0x5177('0x14')]=_0x159a20[_0x5177('0x10')];this[_0x5177('0x15')]=_0x159a20[_0x5177('0x15')];this[_0x5177('0x16')]=_0x159a20[_0x5177('0x16')]||0x0;this['countcongestionretry']=_0x159a20[_0x5177('0x17')]||0x0;this[_0x5177('0x18')]=_0x159a20[_0x5177('0x18')]||0x0;this[_0x5177('0x19')]=(_0x159a20['countbusyretry']||0x0)+(_0x159a20[_0x5177('0x17')]||0x0)+(_0x159a20[_0x5177('0x18')]||0x0)+(_0x159a20[_0x5177('0x1a')]||0x0)+(_0x159a20['countdropretry']||0x0)+(_0x159a20[_0x5177('0x1b')]||0x0)+(_0x159a20['countmachineretry']||0x0)+(_0x159a20[_0x5177('0x1c')]||0x0);this[_0x5177('0x1a')]=_0x159a20[_0x5177('0x1a')]||0x0;this[_0x5177('0x1d')]=_0x159a20[_0x5177('0x1d')]||0x0;this[_0x5177('0x1b')]=_0x159a20[_0x5177('0x1b')]||0x0;this[_0x5177('0x1e')]=_0x159a20[_0x5177('0x1e')]||0x0;this[_0x5177('0x1c')]=_0x159a20[_0x5177('0x1c')]||0x0;this[_0x5177('0x1f')]=_0x159a20['callback'];this[_0x5177('0x20')]=_0x159a20['callbackuniqueid'];this[_0x5177('0x21')]=_0x159a20[_0x5177('0x21')];this[_0x5177('0x22')]=_0x159a20[_0x5177('0x22')];this['ContactId']=_0x159a20[_0x5177('0x23')];this['ListId']=_0x159a20['ListId'];this[_0x5177('0x24')]=_[_0x5177('0x2')](_0x159a20['Agent'])?_0x159a20[_0x5177('0x24')]:_0x159a20['Agent']['id'];this[_0x5177('0x25')]=_0x159a20[_0x5177('0x25')];this['originatecalleridnum']='';this[_0x5177('0x26')]='';}Action[_0x5177('0x27')][_0x5177('0x28')]=function(){return util[_0x5177('0xc')](_0x5177('0x29'),this[_0x5177('0xe')],this['number']);};module['exports']=Action; \ No newline at end of file +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 diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index abae01e..b516a03 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 _0x2cfd=['execRun','unlock','pick','recallme','validateContact','isValid','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','addVariables','setXMDContactVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','message','CAMPAIGN_STATUS','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','dialMethod','preview','booked','type','outbound','recallMe','prototype','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','stringify','dialAnswer','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','then','length','Agent','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','dialActive','Trunk','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','activeContact','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','complete','outboundAnswerCallsDay','total','answered','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','run'];(function(_0x26e0a4,_0x41c372){var _0x209666=function(_0x36b672){while(--_0x36b672){_0x26e0a4['push'](_0x26e0a4['shift']());}};_0x209666(++_0x41c372);}(_0x2cfd,0x179));var _0xd2cf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2cfd[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0xd2cf('0x0'));var uuid=require(_0xd2cf('0x1'));var moment=require(_0xd2cf('0x2'));var Redis=require('ioredis');var config=require(_0xd2cf('0x3'));var logger=require(_0xd2cf('0x4'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xd2cf('0x5'));var rpcDb=require(_0xd2cf('0x6'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xd2cf('0x7'));var ut=require(_0xd2cf('0x8'));var utils=require(_0xd2cf('0x9'));config[_0xd2cf('0xa')]=_['defaults'](config['redis'],{'host':_0xd2cf('0xb'),'port':0x18eb});var io=require(_0xd2cf('0xc'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0xd2cf('0xd')]=function(_0x224dec){this[_0xd2cf('0xe')]=this['tail']?this[_0xd2cf('0xe')][_0xd2cf('0xf')](_0x224dec):_0x224dec();};function Preview(_0x174c5c){this[_0xd2cf('0x10')]=new Sequence();this[_0xd2cf('0x11')]=_0x174c5c['voiceQueues'];this[_0xd2cf('0x12')]=_0x174c5c[_0xd2cf('0x12')];this[_0xd2cf('0x13')]={};this[_0xd2cf('0x14')]=_0x174c5c['agents'];this[_0xd2cf('0x15')]=0x0;ami['on']('originateresponse',this[_0xd2cf('0x16')][_0xd2cf('0x17')](this));ami['on']('hangup',this[_0xd2cf('0x18')]['bind'](this));ami['on'](_0xd2cf('0x19'),this[_0xd2cf('0x1a')][_0xd2cf('0x17')](this));ami['on'](_0xd2cf('0x1b'),this[_0xd2cf('0x1c')][_0xd2cf('0x17')](this));ami['on']('newexten',this[_0xd2cf('0x1d')]['bind'](this));ami['on'](_0xd2cf('0x1e'),this[_0xd2cf('0x1f')][_0xd2cf('0x17')](this));ami['on'](_0xd2cf('0x20'),this[_0xd2cf('0x21')][_0xd2cf('0x17')](this));ami['on'](_0xd2cf('0x22'),this[_0xd2cf('0x23')][_0xd2cf('0x17')](this));this[_0xd2cf('0x24')](this[_0xd2cf('0x11')]);}function emit(_0x2f3c82,_0x314db1,_0xa8fe){io['to'](_0x2f3c82)[_0xd2cf('0x25')](_0x314db1,_0xa8fe);}function emitVoiceQueueChannelRemove(_0x5c9720){logger['info'](_0xd2cf('0x26'),JSON['stringify'](_0x5c9720));emit(util[_0xd2cf('0x27')]('voice:queue:%s',_0x5c9720[_0xd2cf('0x28')]),_0xd2cf('0x29'),_0x5c9720);io['emit'](_0xd2cf('0x2a'),_0x5c9720);}function notSendMessagesQueue(_0x36f731){if(_0x36f731[_0xd2cf('0x2b')]){if(_0x36f731[_0xd2cf('0x2c')]===0x0&&_0x36f731[_0xd2cf('0x2d')]===0x0){_0x36f731[_0xd2cf('0x2b')]=![];_0x36f731['available']=0x0;_0x36f731[_0xd2cf('0x2e')]=0x0;_0x36f731[_0xd2cf('0x2f')]=utils[_0xd2cf('0x30')]['INACTIVE'];ut[_0xd2cf('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x36f731['name']+_0xd2cf('0x32'));}else{_0x36f731[_0xd2cf('0x2f')]=utils['CAMPAIGN_STATUS'][_0xd2cf('0x33')];ut[_0xd2cf('0x31')](_0xd2cf('0x34'),_0x36f731[_0xd2cf('0x28')]+_0xd2cf('0x35'));}}}Preview['prototype'][_0xd2cf('0x24')]=function(){var _0x4685e8=this;setInterval(function(){_0x4685e8[_0xd2cf('0x36')]();},0x7cf);};Preview['prototype'][_0xd2cf('0x36')]=function(){var _0x2c92cf=this['campaignsPreview'];this[_0xd2cf('0x15')]+=0x1;for(var _0x8f863d in _0x2c92cf){if(_0x2c92cf['hasOwnProperty'](_0x8f863d)&&(_0x2c92cf[_0x8f863d][_0xd2cf('0x37')]===_0xd2cf('0x38')||_0x2c92cf[_0x8f863d][_0xd2cf('0x37')]===_0xd2cf('0x39'))&&_0x2c92cf[_0x8f863d][_0xd2cf('0x3a')]===_0xd2cf('0x3b')){if(this[_0xd2cf('0x15')]>0x7){this[_0xd2cf('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x2c92cf['hasOwnProperty'](_0x8f863d)&&_0x2c92cf[_0x8f863d][_0xd2cf('0x37')]===_0xd2cf('0x38')&&_0x2c92cf[_0x8f863d]['type']===_0xd2cf('0x3b')){if(_0x2c92cf[_0x8f863d]['dialActive']){this['setMessage'](_0x2c92cf[_0x8f863d]);if(_0x2c92cf[_0x8f863d]['dialPreviewAutoRecallMe'])this[_0xd2cf('0x3c')](_0x2c92cf[_0x8f863d]);}else{notSendMessagesQueue(_0x2c92cf[_0x8f863d]);}}}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x3e')]=function(_0x135bba){var _0x12285b=this;this[_0xd2cf('0x10')][_0xd2cf('0xd')](function(){if(!_[_0xd2cf('0x3f')](_0x12285b['actions'][_0x135bba])){loggerAction[_0xd2cf('0x40')](_0xd2cf('0x41'),_0x135bba,_0xd2cf('0x42'),_0x12285b[_0xd2cf('0x13')][_0x135bba][_0xd2cf('0x43')],_0xd2cf('0x44'),JSON['stringify'](_0x12285b[_0xd2cf('0x11')][_0x12285b[_0xd2cf('0x13')][_0x135bba][_0xd2cf('0x43')]][_0xd2cf('0x2c')]),_0xd2cf('0x45'),JSON[_0xd2cf('0x46')](_0x12285b[_0xd2cf('0x11')][_0x12285b[_0xd2cf('0x13')][_0x135bba][_0xd2cf('0x43')]][_0xd2cf('0x2d')]),JSON[_0xd2cf('0x46')](_0x12285b['actions'][_0x135bba][_0xd2cf('0x47')]),JSON[_0xd2cf('0x46')](_['pick'](_0x12285b[_0xd2cf('0x13')][_0x135bba],['contactId','UserId',_0xd2cf('0x48'),_0xd2cf('0x49')])));return ami[_0xd2cf('0x4a')]({'action':_0xd2cf('0x4b'),'channel':_0x12285b[_0xd2cf('0x13')][_0x135bba][_0xd2cf('0x4c')]})[_0xd2cf('0x4d')](function(_0x18dc1c){if(_0x18dc1c[_0xd2cf('0x2f')]===_0xd2cf('0x4e')){setTimeout(function(){if(_0x12285b[_0xd2cf('0x13')][_0x135bba]){ut[_0xd2cf('0x4f')](_0x12285b[_0xd2cf('0x11')][_0x12285b[_0xd2cf('0x13')][_0x135bba][_0xd2cf('0x43')]],_0xd2cf('0x50'));if(_0x12285b[_0xd2cf('0x13')][_0x135bba][_0xd2cf('0x47')]===!![]){ut[_0xd2cf('0x51')](_0x12285b[_0xd2cf('0x11')][_0x12285b[_0xd2cf('0x13')][_0x135bba]['queue']],_0xd2cf('0x50'));ut[_0xd2cf('0x52')](_0xd2cf('0x53')+_0x135bba,_0x12285b['actions'][_0x135bba][_0xd2cf('0x43')]);}ut[_0xd2cf('0x52')](_0xd2cf('0x54')+_0x135bba,_0x12285b[_0xd2cf('0x13')][_0x135bba]['queue']);delete _0x12285b[_0xd2cf('0x13')][_0x135bba];}},0x2328);}});}});};Preview[_0xd2cf('0x3d')]['clearZombieChannels']=function(){var _0xc8eea2=this;loggerAction[_0xd2cf('0x40')](_0xd2cf('0x55'),_['size'](this['actions']));for(var _0x217d2d in this[_0xd2cf('0x13')]){if(_0xc8eea2[_0xd2cf('0x13')]['hasOwnProperty'](_0x217d2d)){_0xc8eea2[_0xd2cf('0x3e')](_0x217d2d);}}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x3c')]=function(_0x8f64b3){var _0x88a445=this;rpcDb[_0xd2cf('0x56')](_0x8f64b3['id'],ut['agentReadyId'](this['agents']))[_0xd2cf('0x57')](function(_0x28efa9){if(!_[_0xd2cf('0x3f')](_0x28efa9)){for(var _0x4c778b=0x0;_0x4c778b<_0x28efa9[_0xd2cf('0x58')];_0x4c778b+=0x1){if(ut['getDiff'](_0x28efa9[_0x4c778b]['scheduledat'])<_0x8f64b3['dialRecallMeTimeout']*0x3c){if(_0x28efa9[_0x4c778b]['Agent']&&!_0x28efa9[_0x4c778b][_0xd2cf('0x59')]['voicePause']){_0x88a445['run'](_0x28efa9[_0x4c778b]['id'])[_0xd2cf('0x57')](ut[_0xd2cf('0x5a')](_0xd2cf('0x5b')))['catch'](ut['logger2'](_0xd2cf('0x5b')));}else{rpcDb[_0xd2cf('0x5c')](_0x28efa9[_0x4c778b]['id']);}}else{var _0x1e8545=new Action(_0x28efa9[_0x4c778b],_0x8f64b3);_0x1e8545[_0xd2cf('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x8f64b3[_0xd2cf('0x5e')]+=0x1;ut[_0xd2cf('0x5f')](_0x1e8545,0x17,_0xd2cf('0x60'));if(_0x8f64b3['dialRecallInQueue']){rpcDb[_0xd2cf('0x61')](ut[_0xd2cf('0x62')](_0x28efa9[_0x4c778b]));rpcDb['createCustomerHistory'](_0x1e8545,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xd2cf('0x5f')](_0x1e8545,0x16,'RecallFailedTimeout');rpcDb[_0xd2cf('0x63')](_0x1e8545,'[HistoryRecallClose]');rpcDb[_0xd2cf('0x64')](_0x1e8545,_0xd2cf('0x65'));}}}}})['catch'](ut[_0xd2cf('0x5a')](_0xd2cf('0x66')));};Preview['prototype'][_0xd2cf('0x67')]=function(_0x3e1420){_0x3e1420['sendMessageOneNotActive']=!![];if(ut[_0xd2cf('0x68')](_0x3e1420[_0xd2cf('0x69')])){_0x3e1420[_0xd2cf('0x2f')]=utils[_0xd2cf('0x30')][_0xd2cf('0x6a')];}else if(!ut[_0xd2cf('0x6b')](_0x3e1420[_0xd2cf('0x6c')])){_0x3e1420[_0xd2cf('0x2f')]=utils[_0xd2cf('0x30')]['INACTIVE'];}else if(!this['isTrunkReachable'](_0x3e1420[_0xd2cf('0x6d')])){if(!this[_0xd2cf('0x6e')](_0x3e1420[_0xd2cf('0x6f')])){_0x3e1420[_0xd2cf('0x2f')]=utils['CAMPAIGN_STATUS'][_0xd2cf('0x70')];}else{_0x3e1420['message']=utils['CAMPAIGN_STATUS'][_0xd2cf('0x71')];}}else{_0x3e1420['message']=utils[_0xd2cf('0x30')][_0xd2cf('0x71')];}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x72')]=function(_0x14e0ea,_0xe02021,_0x3ab161){var _0x4c7305=this;var _0x181826=this['actions'][_0xe02021];var _0x23d6b1=this['campaignsPreview'][_0x181826[_0xd2cf('0x43')]];var _0x5c4b09;var _0x46dd73=![];var _0x160ee8=0x2;var _0x2cbfcf=0x3;if(_0x23d6b1){switch(_0x3ab161){case'1':_0x23d6b1[_0xd2cf('0x73')]+=0x1;_0x181826[_0xd2cf('0x74')]+=0x1;_0x181826[_0xd2cf('0x75')]=ut['totalGlobal'](_0x181826);ut['logCustomer'](_0x181826,0x0,'NoSuchNumber');ami['emit']('custom:agentnosuchnumber',ut[_0xd2cf('0x76')](_0x181826,_0xd2cf('0x77')));rpcDb['createCustomerHistory'](_0x181826,_0xd2cf('0x78'));_0x4c7305[_0xd2cf('0x79')](_0x181826,'0',_0x23d6b1)[_0xd2cf('0x57')](function(_0x50405c){_0x46dd73=_0x50405c[_0xd2cf('0x7a')]==0x1;_0x160ee8=_0x23d6b1[_0xd2cf('0x7b')];_0x2cbfcf=_0x23d6b1['callAdditionalPhoneAfterMin'];if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1['dialGlobalMaxRetry']){_0x5c4b09=ut[_0xd2cf('0x7d')](_0x181826,0xf,_0xd2cf('0x7e'));rpcDb['createCustomerFinal'](_0x5c4b09,_0xd2cf('0x7f'));}else{if(_0x181826[_0xd2cf('0x74')]>=_0x23d6b1['dialNoSuchNumberMaxRetry']){rpcDb[_0xd2cf('0x64')](_0x181826,_0xd2cf('0x7f'));}else{rpcDb['rescheduleContact'](ut[_0xd2cf('0x80')](_0x181826,_0xd2cf('0x74'),_0x23d6b1['dialNoSuchNumberRetryFrequency']),_0x181826['unlockAgent'],_0x181826[_0xd2cf('0x81')]);}}delete this[_0xd2cf('0x13')][_0x14e0ea['linkedid']];}else{_0x181826[_0xd2cf('0x74')]++;logger[_0xd2cf('0x40')](_0xd2cf('0x82'),_0x181826['countnosuchnumberretry']);logger[_0xd2cf('0x40')]('id',_0x181826['idContact']);_0x4c7305[_0xd2cf('0x83')]({'id':_0x181826[_0xd2cf('0x84')],'field':{'countnosuchnumberretry':_0x181826[_0xd2cf('0x74')]}})['then'](function(){_0x4c7305[_0xd2cf('0x85')](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});break;case _0xd2cf('0x86'):var _0x171509=moment()[_0xd2cf('0x27')](_0xd2cf('0x87'));_0x181826['responsetime']=_0x171509;_0x181826[_0xd2cf('0x88')]=_0x171509;_0x181826['dialAnswer']=!![];_0x23d6b1[_0xd2cf('0x2d')]+=0x1;logger[_0xd2cf('0x40')](_0xd2cf('0x89'),_0x181826[_0xd2cf('0x8a')],_0xd2cf('0x8b'),_0x23d6b1['name'],_0xd2cf('0x45'),_0x23d6b1[_0xd2cf('0x2d')]);ami['emit'](_0xd2cf('0x8c'),ut[_0xd2cf('0x76')](_0x181826,_0xd2cf('0x8d'),this[_0xd2cf('0x11')][_0x181826['queue']]));if(_0x23d6b1[_0xd2cf('0x8e')]){ami[_0xd2cf('0x25')](_0xd2cf('0x8f'),ut['buildAcw'](_0x181826));}break;case'16':ami[_0xd2cf('0x25')]('custom:agentcomplete',ut[_0xd2cf('0x76')](_0x181826,_0xd2cf('0x90'),this[_0xd2cf('0x11')][_0x181826['queue']]));emitVoiceQueueChannelRemove(ut[_0xd2cf('0x76')](_0x181826,'complete'));_0x23d6b1[_0xd2cf('0x91')]+=0x1;_0x23d6b1[_0xd2cf('0x92')]+=0x1;_0x23d6b1[_0xd2cf('0x93')]+=0x1;ut[_0xd2cf('0x51')](_0x23d6b1,_0xd2cf('0x94'));_0x181826[_0xd2cf('0x75')]=ut[_0xd2cf('0x7c')](_0x181826);ut['logCustomer'](_0x181826,0x4,'Answer');rpcDb['createCustomerHistory'](_0x181826,_0xd2cf('0x95'));rpcDb[_0xd2cf('0x64')](_0x181826,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xd2cf('0x96')](_0x181826);_0x23d6b1[_0xd2cf('0x97')]+=_0x181826[_0xd2cf('0x98')];_0x23d6b1['sumBillable']+=_0x181826['talktime'];logger[_0xd2cf('0x40')](_0xd2cf('0x99'),_0x181826['uniqueid'],_0xd2cf('0x8b'),_0x23d6b1[_0xd2cf('0x28')],_0xd2cf('0x45'),_0x23d6b1[_0xd2cf('0x2d')]);delete this[_0xd2cf('0x13')][_0x14e0ea[_0xd2cf('0x9a')]];break;case _0xd2cf('0x9b'):_0x23d6b1[_0xd2cf('0x9c')]+=0x1;_0x181826[_0xd2cf('0x9d')]+=0x1;_0x181826[_0xd2cf('0x75')]=ut[_0xd2cf('0x7c')](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0x5,_0xd2cf('0x9e'));_0x160ee8=_0x23d6b1[_0xd2cf('0x9f')];_0x2cbfcf=_0x23d6b1[_0xd2cf('0xa0')];ami[_0xd2cf('0x25')](_0xd2cf('0xa1'),ut[_0xd2cf('0x76')](_0x181826,_0xd2cf('0xa2')));rpcDb[_0xd2cf('0x63')](_0x181826,_0xd2cf('0xa3'));_0x4c7305['verifyAdditionalPhones'](_0x181826,'5',_0x23d6b1)[_0xd2cf('0x57')](function(_0x135d46){_0x46dd73=_0x135d46[_0xd2cf('0x7a')]==0x1;if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1[_0xd2cf('0xa4')]){_0x5c4b09=ut[_0xd2cf('0x7d')](_0x181826,0xf,'Global');rpcDb[_0xd2cf('0x64')](_0x5c4b09,_0xd2cf('0xa5'));}else{if(_0x181826[_0xd2cf('0x9d')]>=_0x23d6b1[_0xd2cf('0xa6')]){rpcDb[_0xd2cf('0x64')](_0x181826,_0xd2cf('0xa3'));}else{rpcDb['rescheduleContact'](ut[_0xd2cf('0x80')](_0x181826,_0xd2cf('0x9d'),_0x23d6b1['dialBusyRetryFrequency']),_0x181826[_0xd2cf('0xa7')],_0x181826[_0xd2cf('0x81')]);}}}else{_0x181826[_0xd2cf('0x9d')]++;_0x4c7305['incrementPreviewCounters']({'id':_0x181826[_0xd2cf('0x84')],'field':{'countbusyretry':_0x181826[_0xd2cf('0x9d')]}})[_0xd2cf('0x57')](function(){_0x4c7305['swapAdditionalPhones'](_0x181826,_0x160ee8,_0x2cbfcf)['then'](function(){});});}});break;case _0xd2cf('0xa8'):_0x23d6b1[_0xd2cf('0xa9')]+=0x1;_0x181826['countnoanswerretry']+=0x1;_0x181826[_0xd2cf('0x75')]=ut[_0xd2cf('0x7c')](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0x3,_0xd2cf('0xaa'));_0x160ee8=_0x23d6b1[_0xd2cf('0xab')];_0x2cbfcf=_0x23d6b1[_0xd2cf('0xa0')];var _0x2426f9=ut['buildNoAnswerEventPayload'](_0x181826,_0x23d6b1);ami[_0xd2cf('0x25')]('custom:agentnoanswer',_0x2426f9);rpcDb['createCustomerHistory'](_0x181826,'[callProgressDetectingCustomer][logNoAnswer]');_0x4c7305['verifyAdditionalPhones'](_0x181826,'3',_0x23d6b1)[_0xd2cf('0x57')](function(_0x5dad49){_0x46dd73=_0x5dad49['additional']==0x1;if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1['dialGlobalMaxRetry']){_0x5c4b09=ut['cloneAction'](_0x181826,0xf,_0xd2cf('0x7e'));rpcDb[_0xd2cf('0x64')](_0x5c4b09,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x181826[_0xd2cf('0xac')]>=_0x23d6b1[_0xd2cf('0xad')]){rpcDb[_0xd2cf('0x64')](_0x181826,_0xd2cf('0xae'));}else{rpcDb[_0xd2cf('0xaf')](ut[_0xd2cf('0x80')](_0x181826,_0xd2cf('0xac'),_0x23d6b1[_0xd2cf('0xab')]),_0x181826['unlockAgent'],_0x181826['activeContact']);}}}else{_0x181826[_0xd2cf('0xac')]++;_0x4c7305[_0xd2cf('0x83')]({'id':_0x181826['idContact'],'field':{'countnoanswerretry':_0x181826[_0xd2cf('0xac')]}})[_0xd2cf('0x57')](function(){_0x4c7305[_0xd2cf('0x85')](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});break;case _0xd2cf('0xb0'):_0x23d6b1['outboundCongestionCallsDay']+=0x1;_0x181826[_0xd2cf('0xb1')]+=0x1;_0x181826['countglobal']=ut[_0xd2cf('0x7c')](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0x8,_0xd2cf('0xb2'));_0x160ee8=_0x23d6b1['dialCongestionRetryFrequency'];_0x2cbfcf=_0x23d6b1['callAdditionalPhoneAfterMin'];ami[_0xd2cf('0x25')](_0xd2cf('0xb3'),ut[_0xd2cf('0x76')](_0x181826,'congestion'));rpcDb[_0xd2cf('0x63')](_0x181826,_0xd2cf('0xb4'));_0x4c7305[_0xd2cf('0x79')](_0x181826,'8',_0x23d6b1)[_0xd2cf('0x57')](function(_0x3c8b80){_0x46dd73=_0x3c8b80[_0xd2cf('0x7a')]==0x1;if(!_0x46dd73){if(ut['totalGlobal'](_0x181826)>=_0x23d6b1[_0xd2cf('0xa4')]){_0x5c4b09=ut['cloneAction'](_0x181826,0xf,_0xd2cf('0x7e'));rpcDb['createCustomerFinal'](_0x5c4b09,_0xd2cf('0xb5'));}else{if(_0x181826[_0xd2cf('0xb1')]>=_0x23d6b1['dialCongestionMaxRetry']){rpcDb[_0xd2cf('0x64')](_0x181826,_0xd2cf('0xb4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x181826,_0xd2cf('0xb1'),_0x23d6b1[_0xd2cf('0x9f')]),_0x181826[_0xd2cf('0xa7')],_0x181826['activeContact']);}}}else{_0x181826[_0xd2cf('0xb1')]++;_0x4c7305['incrementPreviewCounters']({'id':_0x181826['idContact'],'field':{'countcongestionretry':_0x181826[_0xd2cf('0xb1')]}})['then'](function(){_0x4c7305['swapAdditionalPhones'](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});break;case _0xd2cf('0xb6'):_0x23d6b1[_0xd2cf('0xb7')]+=0x1;_0x181826[_0xd2cf('0xb8')]+=0x1;_0x181826[_0xd2cf('0x75')]=ut['totalGlobal'](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0x14,'AgentReject');_0x160ee8=_0x23d6b1['dialAgentRejectRetryFrequency'];_0x2cbfcf=_0x23d6b1[_0xd2cf('0xa0')];ami[_0xd2cf('0x25')](_0xd2cf('0xb9'),ut[_0xd2cf('0x76')](_0x181826,_0xd2cf('0xba')));rpcDb[_0xd2cf('0x63')](_0x181826,'[syncHangupRequest][logAgentReject]');_0x4c7305[_0xd2cf('0x79')](_0x181826,'20',_0x23d6b1)[_0xd2cf('0x57')](function(_0x1c53a0){_0x46dd73=_0x1c53a0[_0xd2cf('0x7a')]==0x1;if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1[_0xd2cf('0xa4')]){_0x5c4b09=ut[_0xd2cf('0x7d')](_0x181826,0x14,'AgentReject');rpcDb[_0xd2cf('0x64')](_0x5c4b09,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x181826[_0xd2cf('0xb8')]>=_0x23d6b1[_0xd2cf('0xbb')]){rpcDb[_0xd2cf('0x64')](_0x181826,_0xd2cf('0xbc'));}else{rpcDb[_0xd2cf('0xaf')](ut[_0xd2cf('0x80')](_0x181826,_0xd2cf('0xb8'),_0x23d6b1[_0xd2cf('0xbd')]),_0x181826[_0xd2cf('0xa7')],_0x181826[_0xd2cf('0x81')]);}}}else{_0x181826['countnoanswerretry']++;_0x4c7305[_0xd2cf('0x83')]({'id':_0x181826[_0xd2cf('0x84')],'field':{'countnoanswerretry':_0x181826[_0xd2cf('0xac')]}})['then'](function(){_0x4c7305['swapAdditionalPhones'](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});break;case _0xd2cf('0xbe'):_0x23d6b1['outboundAbandonedCallsDay']+=0x1;_0x181826[_0xd2cf('0xbf')]+=0x1;_0x181826[_0xd2cf('0x75')]=ut[_0xd2cf('0x7c')](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0xb,_0xd2cf('0xc0'));rpcDb[_0xd2cf('0x63')](_0x181826,_0xd2cf('0xc1'));_0x4c7305[_0xd2cf('0x79')](_0x181826,'11',_0x23d6b1)[_0xd2cf('0x57')](function(_0x52644d){_0x46dd73=_0x52644d[_0xd2cf('0x7a')]==0x1;if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1['dialGlobalMaxRetry']){_0x5c4b09=ut[_0xd2cf('0x7d')](_0x181826,0xf,_0xd2cf('0x7e'));rpcDb['createCustomerFinal'](_0x5c4b09,_0xd2cf('0xc1'));}else{if(_0x181826['countabandonedetry']>=_0x23d6b1[_0xd2cf('0xc2')]){rpcDb['createCustomerFinal'](_0x181826,_0xd2cf('0xc1'));}else{rpcDb[_0xd2cf('0xaf')](ut[_0xd2cf('0x80')](_0x181826,_0xd2cf('0xbf'),_0x23d6b1[_0xd2cf('0xc3')]),_0x181826['unlockAgent'],_0x181826[_0xd2cf('0x81')]);}}}else{_0x181826['countnoanswerretry']++;_0x4c7305[_0xd2cf('0x83')]({'id':_0x181826[_0xd2cf('0x84')],'field':{'countnoanswerretry':_0x181826[_0xd2cf('0xac')]}})['then'](function(){_0x4c7305[_0xd2cf('0x85')](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});break;case'18':_0x23d6b1[_0xd2cf('0xc4')]+=0x1;_0x181826['countmachineretry']+=0x1;_0x181826[_0xd2cf('0x75')]=ut[_0xd2cf('0x7c')](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0x12,_0x14e0ea[_0xd2cf('0xc5')]||_0x14e0ea[_0xd2cf('0xc6')]);ami[_0xd2cf('0x25')](_0xd2cf('0xc7'),ut[_0xd2cf('0x76')](_0x181826,'amd'));rpcDb[_0xd2cf('0x63')](_0x181826,'[callProgressDetectingCustomer][hangupInAMD]');_0x4c7305[_0xd2cf('0x79')](_0x181826,'18',_0x23d6b1)[_0xd2cf('0x57')](function(_0x107ded){_0x46dd73=_0x107ded['additional']==0x1;if(!_0x46dd73){if(ut['totalGlobal'](_0x181826)>=_0x23d6b1[_0xd2cf('0xa4')]){_0x5c4b09=ut['cloneAction'](_0x181826,0x12,'Global');rpcDb[_0xd2cf('0x64')](_0x5c4b09,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x181826,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x181826[_0xd2cf('0xac')]++;_0x4c7305[_0xd2cf('0x83')]({'id':_0x181826[_0xd2cf('0x84')],'field':{'countnoanswerretry':_0x181826['countnoanswerretry']}})[_0xd2cf('0x57')](function(){_0x4c7305[_0xd2cf('0x85')](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});delete this[_0xd2cf('0x13')][_0x14e0ea[_0xd2cf('0x9a')]];break;case'19':_0x23d6b1[_0xd2cf('0xc4')]+=0x1;_0x181826[_0xd2cf('0x75')]=ut[_0xd2cf('0x7c')](_0x181826);ut[_0xd2cf('0x5f')](_0x181826,0x13,_0x14e0ea[_0xd2cf('0xc5')]||_0x14e0ea[_0xd2cf('0xc6')]);ami[_0xd2cf('0x25')](_0xd2cf('0xc7'),ut[_0xd2cf('0x76')](_0x181826,'amd'));rpcDb[_0xd2cf('0x63')](_0x181826,_0xd2cf('0xc8'));_0x4c7305['verifyAdditionalPhones'](_0x181826,'18',_0x23d6b1)[_0xd2cf('0x57')](function(_0x3455c6){_0x46dd73=_0x3455c6[_0xd2cf('0x7a')]==0x1;if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1[_0xd2cf('0xa4')]){_0x5c4b09=ut[_0xd2cf('0x7d')](_0x181826,0xf,_0xd2cf('0x7e'));rpcDb[_0xd2cf('0x64')](_0x5c4b09,_0xd2cf('0xc8'));}else{rpcDb['createCustomerFinal'](_0x181826,'[callProgressDetectingCustomer][machine]');}}else{_0x181826[_0xd2cf('0xac')]++;_0x4c7305[_0xd2cf('0x83')]({'id':_0x181826['idContact'],'field':{'countnoanswerretry':_0x181826[_0xd2cf('0xac')]}})[_0xd2cf('0x57')](function(){_0x4c7305[_0xd2cf('0x85')](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});});}});delete this[_0xd2cf('0x13')][_0x14e0ea['linkedid']];break;default:if(_0x181826['dialAnswer']){ut['decrementTalkink'](_0x23d6b1,_0xd2cf('0xc9'));ut[_0xd2cf('0x52')](_0xd2cf('0xca')+_0x23d6b1[_0xd2cf('0x28')],_0x14e0ea);}_0x23d6b1['outboundUnknownCallsDay']+=0x1;_0x181826['countglobal']=ut[_0xd2cf('0x7c')](_0x181826);ut['logCustomer'](_0x181826,0xc,_0x14e0ea[_0xd2cf('0xc5')]||_0x14e0ea[_0xd2cf('0xc6')]);_0x160ee8=_0x23d6b1[_0xd2cf('0xbd')];_0x2cbfcf=_0x23d6b1[_0xd2cf('0xa0')];rpcDb[_0xd2cf('0x63')](_0x181826,_0xd2cf('0xcb'));_0x4c7305[_0xd2cf('0x79')](_0x181826,'20',_0x23d6b1)[_0xd2cf('0x57')](function(_0x3a961a){_0x46dd73=_0x3a961a[_0xd2cf('0x7a')]==0x1;if(!_0x46dd73){if(ut[_0xd2cf('0x7c')](_0x181826)>=_0x23d6b1[_0xd2cf('0xa4')]){_0x5c4b09=ut['cloneAction'](_0x181826,0xf,_0xd2cf('0x7e'));rpcDb[_0xd2cf('0x64')](_0x5c4b09,_0xd2cf('0xcc'));}else{rpcDb[_0xd2cf('0x64')](_0x181826,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x14e0ea[_0xd2cf('0x9a')]];}else{_0x4c7305['swapAdditionalPhones'](_0x181826,_0x160ee8,_0x2cbfcf)[_0xd2cf('0x57')](function(){});}});}if(!(_0x181826[_0xd2cf('0x47')]&&_0x3ab161==='16')){ut['updateOriginated'](_0x23d6b1,'[callProgressDetectingCustomer]');logger[_0xd2cf('0x40')](_0xd2cf('0xcd'),_0x181826[_0xd2cf('0x8a')],_0xd2cf('0x8b'),_0x23d6b1[_0xd2cf('0x28')],_0xd2cf('0x44'),_0x23d6b1[_0xd2cf('0x2c')]);}if(_0x3ab161!==_0xd2cf('0x86')){delete this[_0xd2cf('0x13')][_0x14e0ea['linkedid']];delete this['actions'][_0x14e0ea[_0xd2cf('0xce')]];}_0x23d6b1['queueSummaryCountersUpdated']=!![];}};Preview[_0xd2cf('0x3d')][_0xd2cf('0xcf')]=function(_0x59442f,_0xd9ee88,_0x4a533a){if(_[_0xd2cf('0xd0')](_0xd9ee88)&&'object'!==typeof _0xd9ee88){return;}if(_[_0xd2cf('0xd0')](_0x4a533a)&&_0xd2cf('0xd1')!==typeof _0x4a533a){return;}switch(_0x4a533a['reason']){case'0':ut[_0xd2cf('0xd2')](_0x59442f,0x0,_0xd2cf('0xd3'));rpcDb[_0xd2cf('0xd4')](_0x59442f,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xd2cf('0xd2')](_0x59442f,0x3,_0xd2cf('0xaa'));rpcDb[_0xd2cf('0xd4')](_0x59442f,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x59442f,0x5,'Busy');rpcDb[_0xd2cf('0xd4')](_0x59442f,_0xd2cf('0xd5'));break;case'8':ut[_0xd2cf('0xd2')](_0x59442f,0x8,_0xd2cf('0xb2'));rpcDb['createAgentHistory'](_0x59442f,_0xd2cf('0xd6'));break;case'22':ut[_0xd2cf('0xd2')](_0x59442f,0x16,_0xd2cf('0xd7'));rpcDb['createAgentHistory'](_0x59442f,_0xd2cf('0xd8'));break;default:ut['logAgent'](_0x59442f,0xc,_0x4a533a[_0xd2cf('0xd9')]);rpcDb[_0xd2cf('0xd4')](_0x59442f,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0xd9ee88,_0xd2cf('0xda'));logger['info'](_0xd2cf('0xdb'),_0x59442f[_0xd2cf('0x8a')],_0xd2cf('0x8b'),_0xd9ee88['name'],_0xd2cf('0x44'),_0xd9ee88[_0xd2cf('0x2c')]);delete this[_0xd2cf('0x13')][_0x59442f[_0xd2cf('0x8a')]];};Preview[_0xd2cf('0x3d')]['verifyAdditionalPhones']=function(_0x499b3f,_0x3cd286,_0x4915a6){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x499b3f,_0x3cd286,_0x4915a6)[_0xd2cf('0x4d')](logger['info'](_0xd2cf('0xdc')));};Preview['prototype'][_0xd2cf('0x85')]=function(_0x324e01,_0x21e32d,_0x1e985d){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x324e01,_0x21e32d,_0x1e985d)[_0xd2cf('0x4d')](logger[_0xd2cf('0x40')](_0xd2cf('0xdd')));};Preview[_0xd2cf('0x3d')][_0xd2cf('0x83')]=function(_0x43ecdd){return Promise['resolve']()[_0xd2cf('0x57')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x43ecdd))[_0xd2cf('0x4d')](logger[_0xd2cf('0x40')](_0xd2cf('0xde')));};Preview[_0xd2cf('0x3d')][_0xd2cf('0xdf')]=function(_0x4e9f76,_0x24077c,_0x5b7fc8,_0x43a3c4,_0x516e3d){var _0xc3b9a8=this;return new Promise(function(_0x408eec,_0x20f8b3){if(_[_0xd2cf('0x3f')](_0x24077c)||_['isNil'](_0x24077c[_0xd2cf('0xe0')])||_[_0xd2cf('0x3f')](_0x24077c[_0xd2cf('0xe1')])||_[_0xd2cf('0x3f')](_0x24077c['VoiceQueueId'])){_0x20f8b3(ut[_0xd2cf('0x2f')](_0xd2cf('0xe2'),_0x43a3c4,_0x516e3d));return;}var _0x4381f1=uuid['v4']();var _0x3ee56d=_0xc3b9a8['campaignsPreview'][_0x24077c[_0xd2cf('0x42')][_0xd2cf('0x28')]];var _0x424f94=_0x5b7fc8?_0xc3b9a8[_0xd2cf('0x14')][_0x5b7fc8]['id']:undefined;_0xc3b9a8[_0xd2cf('0x13')][_0x4381f1]=new Action(_0x24077c,_0x3ee56d,_0x4381f1,_0x5b7fc8,_0x424f94);var _0x314b98=_0xc3b9a8[_0xd2cf('0x13')][_0x4381f1];_0x314b98[_0xd2cf('0xa7')]=_0x43a3c4;_0x314b98[_0xd2cf('0x81')]=_0x516e3d;_0x314b98[_0xd2cf('0xe3')]=_0x5b7fc8;if(_[_0xd2cf('0xe4')](_0x4e9f76)){_0xc3b9a8[_0xd2cf('0xe5')](_0x314b98,_0x3ee56d,_0x24077c,_0x5b7fc8)['then'](function(_0x49143f){logger[_0xd2cf('0x40')](_0xd2cf('0xe6'),'Queue:\x20'+_0x314b98[_0xd2cf('0x43')]+_0xd2cf('0xe7')+_0x314b98[_0xd2cf('0x84')],JSON[_0xd2cf('0x46')](_0x49143f));ami['emit'](_0xd2cf('0xe8'),ut[_0xd2cf('0x76')](_0x314b98,'called',_0xc3b9a8[_0xd2cf('0x11')][_0x314b98[_0xd2cf('0x43')]]));_0x408eec(ut[_0xd2cf('0x2f')](_0xd2cf('0xe9')));})[_0xd2cf('0x4d')](function(_0x4dc032){ut[_0xd2cf('0x31')](_0xd2cf('0xea'),_0x4dc032);_0x20f8b3(ut['message'](_0xd2cf('0xeb'),_0x43a3c4,_0x516e3d));});}else{_0x3ee56d['outboundBlacklistCallsDay']+=0x1;ut[_0xd2cf('0xec')](_0x314b98);rpcDb[_0xd2cf('0xed')](_0x314b98,_0xd2cf('0xee'));delete _0xc3b9a8['actions'][_0x4381f1];_0x20f8b3(ut[_0xd2cf('0x2f')](_0xd2cf('0xef'),_0x43a3c4,_0x516e3d));}});};Preview[_0xd2cf('0x3d')][_0xd2cf('0x6e')]=function(_0x3a9385){return!_[_0xd2cf('0x3f')](_0x3a9385)&&!_['isNil'](_0x3a9385[_0xd2cf('0x28')])&&!_[_0xd2cf('0x3f')](_0x3a9385[_0xd2cf('0xf0')])&&_0x3a9385['active']&&!_['isNil'](this[_0xd2cf('0x12')][util[_0xd2cf('0x27')](_0xd2cf('0xf1'),_0x3a9385['name'])])&&!_['isNil'](this[_0xd2cf('0x12')][util[_0xd2cf('0x27')](_0xd2cf('0xf1'),_0x3a9385['name'])]['status'])&&(this['trunks'][util[_0xd2cf('0x27')]('SIP/%s',_0x3a9385['name'])][_0xd2cf('0x4b')]===_0xd2cf('0xf2')||this[_0xd2cf('0x12')][util[_0xd2cf('0x27')]('SIP/%s',_0x3a9385[_0xd2cf('0x28')])][_0xd2cf('0x4b')]===_0xd2cf('0xf3'));};Preview['prototype'][_0xd2cf('0xf4')]=function(_0x37fd06,_0x2d8eed){return this[_0xd2cf('0xf5')](_0x37fd06,_0x2d8eed)[_0xd2cf('0x57')](function(_0x21f409){return _['pick'](_0x21f409,[_0xd2cf('0x2f')]);})['catch'](function(_0x3544b5){if(_0x3544b5[_0xd2cf('0xf6')]){rpcDb['unlockContact'](_0x37fd06);}if(_0x3544b5[_0xd2cf('0xf0')]){rpcDb[_0xd2cf('0x5c')](_0x37fd06);}throw _[_0xd2cf('0xf7')](_0x3544b5,[_0xd2cf('0x2f')]);});};Preview[_0xd2cf('0x3d')]['execRun']=function(_0x46f446,_0x48c549){var _0x1e62f4=this;var _0xb55f01,_0x18f24c;return rpcDb['getContactPreview'](_0x46f446)[_0xd2cf('0x57')](function(_0x70b180){if(!_['isNil'](_0x70b180[0x0])){_0x18f24c=_0x70b180[0x0][_0xd2cf('0xf8')]?![]:!![];_0xb55f01=_0x70b180[0x0][_0xd2cf('0xf8')]?!![]:![];_0xb55f01=_0x48c549?!![]:_0xb55f01;}var _0x573e56=_0x1e62f4[_0xd2cf('0xf9')](_0x70b180);if(_0x573e56[_0xd2cf('0xfa')]){rpcDb['checkIsBlackList'](_['pick'](_0x70b180[0x0],['VoiceQueueId','phone']))[_0xd2cf('0x57')](function(_0x4a60b2){_0x1e62f4[_0xd2cf('0xdf')](_0x4a60b2,_0x70b180[0x0],_0x48c549,_0x18f24c,_0xb55f01)[_0xd2cf('0x57')](function(_0x3b4582){return _0x3b4582;})[_0xd2cf('0x4d')](function(_0x3e023a){throw _0x3e023a;});})[_0xd2cf('0x4d')](function(_0x4db5fa){ut[_0xd2cf('0x31')](_0xd2cf('0xfb'),_0x4db5fa);throw ut[_0xd2cf('0x2f')]('Call\x20unsuccessful',_0x18f24c,_0xb55f01);});}else{throw ut['message'](_0x573e56['message'],_0x18f24c,_0xb55f01);}})[_0xd2cf('0x4d')](function(_0xac7dad){ut['logger'](_0xd2cf('0xfc'),_0xac7dad);throw ut[_0xd2cf('0x2f')](_0xd2cf('0xfd'),![],!![]);});};Preview[_0xd2cf('0x3d')][_0xd2cf('0xf9')]=function(_0x20b5ac){if(_[_0xd2cf('0x3f')](_0x20b5ac)||_[_0xd2cf('0xe4')](_0x20b5ac)||!_[_0xd2cf('0x3f')](_0x20b5ac[0x0][_0xd2cf('0x59')])&&_[_0xd2cf('0x3f')](_0x20b5ac[0x0][_0xd2cf('0x59')][_0xd2cf('0x28')])){ut[_0xd2cf('0x31')](_0xd2cf('0xfe'),_0x20b5ac);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x121a37=this[_0xd2cf('0x11')][_0x20b5ac[0x0]['Queue']['name']];_0x121a37['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_['isNil'](_0x121a37)){ut[_0xd2cf('0x31')](_0xd2cf('0xff'),_0x121a37);return{'isValid':![],'message':_0xd2cf('0x100')};}if(!this[_0xd2cf('0x6e')](_0x121a37[_0xd2cf('0x6d')])){ut[_0xd2cf('0x31')](_0xd2cf('0x101'),_0xd2cf('0x102')+_0x121a37[_0xd2cf('0x28')]+_0xd2cf('0x103'));if(!this['isTrunkReachable'](_0x121a37[_0xd2cf('0x6f')])){ut['logger'](_0xd2cf('0x101'),_0x121a37[_0xd2cf('0x28')]+_0xd2cf('0x104'));return{'isValid':![],'message':_0xd2cf('0x105')};}}if(!ut[_0xd2cf('0x6b')](_0x121a37['dialActive'])){ut[_0xd2cf('0x31')](_0xd2cf('0x106'),_0x121a37[_0xd2cf('0x28')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xd2cf('0x102')+_0x121a37['name']+_0xd2cf('0x107')};}return{'isValid':!![],'message':_0xd2cf('0x108')};};Preview[_0xd2cf('0x3d')][_0xd2cf('0xe5')]=function(_0x436fc7,_0x464326,_0xc21953,_0x234a15){var _0x485eb3=this;return new Promise(function(_0x4fcec3,_0x490c5b){var _0x129cd1=_0x436fc7[_0xd2cf('0x8a')];var _0x402472=_0x485eb3[_0xd2cf('0x6e')](_0x464326[_0xd2cf('0x6d')])?util['format'](_0xd2cf('0x109'),_0x464326['Trunk']['name'],_[_0xd2cf('0x3f')](_0x464326[_0xd2cf('0x10a')])?'':_0x464326[_0xd2cf('0x10a')][_0xd2cf('0x10b')]()||'',_0x464326['dialCutDigit']>0x0?_0xc21953[_0xd2cf('0xe1')][_0xd2cf('0x10c')](_0x464326[_0xd2cf('0x10d')]):_0xc21953[_0xd2cf('0xe1')]):util['format'](_0xd2cf('0x109'),_['isNil'](_0x464326['TrunkBackup'])?_0x464326[_0xd2cf('0x6d')][_0xd2cf('0x28')]:_0x464326[_0xd2cf('0x6f')]['name'],_[_0xd2cf('0x3f')](_0x464326[_0xd2cf('0x10a')])?'':_0x464326[_0xd2cf('0x10a')][_0xd2cf('0x10b')]()||'',_0x464326[_0xd2cf('0x10d')]>0x0?_0xc21953[_0xd2cf('0xe1')][_0xd2cf('0x10c')](_0x464326[_0xd2cf('0x10d')]):_0xc21953['phone']);var _0xab1164=_0x485eb3[_0xd2cf('0x6e')](_0x464326['Trunk'])?ut[_0xd2cf('0x10e')](_0x464326[_0xd2cf('0x6d')][_0xd2cf('0x10f')],_0x464326['dialOriginateCallerIdName'],_0x464326[_0xd2cf('0x110')]>0x0?ut[_0xd2cf('0x111')](_0x464326[_0xd2cf('0x112')],_0x464326[_0xd2cf('0x110')]):_0x464326['dialOriginateCallerIdNumber']):ut[_0xd2cf('0x10e')](_[_0xd2cf('0x3f')](_0x464326['TrunkBackup'])?_0x464326['Trunk']['callerid']:_0x464326['TrunkBackup']['callerid'],_0x464326[_0xd2cf('0x113')],_0x464326['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd2cf('0x111')](_0x464326[_0xd2cf('0x112')],_0x464326[_0xd2cf('0x110')]):_0x464326[_0xd2cf('0x112')]);if(_0xab1164){_0x436fc7[_0xd2cf('0x114')]=ut[_0xd2cf('0x115')](_0xab1164);_0x436fc7['originatecalleridnum']=ut['extractCalleridNumber'](_0xab1164);}var _0x532b77=ut[_0xd2cf('0x116')](_0x464326,_0xc21953,_0x402472,_0xab1164,_0x129cd1,_0x436fc7);var _0x27b6b8=utils[_0xd2cf('0x117')](_0xc21953[_0xd2cf('0xe0')]);Object['assign'](_0x532b77,_0x27b6b8);_[_0xd2cf('0x118')](_0x436fc7,ut[_0xd2cf('0x119')](_0x532b77));_0x436fc7[_0xd2cf('0x5d')]=moment()[_0xd2cf('0x27')](_0xd2cf('0x87'));_0x464326[_0xd2cf('0x11a')]=_0x532b77;var _0x46be17=ut['variablesAction'](_0x436fc7,_0x464326,_0x532b77,_0x436fc7['activeContact'],_0x234a15);return ami[_0xd2cf('0x4a')](_0x46be17)[_0xd2cf('0x57')](function(_0x9d1511){_0x464326[_0xd2cf('0x2c')]+=0x1;logger[_0xd2cf('0x40')](_0xd2cf('0x11b'),_0x129cd1,'\x20Queue',_0x464326[_0xd2cf('0x28')],_0xd2cf('0x44'),_0x464326['originated']);_0x4fcec3(_0x9d1511);})['catch'](function(_0x274d1e){ut[_0xd2cf('0xd2')](_0x436fc7,0xe,_0xd2cf('0x11c'));rpcDb[_0xd2cf('0xd4')](_0x436fc7,_0xd2cf('0x11d'));_0x490c5b(_0x274d1e);});});};Preview[_0xd2cf('0x3d')][_0xd2cf('0x1d')]=function(_0x50f609){if(this[_0xd2cf('0x13')][_0x50f609[_0xd2cf('0x9a')]]){this['actions'][_0x50f609['linkedid']][_0xd2cf('0x4c')]=_0x50f609[_0xd2cf('0x4c')];}};Preview['prototype'][_0xd2cf('0x16')]=function(_0x5d1fab){var _0x118772=this;var _0x20cc1e=this['actions'][_0x5d1fab[_0xd2cf('0x11e')]];if(_0x20cc1e){if(_0x20cc1e['lookAgent']&&this[_0xd2cf('0x14')][_0x20cc1e['lookAgent']]){ut[_0xd2cf('0x11f')](_0x20cc1e,this[_0xd2cf('0x14')][_0x20cc1e[_0xd2cf('0xe3')]][_0xd2cf('0x28')],this[_0xd2cf('0x14')][_0x20cc1e[_0xd2cf('0xe3')]]['id']);}var _0x301834=_['clone'](_0x20cc1e);_0x301834[_0xd2cf('0x120')]=moment()[_0xd2cf('0x27')](_0xd2cf('0x87'));var _0x3dd566=_0x118772['campaignsPreview'][_0x20cc1e[_0xd2cf('0x43')]];if(ut[_0xd2cf('0x121')](_0x5d1fab[_0xd2cf('0x122')])){if(_0x20cc1e['unlockAgent']){rpcDb[_0xd2cf('0x123')](_0x20cc1e[_0xd2cf('0x84')]);}if(_0x20cc1e[_0xd2cf('0x81')]){rpcDb['disableContact'](_0x20cc1e[_0xd2cf('0x84')]);}ami[_0xd2cf('0x25')]('custom:agentringnoanswer',ut['buildObj'](_0x20cc1e,_0xd2cf('0x124'),this[_0xd2cf('0x11')][_0x20cc1e[_0xd2cf('0x43')]]));this[_0xd2cf('0xcf')](_0x301834,_0x3dd566,_0x5d1fab);}else{_0x20cc1e[_0xd2cf('0x5d')]=moment()[_0xd2cf('0x27')](_0xd2cf('0x87'));ut[_0xd2cf('0xd2')](_0x301834,0x4,_0xd2cf('0x125'));rpcDb[_0xd2cf('0xd4')](_0x301834,_0xd2cf('0x126'));}}};Preview['prototype']['syncHangup']=function(_0x4e8ebc){var _0x47768d=this[_0xd2cf('0x13')][_0x4e8ebc[_0xd2cf('0x9a')]];var _0x1ee6df;if(_0x47768d){_0x1ee6df=this[_0xd2cf('0x11')][_0x47768d[_0xd2cf('0x43')]];logger['info']('[syncHangup][talking]',_0x4e8ebc[_0xd2cf('0x9a')],'\x20Queue',_0x1ee6df[_0xd2cf('0x28')],_0xd2cf('0x45'),_0x1ee6df[_0xd2cf('0x2d')]);}if(this[_0xd2cf('0x13')][_0x4e8ebc['linkedid']]&&_0x4e8ebc[_0xd2cf('0x9a')]!==_0x4e8ebc[_0xd2cf('0x8a')]){if(_0x4e8ebc[_0xd2cf('0x127')]==='16'&&this[_0xd2cf('0x13')][_0x4e8ebc[_0xd2cf('0x9a')]][_0xd2cf('0x47')]){this['callProgressDetectingCustomer'](_0x4e8ebc,_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc['cause']);}else if(this[_0xd2cf('0x13')][_0x4e8ebc[_0xd2cf('0x9a')]][_0xd2cf('0x47')]){logger[_0xd2cf('0x40')](_0xd2cf('0x128'),_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc[_0xd2cf('0x127')],_0xd2cf('0x8b'),_0x1ee6df[_0xd2cf('0x28')],_0xd2cf('0x45'),_0x1ee6df[_0xd2cf('0x2d')]);this['callProgressDetectingCustomer'](_0x4e8ebc,_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc[_0xd2cf('0x127')]);}}else if(_0x47768d&&_[_0xd2cf('0x3f')](_0x47768d['statedesc'])&&_0x1ee6df[_0xd2cf('0x129')]&&_0x4e8ebc[_0xd2cf('0x9a')]===_0x4e8ebc[_0xd2cf('0x8a')]&&_[_0xd2cf('0x3f')](_0x4e8ebc[_0xd2cf('0xd9')])&&_0x4e8ebc['cause']==='16'&&_0x4e8ebc[_0xd2cf('0x12a')]==='6'&&_[_0xd2cf('0xd0')](_0x47768d['transfer'])){if(_0x47768d[_0xd2cf('0xa7')]){rpcDb[_0xd2cf('0x123')](_0x47768d[_0xd2cf('0x84')]);}if(_0x47768d[_0xd2cf('0x81')]){rpcDb[_0xd2cf('0x5c')](_0x47768d[_0xd2cf('0x84')]);}_0x4e8ebc[_0xd2cf('0xd9')]='22';this['callProgressDetectingAgent'](_0x47768d,_0x1ee6df,_0x4e8ebc);}else if(_0x47768d&&_0x47768d[_0xd2cf('0x12b')]){if(_0x4e8ebc[_0xd2cf('0x127')]==='16'&&this[_0xd2cf('0x13')][_0x4e8ebc[_0xd2cf('0x9a')]][_0xd2cf('0x47')]){logger[_0xd2cf('0x40')]('[syncHangup][talking][transfer]',_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc[_0xd2cf('0x127')],_0xd2cf('0x8b'),_0x1ee6df['name'],_0xd2cf('0x45'),_0x1ee6df[_0xd2cf('0x2d')]);this['callProgressDetectingCustomer'](_0x4e8ebc,_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc['cause']);}else if(this[_0xd2cf('0x13')][_0x4e8ebc[_0xd2cf('0x9a')]][_0xd2cf('0x47')]){logger[_0xd2cf('0x40')](_0xd2cf('0x128'),_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc[_0xd2cf('0x127')],_0xd2cf('0x8b'),_0x1ee6df[_0xd2cf('0x28')],_0xd2cf('0x45'),_0x1ee6df['pTalking']);this['callProgressDetectingCustomer'](_0x4e8ebc,_0x4e8ebc[_0xd2cf('0x9a')],_0x4e8ebc[_0xd2cf('0x127')]);}}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x1c')]=function(_0x3e4902){if(this['actions'][_0x3e4902['destlinkedid']]&&_0x3e4902['destlinkedid']!==_0x3e4902[_0xd2cf('0x12c')]){this[_0xd2cf('0x72')](_0x3e4902,_0x3e4902[_0xd2cf('0xce')],_0x3e4902[_0xd2cf('0xc6')]);}};Preview['prototype'][_0xd2cf('0x1a')]=function(_0x5d5d88){if(this[_0xd2cf('0x13')][_0x5d5d88[_0xd2cf('0x9a')]]&&_0x5d5d88[_0xd2cf('0x9a')]!==_0x5d5d88[_0xd2cf('0x8a')]&&!this[_0xd2cf('0x13')][_0x5d5d88['linkedid']][_0xd2cf('0x47')]){if(_0x5d5d88[_0xd2cf('0x127')]==='1'){this[_0xd2cf('0x72')](_0x5d5d88,_0x5d5d88[_0xd2cf('0x9a')],_0x5d5d88[_0xd2cf('0x127')]);}}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x12d')]=function(_0x32ffe1,_0x1d7d7d,_0x17a2f7){if(this['actions'][_0x32ffe1]){if(_[_0xd2cf('0x3f')](this[_0xd2cf('0x13')][_0x32ffe1]['variables'])){this[_0xd2cf('0x13')][_0x32ffe1][_0xd2cf('0x11a')]={};}this['actions'][_0x32ffe1][_0xd2cf('0x11a')][_0x1d7d7d]=_0x17a2f7;}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x1f')]=function(_0x209ab5){try{if(!_['isNil'](_0x209ab5)){if(ut[_0xd2cf('0x12e')](_[_0xd2cf('0x12f')](_0x209ab5[_0xd2cf('0x130')])[0x0])){this[_0xd2cf('0x12d')](_0x209ab5['uniqueid'],_[_0xd2cf('0x12f')](_0x209ab5[_0xd2cf('0x130')])[0x0],_0x209ab5[_0xd2cf('0x131')]);}}}catch(_0x1e5266){logger['error'](_0xd2cf('0x132'),util[_0xd2cf('0x133')](_0x1e5266,{'showHidden':![],'depth':null}));}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x21')]=function(_0x294d8a){if(_0x294d8a){if(this[_0xd2cf('0x13')][_0x294d8a[_0xd2cf('0x134')]]){this[_0xd2cf('0x13')][_0x294d8a[_0xd2cf('0x134')]][_0xd2cf('0x12b')]=!![];}}};Preview[_0xd2cf('0x3d')][_0xd2cf('0x23')]=function(_0x5ecf1e){if(_0x5ecf1e){if(this[_0xd2cf('0x13')][_0x5ecf1e[_0xd2cf('0x135')]]){this['actions'][_0x5ecf1e['transfererlinkedid']][_0xd2cf('0x12b')]=!![];}}};module[_0xd2cf('0x136')]=Preview; \ No newline at end of file +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 diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6996519..8325cb0 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 _0x9d30=['exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','resolve','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','catch','then','createHistory','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip'];(function(_0x344ed6,_0x3eb850){var _0xeec74e=function(_0x1cb28b){while(--_0x1cb28b){_0x344ed6['push'](_0x344ed6['shift']());}};_0xeec74e(++_0x3eb850);}(_0x9d30,0x75));var _0x09d3=function(_0x5b4d71,_0x50d494){_0x5b4d71=_0x5b4d71-0x0;var _0x35c756=_0x9d30[_0x5b4d71];return _0x35c756;};'use strict';var util=require(_0x09d3('0x0'));var BPromise=require('bluebird');var logger=require(_0x09d3('0x1'))(_0x09d3('0x2'));var cmHopper=require(_0x09d3('0x3'));var cmHopperHistory=require(_0x09d3('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x09d3('0x5'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x35b03f){return function(_0x276b26){logger[_0x09d3('0x6')](_0x35b03f,util['inspect'](_0x276b26,{'showHidden':![],'depth':null}));};}function create(_0x59752b){return cmHopperHistory['createHistory'](_0x59752b)[_0x09d3('0x7')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x331abe){return BPromise['resolve']()[_0x09d3('0x8')](agentReportPreview[_0x09d3('0x9')](_0x331abe))[_0x09d3('0x7')](loggerCatch(_0x09d3('0xa')));}function moveContact(_0x2b2f40){return cmHopper[_0x09d3('0xb')](_0x2b2f40,!![])[_0x09d3('0x7')](loggerCatch(_0x09d3('0xc')));}exports[_0x09d3('0xd')]=function(_0x266940){return cmHopperBlack[_0x09d3('0xd')](_0x266940)[_0x09d3('0x7')](loggerCatch(_0x09d3('0xe')));};exports['getContactPreview']=function(_0x56ec68){return BPromise['resolve']()[_0x09d3('0x8')](cmHopper[_0x09d3('0xf')](_0x56ec68))[_0x09d3('0x7')](loggerCatch(_0x09d3('0x10')));};exports[_0x09d3('0x9')]=function(_0x44b5b2,_0x31a999){create(_0x44b5b2)[_0x09d3('0x7')](loggerCatch(_0x31a999));moveContact(_0x44b5b2)[_0x09d3('0x7')](loggerCatch(_0x31a999));};exports['createAgentHistory']=function(_0x1de997,_0x185c8e){createAgent(_0x1de997)[_0x09d3('0x7')](loggerCatch(_0x185c8e));};exports['createCustomerHistory']=function(_0x5a881b,_0x1c7edc){create(_0x5a881b)[_0x09d3('0x7')](loggerCatch(_0x1c7edc));};exports[_0x09d3('0x11')]=function(_0x1a62fb,_0x58dd6b){moveContact(_0x1a62fb)['catch'](loggerCatch(_0x58dd6b));};exports['rescheduleContact']=function(_0xd588d8,_0x2bd8d5,_0x2e2a21){if(_0x2bd8d5){_0xd588d8[_0x09d3('0x12')]=null;}if(_0x2e2a21){_0xd588d8[_0x09d3('0x13')]=![];}return cmHopper[_0x09d3('0x14')](_0xd588d8)[_0x09d3('0x7')](loggerCatch(_0x09d3('0x15')));};exports[_0x09d3('0x16')]=function(_0x1d7430){return cmHopper[_0x09d3('0x16')](_0x1d7430)[_0x09d3('0x7')](loggerCatch(_0x09d3('0x17')));};exports[_0x09d3('0x18')]=function(_0x4306f5){return cmHopper[_0x09d3('0x18')]({'UserId':null},_0x4306f5,0x1)[_0x09d3('0x7')](loggerCatch(_0x09d3('0x19')));};exports[_0x09d3('0x1a')]=function(_0x10649e){return cmHopper[_0x09d3('0x18')]({'active':![]},_0x10649e,0x1)['catch'](loggerCatch(_0x09d3('0x1b')));};exports['crateCustomerReportQueue']=function(_0x4b670d){var _0x1daba5={};_0x1daba5[_0x09d3('0x1c')]=_0x4b670d['type'];_0x1daba5[_0x09d3('0x1d')]=_0x4b670d[_0x09d3('0x1d')];_0x1daba5[_0x09d3('0x1e')]=_0x4b670d['calleridnum'];_0x1daba5['calleridname']=_0x4b670d[_0x09d3('0x1f')];_0x1daba5['queue']=_0x4b670d[_0x09d3('0x20')];_0x1daba5[_0x09d3('0x21')]=_0x4b670d['answertime'];_0x1daba5[_0x09d3('0x22')]=_0x4b670d['answertime'];_0x1daba5[_0x09d3('0x23')]=0x1;_0x1daba5[_0x09d3('0x24')]=_0x4b670d[_0x09d3('0x25')];_0x1daba5[_0x09d3('0x26')]=_0x4b670d[_0x09d3('0x27')];_0x1daba5[_0x09d3('0x28')]=_0x09d3('0x29');_0x1daba5[_0x09d3('0x2a')]=_0x09d3('0x2b');_0x1daba5[_0x09d3('0x2c')]=0x0;_0x1daba5['assigned']=0x1;_0x1daba5[_0x09d3('0x2d')]=_0x4b670d[_0x09d3('0x27')];_0x1daba5[_0x09d3('0x2e')]=_0x09d3('0x2f');return BPromise['resolve']()[_0x09d3('0x8')](voiceQueueReport[_0x09d3('0x30')](_0x1daba5))[_0x09d3('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x09d3('0x31')]=function(_0x1c139e,_0x1c4b32){return BPromise[_0x09d3('0x32')]()['then'](cmHopper[_0x09d3('0x31')](_0x1c139e,_0x1c4b32))[_0x09d3('0x7')](loggerCatch(_0x09d3('0x33')));};exports[_0x09d3('0x34')]=function(_0x68c200){return cmHopper[_0x09d3('0x14')](_0x68c200,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +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 diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 9c6a908..123f177 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 _0x2afd=['countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','channelAgent','voice','mandatoryDisposition','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','pow','replace','extractCalleridName','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','dialQueueProject2','originatecalleridnum','Call-Type:\x20PREVIEW','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','statedesc','talktime','answertime','Failure','RECALL','BOOKED','uniqueid','xcally-motion-preview','from-sip','totalGlobal','countbusyretry','countcongestionretry'];(function(_0x35fb79,_0x47f0dc){var _0x1f6764=function(_0x219ad9){while(--_0x219ad9){_0x35fb79['push'](_0x35fb79['shift']());}};_0x1f6764(++_0x47f0dc);}(_0x2afd,0x1d8));var _0xd2af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2afd[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0xd2af('0x0'));var _=require(_0xd2af('0x1'));var moment=require('moment');var logger=require(_0xd2af('0x2'))(_0xd2af('0x3'));var ipAgi=process[_0xd2af('0x4')][_0xd2af('0x5')]||_0xd2af('0x6');var utils=require(_0xd2af('0x7'));exports[_0xd2af('0x8')]=function(_0x1fb351){return function(_0x57f661){logger['error'](_0x1fb351,util[_0xd2af('0x9')](_0x57f661,{'showHidden':![],'depth':null}));};};exports[_0xd2af('0xa')]=function(_0x41593b,_0x2d90d3){logger[_0xd2af('0xb')](_0x41593b,util['inspect'](_0x2d90d3,{'showHidden':![],'depth':null}));};exports[_0xd2af('0xc')]=function(_0x4b16e4,_0x54ae81){logger[_0xd2af('0xd')](_0x4b16e4,util[_0xd2af('0x9')](_0x54ae81,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x171776){return function(_0x7271ed){logger[_0xd2af('0xb')](_0x171776,util[_0xd2af('0x9')](_0x7271ed,{'showHidden':![],'depth':null}));};};exports[_0xd2af('0xe')]=function(_0x48a504,_0x331daf,_0x23dab7){return{'message':_0x48a504,'unlock':_0x331daf,'active':_0x23dab7};};exports[_0xd2af('0xf')]=function(_0x5af23a,_0x33cd2a,_0x3668a8){if(!_[_0xd2af('0x10')](_0x3668a8)&&'string'===typeof _0x3668a8&&!_[_0xd2af('0x11')](_0x3668a8)){if(!_[_0xd2af('0x10')](_0x33cd2a)&&_0xd2af('0x12')===typeof _0x33cd2a&&!_[_0xd2af('0x11')](_0x33cd2a)){return util['format']('\x22%s\x22\x20<%s>',_0x33cd2a,_0x3668a8);}return util[_0xd2af('0x13')](_0xd2af('0x14'),_0x3668a8,_0x3668a8);}if(!_[_0xd2af('0x10')](_0x5af23a)&&_0xd2af('0x12')===typeof _0x5af23a&&!_[_0xd2af('0x11')](_0x5af23a)){return _0x5af23a;}return _0xd2af('0x15');};exports[_0xd2af('0x16')]=function(_0x4e7bff){if(_[_0xd2af('0x17')](_0x4e7bff)){return![];}return _0x4e7bff;};exports[_0xd2af('0x18')]=function(_0x5f5c83,_0x1b64f2,_0xf261e9,_0x58c50f,_0x5347f7,_0x4c7eea){var _0x50cddd={'XMD-QUEUE':_0x1b64f2[_0xd2af('0x19')]?_0x1b64f2[_0xd2af('0x19')][_0xd2af('0x1a')]:'','XMD-CALLERID':_0x58c50f,'XMD-CALLERID-PREVIEW':_0x4c7eea?util[_0xd2af('0x13')](_0xd2af('0x14'),_0x4c7eea[_0xd2af('0x1b')],_0x4c7eea[_0xd2af('0x1c')]):_0x58c50f,'XMD-DIALID':_0x5347f7,'XMD-CONTACTID':_0x1b64f2[_0xd2af('0x1d')],'XMD-CDRTYPE':_0xd2af('0x1e'),'CALLERID(all)':_0x58c50f,'XMD-VOICEQUEUEID':_0x1b64f2[_0xd2af('0x1f')],'XMD-DIALCHANNEL':_0xf261e9,'XMD-DIALTIMEOUT':_0x5f5c83['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xd2af('0x13')](_0xd2af('0x20'),_0x5f5c83['dialQueueProject2']?'g':'',_['isEmpty'](_0x5f5c83[_0xd2af('0x21')])?'':_0xd2af('0x22')),'XMD-DIALURL':_0x5f5c83['dialPreviewUrl']||'','XMD-AGI':_0x5f5c83[_0xd2af('0x23')]?util[_0xd2af('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5f5c83['dialQueueProject']):_0xd2af('0x24'),'XMD-AGIAFTER':_0x5f5c83['dialQueueProject2']?util[_0xd2af('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5f5c83[_0xd2af('0x25')]):_0xd2af('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x4c7eea?_0x4c7eea[_0xd2af('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x4c7eea?_0x4c7eea['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xd2af('0x27')};if(!_['isEmpty'](_0x5f5c83[_0xd2af('0x21')])){_0x50cddd[util[_0xd2af('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5f5c83[_0xd2af('0x21')];_0x50cddd[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5347f7;}return _0x50cddd;};exports[_0xd2af('0x28')]=function(_0x29f392){var _0x18deae={};for(var _0x4dd219 in _0x29f392){if(_0x29f392[_0xd2af('0x29')](_0x4dd219)){_0x18deae[util['format']('%s',_[_0xd2af('0x2a')](_0x4dd219))]=_0x29f392[_0x4dd219];}}return{'variables':_0x18deae};};exports[_0xd2af('0x2b')]=function(_0x4228ef,_0x24b35a){if(!_[_0xd2af('0x17')](_0x4228ef)){if(_0x4228ef[_0xd2af('0x29')](_0xd2af('0x2c'))){if(_0x4228ef[_0xd2af('0x2c')]>0x0){_0x4228ef['originated']-=0x1;}else{logger['error'](_0xd2af('0x2d'),_0x24b35a);}}}else{logger['error'](_0xd2af('0x2e'),_0x24b35a);}};exports[_0xd2af('0x2f')]=function(_0x35800c){var _0x296bc7=moment()[_0xd2af('0x13')](_0xd2af('0x30'));_0x35800c[_0xd2af('0x31')]=0xd;_0x35800c['statedesc']=_0xd2af('0x32');_0x35800c['starttime']=_0x296bc7;_0x35800c[_0xd2af('0x33')]=_0x296bc7;_0x35800c[_0xd2af('0x34')]=_0x296bc7;};exports[_0xd2af('0x35')]=function(_0x14d4f8,_0x2484dd,_0x3d1d1b){var _0x14605d=moment()[_0xd2af('0x13')](_0xd2af('0x30'));_0x14d4f8['state']=_0x2484dd;_0x14d4f8['statedesc']=_0x3d1d1b;_0x14d4f8[_0xd2af('0x33')]=_0x14605d;_0x14d4f8[_0xd2af('0x36')]=utils[_0xd2af('0x37')](_0x14d4f8['responsetime'],_0x14d4f8[_0xd2af('0x38')]);};exports[_0xd2af('0x39')]=function(_0x2a1777,_0x5155bb,_0x161d82){_0x2a1777[_0xd2af('0x3a')]=_0x5155bb;_0x2a1777[_0xd2af('0x3b')]=_0x161d82;};exports['logCustomer']=function(_0x29767f,_0x108f5f,_0x205256){var _0x26f10a=moment()['format'](_0xd2af('0x30'));_0x29767f[_0xd2af('0x31')]=_0x108f5f;_0x29767f[_0xd2af('0x3c')]=_0x205256;_0x29767f[_0xd2af('0x33')]=_0x29767f[_0xd2af('0x33')]?_0x29767f[_0xd2af('0x33')]:_0x26f10a;_0x29767f[_0xd2af('0x34')]=_0x29767f['endtime']?_0x29767f['endtime']:_0x26f10a;_0x29767f['ringtime']=utils[_0xd2af('0x37')](_0x29767f[_0xd2af('0x33')]||0x0,_0x29767f[_0xd2af('0x38')]||0x0);_0x29767f[_0xd2af('0x3d')]=_0x29767f['answertime']?utils[_0xd2af('0x37')](_0x29767f[_0xd2af('0x34')],_0x29767f[_0xd2af('0x3e')]):0x0;};exports['isFailure']=function(_0x355830){return _0x355830===_0xd2af('0x3f');};exports['variablesAction']=function(_0x3791f6,_0x1abeaa,_0x1a34d2,_0x5c20ed,_0x2a67b4){var _0x4123b7=_0x5c20ed?_0xd2af('0x40'):_0x3791f6[_0xd2af('0x1b')];_0x4123b7=_0x2a67b4?_0xd2af('0x41'):_0x4123b7;return{'actionid':_0x3791f6[_0xd2af('0x42')],'action':'originate','channel':_0x3791f6['channelAgent'],'callerid':util[_0xd2af('0x13')](_0xd2af('0x14'),_0x4123b7,_0x3791f6[_0xd2af('0x1c')]),'Exten':_0xd2af('0x43'),'Context':_0xd2af('0x44'),'Priority':'1','variable':_0x1a34d2,'timeout':(_0x1abeaa['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3791f6[_0xd2af('0x42')]};};exports[_0xd2af('0x45')]=function(_0x2e68c7){return _0x2e68c7[_0xd2af('0x46')]+_0x2e68c7[_0xd2af('0x47')]+_0x2e68c7[_0xd2af('0x48')]+_0x2e68c7[_0xd2af('0x49')]+_0x2e68c7[_0xd2af('0x4a')];};exports[_0xd2af('0x4b')]=function(_0x37b56e){var _0x40d115=_[_0xd2af('0x4c')](_0x37b56e);_0x40d115['state']=0xf;_0x40d115[_0xd2af('0x3c')]=_0xd2af('0x4d');return _0x40d115;};exports['scheduledAt']=function(_0xedd311,_0x134d50,_0x4d1837){var _0x445dd2={};_0x445dd2[_0x134d50]=_0xedd311[_0x134d50];_0x445dd2[_0xd2af('0x4e')]=![];_0x445dd2[_0xd2af('0x4f')]=moment()['add'](_0x4d1837,_0xd2af('0x50'))[_0xd2af('0x13')](_0xd2af('0x30'));_0x445dd2[_0xd2af('0x1d')]=_0xedd311[_0xd2af('0x1d')];_0x445dd2[_0xd2af('0x51')]=_0xedd311[_0xd2af('0x51')];_0x445dd2['VoiceQueueId']=_0xedd311['VoiceQueueId']||undefined;return _0x445dd2;};exports[_0xd2af('0x52')]=function(_0x3cb3fe,_0x1ad585){if(!_['isNil'](_0x3cb3fe)){if(_0x3cb3fe[_0xd2af('0x53')]>0x0){_0x3cb3fe['pTalking']-=0x1;}else{logger['error'](_0x1ad585,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xd2af('0xd')](_0x1ad585,_0xd2af('0x54'));}};exports[_0xd2af('0x55')]=function(_0x25888a){if(_0x25888a<=0x0){return!![];}return![];};function buildObj(_0x3d7906,_0x2b65c9,_0x29c8e2){_0x3d7906[_0xd2af('0x56')]=_0x2b65c9;_0x3d7906['name']=_0x3d7906[_0xd2af('0x57')];_0x3d7906['interface']=_0x3d7906[_0xd2af('0x58')];_0x3d7906['motionChannel']=_0xd2af('0x59');if(_0x29c8e2){_0x3d7906[_0xd2af('0x5a')]=_0x29c8e2[_0xd2af('0x5a')];}return _0x3d7906;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x115d85){var _0x57bef9={};_0x57bef9[_0xd2af('0x57')]=_0x115d85[_0xd2af('0x57')];_0x57bef9['interface']=_0x115d85[_0xd2af('0x58')];_0x57bef9['uniqueid']=_0x115d85[_0xd2af('0x42')];return _0x57bef9;};exports['agentReadyId']=function(_0x1c1069){var _0x320d6e=[];for(var _0x141e6b in _0x1c1069){if(_0x1c1069[_0xd2af('0x29')](_0x141e6b)){if(!_[_0xd2af('0x17')](_0x1c1069[_0x141e6b])&&_0x1c1069[_0x141e6b][_0xd2af('0x31')]===_0xd2af('0x5b')&&_0x1c1069[_0x141e6b]['status']===_0xd2af('0x5c')){_0x320d6e[_0xd2af('0x5d')](_0x1c1069[_0x141e6b]['id']);}}}return _0x320d6e;};exports[_0xd2af('0x5e')]=function(_0x41d457){var _0x3fd845=moment()[_0xd2af('0x5f')](0x0);var _0x6d0186=moment(_0x41d457)[_0xd2af('0x5f')](0x0);return _0x3fd845[_0xd2af('0x60')](_0x6d0186,_0xd2af('0x61'));};exports[_0xd2af('0x62')]=function(_0x355f7b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x355f7b[_0xd2af('0x1d')],'ListId':_0x355f7b[_0xd2af('0x51')],'VoiceQueueId':_0x355f7b['VoiceQueueId']||undefined,'CampaignId':_0x355f7b[_0xd2af('0x63')]||undefined};};exports['filterKey']=function(_0x3af708){if(_0x3af708==='uniqueid'||_0x3af708===_0xd2af('0x64')||_0x3af708===_0xd2af('0x57')||_0x3af708===_0xd2af('0x65')||_0x3af708===_0xd2af('0x66')||_0x3af708===_0xd2af('0x67')||_0x3af708===_0xd2af('0x3a')||_0x3af708==='channelAgent'||_0x3af708===_0xd2af('0x1b')||_0x3af708==='active'||_0x3af708===_0xd2af('0x1c')||_0x3af708===_0xd2af('0x4f')||_0x3af708===_0xd2af('0x46')||_0x3af708===_0xd2af('0x47')||_0x3af708===_0xd2af('0x48')||_0x3af708===_0xd2af('0x68')||_0x3af708==='callback'||_0x3af708==='callbackuniqueid'||_0x3af708===_0xd2af('0x69')||_0x3af708===_0xd2af('0x6a')||_0x3af708==='ContactId'||_0x3af708===_0xd2af('0x51')||_0x3af708===_0xd2af('0x3b')||_0x3af708===_0xd2af('0x1f')||_0x3af708===_0xd2af('0x6b')||_0x3af708==='xmd-voicequeueid'||_0x3af708===_0xd2af('0x6c')||_0x3af708===_0xd2af('0x6d')||_0x3af708===_0xd2af('0x6e')||_0x3af708===_0xd2af('0x6f')||_0x3af708==='xmd-dialtimeout'||_0x3af708==='xmd-dialoptions'||_0x3af708==='xmd-dialid'||_0x3af708===_0xd2af('0x70')||_0x3af708===_0xd2af('0x71')||_0x3af708==='xmd-cdrtype'||_0x3af708===_0xd2af('0x72')||_0x3af708===_0xd2af('0x73')||_0x3af708===_0xd2af('0x74')||_0x3af708===_0xd2af('0x75')||_0x3af708===_0xd2af('0x76')||_0x3af708===_0xd2af('0x77')||_0x3af708===_0xd2af('0x78')||_0x3af708==='rtpaudioqosloss'||_0x3af708===_0xd2af('0x79')||_0x3af708===_0xd2af('0x7a')||_0x3af708===_0xd2af('0x7b')||_0x3af708==='rtpaudioqos'||_0x3af708===_0xd2af('0x76')||_0x3af708===_0xd2af('0x77')||_0x3af708===_0xd2af('0x78')||_0x3af708===_0xd2af('0x7c')||_0x3af708==='rtpaudioqoslossbridged'||_0x3af708==='rtpaudioqosrtt'||_0x3af708==='rtpaudioqosrttbridged'||_0x3af708===_0xd2af('0x7d')||_0x3af708==='bridgepvtcallid'||_0x3af708===_0xd2af('0x31')||_0x3af708===_0xd2af('0x3c')){return![];}return!![];};exports[_0xd2af('0x7e')]=function(_0xf28da2,_0x3be85f){var _0x577589,_0x1b92e0,_0x10a3d4;if(_0x3be85f<=0x0){_0x3be85f=0x1;}_0x577589=new RegExp('\x5cw{0,'+_0x3be85f+'}$');_0x1b92e0=Math[_0xd2af('0x7f')](0xa,_0x3be85f-0x1);_0x10a3d4=Math['pow'](0xa,_0x3be85f)-0x1;return util['format']('%s',_[_0xd2af('0x80')](_0xf28da2,_0x577589,_['random'](_0x1b92e0,_0x10a3d4)));};exports[_0xd2af('0x81')]=function(_0x5d93c0){var _0x1b4e87=_0x5d93c0[_0xd2af('0x82')](/"(.*?)"/);return _0x1b4e87?_0x1b4e87[0x1]:_0x5d93c0;};exports['extractCalleridNumber']=function(_0x11bcb3){var _0x3d20d8=_0x11bcb3[_0xd2af('0x82')](/<(.*?)>/);return _0x3d20d8?_0x3d20d8[0x1]:_0x11bcb3;};function buildNoAnswerEventPayload(_0x9ecaa9,_0x4269cb){var _0x1f9d0b=buildObj(_0x9ecaa9,_0xd2af('0x83'));if(!_[_0xd2af('0x11')](_0x4269cb[_0xd2af('0x84')])){Object[_0xd2af('0x85')](_0x4269cb['variables'])['forEach'](function(_0x7a8ad2){_0x1f9d0b[_0x7a8ad2[_0xd2af('0x86')]()]=_0x4269cb[_0xd2af('0x84')][_0x7a8ad2];});}return _0x1f9d0b;}exports[_0xd2af('0x87')]=buildNoAnswerEventPayload; \ No newline at end of file +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 diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index b0f5d61..3cb2050 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 _0x1b91=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0xab58e1,_0x5d47ce){var _0x295351=function(_0x43f2a7){while(--_0x43f2a7){_0xab58e1['push'](_0xab58e1['shift']());}};_0x295351(++_0x5d47ce);}(_0x1b91,0x171));var _0x11b9=function(_0x257627,_0x260a99){_0x257627=_0x257627-0x0;var _0x26432a=_0x1b91[_0x257627];return _0x26432a;};'use strict';exports[_0x11b9('0x0')]={'queue':{'type':_0x11b9('0x1'),'required':!![]},'interface':{'type':_0x11b9('0x1'),'required':!![]},'membername':{'type':_0x11b9('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x11b9('0x2'),'required':![]}};exports[_0x11b9('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x11b9('0x1'),'required':!![]}};exports[_0x11b9('0x4')]={'interface':{'type':_0x11b9('0x1'),'required':!![]},'paused':{'type':_0x11b9('0x2')},'reason':{'type':'string','required':![]}};exports[_0x11b9('0x5')]={'module':{'type':'string','required':![]}};exports[_0x11b9('0x6')]={'uniqueid':{'type':_0x11b9('0x1'),'required':!![]}};exports[_0x11b9('0x7')]={'uniqueid':{'type':_0x11b9('0x1'),'required':!![]},'filename':{'type':_0x11b9('0x1')},'format':{'type':_0x11b9('0x1')},'mixmonitorid':{'type':_0x11b9('0x1')}};exports[_0x11b9('0x8')]={'uniqueid':{'type':_0x11b9('0x1'),'required':!![]}};exports[_0x11b9('0x9')]={'uniqueid':{'type':_0x11b9('0x1'),'required':!![]},'exten':{'type':_0x11b9('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +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 diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1f0430a..9f2c224 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x4be886,_0x16b357){var _0x41d679=function(_0x50b124){while(--_0x50b124){_0x4be886['push'](_0x4be886['shift']());}};_0x41d679(++_0x16b357);}(_0xadb5,0xad));var _0x5adb=function(_0x6fef73,_0x3046bc){_0x6fef73=_0x6fef73-0x0;var _0x1c42d2=_0xadb5[_0x6fef73];return _0x1c42d2;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index f678dc7..2da578b 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 _0x68ab=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x3cca1d,_0x3629e6){var _0x4a6375=function(_0x575879){while(--_0x575879){_0x3cca1d['push'](_0x3cca1d['shift']());}};_0x4a6375(++_0x3629e6);}(_0x68ab,0x11e));var _0xb68a=function(_0x3d0123,_0xcf2395){_0x3d0123=_0x3d0123-0x0;var _0x3ead32=_0x68ab[_0x3d0123];return _0x3ead32;};'use strict';function mergeDBDataToRealtime(_0x470476,_0x2745dd){var _0x43c828=Object[_0xb68a('0x0')]({},_0x470476);for(var _0x40806e in _0x2745dd){if(_0x43c828[_0xb68a('0x1')](_0x40806e)){_0x43c828[_0x40806e]=_0x2745dd[_0x40806e];}}return _0x43c828;}exports[_0xb68a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +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 diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index fde68ea..7b5b456 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 _0x3c5c=['queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','internal','destination','exten','type','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','destinationchannel','calleridpreview','originatecalleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','split','membername','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','SIP/%s','voiceQueueReport','length','findAgent','queuecallercomplete'];(function(_0x2a9ef5,_0x439b14){var _0x4819db=function(_0x426b66){while(--_0x426b66){_0x2a9ef5['push'](_0x2a9ef5['shift']());}};_0x4819db(++_0x439b14);}(_0x3c5c,0x8c));var _0xc3c5=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x3c5c[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xc3c5('0x0'));var moment=require(_0xc3c5('0x1'));var util=require(_0xc3c5('0x2'));var config=require(_0xc3c5('0x3'));var ami=require(_0xc3c5('0x4'));var RpcVoiceAgentReport=require(_0xc3c5('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc3c5('0x6'));var RpcMemberReport=require(_0xc3c5('0x7'));var RpcVoiceQueueReport=require(_0xc3c5('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xc3c5('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xc3c5('0xa'));var VoiceAgentReport=require(_0xc3c5('0xb'));var VoiceDialReport=require(_0xc3c5('0xc'));var UserReport=require(_0xc3c5('0xd'));function Report(_0x575969){this[_0xc3c5('0xe')]=_0x575969;this[_0xc3c5('0xf')]=_0x575969['agents'];this[_0xc3c5('0x10')]=_0x575969[_0xc3c5('0x10')];}Report[_0xc3c5('0x11')][_0xc3c5('0x12')]=function(_0x518713){var _0x41eb25=new VoiceQueueReport(this[_0xc3c5('0xe')]);var _0x290506=new VoiceAgentReport(this['realtime']);var _0x19236e=new VoiceDialReport(this[_0xc3c5('0xe')]);var _0x4b0045=new VoiceCallReport(this[_0xc3c5('0xe')]);var _0x1967fc=new UserReport(this[_0xc3c5('0xe')]);if(config[_0xc3c5('0x13')]&&config[_0xc3c5('0x13')][_0xc3c5('0x14')]){ami['on'](_0xc3c5('0x15'),this['voiceQueueReport'][_0xc3c5('0x16')](this));ami['on'](_0xc3c5('0x17'),this[_0xc3c5('0x18')]['bind'](this));ami['on'](_0xc3c5('0x19'),this[_0xc3c5('0x1a')][_0xc3c5('0x16')](this));ami['on'](_0xc3c5('0x1b'),this[_0xc3c5('0x1c')]['bind'](this));ami['on'](_0xc3c5('0x1d'),this[_0xc3c5('0x1e')][_0xc3c5('0x16')](this));ami['on'](_0xc3c5('0x1f'),this[_0xc3c5('0x20')][_0xc3c5('0x16')](this));}};Report[_0xc3c5('0x11')]['findAgent']=function(_0x18089c){var _0x25fe81;_0x25fe81=_[_0xc3c5('0x21')](this[_0xc3c5('0xf')],function(_0x4d3c0f){return _0x4d3c0f[_0xc3c5('0x22')]==_0x18089c||_0x4d3c0f[_0xc3c5('0x23')]==_0x18089c;});if(_[_0xc3c5('0x24')](_0x25fe81)){var _0x28a520=_[_0xc3c5('0x21')](this[_0xc3c5('0x10')],function(_0x22a362){return _0x22a362['accountcode']==_0x18089c||_0x22a362[_0xc3c5('0x23')]==_0x18089c;});if(_0x28a520){_0x25fe81=_[_0xc3c5('0x21')](this[_0xc3c5('0xf')],function(_0x47edb3){return _0x47edb3[_0xc3c5('0x25')]==util[_0xc3c5('0x26')](_0xc3c5('0x27'),_0x28a520[_0xc3c5('0x23')]);});}}return _0x25fe81;};Report[_0xc3c5('0x11')][_0xc3c5('0x28')]=function(_0xb9a99a){for(var _0x411c73=0x0;_0x411c73<_0xb9a99a[_0xc3c5('0x29')];_0x411c73+=0x1){var _0xad5545=this[_0xc3c5('0x2a')](_0xb9a99a[_0x411c73]['connectedlinenum']);if(_0xad5545){_0xb9a99a[_0x411c73]['accountcode']=_0xad5545[_0xc3c5('0x22')];_0xb9a99a[_0x411c73]['assigned']=!![];_0xb9a99a[_0x411c73]['lastAssignedTo']=_0xad5545[_0xc3c5('0x23')];_0xb9a99a[_0x411c73]['interface']=_[_0xc3c5('0x24')](_0xad5545['interface'])?util[_0xc3c5('0x26')](_0xc3c5('0x27'),_0xad5545[_0xc3c5('0x23')]):_0xad5545[_0xc3c5('0x25')];if(_0xb9a99a[_0x411c73][_0xc3c5('0x2b')]){_0xb9a99a[_0x411c73][_0xc3c5('0x2c')]=moment()['format'](_0xc3c5('0x2d'));}if(_0xb9a99a[_0x411c73]['queuecallerexit']){_0xb9a99a[_0x411c73]['queuecallerexitAt']=moment()[_0xc3c5('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc3c5('0x28')](_0xb9a99a[_0x411c73]);}RpcVoiceQueueReport[_0xc3c5('0x2e')](_0xb9a99a[_0x411c73]);}};function extractCalleridNumber(_0x5eeeb4){var _0x364d40=_0x5eeeb4[_0xc3c5('0x2f')](/<(.*?)>/);return _0x364d40?_0x364d40[0x1]:_0x5eeeb4;}Report[_0xc3c5('0x11')][_0xc3c5('0x30')]=function(_0x1e9eb5){for(var _0x12cdf8=0x0;_0x12cdf8','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;_0x2d97690x0?!![]:![];if(!_0x253a47){return this[_0xa988('0x1b')](this[_0xa988('0x17')][_0xa988('0x73')]);}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x74')]=function(_0x4c5221){var _0x173c83=this[_0xa988('0x17')]['id'];if(this[_0xa988('0x17')]['queuestatus'][_0x173c83]&&this['summary'][_0xa988('0x68')][_0x173c83][_0x4c5221['actionid']]){this[_0xa988('0x17')][_0xa988('0x68')][_0x173c83][_0x4c5221[_0xa988('0x67')]][_0xa988('0x12')][_0xa988('0x75')](_0x4c5221);}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x18')]=function(_0x10258c){var _0x483812=this;try{if(this[_0xa988('0x76')](_0x10258c)&&this[_0xa988('0x76')](_0x10258c[_0xa988('0x54')])){logger[_0xa988('0x4e')](_0xa988('0x77'),util[_0xa988('0x45')](_0x10258c,{'showHidden':![],'depth':null}));var _0x554055=this['voiceQueues'][_0x10258c[_0xa988('0x54')]];if(_0x554055){logger[_0xa988('0x4e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x554055[_0xa988('0x5f')]);this[_0xa988('0x17')][_0xa988('0x62')][_0x554055[_0xa988('0x5f')]]={'summaryEvent':_0x10258c};this['summary']['statusRequests']+=0x1;return ami['Action']({'action':_0xa988('0x68'),'queue':_0x554055[_0xa988('0x5f')]})[_0xa988('0x66')](function(_0x41ffd6){if(!_0x483812[_0xa988('0x17')][_0xa988('0x68')][_0x10258c['actionid']]){_0x483812[_0xa988('0x17')][_0xa988('0x68')][_0x10258c[_0xa988('0x67')]]={};}_0x483812['summary']['queuestatus'][_0x10258c['actionid']][_0x41ffd6['actionid']]={'queue':_0x554055[_0xa988('0x5f')],'agents':[]};})[_0xa988('0x41')](function(_0x287114){throw _0x287114;});}}}catch(_0x409394){logger[_0xa988('0x43')](_0xa988('0x69'),util[_0xa988('0x45')](_0x409394,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x1b')]=function(_0x443dfc){if(this[_0xa988('0x17')][_0xa988('0x72')]>0x0){this[_0xa988('0x17')][_0xa988('0x73')]=_0x443dfc;return;}logger[_0xa988('0x4e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x443dfc,{'showHidden':![],'depth':null}));this[_0xa988('0x17')]=initializeSummary();ami[_0xa988('0x4c')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x1f')]=function(_0x1fc075){try{if(this[_0xa988('0x76')](_0x1fc075)){logger[_0xa988('0x4e')](_0xa988('0x78'),_0x1fc075[_0xa988('0x51')],util[_0xa988('0x45')](_0x1fc075,{'showHidden':![],'depth':null}));if(_[_0xa988('0x61')](this[_0xa988('0x11')][_0x1fc075['uniqueid']])){this[_0xa988('0x11')][_0x1fc075[_0xa988('0x51')]]=[];}if(_['isUndefined'](this[_0xa988('0x13')][_0x1fc075[_0xa988('0x51')]])){this[_0xa988('0x13')][_0x1fc075[_0xa988('0x51')]]={};}var _0xcf0b6f=new QueueReport();_0xcf0b6f[_0xa988('0x54')]=_0x1fc075[_0xa988('0x54')];_0xcf0b6f[_0xa988('0x70')]=this[_0xa988('0x15')][_0xcf0b6f[_0xa988('0x54')]]&&this[_0xa988('0x15')][_0xcf0b6f['queue']][_0xa988('0x70')]?this[_0xa988('0x15')][_0xcf0b6f['queue']][_0xa988('0x70')]||_0xa988('0x5d'):_0xa988('0x5d');_0xcf0b6f[_0xa988('0x79')]=moment()['format'](_0xa988('0x7a'));_0xcf0b6f[_0xa988('0x7b')]=_0x1fc075['position'];_0xcf0b6f[_0xa988('0x7c')]=_0x1fc075[_0xa988('0x7c')];_0xcf0b6f[_0xa988('0x51')]=_0x1fc075[_0xa988('0x51')];_0xcf0b6f[_0xa988('0x7d')]=this[_0xa988('0x13')][_0x1fc075[_0xa988('0x51')]][_0xa988('0x7d')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xcf0b6f[_0xa988('0x54')],_0xcf0b6f[_0xa988('0x70')]);Object[_0xa988('0x6e')](_0xcf0b6f,_[_0xa988('0x7e')](_0x1fc075,_['keys'](_0xcf0b6f)));this[_0xa988('0x11')][_0x1fc075[_0xa988('0x51')]][_0xa988('0x75')](_0xcf0b6f);this[_0xa988('0x13')][_0x1fc075[_0xa988('0x51')]]=_0xcf0b6f;this[_0xa988('0x4d')](_0xcf0b6f,_0xa988('0x1e'));}}catch(_0x45b303){logger[_0xa988('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x1fc075[_0xa988('0x51')],util['inspect'](_0x45b303,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xa988('0x20')]=function(_0x4dba73){try{if(this[_0xa988('0x76')](_0x4dba73)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x4dba73[_0xa988('0x51')],util[_0xa988('0x45')](_0x4dba73,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4dba73[_0xa988('0x51')]]){var _0x17eb36=_['last'](this[_0xa988('0x11')][_0x4dba73[_0xa988('0x51')]]);_0x17eb36[_0xa988('0x7f')]=![];_0x17eb36[_0xa988('0x80')]=null;_0x17eb36[_0xa988('0x81')]=_0x4dba73[_0xa988('0x81')];_0x17eb36[_0xa988('0x82')]=_0x4dba73[_0xa988('0x82')];_0x17eb36['queuecallerabandon']=!![];_0x17eb36['queuecallerabandonAt']=moment()[_0xa988('0x52')](_0xa988('0x7a'));_0x17eb36[_0xa988('0x58')]=_0xa988('0x83');_0x17eb36[_0xa988('0x84')]=null;logger[_0xa988('0x85')](_0xa988('0x86'),_0x17eb36[_0xa988('0x54')],_0x17eb36[_0xa988('0x70')]);this[_0xa988('0x13')][_0x4dba73[_0xa988('0x51')]]=_0x17eb36;this['emitVoiceQueueChannelRemove'](_0x17eb36,_0xa988('0x3a'));}}}catch(_0x248e91){logger['error'](_0xa988('0x87'),_0x4dba73[_0xa988('0x51')],util[_0xa988('0x45')](_0x248e91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x22')]=function(_0x53189b){try{if(this['isNotNull'](_0x53189b)){logger[_0xa988('0x4e')](_0xa988('0x88'),_0x53189b[_0xa988('0x51')],util[_0xa988('0x45')](_0x53189b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x53189b[_0xa988('0x51')]]){var _0x29862d=_[_0xa988('0x89')](this[_0xa988('0x11')][_0x53189b[_0xa988('0x51')]]);_0x29862d[_0xa988('0x8a')]=moment()[_0xa988('0x52')](_0xa988('0x7a'));_0x29862d[_0xa988('0x8b')]=_0x53189b[_0xa988('0x8b')];_0x29862d['connectedlinename']=_0x53189b[_0xa988('0x8c')];logger[_0xa988('0x85')](_0xa988('0x8d'),_0x29862d[_0xa988('0x54')],_0x29862d[_0xa988('0x70')],_0x53189b[_0xa988('0x8b')],_0x53189b['connectedlinename']);this[_0xa988('0x13')][_0x53189b[_0xa988('0x51')]]=_0x29862d;this[_0xa988('0x4d')](_0x29862d,_0xa988('0x21'));}}}catch(_0x877ab9){logger[_0xa988('0x43')](_0xa988('0x88'),_0x53189b[_0xa988('0x51')],util['inspect'](_0x877ab9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa988('0xd')]['syncAgentConnect']=function(_0x549e03){try{if(this[_0xa988('0x76')](_0x549e03)){logger[_0xa988('0x4e')](_0xa988('0x8e'),_0x549e03[_0xa988('0x51')],util['inspect'](_0x549e03,{'showHidden':![],'depth':null}));if(this[_0xa988('0x11')][_0x549e03[_0xa988('0x51')]]){var _0xe8b433=_['last'](this[_0xa988('0x11')][_0x549e03[_0xa988('0x51')]]);_0xe8b433[_0xa988('0x7f')]=!![];_0xe8b433['queuecallerexitreason']='COMPLETEDBYAGENT';logger['info'](_0xa988('0x8f'),_0xe8b433['queue'],_0xe8b433['type']);}}}catch(_0x1dbf20){logger['error'](_0xa988('0x8e'),_0x549e03[_0xa988('0x51')],util[_0xa988('0x45')](_0x1dbf20,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x23')]=function(_0x3fab48){try{if(this['isNotNull'](_0x3fab48)){logger[_0xa988('0x4e')]('[%s][voiceQueueReport][agentcomplete]',_0x3fab48[_0xa988('0x51')],util[_0xa988('0x45')](_0x3fab48,{'showHidden':![],'depth':null}));if(this[_0xa988('0x11')][_0x3fab48[_0xa988('0x51')]]){var _0x1003d7=_[_0xa988('0x89')](this[_0xa988('0x11')][_0x3fab48['uniqueid']]);_0x1003d7[_0xa988('0x3a')]=![];_0x1003d7[_0xa988('0x90')]=null;_0x1003d7['assigned']=!![];_0x1003d7['lastAssignedTo']=_0x3fab48['membername'];_0x1003d7[_0xa988('0x81')]=_0x3fab48['holdtime'];_0x1003d7['queuecallercomplete']=!![];_0x1003d7['queuecallerexit']=![];_0x1003d7[_0xa988('0x91')]=null;if(!_0x1003d7[_0xa988('0x92')]){if(_0x3fab48['reason']==_0xa988('0x92')){_0x1003d7[_0xa988('0x58')]=_0xa988('0x93');logger['info'](_0xa988('0x94'),_0x1003d7[_0xa988('0x54')],_0x1003d7[_0xa988('0x70')]);}else{if(_[_0xa988('0x95')](_0x3fab48['channel'][_0xa988('0x96')](),_0xa988('0x97'))){if(this[_0xa988('0x11')][_0x3fab48[_0xa988('0x98')]]){var _0x476c8f=_[_0xa988('0x89')](this[_0xa988('0x11')][_0x3fab48[_0xa988('0x98')]]);_0x476c8f[_0xa988('0x7f')]=![];_0x476c8f[_0xa988('0x99')]=!![];_0x476c8f['queuecallerexitAt']=moment(_0x1003d7['queuecallerjoinAt'])[_0xa988('0x9a')](_0x3fab48[_0xa988('0x81')],_0xa988('0x9b'))[_0xa988('0x52')](_0xa988('0x7a'));_0x476c8f[_0xa988('0x58')]='FORWARDTRANSFER';_0x476c8f[_0xa988('0x92')]=!![];_0x476c8f[_0xa988('0x9c')]=_0xa988('0x9d');_0x476c8f[_0xa988('0x9e')]=_0x3fab48['destexten'];_0x476c8f['transferuniqueid']=_0x3fab48[_0xa988('0x51')];logger[_0xa988('0x85')](_0xa988('0x9f'),_0x476c8f[_0xa988('0x54')],_0x476c8f[_0xa988('0x70')]);var _0x8fed48=this['queueReports'][_0x3fab48[_0xa988('0x98')]];this[_0xa988('0x11')][_0x3fab48['linkedid']]=this[_0xa988('0x11')][_0x3fab48[_0xa988('0x51')]];this[_0xa988('0x11')][_0x3fab48['uniqueid']]=_0x8fed48;}}else{_0x1003d7['queuecallerexitreason']='COMPLETEDBY'+_0x3fab48[_0xa988('0xa0')][_0xa988('0xa1')]();logger[_0xa988('0x85')](_0xa988('0xa2'),_0x1003d7['queue'],_0x1003d7[_0xa988('0x70')],_0x1003d7[_0xa988('0x58')]);}}}this[_0xa988('0x13')][_0x3fab48[_0xa988('0x51')]]=_0x1003d7;}}}catch(_0x3950df){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x3fab48[_0xa988('0x51')],util['inspect'](_0x3950df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0x26')]=function(_0x34cf04){try{if(this[_0xa988('0x76')](_0x34cf04)){logger[_0xa988('0x4e')](_0xa988('0xa3'),_0x34cf04['uniqueid'],util[_0xa988('0x45')](_0x34cf04,{'showHidden':![],'depth':null}));this['addVariable'](_0x34cf04[_0xa988('0x51')],_[_0xa988('0xa4')](_0x34cf04[_0xa988('0xa5')])[0x0],_0x34cf04['value']);if(this['queueReports'][_0x34cf04['uniqueid']]){var _0x240626=_[_0xa988('0x89')](this[_0xa988('0x11')][_0x34cf04[_0xa988('0x51')]]);if(_0x240626){if(this['isNotNull'](_0x34cf04[_0xa988('0xa5')])&&this['isNotNull'](_0x34cf04['variable'][_0xa988('0x68')])){switch(_0x34cf04['value']){case'CONTINUE':_0x240626[_0xa988('0x99')]=![];_0x240626[_0xa988('0x91')]=null;break;case _0xa988('0xa6'):_0x240626[_0xa988('0xa7')]=_0xa988('0xa8');_0x240626['queuecallerexit']=!![];_0x240626[_0xa988('0x91')]=moment()[_0xa988('0x52')](_0xa988('0x7a'));_0x240626[_0xa988('0x8a')]=moment()[_0xa988('0x52')](_0xa988('0x7a'));logger['debug'](_0xa988('0xa9'),_0x34cf04[_0xa988('0x51')],util[_0xa988('0x45')](_0x240626,{'showHidden':![],'depth':null}));ami[_0xa988('0x4c')](_0xa988('0xaa'),_0x240626);break;default:_0x240626[_0xa988('0x99')]=!![];_0x240626['queuecallerexitAt']=moment()[_0xa988('0x52')](_0xa988('0x7a'));_0x240626[_0xa988('0x8a')]=moment()['format'](_0xa988('0x7a'));}_0x240626[_0xa988('0x3a')]=![];_0x240626[_0xa988('0x90')]=null;_0x240626[_0xa988('0x58')]=_0x34cf04['value'];this[_0xa988('0x13')][_0x34cf04[_0xa988('0x51')]]=_0x240626;this['emitVoiceQueueChannelRemove'](_0x240626,_0xa988('0x25'));}else if(this[_0xa988('0x76')](_0x34cf04['variable'])&&this[_0xa988('0x76')](_0x34cf04[_0xa988('0xa5')][_0xa988('0xab')])){if(!_0x240626[_0xa988('0x3a')]){_0x240626[_0xa988('0x99')]=!![];_0x240626['queuecallerexitAt']=moment()['format'](_0xa988('0x7a'));_0x240626[_0xa988('0x58')]=_0xa988('0xac');_0x240626[_0xa988('0x8a')]=moment()[_0xa988('0x52')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa988('0x13')][_0x34cf04[_0xa988('0x51')]]=_0x240626;}}logger[_0xa988('0x85')](_0xa988('0xad'),_0x34cf04[_0xa988('0x51')],_0x240626[_0xa988('0x54')],_0x240626['type'],_['keys'](_0x34cf04[_0xa988('0xa5')])[0x0],_0x34cf04[_0xa988('0xae')]);_0x240626[_0xa988('0x47')]=this[_0xa988('0x47')][_0x34cf04['uniqueid']];}}}}catch(_0x108f7d){logger[_0xa988('0x43')](_0xa988('0xa3'),_0x34cf04[_0xa988('0x51')],util[_0xa988('0x45')](_0x108f7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0xaf')]=function(_0x40d120,_0x158d6f,_0x4cf8c9){var _0x41df1a=['rtpaudioqos',_0xa988('0xb0'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xa988('0xb1'),_0xa988('0xb2'),_0xa988('0xb3'),_0xa988('0xb4'),_0xa988('0xb5'),_0xa988('0xb6'),'bridgepeer',_0xa988('0xb7'),'membercalls',_0xa988('0xb8'),_0xa988('0xb9'),_0xa988('0xba'),_0xa988('0xbb'),_0xa988('0xbc'),_0xa988('0xbd')];if(!_[_0xa988('0xbe')](_0x158d6f)&&!_[_0xa988('0xbf')](_0x41df1a,_0x158d6f)){if(_[_0xa988('0x61')](this[_0xa988('0x47')][_0x40d120])){this[_0xa988('0x47')][_0x40d120]={};}this[_0xa988('0x47')][_0x40d120][_0x158d6f]=_0x4cf8c9;}};VoiceQueueReport[_0xa988('0xd')][_0xa988('0xc0')]=function(_0x2811fb,_0x8e4344,_0x5b6cd0){try{var _0x2acd84={};if(this['queueReports'][_0x2811fb]){for(var _0xaab349=0x0;_0xaab3490x0?!![]:![];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;_0x27f63b=0x0?moment(_0x1d1c1d[_0x3b03('0x1a')])[_0x3b03('0xc')](_0x1d1c1d['starttime'],'seconds'):null,'data1':'outbound','data2':_0x1d1c1d[_0x3b03('0x13')],'data3':_0x1d1c1d['exten'],'data4':_0x1d1c1d[_0x3b03('0x1c')]||null,'role':_0x3b03('0x12'),'internal':_0x1d1c1d[_0x3b03('0x13')]?_[_0x3b03('0x14')](_0x1d1c1d['accountcode']):undefined,'uniqueid':_0x1d1c1d[_0x3b03('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x5b0f=['voice','isNil','interface','format','SIP/%s','lastAssignedTo','queuecallerleaveAt','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','TALKING','starttime','endtime','diff','seconds','outbound','dialstring','lodash','util','voiceQueueReport','queuecallercompleteAt','Request'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x5b0f,0x13a));var _0xf5b0=function(_0x4ea809,_0x5416a6){_0x4ea809=_0x4ea809-0x0;var _0x31be45=_0x5b0f[_0x4ea809];return _0x31be45;};'use strict';var moment=require('moment');var _=require(_0xf5b0('0x0'));var util=require(_0xf5b0('0x1'));var client=require('../client');exports[_0xf5b0('0x2')]=function(_0x25cc04){var _0x56f010=_0x25cc04[_0xf5b0('0x3')]||_0x25cc04['queuecallerexitAt'];return client[_0xf5b0('0x4')]('CreateMemberReport',{'body':{'channel':_0xf5b0('0x5'),'membername':_0x25cc04['lastAssignedTo'],'interface':_[_0xf5b0('0x6')](_0x25cc04[_0xf5b0('0x7')])?util[_0xf5b0('0x8')](_0xf5b0('0x9'),_0x25cc04[_0xf5b0('0xa')]):_0x25cc04[_0xf5b0('0x7')],'type':'TALKING','enterAt':_0x25cc04[_0xf5b0('0xb')],'exitAt':_0x56f010,'duration':moment(_0x56f010)['diff'](_0x25cc04['queuecallerleaveAt'],'seconds'),'data1':_0xf5b0('0xc'),'data2':_0x25cc04[_0xf5b0('0xd')],'data3':_0x25cc04[_0xf5b0('0xe')],'data4':null,'data5':_0x25cc04['queue'],'role':_0xf5b0('0xf'),'internal':_0x25cc04[_0xf5b0('0x10')]?_[_0xf5b0('0x11')](_0x25cc04['accountcode']):undefined,'uniqueid':_0x25cc04[_0xf5b0('0x12')]},'log':_0xf5b0('0x13')});};exports[_0xf5b0('0x14')]=function(_0x30172a){return client[_0xf5b0('0x4')](_0xf5b0('0x13'),{'body':{'channel':_0xf5b0('0x5'),'membername':_0x30172a[_0xf5b0('0x15')],'interface':_0x30172a[_0xf5b0('0x7')],'type':_0xf5b0('0x16'),'enterAt':_0x30172a[_0xf5b0('0x17')],'exitAt':_0x30172a['endtime'],'duration':moment(_0x30172a[_0xf5b0('0x18')])[_0xf5b0('0x19')](_0x30172a[_0xf5b0('0x17')],_0xf5b0('0x1a'))>=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 diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e48fb75..96b1990 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 _0x7d80=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x2e2c1b,_0x94deaf){var _0x43a4f2=function(_0x421a57){while(--_0x421a57){_0x2e2c1b['push'](_0x2e2c1b['shift']());}};_0x43a4f2(++_0x94deaf);}(_0x7d80,0x17a));var _0x07d8=function(_0x58bd42,_0x5d6e76){_0x58bd42=_0x58bd42-0x0;var _0x1184ac=_0x7d80[_0x58bd42];return _0x1184ac;};'use strict';var client=require('../client');exports[_0x07d8('0x0')]=function(){return client[_0x07d8('0x1')](_0x07d8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x07d8('0x3'),_0x07d8('0x4')]},'log':_0x07d8('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e391276..7beb48f 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 _0x4d4b=['html','Request','GetTemplate','name'];(function(_0xc2b4c8,_0x756a49){var _0x402443=function(_0x571bae){while(--_0x571bae){_0xc2b4c8['push'](_0xc2b4c8['shift']());}};_0x402443(++_0x756a49);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x4582af,_0x51cde7){_0x4582af=_0x4582af-0x0;var _0xfe07e6=_0x4d4b[_0x4582af];return _0xfe07e6;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x10eede){return function(_0x365c13){return client[_0xb4d4('0x0')](_0xb4d4('0x1'),{'options':{'raw':!![],'attributes':['id',_0xb4d4('0x2'),_0xb4d4('0x3')]},'log':_0xb4d4('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index fbaaf0a..da3db8b 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 _0x23e5=['data2','data3','data6','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','action'];(function(_0x27038a,_0x33da42){var _0x12e6a0=function(_0x57fc50){while(--_0x57fc50){_0x27038a['push'](_0x27038a['shift']());}};_0x12e6a0(++_0x33da42);}(_0x23e5,0x1d4));var _0x523e=function(_0x50e318,_0x103521){_0x50e318=_0x50e318-0x0;var _0x209b0f=_0x23e5[_0x50e318];return _0x209b0f;};'use strict';var client=require(_0x523e('0x0'));exports[_0x523e('0x1')]=function(_0x59f785){return function(_0x2e283e){return client[_0x523e('0x2')](_0x523e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x523e('0x4'),_0x523e('0x5')],'include':[{'model':_0x523e('0x6'),'as':_0x523e('0x7'),'attributes':['id',_0x523e('0x8'),_0x523e('0x9'),'value']},{'model':_0x523e('0x6'),'as':'AnyConditions','attributes':['id',_0x523e('0x8'),_0x523e('0x9'),_0x523e('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0x523e('0xb'),'data1',_0x523e('0xc'),_0x523e('0xd'),'data4','data5',_0x523e('0xe'),'data7']}]},'log':_0x523e('0x3')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2b9b56d..fb7424d 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 _0xd918=['GetTrunk','name','defaultuser'];(function(_0x11fa39,_0x4779bd){var _0x452e2a=function(_0x435b17){while(--_0x435b17){_0x11fa39['push'](_0x11fa39['shift']());}};_0x452e2a(++_0x4779bd);}(_0xd918,0xf7));var _0x8d91=function(_0x377a48,_0x3980cb){_0x377a48=_0x377a48-0x0;var _0x59e82b=_0xd918[_0x377a48];return _0x59e82b;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x55c758){return function(_0x20771e){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8d91('0x0'),'registry',_0x8d91('0x1')]},'log':_0x8d91('0x2')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 91df968..4bceddf 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x58952d,_0x1e4a20){var _0xc520c=function(_0x474097){while(--_0x474097){_0x58952d['push'](_0x58952d['shift']());}};_0xc520c(++_0x1e4a20);}(_0xedd9,0xfc));var _0x9edd=function(_0x34503b,_0x54b357){_0x34503b=_0x34503b-0x0;var _0x54ab9a=_0xedd9[_0x34503b];return _0x54ab9a;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1008c44..6c0d8ee 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 _0xccbf=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xccbf,0x14e));var _0xfccb=function(_0x92b864,_0x4dea6a){_0x92b864=_0x92b864-0x0;var _0x376972=_0xccbf[_0x92b864];return _0x376972;};'use strict';var client=require(_0xfccb('0x0'));exports['create']=function(_0x3aeef9){return client[_0xfccb('0x1')](_0xfccb('0x2'),{'body':_0x3aeef9,'log':_0xfccb('0x2')});};exports[_0xfccb('0x3')]=function(_0x4e763f,_0x70e885,_0x31b317){return client[_0xfccb('0x1')](_0xfccb('0x4'),{'body':_0x4e763f,'options':{'where':{'uniqueid':_0x70e885,'interface':_0x31b317,'agentcomplete':!![]}},'log':_0xfccb('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 60107c6..0313f5e 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 _0x1594=['format','type','disposition','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x3a2ca8,_0x33798e){var _0xa92170=function(_0x127825){while(--_0x127825){_0x3a2ca8['push'](_0x3a2ca8['shift']());}};_0xa92170(++_0x33798e);}(_0x1594,0xa6));var _0x4159=function(_0x19bd67,_0x5b6c63){_0x19bd67=_0x19bd67-0x0;var _0x1d6dba=_0x1594[_0x19bd67];return _0x1d6dba;};'use strict';var moment=require('moment');var util=require(_0x4159('0x0'));var _=require(_0x4159('0x1'));var client=require(_0x4159('0x2'));exports[_0x4159('0x3')]=function(_0x29fe95){return client[_0x4159('0x4')](_0x4159('0x5'),{'body':_[_0x4159('0x6')](_0x29fe95,{'source':_0x29fe95[_0x4159('0x7')],'destinationcontext':_0x29fe95[_0x4159('0x8')],'callerid':_0x29fe95[_0x4159('0x9')],'amaflags':_0x4159('0xa')}),'log':_0x4159('0x5')});};exports[_0x4159('0xb')]=function(){return function(){return client['Request'](_0x4159('0xc'),{'options':{'where':{'type':[_0x4159('0xd')],'createdAt':{'$between':[moment()[_0x4159('0xe')](_0x4159('0xf'))['format'](_0x4159('0x10')),moment()[_0x4159('0x11')](_0x4159('0xf'))[_0x4159('0x12')](_0x4159('0x10'))]}},'attributes':[_0x4159('0x13'),_0x4159('0x14'),'duration',_0x4159('0x15')]},'log':_0x4159('0x16')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 303d0de..15b1e8f 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 _0xc3d7=['CreateVoiceDialReport','Request'];(function(_0x33968f,_0x19e029){var _0x3ca1e5=function(_0x59ed2f){while(--_0x59ed2f){_0x33968f['push'](_0x33968f['shift']());}};_0x3ca1e5(++_0x19e029);}(_0xc3d7,0x123));var _0x7c3d=function(_0xfa17e5,_0x3fc7ed){_0xfa17e5=_0xfa17e5-0x0;var _0x4c8ffe=_0xc3d7[_0xfa17e5];return _0x4c8ffe;};'use strict';var client=require('../client');exports['create']=function(_0x2eb8f3){return client[_0x7c3d('0x0')]('CreateVoiceDialReport',{'body':_0x2eb8f3,'log':_0x7c3d('0x1')});}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index db69782..ef8c96e 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 _0x9c5e=['exten','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x4ec3a6,_0x64866d){var _0x519ff9=function(_0x5ec28e){while(--_0x5ec28e){_0x4ec3a6['push'](_0x4ec3a6['shift']());}};_0x519ff9(++_0x64866d);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x6b8eda,_0x567015){_0x6b8eda=_0x6b8eda-0x0;var _0x401c6b=_0x9c5e[_0x6b8eda];return _0x401c6b;};'use strict';var client=require(_0xe9c5('0x0'));exports[_0xe9c5('0x1')]=function(){return function(){return client[_0xe9c5('0x2')](_0xe9c5('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe9c5('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 078cfbd..83bb0bd 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 _0xba0b=['dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format'];(function(_0x4c4042,_0x3967e4){var _0x4bb9d1=function(_0xac1371){while(--_0xac1371){_0x4c4042['push'](_0x4c4042['shift']());}};_0x4bb9d1(++_0x3967e4);}(_0xba0b,0x111));var _0xbba0=function(_0x259d5b,_0x16bce9){_0x259d5b=_0x259d5b-0x0;var _0x1c1bf7=_0xba0b[_0x259d5b];return _0x1c1bf7;};'use strict';var client=require(_0xbba0('0x0'));exports[_0xbba0('0x1')]=function(){return function(){return client[_0xbba0('0x2')](_0xbba0('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xbba0('0x4'),'acwTimeout',_0xbba0('0x5'),_0xbba0('0x6'),'type','dialActive','dialMethod',_0xbba0('0x7'),_0xbba0('0x8'),'dialPowerLevel',_0xbba0('0x9'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0xbba0('0xa'),_0xbba0('0xb'),'dialOriginateTimeout',_0xbba0('0xc'),'dialQueueTimeout',_0xbba0('0xd'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency',_0xbba0('0xe'),_0xbba0('0xf'),_0xbba0('0x10'),_0xbba0('0x11'),'dialGlobalInterval',_0xbba0('0x12'),_0xbba0('0x13'),_0xbba0('0x14'),_0xbba0('0x15'),_0xbba0('0x16'),_0xbba0('0x17'),'dialAMDTotalAnalysisTime',_0xbba0('0x18'),_0xbba0('0x19'),_0xbba0('0x1a'),_0xbba0('0x1b'),'dialAMDMaximumWordLength',_0xbba0('0x1c'),'dialRecallMeTimeout',_0xbba0('0x1d'),'dialOrderByScheduledAt',_0xbba0('0x1e'),'dialAgiAfterHangupClient',_0xbba0('0x1f'),_0xbba0('0x6'),_0xbba0('0x20'),_0xbba0('0x21'),'dialCutDigit',_0xbba0('0x22'),'dialNoSuchNumberRetryFrequency',_0xbba0('0x23'),_0xbba0('0x24'),_0xbba0('0x25'),_0xbba0('0x26'),_0xbba0('0x27'),_0xbba0('0x28'),'dialAgentRejectMaxRetry',_0xbba0('0x29'),_0xbba0('0x2a'),_0xbba0('0x2b'),'dialPredictiveIntervalMinThreshold',_0xbba0('0x2c'),_0xbba0('0x2d')],'include':[{'model':_0xbba0('0x2e'),'as':_0xbba0('0x2e'),'attributes':['id',_0xbba0('0x2f'),_0xbba0('0x30'),_0xbba0('0x31')]},{'model':_0xbba0('0x32'),'as':_0xbba0('0x33'),'attributes':['id',_0xbba0('0x2f')]},{'model':'Trunk','as':_0xbba0('0x34'),'attributes':['id',_0xbba0('0x2f'),_0xbba0('0x30'),_0xbba0('0x31')]},{'model':_0xbba0('0x35'),'as':'Interval','attributes':['id',_0xbba0('0x2f')],'include':[{'model':_0xbba0('0x35'),'as':_0xbba0('0x36'),'attributes':['id','name',_0xbba0('0x37')]}]}]},'log':_0xbba0('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index aac6e50..3c4129d 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(_0xec141f,_0x44835b){var _0x51ebb0=function(_0x8828d7){while(--_0x8828d7){_0xec141f['push'](_0xec141f['shift']());}};_0x51ebb0(++_0x44835b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_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 diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 679111d..ce69857 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 _0x7875=['Request','../client','getVoiceQueueRtPauses'];(function(_0x9ebff0,_0x3fa999){var _0x169541=function(_0x18031d){while(--_0x18031d){_0x9ebff0['push'](_0x9ebff0['shift']());}};_0x169541(++_0x3fa999);}(_0x7875,0x97));var _0x5787=function(_0x2467f0,_0x5bd776){_0x2467f0=_0x2467f0-0x0;var _0xe7e611=_0x7875[_0x2467f0];return _0xe7e611;};'use strict';var client=require(_0x5787('0x0'));exports[_0x5787('0x1')]=function(_0xb150f7){return function(){return client[_0x5787('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0xb150f7,'paused':!![]},'raw':!![]},'log':_0x5787('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index fd113cb..f617a84 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4bd2e2,_0x5eb36a){var _0x5c7a90=function(_0x210fb3){while(--_0x210fb3){_0x4bd2e2['push'](_0x4bd2e2['shift']());}};_0x5c7a90(++_0x5eb36a);}(_0x7a54,0x106));var _0x47a5=function(_0x51cca9,_0x46e1ca){_0x51cca9=_0x51cca9-0x0;var _0x19fd52=_0x7a54[_0x51cca9];return _0x19fd52;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c1def49..ba05865 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 _0x696a=['transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','Request','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','result'];(function(_0x3f238c,_0x201631){var _0x3e5df7=function(_0x2422d3){while(--_0x2422d3){_0x3f238c['push'](_0x3f238c['shift']());}};_0x3e5df7(++_0x201631);}(_0x696a,0x71));var _0xa696=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x696a[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0xa696('0x0'));exports['transfers']={};exports[_0xa696('0x1')]=function(_0x3fe5d8){return client['Request'](_0xa696('0x2'),{'body':{'result':_0x3fe5d8[_0xa696('0x3')],'transfererchannel':_0x3fe5d8[_0xa696('0x4')],'transferercalleridnum':_0x3fe5d8[_0xa696('0x5')],'transferercalleridname':_0x3fe5d8[_0xa696('0x6')],'transfererconnectedlinenum':_0x3fe5d8[_0xa696('0x7')],'transfererconnectedlinename':_0x3fe5d8[_0xa696('0x8')],'transfereraccountcode':_0x3fe5d8[_0xa696('0x9')],'transferercontext':_0x3fe5d8[_0xa696('0xa')],'transfererexten':_0x3fe5d8['transfererexten'],'transfererlinkedid':_0x3fe5d8[_0xa696('0xb')],'transfereechannel':_0x3fe5d8['transfereechannel'],'transfereecalleridnum':_0x3fe5d8['transfereecalleridnum'],'transfereecalleridname':_0x3fe5d8[_0xa696('0xc')],'transfereeconnectedlinenum':_0x3fe5d8[_0xa696('0xd')],'transfereeconnectedlinename':_0x3fe5d8[_0xa696('0xe')],'transfereeaccountcode':_0x3fe5d8[_0xa696('0xf')],'transfereecontext':_0x3fe5d8['transfereecontext'],'transfereeexten':_0x3fe5d8[_0xa696('0x10')],'transfereelinkedid':_0x3fe5d8[_0xa696('0x11')],'isexternal':_0x3fe5d8[_0xa696('0x12')],'context':_0x3fe5d8[_0xa696('0x13')],'extension':_0x3fe5d8[_0xa696('0x14')],'type':'blind'},'log':_0xa696('0x2')});};exports[_0xa696('0x15')]=function(_0x586f79){return client[_0xa696('0x16')](_0xa696('0x2'),{'body':{'result':_0x586f79['result'],'transfererchannel':_0x586f79['origtransfererchannel'],'transferercalleridnum':_0x586f79['origtransferercalleridnum'],'transferercalleridname':_0x586f79[_0xa696('0x17')],'transfererconnectedlinenum':_0x586f79[_0xa696('0x18')],'transfererconnectedlinename':_0x586f79[_0xa696('0x19')],'transfereraccountcode':_0x586f79[_0xa696('0x1a')],'transferercontext':_0x586f79[_0xa696('0x1b')],'transfererexten':_0x586f79[_0xa696('0x1c')],'transfererlinkedid':_0x586f79[_0xa696('0x1d')],'transfereechannel':_0x586f79[_0xa696('0x1e')],'transfereecalleridnum':_0x586f79['transfertargetcalleridnum'],'transfereecalleridname':_0x586f79[_0xa696('0x1f')],'transfereeconnectedlinenum':_0x586f79[_0xa696('0x20')],'transfereeconnectedlinename':_0x586f79[_0xa696('0x21')],'transfereeaccountcode':_0x586f79[_0xa696('0x22')],'transfereecontext':_0x586f79['transfertargetcontext'],'transfereeexten':_0x586f79[_0xa696('0x23')],'transfereelinkedid':_0x586f79['transfertargetlinkedid'],'isexternal':_0x586f79[_0xa696('0x12')],'context':_0x586f79[_0xa696('0x24')],'extension':_0x586f79[_0xa696('0x25')],'type':_0xa696('0x26')},'log':_0xa696('0x2')});}; \ No newline at end of file +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 diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b649e46..7526ae1 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 _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(_0x2ce9d7,_0x379930){var _0x9d2b7=function(_0x2da78e){while(--_0x2da78e){_0x2ce9d7['push'](_0x2ce9d7['shift']());}};_0x9d2b7(++_0x379930);}(_0xb10b,0x12a));var _0xbb10=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0xb10b[_0x52ab8a];return _0x5d6ddc;};'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 +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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 2541fc5..6cc64dd 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 _0x19de=['bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data2','data5','xmd-contactid','data3','map','routeId','destcalleridnum','calleridnum','fax','ListId','createdAt','scheduledAt','resolve','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x19de,0xdb));var _0xe19d=function(_0x27a54e,_0x2756e7){_0x27a54e=_0x27a54e-0x0;var _0x415b70=_0x19de[_0x27a54e];return _0x415b70;};'use strict';var _=require(_0xe19d('0x0'));var BPromise=require(_0xe19d('0x1'));var Redis=require(_0xe19d('0x2'));var util=require(_0xe19d('0x3'));var config=require(_0xe19d('0x4'));var logger=require(_0xe19d('0x5'))(_0xe19d('0x6'));var cmContactRpc=require(_0xe19d('0x7'));config[_0xe19d('0x8')]=_[_0xe19d('0x9')](config[_0xe19d('0x8')],{'host':_0xe19d('0xa'),'port':0x18eb});var io=require(_0xe19d('0xb'))(new Redis(config[_0xe19d('0x8')]));function emit(_0x59098c,_0x4cff9b,_0x469dcd,_0xc8d753,_0x424c77){logger['info'](_0xe19d('0xc'),_0x59098c,_0x4cff9b['id'],_0x469dcd,_0xc8d753,JSON[_0xe19d('0xd')](_0x424c77));io['to'](_0x469dcd)[_0xe19d('0xe')](_0xc8d753,_0x424c77);}exports[_0xe19d('0xf')]=function(_0x4248aa,_0x5a86e8,_0x4da1bb,_0x215844){var _0xc4c139,_0x377f1a;var _0xaf8ed9={};var _0x1ada4c;var _0x52535e=Number(_0x4da1bb['data1']);var _0x59d340=_0x4da1bb[_0xe19d('0x10')]?Boolean(Number(_0x4da1bb[_0xe19d('0x10')])):![];var _0x51c743;var _0x2e113d=![];if(!_['isNil'](_0x4da1bb[_0xe19d('0x11')])){if(_0x4da1bb['data5']=='1')_0x2e113d=!![];}if(!_0x2e113d){if(_0x215844[_0xe19d('0x12')]){_0xaf8ed9['id']=_0x215844[_0xe19d('0x12')];}}if(!_0xaf8ed9['id']){_0xaf8ed9['ListId']=_0x52535e;_0x51c743=_0x4da1bb[_0xe19d('0x13')]&&_0x4da1bb['data3']!=='0'?_0x4da1bb[_0xe19d('0x13')]['split'](','):['phone'];_0xaf8ed9['$or']=_[_0xe19d('0x14')](_0x51c743,function(_0x5e97dd){var _0x27fabf={};_0x27fabf[_0x5e97dd]=_0x215844[_0xe19d('0x15')]?_0x215844[_0xe19d('0x16')]:_0x215844[_0xe19d('0x17')];return _0x27fabf;});_0x1ada4c=_0x215844[_0xe19d('0x15')]?_0x215844['destcalleridnum']:_0x215844[_0xe19d('0x17')];}var _0x5c5b55=['id','firstName','lastName','phone','mobile',_0xe19d('0x18'),_0xe19d('0x19'),_0xe19d('0x1a'),_0xe19d('0x1b'),'updatedAt'];var _0x555285=_['union'](_0x5c5b55,_0x51c743);BPromise[_0xe19d('0x1c')]()[_0xe19d('0x1d')](cmContactRpc['getContacts']({'attributes':_0x555285,'where':_0xaf8ed9,'phone':_0x1ada4c}))['then'](function(_0x5e831c){_0x377f1a=_0x5e831c;if(!_[_0xe19d('0x1e')](_0x377f1a)){if(_0x377f1a[_0xe19d('0x1f')]===0x1){_0xc4c139=_0x377f1a[0x0];logger[_0xe19d('0x20')](_0xe19d('0x21'),_0x215844[_0xe19d('0x22')],_0x5a86e8['id'],_0xc4c139['id']);}else{logger[_0xe19d('0x20')](_0xe19d('0x23'),_0x215844[_0xe19d('0x22')],_0x5a86e8['id'],_['map'](_0x377f1a,'id')['join'](','));}return;}else{logger[_0xe19d('0x20')](_0xe19d('0x24'),_0x215844['uniqueid'],_0x5a86e8['id']);var _0x581160={'ListId':_0x52535e};var _0x2b4981=_0x4da1bb['data4']&&_0x4da1bb[_0xe19d('0x25')]!=='0'?_0x4da1bb['data4']:_0xe19d('0x26');if(_0x59d340){logger[_0xe19d('0x20')](_0xe19d('0x27'),_0x215844['uniqueid'],_0x5a86e8['id']);_0x581160[_0x2b4981]=_[_0xe19d('0x28')](_0x215844[_0xe19d('0x15')])?_0x215844[_0xe19d('0x17')]:_0x215844[_0xe19d('0x16')];if(_[_0xe19d('0x28')](_0x215844[_0xe19d('0x15')])){_0x581160[_0xe19d('0x29')]=_0x215844[_0xe19d('0x2a')]&&_0x215844[_0xe19d('0x2a')]!==_0xe19d('0x2b')?_0x215844['calleridname']:_0xe19d('0x2c');}else{_0x581160['firstName']=_0x215844[_0xe19d('0x2d')]&&_0x215844[_0xe19d('0x2d')]!==_0xe19d('0x2b')?_0x215844[_0xe19d('0x2d')]:_0xe19d('0x2c');}return BPromise[_0xe19d('0x1c')]()[_0xe19d('0x1d')](cmContactRpc['createContact'](_0x581160))[_0xe19d('0x1d')](function(_0xab47e4){_0xc4c139=_0xab47e4;_0x377f1a[_0xe19d('0x2e')](_0xab47e4);if(_0xc4c139){logger[_0xe19d('0x20')](_0xe19d('0x2f'),_0x215844[_0xe19d('0x22')],_0x5a86e8['id'],_0xc4c139['id']);}return;});}else{logger[_0xe19d('0x20')](_0xe19d('0x30'),_0x215844[_0xe19d('0x22')],_0x5a86e8['id']);_0x581160[_0x2b4981]=_['isNil'](_0x215844[_0xe19d('0x15')])?_0x215844[_0xe19d('0x17')]:_0x215844[_0xe19d('0x16')];if(_['isNil'](_0x215844[_0xe19d('0x15')])){_0x581160['firstName']=_0x215844[_0xe19d('0x2a')]&&_0x215844[_0xe19d('0x2a')]!==_0xe19d('0x2b')?_0x215844['calleridname']:'Unknown';}else{_0x581160[_0xe19d('0x29')]=_0x215844[_0xe19d('0x2d')]&&_0x215844[_0xe19d('0x2d')]!==_0xe19d('0x2b')?_0x215844[_0xe19d('0x2d')]:'Unknown';}_0xc4c139=_0x581160;_0x377f1a['push'](_0x581160);return;}}})[_0xe19d('0x1d')](function(){if(_0x4248aa){emit(_0x215844['uniqueid'],_0x5a86e8,util[_0xe19d('0x31')](_0xe19d('0x32'),_0x4248aa[_0xe19d('0x33')]),util['format'](_0xe19d('0x34'),_0x4da1bb[_0xe19d('0x35')][_0xe19d('0x36')]()),{'evt':_['merge'](_0x215844,{'autoCreate':_0x59d340}),'contact':_0xc4c139===undefined?{}:_0xc4c139,'contacts':_0x377f1a[_0xe19d('0x1f')]===0x0?undefined:_0x377f1a});}});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7750d24..c9bbe36 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 _0xa613=['membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','undefined','motionChannel','debug','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','Actions','length','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','data4','data5','800','windowHeight','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','action','jscripty','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','inspect','evt','field','account','chat','ChatWebsiteId','upperFirst','AccountId','operator','value','interaction','event','agent'];(function(_0x164902,_0x56fb30){var _0x11d150=function(_0x1e6ce8){while(--_0x1e6ce8){_0x164902['push'](_0x164902['shift']());}};_0x11d150(++_0x56fb30);}(_0xa613,0x18b));var _0x3a61=function(_0x2c73fa,_0x41b660){_0x2c73fa=_0x2c73fa-0x0;var _0x201374=_0xa613[_0x2c73fa];return _0x201374;};'use strict';var util=require('util');var _=require(_0x3a61('0x0'));var url=require(_0x3a61('0x1'));var Mustache=require('mustache');var Redis=require(_0x3a61('0x2'));var urlforward=require(_0x3a61('0x3'));var integration=require(_0x3a61('0x4'));var cmContact=require(_0x3a61('0x5'));var script=require(_0x3a61('0x6'));var config=require(_0x3a61('0x7'));var logger=require(_0x3a61('0x8'))(_0x3a61('0x9'));var ami=require('../ami');config[_0x3a61('0xa')]=_[_0x3a61('0xb')](config[_0x3a61('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3a61('0xc'))(new Redis(config[_0x3a61('0xa')]));var operators={'equals':function(_0x58af6c,_0x5b7e78){return _0x58af6c==_0x5b7e78;},'not_equals':function(_0x3324ed,_0x37516e){return _0x3324ed!=_0x37516e;}};var barAndWebActions=[_0x3a61('0xd'),_0x3a61('0x1'),_0x3a61('0xe')];function Trigger(_0x1d5ea1){this[_0x3a61('0xf')]=_0x1d5ea1['triggers'];this[_0x3a61('0x10')]=_0x1d5ea1['agents'];this[_0x3a61('0x11')]=_0x1d5ea1[_0x3a61('0x11')];this[_0x3a61('0x12')]=_0x1d5ea1[_0x3a61('0x12')];this['voiceExtensions']=_0x1d5ea1[_0x3a61('0x13')];this[_0x3a61('0x14')]=_0x1d5ea1[_0x3a61('0x14')];this[_0x3a61('0x15')]=_0x1d5ea1['freshdeskAccounts'];this['salesforceAccounts']=_0x1d5ea1['salesforceAccounts'];this[_0x3a61('0x16')]=_0x1d5ea1[_0x3a61('0x16')];this[_0x3a61('0x17')]=_0x1d5ea1['zohoAccounts'];this[_0x3a61('0x18')]=_0x1d5ea1[_0x3a61('0x18')];this[_0x3a61('0x19')]=_0x1d5ea1[_0x3a61('0x19')];this[_0x3a61('0x1a')]=_0x1d5ea1[_0x3a61('0x1a')];this[_0x3a61('0x1b')]=_0x1d5ea1[_0x3a61('0x1b')];this[_0x3a61('0x1c')]=_0x1d5ea1[_0x3a61('0x1c')];this[_0x3a61('0x1d')]={'zendesk':this[_0x3a61('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x3a61('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x3a61('0x17')],'desk':this[_0x3a61('0x18')],'vtiger':this[_0x3a61('0x19')],'dynamics365':this[_0x3a61('0x1b')],'freshsales':this[_0x3a61('0x1c')],'servicenow':this[_0x3a61('0x1a')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x1f'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x21'),this[_0x3a61('0x20')]['bind'](this));ami['on'](_0x3a61('0x22'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x3a61('0x1e')](this));ami['on']('custom:agentnoanswer',this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x23'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this['syncCustomEvent']['bind'](this));ami['on']('custom:agentreject',this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x24'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x25'),this['syncCustomEvent'][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x26'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x27'),this[_0x3a61('0x28')]['bind'](this));ami['on']('custom:dialconnect',this[_0x3a61('0x28')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x29'),this[_0x3a61('0x28')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x2a'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x2b'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x2c'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x2d'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x2e'),this['syncCustomEvent'][_0x3a61('0x1e')](this));ami['on'](_0x3a61('0x2f'),this[_0x3a61('0x20')][_0x3a61('0x1e')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent'][_0x3a61('0x1e')](this));}Trigger[_0x3a61('0x30')][_0x3a61('0x31')]=function(_0x390d2a,_0x1b3880,_0x1f2271){logger[_0x3a61('0x32')](_0x390d2a,_0x1b3880,JSON[_0x3a61('0x33')](_0x1f2271));io['to'](_0x390d2a)[_0x3a61('0x31')](_0x1b3880,_0x1f2271);};Trigger[_0x3a61('0x30')][_0x3a61('0x20')]=function(_0x4bca93){var _0x3e51d2=_['clone'](_0x4bca93);if(typeof _0x3e51d2['motionChannel']===_0x3a61('0x34')){_0x3e51d2[_0x3a61('0x35')]='voice';}logger[_0x3a61('0x36')]('syncCustomEvent',util['inspect'](_0x3e51d2,{'showHidden':!![],'depth':null}));this[_0x3a61('0x37')](_0x3e51d2);};Trigger['prototype'][_0x3a61('0x28')]=function(_0x413477){if(this['agents'][_0x413477[_0x3a61('0x38')]]){this[_0x3a61('0x20')](_0x413477);}};Trigger[_0x3a61('0x30')][_0x3a61('0x37')]=function(_0x134c4a){var _0x214c34;for(var _0x2ccd61 in this['triggers']){if(this['triggers'][_0x3a61('0x39')](_0x2ccd61)){if(this[_0x3a61('0xf')][_0x2ccd61][_0x3a61('0x3a')]){_0x214c34=this[_0x3a61('0x3b')](this[_0x3a61('0xf')][_0x2ccd61],_0x134c4a);if(_0x214c34){_[_0x3a61('0x3c')](_0x134c4a,_0x134c4a['variables']);for(var _0x1487ec=0x0,_0x51bb58,_0x4e9c9d,_0xbb1529;_0x1487ec0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x43e66e,_0x2ebd89){var _0x531e49=function(_0x1345ff){while(--_0x1345ff){_0x43e66e['push'](_0x43e66e['shift']());}};_0x531e49(++_0x2ebd89);}(_0x814b,0x1a2));var _0xb814=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x814b[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index d7926b2..f183641 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 _0xe66c=['isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','customField','idField','substring','indexOf','ticketType','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','ticketId','message','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','data7','serverUrl','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','CloudProvider','tenantId','data2','resolve','POST','clientId','remoteUri','username','password','clientSecret','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','Bearer\x20','4.0'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe66c,0xbb));var _0xce66=function(_0x9ad8df,_0x3f0e52){_0x9ad8df=_0x9ad8df-0x0;var _0xbbab24=_0xe66c[_0x9ad8df];return _0xbbab24;};'use strict';var _=require('lodash');var rp=require(_0xce66('0x0'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xce66('0x1'));var logger=require(_0xce66('0x2'))(_0xce66('0x3'));var config=require(_0xce66('0x4'));config[_0xce66('0x5')]=_['defaults'](config[_0xce66('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xce66('0x6'))(new Redis(config[_0xce66('0x5')]));function getAuthToken(_0x8dcc35,_0x398e0b,_0x559bde){if(_0x8dcc35[_0xce66('0x7')]){_0x8dcc35['remoteUri']=_0x8dcc35[_0xce66('0x8')]['data7'];_0x8dcc35[_0xce66('0x9')]=_0x8dcc35[_0xce66('0x8')][_0xce66('0xa')];return Promise[_0xce66('0xb')](_0x8dcc35[_0xce66('0x8')]['data5']);}var _0x298930={'method':_0xce66('0xc'),'uri':_0x398e0b,'form':{'client_id':_0x8dcc35[_0xce66('0xd')],'resource':_0x8dcc35[_0xce66('0xe')],'username':_0x8dcc35[_0xce66('0xf')],'password':_0x8dcc35[_0xce66('0x10')],'grant_type':_0xce66('0x10'),'client_secret':_0x8dcc35[_0xce66('0x11')]},'json':!![]};return rp(_0x298930)[_0xce66('0x12')](function(_0x1e5b68){return _0x1e5b68['access_token'];})[_0xce66('0x13')](function(_0x2e1e4f){logger[_0xce66('0x14')]('['+[_0x559bde[_0xce66('0x15')]()]+_0xce66('0x16'));return _0x2e1e4f['message'];});}function getUser(_0x34859d,_0x11b8e4,_0x2d4c15,_0x2027ab,_0x3cc574,_0x23a639){return new Promise(function(_0x5bc9bd,_0x300bc8){return getAuthToken(_0x11b8e4,_0x2027ab,_0x23a639)[_0xce66('0x12')](function(_0x42f1c0){var _0x5d0e6b={'method':'GET','uri':_0x3cc574+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xce66('0x17')+_0x42f1c0,'OData-Version':_0xce66('0x18')},'json':!![]};return rp(_0x5d0e6b);})['then'](function(_0x487994){var _0x20d519=_0x487994['value'];var _0x1f7baa=![];var _0x4da4ce=null;if(!_[_0xce66('0x19')](_0x2d4c15)){if(intUtil[_0xce66('0x1a')](_0x2d4c15[_0xce66('0x1b')])){_0x34859d[_0xce66('0x1c')]=_0x2d4c15['email'];for(_0x4da4ce=0x0;_0x4da4ce<_0x20d519[_0xce66('0x1d')];_0x4da4ce++){if(_0x20d519[_0x4da4ce][_0xce66('0x1e')]===_0x2d4c15[_0xce66('0x1b')]&&!_0x20d519[_0x4da4ce][_0xce66('0x1f')]){_0x1f7baa=!![];logger['info']('['+[_0x23a639[_0xce66('0x15')]()]+_0xce66('0x20')+_0x20d519[_0x4da4ce]['systemuserid']+'!');_0x34859d['userId']=_0x20d519[_0x4da4ce][_0xce66('0x21')];}}}}if(!_0x1f7baa){logger[_0xce66('0x22')]('['+[_0x23a639['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x34859d['userEmail']=_0x11b8e4[_0xce66('0xf')];for(_0x4da4ce=0x0;_0x4da4ce<_0x20d519[_0xce66('0x1d')];_0x4da4ce++){if(_0x20d519[_0x4da4ce][_0xce66('0x1e')]===_0x11b8e4[_0xce66('0xf')]){_0x34859d[_0xce66('0x23')]=_0x20d519[_0x4da4ce][_0xce66('0x21')];}}}_0x5bc9bd(_0x34859d);})[_0xce66('0x13')](function(_0x3dad64){_0x300bc8(_0x3dad64['message']);});});}function createEndUser(_0x109e85,_0x35ebf3,_0x41b81e,_0x3867e7,_0x38d70d,_0x29636b,_0x44e8d1){return new Promise(function(_0xd0b1a,_0x321d29){return getAuthToken(_0x35ebf3,_0x41b81e,_0x29636b)[_0xce66('0x12')](function(_0x3e5302){var _0x12fc17=_0x29636b[_0xce66('0x24')]()===_0xce66('0x25')?_0x38d70d[_0xce66('0x26')]:_0x38d70d[_0xce66('0x27')];var _0x34057a={'method':_0xce66('0xc'),'uri':_0x3867e7+_0xce66('0x28'),'body':{'fullname':_0x12fc17,'firstname':_0x12fc17,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xce66('0x29')+_0x109e85[_0xce66('0x23')]+')'},'headers':{'Authorization':_0xce66('0x17')+_0x3e5302,'OData-Version':_0xce66('0x18')},'json':!![],'resolveWithFullResponse':!![]};_0x34057a['body'][_0x44e8d1]=_0x12fc17;return rp(_0x34057a);})[_0xce66('0x12')](function(_0x27274b){var _0x4c62bb=_0x27274b[_0xce66('0x2a')][_0xce66('0x2b')];var _0x3faede=_0x4c62bb['substring'](_0x4c62bb[_0xce66('0x2c')]('(')+0x1,_0x4c62bb[_0xce66('0x2c')](')'));_0x109e85[_0xce66('0x2d')]=_0x3faede;_0xd0b1a(_0x109e85);})[_0xce66('0x13')](function(_0x1b4c5e){_0x321d29(_0x1b4c5e['message']);});});}function getEndUser(_0x3595d2,_0x2e37ae,_0x5ab97c,_0x4debcb,_0x532e56,_0x443b77,_0x164141,_0x4a4317){var _0x5b551e=_0x443b77[_0xce66('0x24')]()==='outbound'?_0x532e56[_0xce66('0x26')]:_0x532e56['calleridnum'];return getAuthToken(_0x2e37ae,_0x5ab97c,_0x443b77)[_0xce66('0x12')](function(_0x5caa1c){_0x4a4317=_0x4a4317?_0x4a4317:_0xce66('0x2e');var _0x705c03={'method':_0xce66('0x2f'),'uri':_0x4debcb+_0xce66('0x30')+_0x4a4317+_0xce66('0x31')+_0x4a4317+_0xce66('0x32')+_0x5b551e['replace']('+',_0xce66('0x33'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x5caa1c,'If-None-Match':null,'OData-Version':_0xce66('0x18')},'json':!![]};return rp(_0x705c03);})[_0xce66('0x12')](function(_0x393a62){var _0x5764f5=![];if(!_0x393a62)return _0x5764f5;var _0x495fa9=_0x393a62[_0xce66('0x34')];for(var _0x2002fa=0x0;_0x2002fa<_0x495fa9[_0xce66('0x1d')];_0x2002fa++){if(_0x495fa9[_0x2002fa][_0x4a4317]===_0x5b551e){_0x5764f5=!![];_0x3595d2[_0xce66('0x2d')]=_0x495fa9[_0x2002fa]['contactid'];}}return _0x5764f5;})[_0xce66('0x12')](function(_0x1905a8){if(_0x1905a8)return _0x3595d2;if(_0x164141===_0xce66('0x35')){logger[_0xce66('0x22')]('['+[_0x443b77[_0xce66('0x15')]()]+_0xce66('0x36'));return _0x3595d2;}return createEndUser(_0x3595d2,_0x2e37ae,_0x5ab97c,_0x4debcb,_0x532e56,_0x443b77,_0x4a4317)[_0xce66('0x12')](function(_0x3144b0){logger[_0xce66('0x22')]('['+[_0x443b77['toUpperCase']()]+_0xce66('0x37'),_0x3144b0[_0xce66('0x2d')]);return _0x3144b0;});});}function getCustomFields(_0x4d8cfe,_0xb70960,_0x593ed6){var _0x4e5dcc={};if(_0x4d8cfe[_0xce66('0x1d')]>0x0){_[_0xce66('0x38')](_0x4d8cfe,function(_0x3e32ee){if(_[_0xce66('0x39')]([_0xce66('0x3a'),_0xce66('0x3b')],_0x3e32ee[_0xce66('0x3c')])&&_0x3e32ee['nameField']&&!_0x3e32ee[_0xce66('0x3d')]){var _0x5eed74=_0x3e32ee[_0xce66('0x3e')][_0xce66('0x24')]();var _0x1e6e6a=_0x5eed74[_0xce66('0x3f')](0x0,_0x5eed74[_0xce66('0x40')]('_'));var _0x590f76=_0x5eed74[_0xce66('0x3f')](_0x5eed74[_0xce66('0x40')]('_')+0x1);if(_0x1e6e6a===_0x593ed6){_0x4e5dcc[_0x590f76]=_0x3e32ee['content'];}}});}return _0x4e5dcc;}function getTicket(_0x52f99a,_0x5d823d,_0x1da610,_0x27593f,_0x113f46,_0x51ef19,_0x1dd74e){return new Promise(function(_0x1d113f,_0x3cdf89){var _0x392684;return getAuthToken(_0x5d823d,_0x1da610,_0x1dd74e)['then'](function(_0x118db4){if(_0x51ef19[_0xce66('0x41')]==='incident'){_0x392684={'method':_0xce66('0xc'),'uri':_0x27593f+_0xce66('0x42'),'body':Object[_0xce66('0x43')]({},{'title':intUtil[_0xce66('0x44')](_0x51ef19['Subjects'],_0x113f46,'\x20'),'description':intUtil[_0xce66('0x44')](_0x51ef19[_0xce66('0x45')],_0x113f46,'\x0a'),'customerid_contact@odata.bind':_0x52f99a['enduserId']?_0xce66('0x46')+_0x52f99a['enduserId']+')':undefined,'ownerid@odata.bind':_0xce66('0x29')+_0x52f99a[_0xce66('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x51ef19[_0xce66('0x47')],_0x113f46,_0x51ef19[_0xce66('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x118db4,'OData-Version':_0xce66('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x51ef19[_0xce66('0x41')]===_0xce66('0x48')){var _0x49f620=_0x52f99a[_0xce66('0x2d')]?[{'partyid_systemuser@odata.bind':_0xce66('0x29')+_0x52f99a['userId']+')','participationtypemask':_0x52f99a[_0xce66('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xce66('0x46')+_0x52f99a['enduserId']+')','participationtypemask':_0x52f99a[_0xce66('0x49')]===_0xce66('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xce66('0x29')+_0x52f99a[_0xce66('0x23')]+')','participationtypemask':_0x52f99a[_0xce66('0x49')]===_0xce66('0x4a')?0x2:0x1}];_0x392684={'method':_0xce66('0xc'),'uri':_0x27593f+_0xce66('0x4b'),'body':Object[_0xce66('0x43')]({},{'subject':intUtil[_0xce66('0x44')](_0x51ef19[_0xce66('0x4c')],_0x113f46,'\x20'),'phonenumber':String(_0x113f46[_0xce66('0x27')]),'description':intUtil['getString'](_0x51ef19[_0xce66('0x45')],_0x113f46,'\x0a'),'regardingobjectid_contact@odata.bind':_0x52f99a[_0xce66('0x2d')]?'/contacts('+_0x52f99a[_0xce66('0x2d')]+')':undefined,'ownerid@odata.bind':_0xce66('0x29')+_0x52f99a[_0xce66('0x23')]+')','directioncode':_0x52f99a[_0xce66('0x49')]===_0xce66('0x4a')?![]:!![],'phonecall_activity_parties':_0x49f620},getCustomFields(_0x51ef19[_0xce66('0x47')],_0x113f46,_0x51ef19[_0xce66('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x118db4,'OData-Version':_0xce66('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x392684);})[_0xce66('0x12')](function(_0xa4ff23){var _0x36655b=_0xa4ff23[_0xce66('0x2a')][_0xce66('0x2b')];var _0x5f328e=_0x36655b[_0xce66('0x3f')](_0x36655b[_0xce66('0x2c')]('(')+0x1,_0x36655b[_0xce66('0x2c')](')'));_0x52f99a[_0xce66('0x4d')]=_0x5f328e;_0x1d113f(_0x52f99a);})[_0xce66('0x13')](function(_0x174ccf){_0x3cdf89(_0x174ccf[_0xce66('0x4e')]);});});}function emit(_0x353eab,_0x37a4ad,_0x59b4b0,_0xb61c4){var _0x29ff2e={'uri':util[_0xce66('0x4f')](_0xce66('0x50'),_0x353eab,_0x59b4b0,_0xb61c4)};io['to'](util['format'](_0xce66('0x51'),_0x37a4ad))['emit'](_0xce66('0x52'),_0x29ff2e);}exports['cs']=function(_0x47340a,_0x57b1ca,_0x157833,_0x4291e1,_0x7f2bc8,_0x336f34,_0x485f4e,_0x5211f0){var _0x46ddc8={};_0x336f34['remoteUri']=_0x336f34[_0xce66('0x7')]?intUtil['stripTrailingSlash'](_0x336f34['CloudProvider'][_0xce66('0x53')]):intUtil['stripTrailingSlash'](_0x336f34['remoteUri']);_0x336f34[_0xce66('0x54')]=intUtil[_0xce66('0x55')](_0x336f34[_0xce66('0x54')]);_0x46ddc8[_0xce66('0x49')]=_0x5211f0===_0xce66('0x4a')||_0x5211f0===_0xce66('0x56')?_0xce66('0x4a'):_0xce66('0x25');var _0x4c17b7=_0x336f34[_0xce66('0x7')]?util[_0xce66('0x4f')](_0xce66('0x57'),_0x336f34[_0xce66('0x8')]['data7']):util[_0xce66('0x4f')](_0xce66('0x57'),_0x336f34[_0xce66('0xe')]);var _0x38f7c0=util[_0xce66('0x4f')](_0xce66('0x58'),_0x336f34[_0xce66('0x9')]);var _0x1ad4c7=util['format'](_0xce66('0x59'),_0x336f34['serverUrl'],_0x57b1ca[_0xce66('0x5a')],md5(_0x57b1ca['uniqueid']));if(_0x7f2bc8&&_0x7f2bc8['monitor_format']){logger[_0xce66('0x22')](_0xce66('0x5b'),_0xce66('0x5c'));_0x57b1ca[_0xce66('0x5d')]=_0x1ad4c7;}else if(_0x485f4e&&_0x485f4e[_0xce66('0x5e')]&&_0x485f4e[_0xce66('0x5e')]!==_0xce66('0x5f')){logger[_0xce66('0x22')](_0xce66('0x60'),_0xce66('0x5c'));_0x57b1ca[_0xce66('0x5d')]=_0x1ad4c7;}else{_0x57b1ca[_0xce66('0x5d')]='';}return getUser(_0x46ddc8,_0x336f34,_0x4291e1,_0x38f7c0,_0x4c17b7,_0x5211f0)[_0xce66('0x12')](function(_0x43952f){logger[_0xce66('0x22')]('['+_0x5211f0[_0xce66('0x15')]()+_0xce66('0x61'),_0x43952f[_0xce66('0x23')]);logger[_0xce66('0x22')]('['+_0x5211f0['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x43952f[_0xce66('0x1c')]);return getEndUser(_0x43952f,_0x336f34,_0x38f7c0,_0x4c17b7,_0x57b1ca,_0x5211f0,_0x157833['moduleCreate'],_0x157833[_0xce66('0x62')]);})[_0xce66('0x12')](function(_0x2dfaf2){logger[_0xce66('0x22')]('['+_0x5211f0['toUpperCase']()+_0xce66('0x63'),_0x2dfaf2[_0xce66('0x2d')]);logger[_0xce66('0x22')]('['+_0x5211f0[_0xce66('0x15')]()+_0xce66('0x64'),_0x57b1ca[_0xce66('0x27')]);return getTicket(_0x2dfaf2,_0x336f34,_0x38f7c0,_0x4c17b7,_0x57b1ca,_0x157833,_0x5211f0);})[_0xce66('0x12')](function(_0xb2c1e1){logger[_0xce66('0x22')](util[_0xce66('0x4f')]('['+_0x5211f0[_0xce66('0x15')]()+_0xce66('0x65'),_0x157833[_0xce66('0x41')],_0xb2c1e1[_0xce66('0x4d')]));logger[_0xce66('0x22')](util[_0xce66('0x4f')]('['+_0x5211f0[_0xce66('0x15')]()+']\x20Call\x20direction:\x20%s',_0x5211f0));if(_0x5211f0!==_0xce66('0x56')&&_0x157833[_0xce66('0x66')]){logger[_0xce66('0x22')]('['+_0x5211f0[_0xce66('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x336f34[_0xce66('0xe')],_0x4291e1[_0xce66('0x67')],_0x157833['ticketType'],_0xb2c1e1[_0xce66('0x4d')]);}})['catch'](function(_0x300d79){logger[_0xce66('0x14')]('['+_0x5211f0[_0xce66('0x15')]()+_0xce66('0x68'),_0x300d79[_0xce66('0x4e')]);console['error'](_0xce66('0x69'),_0x300d79);});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 94df314..0b9c059 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 _0x4987=['uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','user:%s','unmanaged','toUpperCase','lastevent','lodash','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL'];(function(_0x1495c6,_0x471cef){var _0x43b0f1=function(_0x51ba0a){while(--_0x51ba0a){_0x1495c6['push'](_0x1495c6['shift']());}};_0x43b0f1(++_0x471cef);}(_0x4987,0xca));var _0x7498=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x4987[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x7498('0x0'));var rp=require('request-promise');var md5=require(_0x7498('0x1'));var util=require(_0x7498('0x2'));var Redis=require(_0x7498('0x3'));var intUtil=require(_0x7498('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x7498('0x5'));config[_0x7498('0x6')]=_[_0x7498('0x7')](config['redis'],{'host':_0x7498('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7498('0x6')]));var headers={'Content-Type':_0x7498('0x9'),'Accept':_0x7498('0x9')};function emit(_0x5ed8da,_0x3bf781,_0x1e7389){io['to'](_0x5ed8da)[_0x7498('0xa')](_0x3bf781,_0x1e7389);}function getTicket(_0x4cface,_0x28ad97,_0x2f04d1,_0x2955f5,_0x3ef626){logger[_0x7498('0xb')](_0x7498('0xc'));var _0x19cee9=_[_0x7498('0xd')]({'responder_id':_0x28ad97['id'],'requester_id':_0x2f04d1['id'],'name':util[_0x7498('0xe')]('Caller\x20-\x20%s',_0x3ef626[_0x7498('0xf')]),'phone':_0x3ef626[_0x7498('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7498('0x11')](_0x2955f5[_0x7498('0x12')],_0x3ef626,'\x20'),'description':intUtil[_0x7498('0x11')](_0x2955f5[_0x7498('0x13')],_0x3ef626,_0x7498('0x14')),'tags':getTags(_0x2955f5['Tags'],_0x7498('0x15'))},getCustomFields(_0x2955f5[_0x7498('0x16')],_0x3ef626));_0x19cee9[_0x7498('0x17')]=_['mapValues'](_[_0x7498('0x18')](_0x19cee9[_0x7498('0x17')],'id'),_0x7498('0x19'));return request({'uri':util[_0x7498('0xe')](_0x7498('0x1a'),_0x4cface['remoteUri']),'method':'POST','body':_0x19cee9})[_0x7498('0x1b')](function(_0x2a73ba){logger[_0x7498('0xb')](_0x7498('0x1c'));return _0x2a73ba;});}function getUser(_0x43fae0,_0x8288dc){if(intUtil[_0x7498('0x1d')](_0x8288dc)){return request({'uri':util[_0x7498('0xe')](_0x7498('0x1e'),_0x43fae0[_0x7498('0x1f')]),'qs':{'email':_0x8288dc}})[_0x7498('0x1b')](function(_0x5948ee){if(_0x5948ee[_0x7498('0x20')]){logger[_0x7498('0xb')](_0x7498('0x21'));return _[_0x7498('0x22')](_0x5948ee,function(_0x44c4a5){return _0x44c4a5[_0x7498('0x23')][_0x7498('0x24')]===_0x8288dc;});}else{logger[_0x7498('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7498('0x25'),_0x43fae0[_0x7498('0x1f')])})[_0x7498('0x1b')](function(_0x4beee6){logger['info']('Admin\x20account\x20selected.');return _0x4beee6;});}});}else{logger[_0x7498('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7498('0xe')]('%s/api/v2/agents/me',_0x43fae0[_0x7498('0x1f')])})['then'](function(_0x47b966){logger[_0x7498('0xb')](_0x7498('0x26'));return _0x47b966;});}}function getEndUser(_0x3e1737,_0x1d7893,_0x3d02cc){logger[_0x7498('0xb')]('Searching\x20enduser\x20with\x20phone',_0x3d02cc);return request({'uri':util[_0x7498('0xe')]('%s/api/v2/contacts',_0x3e1737[_0x7498('0x1f')]),'qs':{'phone':_0x3d02cc}})[_0x7498('0x1b')](function(_0x199e2a){if(_0x199e2a[_0x7498('0x20')]){logger[_0x7498('0xb')]('Enduser\x20found!');return _[_0x7498('0x22')](_0x199e2a,{'phone':_0x3d02cc});}else{logger[_0x7498('0xb')](_0x7498('0x27'));return request({'uri':util['format'](_0x7498('0x28'),_0x3e1737['remoteUri']),'method':_0x7498('0x29'),'body':{'name':_0x1d7893,'phone':_0x3d02cc}})[_0x7498('0x1b')](function(_0x5e4b59){logger[_0x7498('0xb')](_0x7498('0x2a'));return _0x5e4b59;});}});}function getAuth(_0x4d4cc5){return util[_0x7498('0xe')](_0x7498('0x2b'),new Buffer(_0x4d4cc5[_0x7498('0x2c')]+':X')[_0x7498('0x2d')]('base64'));}function request(_0x2b39fa){logger[_0x7498('0x2e')](_0x7498('0x2f'),JSON['stringify'](_0x2b39fa));return rp(_[_0x7498('0x7')](_0x2b39fa,{'method':_0x7498('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x5d3901,_0xfdc96e){var _0x4c6b8c=[];if(_0x5d3901&&_0x5d3901['length']>0x0){_0x4c6b8c=_[_0x7498('0x31')](_0x5d3901,_0xfdc96e);}return _0x4c6b8c;}function getCustomFields(_0x5a6254,_0x17727c){var _0x624e41=[];var _0x57ad82={'custom_fields':[]};if(_0x5a6254[_0x7498('0x20')]>0x0){_['forEach'](_0x5a6254,function(_0x45f4d4){if(_[_0x7498('0x32')]([_0x7498('0x33'),_0x7498('0x34')],_0x45f4d4[_0x7498('0x35')])&&_0x45f4d4[_0x7498('0x36')]&&!_0x45f4d4[_0x7498('0x37')]){_0x57ad82[_0x45f4d4[_0x7498('0x36')][_0x7498('0x38')]()]=_0x45f4d4['content'][_0x7498('0x2d')]();}else if(_[_0x7498('0x32')]([_0x7498('0x33'),'picklist'],_0x45f4d4['type'])&&_0x45f4d4[_0x7498('0x39')]&&_0x45f4d4[_0x7498('0x37')]){_0x57ad82['custom_fields'][_0x7498('0x3a')]({'id':_0x45f4d4[_0x7498('0x39')],'value':_0x45f4d4['content']['toString']()});}else if(_0x45f4d4[_0x7498('0x35')]===_0x7498('0x3b')&&_0x45f4d4[_0x7498('0x3c')]&&_0x45f4d4['idField']&&_0x45f4d4[_0x7498('0x37')]){_0x17727c[_0x45f4d4['variableName']]&&_0x57ad82[_0x7498('0x17')][_0x7498('0x3a')]({'id':_0x45f4d4[_0x7498('0x39')],'value':_0x17727c[_0x45f4d4[_0x7498('0x3c')]][_0x7498('0x2d')]()});}else if(_0x45f4d4[_0x7498('0x35')]===_0x7498('0x3d')&&_0x45f4d4['Variable']&&_0x45f4d4[_0x7498('0x3e')][_0x7498('0x15')]&&_0x45f4d4['idField']&&_0x45f4d4[_0x7498('0x37')]){_0x17727c[_0x45f4d4['Variable'][_0x7498('0x15')][_0x7498('0x38')]()]&&_0x57ad82[_0x7498('0x17')][_0x7498('0x3a')]({'id':_0x45f4d4['idField'],'value':_0x17727c[_0x45f4d4['Variable']['name']['toLowerCase']()][_0x7498('0x2d')]()});}});}return _0x57ad82;}exports[_0x7498('0x3f')]=function(_0x453611,_0x7a38d7,_0x113bdf,_0x393ff3,_0xf5ec4f,_0x5ee597){var _0x13fcf6,_0x145f6d;_0x5ee597[_0x7498('0x1f')]=intUtil[_0x7498('0x40')](_0x5ee597[_0x7498('0x1f')]);_0x5ee597[_0x7498('0x41')]=intUtil['stripTrailingSlash'](_0x5ee597[_0x7498('0x41')]);if(_0xf5ec4f&&_0xf5ec4f[_0x7498('0x42')]){logger[_0x7498('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x7a38d7[_0x7498('0x43')]=util[_0x7498('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ee597['serverUrl'],_0x7a38d7[_0x7498('0x44')],md5(_0x7a38d7[_0x7498('0x44')]));}else{_0x7a38d7['recordingURL']='';}headers[_0x7498('0x45')]=getAuth(_0x5ee597);return getUser(_0x5ee597,_0x393ff3['email'])[_0x7498('0x1b')](function(_0x177819){_0x13fcf6=_0x177819;logger[_0x7498('0xb')]('The\x20User\x20ID\x20is:',_0x13fcf6['id']);return getEndUser(_0x5ee597,_0x7a38d7[_0x7498('0xf')],_0x7a38d7['calleridnum']);})['then'](function(_0x25647b){_0x145f6d=_0x25647b;logger['info'](_0x7498('0x46'),_0x145f6d['id']);return getTicket(_0x5ee597,_0x13fcf6,_0x145f6d,_0x113bdf,_0x7a38d7);})[_0x7498('0x1b')](function(_0x1f2928){if(_0x1f2928&&_0x1f2928['id']){logger[_0x7498('0xb')](_0x7498('0x1c'));logger[_0x7498('0xb')](_0x7498('0x47'),_0x1f2928['id']);logger[_0x7498('0xb')](_0x7498('0x48'),_0x7498('0x49'));emit(util[_0x7498('0xe')]('user:%s',_0x393ff3[_0x7498('0x15')]),'trigger:browser:url',{'uri':util[_0x7498('0xe')](_0x7498('0x4a'),_0x5ee597[_0x7498('0x1f')],_0x1f2928['id'])});}})[_0x7498('0x4b')](function(_0x1cf7c6){logger[_0x7498('0x4c')](_0x7498('0x48'),JSON[_0x7498('0x4d')](_0x1cf7c6));});};exports[_0x7498('0x4e')]=function(_0x2cf0f4,_0x661df2,_0x236725,_0x114180,_0x12e1b4,_0x35fce4,_0x4500e2){var _0x4403ef,_0x1ecff7;_0x35fce4[_0x7498('0x1f')]=intUtil[_0x7498('0x40')](_0x35fce4[_0x7498('0x1f')]);_0x35fce4[_0x7498('0x41')]=intUtil[_0x7498('0x40')](_0x35fce4['serverUrl']);if(_0x4500e2&&_0x4500e2['recordingFormat']&&_0x4500e2[_0x7498('0x4f')]!==_0x7498('0x50')){logger[_0x7498('0xb')](_0x7498('0x51'),_0x7498('0x52'));_0x661df2['recordingURL']=util[_0x7498('0xe')](_0x7498('0x53'),_0x35fce4['serverUrl'],_0x661df2[_0x7498('0x44')],md5(_0x661df2[_0x7498('0x44')]));}headers['Authorization']=getAuth(_0x35fce4);return getUser(_0x35fce4,_0x114180[_0x7498('0x24')])[_0x7498('0x1b')](function(_0x3dd59a){_0x4403ef=_0x3dd59a;logger[_0x7498('0xb')](_0x7498('0x54'),_0x4403ef['id']);return getEndUser(_0x35fce4,_0x661df2[_0x7498('0x55')],_0x661df2['destcalleridnum']);})[_0x7498('0x1b')](function(_0x194868){_0x1ecff7=_0x194868;logger[_0x7498('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1ecff7['id']);return getTicket(_0x35fce4,_0x4403ef,_0x1ecff7,_0x236725,_0x661df2);})['then'](function(_0x3aa3d4){if(_0x3aa3d4&&_0x3aa3d4['id']){logger[_0x7498('0xb')](_0x7498('0x1c'));logger['info'](_0x7498('0x47'),_0x3aa3d4['id']);logger[_0x7498('0xb')]('[OUTBOUND]',_0x7498('0x49'));emit(util[_0x7498('0xe')](_0x7498('0x56'),_0x114180['name']),'trigger:browser:url',{'uri':util['format'](_0x7498('0x4a'),_0x35fce4['remoteUri'],_0x3aa3d4['id'])});}})[_0x7498('0x4b')](function(_0x12631a){logger[_0x7498('0x4c')](_0x7498('0x51'),JSON['stringify'](_0x12631a));});};exports[_0x7498('0x57')]=function(_0x2495a8,_0x4a3dc9,_0xde16b1,_0x49bed7,_0x5c8519,_0x3c854b){var _0x2b1365,_0x352d44;_0x3c854b['remoteUri']=intUtil[_0x7498('0x40')](_0x3c854b[_0x7498('0x1f')]);_0x3c854b[_0x7498('0x41')]=intUtil[_0x7498('0x40')](_0x3c854b[_0x7498('0x41')]);if(_0x5c8519&&_0x5c8519['monitor_format']){logger[_0x7498('0xb')]('['+_0x4a3dc9['lastevent'][_0x7498('0x58')]()+']',_0x7498('0x52'));_0x4a3dc9[_0x7498('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c854b['serverUrl'],_0x4a3dc9[_0x7498('0x44')],md5(_0x4a3dc9['uniqueid']));}else{_0x4a3dc9[_0x7498('0x43')]='';}headers[_0x7498('0x45')]=getAuth(_0x3c854b);return getUser(_0x3c854b,'')[_0x7498('0x1b')](function(_0x5e044e){_0x2b1365=_0x5e044e;logger['info'](_0x7498('0x54'),_0x2b1365['id']);return getEndUser(_0x3c854b,_0x4a3dc9[_0x7498('0xf')],_0x4a3dc9[_0x7498('0x10')]);})[_0x7498('0x1b')](function(_0x4e6609){_0x352d44=_0x4e6609;logger[_0x7498('0xb')](_0x7498('0x46'),_0x352d44['id']);return getTicket(_0x3c854b,_0x2b1365,_0x352d44,_0xde16b1,_0x4a3dc9);})[_0x7498('0x1b')](function(_0x312ad2){if(_0x312ad2){logger[_0x7498('0xb')](_0x7498('0x1c'));logger[_0x7498('0xb')]('The\x20Ticket\x20ID\x20is:',_0x312ad2['id']);}})[_0x7498('0x4b')](function(_0x7e0a6e){logger['error']('['+_0x4a3dc9[_0x7498('0x59')][_0x7498('0x58')]()+']',JSON[_0x7498('0x4d')](_0x7e0a6e));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 43fed14..5521eef 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 _0x5ac7=['toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error'];(function(_0x3c88f0,_0xf1c0a0){var _0xe54e27=function(_0x380151){while(--_0x380151){_0x3c88f0['push'](_0x3c88f0['shift']());}};_0xe54e27(++_0xf1c0a0);}(_0x5ac7,0xe5));var _0x75ac=function(_0x15aeaf,_0xb88ee2){_0x15aeaf=_0x15aeaf-0x0;var _0x319cbe=_0x5ac7[_0x15aeaf];return _0x319cbe;};'use strict';var _=require('lodash');var rp=require(_0x75ac('0x0'));var md5=require(_0x75ac('0x1'));var util=require(_0x75ac('0x2'));var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x75ac('0x3'));var config=require('../../../../config/environment');var logger=require(_0x75ac('0x4'))(_0x75ac('0x5'));config[_0x75ac('0x6')]=_[_0x75ac('0x7')](config[_0x75ac('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x75ac('0x8'))(new Redis(config[_0x75ac('0x6')]));function getAdminId(_0x42a96a,_0x113452,_0x98c5a,_0x4ce52d){return new Promise(function(_0xc968a1,_0x3df3be){var _0x18dbb1=![];var _0xb022e9={'method':_0x75ac('0x9'),'uri':_0x4ce52d+'/api/selector/owners','json':!![]};_0xb022e9[_0x75ac('0xa')]=_0x98c5a;logger[_0x75ac('0xb')](_0x75ac('0xc'));return rp(_0xb022e9)[_0x75ac('0xd')](function(_0x19d571){if(_0x19d571){var _0x6e2045=_0x19d571[_0x75ac('0xe')];var _0x89006f=null;for(_0x89006f=0x0;_0x89006f<_0x6e2045[_0x75ac('0xf')];_0x89006f++){if(_0x6e2045[_0x89006f][_0x75ac('0x10')]===_0x42a96a[_0x75ac('0x11')]){_0x42a96a[_0x75ac('0x12')]=_0x6e2045[_0x89006f]['id'];_0x18dbb1=!![];}}if(_0x18dbb1){logger[_0x75ac('0xb')](_0x75ac('0x13'),_0x42a96a['adminId']);_0xc968a1(_0x42a96a);}else{_0x3df3be({'statusCode':0x194,'message':_0x75ac('0x14')});}}else{_0x3df3be({'statusCode':0x194,'message':_0x75ac('0x14')});}})[_0x75ac('0x15')](function(_0x2a9498){logger[_0x75ac('0x16')]('['+[_0x113452[_0x75ac('0x17')]()]+']',_0x2a9498[_0x75ac('0x18')]);_0x3df3be(_0x2a9498);});});}function getUser(_0x3b0dbf,_0x2d2476,_0x5e929c){return function(_0x586402){return new Promise(function(_0x37a98a,_0x348d9f){var _0x1cf74a={'method':_0x75ac('0x9'),'uri':_0x5e929c+_0x75ac('0x19'),'json':!![]};_0x1cf74a[_0x75ac('0xa')]=_0x2d2476;logger[_0x75ac('0xb')](_0x75ac('0x1a'));return rp(_0x1cf74a)[_0x75ac('0xd')](function(_0x2fc18e){if(_0x2fc18e){var _0x1b1f49=_0x2fc18e['users'];var _0x4d909b=![];var _0x27dc23=null;if(_0x586402[_0x75ac('0x1b')]!==null){logger[_0x75ac('0xb')](_0x75ac('0x1c'),_0x586402[_0x75ac('0x1b')]);_0x586402['userEmail']=_0x586402[_0x75ac('0x1b')];for(_0x27dc23=0x0;_0x27dc23<_0x1b1f49[_0x75ac('0xf')];_0x27dc23++){if(_0x1b1f49[_0x27dc23][_0x75ac('0x10')]===_0x586402[_0x75ac('0x1b')]){_0x4d909b=!![];_0x586402[_0x75ac('0x1d')]=_0x1b1f49[_0x27dc23]['id'];logger[_0x75ac('0xb')]('User\x20found:',_0x586402[_0x75ac('0x1d')]);}}}if(!_0x4d909b){logger[_0x75ac('0xb')](_0x75ac('0x1e'));_0x586402[_0x75ac('0x1f')]=_0x586402[_0x75ac('0x11')];_0x586402[_0x75ac('0x1d')]=_0x586402[_0x75ac('0x12')];_0x4d909b=!![];}if(_0x4d909b){_0x37a98a(_0x586402);}else{_0x348d9f({'statusCode':0x194,'message':_0x75ac('0x14')});}}else{_0x348d9f({'statusCode':0x194,'message':_0x75ac('0x14')});}})[_0x75ac('0x15')](function(_0x2a4885){logger['error']('['+[_0x3b0dbf[_0x75ac('0x17')]()]+']',_0x2a4885[_0x75ac('0x18')]);_0x348d9f(_0x2a4885);});});};}function searchContact(_0x118a52,_0x23555d,_0x5c41a3,_0xd43c96){return new Promise(function(_0x14b626,_0x3a9c28){var _0x3be8f4={'method':_0x75ac('0x9'),'headers':_0x23555d,'uri':_0x118a52+_0x75ac('0x20')+_0xd43c96+'&f='+_0x5c41a3+_0x75ac('0x21'),'json':!![]};rp(_0x3be8f4)['then'](function(_0x484308){var _0xe9daa5=_[_0x75ac('0x22')](_0x484308[_0x75ac('0x23')]['contacts'],[_0x5c41a3,_0xd43c96]);_0x14b626(_0xe9daa5);})[_0x75ac('0x15')](function(_0x319f7a){_0x3a9c28(_0x319f7a);});});}function getEndUser(_0x6b59c5,_0x20acf9,_0x1739da){return function(_0x4e5d28){return new Promise(function(_0x1d89ac,_0x39a381){logger[_0x75ac('0xb')](util[_0x75ac('0x24')](_0x75ac('0x25'),_0x4e5d28[_0x75ac('0x26')]));searchContact(_0x1739da,_0x20acf9,_0x75ac('0x27'),_0x4e5d28['contactNumber'])[_0x75ac('0xd')](function(_0x461b04){if(_0x461b04){_0x4e5d28[_0x75ac('0x28')]=_0x461b04['id'];logger[_0x75ac('0xb')](_0x75ac('0x29'),_0x4e5d28['endUserId']);return _0x1d89ac(_0x4e5d28);}searchContact(_0x1739da,_0x20acf9,_0x75ac('0x2a'),_0x4e5d28[_0x75ac('0x26')])[_0x75ac('0xd')](function(_0x22886a){if(_0x22886a){_0x4e5d28[_0x75ac('0x28')]=_0x22886a['id'];logger[_0x75ac('0xb')](_0x75ac('0x2b'),_0x4e5d28[_0x75ac('0x28')]);return _0x1d89ac(_0x4e5d28);}createEndUser(_0x4e5d28,_0x6b59c5,_0x20acf9,_0x1739da)['then'](function(_0x12ac34){logger[_0x75ac('0xb')](_0x75ac('0x2c'),_0x12ac34[_0x75ac('0x28')]);return _0x1d89ac(_0x12ac34);});});})['catch'](function(_0x385a3f){_0x39a381(_0x385a3f);});});};}function createEndUser(_0x28e75f,_0x23fcb6,_0x57e4e0,_0x28736d){return new Promise(function(_0x3dde6e,_0x2a59c8){var _0x5a548f=moment();var _0x546a98={'method':_0x75ac('0x2d'),'uri':_0x28736d+_0x75ac('0x2e'),'body':{'contact':{'last_name':_0x28e75f[_0x75ac('0x26')],'work_number':_0x28e75f[_0x75ac('0x26')],'mobile_number':_0x28e75f[_0x75ac('0x26')],'owner_id':_0x28e75f['userId'],'created_at':_0x5a548f[_0x75ac('0x24')](_0x75ac('0x2f'))}},'json':!![]};_0x546a98['headers']=_0x57e4e0;logger[_0x75ac('0xb')](_0x75ac('0x30'));return rp(_0x546a98)[_0x75ac('0xd')](function(_0x81aafd){_0x28e75f[_0x75ac('0x28')]=_0x81aafd['contact']['id'];_0x3dde6e(_0x28e75f);})[_0x75ac('0x15')](function(_0x30e51b){logger[_0x75ac('0x16')]('['+[_0x23fcb6['toUpperCase']()]+']',_0x30e51b[_0x75ac('0x18')]);_0x2a59c8(_0x30e51b['message']);});});}function getTicket(_0x560750,_0x3b2922,_0x1b4bde,_0x5b274d,_0x48a1fb){return function(_0x59999d){logger[_0x75ac('0xb')](_0x75ac('0x31'));return new Promise(function(_0x2f7115,_0x54f8f2){var _0x4e18b7=moment();var _0x293c74={'method':_0x75ac('0x2d'),'uri':_0x1b4bde+'/api/tasks','body':{'title':intUtil[_0x75ac('0x32')](_0x5b274d[_0x75ac('0x33')],_0x48a1fb,'\x20'),'description':intUtil['getString'](_0x5b274d[_0x75ac('0x34')],_0x48a1fb,'\x0a'),'owner_id':_0x59999d[_0x75ac('0x1d')],'creater_id':_0x59999d[_0x75ac('0x12')],'targetable_id':_0x59999d['endUserId'],'targetable_type':_0x75ac('0x35'),'created_at':_0x4e18b7[_0x75ac('0x24')](_0x75ac('0x2f')),'due_date':_0x4e18b7[_0x75ac('0x36')](0x1e,'m')[_0x75ac('0x24')](_0x75ac('0x2f'))},'json':!![]};_0x293c74[_0x75ac('0xa')]=_0x3b2922;return rp(_0x293c74)['then'](function(_0x49ac21){_0x59999d[_0x75ac('0x37')]=_0x49ac21[_0x75ac('0x38')]['id'];logger['info']('Task\x20created:',_0x59999d[_0x75ac('0x37')]);_0x2f7115(_0x59999d);})['catch'](function(_0x4c23c1){logger[_0x75ac('0x16')]('['+[_0x560750[_0x75ac('0x17')]()]+']',_0x4c23c1[_0x75ac('0x18')]);_0x54f8f2(_0x4c23c1[_0x75ac('0x18')]);});});};}function emit(_0x29f999,_0x14418c,_0x2ce815){var _0x4fb5c3={'uri':_0x29f999+_0x75ac('0x39')+_0x2ce815};io['to'](util[_0x75ac('0x24')](_0x75ac('0x3a'),_0x14418c))[_0x75ac('0x3b')]('trigger:browser:url',_0x4fb5c3);}exports['cs']=function(_0x286e16,_0x19ff6d,_0x30ba8b,_0x35aebd,_0x852cf,_0xae688d,_0x2661f8,_0x4f4932){var _0x42dff0={};var _0x2e6078={'Authorization':'Token\x20token='+_0xae688d[_0x75ac('0x3c')]};_0xae688d[_0x75ac('0x3d')]=intUtil[_0x75ac('0x3e')](_0xae688d[_0x75ac('0x3d')]);_0xae688d[_0x75ac('0x3f')]=intUtil[_0x75ac('0x3e')](_0xae688d['serverUrl']);var _0x554ad5=_0xae688d[_0x75ac('0x3d')];_0x42dff0[_0x75ac('0x11')]=_0xae688d[_0x75ac('0x40')];_0x42dff0[_0x75ac('0x26')]=_0x4f4932[_0x75ac('0x41')]()==='outbound'?_0x19ff6d[_0x75ac('0x42')]:_0x19ff6d[_0x75ac('0x43')];_0x42dff0[_0x75ac('0x44')]=_0x4f4932==='queue'||_0x4f4932==='unmanaged'?_0x75ac('0x45'):'outbound';if(_0x35aebd){_0x42dff0['agentEmail']=_0x35aebd[_0x75ac('0x10')];}var _0x4cffdf=util[_0x75ac('0x24')](_0x75ac('0x46'),_0xae688d[_0x75ac('0x3f')],_0x19ff6d[_0x75ac('0x47')],md5(_0x19ff6d['uniqueid']));if(_0x852cf&&_0x852cf[_0x75ac('0x48')]){logger['info']('[QUEUE]',_0x75ac('0x49'));_0x19ff6d[_0x75ac('0x4a')]=_0x4cffdf;}else if(_0x2661f8&&_0x2661f8['recordingFormat']&&_0x2661f8[_0x75ac('0x4b')]!==_0x75ac('0x4c')){logger[_0x75ac('0xb')](_0x75ac('0x4d'),_0x75ac('0x49'));_0x19ff6d[_0x75ac('0x4a')]=_0x4cffdf;}else{_0x19ff6d['recordingURL']='';}return getAdminId(_0x42dff0,_0x4f4932,_0x2e6078,_0x554ad5)[_0x75ac('0xd')](getUser(_0x4f4932,_0x2e6078,_0x554ad5))['then'](getEndUser(_0x4f4932,_0x2e6078,_0x554ad5))[_0x75ac('0xd')](getTicket(_0x4f4932,_0x2e6078,_0x554ad5,_0x30ba8b,_0x19ff6d))[_0x75ac('0xd')](function(_0x395b84){logger[_0x75ac('0xb')](util[_0x75ac('0x24')](_0x75ac('0x4e'),_0x395b84['ticketId']));if(_0x4f4932!==_0x75ac('0x4f')){logger[_0x75ac('0xb')]('['+[_0x4f4932[_0x75ac('0x17')]()]+']',_0x75ac('0x50'));emit(_0x554ad5,_0x35aebd[_0x75ac('0x51')],_0x395b84[_0x75ac('0x28')]);}})[_0x75ac('0x15')](function(_0x27dc54){logger[_0x75ac('0x16')]('['+[_0x4f4932[_0x75ac('0x17')]()]+_0x75ac('0x52'),util[_0x75ac('0x53')](_0x27dc54,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index e81db86..e83aba5 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 _0x2e4a=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./desk','./vtiger'];(function(_0x19b963,_0x42ef6c){var _0x116579=function(_0x533007){while(--_0x533007){_0x19b963['push'](_0x19b963['shift']());}};_0x116579(++_0x42ef6c);}(_0x2e4a,0x66));var _0xa2e4=function(_0x59adac,_0x161529){_0x59adac=_0x59adac-0x0;var _0x3823b7=_0x2e4a[_0x59adac];return _0x3823b7;};'use strict';var _=require(_0xa2e4('0x0'));var util=require(_0xa2e4('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xa2e4('0x2'));var sugarcrm=require(_0xa2e4('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xa2e4('0x4'));var vtiger=require(_0xa2e4('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xa2e4('0x6'));var freshsales=require(_0xa2e4('0x7'));var integrations=[_0xa2e4('0x8'),_0xa2e4('0x9'),_0xa2e4('0xa'),'freshdesk',_0xa2e4('0xb'),'desk',_0xa2e4('0xc'),_0xa2e4('0xd'),_0xa2e4('0xe'),_0xa2e4('0xf')];exports[_0xa2e4('0x10')]=function(_0x15a024,_0x373ccf,_0x3afa6a,_0x983b29,_0x435cc8,_0xf6ba5e){if(_0x3afa6a){if(_[_0xa2e4('0x11')](integrations,_0x15a024[_0xa2e4('0x12')][_0xa2e4('0x13')]())){try{var _0x2a7386=null;var _0x4dc4ad='';var _0x74b174=_0x3afa6a[_0x15a024[_0xa2e4('0x12')][_0xa2e4('0x13')]()];if(_0x74b174){var _0xe75355=_0x74b174[_0x15a024[_0xa2e4('0x14')]];if(_0xe75355){var _0x28c039=_[_0xa2e4('0x15')](_0xe75355['Configurations'],{'id':parseInt(_0x15a024[_0xa2e4('0x16')],0xa)});if(_0x28c039){if(_0x983b29){if(_0x435cc8&&_0x373ccf[_0xa2e4('0x17')]){_0x4dc4ad=_0xa2e4('0x17');}else if(_0x373ccf[_0xa2e4('0x18')]){_0x4dc4ad=_0xa2e4('0x19');}else{console[_0xa2e4('0x1a')](_0xa2e4('0x1b'),_0x373ccf);}}else{_0x4dc4ad='unmanaged';}switch(_0x15a024[_0xa2e4('0x12')]['toLowerCase']()){case _0xa2e4('0x8'):zendesk[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case _0xa2e4('0x9'):salesforce[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case'sugarcrm':sugarcrm[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case _0xa2e4('0x1c'):freshdesk[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case'zoho':zoho[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case'desk':desk[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case'vtiger':vtiger[_0x4dc4ad](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e);break;case _0xa2e4('0xe'):freshsales['cs'](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e,_0x4dc4ad);break;case _0xa2e4('0xf'):servicenow['cs'](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e,_0x4dc4ad);break;case _0xa2e4('0xd'):dynamics365['cs'](_0x15a024,_0x373ccf,_0x28c039,_0x983b29,_0x435cc8,_0xe75355,_0xf6ba5e,_0x4dc4ad);break;default:console[_0xa2e4('0x1a')](_0xa2e4('0x1d'));}}else{_0x2a7386=require(_0xa2e4('0x1e'))(_0x15a024[_0xa2e4('0x12')]['toLowerCase']());_0x2a7386[_0xa2e4('0x1f')](_0xa2e4('0x20'),util[_0xa2e4('0x21')](_0xa2e4('0x22'),_0x15a024['data1']['toLowerCase'](),_0x15a024['data3']));}}else{_0x2a7386=require('../../../../config/logger')(_0x15a024[_0xa2e4('0x12')][_0xa2e4('0x13')]());_0x2a7386['error']('[EXEC]',util[_0xa2e4('0x21')](_0xa2e4('0x23'),_0x15a024[_0xa2e4('0x12')]['toLowerCase'](),_0x15a024['data2']));}}else{}}catch(_0x184c22){console[_0xa2e4('0x1f')](_0x184c22);}}}}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 77d0c33..110b5de 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 _0x2c2d=['customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','lead','WhoId','endUserType','account','WhatId','Case','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','account_contact_lead','additionalSearchAccount','Lead','Account','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','forEach','includes','string','picklist','idField','toString','variable','variableName'];(function(_0x4a3554,_0x14f2fd){var _0x12e4cb=function(_0x30dedc){while(--_0x30dedc){_0x4a3554['push'](_0x4a3554['shift']());}};_0x12e4cb(++_0x14f2fd);}(_0x2c2d,0xb5));var _0xd2c2=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x2c2d[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0xd2c2('0x0'));var rp=require(_0xd2c2('0x1'));var moment=require(_0xd2c2('0x2'));var BPromise=require(_0xd2c2('0x3'));var md5=require(_0xd2c2('0x4'));var jsforce=require('jsforce');var util=require(_0xd2c2('0x5'));var Redis=require(_0xd2c2('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd2c2('0x7'))(_0xd2c2('0x8'));config[_0xd2c2('0x9')]=_[_0xd2c2('0xa')](config['redis'],{'host':_0xd2c2('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4d57ce,_0x14bef3,_0x205cd1){io['to'](_0x4d57ce)[_0xd2c2('0xc')](_0x14bef3,_0x205cd1);}function getTicket(_0xcbafed,_0x54fb33,_0x15bedf,_0x5e9307,_0x59d30d,_0x289237,_0x3c7f1c,_0x1e2738){var _0x10be31=Object[_0xd2c2('0xd')]({},{'OwnerId':_0x54fb33['id'],'Subject':intUtil['getString'](_0x5e9307[_0xd2c2('0xe')],_0x59d30d,'\x20'),'Description':intUtil['getString'](_0x5e9307[_0xd2c2('0xf')],_0x59d30d,'\x0a')},getCustomFields(_0x289237,_0x59d30d));if(_0x15bedf){if(_0x5e9307[_0xd2c2('0x10')]==='Task'){_0x10be31[_0xd2c2('0x11')]=moment[_0xd2c2('0x12')]();_0x10be31[_0xd2c2('0x13')]=![];_0x10be31[_0xd2c2('0x14')]=![];if(_0x15bedf['endUserType']===_0xd2c2('0x15')||_0x15bedf['endUserType']===_0xd2c2('0x16')){_0x10be31[_0xd2c2('0x17')]=_0x15bedf['id'];}else if(_0x15bedf[_0xd2c2('0x18')]===_0xd2c2('0x19')){_0x10be31[_0xd2c2('0x1a')]=_0x15bedf['id'];}}else if(_0x5e9307['ticketType']===_0xd2c2('0x1b')){if(_0x15bedf[_0xd2c2('0x18')]==='contact'){_0x10be31['ContactId']=_0x15bedf['id'];}else if(_0x15bedf[_0xd2c2('0x18')]===_0xd2c2('0x19')){_0x10be31['AccountId']=_0x15bedf['id'];}else if(_0x15bedf[_0xd2c2('0x18')]==='lead'&&_0x5e9307['leadId']){_0x10be31[_0x5e9307['leadId']]=_0x15bedf['id'];}else{logger['info'](_0xd2c2('0x1c'));}}}return _0x3c7f1c[_0xd2c2('0x1d')](_0x5e9307[_0xd2c2('0x10')])['create'](_0x10be31);}function getUser(_0x5f51dd,_0x33258b,_0x295f7b){if(!_[_0xd2c2('0x1e')](_0x33258b)&&intUtil[_0xd2c2('0x1f')](_0x33258b)){var _0x52fe13={'Email':_0x33258b};var _0x598cbf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x295f7b[_0xd2c2('0x1d')](_0xd2c2('0x20'))[_0xd2c2('0x21')](_0x52fe13,_0x598cbf)[_0xd2c2('0x22')]()[_0xd2c2('0x23')](function(_0x1e87c8){if(_0x1e87c8[_0xd2c2('0x24')]){var _0x4613c0=_['find'](_0x1e87c8,function(_0x2a1f34){return _0x2a1f34[_0xd2c2('0x25')]===_0x33258b;});if(_0x4613c0){logger['info'](_0xd2c2('0x26'),_0x33258b);return BPromise[_0xd2c2('0x27')]({'id':_0x4613c0['Id'],'name':_0x4613c0[_0xd2c2('0x28')]});}}else{logger[_0xd2c2('0x29')](_0xd2c2('0x2a'),_0x33258b);return _0x295f7b[_0xd2c2('0x2b')]()[_0xd2c2('0x23')](function(_0x257f0b){return BPromise[_0xd2c2('0x27')]({'id':_0x257f0b['user_id'],'name':_0x257f0b['display_name']});});}});}else{logger[_0xd2c2('0x29')](_0xd2c2('0x2a'),_0x33258b);return _0x295f7b['identity']()[_0xd2c2('0x23')](function(_0x3100ca){return BPromise[_0xd2c2('0x27')]({'id':_0x3100ca[_0xd2c2('0x2c')],'name':_0x3100ca[_0xd2c2('0x2d')]});});}}function getEndUser(_0x38d7fd,_0x24ff20,_0x24a6f3,_0x1f326b,_0xc30039){var _0x5d57a1={'$or':{'Phone':_0x1f326b}};var _0x567a27={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd2c2('0x27')]()['then'](function(){logger[_0xd2c2('0x29')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x1f326b,_0x24ff20['moduleSearch']);switch(_0x24ff20[_0xd2c2('0x2e')]){case _0xd2c2('0x2f'):var _0x362f26=_['cloneDeep'](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x30')]){var _0x1a118d={};_0x1a118d[_0x24ff20[_0xd2c2('0x30')]]=_0x1f326b;_[_0xd2c2('0x31')](_0x362f26['$or'],_0x1a118d);}return _0xc30039[_0xd2c2('0x1d')](_0xd2c2('0x32'))[_0xd2c2('0x21')](_0x362f26,_0x567a27)[_0xd2c2('0x22')]()[_0xd2c2('0x23')](function(_0x1640d7){if(_0x1640d7&&_0x1640d7[_0xd2c2('0x24')]){return _0x1640d7;}else{var _0x18ea09=_[_0xd2c2('0x33')](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x34')]){var _0xabc382={};_0xabc382[_0x24ff20[_0xd2c2('0x34')]]=_0x1f326b;_[_0xd2c2('0x31')](_0x18ea09[_0xd2c2('0x35')],_0xabc382);}return _0xc30039[_0xd2c2('0x1d')]('Lead')[_0xd2c2('0x21')](_0x18ea09,_0x567a27);}});case _0xd2c2('0x36'):var _0x42e98e=_[_0xd2c2('0x33')](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x37')]){var _0x1a118d={};_0x1a118d[_0x24ff20[_0xd2c2('0x37')]]=_0x1f326b;_[_0xd2c2('0x31')](_0x42e98e[_0xd2c2('0x35')],_0x1a118d);}return _0xc30039['sobject']('Account')[_0xd2c2('0x21')](_0x42e98e,_0x567a27)[_0xd2c2('0x22')]()[_0xd2c2('0x23')](function(_0x41baad){if(_0x41baad&&_0x41baad['length']){return _0x41baad;}else{var _0x2a2571=_[_0xd2c2('0x33')](_0x5d57a1);if(_0x24ff20['additionalSearchContact']){var _0x46195b={};_0x46195b[_0x24ff20['additionalSearchContact']]=_0x1f326b;_[_0xd2c2('0x31')](_0x2a2571[_0xd2c2('0x35')],_0x46195b);}return _0xc30039['sobject'](_0xd2c2('0x32'))[_0xd2c2('0x21')](_0x2a2571,_0x567a27)['then'](function(_0x31dde6){if(_0x31dde6&&_0x31dde6[_0xd2c2('0x24')]){return _0x31dde6;}else{var _0x244937=_['cloneDeep'](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x34')]){var _0x378c1e={};_0x378c1e[_0x24ff20['additionalSearchLead']]=_0x1f326b;_['merge'](_0x244937[_0xd2c2('0x35')],_0x378c1e);}return _0xc30039['sobject'](_0xd2c2('0x38'))[_0xd2c2('0x21')](_0x244937,_0x567a27);}});}});case _0xd2c2('0x15'):var _0x362f26=_[_0xd2c2('0x33')](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x30')]){var _0x1a118d={};_0x1a118d[_0x24ff20[_0xd2c2('0x30')]]=_0x1f326b;_[_0xd2c2('0x31')](_0x362f26[_0xd2c2('0x35')],_0x1a118d);}return _0xc30039[_0xd2c2('0x1d')](_0xd2c2('0x32'))[_0xd2c2('0x21')](_0x362f26,_0x567a27)[_0xd2c2('0x22')]();case _0xd2c2('0x16'):var _0x297bad=_[_0xd2c2('0x33')](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x34')]){var _0x1a118d={};_0x1a118d[_0x24ff20[_0xd2c2('0x34')]]=_0x1f326b;_['merge'](_0x297bad[_0xd2c2('0x35')],_0x1a118d);}return _0xc30039[_0xd2c2('0x1d')](_0xd2c2('0x38'))[_0xd2c2('0x21')](_0x297bad,_0x567a27);case _0xd2c2('0x19'):var _0x42e98e=_['cloneDeep'](_0x5d57a1);if(_0x24ff20[_0xd2c2('0x37')]){var _0x1a118d={};_0x1a118d[_0x24ff20[_0xd2c2('0x37')]]=_0x1f326b;_['merge'](_0x42e98e[_0xd2c2('0x35')],_0x1a118d);}return _0xc30039[_0xd2c2('0x1d')](_0xd2c2('0x39'))[_0xd2c2('0x21')](_0x42e98e,_0x567a27);default:return null;}})[_0xd2c2('0x23')](function(_0x298bf4){if(_0x298bf4&&_0x298bf4[_0xd2c2('0x24')]){var _0x25547c=_['first'](_0x298bf4);if(_0x25547c){return BPromise[_0xd2c2('0x27')]({'id':_0x25547c['Id'],'name':_0x25547c['Name'],'phone':_0x25547c[_0xd2c2('0x3a')],'endUserType':_0x25547c[_0xd2c2('0x3b')][_0xd2c2('0x3c')][_0xd2c2('0x3d')]()});}}})[_0xd2c2('0x23')](function(_0x3b2e6e){if(_0x3b2e6e){logger[_0xd2c2('0x29')](_0xd2c2('0x3e'),_0x3b2e6e[_0xd2c2('0x18')],_0x1f326b);return BPromise[_0xd2c2('0x27')](_0x3b2e6e);}else{logger[_0xd2c2('0x29')](_0xd2c2('0x3f'),_0x1f326b);var _0x505414={'Phone':_0x1f326b};if(_0x24ff20[_0xd2c2('0x40')]){if(_0x24ff20[_0xd2c2('0x40')]===_0xd2c2('0x15')){logger[_0xd2c2('0x29')](_0xd2c2('0x41'),_0x1f326b,_0x24ff20[_0xd2c2('0x40')]);_0x505414[_0xd2c2('0x42')]=_0x24a6f3!==_0xd2c2('0x43')?_0x24a6f3:util[_0xd2c2('0x44')](_0xd2c2('0x45'),_0x1f326b);}else if(_0x24ff20[_0xd2c2('0x40')]===_0xd2c2('0x16')){logger[_0xd2c2('0x29')](_0xd2c2('0x41'),_0x1f326b,_0x24ff20[_0xd2c2('0x40')]);_0x505414['LastName']=_0x24a6f3!==_0xd2c2('0x43')?_0x24a6f3:util[_0xd2c2('0x44')](_0xd2c2('0x45'),_0x1f326b);_0x505414['Company']='No\x20Company';}else if(_0x24ff20[_0xd2c2('0x40')]===_0xd2c2('0x19')){logger[_0xd2c2('0x29')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f326b,_0x24ff20[_0xd2c2('0x40')]);_0x505414['Name']=_0x24a6f3!==''?_0x24a6f3:util[_0xd2c2('0x44')](_0xd2c2('0x45'),_0x1f326b);}else{return null;}}return _0xc30039[_0xd2c2('0x1d')](_[_0xd2c2('0x46')](_0x24ff20[_0xd2c2('0x40')]))['create'](_0x505414)[_0xd2c2('0x23')](function(_0x8fb759){return BPromise['resolve']({'id':_0x8fb759['id'],'endUserType':_0x24ff20['moduleCreate']});});}});}function getCustomFields(_0x5aa7d0,_0x5aa1b9){var _0x5d029e={};if(_0x5aa7d0[_0xd2c2('0x24')]>0x0){_[_0xd2c2('0x47')](_0x5aa7d0,function(_0x29d662){if(_[_0xd2c2('0x48')]([_0xd2c2('0x49'),_0xd2c2('0x4a')],_0x29d662[_0xd2c2('0x3c')])&&_0x29d662[_0xd2c2('0x4b')]){_0x5d029e[_0x29d662[_0xd2c2('0x4b')]]=_0x29d662['content'][_0xd2c2('0x4c')]();}else if(_0x29d662[_0xd2c2('0x3c')]===_0xd2c2('0x4d')&&_0x29d662[_0xd2c2('0x4e')]&&_0x29d662[_0xd2c2('0x4b')]){_0x5aa1b9[_0x29d662[_0xd2c2('0x4e')]]&&(_0x5d029e[_0x29d662['idField']]=_0x5aa1b9[_0x29d662[_0xd2c2('0x4e')]][_0xd2c2('0x4c')]());}else if(_0x29d662['type']===_0xd2c2('0x4f')&&_0x29d662[_0xd2c2('0x50')]&&_0x29d662[_0xd2c2('0x50')][_0xd2c2('0x51')]&&_0x29d662[_0xd2c2('0x4b')]){_0x5aa1b9[_0x29d662[_0xd2c2('0x50')][_0xd2c2('0x51')]['toLowerCase']()]&&(_0x5d029e[_0x29d662[_0xd2c2('0x4b')]]=_0x5aa1b9[_0x29d662[_0xd2c2('0x50')][_0xd2c2('0x51')]['toLowerCase']()][_0xd2c2('0x4c')]());}});}return _0x5d029e;}function getConnection(_0x41b63d){var _0x33ebbb=_0x41b63d[_0xd2c2('0x52')][_0xd2c2('0x53')](_0x41b63d[_0xd2c2('0x54')]);var _0xd38e33=new jsforce[(_0xd2c2('0x55'))]({'oauth2':{'loginUrl':_0x41b63d[_0xd2c2('0x56')]||_0xd2c2('0x57'),'clientId':_0x41b63d[_0xd2c2('0x58')],'clientSecret':_0x41b63d[_0xd2c2('0x59')]}});return _0xd38e33[_0xd2c2('0x5a')](_0x41b63d[_0xd2c2('0x5b')],_0x33ebbb)['then'](function(){logger[_0xd2c2('0x29')](_0xd2c2('0x5c'));return _0xd38e33;});}exports[_0xd2c2('0x5d')]=function(_0x44441c,_0x554bb8,_0x20384e,_0x58440f,_0x51dc31,_0x52dd4a){var _0x40f904,_0x5754a8,_0x489d92,_0xa2b29b;_0x52dd4a[_0xd2c2('0x5e')]=intUtil['stripTrailingSlash'](_0x52dd4a[_0xd2c2('0x5e')]);_0x52dd4a[_0xd2c2('0x56')]=intUtil['stripTrailingSlash'](_0x52dd4a[_0xd2c2('0x56')]);if(_0x51dc31&&_0x51dc31[_0xd2c2('0x5f')]){logger['info'](_0xd2c2('0x60'),_0xd2c2('0x61'));_0x554bb8[_0xd2c2('0x62')]=util[_0xd2c2('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52dd4a['serverUrl'],_0x554bb8['uniqueid'],md5(_0x554bb8[_0xd2c2('0x63')]));}else{_0x554bb8[_0xd2c2('0x62')]='';}return getConnection(_0x52dd4a)[_0xd2c2('0x23')](function(_0x8c8b9){_0xa2b29b=_0x8c8b9;return getUser(_0x52dd4a,_0x58440f[_0xd2c2('0x64')],_0xa2b29b);})[_0xd2c2('0x23')](function(_0x1d08ae){_0x40f904=_0x1d08ae;return getEndUser(_0x52dd4a,_0x20384e,_0x554bb8[_0xd2c2('0x65')],_0x554bb8[_0xd2c2('0x66')],_0xa2b29b);})[_0xd2c2('0x23')](function(_0x230f95){_0x5754a8=_0x230f95;return getTicket(_0x52dd4a,_0x40f904,_0x5754a8,_0x20384e,_0x554bb8,_0x20384e[_0xd2c2('0x67')],_0xa2b29b,_0xd2c2('0x5d'));})[_0xd2c2('0x23')](function(_0x210978){_0x489d92=_0x210978;logger['info'](_0xd2c2('0x68'),_0x489d92['id']);logger[_0xd2c2('0x29')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x489d92['id'],_0x58440f[_0xd2c2('0x51')],_0x52dd4a[_0xd2c2('0x3c')]);switch(_0x52dd4a[_0xd2c2('0x3c')]){case _0xd2c2('0x69'):emit(util[_0xd2c2('0x44')](_0xd2c2('0x6a'),_0x58440f[_0xd2c2('0x51')]),_0xd2c2('0x6b'),{'recordId':_0x489d92['id']});break;case _0xd2c2('0x6c'):emit(util[_0xd2c2('0x44')]('user:%s',_0x58440f[_0xd2c2('0x51')]),_0xd2c2('0x6d'),{'uri':util[_0xd2c2('0x44')]('%s/%s/e',_0xa2b29b[_0xd2c2('0x6e')],_0x489d92['id'])});break;default:logger[_0xd2c2('0x6f')](_0xd2c2('0x70'));}})[_0xd2c2('0x71')](function(_0x4f3a2e){logger[_0xd2c2('0x6f')](_0xd2c2('0x60'),_0x4f3a2e);});};exports[_0xd2c2('0x72')]=function(_0x1f2ed8,_0x16fd8a,_0x327107,_0x2cee33,_0xa498de,_0x489661,_0x6d81dd){var _0x2bc837,_0x28a60f,_0x5158e0,_0x118006;_0x489661[_0xd2c2('0x5e')]=intUtil[_0xd2c2('0x73')](_0x489661[_0xd2c2('0x5e')]);_0x489661[_0xd2c2('0x56')]=intUtil['stripTrailingSlash'](_0x489661[_0xd2c2('0x56')]);if(_0x6d81dd&&_0x6d81dd[_0xd2c2('0x74')]&&_0x6d81dd['recordingFormat']!==_0xd2c2('0x75')){logger[_0xd2c2('0x29')](_0xd2c2('0x76'),'Recording\x20is\x20enabled!');_0x16fd8a[_0xd2c2('0x62')]=util[_0xd2c2('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x489661[_0xd2c2('0x5e')],_0x16fd8a['uniqueid'],md5(_0x16fd8a['uniqueid']));}return getConnection(_0x489661)[_0xd2c2('0x23')](function(_0xdd4cd9){_0x118006=_0xdd4cd9;return getUser(_0x489661,_0x2cee33[_0xd2c2('0x64')],_0x118006);})['then'](function(_0x4c8cd8){_0x2bc837=_0x4c8cd8;return getEndUser(_0x489661,_0x327107,_0x16fd8a[_0xd2c2('0x77')],_0x16fd8a[_0xd2c2('0x78')],_0x118006);})['then'](function(_0x1b7fe0){_0x28a60f=_0x1b7fe0;return getTicket(_0x489661,_0x2bc837,_0x28a60f,_0x327107,_0x16fd8a,_0x327107[_0xd2c2('0x67')],_0x118006,_0xd2c2('0x72'));})[_0xd2c2('0x23')](function(_0x4b3e39){_0x5158e0=_0x4b3e39;logger['info'](_0xd2c2('0x79'),_0x5158e0['id']);logger['info'](_0xd2c2('0x7a'),_0x5158e0['id'],_0x2cee33[_0xd2c2('0x51')],_0x489661[_0xd2c2('0x3c')]);switch(_0x489661[_0xd2c2('0x3c')]){case'integrationTab':emit(util['format'](_0xd2c2('0x6a'),_0x2cee33['name']),'trigger:salesforce:display',{'recordId':_0x5158e0['id']});break;case _0xd2c2('0x6c'):emit(util['format'](_0xd2c2('0x6a'),_0x2cee33[_0xd2c2('0x51')]),'trigger:browser:url',{'uri':util[_0xd2c2('0x44')](_0xd2c2('0x7b'),_0x118006[_0xd2c2('0x6e')],_0x5158e0['id'])});break;default:logger[_0xd2c2('0x6f')](_0xd2c2('0x76'),_0xd2c2('0x7c'));}})[_0xd2c2('0x71')](function(_0x5ed2bd){logger[_0xd2c2('0x6f')](_0xd2c2('0x76'),_0x5ed2bd);});};exports[_0xd2c2('0x7d')]=function(_0x16f6be,_0x38d681,_0x3ee9a1,_0xe4d455,_0x26a0e7,_0x452b18){var _0x559119,_0x1a653d,_0x46f9c5,_0x257faa;_0x452b18['serverUrl']=intUtil[_0xd2c2('0x73')](_0x452b18[_0xd2c2('0x5e')]);_0x452b18['remoteUri']=intUtil[_0xd2c2('0x73')](_0x452b18[_0xd2c2('0x56')]);if(_0x26a0e7&&_0x26a0e7[_0xd2c2('0x5f')]){logger['info']('['+_0x38d681[_0xd2c2('0x7e')][_0xd2c2('0x7f')]()+']',_0xd2c2('0x61'));_0x38d681[_0xd2c2('0x62')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x452b18['serverUrl'],_0x38d681[_0xd2c2('0x63')],md5(_0x38d681[_0xd2c2('0x63')]));}else{_0x38d681[_0xd2c2('0x62')]='';}return getConnection(_0x452b18)[_0xd2c2('0x23')](function(_0x417739){_0x257faa=_0x417739;if(!_['isNil'](_0xe4d455)){return getUser(_0x452b18,_0xe4d455[_0xd2c2('0x51')],_0x257faa);}else{return getUser(_0x452b18,null,_0x257faa);}})[_0xd2c2('0x23')](function(_0x294d2a){_0x559119=_0x294d2a;return getEndUser(_0x452b18,_0x3ee9a1,_0x38d681[_0xd2c2('0x65')],_0x38d681[_0xd2c2('0x66')],_0x257faa);})[_0xd2c2('0x23')](function(_0x357b21){_0x1a653d=_0x357b21;return getTicket(_0x452b18,_0x559119,_0x1a653d,_0x3ee9a1,_0x38d681,_0x3ee9a1[_0xd2c2('0x67')],_0x257faa);})[_0xd2c2('0x23')](function(_0x202252){_0x46f9c5=_0x202252;logger[_0xd2c2('0x29')]('['+_0x38d681[_0xd2c2('0x7e')][_0xd2c2('0x7f')]()+_0xd2c2('0x80'),_0x46f9c5['id']);logger['info']('['+_0x38d681[_0xd2c2('0x7e')][_0xd2c2('0x7f')]()+_0xd2c2('0x81'),_0x452b18['type']);})[_0xd2c2('0x71')](function(_0x2ecc26){logger[_0xd2c2('0x6f')]('['+_0x38d681[_0xd2c2('0x7e')]['toUpperCase']()+']',_0x2ecc26);});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index c019bf6..94bf290 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 _0x27b3=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toLowerCase','content','toString','includes','idField','customField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','POST','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','incident','Incident','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','callDirection','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x27b3,0xc8));var _0x327b=function(_0x4a32f6,_0x4ffe72){_0x4a32f6=_0x4a32f6-0x0;var _0x250f63=_0x27b3[_0x4a32f6];return _0x250f63;};'use strict';var _=require('lodash');var Promise=require(_0x327b('0x0'));var rp=require(_0x327b('0x1'));var util=require(_0x327b('0x2'));var md5=require(_0x327b('0x3'));var Redis=require(_0x327b('0x4'));var intUtil=require(_0x327b('0x5'));var config=require(_0x327b('0x6'));var logger=require(_0x327b('0x7'))(_0x327b('0x8'));config[_0x327b('0x9')]=_[_0x327b('0xa')](config[_0x327b('0x9')],{'host':_0x327b('0xb'),'port':0x18eb});var io=require(_0x327b('0xc'))(new Redis(config['redis']));function getAdminUser(_0x53e5bf,_0x27202a,_0x3b007f,_0x9c1855,_0x4b13e8,_0x4d3547){return new Promise(function(_0x4f521a,_0x2047a8){var _0x524e4c={'method':_0x327b('0xd'),'uri':_0x9c1855+_0x327b('0xe')+'&'+_0x4b13e8+'&'+_0x4d3547,'auth':_0x27202a,'json':!![]};return rp(_0x524e4c)['then'](function(_0x2d11b6){if(_0x2d11b6[_0x327b('0xf')][_0x327b('0x10')]>0x0){_0x3b007f[_0x327b('0x11')]=_0x2d11b6[_0x327b('0xf')][0x0]['sys_id'];}logger[_0x327b('0x12')]('['+[_0x53e5bf[_0x327b('0x13')]()]+'],\x20getAdminUser\x20crm',_0x3b007f);_0x4f521a(_0x3b007f);})[_0x327b('0x14')](function(_0x1d523f){logger[_0x327b('0x15')]('['+[_0x53e5bf[_0x327b('0x13')]()]+']',_0x1d523f['message']);_0x2047a8(_0x1d523f[_0x327b('0x16')]);});});}function getUser(_0x1b3425,_0x554c06,_0xce5253,_0x2d3eff,_0x26bf2a){return function(_0x56f568){logger[_0x327b('0x12')]('['+[_0x1b3425['toUpperCase']()]+_0x327b('0x17'),_0x56f568);return new Promise(function(_0x25e0d6,_0x4d2b37){if(intUtil[_0x327b('0x18')](_0x56f568[_0x327b('0x19')])){var _0x4c3fd7={'method':_0x327b('0xd'),'uri':_0xce5253+_0x327b('0x1a')+_0x56f568[_0x327b('0x19')]+'&'+_0x2d3eff+'&'+_0x26bf2a,'auth':_0x554c06,'json':!![]};logger[_0x327b('0x12')]('['+[_0x1b3425['toUpperCase']()]+_0x327b('0x1b'),_0x4c3fd7);return rp(_0x4c3fd7)[_0x327b('0x1c')](function(_0x283f84){logger['info']('['+[_0x1b3425[_0x327b('0x13')]()]+_0x327b('0x1d'),_0x283f84);if(_0x283f84['result'][_0x327b('0x10')]>0x0&&String(_0x283f84['result'][0x0][_0x327b('0x1e')])===_0x327b('0x1f')){_0x56f568[_0x327b('0x20')]=_0x283f84[_0x327b('0xf')][0x0][_0x327b('0x21')];}else{_0x56f568['userId']=_0x56f568[_0x327b('0x11')];_0x56f568[_0x327b('0x19')]=_0x56f568['adminEmail'];}logger['info']('['+[_0x1b3425['toUpperCase']()]+_0x327b('0x22'),_0x56f568);_0x25e0d6(_0x56f568);})['catch'](function(_0x5b66b8){logger[_0x327b('0x15')]('['+[_0x1b3425[_0x327b('0x13')]()]+']',_0x5b66b8[_0x327b('0x16')]);_0x4d2b37(_0x5b66b8[_0x327b('0x16')]);});}else{logger['info']('['+[_0x1b3425[_0x327b('0x13')]()]+_0x327b('0x23'));_0x56f568[_0x327b('0x20')]=_0x56f568[_0x327b('0x11')];_0x56f568[_0x327b('0x19')]=_0x56f568['adminEmail'];_0x25e0d6(_0x56f568);}});};}function createEndUser(_0x40d477,_0x29c733,_0x4a19bf,_0x2db2f5,_0x460c83){logger[_0x327b('0x12')]('['+[_0x40d477[_0x327b('0x13')]()]+_0x327b('0x24'),_0x4a19bf);return new Promise(function(_0x3a9c56,_0x33e36f){var _0x1498aa={'method':'POST','uri':_0x2db2f5+_0x327b('0x25')+_0x460c83,'body':{'user_name':_0x4a19bf[_0x327b('0x26')],'roles':'user','first_name':_0x4a19bf[_0x327b('0x26')],'active':_0x327b('0x1f'),'date_format':'System','phone':_0x4a19bf['endUserNumber']},'auth':_0x29c733,'json':!![]};return rp(_0x1498aa)[_0x327b('0x1c')](function(_0x39394f){logger[_0x327b('0x12')]('['+[_0x40d477[_0x327b('0x13')]()]+_0x327b('0x27'),_0x39394f[_0x327b('0xf')]);_0x4a19bf[_0x327b('0x28')]=_0x39394f[_0x327b('0xf')][_0x327b('0x21')];_0x3a9c56(_0x4a19bf);})[_0x327b('0x14')](function(_0x3fd6e7){logger[_0x327b('0x15')]('['+[_0x40d477[_0x327b('0x13')]()]+']',_0x3fd6e7[_0x327b('0x16')]);_0x33e36f(_0x3fd6e7[_0x327b('0x16')]);});});}function getEndUser(_0x4c5567,_0x4dcc31,_0x260006,_0x3f6a86,_0x470f59){return function(_0x3fb23b){logger[_0x327b('0x12')]('['+[_0x4c5567[_0x327b('0x13')]()]+_0x327b('0x29'),_0x3fb23b);return new Promise(function(_0x10cf66,_0x26d33a){var _0x304ebe={'method':'GET','uri':_0x260006+_0x327b('0x2a')+_0x3fb23b['endUserNumber']+'&'+_0x3f6a86+'&'+_0x470f59,'auth':_0x4dcc31,'json':!![]};return rp(_0x304ebe)[_0x327b('0x1c')](function(_0x2fe23f){if(_0x2fe23f[_0x327b('0xf')][_0x327b('0x10')]>0x0){_0x3fb23b['endUserId']=_0x2fe23f[_0x327b('0xf')][0x0][_0x327b('0x21')];logger[_0x327b('0x12')]('['+[_0x4c5567['toUpperCase']()]+_0x327b('0x2b'),_0x3fb23b);_0x10cf66(_0x3fb23b);}else{return createEndUser(_0x4c5567,_0x4dcc31,_0x3fb23b,_0x260006,_0x3f6a86)[_0x327b('0x1c')](function(_0x333e5f){logger[_0x327b('0x12')]('['+[_0x4c5567[_0x327b('0x13')]()]+_0x327b('0x2c'),_0x333e5f);_0x10cf66(_0x333e5f);});}})[_0x327b('0x14')](function(_0x155646){logger[_0x327b('0x15')]('['+[_0x4c5567[_0x327b('0x13')]()]+']',_0x155646[_0x327b('0x16')]);_0x26d33a(_0x155646[_0x327b('0x16')]);});});};}function getCustomFields(_0x4d2b16,_0x48d379){var _0x4e9529={};if(_0x4d2b16[_0x327b('0x10')]>0x0){_[_0x327b('0x2d')](_0x4d2b16,function(_0x1b7920){if(_['includes']([_0x327b('0x2e'),_0x327b('0x2f')],_0x1b7920[_0x327b('0x30')])&&_0x1b7920[_0x327b('0x31')]&&!_0x1b7920['customField']){_0x4e9529[_0x1b7920[_0x327b('0x31')][_0x327b('0x32')]()]=_0x1b7920[_0x327b('0x33')][_0x327b('0x34')]();}else if(_[_0x327b('0x35')]([_0x327b('0x2e'),_0x327b('0x2f')],_0x1b7920[_0x327b('0x30')])&&_0x1b7920[_0x327b('0x36')]&&_0x1b7920[_0x327b('0x37')]){_0x4e9529[_0x1b7920[_0x327b('0x36')]['toLowerCase']()]=_0x1b7920[_0x327b('0x33')][_0x327b('0x34')]();}else if(_0x1b7920[_0x327b('0x30')]===_0x327b('0x38')&&_0x1b7920[_0x327b('0x39')]&&_0x1b7920[_0x327b('0x36')]&&_0x1b7920[_0x327b('0x37')]){_0x4e9529[_0x1b7920[_0x327b('0x36')][_0x327b('0x32')]()]=_0x48d379[_0x1b7920['variableName']][_0x327b('0x34')]();}else if(_0x1b7920[_0x327b('0x30')]==='customVariable'&&_0x1b7920[_0x327b('0x3a')]&&_0x1b7920[_0x327b('0x3a')][_0x327b('0x3b')]&&_0x1b7920[_0x327b('0x36')]&&_0x1b7920[_0x327b('0x37')]){_0x4e9529[_0x1b7920[_0x327b('0x36')][_0x327b('0x32')]()]=_0x48d379[_0x1b7920['Variable'][_0x327b('0x3b')][_0x327b('0x32')]()][_0x327b('0x34')]();}});}return _0x4e9529;}function getTicket(_0x368ab1,_0x5a1d5d,_0x47c716,_0x5861f6,_0x46c6cb,_0x2dbe25){return function(_0xc15cdd){logger[_0x327b('0x12')]('['+[_0x368ab1['toUpperCase']()]+_0x327b('0x3c'),_0xc15cdd);return new Promise(function(_0x4b0f86,_0x66681c){var _0x3d78aa=_0x368ab1[_0x327b('0x32')]()==='outbound'?_0xc15cdd['userId']:_0xc15cdd[_0x327b('0x28')];var _0x4b40a5={'method':_0x327b('0x3d'),'uri':_0x47c716+'incident'+'?'+_0x2dbe25,'body':Object[_0x327b('0x3e')]({},{'active':_0x327b('0x1f'),'caller_id':_0x3d78aa,'assigned_to':_0xc15cdd[_0x327b('0x20')],'short_description':intUtil[_0x327b('0x3f')](_0x5861f6[_0x327b('0x40')],_0x46c6cb,'\x20'),'description':intUtil[_0x327b('0x3f')](_0x5861f6[_0x327b('0x41')],_0x46c6cb,'\x0a')},getCustomFields(_0x5861f6[_0x327b('0x42')],_0x46c6cb)),'auth':_0x5a1d5d,'json':!![]};return rp(_0x4b40a5)[_0x327b('0x1c')](function(_0x496d4b){logger[_0x327b('0x12')]('['+[_0x368ab1[_0x327b('0x13')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x496d4b[_0x327b('0xf')]);_0xc15cdd[_0x327b('0x43')]=_0x496d4b[_0x327b('0xf')][_0x327b('0x21')];_0xc15cdd[_0x327b('0x44')]=_0x496d4b[_0x327b('0xf')][_0x327b('0x45')];logger['info']('['+[_0x368ab1['toUpperCase']()]+_0x327b('0x46'),_0xc15cdd);_0x4b0f86(_0xc15cdd);})['catch'](function(_0x2f788a){logger[_0x327b('0x15')]('['+[_0x368ab1['toUpperCase']()]+']',_0x2f788a['message']);_0x66681c(_0x2f788a['message']);});});};}function createRemoteTag(_0x215e28,_0x5d7e4c,_0x4aa4cc,_0x565c5e){return new Promise(function(_0x2473fd,_0x4ce670){var _0x3ba810={'method':'POST','uri':_0x4aa4cc+_0x327b('0x47')+'?'+_0x565c5e,'body':{'short_description':_0x215e28,'global':!![],'active':!![],'name':_0x215e28},'auth':_0x5d7e4c,'json':!![]};return rp(_0x3ba810)[_0x327b('0x1c')](function(_0x384954){var _0x606350=_0x384954[_0x327b('0xf')][_0x327b('0x21')];_0x2473fd(_0x606350);});});}function getRemoteTag(_0x4409e1,_0x25a524,_0x48758a,_0x416952,_0x24f1a2){return new Promise(function(_0x18d8de,_0x3a03a4){var _0x265309={'method':_0x327b('0xd'),'uri':_0x48758a+_0x327b('0x47')+'?sysparm_query=name%3D'+_0x4409e1+'&'+_0x416952,'auth':_0x25a524,'json':!![]};return rp(_0x265309)[_0x327b('0x1c')](function(_0x289a28){if(_0x289a28[_0x327b('0xf')][_0x327b('0x10')]>0x0){var _0x5360e9=_0x289a28['result'][0x0]['sys_id'];_0x18d8de(_0x5360e9);}else{return createRemoteTag(_0x4409e1,_0x25a524,_0x48758a,_0x416952)['then'](function(_0x56fa0c){_0x18d8de(_0x56fa0c);});}});});}function assignTagToIncident(_0x2063cb,_0xaa8b26,_0x3325ec,_0x2b99b4,_0x579fa6){return new Promise(function(_0x1376ac,_0x42e4b1){var _0x2c96e4={'method':_0x327b('0x3d'),'uri':_0x3325ec+'label_entry'+'?'+_0x579fa6,'body':{'label':_0x2063cb,'table':_0x327b('0x48'),'id_type':_0x327b('0x49'),'table_key':_0x2b99b4[_0x327b('0x43')],'title':'Incident\x20-\x20'+_0x2b99b4[_0x327b('0x44')],'id_display':_0x2b99b4[_0x327b('0x44')]},'auth':_0xaa8b26,'json':!![]};return rp(_0x2c96e4)[_0x327b('0x1c')](function(_0x3d0b97){_0x1376ac();})[_0x327b('0x14')](function(){_0x1376ac();});});}function manageTags(_0x930cda,_0x478604,_0x4c8da0,_0xd8b05e,_0x2a5a20,_0x397103,_0x58558b){return new Promise(function(_0x1bb4cf,_0x180602){var _0x5a180c=[];_0x478604['forEach'](function(_0x41f7c9){_0x5a180c['push'](getRemoteTag(_0x41f7c9,_0x4c8da0,_0xd8b05e,_0x397103,_0x58558b));});return Promise[_0x327b('0x4a')](_0x5a180c)[_0x327b('0x1c')](function(_0x99314e){if(_0x99314e['length']){logger[_0x327b('0x12')]('['+[_0x930cda[_0x327b('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x99314e);var _0x27a700=[];_0x99314e[_0x327b('0x2d')](function(_0x2e8eb9){_0x27a700[_0x327b('0x4b')](assignTagToIncident(_0x2e8eb9,_0x4c8da0,_0xd8b05e,_0x2a5a20,_0x397103));});return Promise[_0x327b('0x4a')](_0x27a700)[_0x327b('0x1c')](function(){_0x1bb4cf();})[_0x327b('0x14')](function(){_0x1bb4cf();});}else{_0x1bb4cf();}});});}function getTags(_0xa47012,_0xd35b04,_0xb59492,_0x41613c,_0xf4873a,_0x449c1d){return function(_0x2298c9){return new Promise(function(_0x242018,_0x51188b){var _0x5f2f2a=[];var _0x382cba=_0x41613c[_0x327b('0x4c')];if(_0x382cba&&_0x382cba[_0x327b('0x10')]>0x0){_0x5f2f2a=_[_0x327b('0x4d')](_0x382cba,'name');}if(_0x5f2f2a[_0x327b('0x10')]>0x0){return manageTags(_0xa47012,_0x5f2f2a,_0xd35b04,_0xb59492,_0x2298c9,_0xf4873a,_0x449c1d)['then'](function(){_0x242018(_0x2298c9);});}else{_0x242018(_0x2298c9);}});};}function emit(_0x4daa82,_0x1cf20e,_0x1e8389){var _0x2fc47e=_0x327b('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x327b('0x4f')+_0x327b('0x50');var _0x143c48={'uri':_0x4daa82+_0x327b('0x51')+_0x1e8389+_0x2fc47e};io['to'](util['format'](_0x327b('0x52'),_0x1cf20e))[_0x327b('0x53')](_0x327b('0x54'),_0x143c48);}exports['cs']=function(_0x1b17fa,_0x2a54bf,_0x596de6,_0x3887a0,_0x14cf16,_0x62a5b7,_0x51a834,_0x4a1f3d){var _0x17a732={};var _0x42be86={'user':_0x62a5b7[_0x327b('0x55')],'pass':_0x62a5b7[_0x327b('0x56')]};var _0xaf57a2='sysparm_limit=1';var _0x32499d=_0x327b('0x57');_0x62a5b7[_0x327b('0x58')]=intUtil[_0x327b('0x59')](_0x62a5b7[_0x327b('0x58')]);_0x62a5b7['serverUrl']=intUtil[_0x327b('0x59')](_0x62a5b7[_0x327b('0x5a')]);var _0x247209=util[_0x327b('0x5b')](_0x327b('0x5c'),_0x62a5b7[_0x327b('0x58')]);_0x17a732[_0x327b('0x19')]=!_[_0x327b('0x5d')](_0x3887a0)?_0x3887a0[_0x327b('0x5e')]:null;_0x17a732[_0x327b('0x5f')]=_0x62a5b7['email'];_0x17a732[_0x327b('0x26')]=_0x4a1f3d[_0x327b('0x32')]()==='outbound'?_0x2a54bf[_0x327b('0x60')]:_0x2a54bf[_0x327b('0x61')];_0x17a732[_0x327b('0x62')]=_0x4a1f3d==='queue'||_0x4a1f3d==='unmanaged'?'queue':_0x327b('0x63');var _0x5addf6=util['format'](_0x327b('0x64'),_0x62a5b7[_0x327b('0x5a')],_0x2a54bf[_0x327b('0x65')],md5(_0x2a54bf[_0x327b('0x65')]));if(_0x14cf16&&_0x14cf16[_0x327b('0x66')]){logger[_0x327b('0x12')](_0x327b('0x67'),_0x327b('0x68'));_0x2a54bf[_0x327b('0x69')]=_0x5addf6;}else if(_0x51a834&&_0x51a834[_0x327b('0x6a')]&&_0x51a834[_0x327b('0x6a')]!==_0x327b('0x6b')){logger['info'](_0x327b('0x6c'),'Recording\x20is\x20enabled!');_0x2a54bf[_0x327b('0x69')]=_0x5addf6;}else{_0x2a54bf['recordingURL']='';}return getAdminUser(_0x4a1f3d,_0x42be86,_0x17a732,_0x247209,_0x32499d,_0xaf57a2)[_0x327b('0x1c')](getUser(_0x4a1f3d,_0x42be86,_0x247209,_0x32499d,_0xaf57a2))[_0x327b('0x1c')](getEndUser(_0x4a1f3d,_0x42be86,_0x247209,_0x32499d,_0xaf57a2))[_0x327b('0x1c')](getTicket(_0x4a1f3d,_0x42be86,_0x247209,_0x596de6,_0x2a54bf,_0x32499d))['then'](function(_0x14f1f8){logger['info'](util[_0x327b('0x5b')]('The\x20ticket\x20ID\x20is:\x20%s',_0x14f1f8['ticketId']));logger[_0x327b('0x12')](util['format']('call\x20direction:\x20%s',_0x4a1f3d));if(_0x4a1f3d!==_0x327b('0x6d')){logger[_0x327b('0x12')]('['+[_0x4a1f3d[_0x327b('0x13')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x62a5b7[_0x327b('0x58')],_0x3887a0[_0x327b('0x3b')],_0x14f1f8[_0x327b('0x43')]);}})[_0x327b('0x14')](function(_0x43e27a){logger['error']('['+[_0x4a1f3d[_0x327b('0x13')]()]+_0x327b('0x6e'),util[_0x327b('0x6f')](_0x43e27a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 2d986b3..e4e9d82 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 _0x00d5=['uniqueid','calleridname','lodash','request-promise','bluebird','md5','util','ioredis','./util','sugarcrm','redis','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','parent_id','parent_type','length','forEach','variableName','push','set_entry','JSON','Calls','format','Basic\x20%s','toString','base64','get_server_info','stringify','isNil','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','customField','nameField','content','custom_fields','idField','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase'];(function(_0x2d1067,_0x84fa8c){var _0x4ca52f=function(_0x2c18fe){while(--_0x2c18fe){_0x2d1067['push'](_0x2d1067['shift']());}};_0x4ca52f(++_0x84fa8c);}(_0x00d5,0x16d));var _0x500d=function(_0x192b20,_0x2add7f){_0x192b20=_0x192b20-0x0;var _0x1b4589=_0x00d5[_0x192b20];return _0x1b4589;};'use strict';var _=require(_0x500d('0x0'));var rp=require(_0x500d('0x1'));var BPromise=require(_0x500d('0x2'));var md5=require(_0x500d('0x3'));var util=require(_0x500d('0x4'));var Redis=require(_0x500d('0x5'));var intUtil=require(_0x500d('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x500d('0x7'));config[_0x500d('0x8')]=_['defaults'](config[_0x500d('0x8')],{'host':_0x500d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x500d('0x8')]));var def={'method':_0x500d('0xa'),'json':!![]};function emit(_0x56598b,_0x44880c,_0x51d528){io['to'](_0x56598b)[_0x500d('0xb')](_0x44880c,_0x51d528);}function getTicket(_0x3a4760,_0x5a5227,_0x50d1a3,_0xf4c545,_0x4d774a,_0xcedcf4,_0x1d9f37,_0x287317){logger['info'](_0x500d('0xc'));var _0x2d45d0=new Date();var _0x5b9741=[{'name':_0x500d('0xd'),'value':intUtil[_0x500d('0xe')](_0xf4c545[_0x500d('0xf')],_0x4d774a,'\x20')},{'name':_0x500d('0x10'),'value':_0x5a5227['id']},{'name':_0x500d('0x11'),'value':_0x5a5227['id']},{'name':_0x500d('0x12'),'value':intUtil[_0x500d('0xe')](_0xf4c545['Descriptions'],_0x4d774a,'\x0a')},{'name':_0x500d('0x13'),'value':_0x2d45d0[_0x500d('0x14')]()[_0x500d('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x500d('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x500d('0x17'),'value':_0x50d1a3['id']},{'name':_0x500d('0x18'),'value':'Contacts'},{'name':'parent_name','value':_0x50d1a3[_0x500d('0xd')]},{'name':'direction','value':_0x287317}];if(_0xcedcf4[_0x500d('0x19')]){_[_0x500d('0x1a')](_0xcedcf4,function(_0x44a803){if(_0x4d774a[_0x44a803[_0x500d('0x1b')]]){_0x5b9741[_0x500d('0x1c')]({'name':_0x44a803['idField'],'value':_0x4d774a[_0x44a803[_0x500d('0x1b')]]});}});}return request({'form':{'method':_0x500d('0x1d'),'input_type':_0x500d('0x1e'),'response_type':_0x500d('0x1e'),'rest_data':JSON['stringify']({'session':_0x1d9f37['id'],'module_name':_0x500d('0x1f'),'name_value_list':_0x5b9741})}});}function getAuth(_0x5364b7){return util[_0x500d('0x20')](_0x500d('0x21'),new Buffer(_0x5364b7['apiKey']+':X')[_0x500d('0x22')](_0x500d('0x23')));}function getServerInfo(_0x4a3509){return request({'form':{'method':_0x500d('0x24'),'input_type':_0x500d('0x1e'),'response_type':_0x500d('0x1e'),'rest_data':JSON[_0x500d('0x25')]({'session':_0x4a3509['id']})}});}function getUser(_0x58bc07,_0x16a77e,_0x3ca8cc){if(!_[_0x500d('0x26')](_0x16a77e)){logger[_0x500d('0x27')]('Getting\x20agent\x20with\x20name',_0x16a77e);return request({'form':{'method':_0x500d('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x500d('0x25')]({'session':_0x3ca8cc['id'],'module_name':_0x500d('0x29'),'query':util[_0x500d('0x20')](_0x500d('0x2a'),_0x16a77e),'order_by':'','offset':'0','select_fields':['id',_0x500d('0xd'),_0x500d('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x500d('0x2c')](function(_0x58dc01){if(_0x58dc01[_0x500d('0x2d')][_0x500d('0x19')]){var _0x438f68=_[_0x500d('0x2e')](_0x58dc01[_0x500d('0x2d')],function(_0x2741ee){return _0x2741ee[_0x500d('0x2f')]['user_name'][_0x500d('0x30')]===_0x16a77e;});if(_0x438f68){logger['info'](_0x500d('0x31'));return BPromise['resolve']({'id':_0x438f68['name_value_list']['id'][_0x500d('0x30')],'name':_0x438f68[_0x500d('0x2f')][_0x500d('0xd')][_0x500d('0x30')]});}}logger['info'](_0x500d('0x32'));return BPromise[_0x500d('0x33')]({'id':_0x3ca8cc[_0x500d('0x2f')][_0x500d('0x34')][_0x500d('0x30')],'name':_0x3ca8cc['name_value_list'][_0x500d('0x2b')][_0x500d('0x30')]});});}else{logger[_0x500d('0x27')](_0x500d('0x35'));return BPromise[_0x500d('0x33')]({'id':_0x3ca8cc['name_value_list'][_0x500d('0x34')][_0x500d('0x30')],'name':_0x3ca8cc['name_value_list']['user_name']['value']});}}function getEndUser(_0x188993,_0x156b65,_0x253266,_0x3900f3){logger[_0x500d('0x27')]('Searching\x20enduser\x20with\x20phone',_0x253266);return request({'form':{'method':_0x500d('0x28'),'input_type':_0x500d('0x1e'),'response_type':_0x500d('0x1e'),'rest_data':JSON[_0x500d('0x25')]({'session':_0x3900f3['id'],'module_name':_0x500d('0x36'),'query':util[_0x500d('0x20')](_0x500d('0x37'),_0x253266),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x500d('0x2c')](function(_0x5274bf){if(_0x5274bf[_0x500d('0x2d')]['length']){var _0x4d7b22=_[_0x500d('0x2e')](_0x5274bf[_0x500d('0x2d')],function(_0xb9a4c3){return _0xb9a4c3[_0x500d('0x2f')][_0x500d('0x38')][_0x500d('0x30')]===_0x253266;});if(_0x4d7b22){logger[_0x500d('0x27')](_0x500d('0x39'));return BPromise['resolve']({'id':_0x4d7b22[_0x500d('0x2f')]['id'][_0x500d('0x30')],'name':_0x4d7b22[_0x500d('0x2f')][_0x500d('0xd')]['value'],'phone':_0x4d7b22[_0x500d('0x2f')][_0x500d('0x38')][_0x500d('0x30')]});}}else{logger[_0x500d('0x27')](_0x500d('0x3a'));return request({'form':{'method':_0x500d('0x1d'),'input_type':_0x500d('0x1e'),'response_type':_0x500d('0x1e'),'rest_data':JSON[_0x500d('0x25')]({'session':_0x3900f3['id'],'module_name':'Contacts','name_value_list':[{'name':_0x500d('0x3b'),'value':_0x156b65!==_0x500d('0x3c')?_0x156b65:util['format'](_0x500d('0x3d'),_0x253266)},{'name':_0x500d('0x38'),'value':_0x253266}]})}})[_0x500d('0x2c')](function(_0xc2bcdc){logger[_0x500d('0x27')]('Enduser\x20created.');return BPromise[_0x500d('0x33')]({'id':_0xc2bcdc['id'],'name':_0xc2bcdc['entry_list'][_0x500d('0x3b')]['value'],'phone':_0xc2bcdc[_0x500d('0x2d')]['phone_home'][_0x500d('0x30')]});});}});}function request(_0x21cf4d){logger[_0x500d('0x3e')](_0x500d('0x3f'),JSON[_0x500d('0x25')](_0x21cf4d));return rp(_[_0x500d('0x40')](def,_0x21cf4d));}function getTags(_0x22ffc1,_0x343012){var _0x538a6f=[];if(_0x22ffc1&&_0x22ffc1[_0x500d('0x19')]>0x0){_0x538a6f=_[_0x500d('0x41')](_0x22ffc1,_0x343012);}return _0x538a6f;}function getCustomFields(_0x3fdf02,_0x5abb07){var _0x5ef40e=[];var _0x1cdc42={'custom_fields':[]};if(_0x3fdf02[_0x500d('0x19')]>0x0){_[_0x500d('0x1a')](_0x3fdf02,function(_0x52657f){if(_0x52657f[_0x500d('0x42')]===_0x500d('0x43')&&_0x52657f['nameField']&&!_0x52657f[_0x500d('0x44')]){_0x1cdc42[_0x52657f[_0x500d('0x45')]['toLowerCase']()]=_0x52657f[_0x500d('0x46')][_0x500d('0x22')]();}else if(_0x52657f[_0x500d('0x42')]===_0x500d('0x43')&&_0x52657f['idField']&&_0x52657f[_0x500d('0x44')]){_0x1cdc42[_0x500d('0x47')][_0x500d('0x1c')]({'id':_0x52657f[_0x500d('0x48')],'value':_0x52657f[_0x500d('0x46')][_0x500d('0x22')]()});}else if(_0x52657f[_0x500d('0x42')]==='variable'&&_0x52657f['variableName']&&_0x52657f[_0x500d('0x48')]&&_0x52657f[_0x500d('0x44')]){_0x5abb07[_0x52657f[_0x500d('0x1b')]]&&_0x1cdc42['custom_fields'][_0x500d('0x1c')]({'id':_0x52657f[_0x500d('0x48')],'value':_0x5abb07[_0x52657f[_0x500d('0x1b')]]['toString']()});}else if(_0x52657f[_0x500d('0x42')]===_0x500d('0x49')&&_0x52657f[_0x500d('0x4a')]&&_0x52657f[_0x500d('0x4a')]['name']&&_0x52657f['idField']&&_0x52657f[_0x500d('0x44')]){_0x5abb07[_0x52657f[_0x500d('0x4a')][_0x500d('0xd')][_0x500d('0x4b')]()]&&_0x1cdc42[_0x500d('0x47')][_0x500d('0x1c')]({'id':_0x52657f[_0x500d('0x48')],'value':_0x5abb07[_0x52657f['Variable'][_0x500d('0xd')]['toLowerCase']()]['toString']()});}});}return _0x1cdc42;}function getConnection(_0x5ad451){return request({'method':'POST','form':{'method':_0x500d('0x4c'),'input_type':_0x500d('0x1e'),'response_type':_0x500d('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5ad451[_0x500d('0x4d')],'password':_0x5ad451[_0x500d('0x4e')],'encryption':_0x500d('0x4f')},'application':_0x500d('0x50')})}})[_0x500d('0x2c')](function(_0x238c21){var _0x4a4809=_0x238c21;if(_0x4a4809['id']){def['sessionID']=_0x4a4809['id'];return BPromise[_0x500d('0x33')](_0x4a4809);}else{throw new Error(util[_0x500d('0x20')](_0x500d('0x51'),_0x5ad451['id']));}});}function setRelationship(_0x5ec851,_0x11ceb6,_0x39af3d,_0x250cfb){return request({'form':{'method':_0x500d('0x52'),'input_type':_0x500d('0x1e'),'response_type':'JSON','rest_data':JSON[_0x500d('0x25')]({'session':_0x5ec851['id'],'module_name':'Calls','module_id':_0x39af3d['id'],'link_field_name':_0x250cfb,'related_ids':[_0x11ceb6['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x5846af,_0x420cf4,_0x279a3c,_0x483c2d,_0x160e78,_0x20ba43){var _0x4281cd,_0x1ed4a0,_0x4c2419,_0x42527c;_0x20ba43[_0x500d('0x53')]=intUtil[_0x500d('0x54')](_0x20ba43[_0x500d('0x53')]);_0x20ba43[_0x500d('0x55')]=intUtil[_0x500d('0x54')](_0x20ba43[_0x500d('0x55')]);def[_0x500d('0x56')]=util[_0x500d('0x20')](_0x500d('0x57'),_0x20ba43[_0x500d('0x53')]);if(_0x160e78&&_0x160e78['monitor_format']){logger[_0x500d('0x27')](_0x500d('0x58'),_0x500d('0x59'));_0x420cf4[_0x500d('0x5a')]=util[_0x500d('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20ba43['serverUrl'],_0x420cf4['uniqueid'],md5(_0x420cf4['uniqueid']));}else{_0x420cf4[_0x500d('0x5a')]='';}return getConnection(_0x20ba43)[_0x500d('0x2c')](function(_0xaf9de9){_0x42527c=_0xaf9de9;return getUser(_0x20ba43,_0x483c2d[_0x500d('0xd')],_0x42527c);})[_0x500d('0x2c')](function(_0x449668){_0x4281cd=_0x449668;logger[_0x500d('0x27')](_0x500d('0x5b'),_0x4281cd['id']);return getEndUser(_0x20ba43,_0x420cf4['calleridname'],_0x420cf4[_0x500d('0x5c')],_0x42527c);})[_0x500d('0x2c')](function(_0x4e76ef){_0x1ed4a0=_0x4e76ef;logger[_0x500d('0x27')]('The\x20Enduser\x20ID\x20is:',_0x1ed4a0['id']);return getTicket(_0x20ba43,_0x4281cd,_0x1ed4a0,_0x279a3c,_0x420cf4,_0x279a3c[_0x500d('0x5d')],_0x42527c,_0x500d('0x5e'));})[_0x500d('0x2c')](function(_0x2bdae3){_0x4c2419=_0x2bdae3;logger[_0x500d('0x27')]('Ticket\x20created!');logger[_0x500d('0x27')](_0x500d('0x5f'),_0x4c2419['id']);return setRelationship(_0x42527c,_0x4281cd,_0x4c2419,_0x500d('0x60'));})[_0x500d('0x2c')](function(){return setRelationship(_0x42527c,_0x1ed4a0,_0x4c2419,_0x500d('0x61'));})[_0x500d('0x2c')](function(){return getServerInfo(_0x42527c);})[_0x500d('0x2c')](function(_0x527c1d){var _0x45f4e0=parseInt(_0x527c1d[_0x500d('0x62')][_0x500d('0x63')](0x0));var _0x3c6a6e=util[_0x500d('0x20')](_0x500d('0x64'),_0x20ba43['remoteUri'],_0x4c2419['id']);if(_0x45f4e0>0x6){_0x3c6a6e=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x20ba43[_0x500d('0x53')],_0x4c2419['id']);}logger[_0x500d('0x27')](_0x500d('0x58'),_0x500d('0x65'));emit(util['format'](_0x500d('0x66'),_0x483c2d[_0x500d('0xd')]),_0x500d('0x67'),{'uri':_0x3c6a6e});})[_0x500d('0x68')](function(_0x2a5c7e){logger[_0x500d('0x69')]('[QUEUE]',JSON['stringify'](_0x2a5c7e));});};exports[_0x500d('0x6a')]=function(_0x328d69,_0x315ed7,_0x54fb27,_0x3f24f5,_0x322dd0,_0x5e8754,_0x1ee15c){var _0x96a0a2,_0x2c7a00,_0x1dd91b,_0x256096;_0x5e8754[_0x500d('0x53')]=intUtil[_0x500d('0x54')](_0x5e8754[_0x500d('0x53')]);_0x5e8754[_0x500d('0x55')]=intUtil[_0x500d('0x54')](_0x5e8754[_0x500d('0x55')]);def[_0x500d('0x56')]=util[_0x500d('0x20')](_0x500d('0x57'),_0x5e8754[_0x500d('0x53')]);if(_0x1ee15c&&_0x1ee15c[_0x500d('0x6b')]&&_0x1ee15c['recordingFormat']!==_0x500d('0x6c')){logger[_0x500d('0x27')](_0x500d('0x6d'),_0x500d('0x59'));_0x315ed7[_0x500d('0x5a')]=util['format'](_0x500d('0x6e'),_0x5e8754['serverUrl'],_0x315ed7['uniqueid'],md5(_0x315ed7['uniqueid']));}return getConnection(_0x5e8754)[_0x500d('0x2c')](function(_0xdb362){_0x256096=_0xdb362;return getUser(_0x5e8754,_0x3f24f5[_0x500d('0xd')],_0x256096);})['then'](function(_0x5d0676){_0x96a0a2=_0x5d0676;logger['info'](_0x500d('0x5b'),_0x96a0a2['id']);return getEndUser(_0x5e8754,_0x315ed7[_0x500d('0x6f')],_0x315ed7[_0x500d('0x70')],_0x256096);})[_0x500d('0x2c')](function(_0xb883e3){_0x2c7a00=_0xb883e3;logger[_0x500d('0x27')](_0x500d('0x71'),_0x2c7a00['id']);return getTicket(_0x5e8754,_0x96a0a2,_0x2c7a00,_0x54fb27,_0x315ed7,_0x54fb27[_0x500d('0x5d')],_0x256096,'Outbound');})[_0x500d('0x2c')](function(_0x2ef455){_0x1dd91b=_0x2ef455;logger[_0x500d('0x27')](_0x500d('0x72'));logger[_0x500d('0x27')]('The\x20Ticket\x20ID\x20is:',_0x1dd91b['id']);return setRelationship(_0x256096,_0x96a0a2,_0x1dd91b,_0x500d('0x60'));})[_0x500d('0x2c')](function(){return setRelationship(_0x256096,_0x2c7a00,_0x1dd91b,'contacts');})[_0x500d('0x2c')](function(){return getServerInfo(_0x256096);})['then'](function(_0x27bb32){var _0x1d9d90=parseInt(_0x27bb32['version']['charAt'](0x0));var _0xa5e84d=util['format'](_0x500d('0x64'),_0x5e8754[_0x500d('0x53')],_0x1dd91b['id']);if(_0x1d9d90>0x6){_0xa5e84d=util[_0x500d('0x20')](_0x500d('0x73'),_0x5e8754[_0x500d('0x53')],_0x1dd91b['id']);}logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x500d('0x20')](_0x500d('0x66'),_0x3f24f5[_0x500d('0xd')]),_0x500d('0x67'),{'uri':_0xa5e84d});})[_0x500d('0x68')](function(_0x386a99){logger[_0x500d('0x69')](_0x500d('0x6d'),JSON[_0x500d('0x25')](_0x386a99));});};exports[_0x500d('0x74')]=function(_0x28b00b,_0x253866,_0x21470a,_0x5727c3,_0x2b85b6,_0x53f66e){var _0x1e6f68,_0x2c3e85,_0x4e6925,_0x378873;_0x53f66e[_0x500d('0x53')]=intUtil[_0x500d('0x54')](_0x53f66e[_0x500d('0x53')]);_0x53f66e[_0x500d('0x55')]=intUtil[_0x500d('0x54')](_0x53f66e[_0x500d('0x55')]);def[_0x500d('0x56')]=util['format'](_0x500d('0x57'),_0x53f66e[_0x500d('0x53')]);if(_0x2b85b6&&_0x2b85b6['monitor_format']){logger[_0x500d('0x27')]('['+_0x253866[_0x500d('0x75')][_0x500d('0x76')]()+']',_0x500d('0x59'));_0x253866[_0x500d('0x5a')]=util['format'](_0x500d('0x6e'),_0x53f66e[_0x500d('0x55')],_0x253866[_0x500d('0x77')],md5(_0x253866[_0x500d('0x77')]));}else{_0x253866[_0x500d('0x5a')]='';}return getConnection(_0x53f66e)[_0x500d('0x2c')](function(_0x1fbe30){_0x378873=_0x1fbe30;if(!_[_0x500d('0x26')](_0x5727c3)){return getUser(_0x53f66e,_0x5727c3['name'],_0x378873);}else{return getUser(_0x53f66e,null,_0x378873);}})['then'](function(_0x4ca4cd){_0x1e6f68=_0x4ca4cd;logger[_0x500d('0x27')](_0x500d('0x5b'),_0x1e6f68['id']);return getEndUser(_0x53f66e,_0x253866[_0x500d('0x78')],_0x253866[_0x500d('0x5c')],_0x378873);})['then'](function(_0x57ccb9){_0x2c3e85=_0x57ccb9;logger[_0x500d('0x27')]('The\x20Enduser\x20ID\x20is:',_0x2c3e85['id']);return getTicket(_0x53f66e,_0x1e6f68,_0x2c3e85,_0x21470a,_0x253866,_0x21470a['Fields'],_0x378873,_0x500d('0x5e'));})['then'](function(_0xbe90ea){_0x4e6925=_0xbe90ea;logger[_0x500d('0x27')](_0x500d('0x72'));logger[_0x500d('0x27')](_0x500d('0x5f'),_0x4e6925['id']);return setRelationship(_0x378873,_0x1e6f68,_0x4e6925,_0x500d('0x60'));})[_0x500d('0x2c')](function(){return setRelationship(_0x378873,_0x2c3e85,_0x4e6925,'contacts');})[_0x500d('0x2c')](function(){return getServerInfo(_0x378873);})[_0x500d('0x68')](function(_0x1fe96f){logger[_0x500d('0x69')]('['+_0x253866['lastevent'][_0x500d('0x76')]()+']',JSON[_0x500d('0x25')](_0x1fe96f));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index c7be41b..400f375 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 _0xc2e7=['test','util','getString','length','sortBy','type','string','push','content','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','customVariable','stripTrailingSlash','slice','lastIndexOf','validateEmail'];(function(_0x3e3e8d,_0x4b3914){var _0x3d51d4=function(_0x3f0d40){while(--_0x3f0d40){_0x3e3e8d['push'](_0x3e3e8d['shift']());}};_0x3d51d4(++_0x4b3914);}(_0xc2e7,0x1c3));var _0x7c2e=function(_0xf2efc6,_0xf2a42a){_0xf2efc6=_0xf2efc6-0x0;var _0x4e140a=_0xc2e7[_0xf2efc6];return _0x4e140a;};'use strict';var _=require('lodash');var util=require(_0x7c2e('0x0'));exports[_0x7c2e('0x1')]=function(_0xd78548,_0x11c93d,_0xcb8d8){var _0x1276ae=[];if(_0xd78548[_0x7c2e('0x2')]>0x0){var _0x43503b=_[_0x7c2e('0x3')](_0xd78548,['id']);for(var _0x44c61d=0x0;_0x44c61d<_0x43503b['length'];_0x44c61d++){var _0x1871d2=_0x43503b[_0x44c61d];if(_0x1871d2[_0x7c2e('0x4')]===_0x7c2e('0x5')){_0x1276ae[_0x7c2e('0x6')](_0x1871d2[_0x7c2e('0x7')]);}else if(_0x1871d2[_0x7c2e('0x4')]==='variable'&&_0x1871d2[_0x7c2e('0x8')]){_0x11c93d[_0x1871d2['variableName']]&&_0x1276ae['push'](_0x11c93d[_0x1871d2[_0x7c2e('0x8')]][_0x7c2e('0x9')]());}else if(_0x1871d2['type']==='customVariable'&&_0x1871d2[_0x7c2e('0xa')]&&_0x1871d2['Variable']['name']){_0x11c93d[_0x1871d2[_0x7c2e('0xa')][_0x7c2e('0xb')][_0x7c2e('0xc')]()]&&_0x1276ae[_0x7c2e('0x6')](_0x11c93d[_0x1871d2[_0x7c2e('0xa')][_0x7c2e('0xb')][_0x7c2e('0xc')]()][_0x7c2e('0x9')]());}else if(_0x1871d2[_0x7c2e('0x4')]===_0x7c2e('0xd')){if(_0x1871d2[_0x7c2e('0xe')]===_0x7c2e('0x5')&&_0x1871d2[_0x7c2e('0xf')]){_0x1276ae['push'](util[_0x7c2e('0x10')](_0x7c2e('0x11'),_0x1871d2['key'],_0x1871d2['keyContent']));}else if(_0x1871d2['keyType']===_0x7c2e('0x12')&&_0x1871d2[_0x7c2e('0x8')]&&_0x1871d2[_0x7c2e('0xf')]){_0x11c93d[_0x1871d2[_0x7c2e('0x8')]]&&_0x1276ae[_0x7c2e('0x6')](util[_0x7c2e('0x10')](_0x7c2e('0x11'),_0x1871d2[_0x7c2e('0xf')],_0x11c93d[_0x1871d2[_0x7c2e('0x8')]]));}else if(_0x1871d2[_0x7c2e('0xe')]===_0x7c2e('0x13')&&_0x1871d2[_0x7c2e('0xa')]&&_0x1871d2[_0x7c2e('0xa')][_0x7c2e('0xb')]&&_0x1871d2['key']){_0x11c93d[_0x1871d2['Variable'][_0x7c2e('0xb')]['toLowerCase']()]&&_0x1276ae[_0x7c2e('0x6')](util[_0x7c2e('0x10')](_0x7c2e('0x11'),_0x1871d2[_0x7c2e('0xf')],_0x11c93d[_0x1871d2[_0x7c2e('0xa')][_0x7c2e('0xb')][_0x7c2e('0xc')]()]));}}}}return _0x1276ae['join'](_0xcb8d8);};exports[_0x7c2e('0x14')]=function(_0x565026){var _0x5c43e4=_0x565026[_0x7c2e('0x15')](-0x1);if(_0x5c43e4==='/'){_0x565026=_0x565026['substring'](0x0,_0x565026[_0x7c2e('0x16')](_0x5c43e4));}return _0x565026;};exports[_0x7c2e('0x17')]=function(_0x152076){if(!_['isNil'](_0x152076)&&_0x152076!==''){var _0x53ef64=/^(([^<>()\[\]\\.,;:\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 _0x53ef64[_0x7c2e('0x18')](String(_0x152076)['toLowerCase']());}else{return![];}}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index c7ec25e..eb00240 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index fb4c287..607f185 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 _0x3ccb=['socket.io-emitter','emit','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','end-user','length','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','nameField','toLowerCase','content','idField','push','variable','variableName','customField','custom_fields','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','inspect','outbound','none','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','request-promise','md5','./util','../../../../config/logger','zendesk','redis','defaults','localhost'];(function(_0x532e86,_0x211359){var _0xd8e36b=function(_0x5234bd){while(--_0x5234bd){_0x532e86['push'](_0x532e86['shift']());}};_0xd8e36b(++_0x211359);}(_0x3ccb,0x1ab));var _0xb3cc=function(_0x256703,_0x3d7958){_0x256703=_0x256703-0x0;var _0x4c35ef=_0x3ccb[_0x256703];return _0x4c35ef;};'use strict';var _=require(_0xb3cc('0x0'));var rp=require(_0xb3cc('0x1'));var md5=require(_0xb3cc('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xb3cc('0x3'));var config=require('../../../../config/environment');var logger=require(_0xb3cc('0x4'))(_0xb3cc('0x5'));config[_0xb3cc('0x6')]=_[_0xb3cc('0x7')](config[_0xb3cc('0x6')],{'host':_0xb3cc('0x8'),'port':0x18eb});var io=require(_0xb3cc('0x9'))(new Redis(config['redis']));function emit(_0x4d0ebc,_0x5982f9,_0x2a23cd){io['to'](_0x4d0ebc)[_0xb3cc('0xa')](_0x5982f9,_0x2a23cd);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x50b7fa,_0x164c8d,_0x1178b2,_0x4c5d61,_0x47199b){logger[_0xb3cc('0xb')](_0xb3cc('0xc'));return request({'uri':util['format'](_0xb3cc('0xd'),_0x50b7fa[_0xb3cc('0xe')]),'method':_0xb3cc('0xf'),'body':{'ticket':_[_0xb3cc('0x10')]({'requester_id':_0x1178b2['id'],'submitter_id':_0x164c8d?_0x164c8d['id']:undefined,'assignee_id':_0x164c8d?_0x164c8d['id']:undefined,'tags':getTags(_0x4c5d61[_0xb3cc('0x11')],_0xb3cc('0x12')),'subject':intUtil[_0xb3cc('0x13')](_0x4c5d61[_0xb3cc('0x14')],_0x47199b,'\x20'),'description':intUtil[_0xb3cc('0x13')](_0x4c5d61['Descriptions'],_0x47199b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb3cc('0x13')](_0x4c5d61[_0xb3cc('0x15')],_0x47199b,'\x0a')}},getCustomFields(_0x4c5d61[_0xb3cc('0x16')],_0x47199b))}})[_0xb3cc('0x17')](function(_0x28edc6){logger[_0xb3cc('0xb')]('Ticket\x20created!');return _0x28edc6[_0xb3cc('0x18')];});}function getUser(_0x3187a8,_0x1b7de0){if(intUtil[_0xb3cc('0x19')](_0x1b7de0)){logger[_0xb3cc('0xb')](_0xb3cc('0x1a'),_0x1b7de0);return request({'uri':util['format']('%s/search.json',_0x3187a8[_0xb3cc('0xe')]),'qs':{'query':util[_0xb3cc('0x1b')](_0xb3cc('0x1c'),_0x1b7de0)}})[_0xb3cc('0x17')](function(_0x4d2cc0){if(_0x4d2cc0['count']){logger[_0xb3cc('0xb')]('Agent\x20found!');return _['find'](_0x4d2cc0[_0xb3cc('0x1d')],{'email':_0x1b7de0,'role':_0xb3cc('0x1e')});}else{logger[_0xb3cc('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb3cc('0x1b')]('%s/users/me.json',_0x3187a8[_0xb3cc('0xe')])})[_0xb3cc('0x17')](function(_0x5b81ea){logger[_0xb3cc('0xb')](_0xb3cc('0x1f'));return _0x5b81ea[_0xb3cc('0x20')];});}});}else{logger['info'](_0xb3cc('0x21'));return request({'uri':util['format'](_0xb3cc('0x22'),_0x3187a8[_0xb3cc('0xe')])})[_0xb3cc('0x17')](function(_0x1fcbe6){logger['info']('Admin\x20account\x20selected.');return _0x1fcbe6[_0xb3cc('0x20')];});}}function getEndUser(_0x5eae4c,_0x9d0c0b,_0x4c35ab){logger[_0xb3cc('0xb')](_0xb3cc('0x23'),_0x4c35ab);return request({'uri':util[_0xb3cc('0x1b')](_0xb3cc('0x24'),_0x5eae4c[_0xb3cc('0xe')]),'qs':{'query':util[_0xb3cc('0x1b')](_0xb3cc('0x25'),_0x4c35ab)}})[_0xb3cc('0x17')](function(_0xc080d0){var _0x46d757;if(_0xc080d0[_0xb3cc('0x1d')]['length']){_0xc080d0[_0xb3cc('0x1d')]=_['filter'](_0xc080d0[_0xb3cc('0x1d')],{'suspended':![],'role':_0xb3cc('0x26')});if(_0xc080d0[_0xb3cc('0x1d')][_0xb3cc('0x27')]){_0x46d757=_[_0xb3cc('0x28')](_0xc080d0[_0xb3cc('0x1d')]);}}if(_0x46d757){logger[_0xb3cc('0xb')](_0xb3cc('0x29'));return _0x46d757;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb3cc('0x1b')](_0xb3cc('0x2a'),_0x5eae4c[_0xb3cc('0xe')]),'method':'POST','body':{'user':{'role':_0xb3cc('0x26'),'name':util[_0xb3cc('0x1b')](_0xb3cc('0x2b'),_0x9d0c0b||_0x4c35ab),'phone':_0x4c35ab}}})[_0xb3cc('0x17')](function(_0x1137d1){logger[_0xb3cc('0xb')](_0xb3cc('0x2c'));return _0x1137d1['user'];});}});}function getAuth(_0x527ffc){var _0x32969a;if(_0x527ffc[_0xb3cc('0x2d')]===_0xb3cc('0x2e')){_0x32969a=util['format'](_0xb3cc('0x2f'),_0x527ffc['username'],_0x527ffc[_0xb3cc('0x2e')]);}else if(_0x527ffc[_0xb3cc('0x2d')]===_0xb3cc('0x30')){_0x32969a=util[_0xb3cc('0x1b')](_0xb3cc('0x31'),_0x527ffc[_0xb3cc('0x32')],_0x527ffc['token']);}return util[_0xb3cc('0x1b')]('Basic\x20%s',new Buffer(_0x32969a)[_0xb3cc('0x33')](_0xb3cc('0x34')));}function request(_0x13e2d4){logger[_0xb3cc('0x35')](_0xb3cc('0x36'),JSON[_0xb3cc('0x37')](_0x13e2d4));return rp(_[_0xb3cc('0x7')](_0x13e2d4,{'method':_0xb3cc('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x2a8013,_0x14313a){var _0x42a00a=[];if(_0x2a8013&&_0x2a8013[_0xb3cc('0x27')]>0x0){_0x42a00a=_[_0xb3cc('0x39')](_0x2a8013,_0x14313a);}return _0x42a00a;}function getCustomFields(_0xc3385d,_0x1d6d29){var _0x206650=[];var _0x581e78={'custom_fields':[]};if(_0xc3385d[_0xb3cc('0x27')]>0x0){_[_0xb3cc('0x3a')](_0xc3385d,function(_0x2d98a0){if(_[_0xb3cc('0x3b')](['string',_0xb3cc('0x3c')],_0x2d98a0[_0xb3cc('0x3d')])&&_0x2d98a0[_0xb3cc('0x3e')]&&!_0x2d98a0['customField']){_0x581e78[_0x2d98a0['nameField'][_0xb3cc('0x3f')]()]=_0x2d98a0[_0xb3cc('0x40')]['toString']();}else if(_[_0xb3cc('0x3b')](['string',_0xb3cc('0x3c')],_0x2d98a0[_0xb3cc('0x3d')])&&_0x2d98a0[_0xb3cc('0x41')]&&_0x2d98a0['customField']){_0x581e78['custom_fields'][_0xb3cc('0x42')]({'id':_0x2d98a0[_0xb3cc('0x41')],'value':_0x2d98a0['content']['toString']()});}else if(_0x2d98a0[_0xb3cc('0x3d')]===_0xb3cc('0x43')&&_0x2d98a0[_0xb3cc('0x44')]&&_0x2d98a0[_0xb3cc('0x41')]&&_0x2d98a0[_0xb3cc('0x45')]){_0x1d6d29[_0x2d98a0[_0xb3cc('0x44')]]&&_0x581e78[_0xb3cc('0x46')][_0xb3cc('0x42')]({'id':_0x2d98a0[_0xb3cc('0x41')],'value':_0x1d6d29[_0x2d98a0[_0xb3cc('0x44')]][_0xb3cc('0x33')]()});}else if(_0x2d98a0['type']==='customVariable'&&_0x2d98a0[_0xb3cc('0x47')]&&_0x2d98a0[_0xb3cc('0x47')][_0xb3cc('0x12')]&&_0x2d98a0[_0xb3cc('0x41')]&&_0x2d98a0['customField']){_0x1d6d29[_0x2d98a0[_0xb3cc('0x47')][_0xb3cc('0x12')][_0xb3cc('0x3f')]()]&&_0x581e78[_0xb3cc('0x46')][_0xb3cc('0x42')]({'id':_0x2d98a0['idField'],'value':_0x1d6d29[_0x2d98a0[_0xb3cc('0x47')]['name'][_0xb3cc('0x3f')]()][_0xb3cc('0x33')]()});}});}return _0x581e78;}exports[_0xb3cc('0x48')]=function(_0x3e27ee,_0x42f3ae,_0x16f142,_0x1a200c,_0x21e159,_0x3333fe){var _0x15c621,_0x5b3090;_0x3333fe[_0xb3cc('0xe')]=intUtil[_0xb3cc('0x49')](_0x3333fe[_0xb3cc('0xe')]);_0x3333fe[_0xb3cc('0x4a')]=intUtil[_0xb3cc('0x49')](_0x3333fe['serverUrl']);if(_0x21e159&&_0x21e159['monitor_format']){logger[_0xb3cc('0xb')](_0xb3cc('0x4b'),_0xb3cc('0x4c'));_0x42f3ae[_0xb3cc('0x4d')]=util[_0xb3cc('0x1b')](_0xb3cc('0x4e'),_0x3333fe[_0xb3cc('0x4a')],_0x42f3ae['uniqueid'],md5(_0x42f3ae[_0xb3cc('0x4f')]));}else{_0x42f3ae[_0xb3cc('0x4d')]='';}headers[_0xb3cc('0x50')]=getAuth(_0x3333fe);return getUser(_0x3333fe,_0x1a200c[_0xb3cc('0x51')])['then'](function(_0x4c0d86){_0x15c621=_0x4c0d86;logger['info']('The\x20User\x20ID\x20is:',_0x15c621['id']);return getEndUser(_0x3333fe,_0x42f3ae[_0xb3cc('0x52')],_0x42f3ae['calleridnum']);})[_0xb3cc('0x17')](function(_0x2e18e0){_0x5b3090=_0x2e18e0;logger[_0xb3cc('0xb')](_0xb3cc('0x53'),_0x5b3090['id']);return getTicket(_0x3333fe,_0x15c621,_0x5b3090,_0x16f142,_0x42f3ae);})[_0xb3cc('0x17')](function(_0x5d0a73){if(_0x5d0a73){logger[_0xb3cc('0xb')](_0xb3cc('0x54'),_0x5d0a73['id']);switch(_0x3333fe[_0xb3cc('0x3d')]){case'integrationTab':logger['info']('[QUEUE]',_0xb3cc('0x55'));return request({'uri':util[_0xb3cc('0x1b')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3333fe[_0xb3cc('0xe')],_0x15c621['id'],_0x5d0a73['id']),'method':_0xb3cc('0xf')});case'newTab':logger['info'](_0xb3cc('0x4b'),_0xb3cc('0x56'));emit(util[_0xb3cc('0x1b')]('user:%s',_0x1a200c[_0xb3cc('0x12')]),_0xb3cc('0x57'),{'uri':util[_0xb3cc('0x1b')](_0xb3cc('0x58'),_0x3333fe[_0xb3cc('0xe')][_0xb3cc('0x59')](_0xb3cc('0x5a'),''),_0x5d0a73['id'])});break;default:logger['error'](_0xb3cc('0x4b'),_0xb3cc('0x5b'));}}})[_0xb3cc('0x5c')](function(_0x9927c0){logger[_0xb3cc('0x5d')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb3cc('0x5e')](_0x9927c0,{'showHidden':!![],'depth':null}));});};exports[_0xb3cc('0x5f')]=function(_0x11b05b,_0x5889ab,_0x328036,_0x7f6e79,_0x4285bf,_0x13026a,_0x2875cd){var _0x579a83,_0x28b892;_0x13026a[_0xb3cc('0xe')]=intUtil['stripTrailingSlash'](_0x13026a[_0xb3cc('0xe')]);_0x13026a[_0xb3cc('0x4a')]=intUtil[_0xb3cc('0x49')](_0x13026a['serverUrl']);if(_0x2875cd&&_0x2875cd['recordingFormat']&&_0x2875cd['recordingFormat']!==_0xb3cc('0x60')){logger[_0xb3cc('0xb')]('[OUTBOUND]',_0xb3cc('0x4c'));_0x5889ab[_0xb3cc('0x4d')]=util[_0xb3cc('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13026a['serverUrl'],_0x5889ab[_0xb3cc('0x4f')],md5(_0x5889ab['uniqueid']));}headers[_0xb3cc('0x50')]=getAuth(_0x13026a);return getUser(_0x13026a,_0x7f6e79['email'])[_0xb3cc('0x17')](function(_0x2002e7){_0x579a83=_0x2002e7;logger[_0xb3cc('0xb')](_0xb3cc('0x61'),_0x579a83['id']);return getEndUser(_0x13026a,_0x5889ab[_0xb3cc('0x62')],_0x5889ab['destcalleridnum']);})[_0xb3cc('0x17')](function(_0xafc4e3){_0x28b892=_0xafc4e3;logger[_0xb3cc('0xb')](_0xb3cc('0x53'),_0x28b892['id']);return getTicket(_0x13026a,_0x579a83,_0x28b892,_0x328036,_0x5889ab);})['then'](function(_0x407307){if(_0x407307){logger[_0xb3cc('0xb')](_0xb3cc('0x54'),_0x407307['id']);switch(_0x13026a[_0xb3cc('0x3d')]){case'integrationTab':logger[_0xb3cc('0xb')](_0xb3cc('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb3cc('0x1b')](_0xb3cc('0x64'),_0x13026a['remoteUri'],_0x579a83['id'],_0x407307['id']),'method':_0xb3cc('0xf')});case _0xb3cc('0x65'):logger[_0xb3cc('0xb')]('[OUTBOUND]',_0xb3cc('0x56'));emit(util[_0xb3cc('0x1b')](_0xb3cc('0x66'),_0x7f6e79[_0xb3cc('0x12')]),_0xb3cc('0x57'),{'uri':util[_0xb3cc('0x1b')](_0xb3cc('0x58'),_0x13026a[_0xb3cc('0xe')][_0xb3cc('0x59')](_0xb3cc('0x5a'),''),_0x407307['id'])});break;default:logger[_0xb3cc('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x4a269f){logger[_0xb3cc('0x5d')](_0xb3cc('0x67'),util[_0xb3cc('0x5e')](_0x4a269f,{'showHidden':!![],'depth':null}));});};exports[_0xb3cc('0x68')]=function(_0x43e7ac,_0x1d4753,_0x55d1c6,_0x345772,_0x149a8d,_0xff15f6){var _0x54a586,_0x5783b1;_0xff15f6['remoteUri']=intUtil[_0xb3cc('0x49')](_0xff15f6['remoteUri']);_0xff15f6[_0xb3cc('0x4a')]=intUtil[_0xb3cc('0x49')](_0xff15f6[_0xb3cc('0x4a')]);if(_0x149a8d&&_0x149a8d[_0xb3cc('0x69')]){logger[_0xb3cc('0xb')]('['+_0x1d4753[_0xb3cc('0x6a')][_0xb3cc('0x6b')]()+']','Recording\x20is\x20enabled!');_0x1d4753['recordingURL']=util[_0xb3cc('0x1b')](_0xb3cc('0x4e'),_0xff15f6[_0xb3cc('0x4a')],_0x1d4753[_0xb3cc('0x4f')],md5(_0x1d4753[_0xb3cc('0x4f')]));}else{_0x1d4753[_0xb3cc('0x4d')]='';}headers[_0xb3cc('0x50')]=getAuth(_0xff15f6);return getUser(_0xff15f6)[_0xb3cc('0x17')](function(_0x257424){_0x54a586=_0x257424;logger['info']('The\x20User\x20ID\x20is:',_0x54a586['id']);return getEndUser(_0xff15f6,_0x1d4753[_0xb3cc('0x52')],_0x1d4753[_0xb3cc('0x6c')]);})[_0xb3cc('0x17')](function(_0xaaf916){_0x5783b1=_0xaaf916;logger[_0xb3cc('0xb')](_0xb3cc('0x53'),_0x5783b1['id']);return getTicket(_0xff15f6,_0x54a586,_0x5783b1,_0x55d1c6,_0x1d4753);})[_0xb3cc('0x17')](function(_0x4a2d98){if(_0x4a2d98){logger['info'](_0xb3cc('0x54'),_0x4a2d98['id']);}})[_0xb3cc('0x5c')](function(_0x4a6e7e){logger[_0xb3cc('0x5d')]('['+_0x1d4753[_0xb3cc('0x6a')][_0xb3cc('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xb3cc('0x5e')](_0x4a6e7e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 74d35a6..801141d 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 _0x0286=['isNil','access_token','isBefore','zone','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','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridnum','The\x20Call\x20ID\x20is:','user:%s','https://crm.','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','The\x20User\x20ID\x20is:','calleridname','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf'];(function(_0x2a8044,_0x5cfbbf){var _0xaa11ff=function(_0x5f0e90){while(--_0x5f0e90){_0x2a8044['push'](_0x2a8044['shift']());}};_0xaa11ff(++_0x5cfbbf);}(_0x0286,0x7f));var _0x6028=function(_0x29d695,_0x5e1e14){_0x29d695=_0x29d695-0x0;var _0x1f63f3=_0x0286[_0x29d695];return _0x1f63f3;};'use strict';var _=require('lodash');var rp=require(_0x6028('0x0'));var md5=require(_0x6028('0x1'));var util=require(_0x6028('0x2'));var intUtil=require(_0x6028('0x3'));var moment=require('moment');var Redis=require(_0x6028('0x4'));var BPromise=require(_0x6028('0x5'));var config=require(_0x6028('0x6'));var logger=require(_0x6028('0x7'))('zoho');config[_0x6028('0x8')]=_['defaults'](config[_0x6028('0x8')],{'host':_0x6028('0x9'),'port':0x18eb});var io=require(_0x6028('0xa'))(new Redis(config[_0x6028('0x8')]));function emit(_0x560d1a,_0x249ca2,_0x1ddbfa){io['to'](_0x560d1a)[_0x6028('0xb')](_0x249ca2,_0x1ddbfa);}function request(_0x1f39f5){logger['debug']('[HTTP]',JSON[_0x6028('0xc')](_0x1f39f5));return rp(_0x1f39f5);}function getCustomFields(_0x40edcb,_0x28bcaf){var _0x393841={};if(_0x40edcb[_0x6028('0xd')]>0x0){_['forEach'](_0x40edcb,function(_0x3f957d){if(_[_0x6028('0xe')]([_0x6028('0xf'),_0x6028('0x10')],_0x3f957d[_0x6028('0x11')])&&_0x3f957d[_0x6028('0x12')]){_0x393841[_0x3f957d[_0x6028('0x12')]]=_0x3f957d[_0x6028('0x13')][_0x6028('0x14')]();}else if(_0x3f957d[_0x6028('0x11')]===_0x6028('0x15')&&_0x3f957d[_0x6028('0x16')]&&_0x3f957d[_0x6028('0x12')]&&_0x28bcaf[_0x3f957d[_0x6028('0x16')]]){_0x393841[_0x3f957d[_0x6028('0x12')]]=_0x28bcaf[_0x3f957d[_0x6028('0x16')]][_0x6028('0x14')]();}else if(_0x3f957d['type']===_0x6028('0x17')&&_0x3f957d[_0x6028('0x18')]&&_0x3f957d[_0x6028('0x18')]['name']&&_0x3f957d[_0x6028('0x12')]&&_0x28bcaf[_0x3f957d['Variable'][_0x6028('0x19')][_0x6028('0x1a')]()]){_0x393841[_0x3f957d[_0x6028('0x12')]]=_0x28bcaf[_0x3f957d['Variable'][_0x6028('0x19')][_0x6028('0x1a')]()][_0x6028('0x14')]();}});}return _0x393841;}function getName(_0x3143dc){if(_0x3143dc[_0x6028('0x1b')]('\x20')>0x0){var _0x18675f=_0x3143dc['split'](/ (.+)/);if(_0x18675f[0x1]){return _0x18675f;}}return[_0x3143dc,_0x3143dc];}var accountsTokens={};function getAccessToken(_0x317f3b){return new Promise(function(_0xd7738b,_0x2a7526){if(!_[_0x6028('0x1c')](accountsTokens[_0x317f3b['id']])&&!_[_0x6028('0x1c')](accountsTokens[_0x317f3b['id']][_0x6028('0x1d')])){if(moment()[_0x6028('0x1e')](accountsTokens[_0x317f3b['id']]['expires_in'])){_0xd7738b(accountsTokens[_0x317f3b['id']][_0x6028('0x1d')]);}}var _0x5a75ea;switch(_0x317f3b[_0x6028('0x1f')]){case'US':_0x5a75ea='https://accounts.zoho.com';break;case'AU':_0x5a75ea=_0x6028('0x20');break;case'EU':_0x5a75ea=_0x6028('0x21');break;case'IN':_0x5a75ea=_0x6028('0x22');break;case'CN':_0x5a75ea=_0x6028('0x23');break;default:_0x5a75ea=_0x6028('0x21');break;}var _0x2c8211={'method':_0x6028('0x24'),'uri':_0x5a75ea+_0x6028('0x25'),'qs':{'refresh_token':_0x317f3b[_0x6028('0x26')],'client_id':_0x317f3b[_0x6028('0x27')],'client_secret':_0x317f3b[_0x6028('0x28')],'grant_type':_0x6028('0x29')},'json':!![]};return rp(_0x2c8211)['then'](function(_0x4474aa){accountsTokens[_0x317f3b['id']]={'access_token':_0x4474aa['access_token'],'expires_in':moment()[_0x6028('0x2a')](_0x4474aa[_0x6028('0x2b')],_0x6028('0x2c'))};_0xd7738b(_0x4474aa[_0x6028('0x1d')]);})[_0x6028('0x2d')](function(_0x353e31){logger[_0x6028('0x2e')](_0x6028('0x2f'),_0x353e31[_0x6028('0x30')]);_0x2a7526(_0x353e31);});});}function getUser(_0x55d6c7,_0x2ebd98,_0x19bcbb,_0x402d0a){logger[_0x6028('0x31')]('Search\x20user');return request({'method':_0x6028('0x32'),'uri':util[_0x6028('0x33')](_0x6028('0x34'),_0x2ebd98),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x6028('0x35')+_0x55d6c7},'json':!![]})[_0x6028('0x36')](function(_0x4e6266){if(_0x4e6266[_0x6028('0x37')]){var _0x184d6e=-0x1;if(_[_0x6028('0x38')](_0x4e6266[_0x6028('0x37')])){if(!_[_0x6028('0x1c')](_0x402d0a)){_0x184d6e=_['findIndex'](_0x4e6266['users'],function(_0x49324e){return _0x49324e[_0x6028('0x39')]===_0x402d0a;});}if(_0x184d6e>=0x0){logger['info'](_0x6028('0x3a'));}else{logger[_0x6028('0x31')](_0x6028('0x3b'));_0x184d6e=_['findIndex'](_0x4e6266[_0x6028('0x37')],function(_0xd6cea1){return _0xd6cea1['profile'][_0x6028('0x19')]===_0x6028('0x3c');});}return _0x4e6266['users'][_0x184d6e];}else{if(_0x4e6266[_0x6028('0x3d')][_0x6028('0x3e')][_0x6028('0x19')]===_0x6028('0x3c')){logger[_0x6028('0x31')](_0x6028('0x3b'));user=_0x4e6266[_0x6028('0x3d')];return user;}else{logger[_0x6028('0x2e')](_0x6028('0x3f'),JSON[_0x6028('0xc')](_0x4e6266));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6028('0xc')](_0x4e6266));}}}else{logger[_0x6028('0x2e')](_0x6028('0x3f'),JSON[_0x6028('0xc')](_0x4e6266));throw new Error(_0x6028('0x40')+JSON[_0x6028('0xc')](_0x4e6266));}})['catch'](function(_0x47f722){console[_0x6028('0x2e')](_0x47f722);});}function getZohoUser(_0x3171a7,_0x4327bf){return new BPromise(function(_0x566a39,_0x3119eb){request(_0x3171a7)[_0x6028('0x36')](function(_0x311dac){var _0x53395e=null;if(_0x311dac){_0x53395e=_0x311dac[_0x6028('0x41')][0x0];_0x53395e[_0x6028('0x42')]=_0x4327bf;}_0x566a39(_0x53395e);})['catch'](function(_0x55dd77){_0x3119eb(_0x55dd77);});});}function createEndUser(_0x198b7a,_0x182401,_0x26a258,_0x2e29b3,_0x2d7d67,_0x5bb5d2){var _0x26a258=getName(_0x26a258);return request({'method':'POST','uri':_0x6028('0x43')+_0x182401+_0x6028('0x44')+_['startCase'](_0x5bb5d2[_0x6028('0x45')])+'s','body':{'data':[{'Last_Name':_0x26a258[0x1],'First_Name':_0x26a258[0x0],'Phone':_0x2e29b3,'Owner':{'name':!_[_0x6028('0x1c')](_0x2d7d67[_0x6028('0x46')]['name'])?_0x2d7d67[_0x6028('0x46')][_0x6028('0x19')]:!_[_0x6028('0x1c')](_0x2d7d67['first_name'])?_0x2d7d67['first_name']+'\x20'+_0x2d7d67[_0x6028('0x47')]:_0x2d7d67[_0x6028('0x47')],'id':_0x2d7d67['id']}}]},'headers':{'Authorization':_0x6028('0x35')+_0x198b7a},'json':!![]})[_0x6028('0x36')](function(_0xce70a1){if(_0xce70a1&&_0xce70a1[_0x6028('0x41')][0x0][_0x6028('0x48')]===_0x6028('0x49')){var _0x1559c0=_0xce70a1['data'][0x0][_0x6028('0x4a')];_0x1559c0[_0x6028('0x42')]=_['startCase'](_0x5bb5d2[_0x6028('0x45')])+'s';return _0x1559c0;}logger[_0x6028('0x2e')](_0x6028('0x3f'),JSON['stringify'](data));throw new Error(_0x6028('0x4b')+JSON[_0x6028('0xc')](data));})['catch'](function(_0x580c10){console['log'](_0x6028('0x4c'),_0x580c10);});}function getEndUser(_0x210760,_0x406c5c,_0x4abad7,_0x21d069,_0x419a7d,_0x6e60c6,_0x34ef83){var _0x53f4fa={'method':'GET','uri':'','headers':{'Authorization':_0x6028('0x35')+_0x210760},'json':!![]};switch(_0x34ef83[_0x6028('0x4d')]){case'contact_lead':_0x53f4fa[_0x6028('0x4e')]=_0x6028('0x43')+_0x406c5c+_0x6028('0x4f')+_0x419a7d+'))';return getZohoUser(_0x53f4fa,_0x6028('0x50'))[_0x6028('0x36')](function(_0x3033c8){if(_0x3033c8)return _0x3033c8;_0x53f4fa[_0x6028('0x4e')]=_0x6028('0x43')+_0x406c5c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x419a7d+'))';return getZohoUser(_0x53f4fa,_0x6028('0x51'))[_0x6028('0x36')](function(_0x365e6e){if(_0x365e6e)return _0x365e6e;if(_0x34ef83[_0x6028('0x45')]!=_0x6028('0x52')){return createEndUser(_0x210760,_0x406c5c,_0x21d069,_0x419a7d,_0x6e60c6,_0x34ef83);}else{return{};}});});break;case _0x6028('0x53'):_0x53f4fa[_0x6028('0x4e')]=_0x6028('0x43')+_0x406c5c+_0x6028('0x4f')+_0x419a7d+'))';return getZohoUser(_0x53f4fa,_0x6028('0x50'))[_0x6028('0x36')](function(_0x5b1e9e){if(_0x5b1e9e)return _0x5b1e9e;if(_0x34ef83['moduleCreate']!=_0x6028('0x52')){return createEndUser(_0x210760,_0x406c5c,_0x21d069,_0x419a7d,_0x6e60c6,_0x34ef83);}else{return{};}});break;case _0x6028('0x54'):_0x53f4fa[_0x6028('0x4e')]=_0x6028('0x43')+_0x406c5c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x419a7d+'))';return getZohoUser(_0x53f4fa,_0x6028('0x51'))['then'](function(_0x36175b){if(_0x36175b)return _0x36175b;if(_0x34ef83['moduleCreate']!=_0x6028('0x52')){return createEndUser(_0x210760,_0x406c5c,_0x21d069,_0x419a7d,_0x6e60c6,_0x34ef83);}else{return{};}});break;}}function getCall(_0xaafec6,_0x118d3b,_0x199fd6,_0x5669de,_0x470ca7,_0x210323,_0x49da31,_0x1f35d0){logger['info'](_0x6028('0x55'));var _0x11e57a={};_0x11e57a[_0x6028('0x56')]={'name':!_[_0x6028('0x1c')](_0x5669de[_0x6028('0x46')][_0x6028('0x19')])&&!_[_0x6028('0x1c')](_0x5669de['profile'][_0x6028('0x19')])&&_0x5669de[_0x6028('0x3e')][_0x6028('0x19')]===_0x6028('0x57')?_0x5669de[_0x6028('0x46')][_0x6028('0x19')]:!_[_0x6028('0x1c')](_0x5669de[_0x6028('0x58')])?_0x5669de['first_name']+'\x20'+_0x5669de[_0x6028('0x47')]:_0x5669de[_0x6028('0x47')],'id':_0x5669de['id']};_0x11e57a[_0x6028('0x59')]=intUtil['getString'](_0x210323['Subjects'],_0x49da31,'\x20');_0x11e57a[_0x6028('0x5a')]=intUtil[_0x6028('0x5b')](_0x210323['Descriptions'],_0x49da31,'\x0a');if(_0x470ca7[_0x6028('0x42')]===_0x6028('0x50')){_0x11e57a[_0x6028('0x5c')]={'name':!_[_0x6028('0x1c')](_0x470ca7[_0x6028('0x5d')])?_0x470ca7[_0x6028('0x5d')]:!_[_0x6028('0x1c')](_0x470ca7['First_Name'])?_0x470ca7[_0x6028('0x5e')]+'\x20'+_0x470ca7['Last_Name']:_0x470ca7[_0x6028('0x5f')],'id':_0x470ca7['id']};}if(_0x470ca7[_0x6028('0x42')]==='Leads'){_0x11e57a[_0x6028('0x60')]={'name':!_[_0x6028('0x1c')](_0x470ca7[_0x6028('0x5d')])?_0x470ca7[_0x6028('0x5d')]:!_['isNil'](_0x470ca7[_0x6028('0x5e')])?_0x470ca7[_0x6028('0x5e')]+'\x20'+_0x470ca7[_0x6028('0x5f')]:_0x470ca7['Last_Name'],'id':_0x470ca7['id']};_0x11e57a[_0x6028('0x61')]=_[_0x6028('0x62')](_0x470ca7['enduserType']);}if(_0x49da31['talktime']){_0x11e57a[_0x6028('0x63')]=moment[_0x6028('0x64')](parseInt(_0x49da31['talktime'])*0x3e8)[_0x6028('0x33')](_0x6028('0x65'));}else if(_0x49da31[_0x6028('0x66')]&&_0x49da31[_0x6028('0x67')]){_0x11e57a[_0x6028('0x63')]=moment['utc'](moment(_0x49da31[_0x6028('0x67')],_0x6028('0x68'))['diff'](moment(_0x49da31[_0x6028('0x69')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x6028('0x65'));}switch(_0x49da31[_0x6028('0x6a')]){case _0x6028('0x6b'):_0x11e57a[_0x6028('0x6c')]=_0x6028('0x6d');break;case _0x6028('0x6e'):case'connect':_0x11e57a[_0x6028('0x6c')]=_0x6028('0x6f');break;case _0x6028('0x70'):_0x11e57a[_0x6028('0x6c')]=_0x6028('0x71');break;case _0x6028('0x72'):_0x11e57a['Call_Result']=_0x6028('0x73');break;case'timeout':_0x11e57a[_0x6028('0x6c')]=_0x6028('0x74');default:}_0x11e57a[_0x6028('0x75')]=(_0x1f35d0===_0x6028('0x76')?moment(_0x49da31[_0x6028('0x69')])[_0x6028('0x33')](_0x6028('0x68')):moment(_0x49da31[_0x6028('0x77')])[_0x6028('0x33')](_0x6028('0x68')))||moment()[_0x6028('0x33')](_0x6028('0x68'));_0x11e57a[_0x6028('0x78')]=_0x1f35d0||_0x6028('0x79');_0x11e57a=_[_0x6028('0x7a')](_0x11e57a,getCustomFields(_0x210323[_0x6028('0x7b')],_0x49da31));return request({'method':_0x6028('0x24'),'uri':'https://www.zohoapis.'+_0x118d3b+_0x6028('0x7c'),'headers':{'Authorization':_0x6028('0x35')+_0xaafec6},'body':{'data':[_0x11e57a]},'json':!![]})[_0x6028('0x36')](function(_0x433068){if(_0x433068&&_0x433068[_0x6028('0x41')][0x0][_0x6028('0x48')]===_0x6028('0x49')){logger['info'](_0x6028('0x7d'));return{'id':_0x433068[_0x6028('0x41')][0x0]['details']['id']};}})['catch'](function(_0x2a24db){logger['info'](_0x6028('0x7e'),_0x2a24db[_0x6028('0x30')]);console['log']('err',_0x2a24db);});}exports[_0x6028('0x7f')]=function(_0x18c754,_0x2bb2b0,_0x1bfe68,_0x186aec,_0x3c996d,_0x2efdd1){var _0x39ca25,_0x5d270c,_0x595b36;_0x2efdd1[_0x6028('0x80')]=intUtil[_0x6028('0x81')](_0x2efdd1[_0x6028('0x80')]);_0x2efdd1['serverUrl']=intUtil[_0x6028('0x81')](_0x2efdd1[_0x6028('0x82')]);if(_0x3c996d&&_0x3c996d[_0x6028('0x83')]){logger[_0x6028('0x31')](_0x6028('0x84'),_0x6028('0x85'));_0x2bb2b0[_0x6028('0x86')]=_0x2efdd1[_0x6028('0x82')]+_0x6028('0x87')+_0x2bb2b0[_0x6028('0x88')]+_0x6028('0x89')+md5(_0x2bb2b0[_0x6028('0x88')]);}else{_0x2bb2b0[_0x6028('0x86')]='';}var _0xdc2c61=_0x2efdd1['host']===_0x6028('0x8a')?'eu':_0x6028('0x8b');return getAccessToken(_0x2efdd1)[_0x6028('0x36')](function(_0x4c42de){_0x595b36=_0x4c42de;return getUser(_0x595b36,_0xdc2c61,_0x2efdd1,_0x186aec[_0x6028('0x39')]);})[_0x6028('0x36')](function(_0x3c7c13){_0x39ca25=_0x3c7c13;logger['info']('The\x20User\x20ID\x20is:',_0x39ca25['id']);return getEndUser(_0x595b36,_0xdc2c61,_0x2efdd1,_0x2bb2b0['calleridname'],_0x2bb2b0[_0x6028('0x8c')],_0x39ca25,_0x1bfe68);})[_0x6028('0x36')](function(_0x31d835){_0x5d270c=_0x31d835;return getCall(_0x595b36,_0xdc2c61,_0x2efdd1,_0x39ca25,_0x5d270c,_0x1bfe68,_0x2bb2b0,_0x6028('0x79'));})[_0x6028('0x36')](function(_0x1dc730){if(_0x1dc730){logger['info'](_0x6028('0x8d'),_0x1dc730['id']);logger[_0x6028('0x31')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6028('0x33')](_0x6028('0x8e'),_0x186aec[_0x6028('0x19')]),'trigger:browser:url',{'uri':_0x6028('0x8f')+_0x2efdd1['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1dc730['id']});}})[_0x6028('0x2d')](function(_0xc642d2){logger[_0x6028('0x2e')](_0x6028('0x84'),JSON[_0x6028('0xc')](_0xc642d2));});};exports[_0x6028('0x76')]=function(_0x569e91,_0x50525e,_0x589964,_0x395224,_0x18687a,_0x151a78,_0x4c1c87){var _0x55fb9a,_0x42f1d1,_0x51f4fc;_0x151a78[_0x6028('0x80')]=intUtil[_0x6028('0x81')](_0x151a78[_0x6028('0x80')]);_0x151a78[_0x6028('0x82')]=intUtil[_0x6028('0x81')](_0x151a78['serverUrl']);if(_0x4c1c87&&_0x4c1c87[_0x6028('0x90')]&&_0x4c1c87[_0x6028('0x90')]!=='none'){logger[_0x6028('0x31')](_0x6028('0x91'),_0x6028('0x85'));_0x50525e[_0x6028('0x86')]=_0x151a78['serverUrl']+_0x6028('0x87')+_0x50525e[_0x6028('0x88')]+_0x6028('0x89')+md5(_0x50525e[_0x6028('0x88')]);}var _0x1a9931=_0x151a78[_0x6028('0x80')]===_0x6028('0x8a')?'eu':_0x6028('0x8b');return getAccessToken(_0x151a78)['then'](function(_0x142ac2){_0x51f4fc=_0x142ac2;return getUser(_0x51f4fc,_0x1a9931,_0x151a78,_0x395224[_0x6028('0x39')]);})[_0x6028('0x36')](function(_0x477419){_0x55fb9a=_0x477419;logger[_0x6028('0x31')]('The\x20User\x20ID\x20is:',_0x55fb9a['id']);return getEndUser(_0x51f4fc,_0x1a9931,_0x151a78,_0x50525e[_0x6028('0x92')],_0x50525e[_0x6028('0x93')],_0x55fb9a,_0x589964);})['then'](function(_0x2ea38b){_0x42f1d1=_0x2ea38b;return getCall(_0x51f4fc,_0x1a9931,_0x151a78,_0x55fb9a,_0x42f1d1,_0x589964,_0x50525e,_0x6028('0x94'));})['then'](function(_0x421418){if(_0x421418){logger['info']('The\x20Call\x20ID\x20is:',_0x421418['id']);logger['info']('[OUTBOUND]',_0x6028('0x95'));emit(util[_0x6028('0x33')]('user:%s',_0x395224[_0x6028('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x151a78[_0x6028('0x80')]+_0x6028('0x96')+_0x421418['id']});}})['catch'](function(_0x2b4438){logger[_0x6028('0x2e')](_0x6028('0x91'),JSON['stringify'](_0x2b4438));});};exports[_0x6028('0x97')]=function(_0xc60923,_0x45a7a5,_0x3bbec7,_0x29c8fa,_0x21e15e,_0x4fbfaf){var _0x4fc30d,_0x4fa841,_0x1b03dc;_0x4fbfaf[_0x6028('0x80')]=intUtil[_0x6028('0x81')](_0x4fbfaf[_0x6028('0x80')]);_0x4fbfaf['serverUrl']=intUtil[_0x6028('0x81')](_0x4fbfaf['serverUrl']);if(_0x21e15e&&_0x21e15e[_0x6028('0x83')]){logger['info']('['+_0x45a7a5[_0x6028('0x6a')][_0x6028('0x98')]()+']','Recording\x20is\x20enabled!');_0x45a7a5['recordingURL']=_0x4fbfaf[_0x6028('0x82')]+_0x6028('0x87')+_0x45a7a5[_0x6028('0x88')]+_0x6028('0x89')+md5(_0x45a7a5[_0x6028('0x88')]);}else{_0x45a7a5[_0x6028('0x86')]='';}var _0x53fa10=_0x4fbfaf[_0x6028('0x80')]===_0x6028('0x8a')?'eu':_0x6028('0x8b');return getAccessToken(_0x4fbfaf)['then'](function(_0xee379a){_0x1b03dc=_0xee379a;return getUser(_0x1b03dc,_0x53fa10,_0x4fbfaf);})[_0x6028('0x36')](function(_0x119249){_0x4fc30d=_0x119249;logger[_0x6028('0x31')](_0x6028('0x99'),_0x4fc30d['id']);return getEndUser(_0x1b03dc,_0x53fa10,_0x4fbfaf,_0x45a7a5[_0x6028('0x9a')],_0x45a7a5[_0x6028('0x8c')],_0x4fc30d,_0x3bbec7);})[_0x6028('0x36')](function(_0x3ac156){_0x4fa841=_0x3ac156;return getCall(_0x1b03dc,_0x53fa10,_0x4fbfaf,_0x4fc30d,_0x4fa841,_0x3bbec7,_0x45a7a5,'Inbound');})['then'](function(_0x1fb8a8){if(_0x1fb8a8){logger[_0x6028('0x31')](_0x6028('0x8d'),_0x1fb8a8['id']);}})[_0x6028('0x2d')](function(_0x4391b4){logger[_0x6028('0x2e')]('['+_0x45a7a5[_0x6028('0x6a')]['toUpperCase']()+']',JSON[_0x6028('0xc')](_0x4391b4));});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 0ff7bf6..bc75270 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 _0x49f3=['data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','Script'];(function(_0x3e34b1,_0x4a32ab){var _0x521ca0=function(_0x1ccdb2){while(--_0x1ccdb2){_0x3e34b1['push'](_0x3e34b1['shift']());}};_0x521ca0(++_0x4a32ab);}(_0x49f3,0xb9));var _0x349f=function(_0x51f571,_0x24da3e){_0x51f571=_0x51f571-0x0;var _0x329162=_0x49f3[_0x51f571];return _0x329162;};'use strict';var util=require(_0x349f('0x0'));var sh=require(_0x349f('0x1'));var Mustache=require(_0x349f('0x2'));var logger=require(_0x349f('0x3'))(_0x349f('0x4'));exports[_0x349f('0x5')]=function(_0x1d1b29,_0x19c855){var _0x5efea=_0x1d1b29['data2']?_0x1d1b29['data2']:_0x349f('0x6');var _0xf316b9=_0x1d1b29[_0x349f('0x7')]?Mustache[_0x349f('0x8')](_0x1d1b29[_0x349f('0x7')],_0x19c855):_0x19c855;sh[_0x349f('0x5')](_0xf316b9,function(_0x54b361,_0x45fb90,_0x1b8b5f){if(_0x54b361!==0x0){logger[_0x349f('0x9')](util['format'](_0x349f('0xa'),_0x5efea,_0xf316b9,_0x54b361,_0x1b8b5f));}else{logger['info'](util['format'](_0x349f('0xb'),_0x5efea,_0xf316b9,_0x45fb90));}});}; \ No newline at end of file +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 diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 94dec63..67fdd34 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 _0xe03e=['catch','error','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','GET','DELETE','POST','PUT','data7','parse','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode'];(function(_0x4d63b6,_0x51bfae){var _0x441713=function(_0x17f160){while(--_0x17f160){_0x4d63b6['push'](_0x4d63b6['shift']());}};_0x441713(++_0x51bfae);}(_0xe03e,0x1a7));var _0xee03=function(_0x5cb9eb,_0x3d84ac){_0x5cb9eb=_0x5cb9eb-0x0;var _0x4898f5=_0xe03e[_0x5cb9eb];return _0x4898f5;};'use strict';var rp=require(_0xee03('0x0'));var util=require(_0xee03('0x1'));var _=require(_0xee03('0x2'));var Mustache=require(_0xee03('0x3'));var logger=require(_0xee03('0x4'))(_0xee03('0x5'));exports[_0xee03('0x6')]=function(_0x20797e,_0x3eb620){var _0x27bc05,_0x49f700;var _0x1b9b6d={'method':_0x20797e[_0xee03('0x7')][_0xee03('0x8')](),'uri':Mustache[_0xee03('0x9')](_0x20797e[_0xee03('0xa')],_0x3eb620),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x20797e[_0xee03('0xb')])===_0xee03('0xc')&&parseInt(_0x20797e[_0xee03('0xb')])>=0x1&&parseInt(_0x20797e['data5'])<=0xa?parseInt(_0x20797e['data5'])*0x3e8:0x5*0x3e8};try{_0x1b9b6d[_0xee03('0xd')]=_0x20797e[_0xee03('0xe')]?JSON['parse'](Mustache[_0xee03('0x9')](_0x20797e[_0xee03('0xe')],_0x3eb620)):{};}catch(_0x171874){logger['error'](_0x171874['stack']);}switch(_0x20797e[_0xee03('0x7')][_0xee03('0x8')]()){case _0xee03('0xf'):case _0xee03('0x10'):_0x27bc05=null;_0x1b9b6d['qs']=_0x3eb620;break;case _0xee03('0x11'):case _0xee03('0x12'):if(_0x20797e[_0xee03('0x13')]){try{_0x27bc05=JSON[_0xee03('0x14')](Mustache[_0xee03('0x9')](_0x20797e[_0xee03('0x13')],_0x3eb620));_0x1b9b6d[_0xee03('0x15')]=_0x27bc05;}catch(_0x302c9b){logger['error'](_0x302c9b[_0xee03('0x16')]);logger['error'](_0xee03('0x17'));}}else{_0x27bc05=_0x3eb620;_0x1b9b6d[_0xee03('0x15')]=_0x27bc05;}break;}logger[_0xee03('0x18')](util['format'](_0xee03('0x19'),_0x20797e[_0xee03('0x7')],_0x20797e[_0xee03('0xa')],JSON[_0xee03('0x1a')](_0x1b9b6d)));rp(_0x1b9b6d)[_0xee03('0x1b')](function(_0x40aceb){_0x27bc05=!_['isNil'](_0x27bc05)?_0xee03('0x1c')+_0x27bc05:'';_0x49f700=typeof _0x40aceb[_0xee03('0x15')]===_0xee03('0x1d')?JSON[_0xee03('0x1a')](_0x40aceb['body']):_0x40aceb[_0xee03('0x15')];logger['info'](util[_0xee03('0x1e')](_0xee03('0x1f'),_0x20797e['data1'],_0x20797e['data2'],_0x40aceb[_0xee03('0x20')],_0x49f700));})[_0xee03('0x21')](function(_0x10fe64){logger[_0xee03('0x22')](util[_0xee03('0x1e')](_0xee03('0x23'),_0x20797e[_0xee03('0x7')],_0x20797e['data2'],_0x10fe64['statusCode'],_0x10fe64[_0xee03('0x24')],_0x10fe64[_0xee03('0x25')]));});}; \ No newline at end of file +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 diff --git a/server/services/email/client.js b/server/services/email/client.js index 8ed77bd..8307cb3 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 _0xac82=['routing','client','http','Request','then','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x252030,_0x2ef316){var _0x51ab93=function(_0x3dfaa6){while(--_0x3dfaa6){_0x252030['push'](_0x252030['shift']());}};_0x51ab93(++_0x2ef316);}(_0xac82,0xeb));var _0x2ac8=function(_0x4248fb,_0x131f47){_0x4248fb=_0x4248fb-0x0;var _0x4e2b6d=_0xac82[_0x4248fb];return _0x4e2b6d;};'use strict';var jayson=require(_0x2ac8('0x0'));var BPromise=require(_0x2ac8('0x1'));var logger=require(_0x2ac8('0x2'))(_0x2ac8('0x3'));var client=jayson[_0x2ac8('0x4')][_0x2ac8('0x5')]({'port':0x2329});client[_0x2ac8('0x6')]=function(_0x4f5151,_0x4b0ad7){return new BPromise(function(_0x1ceb3b,_0x10cb9c){return client['request'](_0x4f5151,_0x4b0ad7)[_0x2ac8('0x7')](function(_0x3bc5bd){logger[_0x2ac8('0x8')](_0x2ac8('0x9'),'routing',_0x4f5151,_0x4b0ad7,_0x3bc5bd);if(_0x3bc5bd[_0x2ac8('0xa')]){logger[_0x2ac8('0xa')]('rpc',_0x2ac8('0x3'),_0x4f5151,_0x3bc5bd[_0x2ac8('0xa')][_0x2ac8('0xb')],_0x4b0ad7);return _0x10cb9c(_0x3bc5bd[_0x2ac8('0xa')][_0x2ac8('0xb')]);}else{return _0x1ceb3b(_0x3bc5bd[_0x2ac8('0xc')]);}})[_0x2ac8('0xd')](function(_0x467a80){logger[_0x2ac8('0xa')](_0x2ac8('0x9'),_0x2ac8('0x3'),_0x4f5151,_0x467a80,_0x4b0ad7);return _0x10cb9c(_0x467a80);});});};module['exports']=client; \ No newline at end of file +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 diff --git a/server/services/email/index.js b/server/services/email/index.js index bc088ff..de85ac0 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 _0x6060=['then','initMailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','getMailAccounts'];(function(_0x2ff893,_0x1396fe){var _0x56d16f=function(_0x325cf3){while(--_0x325cf3){_0x2ff893['push'](_0x2ff893['shift']());}};_0x56d16f(++_0x1396fe);}(_0x6060,0x148));var _0x0606=function(_0x26a490,_0x1d54cf){_0x26a490=_0x26a490-0x0;var _0x4f14c1=_0x6060[_0x26a490];return _0x4f14c1;};'use strict';var server=require(_0x0606('0x0'));var Realtime=require(_0x0606('0x1'));var EmailChannel=require(_0x0606('0x2'));var mailAccount=require(_0x0606('0x3'));var setting=require(_0x0606('0x4'));var logger=require(_0x0606('0x5'))(_0x0606('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x0606('0x7')]())[_0x0606('0x8')](realtime[_0x0606('0x9')]())[_0x0606('0x8')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x0606('0xa')](realtime,email)[_0x0606('0x8')](function(){return initRealtime();})[_0x0606('0x8')](function(){return setting[_0x0606('0xb')]();})[_0x0606('0x8')](function(_0x58e5e6){return setInterval(initRealtime,_0x58e5e6[_0x0606('0xc')]*0x3e8);})[_0x0606('0xd')](function(_0x4961ef){logger[_0x0606('0xe')](_0x0606('0xf'),_0x4961ef);});}main(); \ No newline at end of file +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 diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c4575d7..e361f7c 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 _0xfeed=['lastSync','verify','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','custom','service','box','handleImapBox','bind','handleImapEmail','error','disabled','emit','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','handleImapError','sendMail','smtp','send','verifySmtp','Smtp'];(function(_0x246358,_0x1b1f8e){var _0x329b3f=function(_0x2bbd8f){while(--_0x2bbd8f){_0x246358['push'](_0x246358['shift']());}};_0x329b3f(++_0x1b1f8e);}(_0xfeed,0x70));var _0xdfee=function(_0x48d044,_0x716b1a){_0x48d044=_0x48d044-0x0;var _0x73901a=_0xfeed[_0x48d044];return _0x73901a;};'use strict';var _=require('lodash');var moment=require(_0xdfee('0x0'));var BPromise=require(_0xdfee('0x1'));var md5=require(_0xdfee('0x2'));var Redis=require(_0xdfee('0x3'));var config=require(_0xdfee('0x4'));var logger=require('../../../config/logger')(_0xdfee('0x5'));config[_0xdfee('0x6')]=_[_0xdfee('0x7')](config[_0xdfee('0x6')],{'host':_0xdfee('0x8'),'port':0x18eb});var io=require(_0xdfee('0x9'))(new Redis(config[_0xdfee('0x6')]));var EmailImap=require(_0xdfee('0xa'));var EmailSmtp=require(_0xdfee('0xb'));var mailAccount=require(_0xdfee('0xc'));var md5Accounts={};function EmailChannel(_0x3a0a73){logger[_0xdfee('0xd')](_0xdfee('0xe'));this['mailAccounts']=_0x3a0a73[_0xdfee('0xf')];this[_0xdfee('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xdfee('0x11')]['emit']=function(_0x6c1d01){var _0xfde121=this[_0xdfee('0xf')][_0x6c1d01];var _0x24df82={'id':_0xfde121['id'],'name':_0xfde121['name'],'key':_0xfde121[_0xdfee('0x12')],'active':_0xfde121[_0xdfee('0x13')],'Imap':{'status':_0xfde121[_0xdfee('0x14')][_0xdfee('0x15')],'messageStatus':_0xfde121['Imap'][_0xdfee('0x16')],'total':_0xfde121[_0xdfee('0x14')][_0xdfee('0x17')]}};if(_[_0xdfee('0x18')](md5Accounts[_0x6c1d01])){md5Accounts[_0x6c1d01]={};}var _0x362164=md5(JSON[_0xdfee('0x19')](_0x24df82));if(md5Accounts[_0x6c1d01][_0xdfee('0x2')]!==_0x362164){md5Accounts[_0x6c1d01][_0xdfee('0x2')]=_0x362164;io['emit'](_0xdfee('0x1a'),_0x24df82);}};EmailChannel[_0xdfee('0x11')][_0xdfee('0x1b')]=function(_0xd10c18){for(var _0xd4fb81 in _0xd10c18){if(_0xd10c18[_0xdfee('0x1c')](_0xd4fb81)){if(_0xd10c18[_0xd4fb81]['Imap']&&_0xd10c18[_0xd4fb81][_0xdfee('0x13')]){var _0x4dc20d=_0xd10c18[_0xd4fb81][_0xdfee('0x14')];if(!_0x4dc20d['service']&&_0xd10c18[_0xd4fb81]['provider']!==_0xdfee('0x1d'))_0x4dc20d[_0xdfee('0x1e')]=_0xd10c18[_0xd4fb81]['provider'];if(!this[_0xdfee('0x10')]['hasOwnProperty'](_0x4dc20d['id'])){this[_0xdfee('0x10')][_0x4dc20d['id']]=new EmailImap(_0x4dc20d,_0xd10c18[_0xd4fb81]['email']);this[_0xdfee('0x10')][_0x4dc20d['id']]['on'](_0xdfee('0x1f'),this[_0xdfee('0x20')][_0xdfee('0x21')](this,_0xd4fb81));this[_0xdfee('0x10')][_0x4dc20d['id']]['on'](_0xdfee('0x5'),this[_0xdfee('0x22')][_0xdfee('0x21')](this,_0xd4fb81));this[_0xdfee('0x10')][_0x4dc20d['id']]['on']('end',this['handleImapEnd']['bind'](this,_0xd4fb81));this[_0xdfee('0x10')][_0x4dc20d['id']]['on'](_0xdfee('0x23'),this['handleImapError']['bind'](this,_0xd4fb81));}}else{if(_[_0xdfee('0x18')](this[_0xdfee('0xf')][_0xd4fb81][_0xdfee('0x14')])){this[_0xdfee('0xf')][_0xd4fb81][_0xdfee('0x14')]={};}this[_0xdfee('0xf')][_0xd4fb81][_0xdfee('0x14')][_0xdfee('0x15')]=_0xdfee('0x24');this['mailAccounts'][_0xd4fb81]['Imap'][_0xdfee('0x16')]='';this[_0xdfee('0x25')](_0xd4fb81);}}}};EmailChannel[_0xdfee('0x11')][_0xdfee('0x20')]=function(_0xb71594,_0x352371){if(this[_0xdfee('0xf')][_0xb71594]){this[_0xdfee('0xf')][_0xb71594]['Imap'][_0xdfee('0x15')]=_0xdfee('0x26');this[_0xdfee('0xf')][_0xb71594][_0xdfee('0x14')]['messageStatus']=_0x352371['name'];if(_0x352371[_0xdfee('0x27')]){this[_0xdfee('0xf')][_0xb71594]['Imap'][_0xdfee('0x17')]=_0x352371[_0xdfee('0x27')][_0xdfee('0x17')];}return this[_0xdfee('0x25')](_0xb71594);}};EmailChannel[_0xdfee('0x11')][_0xdfee('0x22')]=function(_0x4c455e,_0x4a7ff4){logger[_0xdfee('0xd')](_0xdfee('0x28'),_0x4a7ff4[_0xdfee('0x29')],_0x4a7ff4['lastName'],_0x4a7ff4[_0xdfee('0x2a')],_0x4c455e);if(this[_0xdfee('0xf')][_0x4c455e]){return mailAccount[_0xdfee('0x2b')](_0x4c455e,_0x4a7ff4)[_0xdfee('0x2c')](function(_0x15cf8b){if(_0x15cf8b){logger['info'](_0xdfee('0x2d'));}})[_0xdfee('0x2e')](function(_0x58a09a){logger[_0xdfee('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x58a09a));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x20a5a8){if(this[_0xdfee('0xf')][_0x20a5a8]&&this['mailAccounts'][_0x20a5a8][_0xdfee('0x14')]){if(this[_0xdfee('0x10')][this[_0xdfee('0xf')][_0x20a5a8]['Imap']['id']]){delete this[_0xdfee('0x10')][this[_0xdfee('0xf')][_0x20a5a8]['Imap']['id']];}this[_0xdfee('0xf')][_0x20a5a8][_0xdfee('0x14')]['lastSync']=moment();this[_0xdfee('0x25')](_0x20a5a8);}};EmailChannel[_0xdfee('0x11')][_0xdfee('0x2f')]=function(_0x25ba8b,_0xb99965){if(this['mailAccounts'][_0x25ba8b]){this[_0xdfee('0xf')][_0x25ba8b][_0xdfee('0x14')][_0xdfee('0x15')]=_0xdfee('0x23');this[_0xdfee('0xf')][_0x25ba8b][_0xdfee('0x14')][_0xdfee('0x16')]=_0xb99965;return this[_0xdfee('0x25')](_0x25ba8b);}};EmailChannel[_0xdfee('0x11')][_0xdfee('0x30')]=function(_0x3b783f,_0x3e07b6){return this[_0xdfee('0x31')][_0xdfee('0x32')](_0x3b783f,_0x3e07b6);};EmailChannel[_0xdfee('0x11')][_0xdfee('0x33')]=function(_0x4089bc){var _0x506919=this;if(this[_0xdfee('0xf')][_0x4089bc['id']]){if(_[_0xdfee('0x18')](this['mailAccounts'][_0x4089bc['id']]['Smtp'])){this[_0xdfee('0xf')][_0x4089bc['id']][_0xdfee('0x34')]={};}this[_0xdfee('0xf')][_0x4089bc['id']]['Smtp'][_0xdfee('0x35')]=moment();return new BPromise(function(_0xcdbf79,_0x3fedef){return _0x506919[_0xdfee('0x31')]['verify'](_0x4089bc)[_0xdfee('0x2c')](function(_0x1848f4){_0x506919[_0xdfee('0xf')][_0x4089bc['id']]['Smtp'][_0xdfee('0x15')]='verified';_0x506919[_0xdfee('0xf')][_0x4089bc['id']][_0xdfee('0x34')][_0xdfee('0x16')]='';_0x506919[_0xdfee('0x25')](_0x4089bc['id']);_0xcdbf79(_0x1848f4);})[_0xdfee('0x2e')](function(_0x4556da){_0x506919[_0xdfee('0xf')][_0x4089bc['id']][_0xdfee('0x34')][_0xdfee('0x15')]=_0xdfee('0x23');_0x506919[_0xdfee('0xf')][_0x4089bc['id']][_0xdfee('0x34')][_0xdfee('0x16')]=_0x4556da;_0x506919[_0xdfee('0x25')](_0x4089bc['id']);_0x3fedef(_0x4556da);});});}return this['smtp'][_0xdfee('0x36')](_0x4089bc);};module['exports']=EmailChannel; \ No newline at end of file +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 diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a5d072f..45fc9f8 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 _0x26bd=['account','handleFetchEnd','handleFetchError','closeBox','textCode','hasOwnProperty','upperFirst','exports','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','once','ready','handleReady','handleEnd','bind','connect','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','message','error','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0xc9693a,_0x6eee5e){var _0x107e43=function(_0x46e1bf){while(--_0x46e1bf){_0xc9693a['push'](_0xc9693a['shift']());}};_0x107e43(++_0x6eee5e);}(_0x26bd,0x104));var _0xd26b=function(_0x3d65e3,_0x9a6ccc){_0x3d65e3=_0x3d65e3-0x0;var _0x4b8f69=_0x26bd[_0x3d65e3];return _0x4b8f69;};'use strict';var _=require('lodash');var util=require(_0xd26b('0x0'));var Imap=require(_0xd26b('0x1'));var simpleParser=require('mailparser')[_0xd26b('0x2')];var Iconv=require(_0xd26b('0x3'))[_0xd26b('0x4')];var EventEmitter=require(_0xd26b('0x5'))[_0xd26b('0x6')];var utils=require(_0xd26b('0x7'));var logger=require(_0xd26b('0x8'))(_0xd26b('0x9'));function EmailImap(_0xd9ed72,_0x5e0dd8){this[_0xd26b('0xa')]=_0xd9ed72[_0xd26b('0xa')];this['account']=this[_0xd26b('0xb')](_0xd9ed72,_0x5e0dd8);this['imap']=new Imap(this['account']);this['imap'][_0xd26b('0xc')](_0xd26b('0xd'),this[_0xd26b('0xe')]['bind'](this));this['imap'][_0xd26b('0xc')]('end',this[_0xd26b('0xf')][_0xd26b('0x10')](this));this[_0xd26b('0x1')]['on']('error',this['handleError']['bind'](this));this[_0xd26b('0x1')][_0xd26b('0x11')]();}util[_0xd26b('0x12')](EmailImap,EventEmitter);EmailImap[_0xd26b('0x13')][_0xd26b('0xb')]=function(_0x28c9f4,_0x5695e6){var _0x446dae={'connTimeout':_0x28c9f4['connTimeout']?_0x28c9f4[_0xd26b('0x14')]*0x3e8:0x2710,'authTimeout':_0x28c9f4[_0xd26b('0x15')]?_0x28c9f4[_0xd26b('0x15')]*0x3e8:0x1388};if(_0x28c9f4[_0xd26b('0x16')]){_0x446dae['user']=_0x28c9f4[_0xd26b('0x17')];if(_0x28c9f4['modernAuthentication']){_0x446dae['xoauth2']=utils[_0xd26b('0x18')](_0x28c9f4['CloudProvider'][_0xd26b('0x19')],_0x28c9f4[_0xd26b('0x17')]);}else{_0x446dae[_0xd26b('0x1a')]=_0x28c9f4[_0xd26b('0x1a')];}}else{if(_0x28c9f4[_0xd26b('0x1b')]){_0x446dae[_0xd26b('0x17')]=_0x28c9f4[_0xd26b('0x17')];_0x446dae[_0xd26b('0x1a')]=_0x28c9f4[_0xd26b('0x1a')];}}_0x446dae['email']=_0x5695e6||_0x28c9f4['user']||_0xd26b('0x1c');_0x446dae[_0xd26b('0x1d')]=_0x28c9f4[_0xd26b('0x1d')];_0x446dae[_0xd26b('0x1e')]=_0x28c9f4[_0xd26b('0x1e')]||0x3e1;if(_0x28c9f4['tls']){_0x446dae[_0xd26b('0x1f')]=!![];}else{_0x446dae['tls']=![];_0x446dae[_0xd26b('0x20')]=_0xd26b('0x21');}return _0x446dae;};EmailImap[_0xd26b('0x13')][_0xd26b('0xe')]=function(){this['imap'][_0xd26b('0x22')](this[_0xd26b('0xa')],![],this[_0xd26b('0x23')]['bind'](this));};EmailImap['prototype'][_0xd26b('0x23')]=function(_0x4569f2,_0x174b2e){if(_0x4569f2){this[_0xd26b('0x24')](_0x4569f2,!![]);}else{this[_0xd26b('0x25')](_0xd26b('0x26'),_0x174b2e);this[_0xd26b('0x27')]();}};EmailImap['prototype'][_0xd26b('0x28')]=function(_0x4393f4){if(_0x4393f4){this[_0xd26b('0x24')](_0x4393f4,!![]);}else{this['imap'][_0xd26b('0x29')]();}};EmailImap['prototype'][_0xd26b('0x27')]=function(){this['imap'][_0xd26b('0x2a')]([_0xd26b('0x2b')],this[_0xd26b('0x2c')][_0xd26b('0x10')](this));};EmailImap[_0xd26b('0x13')]['handleReadUnseen']=function(_0x7d7348,_0x380627){if(_0x7d7348){this[_0xd26b('0x24')](_0x7d7348,!![]);}else{if(_0x380627[_0xd26b('0x2d')]){try{var _0x5baa1f=this[_0xd26b('0x1')]['fetch'](_0x380627,{'bodies':'','markSeen':!![]});_0x5baa1f['on'](_0xd26b('0x2e'),this['handleFetchMessage'][_0xd26b('0x10')](this));_0x5baa1f[_0xd26b('0xc')](_0xd26b('0x2f'),this['handleFetchError'][_0xd26b('0x10')](this));_0x5baa1f[_0xd26b('0xc')](_0xd26b('0x29'),this['handleFetchEnd'][_0xd26b('0x10')](this));}catch(_0x43630f){logger[_0xd26b('0x2f')](_0x43630f);}}else{this[_0xd26b('0x1')]['closeBox'](!![],this[_0xd26b('0x28')][_0xd26b('0x10')](this));}}};EmailImap['prototype'][_0xd26b('0x30')]=function(_0x4a6f31){_0x4a6f31['on'](_0xd26b('0x31'),this[_0xd26b('0x32')][_0xd26b('0x10')](this));_0x4a6f31['once'](_0xd26b('0x33'),this[_0xd26b('0x34')][_0xd26b('0x10')](this));_0x4a6f31['once']('end',this[_0xd26b('0x35')][_0xd26b('0x10')](this));};EmailImap[_0xd26b('0x13')][_0xd26b('0x32')]=function(_0x1227a6){simpleParser(_0x1227a6,{'Iconv':Iconv},this[_0xd26b('0x36')][_0xd26b('0x10')](this));};EmailImap[_0xd26b('0x13')][_0xd26b('0x34')]=function(){};EmailImap[_0xd26b('0x13')][_0xd26b('0x35')]=function(){};EmailImap[_0xd26b('0x13')]['handleSimpleParser']=function(_0x4d79f9,_0x460a3f){if(_0x4d79f9){logger['error'](_0x4d79f9);}else{var _0x553b19=this;utils['parser'](this[_0xd26b('0x37')],_0x460a3f,function(_0x3e71ec){_0x553b19[_0xd26b('0x25')](_0xd26b('0x9'),_0x3e71ec);});}};EmailImap[_0xd26b('0x13')][_0xd26b('0x38')]=function(){this[_0xd26b('0x1')]['closeBox'](!![],this[_0xd26b('0x28')][_0xd26b('0x10')](this));};EmailImap[_0xd26b('0x13')][_0xd26b('0x39')]=function(_0x6a7787){this[_0xd26b('0x24')](_0x6a7787);this[_0xd26b('0x1')][_0xd26b('0x3a')](!![],this[_0xd26b('0x28')][_0xd26b('0x10')](this));};EmailImap[_0xd26b('0x13')][_0xd26b('0xf')]=function(){this[_0xd26b('0x25')]('end');};EmailImap[_0xd26b('0x13')][_0xd26b('0x24')]=function(_0x299f22,_0x4258f7){logger[_0xd26b('0x2f')](_0xd26b('0x24'),this[_0xd26b('0x37')]['email'],JSON['stringify'](_0x299f22));var _0x20d1b7='';if(_0x299f22){if(_0x299f22['textCode']){_0x20d1b7=_0x299f22[_0xd26b('0x3b')];}else{for(var _0x5cdb01 in _0x299f22){if(_0x299f22[_0xd26b('0x3c')](_0x5cdb01)){_0x20d1b7+=_[_0xd26b('0x3d')](_0x5cdb01)+':\x20'+_0x299f22[_0x5cdb01]+'\x0a';}}}}if(_0x4258f7){this[_0xd26b('0x1')][_0xd26b('0x29')]();}else{this[_0xd26b('0x25')](_0xd26b('0x2f'),_0x20d1b7);this[_0xd26b('0x25')](_0xd26b('0x29'));}};module[_0xd26b('0x3e')]=EmailImap; \ No newline at end of file +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 diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2643f44..32ffbe7 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 _0xac1d=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired','exports'];(function(_0x53b27a,_0x23abfe){var _0x3beee3=function(_0x4d5c54){while(--_0x4d5c54){_0x53b27a['push'](_0x53b27a['shift']());}};_0x3beee3(++_0x23abfe);}(_0xac1d,0x136));var _0xdac1=function(_0x75928e,_0x2104c1){_0x75928e=_0x75928e-0x0;var _0x56495a=_0xac1d[_0x75928e];return _0x56495a;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xdac1('0x0'));function EmailSmtp(){}EmailSmtp[_0xdac1('0x1')][_0xdac1('0x2')]=function(_0x5d9c6c,_0x4c8a5e){return new Promise(function(_0x4eac4d,_0x2dfe1e){var _0x13a275=nodemailer[_0xdac1('0x3')](_0x5d9c6c);_0x13a275[_0xdac1('0x4')]('compile',inlineBase64());_0x13a275[_0xdac1('0x5')](_0x4c8a5e,function(_0x4807c9,_0x46282a){if(_0x4807c9){_0x2dfe1e(_0x4807c9[_0xdac1('0x6')]());}else{_0x4eac4d(_0x46282a);}});});};EmailSmtp[_0xdac1('0x1')][_0xdac1('0x7')]=function(_0x2f77a1){return new Promise(function(_0x280318,_0x1ab9f9){var _0x9852ec=nodemailer[_0xdac1('0x3')](_0x2f77a1);_0x9852ec['verify'](function(_0x166f77,_0x48b0ff){if(_0x166f77){_0x1ab9f9(_0x166f77[_0xdac1('0x6')]());}else{if(_0x48b0ff){_0x280318(_0x48b0ff);}else{_0x1ab9f9(_0xdac1('0x8'));}}});});};module[_0xdac1('0x9')]=EmailSmtp; \ No newline at end of file +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 diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 856d7a3..f303687 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 _0xe348=['contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','toString','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','../../../config/environment','head','value','address','generate','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','anonymous','@xcally.com','html','test','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x46e971[_0x8e34('0x10')](0x0,-0x1)[_0x8e34('0x11')]('\x20'):_0x48c4ec['name'];}return _0x8e34('0x12');}function getLastName(_0x4ce0e2){var _0x380497=_[_0x8e34('0x7')](_0x4ce0e2[_0x8e34('0x8')]);if(_0x380497&&_0x380497[_0x8e34('0xb')]){var _0x149808=_0x380497[_0x8e34('0xb')][_0x8e34('0xe')](/\s+/);return _0x149808[_0x8e34('0xf')]>0x1?_0x149808[_0x8e34('0x13')]():'';}return'';}function getMails(_0x27154c,_0xd6bbec){var _0x507234='';for(var _0xf26659=0x0;_0xf26659<_0xd6bbec['value'][_0x8e34('0xf')];_0xf26659+=0x1){if(_0xd6bbec[_0x8e34('0x8')][_0xf26659]['address']!==_0x27154c){if(!_[_0x8e34('0x14')](_0x507234)){_0x507234+=',';}_0x507234+=_0xd6bbec[_0x8e34('0x8')][_0xf26659]['name']||_0xd6bbec[_0x8e34('0x8')][_0xf26659]['address']||'';_0x507234+='\x20<';_0x507234+=_0xd6bbec[_0x8e34('0x8')][_0xf26659][_0x8e34('0x9')]?_0xd6bbec[_0x8e34('0x8')][_0xf26659]['address']:_0x8e34('0x15')+random[_0x8e34('0xa')](0x6)+_0x8e34('0x16');_0x507234+='>';}}return _0x507234;}function parseEmail(_0x27e8fe,_0x507c87,_0x43ccd6){if(_0x507c87[_0x8e34('0x17')]){var _0x4f5444=/)<[^<]*)*<\/script>/gi;while(_0x4f5444[_0x8e34('0x18')](_0x507c87[_0x8e34('0x17')])){_0x507c87[_0x8e34('0x17')]=_0x507c87[_0x8e34('0x17')]['replace'](_0x4f5444,'');}if(_0x507c87[_0x8e34('0x17')][_0x8e34('0x19')](_0x8e34('0x1a'))){var _0x3c4134=[];_0x507c87[_0x8e34('0x1b')]['forEach'](_0x143bb7=>{_0x3c4134[_0x8e34('0x1c')](_0x143bb7['filename']);});var _0x5f54c5=/]+>/g;var _0x456ad4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x347570=_0x507c87[_0x8e34('0x17')][_0x8e34('0x1d')](_0x456ad4,_0x8e34('0x1e'));var _0x383814=_0x347570[_0x8e34('0x1d')](_0x5f54c5,_0x8e34('0x1f'));for(let _0x116e36=0x0;_0x116e36<_0x3c4134['length'];_0x116e36++){var _0x22f0f1=_0x383814[_0x8e34('0x1d')](_0x8e34('0x1f'),_0x8e34('0x20')+_0x3c4134[_0x116e36]+_0x8e34('0x21'));_0x383814=_0x22f0f1;}_0x507c87['html']=_0x383814;}_0x43ccd6['body']=_0x507c87['html'];}else{_0x43ccd6[_0x8e34('0x22')]=_0x507c87['textAsHtml'];}if(_0x43ccd6[_0x8e34('0x22')]){_0x43ccd6[_0x8e34('0x22')]=_0x43ccd6['body'][_0x8e34('0x1d')](/0x0){var _0xa33a4f=[_0x8e34('0x34'),_0x8e34('0x35'),_0x8e34('0x36')];for(var _0x392786=0x0;_0x392786<_0x507c87[_0x8e34('0x33')]['length'];_0x392786++){var _0x3648c3=_[_0x8e34('0xd')](_0xa33a4f,_0x507c87[_0x8e34('0x33')][_0x392786]['line']);if(_0x3648c3>=0x0){_0x43ccd6[_0x8e34('0x37')]=!![];}}}return _0x43ccd6;}exports[_0x8e34('0x38')]=function(_0x171a44,_0x13b453,_0x479f2d){var _0x4f5775={'from':getAddress(_0x13b453[_0x8e34('0x39')]),'firstName':getFirstName(_0x13b453[_0x8e34('0x39')]),'lastName':getLastName(_0x13b453[_0x8e34('0x39')]),'mapKey':_0x8e34('0x27'),'message':{'from':getMails(_0x171a44[_0x8e34('0x27')],_0x13b453['from']),'to':_0x171a44[_0x8e34('0x27')],'cc':'','subject':_0x13b453[_0x8e34('0x3a')]||'','messageId':_0x13b453[_0x8e34('0x3b')],'inReplyTo':_0x13b453[_0x8e34('0x3c')],'sentAt':moment(_0x13b453['date'])['format'](_0x8e34('0x3d')),'attach':![],'attachments':[]}};if(!_0x13b453[_0x8e34('0x17')]&&!_0x13b453['textAsHtml']){var _0x15bd27=_[_0x8e34('0x3e')](_0x13b453[_0x8e34('0x1b')],{'contentType':'application/ms-tnef'});if(_0x15bd27['length']){logger[_0x8e34('0x3f')](util[_0x8e34('0x2c')](_0x8e34('0x40'),_0x13b453['messageId']));tnef[_0x8e34('0x41')](_[_0x8e34('0x42')](_0x15bd27)[_0x8e34('0x31')],function(_0x223284,_0x18fb3c){if(_0x18fb3c){_0x13b453['html']=_0x18fb3c['BodyHTML']||_0x8e34('0x43');if(_0x18fb3c[_0x8e34('0x44')]){for(var _0x4e510e=0x0;_0x4e510e<_0x18fb3c['Attachments'][_0x8e34('0xf')];_0x4e510e++){var _0x116054=_0x18fb3c[_0x8e34('0x44')][_0x4e510e];_0x4f5775[_0x8e34('0x24')][_0x8e34('0x1b')]['push']({'filename':_0x116054[_0x8e34('0x45')],'content':Buffer[_0x8e34('0x39')](_0x116054['Data'])});}}}_0x479f2d(parseEmail(_0x171a44,_0x13b453,_0x4f5775));});}else{_0x13b453[_0x8e34('0x17')]=_0x8e34('0x43');_0x479f2d(parseEmail(_0x171a44,_0x13b453,_0x4f5775));}}else{_0x479f2d(parseEmail(_0x171a44,_0x13b453,_0x4f5775));}};exports[_0x8e34('0x46')]=function(_0x444288,_0x8d69a5){var _0x17751b=[_0x8e34('0x47')+(_0x8d69a5||''),'auth=Bearer\x20'+_0x444288,'',''];return Buffer[_0x8e34('0x39')](_0x17751b[_0x8e34('0x11')](''),'utf-8')[_0x8e34('0x48')](_0x8e34('0x49'));}; \ No newline at end of file +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 diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ac11bd5..3b0d3b3 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 _0x2ef5=['active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x2ef5,0x1a4));var _0x52ef=function(_0x363368,_0x328831){_0x363368=_0x363368-0x0;var _0x596be1=_0x2ef5[_0x363368];return _0x596be1;};'use strict';var _=require(_0x52ef('0x0'));function MailAccount(_0x17a6a5){this['id']=_0x17a6a5['id']||0x0;this[_0x52ef('0x1')]=_0x17a6a5[_0x52ef('0x1')]||_0x52ef('0x2');this[_0x52ef('0x3')]=_0x17a6a5[_0x52ef('0x3')]||'SERV';this[_0x52ef('0x4')]=_0x17a6a5[_0x52ef('0x4')]||![];this['Imap']=_0x17a6a5[_0x52ef('0x5')]||[];this[_0x52ef('0x6')]=_0x17a6a5[_0x52ef('0x6')]||[];}module[_0x52ef('0x7')]=MailAccount; \ No newline at end of file +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 diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e974e47..c5a4339 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 _0x1988=['lodash','../model/mailAccount','mailAccounts','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x1988,0x186));var _0x8198=function(_0x41a5be,_0x53e17d){_0x41a5be=_0x41a5be-0x0;var _0x150049=_0x1988[_0x41a5be];return _0x150049;};'use strict';var _=require(_0x8198('0x0'));var MailAccount=require(_0x8198('0x1'));var Realtime=function(){this[_0x8198('0x2')]={};};function freeIsNotKey(_0x528559,_0x3b6abf,_0x395a0c){var _0x40a61a=_['mapKeys'](_0x528559,function(_0x1cbb93,_0x39598a){return _0x1cbb93[_0x395a0c];});for(var _0x54e280 in _0x3b6abf){if(_0x3b6abf['hasOwnProperty'](_0x54e280)){if(!_0x40a61a[_0x54e280]){delete _0x3b6abf[_0x54e280];}}}}Realtime[_0x8198('0x3')][_0x8198('0x4')]=function(_0x5b6451,_0x15a0b7){for(var _0x1f9adc in _0x15a0b7){if(_0x5b6451['hasOwnProperty'](_0x1f9adc)){_0x5b6451[_0x1f9adc]=_0x15a0b7[_0x1f9adc];}}};Realtime[_0x8198('0x3')][_0x8198('0x5')]=function(){var _0x32a471=this;return function(_0x2a17b0){if(_0x2a17b0){freeIsNotKey(_0x2a17b0,_0x32a471['mailAccounts'],'id');for(var _0x4c55ef=0x0,_0x14fbce={},_0x3871fe={};_0x4c55ef<_0x2a17b0[_0x8198('0x6')];_0x4c55ef+=0x1){_0x14fbce=_0x2a17b0[_0x4c55ef];if(_[_0x8198('0x7')](_0x32a471[_0x8198('0x2')][_0x14fbce['id']])){_0x32a471[_0x8198('0x2')][_0x14fbce['id']]=new MailAccount(_0x14fbce);}else{_[_0x8198('0x8')](_0x32a471[_0x8198('0x2')][_0x14fbce['id']],_0x14fbce);}}}return _0x32a471['mailAccounts'];};};module[_0x8198('0x9')]=Realtime; \ No newline at end of file +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 diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ea3a993..a1bb07f 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 _0x9134=['Request','GetMailAccount','name','email','active','key','ListId','TemplateId','MailServerIn','CloudProvider','service','data5','type','getMailAccount','notify','NotifyMailAccount','getMailAccounts'];(function(_0x5426e1,_0x3af209){var _0x4e99e9=function(_0x2dbdb8){while(--_0x2dbdb8){_0x5426e1['push'](_0x5426e1['shift']());}};_0x4e99e9(++_0x3af209);}(_0x9134,0x87));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0x4913('0x0')]=function(){return function(){return client[_0x4913('0x1')](_0x4913('0x2'),{'options':{'attributes':['id',_0x4913('0x3'),'provider','service',_0x4913('0x4'),_0x4913('0x5'),_0x4913('0x6'),_0x4913('0x7'),_0x4913('0x8')],'raw':![],'include':[{'model':_0x4913('0x9'),'as':'Imap','include':[{'model':_0x4913('0xa'),'attributes':['id',_0x4913('0x3'),_0x4913('0xb'),'type',_0x4913('0xc')],'as':_0x4913('0xa')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x4913('0xa'),'attributes':['id',_0x4913('0x3'),'service',_0x4913('0xd'),_0x4913('0xc')],'as':_0x4913('0xa')}]}]},'log':_0x4913('0xe')});};};exports[_0x4913('0xf')]=function(_0x47cabb,_0x43fc62){return client['Request'](_0x4913('0x10'),{'account':{'id':_0x47cabb},'body':_0x43fc62,'log':'NotifyMailAccount'});}; \ No newline at end of file +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 diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 227c722..f16c7be 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 _0xe9ca=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x125b22,_0x12e0f1){var _0x5a8ebf=function(_0x1e2cba){while(--_0x1e2cba){_0x125b22['push'](_0x125b22['shift']());}};_0x5a8ebf(++_0x12e0f1);}(_0xe9ca,0x1ca));var _0xae9c=function(_0x283eed,_0x5e4735){_0x283eed=_0x283eed-0x0;var _0x31a10d=_0xe9ca[_0x283eed];return _0x31a10d;};'use strict';var client=require(_0xae9c('0x0'));exports[_0xae9c('0x1')]=function(){return client['Request'](_0xae9c('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xae9c('0x3')]},'log':_0xae9c('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2658c99..d83e2eb 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_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 diff --git a/server/services/express/index.js b/server/services/express/index.js index a8cbb25..b447df6 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 _0x670e=['listen','port','socket.io','websocket','polling','redis','defaults','localhost','../../config/triggers','default','../../config/socketio','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','ioredis','../../config/environment'];(function(_0xc6c255,_0xe36684){var _0x2cb07c=function(_0x190ed2){while(--_0x190ed2){_0xc6c255['push'](_0xc6c255['shift']());}};_0x2cb07c(++_0xe36684);}(_0x670e,0x13c));var _0xe670=function(_0x37c657,_0x41e62d){_0x37c657=_0x37c657-0x0;var _0x165959=_0x670e[_0x37c657];return _0x165959;};'use strict';var _=require('lodash');var http=require(_0xe670('0x0'));var express=require('express');var sticky=require(_0xe670('0x1'));var Redis=require(_0xe670('0x2'));var config=require(_0xe670('0x3'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xe670('0x4')](server,config[_0xe670('0x5')])){var socketio=require(_0xe670('0x6'))(server,{'transports':[_0xe670('0x7'),_0xe670('0x8')]});config[_0xe670('0x9')]=_[_0xe670('0xa')](config['redis'],{'host':_0xe670('0xb'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xe670('0x9')]),'subClient':new Redis(config['redis'])}));require(_0xe670('0xc'))[_0xe670('0xd')]();require(_0xe670('0xe'))['default'](socketio);require('../../config/express')['default'](app);require(_0xe670('0xf'))['default'](app);}else{server['once'](_0xe670('0x10'),function(){console[_0xe670('0x11')](_0xe670('0x12'),config[_0xe670('0x5')]);});}exports=module[_0xe670('0x13')]=app; \ No newline at end of file +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 diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 8149ca3..b13f033 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 _0xcd12=['Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','routing','client','http'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xcd12,0x106));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x2cd1('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x2cd1('0x1'));var client=jayson[_0x2cd1('0x2')][_0x2cd1('0x3')]({'port':0x2329});client[_0x2cd1('0x4')]=function(_0x5bda6f,_0x54e477){return new BPromise(function(_0x3a8dcb,_0x50199e){return client[_0x2cd1('0x5')](_0x5bda6f,_0x54e477)[_0x2cd1('0x6')](function(_0x1d5237){logger[_0x2cd1('0x7')](_0x2cd1('0x8'),_0x2cd1('0x1'),_0x5bda6f,_0x54e477,_0x1d5237);if(_0x1d5237[_0x2cd1('0x9')]){logger[_0x2cd1('0x9')](_0x2cd1('0x8'),_0x2cd1('0x1'),_0x5bda6f,_0x1d5237[_0x2cd1('0x9')][_0x2cd1('0xa')],_0x54e477);return _0x50199e(_0x1d5237[_0x2cd1('0x9')][_0x2cd1('0xa')]);}else{return _0x3a8dcb(_0x1d5237[_0x2cd1('0xb')]);}})[_0x2cd1('0xc')](function(_0x188049){logger[_0x2cd1('0x9')]('rpc',_0x2cd1('0x1'),_0x5bda6f,_0x188049,_0x54e477);return _0x50199e(_0x188049);});});};module[_0x2cd1('0xd')]=client; \ No newline at end of file +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 diff --git a/server/services/routing/index.js b/server/services/routing/index.js index f3abf44..06b0747 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 _0x0040=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x3702ef,_0x2f93f6){var _0x1fe56f=function(_0xdadfbd){while(--_0xdadfbd){_0x3702ef['push'](_0x3702ef['shift']());}};_0x1fe56f(++_0x2f93f6);}(_0x0040,0x116));var _0x0004=function(_0x657e67,_0x518f58){_0x657e67=_0x657e67-0x0;var _0x29e86d=_0x0040[_0x657e67];return _0x29e86d;};'use strict';var BPromise=require(_0x0004('0x0'));var server=require(_0x0004('0x1'));var Realtime=require('./realtime');var user=require(_0x0004('0x2'));var interval=require(_0x0004('0x3'));var openchannelQueue=require(_0x0004('0x4'));var chatQueue=require(_0x0004('0x5'));var smsQueue=require(_0x0004('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x0004('0x7'));var whatsappQueue=require(_0x0004('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0004('0x9')]()[_0x0004('0xa')](user[_0x0004('0xb')]())[_0x0004('0xa')](realtime['initAgents']())[_0x0004('0xa')](interval[_0x0004('0xc')]())[_0x0004('0xa')](realtime[_0x0004('0xd')]())[_0x0004('0xa')](openchannelQueue[_0x0004('0xe')]())[_0x0004('0xa')](realtime[_0x0004('0xf')]())[_0x0004('0xa')](chatQueue[_0x0004('0x10')]())[_0x0004('0xa')](realtime[_0x0004('0x11')]())[_0x0004('0xa')](smsQueue[_0x0004('0x12')]())[_0x0004('0xa')](realtime['initSmsQueues']())[_0x0004('0xa')](mailQueue[_0x0004('0x13')]())[_0x0004('0xa')](realtime[_0x0004('0x14')]())[_0x0004('0xa')](faxQueue[_0x0004('0x15')]())[_0x0004('0xa')](realtime[_0x0004('0x16')]())['then'](whatsappQueue[_0x0004('0x17')]())['then'](realtime[_0x0004('0x18')]())[_0x0004('0xa')](function(){return realtime;});}function main(){return server[_0x0004('0x19')](realtime)[_0x0004('0xa')](function(_0x23a7e3){return initRealtime();})[_0x0004('0xa')](function(_0x5e684f){return setInterval(initRealtime,0x1388);})[_0x0004('0x1a')](function(_0x4c173a){console[_0x0004('0x1b')](_0x4c173a);});}main(); \ No newline at end of file +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 diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 3e8daf8..d7c1820 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(_0xee7f65,_0x4ff021){var _0x5449bc=function(_0x8090e2){while(--_0x8090e2){_0xee7f65['push'](_0xee7f65['shift']());}};_0x5449bc(++_0x4ff021);}(_0x326f,0xd1));var _0xf326=function(_0x111690,_0x15e4e9){_0x111690=_0x111690-0x0;var _0x330bd1=_0x326f[_0x111690];return _0x330bd1;};'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 _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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 70f24b3..4fa330e 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 _0x6502=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','request','then'];(function(_0x3ed2fe,_0x12dd4f){var _0xf563fd=function(_0x39dd8f){while(--_0x39dd8f){_0x3ed2fe['push'](_0x3ed2fe['shift']());}};_0xf563fd(++_0x12dd4f);}(_0x6502,0x1bd));var _0x2650=function(_0x1863fb,_0x3304d3){_0x1863fb=_0x1863fb-0x0;var _0x3c7735=_0x6502[_0x1863fb];return _0x3c7735;};'use strict';var BPromise=require(_0x2650('0x0'));var jayson=require(_0x2650('0x1'));var client=jayson[_0x2650('0x2')]['http']({'port':0x232b});function request(_0x242c4c,_0x1626e6){return new BPromise(function(_0x4043db,_0x1bc33c){return client[_0x2650('0x3')](_0x242c4c,_0x1626e6)[_0x2650('0x4')](function(_0x21ac93){if(_0x21ac93[_0x2650('0x5')]){return _0x1bc33c(_0x21ac93[_0x2650('0x5')][_0x2650('0x6')]);}else{return _0x4043db(_0x21ac93[_0x2650('0x7')]);}})[_0x2650('0x8')](function(_0x1c235d){return _0x1bc33c(_0x1c235d);});});}exports[_0x2650('0x9')]=function(_0x500a36,_0x2796dd){return request('SendMail',{'account':_0x500a36,'message':_0x2796dd});}; \ No newline at end of file +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 diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4c07293..0eacc80 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 _0xc050=['getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','format','name','chatStatusTime','smsStatus','smsStatusTime','mailWaitingInteractions','openchannelWaitingInteractions','stringify','user:routing:update','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0xc050,0x95));var _0x0c05=function(_0x14028c,_0x552167){_0x14028c=_0x14028c-0x0;var _0x19f7f0=_0xc050[_0x14028c];return _0x19f7f0;};'use strict';var _=require('lodash');var moment=require(_0x0c05('0x0'));var md5=require(_0x0c05('0x1'));var Redis=require(_0x0c05('0x2'));var config=require(_0x0c05('0x3'));config[_0x0c05('0x4')]=_['defaults'](config[_0x0c05('0x4')],{'host':_0x0c05('0x5'),'port':0x18eb});var io=require(_0x0c05('0x6'))(new Redis(config[_0x0c05('0x4')]));function Agent(_0x38061c){this['id']=_0x38061c['id']||0x0;this['name']=_0x38061c['name']||'';this[_0x0c05('0x7')]=_0x38061c[_0x0c05('0x7')]||![];this[_0x0c05('0x8')]=_0x38061c['chatPause']||![];this[_0x0c05('0x9')]=_0x38061c[_0x0c05('0x9')]||![];this[_0x0c05('0xa')]=_0x38061c[_0x0c05('0xa')]||![];this[_0x0c05('0xb')]=_0x38061c[_0x0c05('0xb')]||![];this[_0x0c05('0xc')]=_0x38061c[_0x0c05('0xc')]||![];this[_0x0c05('0xd')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x38061c['chatCapacity']||0x0;this[_0x0c05('0xe')]=0x0;this['mailStatus']=_0x0c05('0xf');this[_0x0c05('0x10')]=0x0;this[_0x0c05('0x11')]=_0x38061c[_0x0c05('0x11')]||0x0;this[_0x0c05('0x12')]=0x0;this[_0x0c05('0x13')]='unknown';this['faxStatusTime']=0x0;this[_0x0c05('0x14')]=_0x38061c['faxCapacity']||0x0;this[_0x0c05('0x15')]=0x0;this['smsStatus']=_0x0c05('0xf');this['smsStatusTime']=0x0;this[_0x0c05('0x16')]=_0x38061c[_0x0c05('0x16')]||0x0;this[_0x0c05('0x17')]=0x0;this[_0x0c05('0x18')]='unknown';this[_0x0c05('0x19')]=0x0;this[_0x0c05('0x1a')]=_0x38061c[_0x0c05('0x1a')]||0x0;this[_0x0c05('0x1b')]=0x0;this[_0x0c05('0x1c')]=_0x0c05('0xf');this[_0x0c05('0x1d')]=0x0;this[_0x0c05('0x1e')]=_0x38061c[_0x0c05('0x1e')]||0x0;this[_0x0c05('0x1f')]=0x0;this[_0x0c05('0x20')]=![];this[_0x0c05('0x21')]=undefined;this['md5']='';this[_0x0c05('0x22')]={};this[_0x0c05('0x23')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x0c05('0x24')]={};this[_0x0c05('0x25')]={};this[_0x0c05('0x26')]();}Agent[_0x0c05('0x27')][_0x0c05('0x28')]=function(_0x195785){if(this[_0x195785+_0x0c05('0x29')]>0x0){if(this[_0x195785+_0x0c05('0x2a')]>0x0&&this[_0x195785+_0x0c05('0x29')]>=this[_0x195785+_0x0c05('0x2a')]){return _0x0c05('0x2b');}else{return _0x0c05('0x2c');}}else{return _0x0c05('0x2d');}};Agent[_0x0c05('0x27')]['updateRealtime']=function(){var _0x2ae06c=[_0x0c05('0x2e'),_0x0c05('0x2f'),_0x0c05('0x30'),_0x0c05('0x31'),'sms',_0x0c05('0x32')];for(var _0x368409=0x0;_0x368409<_0x2ae06c[_0x0c05('0x33')];_0x368409+=0x1){var _0x33e3b6=this['getChannelStatus'](_0x2ae06c[_0x368409]);if(this[_0x2ae06c[_0x368409]+_0x0c05('0x34')]!==_0x33e3b6){this[_0x2ae06c[_0x368409]+_0x0c05('0x35')]=_['toNumber'](moment()[_0x0c05('0x36')]('x'));}this[_0x2ae06c[_0x368409]+_0x0c05('0x34')]=_0x33e3b6;}var _0x549984={'id':this['id'],'name':this[_0x0c05('0x37')],'online':this['online'],'voicePause':this[_0x0c05('0x7')],'chatPause':this[_0x0c05('0x8')],'mailPause':this[_0x0c05('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x0c05('0xa')],'openchannelPause':this[_0x0c05('0xc')],'chatStatus':this[_0x0c05('0xd')],'chatStatusTime':this[_0x0c05('0x38')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x0c05('0x10')],'mailCapacity':this[_0x0c05('0x11')],'mailCurrentCapacity':this[_0x0c05('0x12')],'faxStatus':this[_0x0c05('0x13')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x0c05('0x14')],'faxCurrentCapacity':this[_0x0c05('0x15')],'smsStatus':this[_0x0c05('0x39')],'smsStatusTime':this[_0x0c05('0x3a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x0c05('0x19')],'whatsappCapacity':this[_0x0c05('0x1a')],'whatsappCurrentCapacity':this[_0x0c05('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x0c05('0x1d')],'openchannelCapacity':this[_0x0c05('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x0c05('0x21')],'chatWaitingInteractions':this[_0x0c05('0x22')],'faxWaitingInteractions':this[_0x0c05('0x23')],'mailWaitingInteractions':this[_0x0c05('0x3b')],'openchannelWaitingInteractions':this[_0x0c05('0x3c')],'smsWaitingInteractions':this[_0x0c05('0x24')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x37fca9=md5(JSON[_0x0c05('0x3d')](_0x549984));if(this[_0x0c05('0x1')]!==_0x37fca9){this[_0x0c05('0x1')]=_0x37fca9;io['emit'](_0x0c05('0x3e'),_0x549984);}};module['exports']=Agent; \ No newline at end of file +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 diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1eddc0e..c13dde2 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 _0xa380=['loggedIn','paused','length','online','available','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa380,0x79));var _0x0a38=function(_0x8fd6ca,_0x34b5f3){_0x8fd6ca=_0x8fd6ca-0x0;var _0x4f61f3=_0xa380[_0x8fd6ca];return _0x4f61f3;};'use strict';var _=require(_0x0a38('0x0'));var md5=require(_0x0a38('0x1'));var util=require(_0x0a38('0x2'));var Redis=require(_0x0a38('0x3'));var config=require(_0x0a38('0x4'));config['redis']=_[_0x0a38('0x5')](config['redis'],{'host':_0x0a38('0x6'),'port':0x18eb});var io=require(_0x0a38('0x7'))(new Redis(config['redis']));function ChatQueue(_0x24f30d){this['id']=_0x24f30d['id']||0x0;this[_0x0a38('0x8')]=_0x24f30d[_0x0a38('0x8')]||'';this[_0x0a38('0x9')]=_0x24f30d[_0x0a38('0x9')]||0xa;this[_0x0a38('0xa')]=_0x24f30d[_0x0a38('0xa')]||_0x0a38('0xb');this[_0x0a38('0xc')]=_0x24f30d['Agents'];this[_0x0a38('0xd')]={};this[_0x0a38('0xe')]=0x0;this[_0x0a38('0x1')]='';this[_0x0a38('0xf')]();this[_0x0a38('0x10')]();}ChatQueue[_0x0a38('0x11')][_0x0a38('0xf')]=function(){var _0x4965c1=this[_0x0a38('0xd')][_0x0a38('0x12')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x0a38('0xd')][_0x0a38('0x12')]=_0x4965c1;};ChatQueue[_0x0a38('0x11')][_0x0a38('0x10')]=function(){this[_0x0a38('0x13')]=0x0;this[_0x0a38('0x14')]=0x0;for(var _0x104731=0x0;_0x104731=0x0?this[_0x0a38('0x17')]:0x0;var _0x4c8bc8={'id':this['id'],'available':this[_0x0a38('0x17')],'loggedIn':this[_0x0a38('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x0a38('0xe')]};var _0x17084c=md5(JSON['stringify'](_0x4c8bc8));if(this[_0x0a38('0x1')]!==_0x17084c){this[_0x0a38('0x1')]=_0x17084c;io['to'](util[_0x0a38('0x18')](_0x0a38('0x19'),_0x4c8bc8[_0x0a38('0x8')]))['emit'](_0x0a38('0x1a'),_0x4c8bc8);}};module[_0x0a38('0x1b')]=ChatQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 39aea7e..2a93631 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 _0x591f=['beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','Agents','length','loggedIn','faxPause','available','stringify','md5','format','emit','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x591f,0xc7));var _0xf591=function(_0x3d6db1,_0x4358f8){_0x3d6db1=_0x3d6db1-0x0;var _0x5e1cc3=_0x591f[_0x3d6db1];return _0x5e1cc3;};'use strict';var _=require(_0xf591('0x0'));var md5=require('md5');var util=require(_0xf591('0x1'));var Redis=require(_0xf591('0x2'));var config=require(_0xf591('0x3'));config['redis']=_[_0xf591('0x4')](config[_0xf591('0x5')],{'host':_0xf591('0x6'),'port':0x18eb});var io=require(_0xf591('0x7'))(new Redis(config[_0xf591('0x5')]));function FaxQueue(_0xd3d55f){this['id']=_0xd3d55f['id']||0x0;this[_0xf591('0x8')]=_0xd3d55f['name']||'';this[_0xf591('0x9')]=_0xd3d55f['timeout']||0xa;this[_0xf591('0xa')]=_0xd3d55f[_0xf591('0xa')]||_0xf591('0xb');this['Agents']=_0xd3d55f['Agents'];this[_0xf591('0xc')]={};this[_0xf591('0xd')]=0x0;this['md5']='';this[_0xf591('0xe')]();this[_0xf591('0xf')]();}FaxQueue[_0xf591('0x10')][_0xf591('0xe')]=function(){var _0x2d95a6=this[_0xf591('0xc')][_0xf591('0x11')];this[_0xf591('0xc')]=_[_0xf591('0x12')](this['Agents'],'id');this[_0xf591('0xc')][_0xf591('0x11')]=_0x2d95a6;};FaxQueue[_0xf591('0x10')][_0xf591('0xf')]=function(){this['loggedIn']=0x0;this[_0xf591('0x13')]=0x0;for(var _0x48cf01=0x0;_0x48cf01=0x0?this[_0xf591('0x18')]:0x0;var _0x454b46={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf591('0x16')],'name':this[_0xf591('0x8')],'paused':this[_0xf591('0x13')],'waiting':this[_0xf591('0xd')]};var _0x326c80=md5(JSON[_0xf591('0x19')](_0x454b46));if(this[_0xf591('0x1a')]!==_0x326c80){this['md5']=_0x326c80;io['to'](util[_0xf591('0x1b')]('fax:queue:%s',_0x454b46['name']))[_0xf591('0x1c')]('fax_queue:save',_0x454b46);}};module[_0xf591('0x1d')]=FaxQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 1b80489..932e2a8 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 _0xe7a7=['name','Intervals','exports'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0xe7a7,0xf3));var _0x7e7a=function(_0x1c6cbe,_0x11fe54){_0x1c6cbe=_0x1c6cbe-0x0;var _0x32f5fa=_0xe7a7[_0x1c6cbe];return _0x32f5fa;};'use strict';function Interval(_0x5b6f82){this['id']=_0x5b6f82['id']||0x0;this[_0x7e7a('0x0')]=_0x5b6f82[_0x7e7a('0x0')]||'';this['Intervals']=_0x5b6f82[_0x7e7a('0x1')]||{};}module[_0x7e7a('0x2')]=Interval; \ No newline at end of file +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 diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 3e687af..f562e7c 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 _0x2b0c=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','online','mailPause','paused','available','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0xcb0eb2,_0x3906bf){var _0xbab9b8=function(_0x24fa8a){while(--_0x24fa8a){_0xcb0eb2['push'](_0xcb0eb2['shift']());}};_0xbab9b8(++_0x3906bf);}(_0x2b0c,0xe5));var _0xc2b0=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0x2b0c[_0x51a6d6];return _0x5ef1a8;};'use strict';var _=require(_0xc2b0('0x0'));var md5=require(_0xc2b0('0x1'));var util=require(_0xc2b0('0x2'));var Redis=require(_0xc2b0('0x3'));var config=require(_0xc2b0('0x4'));config[_0xc2b0('0x5')]=_[_0xc2b0('0x6')](config['redis'],{'host':_0xc2b0('0x7'),'port':0x18eb});var io=require(_0xc2b0('0x8'))(new Redis(config[_0xc2b0('0x5')]));function MailQueue(_0x4165a1){this['id']=_0x4165a1['id']||0x0;this[_0xc2b0('0x9')]=_0x4165a1[_0xc2b0('0x9')]||'';this['timeout']=_0x4165a1[_0xc2b0('0xa')]||0xa;this[_0xc2b0('0xb')]=_0x4165a1['strategy']||_0xc2b0('0xc');this[_0xc2b0('0xd')]=_0x4165a1[_0xc2b0('0xd')];this[_0xc2b0('0xe')]={};this[_0xc2b0('0xf')]=0x0;this[_0xc2b0('0x1')]='';this[_0xc2b0('0x10')]();this[_0xc2b0('0x11')]();}MailQueue['prototype']['updateRouting']=function(){var _0x2e36e5=this[_0xc2b0('0xe')][_0xc2b0('0x12')];this[_0xc2b0('0xe')]=_[_0xc2b0('0x13')](this[_0xc2b0('0xd')],'id');this['mapAgentsId'][_0xc2b0('0x12')]=_0x2e36e5;};MailQueue[_0xc2b0('0x14')][_0xc2b0('0x11')]=function(){this[_0xc2b0('0x15')]=0x0;this['paused']=0x0;for(var _0x185582=0x0;_0x185582=0x0?this[_0xc2b0('0x19')]:0x0;var _0x53fe8f={'id':this['id'],'available':this[_0xc2b0('0x19')],'loggedIn':this[_0xc2b0('0x15')],'name':this['name'],'paused':this[_0xc2b0('0x18')],'waiting':this[_0xc2b0('0xf')]};var _0x2ae8f5=md5(JSON['stringify'](_0x53fe8f));if(this[_0xc2b0('0x1')]!==_0x2ae8f5){this[_0xc2b0('0x1')]=_0x2ae8f5;io['to'](util[_0xc2b0('0x1a')](_0xc2b0('0x1b'),_0x53fe8f[_0xc2b0('0x9')]))[_0xc2b0('0x1c')]('mail_queue:save',_0x53fe8f);}};module[_0xc2b0('0x1d')]=MailQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 83941ec..b6954f3 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x7a54,0x106));var _0x47a5=function(_0x3e6c29,_0x4fcf4a){_0x3e6c29=_0x3e6c29-0x0;var _0x519488=_0x7a54[_0x3e6c29];return _0x519488;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 63f1ea4..f30b78e 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 _0x84ab=['format','sms:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','length','online','smsPause','available','name','stringify'];(function(_0x19409d,_0xf48905){var _0x5de146=function(_0x117745){while(--_0x117745){_0x19409d['push'](_0x19409d['shift']());}};_0x5de146(++_0xf48905);}(_0x84ab,0x12f));var _0xb84a=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0x84ab[_0x233cb1];return _0x29ee7e;};'use strict';var _=require(_0xb84a('0x0'));var md5=require(_0xb84a('0x1'));var util=require(_0xb84a('0x2'));var Redis=require(_0xb84a('0x3'));var config=require(_0xb84a('0x4'));config['redis']=_[_0xb84a('0x5')](config[_0xb84a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb84a('0x7'))(new Redis(config[_0xb84a('0x6')]));function SmsQueue(_0x28c83b){this['id']=_0x28c83b['id']||0x0;this['name']=_0x28c83b['name']||'';this['timeout']=_0x28c83b[_0xb84a('0x8')]||0xa;this['strategy']=_0x28c83b[_0xb84a('0x9')]||_0xb84a('0xa');this['Agents']=_0x28c83b[_0xb84a('0xb')];this['mapAgentsId']={};this[_0xb84a('0xc')]=0x0;this[_0xb84a('0x1')]='';this[_0xb84a('0xd')]();this['updateRealtime']();}SmsQueue['prototype']['updateRouting']=function(){var _0x1e0180=this[_0xb84a('0xe')][_0xb84a('0xf')];this[_0xb84a('0xe')]=_[_0xb84a('0x10')](this['Agents'],'id');this[_0xb84a('0xe')][_0xb84a('0xf')]=_0x1e0180;};SmsQueue[_0xb84a('0x11')][_0xb84a('0x12')]=function(){this[_0xb84a('0x13')]=0x0;this[_0xb84a('0x14')]=0x0;for(var _0x12ccab=0x0;_0x12ccab=0x0?this[_0xb84a('0x18')]:0x0;var _0x28fe46={'id':this['id'],'available':this[_0xb84a('0x18')],'loggedIn':this[_0xb84a('0x13')],'name':this[_0xb84a('0x19')],'paused':this[_0xb84a('0x14')],'waiting':this[_0xb84a('0xc')]};var _0x553f79=md5(JSON[_0xb84a('0x1a')](_0x28fe46));if(this[_0xb84a('0x1')]!==_0x553f79){this['md5']=_0x553f79;io['to'](util[_0xb84a('0x1b')](_0xb84a('0x1c'),_0x28fe46[_0xb84a('0x19')]))[_0xb84a('0x1d')]('sms_queue:save',_0x28fe46);}};module['exports']=SmsQueue; \ No newline at end of file +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 diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 6c9d289..ef2a03c 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 _0x0296=['online','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','updateRealtime','loggedIn','paused','length'];(function(_0x163c37,_0x5a9d16){var _0x3781e9=function(_0x163074){while(--_0x163074){_0x163c37['push'](_0x163c37['shift']());}};_0x3781e9(++_0x5a9d16);}(_0x0296,0xc4));var _0x6029=function(_0x3b3f90,_0x388364){_0x3b3f90=_0x3b3f90-0x0;var _0x52522e=_0x0296[_0x3b3f90];return _0x52522e;};'use strict';var _=require(_0x6029('0x0'));var md5=require(_0x6029('0x1'));var util=require(_0x6029('0x2'));var Redis=require(_0x6029('0x3'));var config=require(_0x6029('0x4'));config[_0x6029('0x5')]=_['defaults'](config[_0x6029('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6029('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x17561c){this['id']=_0x17561c['id']||0x0;this[_0x6029('0x7')]=_0x17561c[_0x6029('0x7')]||'';this[_0x6029('0x8')]=_0x17561c['timeout']||0xa;this[_0x6029('0x9')]=_0x17561c[_0x6029('0x9')]||_0x6029('0xa');this[_0x6029('0xb')]=_0x17561c['Agents'];this[_0x6029('0xc')]={};this[_0x6029('0xd')]=0x0;this[_0x6029('0x1')]='';this[_0x6029('0xe')]();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3e06d9=this[_0x6029('0xc')]['_rr'];this['mapAgentsId']=_['map'](this[_0x6029('0xb')],'id');this['mapAgentsId']['_rr']=_0x3e06d9;};WhatsappQueue[_0x6029('0xf')][_0x6029('0x10')]=function(){this[_0x6029('0x11')]=0x0;this[_0x6029('0x12')]=0x0;for(var _0x5a598f=0x0;_0x5a598f=0x0?this[_0x6029('0x15')]:0x0;var _0x16029b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6029('0x11')],'name':this[_0x6029('0x7')],'paused':this[_0x6029('0x12')],'waiting':this[_0x6029('0xd')]};var _0x42c683=md5(JSON['stringify'](_0x16029b));if(this[_0x6029('0x1')]!==_0x42c683){this[_0x6029('0x1')]=_0x42c683;io['to'](util[_0x6029('0x16')](_0x6029('0x17'),_0x16029b[_0x6029('0x7')]))[_0x6029('0x18')](_0x6029('0x19'),_0x16029b);}};module[_0x6029('0x1a')]=WhatsappQueue; \ No newline at end of file +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 diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a1e3760..9ef3135 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6ef61e5..4f951b3 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 _0x4372=['update','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x1189e6,_0x335e1c){var _0x545ae9=function(_0x84b11b){while(--_0x84b11b){_0x1189e6['push'](_0x1189e6['shift']());}};_0x545ae9(++_0x335e1c);}(_0x4372,0x1c7));var _0x2437=function(_0x1275e8,_0x40ab85){_0x1275e8=_0x1275e8-0x0;var _0x2bfdbd=_0x4372[_0x1275e8];return _0x2bfdbd;};'use strict';var client=require(_0x2437('0x0'));exports[_0x2437('0x1')]=function(_0x53ad00,_0x323d43){return client['Request'](_0x2437('0x2'),{'body':_0x323d43,'options':{'where':{'id':_0x53ad00}},'log':'updateChatInteraction'});};exports[_0x2437('0x3')]=function(_0x224034,_0x2d0ce2){return client['Request'](_0x2437('0x4'),{'body':_0x2d0ce2,'options':{'where':{'id':_0x224034}},'log':_0x2437('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 460b41d..ec53a83 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 _0x963d=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x518056,_0x59106b){var _0x13a18e=function(_0x4b2dbe){while(--_0x4b2dbe){_0x518056['push'](_0x518056['shift']());}};_0x13a18e(++_0x59106b);}(_0x963d,0x111));var _0xd963=function(_0x3c2290,_0x53dc96){_0x3c2290=_0x3c2290-0x0;var _0x4f1202=_0x963d[_0x3c2290];return _0x4f1202;};'use strict';var client=require('../client');exports[_0xd963('0x0')]=function(_0x19bdc2){return client[_0xd963('0x1')](_0xd963('0x2'),{'body':_0x19bdc2,'log':_0xd963('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 04f3c58..506bc92 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 _0x4677=['getChatQueues','../client','Request','GetChatQueue','name','strategy','User','Agents','online','chatPause'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x4677,0x155));var _0x7467=function(_0x2e132d,_0x50908e){_0x2e132d=_0x2e132d-0x0;var _0x3aa851=_0x4677[_0x2e132d];return _0x3aa851;};'use strict';var client=require(_0x7467('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x7467('0x1')](_0x7467('0x2'),{'options':{'raw':![],'attributes':['id',_0x7467('0x3'),'timeout',_0x7467('0x4')],'include':[{'model':_0x7467('0x5'),'as':_0x7467('0x6'),'attributes':['id',_0x7467('0x3'),_0x7467('0x7'),_0x7467('0x8')]}]},'log':_0x7467('0x9')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6c17b5c..59f6133 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 _0x9221=['create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0x2abd19,_0x493555){var _0xa2cd70=function(_0x3c31d5){while(--_0x3c31d5){_0x2abd19['push'](_0x2abd19['shift']());}};_0xa2cd70(++_0x493555);}(_0x9221,0x64));var _0x1922=function(_0x1bfc4c,_0x13383e){_0x1bfc4c=_0x1bfc4c-0x0;var _0x141d23=_0x9221[_0x1bfc4c];return _0x141d23;};'use strict';var client=require('../client');exports[_0x1922('0x0')]=function(_0x31937b){return client['Request'](_0x1922('0x1'),{'body':_0x31937b,'log':_0x1922('0x1')});};exports['update']=function(_0x309b6b,_0x43c8a3){return client[_0x1922('0x2')](_0x1922('0x3'),{'body':_0x43c8a3,'options':{'where':{'uniqueid':_0x309b6b},'order':[['id',_0x1922('0x4')]],'limit':0x1},'log':_0x1922('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ddd80e8..6d1680c 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x7a54,0x106));var _0x47a5=function(_0x297be6,_0x14af2e){_0x297be6=_0x297be6-0x0;var _0x3d557e=_0x7a54[_0x297be6];return _0x3d557e;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index e2a22ff..a5f6a46 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 _0x6534=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x20d71a,_0x4ad4fe){var _0x34ee0b=function(_0x702b40){while(--_0x702b40){_0x20d71a['push'](_0x20d71a['shift']());}};_0x34ee0b(++_0x4ad4fe);}(_0x6534,0x67));var _0x4653=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6534[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0x4653('0x0'));exports[_0x4653('0x1')]=function(_0x7a4092){return client[_0x4653('0x2')](_0x4653('0x3'),{'body':_0x7a4092,'log':_0x4653('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 4c68d01..9a4c69b 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 _0x8a9e=['User','Agents','online','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x5484cf,_0x4bc69c){var _0x36383b=function(_0x3cb15f){while(--_0x3cb15f){_0x5484cf['push'](_0x5484cf['shift']());}};_0x36383b(++_0x4bc69c);}(_0x8a9e,0xc0));var _0xe8a9=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x8a9e[_0x3ff085];return _0x2b68c3;};'use strict';var client=require('../client');exports[_0xe8a9('0x0')]=function(){return function(){return client[_0xe8a9('0x1')](_0xe8a9('0x2'),{'options':{'raw':![],'attributes':['id',_0xe8a9('0x3'),_0xe8a9('0x4'),_0xe8a9('0x5')],'include':[{'model':_0xe8a9('0x6'),'as':_0xe8a9('0x7'),'attributes':['id',_0xe8a9('0x3'),_0xe8a9('0x8'),'faxPause']}]},'log':_0xe8a9('0x0')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9fc73c4..68af859 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 _0xab52=['UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','Request'];(function(_0x8bd3ea,_0x1a7c55){var _0x201395=function(_0xdedfc4){while(--_0xdedfc4){_0x8bd3ea['push'](_0x8bd3ea['shift']());}};_0x201395(++_0x1a7c55);}(_0xab52,0x1a6));var _0x2ab5=function(_0x53cb4a,_0x41fcd6){_0x53cb4a=_0x53cb4a-0x0;var _0x49c079=_0xab52[_0x53cb4a];return _0x49c079;};'use strict';var client=require(_0x2ab5('0x0'));exports[_0x2ab5('0x1')]=function(_0x3aa5cb){return client['Request']('CreateFaxQueueReport',{'body':_0x3aa5cb,'log':_0x2ab5('0x2')});};exports['update']=function(_0x153d14,_0x4fb4bb){return client[_0x2ab5('0x3')](_0x2ab5('0x4'),{'body':_0x4fb4bb,'options':{'where':{'uniqueid':_0x153d14},'order':[['id',_0x2ab5('0x5')]],'limit':0x1},'log':_0x2ab5('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index b50de69..446e507 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 _0x8737=['Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x8737,0x1db));var _0x7873=function(_0x4b1570,_0x55ab82){_0x4b1570=_0x4b1570-0x0;var _0x559063=_0x8737[_0x4b1570];return _0x559063;};'use strict';var client=require(_0x7873('0x0'));exports['getIntervals']=function(){return function(){return client[_0x7873('0x1')](_0x7873('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7873('0x3')],'include':[{'model':_0x7873('0x4'),'as':_0x7873('0x5'),'attributes':['id',_0x7873('0x3'),_0x7873('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index de49679..e029c59 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 _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x1e79b9,_0x223ef3){var _0x2c2d29=function(_0x4573aa){while(--_0x4573aa){_0x1e79b9['push'](_0x1e79b9['shift']());}};_0x2c2d29(++_0x223ef3);}(_0x6d38,0x1ef));var _0x86d3=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6d38[_0x164eca];return _0x2ce562;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateMailInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToMailInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 8b95484..a760cbf 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 _0x8054=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x269a6f,_0x4c43c5){var _0x29e1e6=function(_0xe6081e){while(--_0xe6081e){_0x269a6f['push'](_0x269a6f['shift']());}};_0x29e1e6(++_0x4c43c5);}(_0x8054,0xca));var _0x4805=function(_0x1d2754,_0x1db6e6){_0x1d2754=_0x1d2754-0x0;var _0x374235=_0x8054[_0x1d2754];return _0x374235;};'use strict';var client=require('../client');exports[_0x4805('0x0')]=function(_0x17fd7c){return client[_0x4805('0x1')](_0x4805('0x2'),{'body':_0x17fd7c,'log':_0x4805('0x3')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index dd8ecd3..f3861ee 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 _0x9bec=['User','mailPause','../client','getMailQueues','timeout'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9bec,0x147));var _0xc9be=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x9bec[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0xc9be('0x0'));exports[_0xc9be('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc9be('0x2'),'strategy'],'include':[{'model':_0xc9be('0x3'),'as':'Agents','attributes':['id','name','online',_0xc9be('0x4')]}]},'log':_0xc9be('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 58677f6..8a02dc2 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 _0xd7ae=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x5d2731,_0x41a5ea){var _0xa88282=function(_0x4af700){while(--_0x4af700){_0x5d2731['push'](_0x5d2731['shift']());}};_0xa88282(++_0x41a5ea);}(_0xd7ae,0x1a5));var _0xed7a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd7ae[_0x413feb];return _0x40ee88;};'use strict';var client=require(_0xed7a('0x0'));exports[_0xed7a('0x1')]=function(_0x5590da){return client[_0xed7a('0x2')](_0xed7a('0x3'),{'body':_0x5590da,'log':_0xed7a('0x3')});};exports[_0xed7a('0x4')]=function(_0x29530d,_0x502b90){return client[_0xed7a('0x2')](_0xed7a('0x5'),{'body':_0x502b90,'options':{'where':{'uniqueid':_0x29530d},'order':[['id',_0xed7a('0x6')]],'limit':0x1},'log':_0xed7a('0x5')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c70301a..ab66c3d 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 _0xf5c8=['Request','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x4ba94a,_0x330873){var _0x33f01f=function(_0xffa852){while(--_0xffa852){_0x4ba94a['push'](_0x4ba94a['shift']());}};_0x33f01f(++_0x330873);}(_0xf5c8,0x1e7));var _0x8f5c=function(_0x557f5f,_0x31d8e7){_0x557f5f=_0x557f5f-0x0;var _0x196eba=_0xf5c8[_0x557f5f];return _0x196eba;};'use strict';var client=require(_0x8f5c('0x0'));exports['update']=function(_0x2c009f,_0x427e86){return client[_0x8f5c('0x1')]('UpdateOpenchannelInteraction',{'body':_0x427e86,'options':{'where':{'id':_0x2c009f}},'log':'updateOpenchannelInteraction'});};exports[_0x8f5c('0x2')]=function(_0x6c159e,_0xbb8040){return client[_0x8f5c('0x1')](_0x8f5c('0x3'),{'body':_0xbb8040,'options':{'where':{'id':_0x6c159e}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 69592b7..0f52cba 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 _0xbc83=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x46238f,_0x43c1ae){var _0x47234e=function(_0x4a1dc4){while(--_0x4a1dc4){_0x46238f['push'](_0x46238f['shift']());}};_0x47234e(++_0x43c1ae);}(_0xbc83,0xb1));var _0x3bc8=function(_0x410ca6,_0x190e44){_0x410ca6=_0x410ca6-0x0;var _0x655a9=_0xbc83[_0x410ca6];return _0x655a9;};'use strict';var client=require(_0x3bc8('0x0'));exports[_0x3bc8('0x1')]=function(_0xeb9637){return client[_0x3bc8('0x2')](_0x3bc8('0x3'),{'body':_0xeb9637,'log':_0x3bc8('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2a7d76a..c6f591b 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 _0xd6af=['strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','name'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd6af,0xb3));var _0xfd6a=function(_0x4767e9,_0x400195){_0x4767e9=_0x4767e9-0x0;var _0x31c58d=_0xd6af[_0x4767e9];return _0x31c58d;};'use strict';var client=require(_0xfd6a('0x0'));exports[_0xfd6a('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xfd6a('0x2'),'timeout',_0xfd6a('0x3')],'include':[{'model':'User','as':_0xfd6a('0x4'),'attributes':['id','name',_0xfd6a('0x5'),_0xfd6a('0x6')]}]},'log':_0xfd6a('0x1')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7da0ca7..d301300 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 _0x03f5=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x39e912,_0x310426){var _0x18d215=function(_0x4cfafc){while(--_0x4cfafc){_0x39e912['push'](_0x39e912['shift']());}};_0x18d215(++_0x310426);}(_0x03f5,0x6c));var _0x503f=function(_0x244e36,_0x448708){_0x244e36=_0x244e36-0x0;var _0x11c2e3=_0x03f5[_0x244e36];return _0x11c2e3;};'use strict';var client=require(_0x503f('0x0'));exports[_0x503f('0x1')]=function(_0xafd248){return client[_0x503f('0x2')](_0x503f('0x3'),{'body':_0xafd248,'log':_0x503f('0x3')});};exports[_0x503f('0x4')]=function(_0x2610d8,_0x5ac4da){return client['Request'](_0x503f('0x5'),{'body':_0x5ac4da,'options':{'where':{'uniqueid':_0x2610d8},'order':[['id',_0x503f('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 38437a8..7195b66 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 _0xbe22=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x567f48,_0x386e0b){var _0x4866c5=function(_0x2285fa){while(--_0x2285fa){_0x567f48['push'](_0x567f48['shift']());}};_0x4866c5(++_0x386e0b);}(_0xbe22,0x1c1));var _0x2be2=function(_0x3912c2,_0x5470aa){_0x3912c2=_0x3912c2-0x0;var _0x14f8c6=_0xbe22[_0x3912c2];return _0x14f8c6;};'use strict';var client=require(_0x2be2('0x0'));exports[_0x2be2('0x1')]=function(_0x501bc2,_0x49a0a2){return client[_0x2be2('0x2')](_0x2be2('0x3'),{'body':_0x49a0a2,'options':{'where':{'id':_0x501bc2}},'log':_0x2be2('0x4')});};exports[_0x2be2('0x5')]=function(_0x1729d7,_0x250c97){return client[_0x2be2('0x2')](_0x2be2('0x6'),{'body':_0x250c97,'options':{'where':{'id':_0x1729d7}},'log':_0x2be2('0x7')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index b813326..cac37f5 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 _0x44e7=['CreateSmsMessage','../client','create','Request'];(function(_0xcc7af2,_0x49bd6b){var _0xe9c75a=function(_0x596a75){while(--_0x596a75){_0xcc7af2['push'](_0xcc7af2['shift']());}};_0xe9c75a(++_0x49bd6b);}(_0x44e7,0xad));var _0x744e=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x44e7[_0x396466];return _0x5e9ab4;};'use strict';var client=require(_0x744e('0x0'));exports[_0x744e('0x1')]=function(_0x2fa496){return client[_0x744e('0x2')](_0x744e('0x3'),{'body':_0x2fa496,'log':'createSmsMessage'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 69e153b..430a239 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(_0x17c860,_0x599108){var _0x4e5c7a=function(_0x55cebe){while(--_0x55cebe){_0x17c860['push'](_0x17c860['shift']());}};_0x4e5c7a(++_0x599108);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index c01b466..239a18f 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x322456,_0x35cca0){var _0x48d2e7=function(_0x2ff827){while(--_0x2ff827){_0x322456['push'](_0x322456['shift']());}};_0x48d2e7(++_0x35cca0);}(_0x70e0,0x17b));var _0x070e=function(_0x595c47,_0x459c8f){_0x595c47=_0x595c47-0x0;var _0x2578e5=_0x70e0[_0x595c47];return _0x2578e5;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index df4210e..b6d2c80 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(_0x14e29b,_0x2fb57f){var _0xca1561=function(_0x3b789e){while(--_0x3b789e){_0x14e29b['push'](_0x14e29b['shift']());}};_0xca1561(++_0x2fb57f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_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 diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index be80873..8c879e2 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 _0xaa37=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xaa37[_0x3ff085];return _0x2b68c3;};'use strict';var client=require(_0x7aa3('0x0'));exports[_0x7aa3('0x1')]=function(_0x1142b8,_0x55c6b4){return client['Request'](_0x7aa3('0x2'),{'body':_0x55c6b4,'options':{'where':{'id':_0x1142b8}},'log':_0x7aa3('0x3')});};exports[_0x7aa3('0x4')]=function(_0x11e64c,_0x334919){return client[_0x7aa3('0x5')](_0x7aa3('0x6'),{'body':_0x334919,'options':{'where':{'id':_0x11e64c}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b4c4d2f..c6d60f5 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 _0xa6c4=['create','createWhatsappMessage','../client'];(function(_0x4f9e10,_0x190e80){var _0x45064d=function(_0x4a3a7c){while(--_0x4a3a7c){_0x4f9e10['push'](_0x4f9e10['shift']());}};_0x45064d(++_0x190e80);}(_0xa6c4,0x140));var _0x4a6c=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xa6c4[_0x2afbb0];return _0x411ff2;};'use strict';var client=require(_0x4a6c('0x0'));exports[_0x4a6c('0x1')]=function(_0x22fd31){return client['Request']('CreateWhatsappMessage',{'body':_0x22fd31,'log':_0x4a6c('0x2')});}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 770fe93..23520dc 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 _0x8da1=['name','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','timeout','User'];(function(_0x4fcbe6,_0x4b9519){var _0x20b2bb=function(_0x1bc15e){while(--_0x1bc15e){_0x4fcbe6['push'](_0x4fcbe6['shift']());}};_0x20b2bb(++_0x4b9519);}(_0x8da1,0x199));var _0x18da=function(_0x4dfe8f,_0x15d58a){_0x4dfe8f=_0x4dfe8f-0x0;var _0x525088=_0x8da1[_0x4dfe8f];return _0x525088;};'use strict';var client=require('../client');exports[_0x18da('0x0')]=function(){return function(){return client['Request'](_0x18da('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x18da('0x2'),'strategy'],'include':[{'model':_0x18da('0x3'),'as':'Agents','attributes':['id',_0x18da('0x4'),_0x18da('0x5'),_0x18da('0x6')]}]},'log':_0x18da('0x0')});};}; \ No newline at end of file +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 diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1014596..9a2f290 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 _0x996b=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','Request'];(function(_0x2ef9e2,_0x376185){var _0x2d4632=function(_0x4abaf4){while(--_0x4abaf4){_0x2ef9e2['push'](_0x2ef9e2['shift']());}};_0x2d4632(++_0x376185);}(_0x996b,0xad));var _0xb996=function(_0x39d876,_0x2d7566){_0x39d876=_0x39d876-0x0;var _0x23372f=_0x996b[_0x39d876];return _0x23372f;};'use strict';var client=require(_0xb996('0x0'));exports['create']=function(_0x3e63b2){return client[_0xb996('0x1')](_0xb996('0x2'),{'body':_0x3e63b2,'log':'CreateWhatsappQueueReport'});};exports[_0xb996('0x3')]=function(_0x2388a7,_0x5bedfb){return client[_0xb996('0x1')](_0xb996('0x4'),{'body':_0x5bedfb,'options':{'where':{'uniqueid':_0x2388a7},'order':[['id','DESC']],'limit':0x1},'log':_0xb996('0x4')});}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index d4bb4b0..289b3a5 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 _0xd21e=['timeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xd21e,0x1e5));var _0xed21=function(_0x35122d,_0x3688da){_0x35122d=_0x35122d-0x0;var _0x1cc08b=_0xd21e[_0x35122d];return _0x1cc08b;};'use strict';var schema=require(_0xed21('0x0'));var _=require(_0xed21('0x1'));var util=require(_0xed21('0x2'));var seqqueue=require(_0xed21('0x3'));var logger=require(_0xed21('0x4'))(_0xed21('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xed21('0x6'),'required':!![],'message':_0xed21('0x7')},'timeout':{'type':_0xed21('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x57ed22,_0x1d1dd4,_0x2c22ab){return logger['info'](util[_0xed21('0x9')](_0xed21('0xa'),_0x57ed22,_0x1d1dd4[_0xed21('0xb')],_0x2c22ab));}function handleFindAgent(_0x3735e3){return function(_0x436043){return _0x436043[_0xed21('0xb')][_0xed21('0xc')]()===_0x3735e3['toLowerCase']();};}exports[_0xed21('0xd')]=function(_0x7321da,_0x2c2346,_0x2a5468,_0x213a6d){return function(_0x4e17e8){try{var _0x43053a={'name':_0x2c2346[0x0],'timeout':_0x2c2346[0x1]};var _0x1434e7=queue[_0xed21('0x0')](_0x43053a,{'typecast':!![]});if(_0x1434e7[_0xed21('0xe')]){logger[_0xed21('0xf')](_0xed21('0x10'),_0x7321da,_[_0xed21('0x11')](_0x1434e7,_0xed21('0x12'))[_0xed21('0x13')](',\x20'));_0x4e17e8['stop']();}else{var _0x1b4e06=_[_0xed21('0x14')](_0x2a5468[_0xed21('0x15')],handleFindAgent(_0x43053a[_0xed21('0xb')]));if(_0x1b4e06){var _0x207947=(_0x43053a[_0xed21('0x16')]||0xa)*0x3e8;var _0x278206,_0x3938f8;var _0x39ee06=seqqueue['createQueue'](_0x207947);_0x39ee06['id']=_0x7321da;_0x39ee06['atimeout']=_0x207947;_0x39ee06[_0xed21('0x17')]=_0x213a6d[_0xed21('0x17')];writeLog(_0x7321da,_0x1b4e06,util['format'](_0xed21('0x18'),_0x207947));_0x2a5468[_0xed21('0x19')][_0x7321da]['on'](_0xed21('0x1a'),function(){logger[_0xed21('0x1b')](_0xed21('0x1c'),_0x7321da);clearTimeout(_0x3938f8);_0x3938f8=undefined;_0x39ee06['close']();if(_0x2a5468[_0xed21('0x19')][_0x7321da]){delete _0x2a5468[_0xed21('0x19')][_0x7321da];}_0x4e17e8[_0xed21('0x1d')]();});_0x2a5468[_0xed21('0x19')][_0x7321da]['on'](_0xed21('0x1e'),function(){if(_0x2a5468[_0xed21('0x19')][_0x7321da]){delete _0x2a5468[_0xed21('0x19')][_0x7321da];}});_0x3938f8=setTimeout(function(){logger[_0xed21('0x1b')](_0xed21('0x1f'),_0x7321da);clearTimeout(_0x3938f8);_0x39ee06[_0xed21('0x20')]();_0x4e17e8[_0xed21('0x21')]();},_0x207947);strategy[_0xed21('0x22')](_0x39ee06,_0x1b4e06,_0x2a5468,_0x213a6d);}else{logger[_0xed21('0xf')](_0xed21('0x23'),_0x7321da,_0x43053a[_0xed21('0xb')]);_0x4e17e8['stop']();}}}catch(_0x50be44){console[_0xed21('0x24')](_0x50be44);logger['error'](_0xed21('0x25'),_0x7321da,_0x50be44[_0xed21('0x26')]);_0x4e17e8[_0xed21('0x1d')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 2041ed1..5d64c14 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 _0x710c=['../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','interaction','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','dialogState','Failed','moment','aws-sdk','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x2155de,_0x531cbd){var _0xfe2575=function(_0x1901f9){while(--_0x1901f9){_0x2155de['push'](_0x2155de['shift']());}};_0xfe2575(++_0x531cbd);}(_0x710c,0xc1));var _0xc710=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x710c[_0x2b91c5];return _0xbd5531;};'use strict';var _=require('lodash');var moment=require(_0xc710('0x0'));var AWS=require(_0xc710('0x1'));var utils=require('./utils');var logger=require(_0xc710('0x2'))(_0xc710('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc710('0x4')),'smsMessage':require(_0xc710('0x5')),'faxMessage':require(_0xc710('0x6')),'whatsappMessage':require(_0xc710('0x7'))};exports[_0xc710('0x8')]=function(_0x2909ab,_0x4349ea){return function(_0x6461fe){try{if(!_[_0xc710('0x9')](this['interaction'][_0xc710('0xa')])){logger['info'](_0xc710('0xb'),_0x2909ab,_0xc710('0xc'));return _0x6461fe[_0xc710('0xd')]();}var _0x2f7cfd={'ContactId':this[_0xc710('0xe')]['id'],'sentAt':moment()[_0xc710('0xf')](_0xc710('0x10')),'direction':'out'};if(this[_0xc710('0x11')]===_0xc710('0x12')||this[_0xc710('0x11')]==='whatsapp'){_0x2f7cfd[_0xc710('0x13')]=this[_0xc710('0x14')][_0xc710('0x13')];}var _0x4db1d4=this['channel'];if(_0x4db1d4==='chat'){_0x2f7cfd[_0xc710('0x15')]=this[_0xc710('0x16')]['id'];}else{_0x2f7cfd[_['upperFirst'](_0x4db1d4)+'AccountId']=this[_0xc710('0x16')]['id'];}_0x2f7cfd[_[_0xc710('0x17')](_0x4db1d4)+_0xc710('0x18')]=this[_0xc710('0x14')]['id'];if(this['interaction'][_0xc710('0x19')]){var _0x44a7f7=_0x4349ea[0x4];if(!_[_0xc710('0x1a')](_0x44a7f7)){_0x2f7cfd['body']=utils[_0xc710('0x1b')](_0x44a7f7,this);return rpc[_0x4db1d4+_0xc710('0x1c')][_0xc710('0x1d')](_0x2f7cfd)[_0xc710('0x1e')](function(_0x1ca43f){logger['info'](_0xc710('0xb'),_0x2909ab,_0x2f7cfd[_0xc710('0x1f')]);})[_0xc710('0x20')](function(_0x5417a4){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2909ab,JSON[_0xc710('0x21')](_0x5417a4));})[_0xc710('0x22')](function(){logger[_0xc710('0x23')](_0xc710('0x24'),_0x2909ab);_0x6461fe[_0xc710('0x25')]();});}else{logger['info'](_0xc710('0x26'),_0x2909ab);_0x6461fe[_0xc710('0x25')]();}}else{var _0x1b2e3b=this;var _0x37b26a=new AWS[(_0xc710('0x27'))]({'accessKeyId':_0x4349ea[0x0],'secretAccessKey':_0x4349ea[0x1],'region':_0x4349ea[0x2]});var _0x6138ed={'botAlias':_0xc710('0x28'),'botName':_0x4349ea[0x3],'inputText':this[_0xc710('0x29')][_0xc710('0x1f')],'userId':this[_0xc710('0x11')]+':'+this[_0xc710('0x14')]['id'][_0xc710('0x2a')]()};_0x37b26a[_0xc710('0x2b')](_0x6138ed,function(_0x5e9fa2,_0x1cfcac){if(_0x5e9fa2){logger[_0xc710('0x2c')](_0xc710('0xb'),_0x2909ab,_0x5e9fa2[_0xc710('0x29')]);_0x6461fe[_0xc710('0xd')]();}else if(_0x1cfcac&&_0x1cfcac[_0xc710('0x29')]){_0x1b2e3b[_0xc710('0x1f')][_0xc710('0x2d')]=_0x1cfcac;_0x2f7cfd[_0xc710('0x1f')]=_0x1cfcac[_0xc710('0x29')];_0x2f7cfd[_0xc710('0x2e')]=_0xc710('0x2d');_0x2f7cfd[_0xc710('0x2f')]=JSON[_0xc710('0x21')](_0x1cfcac);return rpc[_0x4db1d4+_0xc710('0x1c')]['create'](_0x2f7cfd)['then'](function(_0x3a7772){logger[_0xc710('0x23')](_0xc710('0xb'),_0x2909ab,_0x2f7cfd['body']);if(_0x1cfcac[_0xc710('0x30')]==_0xc710('0x31')){_0x6461fe[_0xc710('0xd')]();}else{_0x6461fe['stop']();}})['catch'](function(_0x130744){logger['error']('[%s][AMAZONLEX]\x20%s',_0x2909ab,JSON[_0xc710('0x21')](_0x130744));_0x6461fe[_0xc710('0xd')]();});}else{_0x6461fe[_0xc710('0xd')]();}});}}catch(_0x469896){logger['error'](_0xc710('0xb'),_0x2909ab,JSON[_0xc710('0x21')](_0x469896));_0x6461fe['stop']();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index d45c00a..5837637 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 _0xffeb=['isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffeb,0x14f));var _0xbffe=function(_0x44aac2,_0x336163){_0x44aac2=_0x44aac2-0x0;var _0x38a6bc=_0xffeb[_0x44aac2];return _0x38a6bc;};'use strict';var _=require(_0xbffe('0x0'));var moment=require(_0xbffe('0x1'));var utils=require(_0xbffe('0x2'));var logger=require(_0xbffe('0x3'))(_0xbffe('0x4'));var rpc={'chatMessage':require(_0xbffe('0x5')),'openchannelMessage':require(_0xbffe('0x6')),'mailMessage':require(_0xbffe('0x7')),'smsMessage':require(_0xbffe('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xbffe('0x9')),'openchannelInteraction':require(_0xbffe('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xbffe('0xb')),'whatsappInteraction':require(_0xbffe('0xc'))};var mailRpc=require(_0xbffe('0xd'));exports['consequence']=function(_0x9269b5,_0x43929a,_0x453c3f,_0x49a73d){return function(_0x56ab25){try{var _0x35976c=this['channel'];if(_0x35976c===_0xbffe('0xe')&&_0x49a73d[_0xbffe('0xf')][_0xbffe('0x10')]){logger[_0xbffe('0x11')](_0xbffe('0x12'),_0x9269b5,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x56ab25[_0xbffe('0x13')]();}if(_0x43929a[0x0]==='1'&&(_[_0xbffe('0x14')](this[_0xbffe('0x15')][_0xbffe('0x16')])||!this[_0xbffe('0x15')][_0xbffe('0x16')])){logger[_0xbffe('0x11')](_0xbffe('0x12'),_0x9269b5,_0xbffe('0x17'));return _0x56ab25['next']();}if(_0x43929a[0x0]==='2'&&this[_0xbffe('0x15')][_0xbffe('0x18')]){logger[_0xbffe('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x9269b5,'One\x20Time\x20already\x20sent');return _0x56ab25['next']();}var _0x39e5aa={'ContactId':this[_0xbffe('0x19')]['id'],'sentAt':moment()[_0xbffe('0x1a')](_0xbffe('0x1b')),'direction':_0xbffe('0x1c')};if(this[_0xbffe('0x1d')]===_0xbffe('0xe')){_0x39e5aa[_0xbffe('0xf')]=utils[_0xbffe('0x1e')](_0x43929a[0x2],this);}else{_0x39e5aa['body']=utils[_0xbffe('0x1e')](_0x43929a[0x1],this);}if(this[_0xbffe('0x1f')]){_0x39e5aa['to']=this[_0xbffe('0x1f')][_0xbffe('0x20')]||'';if(this[_0xbffe('0x1d')]===_0xbffe('0xe')&&_0x43929a[0x1]==='1'){_0x39e5aa['cc']=this[_0xbffe('0x1f')]['cc']||'';}_0x39e5aa[_0xbffe('0x20')]=this[_0xbffe('0x1f')]['to']||'';_0x39e5aa[_0xbffe('0x21')]=this[_0xbffe('0x1f')][_0xbffe('0x21')]||'';_0x39e5aa[_0xbffe('0x22')]=!![];if(this['message'][_0xbffe('0x23')]){_0x39e5aa[_0xbffe('0x23')]='';_0x39e5aa['subject']+=_[_0xbffe('0x24')](this[_0xbffe('0x1f')]['subject'],'Re:')?'':_0xbffe('0x25');_0x39e5aa['subject']+=this['message'][_0xbffe('0x23')];}}if(this[_0xbffe('0x1d')]==='chat'){_0x39e5aa['ChatWebsiteId']=this[_0xbffe('0x26')]['id'];}else{_0x39e5aa[_[_0xbffe('0x27')](this[_0xbffe('0x1d')])+_0xbffe('0x28')]=this[_0xbffe('0x26')]['id'];}_0x39e5aa[_[_0xbffe('0x27')](this[_0xbffe('0x1d')])+_0xbffe('0x29')]=this[_0xbffe('0x15')]['id'];var _0x532600=this[_0xbffe('0x15')];if(rpc[this[_0xbffe('0x1d')]+'Message']){if(this[_0xbffe('0x1d')]==='mail'){_0x39e5aa[_0xbffe('0x2a')]=this['message'][_0xbffe('0x2b')];_0x39e5aa[_0xbffe('0x2c')]=_0xbffe('0x2d')+_[_0xbffe('0x2e')](_0x39e5aa[_0xbffe('0xf')],_0xbffe('0x2f'),_0xbffe('0x30'))+_0xbffe('0x31');_0x39e5aa[_0xbffe('0x32')]={'Auto-Submitted':_0xbffe('0x33'),'X-Auto-Response-Suppress':_0xbffe('0x34'),'Precedence':_0xbffe('0x35')};return mailRpc[_0xbffe('0x36')](this[_0xbffe('0x26')][_0xbffe('0x37')],_0x39e5aa)[_0xbffe('0x38')](function(_0xfa8fed){logger[_0xbffe('0x11')](_0xbffe('0x39'),_0x9269b5);_0x39e5aa['messageId']=_0xfa8fed[_0xbffe('0x1f')][_0xbffe('0x2b')];return rpc[_0x35976c+_0xbffe('0x3a')][_0xbffe('0x3b')](_0x39e5aa);})[_0xbffe('0x38')](function(_0x5da257){logger['info'](_0xbffe('0x12'),_0x9269b5,JSON['stringify'](_0x5da257));})[_0xbffe('0x3c')](function(_0x5ebd5b){logger[_0xbffe('0x3d')](_0xbffe('0x3e'),_0x9269b5,JSON[_0xbffe('0x3f')](_0x5ebd5b));})[_0xbffe('0x40')](function(){Promise[_0xbffe('0x41')]()['then'](function(){if(_0x43929a[0x0]!=='2'||_0x532600['autoreplyExecuted'])return;return rpc[_0x35976c+_0xbffe('0x42')][_0xbffe('0x43')](_0x532600['id'],{'autoreplyExecuted':!![]})[_0xbffe('0x38')](function(_0x13519f){logger[_0xbffe('0x11')](_0xbffe('0x44'),_0x9269b5,JSON[_0xbffe('0x3f')](_0x13519f));})[_0xbffe('0x3c')](function(_0x5c217f){logger[_0xbffe('0x3d')](_0xbffe('0x45'),_0x9269b5,JSON[_0xbffe('0x3f')](_0x5c217f));});})['then'](function(){_0x56ab25[_0xbffe('0x13')]();});});}else{return rpc[this[_0xbffe('0x1d')]+_0xbffe('0x3a')][_0xbffe('0x3b')](_0x39e5aa)[_0xbffe('0x38')](function(){logger['info'](_0xbffe('0x12'),_0x9269b5,_0x39e5aa[_0xbffe('0xf')]);})[_0xbffe('0x3c')](function(_0x3b9783){logger[_0xbffe('0x3d')](_0xbffe('0x12'),_0x9269b5,JSON[_0xbffe('0x3f')](_0x3b9783));})[_0xbffe('0x40')](function(){Promise[_0xbffe('0x41')]()[_0xbffe('0x38')](function(){if(_0x43929a[0x0]!=='2'||_0x532600[_0xbffe('0x18')])return;return rpc[_0x35976c+'Interaction'][_0xbffe('0x43')](_0x532600['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2ba8ee){logger[_0xbffe('0x11')](_0xbffe('0x44'),_0x9269b5,JSON[_0xbffe('0x3f')](_0x2ba8ee));})[_0xbffe('0x3c')](function(_0x5c7d54){logger[_0xbffe('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x9269b5,JSON[_0xbffe('0x3f')](_0x5c7d54));});})[_0xbffe('0x38')](function(){_0x56ab25['next']();});});}}}catch(_0x2bd927){logger[_0xbffe('0x3d')](_0xbffe('0x12'),_0x9269b5,JSON[_0xbffe('0x3f')](_0x2bd927));_0x56ab25[_0xbffe('0x46')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index a7887ab..a2b8862 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 _0xc586=['../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x22071a,_0x4bcf62){var _0x5c6c85=function(_0x4c531b){while(--_0x4c531b){_0x22071a['push'](_0x22071a['shift']());}};_0x5c6c85(++_0x4bcf62);}(_0xc586,0x177));var _0x6c58=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xc586[_0x5a9c0c];return _0x53c77d;};'use strict';var moment=require('moment');var logger=require(_0x6c58('0x0'))(_0x6c58('0x1'));var rpc={'chatInteraction':require(_0x6c58('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6c58('0x3')),'mailInteraction':require(_0x6c58('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6c58('0x5'))};exports['consequence']=function(_0x520962,_0x31f07c,_0x4f6e85,_0x4ad888){return function(_0x8d2810){try{logger[_0x6c58('0x6')](_0x6c58('0x7'),_0x520962,_0x31f07c[0x0]);var _0x433fc0={'closed':0x1,'closedAt':moment()['format'](_0x6c58('0x8')),'closeReason':_0x6c58('0x9'),'disposition':_0x31f07c[0x0]};if(rpc[_0x4ad888[_0x6c58('0xa')]+_0x6c58('0xb')]){rpc[_0x4ad888['channel']+_0x6c58('0xb')]['update'](_0x4ad888[_0x6c58('0xc')]['id'],_0x433fc0)['then'](function(_0x5f0f8c){logger[_0x6c58('0x6')](_0x6c58('0xd'),_0x520962,_0x4ad888[_0x6c58('0xc')]['id']);})[_0x6c58('0xe')](function(_0x221a53){logger[_0x6c58('0xf')](_0x6c58('0x10'),_0x520962,JSON['stringify'](_0x221a53));})[_0x6c58('0x11')](function(){_0x8d2810[_0x6c58('0x12')]();});}}catch(_0x381e08){logger[_0x6c58('0xf')](_0x6c58('0x10'),_0x520962,JSON['stringify'](_0x381e08));_0x8d2810[_0x6c58('0x12')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 278ba48..600ecef 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 _0xaaee=['contact','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','providerName','providerResponse','Message','metadata','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x215ede,_0xfba2e2){var _0x24e4a3=function(_0x5b86e2){while(--_0x5b86e2){_0x215ede['push'](_0x215ede['shift']());}};_0x24e4a3(++_0xfba2e2);}(_0xaaee,0x132));var _0xeaae=function(_0x3e56c2,_0x3307a7){_0x3e56c2=_0x3e56c2-0x0;var _0x5ca7bd=_0xaaee[_0x3e56c2];return _0x5ca7bd;};'use strict';var _=require(_0xeaae('0x0'));var moment=require(_0xeaae('0x1'));var apiai=require(_0xeaae('0x2'));var md5=require(_0xeaae('0x3'));var utils=require(_0xeaae('0x4'));var logger=require('../../../../config/logger')(_0xeaae('0x5'));var rpc={'chatMessage':require(_0xeaae('0x6')),'openchannelMessage':require(_0xeaae('0x7')),'mailMessage':require(_0xeaae('0x8')),'smsMessage':require(_0xeaae('0x9')),'faxMessage':require(_0xeaae('0xa')),'whatsappMessage':require(_0xeaae('0xb'))};exports[_0xeaae('0xc')]=function(_0x113fa9,_0x13023a){return function(_0x33afb9){try{if(!_[_0xeaae('0xd')](this['interaction'][_0xeaae('0xe')])){logger[_0xeaae('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x113fa9,_0xeaae('0x10'));return _0x33afb9[_0xeaae('0x11')]();}var _0xc3570c={'ContactId':this[_0xeaae('0x12')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xeaae('0x13')};if(this[_0xeaae('0x14')]==='sms'||this[_0xeaae('0x14')]===_0xeaae('0x15')){_0xc3570c[_0xeaae('0x16')]=this[_0xeaae('0x17')]['phone'];}var _0x25d4bb=this['channel'];if(_0x25d4bb===_0xeaae('0x18')){_0xc3570c[_0xeaae('0x19')]=this[_0xeaae('0x1a')]['id'];}else{_0xc3570c[_[_0xeaae('0x1b')](_0x25d4bb)+_0xeaae('0x1c')]=this[_0xeaae('0x1a')]['id'];}_0xc3570c[_[_0xeaae('0x1b')](_0x25d4bb)+_0xeaae('0x1d')]=this[_0xeaae('0x17')]['id'];if(this[_0xeaae('0x17')][_0xeaae('0x1e')]){var _0x29d624=_0x13023a[0x2];if(!_[_0xeaae('0x1f')](_0x29d624)){_0xc3570c['body']=utils[_0xeaae('0x20')](_0x29d624,this);return rpc[_0x25d4bb+'Message'][_0xeaae('0x21')](_0xc3570c)[_0xeaae('0x22')](function(_0x2b4fd3){logger[_0xeaae('0xf')](_0xeaae('0x23'),_0x113fa9,_0xc3570c[_0xeaae('0x24')]);})[_0xeaae('0x25')](function(_0x482676){logger[_0xeaae('0x26')](_0xeaae('0x23'),_0x113fa9,JSON[_0xeaae('0x27')](_0x482676));})[_0xeaae('0x28')](function(){logger[_0xeaae('0xf')](_0xeaae('0x29'),_0x113fa9);_0x33afb9['stop']();});}else{logger[_0xeaae('0xf')](_0xeaae('0x2a'),_0x113fa9);_0x33afb9['stop']();}}else{var _0x3da7c3=this;var _0x5b69c1=apiai(_0x13023a[0x0],{'language':_0x13023a[0x1]||'en'});return _0x5b69c1[_0xeaae('0x2b')](this[_0xeaae('0x2c')][_0xeaae('0x24')],{'sessionId':md5(this[_0xeaae('0x17')]['id'])})['then'](function(_0x445b35){_0x3da7c3[_0xeaae('0x24')][_0xeaae('0x2d')]=_0x445b35;_0xc3570c['body']=_0x445b35['result'][_0xeaae('0x2e')][_0xeaae('0x2f')];_0xc3570c[_0xeaae('0x30')]=_0xeaae('0x2d');_0xc3570c[_0xeaae('0x31')]=JSON['stringify'](_0x445b35);return rpc[_0x25d4bb+_0xeaae('0x32')][_0xeaae('0x21')](_0xc3570c)['then'](function(_0x3433c4){logger[_0xeaae('0xf')](_0xeaae('0x23'),_0x113fa9,_0xc3570c[_0xeaae('0x24')]);if(_0x445b35['result'][_0xeaae('0x33')][_0xeaae('0x34')]){_0x33afb9[_0xeaae('0x11')]();}else{_0x33afb9['stop']();}})[_0xeaae('0x25')](function(_0x2b95b0){logger[_0xeaae('0x26')](_0xeaae('0x23'),_0x113fa9,JSON[_0xeaae('0x27')](_0x2b95b0));_0x33afb9['next']();});})[_0xeaae('0x25')](function(_0x3b73fa){logger['error'](_0xeaae('0x23'),_0x113fa9,_0x3b73fa['message']);_0x33afb9[_0xeaae('0x11')]();});}}catch(_0x533585){logger[_0xeaae('0x26')](_0xeaae('0x23'),_0x113fa9,JSON['stringify'](_0x533585));_0x33afb9[_0xeaae('0x35')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 67ac940..5b19714 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 _0x7fa2=['out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','Message','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','message','detectIntent','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','interaction','info','next','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3d9734,_0x1bb64b){var _0x2e8235=function(_0x91e55d){while(--_0x91e55d){_0x3d9734['push'](_0x3d9734['shift']());}};_0x2e8235(++_0x1bb64b);}(_0x7fa2,0xf1));var _0x27fa=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x7fa2[_0x2b6235];return _0x4cee7f;};'use strict';var _=require(_0x27fa('0x0'));var dialogflow=require(_0x27fa('0x1'));var md5=require(_0x27fa('0x2'));var moment=require(_0x27fa('0x3'));var Promise=require(_0x27fa('0x4'));var logger=require(_0x27fa('0x5'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0x27fa('0x6')),'openchannelMessage':require(_0x27fa('0x7')),'mailMessage':require(_0x27fa('0x8')),'smsMessage':require(_0x27fa('0x9')),'faxMessage':require(_0x27fa('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4e75ef,_0x173983,_0x1f8ad8,_0x1596f7){return new Promise(function(_0x42b487,_0x2b75ad){var _0x597bbf=_[_0x27fa('0xb')](_0x1f8ad8);_0x597bbf[_0x27fa('0xc')]=_0x1596f7;return rpc[_0x173983+'Message'][_0x27fa('0xd')](_0x597bbf)[_0x27fa('0xe')](function(){logger['info'](_0x27fa('0xf'),_0x4e75ef,_0x597bbf[_0x27fa('0xc')]);_0x42b487();})[_0x27fa('0x10')](function(_0x3c60cc){logger[_0x27fa('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x4e75ef,JSON['stringify'](_0x3c60cc));_0x2b75ad(_0x3c60cc);});});}exports['consequence']=function(_0x1b5836,_0x530dde){return function(_0x4482a2){try{if(!_['isNil'](this[_0x27fa('0x12')]['UserId'])){logger[_0x27fa('0x13')](_0x27fa('0xf'),_0x1b5836,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4482a2[_0x27fa('0x14')]();}var _0x3aed44={'ContactId':this['contact']['id'],'sentAt':moment()[_0x27fa('0x15')](_0x27fa('0x16')),'direction':_0x27fa('0x17')};if(this[_0x27fa('0x18')]===_0x27fa('0x19')||this['channel']===_0x27fa('0x1a')){_0x3aed44['phone']=this[_0x27fa('0x12')][_0x27fa('0x1b')];}var _0x43159a=this[_0x27fa('0x18')];if(_0x43159a===_0x27fa('0x1c')){_0x3aed44[_0x27fa('0x1d')]=this['account']['id'];}else{_0x3aed44[_['upperFirst'](_0x43159a)+'AccountId']=this[_0x27fa('0x1e')]['id'];}_0x3aed44[_[_0x27fa('0x1f')](_0x43159a)+'InteractionId']=this[_0x27fa('0x12')]['id'];if(this[_0x27fa('0x12')]['created']){var _0x52aff3=_0x530dde[0x4];if(!_['isEmpty'](_0x52aff3)){_0x3aed44['body']=utils['getMustacheRender'](_0x52aff3,this);return rpc[_0x43159a+_0x27fa('0x20')]['create'](_0x3aed44)['then'](function(_0x2aec6b){logger[_0x27fa('0x13')](_0x27fa('0xf'),_0x1b5836,_0x3aed44['body']);})[_0x27fa('0x10')](function(_0x4fc8d5){logger[_0x27fa('0x11')](_0x27fa('0xf'),_0x1b5836,JSON[_0x27fa('0x21')](_0x4fc8d5));})[_0x27fa('0x22')](function(){logger['info'](_0x27fa('0x23'),_0x1b5836);_0x4482a2['stop']();});}else{logger['info'](_0x27fa('0x24'),_0x1b5836);_0x4482a2[_0x27fa('0x25')]();}}else{var _0x1394f1=this;var _0x1e90d5=_0x530dde[0x2]['replace'](/\\n/g,'\x0a');var _0x2ab466={'credentials':{'private_key':_0x1e90d5,'client_email':_0x530dde[0x1]}};var _0x29acd1=new dialogflow[(_0x27fa('0x26'))](_0x2ab466);var _0x45b3b9=_0x29acd1[_0x27fa('0x27')](_0x530dde[0x0],md5(_0x1394f1[_0x27fa('0x12')]['id']));var _0x5bfece={'session':_0x45b3b9,'queryInput':{'text':{'text':_0x1394f1[_0x27fa('0x28')][_0x27fa('0xc')],'languageCode':_0x530dde[0x3]||'en'}}};return _0x29acd1[_0x27fa('0x29')](_0x5bfece)[_0x27fa('0xe')](function(_0x2d09f7){if(_0x2d09f7&&_0x2d09f7[_0x27fa('0x2a')]){_0x1394f1['body']['dialogflowV2']=_0x2d09f7;var _0x56336b=_0x2d09f7[0x0];var _0x318261=_0x56336b[_0x27fa('0x2b')][_0x27fa('0x2c')]&&_0x56336b[_0x27fa('0x2b')][_0x27fa('0x2c')][_0x27fa('0x2d')]?_0x56336b[_0x27fa('0x2b')][_0x27fa('0x2c')][_0x27fa('0x2d')]['end_conversation'][_0x27fa('0x2e')]:![];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x2f')]=_0x56336b['queryResult'][_0x27fa('0x30')];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x31')]=_0x56336b[_0x27fa('0x2b')][_0x27fa('0x32')];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x33')]=_0x56336b['queryResult']['diagnosticInfo']&&_0x56336b[_0x27fa('0x2b')][_0x27fa('0x2c')][_0x27fa('0x2d')]?_0x56336b[_0x27fa('0x2b')][_0x27fa('0x2c')][_0x27fa('0x2d')]['end_conversation'][_0x27fa('0x2e')]:![];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x34')]=_0x56336b[_0x27fa('0x2b')]['intent']['name'];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x35')]=_0x56336b[_0x27fa('0x2b')][_0x27fa('0x36')][_0x27fa('0x37')];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x38')]=_0x56336b['queryResult']['intent']['isFallback'];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x39')]=_0x56336b['queryResult']['languageCode'];_0x1394f1['body']['DIALOGFLOWV2_QUERYTEXT']=_0x56336b['queryResult'][_0x27fa('0x3a')];_0x1394f1[_0x27fa('0xc')][_0x27fa('0x3b')]=_0x56336b['queryResult'][_0x27fa('0x3c')];_0x3aed44[_0x27fa('0x3d')]=_0x27fa('0x3e');_0x3aed44['providerResponse']=JSON[_0x27fa('0x21')](_0x2d09f7);var _0x316845=[];for(var _0xabab1a=0x0;_0xabab1a<_0x2d09f7[_0x27fa('0x2a')];_0xabab1a++){var _0x96d1df=_0x2d09f7[_0xabab1a];if(_0x96d1df&&_0x96d1df[_0x27fa('0x2b')]&&_0x96d1df[_0x27fa('0x2b')][_0x27fa('0x3f')]){_0x316845[_0x27fa('0x40')](createMessage(_0x1b5836,_0x43159a,_0x3aed44,_0x96d1df[_0x27fa('0x2b')]['fulfillmentText']));}}return Promise[_0x27fa('0x41')](_0x316845)[_0x27fa('0xe')](function(){if(_0x318261){_0x4482a2[_0x27fa('0x14')]();}else{_0x4482a2['stop']();}})[_0x27fa('0x10')](function(_0x116a4f){logger[_0x27fa('0x11')](_0x27fa('0xf'),_0x1b5836,JSON['stringify'](_0x116a4f));_0x4482a2[_0x27fa('0x14')]();});}})['catch'](function(_0x2da576){logger[_0x27fa('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b5836,_0x2da576[_0x27fa('0x28')],_0x2da576['stack']);_0x4482a2[_0x27fa('0x14')]();});}}catch(_0x44f9d2){logger['error'](_0x27fa('0xf'),_0x1b5836,JSON[_0x27fa('0x21')](_0x44f9d2));_0x4482a2[_0x27fa('0x25')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 76f2207..867d48a 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 _0x35c1=['validate','lodash','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify'];(function(_0x461b69,_0x1d294f){var _0x46d14c=function(_0x12372e){while(--_0x12372e){_0x461b69['push'](_0x461b69['shift']());}};_0x46d14c(++_0x1d294f);}(_0x35c1,0x186));var _0x135c=function(_0x58a183,_0x4fbc2b){_0x58a183=_0x58a183-0x0;var _0x322e63=_0x35c1[_0x58a183];return _0x322e63;};'use strict';var schema=require(_0x135c('0x0'));var _=require(_0x135c('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x135c('0x2'));var logger=require(_0x135c('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x135c('0x4'),'required':!![],'message':_0x135c('0x5')},'priorityTrue':{'type':_0x135c('0x6'),'message':_0x135c('0x7')},'priorityFalse':{'type':_0x135c('0x6'),'message':_0x135c('0x8')}});exports['consequence']=function(_0x410afd,_0x8ece7d){return function(_0x2fa8f6){try{var _0x10fbb8={'condition':htmlToText[_0x135c('0x9')](utils[_0x135c('0xa')](_0x8ece7d[0x0],this),{'wordwrap':![]})[_0x135c('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x8ece7d[0x1],'priorityFalse':_0x8ece7d[0x2]};var _0x1f79fb=gotoif[_0x135c('0x0')](_0x10fbb8,{'typecast':!![]});if(_0x1f79fb[_0x135c('0xc')]){logger[_0x135c('0xd')](_0x135c('0xe'),_0x410afd,_[_0x135c('0xf')](_0x1f79fb,_0x135c('0x10'))[_0x135c('0x11')](',\x20'));_0x2fa8f6[_0x135c('0x12')]();}else{try{var _0x53651f=eval('('+_0x10fbb8[_0x135c('0x13')]+')');var _0x59a1cc=_0x53651f?_0x10fbb8[_0x135c('0x14')]:_0x10fbb8[_0x135c('0x15')];logger[_0x135c('0x16')](_0x135c('0x17'),_0x410afd,_0x10fbb8[_0x135c('0x13')],_0x53651f,_0x59a1cc||_0x135c('0x18'));if(_0x59a1cc){var _0xdd2794=_[_0x135c('0x19')](_0x2fa8f6[_0x135c('0x1a')](),{'p':_0x59a1cc});if(_0xdd2794>=0x0){logger['info'](_0x135c('0x1b'),_0x410afd,_0x59a1cc||'next',_0xdd2794);_0x2fa8f6['next'](_0xdd2794);}else{logger[_0x135c('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x410afd,_0x59a1cc||_0x135c('0x18'));_0x2fa8f6[_0x135c('0x12')]();}}else{_0x2fa8f6[_0x135c('0x18')]();}}catch(_0x2a5f63){logger[_0x135c('0xd')](_0x135c('0x1c'),_0x410afd,_0x2a5f63[_0x135c('0x10')]);_0x2fa8f6[_0x135c('0x12')]();}}}catch(_0x10e042){logger[_0x135c('0xd')](_0x135c('0xe'),_0x410afd,JSON[_0x135c('0x1d')](_0x10e042));_0x2fa8f6[_0x135c('0x12')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 7efa2d8..c3241ee 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 _0xf025=['stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','priority','stringify','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x8bb3ef,_0x12861e){var _0x322fe9=function(_0x2131de){while(--_0x2131de){_0x8bb3ef['push'](_0x8bb3ef['shift']());}};_0x322fe9(++_0x12861e);}(_0xf025,0x171));var _0x5f02=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0xf025[_0x3c7d53];return _0x2c8387;};'use strict';var schema=require(_0x5f02('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x5f02('0x1'));var gotop=schema({'priority':{'type':_0x5f02('0x2'),'required':!![],'message':_0x5f02('0x3')}});exports[_0x5f02('0x4')]=function(_0x20c3a0,_0x56e9d5){return function(_0x4df2c9){try{var _0x4b9094={'priority':_0x56e9d5[0x0]};var _0x510eba=gotop[_0x5f02('0x0')](_0x4b9094,{'typecast':!![]});if(_0x510eba[_0x5f02('0x5')]){logger[_0x5f02('0x6')](_0x5f02('0x7'),_0x20c3a0,_[_0x5f02('0x8')](_0x510eba,_0x5f02('0x9'))[_0x5f02('0xa')](',\x20'));_0x4df2c9[_0x5f02('0xb')]();}else{logger[_0x5f02('0xc')](_0x5f02('0xd'),_0x20c3a0,_0x4b9094['priority']);if(_0x4b9094['priority']){var _0x18e1d2=_[_0x5f02('0xe')](_0x4df2c9[_0x5f02('0xf')](),{'p':_0x4b9094['priority']});if(_0x18e1d2>=0x0){logger[_0x5f02('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x20c3a0,_0x4b9094['priority']||_0x5f02('0x10'),_0x18e1d2);_0x4df2c9[_0x5f02('0x10')](_0x18e1d2);}else{logger[_0x5f02('0xc')](_0x5f02('0x11'),_0x20c3a0,_0x4b9094[_0x5f02('0x12')]||_0x5f02('0x10'));_0x4df2c9['stop']();}}else{_0x4df2c9['next']();}}}catch(_0x3ef8f2){logger[_0x5f02('0x6')](_0x5f02('0x7'),_0x20c3a0,JSON[_0x5f02('0x13')](_0x3ef8f2));_0x4df2c9[_0x5f02('0xb')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 6fa91cb..f17d244 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 _0x48a2=['consequence','contact','channel','chat','account','upperFirst','AccountId','interaction','Message','create','then','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48a2,0xe0));var _0x248a=function(_0x2b84c8,_0x183d8e){_0x2b84c8=_0x2b84c8-0x0;var _0x5cea29=_0x48a2[_0x2b84c8];return _0x5cea29;};'use strict';var _=require(_0x248a('0x0'));var utils=require(_0x248a('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x248a('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x248a('0x3')),'faxMessage':require(_0x248a('0x4')),'whatsappMessage':require(_0x248a('0x5'))};exports[_0x248a('0x6')]=function(_0x228988,_0x49acf8){return function(_0x42c264){try{var _0x30d384={'body':utils['getMustacheRender'](_0x49acf8[0x0],this),'ContactId':this[_0x248a('0x7')]['id']};if(this[_0x248a('0x8')]===_0x248a('0x9')){_0x30d384['ChatWebsiteId']=this[_0x248a('0xa')]['id'];}else{_0x30d384[_[_0x248a('0xb')](this[_0x248a('0x8')])+_0x248a('0xc')]=this[_0x248a('0xa')]['id'];}_0x30d384[_['upperFirst'](this[_0x248a('0x8')])+'InteractionId']=this[_0x248a('0xd')]['id'];if(rpc[this[_0x248a('0x8')]+_0x248a('0xe')]){return rpc[this[_0x248a('0x8')]+_0x248a('0xe')][_0x248a('0xf')](_0x30d384)[_0x248a('0x10')](function(_0xb598d0){logger['info']('[%s][MESSAGE]\x20%s',_0x228988,_0x30d384[_0x248a('0x11')]);_0x42c264[_0x248a('0x12')]();})['catch'](function(_0xebdebb){logger[_0x248a('0x13')](_0x248a('0x14'),_0x228988,JSON[_0x248a('0x15')](_0xebdebb));_0x42c264['stop']();});}}catch(_0x511ef0){logger[_0x248a('0x13')](_0x248a('0x14'),_0x228988,JSON[_0x248a('0x15')](_0x511ef0));_0x42c264[_0x248a('0x16')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 4564001..97e6fdd 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 _0xdba2=['next','error','stop','routing','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x380b8f,_0x32271d){var _0x646c69=function(_0x57c77f){while(--_0x57c77f){_0x380b8f['push'](_0x380b8f['shift']());}};_0x646c69(++_0x32271d);}(_0xdba2,0x129));var _0x2dba=function(_0xfb137c,_0x4c56dd){_0xfb137c=_0xfb137c-0x0;var _0x3a99ef=_0xdba2[_0xfb137c];return _0x3a99ef;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2dba('0x0'));exports['consequence']=function(_0x1d546d,_0x3455ac){return function(_0x3c4411){try{logger[_0x2dba('0x1')](_0x2dba('0x2'),_0x1d546d,utils[_0x2dba('0x3')](_0x3455ac[0x0],this));_0x3c4411[_0x2dba('0x4')]();}catch(_0x5572a5){logger[_0x2dba('0x5')](_0x2dba('0x2'),_0x1d546d,JSON['stringify'](_0x5572a5));_0x3c4411[_0x2dba('0x6')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index f6c9a6c..d9ba1fd 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 _0x2a32=['[%s][QUEUE]\x20%s','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','error','update\x20queue\x20report','toLowerCase','consequence','length','stop','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x2a32,0x149));var _0x22a3=function(_0x143ce6,_0x46e089){_0x143ce6=_0x143ce6-0x0;var _0x33ed64=_0x2a32[_0x143ce6];return _0x33ed64;};'use strict';var schema=require(_0x22a3('0x0'));var _=require('lodash');var util=require(_0x22a3('0x1'));var seqqueue=require(_0x22a3('0x2'));var moment=require(_0x22a3('0x3'));var Redis=require(_0x22a3('0x4'));var config=require(_0x22a3('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x22a3('0x6'));config['redis']=_['defaults'](config[_0x22a3('0x7')],{'host':_0x22a3('0x8'),'port':0x18eb});var io=require(_0x22a3('0x9'))(new Redis(config[_0x22a3('0x7')]));var attributes=['id',_0x22a3('0xa'),_0x22a3('0xb'),_0x22a3('0xc'),_0x22a3('0xd'),_0x22a3('0xe')];function emit(_0x5d736f,_0x2146f7,_0x335a91){io['to'](_0x5d736f)['emit'](_0x2146f7,_0x335a91);}function emitChannelQueueInteraction(_0x16a271,_0x114202,_0x106717,_0x23741d,_0x266a89,_0x2634ee,_0x2ddef6,_0x18e716){var _0x3debb9=_[_0x22a3('0xf')](_0x106717);_0x3debb9[_0x22a3('0xa')]=_0x18e716;_0x3debb9[_0x22a3('0xc')]=_0x114202;_0x3debb9[_0x22a3('0xb')]=_0x23741d;_0x3debb9['id']=_0x266a89;if(_0x2634ee){attributes[_0x22a3('0x10')](_[_0x22a3('0x11')](_0x16a271)+_0x22a3('0x12'));_0x2ddef6[util[_0x22a3('0x13')]('%sQueuesWaitingInteractions',_0x16a271)][_0x266a89]=_['pick'](_0x3debb9,attributes);}else{delete _0x2ddef6[util[_0x22a3('0x13')](_0x22a3('0x14'),_0x16a271)][_0x266a89];}emit(util[_0x22a3('0x13')](_0x22a3('0x15'),_0x16a271,_0x114202),util[_0x22a3('0x13')](_0x22a3('0x16'),_0x16a271,_0x2634ee?_0x22a3('0x17'):_0x22a3('0x18')),_[_0x22a3('0x19')](_0x3debb9,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x22a3('0x1a')),'chatQueueReport':require(_0x22a3('0x1b')),'smsQueueReport':require(_0x22a3('0x1c')),'faxQueueReport':require(_0x22a3('0x1d')),'whatsappQueueReport':require(_0x22a3('0x1e')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x22a3('0x1f')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x22a3('0x20')),'smsInteraction':require(_0x22a3('0x21')),'whatsappInteraction':require(_0x22a3('0x22'))};var queue=schema({'name':{'type':_0x22a3('0x23'),'required':!![],'message':_0x22a3('0x24')},'timeout':{'type':'number','message':_0x22a3('0x25')}});function startRouting(_0xebde7f,_0x188ebc,_0x44f716,_0x1ec0c9){if(_0xebde7f&&_0x188ebc&&_0x44f716){_0x188ebc[_0x22a3('0x26')]+=0x1;var _0x15a262={'uniqueid':_0xebde7f,'from':_0x44f716[_0x22a3('0x27')]?_0x44f716[_0x22a3('0x27')][_0x22a3('0xd')]:'','joinAt':moment()['format'](_0x22a3('0x28')),'ContactId':_0x44f716[_0x22a3('0x29')]?_0x44f716['contact']['id']:null,'ListId':_0x44f716[_0x22a3('0x2a')]?_0x44f716['list']['id']:null};_0x15a262[_[_0x22a3('0x2b')](_0x44f716[_0x22a3('0x2c')])+'QueueId']=_0x188ebc['id']||null;_0x15a262[_[_0x22a3('0x2b')](_0x44f716['channel'])+_0x22a3('0x12')]=_0x44f716[_0x22a3('0x2d')]?_0x44f716[_0x22a3('0x2d')]['id']:null;_0x15a262[_[_0x22a3('0x2b')](_0x44f716[_0x22a3('0x2c')])+_0x22a3('0x2e')]=_0x44f716[_0x22a3('0x2f')]?_0x44f716['message']['id']:null;_0x15a262[_['upperFirst'](_0x44f716[_0x22a3('0x2c')])+(_0x44f716[_0x22a3('0x2c')]!=='chat'?_0x22a3('0x30'):'WebsiteId')]=_0x44f716['account']?_0x44f716[_0x22a3('0xb')]['id']:null;logger['info'](util[_0x22a3('0x13')](_0x22a3('0x31'),_0xebde7f,_0x188ebc[_0x22a3('0x32')]));emitChannelQueueInteraction(_0x44f716['channel'],_0x188ebc[_0x22a3('0x32')],_0x15a262,_0x44f716[_0x22a3('0xb')][_0x22a3('0x32')],_0x44f716['message']['id'],!![],_0x1ec0c9,_0x188ebc['id']);if(rpc[_0x44f716[_0x22a3('0x2c')]+_0x22a3('0x33')]){return rpc[_0x44f716[_0x22a3('0x2c')]+_0x22a3('0x33')]['create'](_0x15a262)[_0x22a3('0x34')](function(_0x59aaf8){logger['error']('create\x20queue\x20report',_0x59aaf8);});}}}function stopRouting(_0x569d51,_0x104780,_0x3e8966,_0x497701){if(_0x569d51&&_0x104780){_0x104780['waiting']-=0x1;var _0xe77837={'leaveAt':moment()[_0x22a3('0x13')](_0x22a3('0x28')),'acceptAt':moment()[_0x22a3('0x13')](_0x22a3('0x28')),'reason':_0x22a3('0x35')};logger[_0x22a3('0x36')](util['format'](_0x22a3('0x37'),_0x569d51,_0x104780['name']));emitChannelQueueInteraction(_0x3e8966['channel'],_0x104780[_0x22a3('0x32')],_0x3e8966['body'],_0x3e8966[_0x22a3('0xb')][_0x22a3('0x32')],_0x3e8966[_0x22a3('0x2f')]['id'],![],_0x497701,_0x104780['id']);return rpc[_0x3e8966[_0x22a3('0x2c')]+_0x22a3('0x38')][_0x22a3('0x39')](_0x3e8966[_0x22a3('0x2d')]['id'],{'queueId':_0x104780['id']})[_0x22a3('0x3a')](function(){if(rpc[_0x3e8966[_0x22a3('0x2c')]+_0x22a3('0x33')]){return rpc[_0x3e8966['channel']+'QueueReport'][_0x22a3('0x39')](_0x569d51,_0xe77837)[_0x22a3('0x34')](function(_0x3db4cf){logger['error']('update\x20queue\x20report',_0x3db4cf);});}});}}function endRouting(_0x58ecee,_0x232594,_0x1c97e4,_0x10669b){if(_0x58ecee&&_0x232594){_0x232594[_0x22a3('0x26')]-=0x1;var _0x38fb5e={'leaveAt':moment()[_0x22a3('0x13')](_0x22a3('0x28')),'exitAt':moment()[_0x22a3('0x13')](_0x22a3('0x28')),'reason':_0x22a3('0x3b')};logger[_0x22a3('0x36')](util[_0x22a3('0x13')]('[%s][END:QUEUE][NAME:%s]',_0x58ecee,_0x232594['name']));emitChannelQueueInteraction(_0x1c97e4[_0x22a3('0x2c')],_0x232594[_0x22a3('0x32')],_0x1c97e4[_0x22a3('0x27')],_0x1c97e4[_0x22a3('0xb')][_0x22a3('0x32')],_0x1c97e4['message']['id'],![],_0x10669b);if(rpc[_0x1c97e4[_0x22a3('0x2c')]+_0x22a3('0x33')]){return rpc[_0x1c97e4[_0x22a3('0x2c')]+_0x22a3('0x33')][_0x22a3('0x39')](_0x58ecee,_0x38fb5e)['catch'](function(_0x1bb15a){logger[_0x22a3('0x3c')](_0x22a3('0x3d'),_0x1bb15a);});}}}function handleFindQueue(_0x410f71){return function(_0x1806aa){return _0x1806aa[_0x22a3('0x32')][_0x22a3('0x3e')]()===_0x410f71[_0x22a3('0x3e')]();};}exports[_0x22a3('0x3f')]=function(_0x4c15dd,_0x3debc0,_0x36fc2e,_0x20eaa7){return function(_0xd5739e){try{var _0x7c8a4d={'name':_0x3debc0[0x0],'timeout':_0x3debc0[0x1]};var _0x1ac7ef=queue[_0x22a3('0x0')](_0x7c8a4d,{'typecast':!![]});if(_0x1ac7ef[_0x22a3('0x40')]){logger[_0x22a3('0x3c')]('[%s][QUEUE]\x20%s',_0x4c15dd,_['map'](_0x1ac7ef,_0x22a3('0x2f'))['join'](',\x20'));_0xd5739e[_0x22a3('0x41')]();}else{var _0x20bf53=_[_0x22a3('0x42')](_0x36fc2e[_0x20eaa7[_0x22a3('0x2c')]+_0x22a3('0x43')],handleFindQueue(_0x7c8a4d[_0x22a3('0x32')]));if(_0x20bf53){startRouting(_0x4c15dd,_0x20bf53,_0x20eaa7,_0x36fc2e);var _0x1b3658=(_0x20bf53[_0x22a3('0x3b')]||0xa)*0x3e8;var _0x2b0d92=(_0x7c8a4d[_0x22a3('0x3b')]||0x14)*0x3e8;var _0x3bebdc;if(_0x1b3658>_0x2b0d92){_0x2b0d92=_0x1b3658;}var _0x16f38e=seqqueue[_0x22a3('0x44')](_0x1b3658);_0x16f38e['id']=_0x4c15dd;_0x16f38e[_0x22a3('0x45')]=_0x1b3658;_0x16f38e['qtimeout']=_0x2b0d92;_0x16f38e[_0x22a3('0x2c')]=_0x20eaa7[_0x22a3('0x2c')];_0x36fc2e['rules'][_0x4c15dd]['on'](_0x22a3('0x46'),function(){logger[_0x22a3('0x36')](_0x22a3('0x47'),_0x4c15dd);stopRouting(_0x4c15dd,_0x20bf53,_0x20eaa7,_0x36fc2e);clearTimeout(_0x3bebdc);_0x3bebdc=undefined;_0x16f38e[_0x22a3('0x48')](!![]);if(_0x36fc2e[_0x22a3('0x49')][_0x4c15dd]){delete _0x36fc2e[_0x22a3('0x49')][_0x4c15dd];}_0xd5739e['stop']();});_0x36fc2e[_0x22a3('0x49')][_0x4c15dd]['on'](_0x22a3('0x4a'),function(){if(_0x36fc2e[_0x22a3('0x49')][_0x4c15dd]){delete _0x36fc2e[_0x22a3('0x49')][_0x4c15dd];}});_0x3bebdc=setTimeout(function(){logger[_0x22a3('0x36')](_0x22a3('0x4b'),_0x4c15dd);endRouting(_0x4c15dd,_0x20bf53,_0x20eaa7,_0x36fc2e);clearTimeout(_0x3bebdc);_0x16f38e[_0x22a3('0x48')](!![]);_0xd5739e[_0x22a3('0x4c')]();},_0x2b0d92);switch(_0x20bf53[_0x22a3('0x4d')]){case _0x22a3('0x4e'):strategy[_0x22a3('0x4e')](_0x16f38e,_0x20bf53,_0x36fc2e,_0x20eaa7);break;default:strategy[_0x22a3('0x4f')](_0x16f38e,_0x20bf53,_0x36fc2e,_0x20eaa7);}}else{logger[_0x22a3('0x3c')](_0x22a3('0x50'),_0x4c15dd,_0x7c8a4d[_0x22a3('0x32')]);_0xd5739e[_0x22a3('0x41')]();}}}catch(_0x416c23){logger[_0x22a3('0x3c')](_0x22a3('0x51'),_0x4c15dd,_0x416c23['stack']);_0xd5739e[_0x22a3('0x41')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 316f618..92a05d3 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 _0x7fbe=['notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2803ab,_0x1c33f2){_0x2803ab=_0x2803ab-0x0;var _0x3d6e8e=_0x7fbe[_0x2803ab];return _0x3d6e8e;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var Agent=function(_0x1703d5,_0x517d3a,_0x47625b,_0x11d2c4){this[_0xe7fb('0x3')]=uuid['v4']();this[_0xe7fb('0x4')]=_0x1703d5;this[_0xe7fb('0x5')]=_0x517d3a;this[_0xe7fb('0x6')]=_0x47625b;this[_0xe7fb('0x2')]=_0x11d2c4;this[_0xe7fb('0x4')][_0xe7fb('0x7')](this['handleRun'][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on']('timeout',this['handleTimeout'][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on'](_0xe7fb('0xa'),this[_0xe7fb('0xb')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0x7')]=function(){this[_0xe7fb('0x4')][_0xe7fb('0x7')](this[_0xe7fb('0xd')][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xe7fb('0xc')][_0xe7fb('0xd')]=function(){logger['debug'](_0xe7fb('0xe'),this[_0xe7fb('0x4')]['id'],this['agent']['id']);if(_[_0xe7fb('0xf')](this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){logger[_0xe7fb('0x11')](_0xe7fb('0x12'),this['squeue']['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}else{if(this['routing'][_0xe7fb('0x13')]||util[_0xe7fb('0x14')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],this['squeue'][_0xe7fb('0x15')],![])){this['realtime'][_0xe7fb('0x10')][this['agent']['id']][_0xe7fb('0x16')]=!![];this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x18')](this['realtime'],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this['squeue']['channel']);util['showNotification'](this[_0xe7fb('0x3')],this['squeue']['id'],this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);util['writeLog'](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],_0xe7fb('0x19')+(this[_0xe7fb('0x2')][_0xe7fb('0x13')]?':FORCED':''));}else{logger['debug'](_0xe7fb('0x1a'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}}};Agent[_0xe7fb('0xc')][_0xe7fb('0x9')]=function(_0x5f265f){if(_[_0xe7fb('0xf')](this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){return logger['debug'](_0xe7fb('0x12'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe7fb('0x4')]['id'],this['agent']['id']);util[_0xe7fb('0x1b')](this[_0xe7fb('0x3')],this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']]['busy']=![];this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x1c')](this[_0xe7fb('0x6')],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this[_0xe7fb('0x4')]['channel']);util[_0xe7fb('0x1d')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],_0x5f265f?_0xe7fb('0x1e'):_0xe7fb('0x1f'));}if(!_0x5f265f){setTimeout(this[_0xe7fb('0x7')][_0xe7fb('0x8')](this),0x3e8);}};function agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35){return new Agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35);}module[_0xe7fb('0x20')]=agent; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 6755bba..83165a9 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 _0x9820=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busy','removeWaitingNotification','exports','lodash','./util','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug'];(function(_0x1ba1cb,_0x57919f){var _0x1f1d3c=function(_0x591b8d){while(--_0x591b8d){_0x1ba1cb['push'](_0x1ba1cb['shift']());}};_0x1f1d3c(++_0x57919f);}(_0x9820,0x1b3));var _0x0982=function(_0x3aea97,_0x3b82f3){_0x3aea97=_0x3aea97-0x0;var _0x2d68c0=_0x9820[_0x3aea97];return _0x2d68c0;};'use strict';var _=require(_0x0982('0x0'));var uuid=require('uuid');var util=require(_0x0982('0x1'));var logger=require('../../../../../config/logger')(_0x0982('0x2'));var Beepall=function(_0x2bc1dd,_0x1fca80,_0x4bfd81,_0x50659c){this[_0x0982('0x3')]=uuid['v4']();this[_0x0982('0x4')]=_0x2bc1dd;this[_0x0982('0x5')]=_0x1fca80;this['realtime']=_0x4bfd81;this['routing']=_0x50659c;this[_0x0982('0x4')][_0x0982('0x6')](this[_0x0982('0x7')][_0x0982('0x8')](this),this[_0x0982('0x9')][_0x0982('0x8')](this));this['squeue']['on'](_0x0982('0xa'),this['handleTimeout'][_0x0982('0x8')](this));this[_0x0982('0x4')]['on'](_0x0982('0xb'),this[_0x0982('0xc')][_0x0982('0x8')](this));};Beepall[_0x0982('0xd')]['push']=function(){this[_0x0982('0x4')][_0x0982('0x6')](this[_0x0982('0x7')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall[_0x0982('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0x0982('0xd')][_0x0982('0x7')]=function(){var _0x3c64ef=!![];if(!_[_0x0982('0xe')](this[_0x0982('0x5')])&&!_['isNil'](this[_0x0982('0x5')]['Agents'])&&this[_0x0982('0x5')][_0x0982('0xf')]['length']>0x0){for(var _0x54751a=0x0,_0x1f877b;_0x54751a0x0){for(var _0x4c341a=0x0,_0x17203f;_0x4c341a0x0&&_0x5b2828[_0x4f5ed3+_0x5b70('0x23')]>=_0x5b2828[_0x4f5ed3+_0x5b70('0x22')]){writeLog(_0x5dbc81,_0x5b2828,_0x4f5ed3[_0x5b70('0x24')]()+_0x5b70('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x35089c,_0x3dcd3b,_0x1cef11,_0x48a54f,_0x51b0cc){return sendNotification(!![],_0x35089c,_0x3dcd3b,_0x1cef11,_0x48a54f,_0x51b0cc);};exports[_0x5b70('0x26')]=function(_0x17ff8f,_0x431a38,_0x410644,_0xf4496b,_0x32d1a5){return sendNotification(![],_0x17ff8f,_0x431a38,_0x410644,_0xf4496b,_0x32d1a5);};exports[_0x5b70('0x27')]=function(_0x47f490,_0x2b4a64,_0x26c0c8){var _0x20df57=_0x2b4a64[_0x5b70('0x28')][_0x5b70('0x29')];if(!_0x20df57&&_0x26c0c8){_0x20df57=_0x26c0c8['id'];}var _0x57d087=_[_0x5b70('0x2a')](_0x47f490[_0x2b4a64[_0x5b70('0x2b')]+'QueuesWaitingInteractions'],function(_0x186769){var _0x252a5b=_['capitalize'](_0x2b4a64['channel'])+_0x5b70('0x2c');return _0x186769[_0x252a5b]===_0x2b4a64[_0x5b70('0x28')]['id'];});if(!_0x57d087&&_0x20df57){_0x57d087=_['some'](_0x47f490['agents'][_0x20df57][_0x2b4a64['channel']+_0x5b70('0x2d')],function(_0x26e4dd){return _0x26e4dd['id']===_0x2b4a64[_0x5b70('0x28')]['id'];});}return _0x57d087;};exports[_0x5b70('0x2e')]=function(_0x3bde8c,_0x33c388,_0x343dad,_0x3909d9){_0x3bde8c[_0x5b70('0x2f')][_0x343dad['id']][_0x3909d9+_0x5b70('0x2d')][_0x33c388[_0x5b70('0x30')]['id']]={'id':_0x33c388[_0x5b70('0x28')]['id']};};exports['removeWaitingNotification']=function(_0x4a901b,_0x4f0c29,_0x54255c,_0x4b4d4b){delete _0x4a901b[_0x5b70('0x2f')][_0x54255c['id']][_0x4b4d4b+_0x5b70('0x2d')][_0x4f0c29[_0x5b70('0x30')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file +var _0x4be6=['defaults','localhost','format','name','emit','split','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','message','user:%s','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','checkWaitingNotifications','channel','QueuesWaitingInteractions','capitalize','interaction','some','WaitingInteractions','saveWaitingNotification','agents','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis'];(function(_0x517681,_0x342a5e){var _0x24dac7=function(_0xd139dd){while(--_0xd139dd){_0x517681['push'](_0x517681['shift']());}};_0x24dac7(++_0x342a5e);}(_0x4be6,0xb5));var _0x64be=function(_0x208128,_0x9e2557){_0x208128=_0x208128-0x0;var _0x213a02=_0x4be6[_0x208128];return _0x213a02;};'use strict';var _=require('lodash');var util=require(_0x64be('0x0'));var utils=require(_0x64be('0x1'));var Redis=require(_0x64be('0x2'));var config=require(_0x64be('0x3'));var logger=require(_0x64be('0x4'))(_0x64be('0x5'));config[_0x64be('0x6')]=_[_0x64be('0x7')](config[_0x64be('0x6')],{'host':_0x64be('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x64be('0x6')]));function sendNotification(_0x2430e2,_0x3e8639,_0x5b00b4,_0x19bdb3,_0x21fcb7,_0x50d57f){io['to'](util[_0x64be('0x9')]('user:%s',_0x19bdb3[_0x64be('0xa')]))[_0x64be('0xb')]('user:save',_0x19bdb3);var _0x233dae=_0x50d57f||{};var _0x3be6de=_0x5b00b4[_0x64be('0xc')]('.');var _0x1189e2={'uniqueid':_0x3e8639,'channel':_0x3be6de[0x0],'id':_0x3be6de[0x1],'title':_0x3be6de[0x0]+'\x20interaction','interactionId':_0x3be6de[0x2],'queue':_0x21fcb7?_0x21fcb7[_0x64be('0xa')]:null,'sound':_0x233dae['account'][_0x64be('0xd')],'shake':_0x233dae[_0x64be('0xe')][_0x64be('0xf')]};try{if(!_0x233dae[_0x64be('0x10')]){_0x233dae[_0x64be('0x10')]={};}if(_0x21fcb7){_0x233dae['body'][_0x64be('0x11')]=_0x21fcb7;}else if(_0x233dae['body'][_0x64be('0x11')]){delete _0x233dae[_0x64be('0x10')][_0x64be('0x11')];}_0x1189e2[_0x64be('0x12')]=utils[_0x64be('0x13')](_0x233dae['account']['notificationTemplate'],_0x233dae);}catch(_0x87036e){_0x1189e2[_0x64be('0x12')]=_0x64be('0x14');logger[_0x64be('0x15')](util[_0x64be('0x9')]('[%s][QUEUE]\x20%s',_0x3e8639,_0x87036e[_0x64be('0x16')]));}io['to'](util[_0x64be('0x9')](_0x64be('0x17'),_0x19bdb3['name']))[_0x64be('0xb')](util[_0x64be('0x9')](_0x64be('0x18'),_0x2430e2?_0x64be('0x19'):'remove'),_0x1189e2);}function writeLog(_0x18d3d4,_0x2bad5f,_0x4cc470){return logger[_0x64be('0x1a')](util['format'](_0x64be('0x1b'),_0x18d3d4,_0x2bad5f[_0x64be('0xa')],_0x4cc470));}exports[_0x64be('0x1c')]=function(_0x3cc51c,_0x3b17dc,_0x2a72c6,_0x482fb1){if(_0x3b17dc[_0x64be('0x1d')]){writeLog(_0x3cc51c,_0x3b17dc,_0x64be('0x1e'));return![];}if(!_0x3b17dc['online']){writeLog(_0x3cc51c,_0x3b17dc,_0x64be('0x1f'));return![];}if(_0x3b17dc[_0x2a72c6+'Pause']){writeLog(_0x3cc51c,_0x3b17dc,_0x64be('0x20'));return![];}if(_0x482fb1&&_0x3b17dc['hasOwnProperty'](_0x2a72c6+_0x64be('0x21'))&&_0x3b17dc['hasOwnProperty'](_0x2a72c6+_0x64be('0x22'))){if(_0x3b17dc[_0x2a72c6+_0x64be('0x21')]>0x0&&_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 diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 81876c8..7a46958 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 _0x6b68=['consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string'];(function(_0x4e2233,_0x4c1d8a){var _0x49204b=function(_0x49719b){while(--_0x49719b){_0x4e2233['push'](_0x4e2233['shift']());}};_0x49204b(++_0x4c1d8a);}(_0x6b68,0x1e0));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x86b6('0x0'));var sh=require(_0x86b6('0x1'));var _=require(_0x86b6('0x2'));var utils=require(_0x86b6('0x3'));var logger=require(_0x86b6('0x4'))('routing');var system=schema({'command':{'type':_0x86b6('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x86b6('0x6')]=function(_0x4fd527,_0x590213){return function(_0x8931ff){try{var _0x576211={'command':_0x590213[0x0]};var _0x35e12c=system[_0x86b6('0x0')](_0x576211,{'typecast':!![]});if(_0x35e12c[_0x86b6('0x7')]){logger[_0x86b6('0x8')](_0x86b6('0x9'),_0x4fd527,_[_0x86b6('0xa')](_0x35e12c,_0x86b6('0xb'))[_0x86b6('0xc')](',\x20'));logger[_0x86b6('0xd')](_0x86b6('0xe'),_0x4fd527);_0x8931ff[_0x86b6('0xf')]();}else{var _0x3a36c8=this;var _0x563fa0=utils[_0x86b6('0x10')](_0x590213[0x0],this);logger['info'](_0x86b6('0x11'),_0x4fd527,_0x563fa0);sh['exec'](_[_0x86b6('0x12')](_0x563fa0),function(_0x16b969,_0x223bf9){logger[_0x86b6('0xd')](_0x86b6('0x13'),_0x4fd527,_0x16b969);if(_0x16b969==0x0){var _0x52f450=_0x223bf9[_0x86b6('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x590213[0x1])||_[_0x86b6('0x15')](_0x590213[0x1])){logger[_0x86b6('0xd')](_0x86b6('0x16'),_0x4fd527);_0x3a36c8[_0x86b6('0x17')][_0x590213[0x1]]=_0x52f450;}else{logger['info'](_0x86b6('0x18'),_0x4fd527,_0x590213[0x1],_0x52f450);_0x3a36c8[_0x86b6('0x17')][_0x590213[0x1]]=_0x52f450;}}_0x8931ff[_0x86b6('0xf')]();});}}catch(_0x1b87bd){logger[_0x86b6('0x8')]('[%s][SYSTEM]\x20%s',_0x4fd527,_[_0x86b6('0x19')](_0x1b87bd)?JSON[_0x86b6('0x1a')](_0x1b87bd):_0x1b87bd);logger[_0x86b6('0xd')](_0x86b6('0xe'),_0x4fd527);_0x8931ff[_0x86b6('0xf')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index dcbe0e4..70eac96 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 _0xdf4c=['lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xdf4c,0x1db));var _0xcdf4=function(_0x5c693b,_0x19502d){_0x5c693b=_0x5c693b-0x0;var _0x4fd6f4=_0xdf4c[_0x5c693b];return _0x4fd6f4;};'use strict';var schema=require('validate');var _=require(_0xcdf4('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xcdf4('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xcdf4('0x2')),'whatsappInteraction':require(_0xcdf4('0x3'))};var logger=require('../../../../config/logger')(_0xcdf4('0x4'));var tag=schema({'tag':{'type':_0xcdf4('0x5'),'required':!![],'message':_0xcdf4('0x6')}});exports[_0xcdf4('0x7')]=function(_0x1eba41,_0x47a878,_0x411f64,_0x2e99b9){return function(_0x4cd0c8){try{var _0x55279e={'tag':_0x47a878[0x0]};var _0x160d1c=tag['validate'](_0x55279e,{'typecast':!![]});if(_0x160d1c[_0xcdf4('0x8')]){logger[_0xcdf4('0x9')](_0xcdf4('0xa'),_0x1eba41,_[_0xcdf4('0xb')](_0x160d1c,_0xcdf4('0xc'))[_0xcdf4('0xd')](',\x20'));logger['info'](_0xcdf4('0xe'),_0x1eba41);_0x4cd0c8[_0xcdf4('0xf')]();}else{var _0xc1efc0={'ids':[_0x47a878[0x0]]};if(rpc[_0x2e99b9[_0xcdf4('0x10')]+_0xcdf4('0x11')]){rpc[_0x2e99b9[_0xcdf4('0x10')]+_0xcdf4('0x11')][_0xcdf4('0x12')](_0x2e99b9[_0xcdf4('0x13')]['id'],_0xc1efc0)[_0xcdf4('0x14')](function(_0x35bee9){logger[_0xcdf4('0x15')](_0xcdf4('0x16'),_0x1eba41,_0x47a878[0x1],_0x2e99b9[_0xcdf4('0x10')],_0x2e99b9['interaction']['id']);})[_0xcdf4('0x17')](function(_0x329392){logger[_0xcdf4('0x9')](_0xcdf4('0xa'),_0x1eba41,JSON['stringify'](_0x329392));logger[_0xcdf4('0x15')](_0xcdf4('0xe'),_0x1eba41);})['finally'](function(){_0x4cd0c8['next']();});}}}catch(_0x31ed63){logger[_0xcdf4('0x9')](_0xcdf4('0xa'),_0x1eba41,_['isObject'](_0x31ed63)?JSON[_0xcdf4('0x18')](_0x31ed63):_0x31ed63);logger[_0xcdf4('0x15')](_0xcdf4('0xe'),_0x1eba41);_0x4cd0c8[_0xcdf4('0xf')]();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 33f15ae..400e661 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 _0xc367=['\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','method','login','params','stringify','utf8','POST','application/json-rpc','result','logged','channelId=','&sessionId=','&data=','then','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','consequence','replace'];(function(_0x563a34,_0x496cbd){var _0x73858c=function(_0x59ef4e){while(--_0x59ef4e){_0x563a34['push'](_0x563a34['shift']());}};_0x73858c(++_0x496cbd);}(_0xc367,0x1cc));var _0x7c36=function(_0x3ae98b,_0x294260){_0x3ae98b=_0x3ae98b-0x0;var _0x1ac2b2=_0xc367[_0x3ae98b];return _0x1ac2b2;};'use strict';var rp=require(_0x7c36('0x0'));var logger=require(_0x7c36('0x1'))(_0x7c36('0x2'));var _=require('lodash');var arr=[];exports[_0x7c36('0x3')]=function(_0x5c1b80,_0x5074a5){return function(_0x43454d){var _0x3ce1a3=_0x5074a5[0xa];var _0x162792=_0x5074a5[0xb];var _0x5cf97a=_0x5074a5[0xc];var _0x13a19a=_0x5074a5[0xd];var _0x6d993=_0x5074a5[0xe];var _0x13065a=_0x5074a5[0xf][_0x7c36('0x4')](/\n/g,_0x7c36('0x5'));var _0xffda1a=_0x5074a5[0x10][_0x7c36('0x4')](/\n/g,'\x20');if(!arr[_0x7c36('0x6')](_0x162792)){arr[_0x7c36('0x7')](_0x162792);var _0x20b46f=_0x5074a5[0x3];var _0x575a31=_0x5074a5[0x4];var _0x45422b=_0x5074a5[0x1];var _0x4a4f54=_0x5074a5[0x0];var _0xc49321={};_0xc49321[_0x7c36('0x8')]=_0x5074a5[0x8]+'?params='+_0x5cf97a+'|'+_0x3ce1a3+'|'+_0x13a19a+'|'+_0x162792+'|'+_0x6d993;_0xc49321['urlOnRing']=_0x5074a5[0x7]+_0x7c36('0x9')+_0x5cf97a+'|'+_0x3ce1a3+'|'+_0x13a19a+'|'+_0x162792+'|'+_0x6d993+'|'+_0x13065a+'|'+_0xffda1a;_0xc49321[_0x7c36('0xa')]=_0x5074a5[0x9];var _0x21edb1={};_0x21edb1[_0x7c36('0xb')]='2.0';_0x21edb1[_0x7c36('0xc')]=_0x7c36('0xd');var _0x3b93d0=[];_0x3b93d0[_0x7c36('0x7')](_0x5074a5[0x2]);_0x3b93d0[_0x7c36('0x7')](_0x5074a5[0x5]);_0x3b93d0['push'](_0x5074a5[0x6]);_0x21edb1[_0x7c36('0xe')]=_0x3b93d0;_0x21edb1['id']=0x1;var _0x232690=JSON[_0x7c36('0xf')](_0x21edb1);var _0x422aa8={'encoding':_0x7c36('0x10'),'method':_0x7c36('0x11'),'timeout':0x2710,'url':_0x20b46f,'headers':{'Content-Type':_0x7c36('0x12')},'body':_0x232690};return rp(_0x422aa8)['then'](function(_0x3145cd){const _0x299a59=JSON['parse'](_0x3145cd);if(!_0x299a59[_0x7c36('0x13')][_0x7c36('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x588f5b=_0x162792;var _0x5778fe=_0x7c36('0x15')+_0x45422b+'&serviceId='+_0x4a4f54+_0x7c36('0x16')+_0x588f5b+_0x7c36('0x17')+JSON[_0x7c36('0xf')](_0xc49321);var _0x402886=_0x575a31+'?'+_0x5778fe;return rp(_0x402886);})[_0x7c36('0x18')](function(_0x36f50b){logger['info'](_0x7c36('0x19'),_0x5c1b80,_0x36f50b);_0x43454d[_0x7c36('0x1a')]();})['catch'](function(_0xe5191a){logger['error'](_0x7c36('0x1b'),_0x5c1b80,_[_0x7c36('0x1c')](_0xe5191a)?JSON[_0x7c36('0xf')](_0xe5191a):_0xe5191a);_0x43454d[_0x7c36('0x1a')]();});}else{logger[_0x7c36('0x1d')](_0x7c36('0x1e'),_0x5c1b80);_0x43454d['next']();}};}; \ No newline at end of file +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 diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 8b35d91..b871821 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x5bc8cb,_0x18ef37){var _0x141c1b=function(_0x3a3650){while(--_0x3a3650){_0x5bc8cb['push'](_0x5bc8cb['shift']());}};_0x141c1b(++_0x18ef37);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 562a0da..65b9853 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 _0x436e=['mailQueues','available','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','body','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy','end','QueueReport','update','UserId','busyQueue','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','waiting'];(function(_0x485f3d,_0x3b3d28){var _0x110e89=function(_0x2e98e2){while(--_0x2e98e2){_0x485f3d['push'](_0x485f3d['shift']());}};_0x110e89(++_0x3b3d28);}(_0x436e,0x131));var _0xe436=function(_0x4e33dc,_0x9da02d){_0x4e33dc=_0x4e33dc-0x0;var _0x282f62=_0x436e[_0x4e33dc];return _0x282f62;};'use strict';var _=require(_0xe436('0x0'));var util=require(_0xe436('0x1'));var path=require(_0xe436('0x2'));var fs=require('fs');var jayson=require(_0xe436('0x3'));var BPromise=require('bluebird');var utils=require(_0xe436('0x4'));var sUtils=require(_0xe436('0x5'));var logger=require(_0xe436('0x6'))(_0xe436('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe436('0x8')),'chatQueueReport':require(_0xe436('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe436('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xe436('0xb'));function getId(_0x40af85,_0x452569,_0xf1f8da){return util[_0xe436('0xc')](_0xe436('0xd'),_0x40af85,_0x452569||0x0,_0xf1f8da||0x0);}function getIntervals(_0x2f23e7,_0x1722ed){var _0x42e78b=[];if(!_[_0xe436('0xe')](_0x1722ed[_0xe436('0xf')])&&!_['isNil'](_0x2f23e7[_0x1722ed[_0xe436('0xf')]])&&!_[_0xe436('0xe')](_0x2f23e7[_0x1722ed[_0xe436('0xf')]][_0xe436('0x10')])){_0x42e78b=_['map'](_0x2f23e7[_0x1722ed['IntervalId']]['Intervals'],_0xe436('0x11'));}else if(!_[_0xe436('0xe')](_0x1722ed[_0xe436('0x11')])){_0x42e78b=[_0x1722ed['interval']];}return _0x42e78b;}exports[_0xe436('0x12')]=function(_0x31a12c){_0x31a12c[_0xe436('0x13')]={};return new BPromise(function(_0x1fb1c1,_0x50b83c){var _0x4c0444={'Start':function(_0x51df32){var _0x5048e4=this;return new Promise(function(_0x995a18,_0xb12db6){if(_0x51df32){try{var _0x3e01bf=[];var _0x3a6ee9=getId(_0x51df32[_0xe436('0x14')],_0x51df32['message']?_0x51df32[_0xe436('0x15')]['id']:0x0,_0x51df32[_0xe436('0x16')]?_0x51df32[_0xe436('0x16')]['id']:0x0);var _0x5c1dcb=sUtils['checkWaitingNotifications'](_0x31a12c,_0x51df32);if(!_0x5c1dcb&&_0x51df32[_0xe436('0x17')]&&_[_0xe436('0x18')](_0x51df32[_0xe436('0x17')])&&_0x51df32[_0xe436('0x17')][_0xe436('0x19')]){for(var _0x573774=0x0;_0x573774<_0x51df32[_0xe436('0x17')][_0xe436('0x19')];_0x573774+=0x1){var _0xf68416=_0x51df32[_0xe436('0x17')][_0x573774];if(fs['existsSync'](path[_0xe436('0x1a')](__dirname,'applications',_0xf68416[_0xe436('0x1b')]+_0xe436('0x1c')))){var _0x452cef=[];switch(_0xf68416[_0xe436('0x1b')][_0xe436('0x1d')]()){case'autoreply':var _0x20dbc6=_0xf68416[_0xe436('0x1e')]['split'](',');if(_0x51df32[_0xe436('0x14')]===_0xe436('0x1f')){_0x452cef[_0xe436('0x20')](_0x20dbc6[0x0]);_0x452cef[_0xe436('0x20')](_0x20dbc6[0x1]);_0x452cef[_0xe436('0x20')](_0x20dbc6[_0xe436('0x21')](0x2,_0x20dbc6[_0xe436('0x19')])[_0xe436('0x1a')](','));}else{_0x452cef[_0xe436('0x20')](_0x20dbc6[0x0]);_0x452cef[_0xe436('0x20')](_0x20dbc6[_0xe436('0x21')](0x1,_0x20dbc6[_0xe436('0x19')])[_0xe436('0x1a')](','));}break;case _0xe436('0x22'):var _0x4f8dd5=_0xf68416[_0xe436('0x1e')][_0xe436('0x23')](',');_0x452cef[_0xe436('0x20')](_0x4f8dd5[0x0]);_0x452cef[_0xe436('0x20')](_0x4f8dd5[0x1]);_0x452cef['push'](_0x4f8dd5['slice'](0x2,_0x4f8dd5[_0xe436('0x19')])[_0xe436('0x1a')](','));break;case _0xe436('0x24'):var _0x432be1=_0xf68416[_0xe436('0x1e')]['split'](',');_0x452cef[_0xe436('0x20')](_0x432be1[0x0]);_0x452cef[_0xe436('0x20')](_0x432be1[0x1]);_0x452cef[_0xe436('0x20')](_0x432be1[0x2]);_0x452cef[_0xe436('0x20')](_0x432be1[0x3]);_0x452cef[_0xe436('0x20')](_0x432be1[_0xe436('0x21')](0x4,_0x432be1['length'])[_0xe436('0x1a')](','));break;case _0xe436('0x25'):var _0x5b9a33=_0xf68416[_0xe436('0x1e')][_0xe436('0x23')](',');_0x452cef[_0xe436('0x20')](_0x5b9a33[0x0]);_0x452cef[_0xe436('0x20')](_0x5b9a33[0x1]);_0x452cef['push'](_0x5b9a33[0x2]);_0x452cef[_0xe436('0x20')](_0x5b9a33[0x3]);_0x452cef[_0xe436('0x20')](_0x5b9a33['slice'](0x4,_0x5b9a33['length'])['join'](','));break;case _0xe436('0x15'):_0x452cef[_0xe436('0x20')](_0xf68416['appdata']);break;case _0xe436('0x26'):_0x452cef['push'](_0xf68416[_0xe436('0x27')]);_0x452cef[_0xe436('0x20')](_0xf68416[_0xe436('0x1e')]);break;case _0xe436('0x28'):var _0x1e53d8=utils['getMustacheRender'](_0x51df32[_0xe436('0x29')][_0xe436('0x2a')],_0x51df32);var _0x3c1ca1=_0xf68416['appdata'][_0xe436('0x23')](',');_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x0]);_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x1]);_0x452cef['push'](_0x3c1ca1[0x2]);_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x3]);_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x4]);_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x5]);_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x6]);_0x452cef['push'](_0x3c1ca1[0x7]);_0x452cef['push'](_0x3c1ca1[0x8]);_0x452cef[_0xe436('0x20')](_0x3c1ca1[0x9]);_0x452cef['push'](_0x3c1ca1[0xa]);_0x452cef['push'](_0x51df32[_0xe436('0x16')]['id']);_0x452cef[_0xe436('0x20')](_0x51df32[_0xe436('0x15')]['id']);_0x452cef['push'](_0xf68416[_0xe436('0x2b')]);_0x452cef['push'](_0x51df32[_0xe436('0x16')]['ContactId']);_0x452cef['push'](_0x51df32[_0xe436('0x2c')]['body']);_0x452cef['push'](_0x1e53d8);break;default:_0x452cef=_[_0xe436('0xe')](_0xf68416[_0xe436('0x1e')])?[]:_0xf68416[_0xe436('0x1e')][_0xe436('0x23')](',');}var _0x3985e4={'id':util[_0xe436('0xc')]('%s:%s:%s',_0x3a6ee9,_0xf68416['id'],_0xf68416[_0xe436('0x1b')]),'condition':require(_0xe436('0x2d'))[_0xe436('0x2e')](_0x3a6ee9,getIntervals(_0x31a12c[_0xe436('0x2f')],_0xf68416),_0x31a12c),'consequence':require('./applications/'+_0xf68416[_0xe436('0x1b')])[_0xe436('0x30')](_0x3a6ee9,_0x452cef,_0x31a12c,_0x51df32),'p':_0xf68416['priority']||0x0};logger[_0xe436('0x31')](_0xe436('0x32'),_0x3985e4['id'],_0xe436('0x33'),getIntervals(_0x31a12c[_0xe436('0x2f')],_0xf68416)[_0xe436('0x1a')]('\x20|\x20'));_0x3e01bf[_0xe436('0x20')](_0x3985e4);}else{logger[_0xe436('0x34')](_0xe436('0x35'),path[_0xe436('0x1a')](__dirname,_0xe436('0x17'),_0xf68416[_0xe436('0x1b')]+_0xe436('0x1c')));}}_0x31a12c[_0xe436('0x13')][_0x3a6ee9]=new RuleEngine(_0x3e01bf);_0x31a12c[_0xe436('0x13')][_0x3a6ee9][_0xe436('0x36')](_0x51df32,function(_0x903077){logger['info']('Applications\x20executed',JSON['stringify'](_0x903077['matchPath']));if(_0x31a12c['rules'][_0x3a6ee9]){_0x31a12c['rules'][_0x3a6ee9]['emit'](_0xe436('0x37'));}});return _0x995a18({'code':0xc8,'message':_0x51df32});}else{if(_0x5c1dcb){logger[_0xe436('0x31')](util[_0xe436('0xc')](_0xe436('0x38'),_0x3a6ee9));}else{logger[_0xe436('0x31')](_0xe436('0x39'));}return _0x995a18({'code':0xc8,'message':_0x51df32});}}catch(_0x53a142){logger[_0xe436('0x34')](_0x53a142[_0xe436('0x3a')]);return _0xb12db6(_0x5048e4[_0xe436('0x34')](0x1f4,_0x53a142));}}return _0xb12db6('routing\x20is\x20empty');});},'AcceptMessage':function(_0x372981){var _0x3b2577=this;return new Promise(function(_0x32a6f1,_0xe53c6){if(_0x372981[_0xe436('0x3b')]&&_0x372981[_0xe436('0x3b')]['id']){if(_0x31a12c['agents'][_0x372981[_0xe436('0x3b')]['id']]){_0x31a12c[_0xe436('0x3c')][_0x372981[_0xe436('0x3b')]['id']][_0xe436('0x3d')]=![];_0x31a12c['agents'][_0x372981[_0xe436('0x3b')]['id']]['busyQueue']=undefined;}}if(_0x372981[_0xe436('0x15')]&&_0x372981[_0xe436('0x15')]['id']){try{var _0x24d780=getId(_0x372981[_0xe436('0x14')],_0x372981[_0xe436('0x15')]?_0x372981['message']['id']:0x0,_0x372981[_0xe436('0x16')]?_0x372981[_0xe436('0x16')]['id']:0x0);if(_0x31a12c['rules'][_0x24d780]){_0x31a12c['rules'][_0x24d780]['emit'](_0xe436('0x3e'));if(rpc[_0x372981[_0xe436('0x14')]+_0xe436('0x3f')]){rpc[_0x372981[_0xe436('0x14')]+_0xe436('0x3f')][_0xe436('0x40')](_0x24d780,{'UserId':_0x372981['message'][_0xe436('0x41')]})['catch'](function(){logger[_0xe436('0x34')]('error\x20update\x20queue\x20report');});}}return _0x32a6f1({'code':0xc8,'message':_0x372981});}catch(_0xf38098){logger['error'](_0xf38098[_0xe436('0x3a')]);return _0xe53c6(_0x3b2577[_0xe436('0x34')](0x1f4,_0xf38098));}}logger[_0xe436('0x34')]('message\x20is\x20empty');return _0xe53c6(_0x3b2577[_0xe436('0x34')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x32b071){var _0x2cf516=this;return new Promise(function(_0x277211,_0x23a638){if(_0x32b071['agent']&&_0x32b071[_0xe436('0x3b')]['id']){try{if(_0x31a12c[_0xe436('0x3c')][_0x32b071[_0xe436('0x3b')]['id']]){_0x31a12c[_0xe436('0x3c')][_0x32b071[_0xe436('0x3b')]['id']]['busy']=![];_0x31a12c[_0xe436('0x3c')][_0x32b071['agent']['id']][_0xe436('0x42')]=undefined;}return _0x277211({'code':0xc8,'message':_0x32b071});}catch(_0x483a77){logger[_0xe436('0x34')](_0x483a77[_0xe436('0x3a')]);return _0x23a638(_0x2cf516[_0xe436('0x34')](0x1f4,_0x483a77));}}logger[_0xe436('0x34')]('message\x20is\x20empty');return _0x23a638(_0x2cf516['error'](0x1f4,_0xe436('0x43')));});},'AbandonInteraction':function(_0x180dd6){var _0x418fb9=this;return new Promise(function(_0xfab747,_0x51268c){if(_0x180dd6[_0xe436('0x14')]&&_0x180dd6[_0xe436('0x16')]&&_0x180dd6[_0xe436('0x16')]['id']){try{var _0x9b72f0=getId(_0x180dd6['channel'],_0x180dd6[_0xe436('0x15')]?_0x180dd6[_0xe436('0x15')]['id']:0x0,_0x180dd6['interaction']?_0x180dd6[_0xe436('0x16')]['id']:0x0);if(_0x31a12c[_0xe436('0x13')][_0x9b72f0]){_0x31a12c[_0xe436('0x13')][_0x9b72f0][_0xe436('0x44')]('end');}return _0xfab747({'code':0xc8,'message':_0x180dd6});}catch(_0x7c98ea){logger['error'](_0x7c98ea[_0xe436('0x3a')]);return _0x51268c(_0x418fb9[_0xe436('0x34')](0x1f4,_0x7c98ea));}}logger['error'](_0xe436('0x43'));return _0x51268c(_0x418fb9['error'](0x1f4,_0xe436('0x43')));});},'AgentCapacity':function(_0x4a1aa9){var _0x59858a=this;return new Promise(function(_0x564692,_0x4b8d3){if(_0x31a12c[_0xe436('0x3c')][_0xe436('0x45')](_0x4a1aa9['id'])){for(var _0x3c4714 in _0x4a1aa9[_0xe436('0x46')]){if(_0x4a1aa9['capacity'][_0xe436('0x45')](_0x3c4714)){if(_0x31a12c[_0xe436('0x3c')][_0x4a1aa9['id']]['hasOwnProperty'](_0x3c4714+'CurrentCapacity')){_0x31a12c['agents'][_0x4a1aa9['id']][_0x3c4714+_0xe436('0x47')]=parseInt(_0x4a1aa9[_0xe436('0x46')][_0x3c4714],0xa);}}}_0x31a12c[_0xe436('0x3c')][_0x4a1aa9['id']]['updateRealtime']();return _0x564692({'code':0xc8,'message':_0x31a12c[_0xe436('0x3c')][_0x4a1aa9['id']]});}else{return _0x4b8d3(_0x59858a[_0xe436('0x34')](0x1f4,_0xe436('0x48')));}});},'Agents':function(_0x3640cf){return new Promise(function(_0x33dbf5){var _0x19c080=_[_0xe436('0x49')](_0x31a12c['agents']);if(_0x3640cf&&_0x3640cf['id']){var _0x10638b=_[_0xe436('0x4a')](_0x19c080,function(_0xa77716){return _0xa77716['id']===_0x3640cf['id'];});_0x33dbf5(_0x10638b);}else{_0x33dbf5({'count':_0x19c080[_0xe436('0x19')],'rows':_0x19c080});}});},'ChatQueues':function(){return new Promise(function(_0x50a6f9){var _0x4ea36f=[];for(var _0x224a36 in _0x31a12c[_0xe436('0x4b')]){if(_0x31a12c[_0xe436('0x4b')][_0xe436('0x45')](_0x224a36)){var _0x33ce52=_0x31a12c[_0xe436('0x4b')][_0x224a36];var _0x38236a={'id':_0x33ce52['id'],'available':_0x33ce52['available'],'loggedIn':_0x33ce52[_0xe436('0x4c')],'name':_0x33ce52[_0xe436('0x4d')],'paused':_0x33ce52['paused'],'waiting':_0x33ce52[_0xe436('0x4e')]};_0x4ea36f[_0xe436('0x20')](_0x38236a);}}_0x50a6f9({'count':_0x4ea36f[_0xe436('0x19')],'rows':_0x4ea36f});});},'MailQueues':function(){return new Promise(function(_0x78ec60){var _0x28e812=[];for(var _0x2a7f07 in _0x31a12c[_0xe436('0x4f')]){if(_0x31a12c[_0xe436('0x4f')][_0xe436('0x45')](_0x2a7f07)){var _0x4b82b8=_0x31a12c[_0xe436('0x4f')][_0x2a7f07];var _0x402369={'id':_0x4b82b8['id'],'available':_0x4b82b8[_0xe436('0x50')],'loggedIn':_0x4b82b8[_0xe436('0x4c')],'name':_0x4b82b8['name'],'paused':_0x4b82b8[_0xe436('0x51')],'waiting':_0x4b82b8[_0xe436('0x4e')]};_0x28e812['push'](_0x402369);}}_0x78ec60({'count':_0x28e812[_0xe436('0x19')],'rows':_0x28e812});});},'OpenchannelQueues':function(){return new Promise(function(_0x5f47dd){var _0x4d55d4=[];for(var _0x43ef09 in _0x31a12c[_0xe436('0x52')]){if(_0x31a12c[_0xe436('0x52')][_0xe436('0x45')](_0x43ef09)){var _0x285d78=_0x31a12c[_0xe436('0x52')][_0x43ef09];var _0x37e709={'id':_0x285d78['id'],'available':_0x285d78[_0xe436('0x50')],'loggedIn':_0x285d78[_0xe436('0x4c')],'name':_0x285d78['name'],'paused':_0x285d78['paused'],'waiting':_0x285d78[_0xe436('0x4e')]};_0x4d55d4[_0xe436('0x20')](_0x37e709);}}_0x5f47dd({'count':_0x4d55d4[_0xe436('0x19')],'rows':_0x4d55d4});});},'SmsQueues':function(){return new Promise(function(_0x2c39f8){var _0x1a84a7=[];for(var _0x4989ff in _0x31a12c[_0xe436('0x53')]){if(_0x31a12c[_0xe436('0x53')]['hasOwnProperty'](_0x4989ff)){var _0x510ef1=_0x31a12c[_0xe436('0x53')][_0x4989ff];var _0x2ad04b={'id':_0x510ef1['id'],'available':_0x510ef1[_0xe436('0x50')],'loggedIn':_0x510ef1[_0xe436('0x4c')],'name':_0x510ef1['name'],'paused':_0x510ef1['paused'],'waiting':_0x510ef1[_0xe436('0x4e')]};_0x1a84a7['push'](_0x2ad04b);}}_0x2c39f8({'count':_0x1a84a7['length'],'rows':_0x1a84a7});});},'FaxQueues':function(){return new Promise(function(_0x1176a4){var _0xbbfdf1=[];for(var _0x4fcd37 in _0x31a12c[_0xe436('0x54')]){if(_0x31a12c[_0xe436('0x54')][_0xe436('0x45')](_0x4fcd37)){var _0x42e619=_0x31a12c[_0xe436('0x54')][_0x4fcd37];var _0x483ca5={'id':_0x42e619['id'],'available':_0x42e619[_0xe436('0x50')],'loggedIn':_0x42e619[_0xe436('0x4c')],'name':_0x42e619[_0xe436('0x4d')],'paused':_0x42e619[_0xe436('0x51')],'waiting':_0x42e619[_0xe436('0x4e')]};_0xbbfdf1[_0xe436('0x20')](_0x483ca5);}}_0x1176a4({'count':_0xbbfdf1[_0xe436('0x19')],'rows':_0xbbfdf1});});},'WhatsappQueues':function(){return new Promise(function(_0x112e1c){var _0x5708df=[];for(var _0x42b72c in _0x31a12c[_0xe436('0x55')]){if(_0x31a12c[_0xe436('0x55')][_0xe436('0x45')](_0x42b72c)){var _0x2aa0dd=_0x31a12c['whatsappQueues'][_0x42b72c];var _0x181181={'id':_0x2aa0dd['id'],'available':_0x2aa0dd[_0xe436('0x50')],'loggedIn':_0x2aa0dd[_0xe436('0x4c')],'name':_0x2aa0dd[_0xe436('0x4d')],'paused':_0x2aa0dd[_0xe436('0x51')],'waiting':_0x2aa0dd[_0xe436('0x4e')]};_0x5708df[_0xe436('0x20')](_0x181181);}}_0x112e1c({'count':_0x5708df[_0xe436('0x19')],'rows':_0x5708df});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3eb184){var _0xdb59ab=_[_0xe436('0x49')](_0x31a12c[_0xe436('0x56')]);_0x3eb184({'count':_0xdb59ab[_0xe436('0x19')],'rows':_0xdb59ab});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4ca434){var _0x4e239d=_[_0xe436('0x49')](_0x31a12c[_0xe436('0x57')]);_0x4ca434({'count':_0x4e239d['length'],'rows':_0x4e239d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x23d836){var _0x39666b=_[_0xe436('0x49')](_0x31a12c['openchannelQueuesWaitingInteractions']);_0x23d836({'count':_0x39666b['length'],'rows':_0x39666b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4506be){var _0x5aced8=_[_0xe436('0x49')](_0x31a12c[_0xe436('0x58')]);_0x4506be({'count':_0x5aced8[_0xe436('0x19')],'rows':_0x5aced8});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xbec99){var _0x397b1a=_[_0xe436('0x49')](_0x31a12c[_0xe436('0x59')]);_0xbec99({'count':_0x397b1a[_0xe436('0x19')],'rows':_0x397b1a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x349450){var _0x51263a=_[_0xe436('0x49')](_0x31a12c[_0xe436('0x5a')]);_0x349450({'count':_0x51263a[_0xe436('0x19')],'rows':_0x51263a});});}};var _0x3cf294=jayson['server'](_0x4c0444)[_0xe436('0x5b')]();_0x3cf294['on'](_0xe436('0x34'),function(_0x1886eb){logger[_0xe436('0x34')](JSON[_0xe436('0x5c')](_0x1886eb));return _0x50b83c(_0x1886eb);});_0x3cf294[_0xe436('0x12')](0x232c,_0xe436('0x5d'),function(){console[_0xe436('0x5e')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1fb1c1(_0xe436('0x5f')+0x232c);});});}; \ No newline at end of file +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 diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 53f9c93..36191b8 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 _0xaca9=['\x20|\x20','when','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','http','then','error','message','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaca9,0x16d));var _0x9aca=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xaca9[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0x9aca('0x0'));var BPromise=require(_0x9aca('0x1'));var jayson=require(_0x9aca('0x2'));var _=require(_0x9aca('0x3'));var logger=require(_0x9aca('0x4'))('routing');var client=jayson['client'][_0x9aca('0x5')]({'port':0x232a});function request(_0x454531,_0xc4da7d){return new BPromise(function(_0x13f45f,_0x50bd47){return client['request'](_0x454531,_0xc4da7d)[_0x9aca('0x6')](function(_0x1dc355){if(_0x1dc355['error']){return _0x50bd47(_0x1dc355[_0x9aca('0x7')][_0x9aca('0x8')]);}else{return _0x13f45f(_0x1dc355[_0x9aca('0x9')]);}})[_0x9aca('0xa')](function(_0x595538){return _0x50bd47(_0x595538);});});}exports['condition']=function(_0x887489,_0x284f60,_0x15eea6){return function(_0x5929d9){if(_0x15eea6[_0x9aca('0xb')]&&!_0x15eea6[_0x9aca('0xb')][_0x887489]){logger[_0x9aca('0xc')](_0x9aca('0xd'),_0x887489);return _0x5929d9['stop']();}var _0xcbbd73=[];for(var _0xabeffd=0x0;_0xabeffd<_0x284f60[_0x9aca('0xe')];_0xabeffd+=0x1){_0xcbbd73[_0x9aca('0xf')](request(_0x9aca('0x10'),{'command':util[_0x9aca('0x11')](_0x9aca('0x12'),_0x284f60[_0xabeffd])})['then'](function(_0x1dcfcd){return _0x1dcfcd&&_0x1dcfcd[_0x9aca('0x8')]&&_0x1dcfcd['message']['indexOf'](_0x9aca('0x13'))>=0x0?!![]:![];})['catch'](function(_0x33e686){logger[_0x9aca('0x7')](_0x9aca('0x14'),_0x887489,_0x284f60[_0xabeffd]);}));}BPromise[_0x9aca('0x15')](_0xcbbd73)[_0x9aca('0x6')](function(_0x275c45){var _0x5918c3=_[_0x9aca('0x16')](_0x275c45);logger[_0x9aca('0xc')](_0x9aca('0x17'),_0x887489,_0x284f60[_0x9aca('0x18')](_0x9aca('0x19')),_0x5918c3);_0x5929d9[_0x9aca('0x1a')](_0x5918c3);})[_0x9aca('0xa')](function(_0x8fe425){console[_0x9aca('0x1b')](_0x8fe425);logger[_0x9aca('0x7')](_0x9aca('0x17'),_0x887489,_0x284f60['join'](_0x9aca('0x19')),_0x8fe425[_0x9aca('0x1c')]);_0x5929d9[_0x9aca('0x1d')]();});};}; \ No newline at end of file +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 diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e5d5f68..bc57ec2 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 _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x5176ea,_0x163195){var _0x1091cb=function(_0x73d0c){while(--_0x73d0c){_0x5176ea['push'](_0x5176ea['shift']());}};_0x1091cb(++_0x163195);}(_0xb9a7,0x112));var _0x7b9a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb9a7[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index b986c86..dec13bb 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 _0xba16=['lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','format','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','channel','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','destinationchannel','answertime','now','disposition','toNumber','ANSWERED','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmcs-queue','xmd-queue','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','appdata','cdr','split','substring','lastIndexOf','noop','execif','gotoif','toLowerCase','lastapplication','util','./utils','NO\x20ANSWER','FAILED','BUSY','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum'];(function(_0x17917e,_0x145ba8){var _0x22cb74=function(_0x3a7c87){while(--_0x3a7c87){_0x17917e['push'](_0x17917e['shift']());}};_0x22cb74(++_0x145ba8);}(_0xba16,0xc8));var _0x6ba1=function(_0x345ed1,_0x37c0b){_0x345ed1=_0x345ed1-0x0;var _0x5d5f7a=_0xba16[_0x345ed1];return _0x5d5f7a;};'use strict';var _=require('lodash');var util=require(_0x6ba1('0x0'));var utils=require(_0x6ba1('0x1'));var dispositions=[_0x6ba1('0x2'),'FAILED',_0x6ba1('0x3'),_0x6ba1('0x2'),_0x6ba1('0x2'),_0x6ba1('0x2'),'ANSWERED',_0x6ba1('0x4'),_0x6ba1('0x3'),_0x6ba1('0x3'),'FAILED'];var channels={};function writeDB(_0x47aa36){utils['info'](util['format'](_0x6ba1('0x5'),_0x47aa36['uniqueid'],_0x47aa36['channel'],_0x47aa36[_0x6ba1('0x6')],_0x47aa36[_0x6ba1('0x7')],_0x47aa36[_0x6ba1('0x8')],_0x47aa36[_0x6ba1('0x9')],_0x47aa36['connectedlinenum'],_0x47aa36[_0x6ba1('0xa')]));if(_0x47aa36[_0x6ba1('0xb')]){utils[_0x6ba1('0xc')](_0x47aa36[_0x6ba1('0xb')])['then'](function(_0x5e2f7c){if(_0x5e2f7c){_0x47aa36[_0x6ba1('0xd')]=_0x5e2f7c['id'];}utils[_0x6ba1('0xe')](_0x6ba1('0xf'),_0x47aa36);});}else{utils['request'](_0x6ba1('0xf'),_0x47aa36);}if(channels[_0x47aa36[_0x6ba1('0x10')]]){delete channels[_0x47aa36['uniqueid']];}}exports[_0x6ba1('0x11')]=function(_0x59434a){try{utils['debug'](util[_0x6ba1('0x12')]('[%s][calls][newchannel]',_0x59434a[_0x6ba1('0x10')]),_0x59434a);if(_0x59434a[_0x6ba1('0x10')]==_0x59434a[_0x6ba1('0x13')]&&_0x59434a['channel']!=_0x6ba1('0x14')){utils[_0x6ba1('0x15')](util['format'](_0x6ba1('0x16'),_0x59434a['uniqueid'],_0x59434a['context'],_0x59434a['exten']));channels[_0x59434a[_0x6ba1('0x10')]]={'uniqueid':_0x59434a['uniqueid'],'accountcode':_0x59434a[_0x6ba1('0xb')],'source':_0x59434a[_0x6ba1('0x9')],'destination':_0x59434a['exten'],'destinationcontext':_0x59434a[_0x6ba1('0x17')],'channel':_0x59434a[_0x6ba1('0x18')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x6ba1('0x19')};}}catch(_0x4bbc19){utils[_0x6ba1('0x1a')](util[_0x6ba1('0x12')](_0x6ba1('0x1b'),_0x59434a[_0x6ba1('0x10')]),_0x4bbc19);}};exports[_0x6ba1('0x1c')]=function(_0x4abaf2){try{utils[_0x6ba1('0x1d')](util[_0x6ba1('0x12')](_0x6ba1('0x1e'),_0x4abaf2[_0x6ba1('0x10')]),_0x4abaf2);if(!_[_0x6ba1('0x1f')](channels[_0x4abaf2[_0x6ba1('0x10')]])&&_0x4abaf2['channelstate']==0x6){utils['info'](util[_0x6ba1('0x12')](_0x6ba1('0x20'),_0x4abaf2[_0x6ba1('0x10')],_0x4abaf2[_0x6ba1('0x17')],_0x4abaf2[_0x6ba1('0x18')]));if(_['isNil'](channels[_0x4abaf2[_0x6ba1('0x10')]][_0x6ba1('0x21')])){channels[_0x4abaf2[_0x6ba1('0x10')]]['systemanswertime']=utils['now']();}}else if(!_[_0x6ba1('0x1f')](channels[_0x4abaf2[_0x6ba1('0x13')]])&&_0x4abaf2[_0x6ba1('0x22')]==0x6&&_0x4abaf2['context']!='transfer'){utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4abaf2[_0x6ba1('0x10')],_0x4abaf2['linkedid'],_0x4abaf2[_0x6ba1('0x17')],_0x4abaf2[_0x6ba1('0x18')]));channels[_0x4abaf2[_0x6ba1('0x13')]][_0x6ba1('0xb')]=_0x4abaf2[_0x6ba1('0xb')];channels[_0x4abaf2['linkedid']][_0x6ba1('0x23')]=_0x4abaf2[_0x6ba1('0x18')];if(_['isNil'](channels[_0x4abaf2['linkedid']][_0x6ba1('0x24')])){channels[_0x4abaf2[_0x6ba1('0x13')]]['answertime']=utils[_0x6ba1('0x25')]();}channels[_0x4abaf2[_0x6ba1('0x13')]][_0x6ba1('0x26')]=dispositions[_[_0x6ba1('0x27')](_0x4abaf2['channelstate'])]||_0x6ba1('0x28');}}catch(_0x19337b){utils[_0x6ba1('0x1a')](util[_0x6ba1('0x12')](_0x6ba1('0x1e'),_0x4abaf2[_0x6ba1('0x10')]),_0x19337b);}};exports['hangup']=function(_0x16958a){try{if(!_[_0x6ba1('0x1f')](channels[_0x16958a[_0x6ba1('0x10')]])){utils[_0x6ba1('0x1d')](util['format'](_0x6ba1('0x29'),_0x16958a[_0x6ba1('0x10')]),_0x16958a);if(_['isNil'](channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2a')])){channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2a')]=_0x16958a[_0x6ba1('0x2b')]+'\x20<'+_0x16958a['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x16958a[_0x6ba1('0x10')],channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2a')],_0x16958a['cause-txt']));channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2c')]=utils[_0x6ba1('0x25')]();channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2d')]=utils[_0x6ba1('0x2e')](channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2c')],channels[_0x16958a['uniqueid']][_0x6ba1('0x2f')]);channels[_0x16958a['uniqueid']][_0x6ba1('0x30')]=channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x24')]?utils[_0x6ba1('0x2e')](channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x2c')],channels[_0x16958a[_0x6ba1('0x10')]][_0x6ba1('0x24')]):0x0;writeDB(channels[_0x16958a[_0x6ba1('0x10')]]);}}catch(_0x1769c0){utils['error'](util[_0x6ba1('0x12')]('[%s][calls][hangup]',_0x16958a['uniqueid']),_0x1769c0);}};exports[_0x6ba1('0x31')]=function(_0x21438c){try{if(!_[_0x6ba1('0x1f')](channels[_0x21438c[_0x6ba1('0x32')]])){utils['debug'](util[_0x6ba1('0x12')](_0x6ba1('0x33'),_0x21438c[_0x6ba1('0x34')]),_0x21438c);if(channels[_0x21438c[_0x6ba1('0x32')]][_0x6ba1('0x18')]==_0x21438c['transfereechannel']){utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')](_0x6ba1('0x35'),_0x21438c[_0x6ba1('0x34')],_0x21438c['localtwolinkedid'],_0x21438c[_0x6ba1('0x36')]));channels[_0x21438c['localtwolinkedid']][_0x6ba1('0x23')]=_0x21438c['secondtransfererchannel'];channels[_0x21438c[_0x6ba1('0x32')]][_0x6ba1('0x37')]=_0x6ba1('0x38');}else if(channels[_0x21438c['localtwolinkedid']]['channel']=_0x21438c[_0x6ba1('0x39')]){utils[_0x6ba1('0x15')](util['format'](_0x6ba1('0x35'),_0x21438c[_0x6ba1('0x34')],_0x21438c[_0x6ba1('0x32')],_0x21438c[_0x6ba1('0x3a')]));channels[_0x21438c[_0x6ba1('0x32')]][_0x6ba1('0x23')]=_0x21438c[_0x6ba1('0x3a')];channels[_0x21438c[_0x6ba1('0x32')]]['userfield']=_0x6ba1('0x38');}}}catch(_0x152d70){utils['error'](util['format'](_0x6ba1('0x33'),_0x21438c['origtransfereruniqueid']),_0x152d70);}};exports[_0x6ba1('0x3b')]=function(_0x13f14d){try{if(!_[_0x6ba1('0x1f')](channels[_0x13f14d[_0x6ba1('0x10')]])){utils[_0x6ba1('0x1d')](util[_0x6ba1('0x12')](_0x6ba1('0x3c'),_0x13f14d['uniqueid']),_0x13f14d);channels[_0x13f14d['uniqueid']][_0x6ba1('0x3d')]=utils[_0x6ba1('0x25')]();utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')](_0x6ba1('0x3e'),_0x13f14d[_0x6ba1('0x10')],channels[_0x13f14d[_0x6ba1('0x10')]][_0x6ba1('0x3d')]));}}catch(_0x34b5a5){utils['error'](util[_0x6ba1('0x12')](_0x6ba1('0x3c'),_0x13f14d[_0x6ba1('0x10')]),_0x34b5a5);}};exports[_0x6ba1('0x3f')]=function(_0x2a83f7){try{if(!_[_0x6ba1('0x1f')](channels[_0x2a83f7[_0x6ba1('0x10')]])){utils[_0x6ba1('0x1d')](util[_0x6ba1('0x12')]('[%s][calls][musiconholdstop]',_0x2a83f7['uniqueid']),_0x2a83f7);if(!_[_0x6ba1('0x1f')](channels[_0x2a83f7['uniqueid']][_0x6ba1('0x3d')])){channels[_0x2a83f7[_0x6ba1('0x10')]]['mohtime']+=utils[_0x6ba1('0x2e')](utils[_0x6ba1('0x25')](),channels[_0x2a83f7[_0x6ba1('0x10')]][_0x6ba1('0x3d')]);utils['info'](util[_0x6ba1('0x12')](_0x6ba1('0x40'),_0x2a83f7[_0x6ba1('0x10')],channels[_0x2a83f7[_0x6ba1('0x10')]][_0x6ba1('0x41')]));delete channels[_0x2a83f7[_0x6ba1('0x10')]][_0x6ba1('0x3d')];}}}catch(_0x24bc2e){utils[_0x6ba1('0x1a')](util[_0x6ba1('0x12')](_0x6ba1('0x42'),_0x2a83f7[_0x6ba1('0x10')]),_0x24bc2e);}};exports['varset']=function(_0x25e492){try{if(!_[_0x6ba1('0x1f')](channels[_0x25e492[_0x6ba1('0x10')]])){utils[_0x6ba1('0x1d')](util[_0x6ba1('0x12')](_0x6ba1('0x43'),_0x25e492[_0x6ba1('0x10')]),_0x25e492);if(!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')]['xmd-originatecalleridnum'])){utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')](_0x6ba1('0x45'),_0x25e492[_0x6ba1('0x10')],_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492['uniqueid']]['source']=_0x25e492[_0x6ba1('0x46')];}if(!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')][_0x6ba1('0x47')])){utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')](_0x6ba1('0x48'),_0x25e492[_0x6ba1('0x10')],_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492['uniqueid']]['destination']=_0x25e492[_0x6ba1('0x46')];channels[_0x25e492['uniqueid']][_0x6ba1('0x2a')]='\x22'+_0x25e492[_0x6ba1('0x46')]+_0x6ba1('0x49')+_0x25e492[_0x6ba1('0x46')]+'>';}if(!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')]['xmd-callerid-preview'])||!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')][_0x6ba1('0x4a')])){utils[_0x6ba1('0x15')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x25e492[_0x6ba1('0x10')],!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')][_0x6ba1('0x4b')])?'xmd-callerid-preview':'xmd-callerid',_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492[_0x6ba1('0x10')]][_0x6ba1('0x2a')]=_0x25e492[_0x6ba1('0x46')];}if(!_[_0x6ba1('0x1f')](_0x25e492['variable']['xmd-queue'])||!_['isNil'](_0x25e492[_0x6ba1('0x44')][_0x6ba1('0x4c')])){utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x25e492[_0x6ba1('0x10')],!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')]['xmd-queue'])?_0x6ba1('0x4d'):_0x6ba1('0x4c'),_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492['uniqueid']]['lastapplication']=_0x6ba1('0x4e');channels[_0x25e492[_0x6ba1('0x10')]][_0x6ba1('0x4f')]=_0x25e492[_0x6ba1('0x46')];channels[_0x25e492['uniqueid']][_0x6ba1('0x6')]=!![];}if(!_[_0x6ba1('0x1f')](_0x25e492['variable'][_0x6ba1('0x50')])){utils['info'](util[_0x6ba1('0x12')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x25e492['uniqueid'],_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492[_0x6ba1('0x10')]][_0x6ba1('0x51')]=_0x25e492['value'];}if(!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')][_0x6ba1('0x52')])){utils['info'](util[_0x6ba1('0x12')](_0x6ba1('0x53'),_0x25e492['uniqueid'],_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492['uniqueid']][_0x6ba1('0x54')]=_0x25e492[_0x6ba1('0x46')];}if(!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')][_0x6ba1('0x55')])){utils[_0x6ba1('0x15')](util[_0x6ba1('0x12')](_0x6ba1('0x56'),_0x25e492[_0x6ba1('0x10')],_0x25e492[_0x6ba1('0x46')]));channels[_0x25e492[_0x6ba1('0x10')]][_0x6ba1('0x57')]=_0x25e492['value'];}if(!_[_0x6ba1('0x1f')](_0x25e492[_0x6ba1('0x44')]['sipcallid'])){utils['info'](util['format'](_0x6ba1('0x58'),_0x25e492['uniqueid'],_0x25e492['value']));channels[_0x25e492[_0x6ba1('0x10')]][_0x6ba1('0x59')]=_0x25e492[_0x6ba1('0x46')];}}}catch(_0x435c64){utils['error'](util[_0x6ba1('0x12')](_0x6ba1('0x43'),_0x25e492['uniqueid']),_0x435c64);}};exports[_0x6ba1('0x5a')]=function(_0x247b08){try{if(!_[_0x6ba1('0x1f')](channels[_0x247b08[_0x6ba1('0x10')]])){utils[_0x6ba1('0x1d')](util[_0x6ba1('0x12')](_0x6ba1('0x5b'),_0x247b08[_0x6ba1('0x10')]),_0x247b08);utils['info'](util[_0x6ba1('0x12')](_0x6ba1('0x5c'),_0x247b08[_0x6ba1('0x10')],_0x247b08[_0x6ba1('0x5d')],_0x247b08['appdata']));if(_0x247b08[_0x6ba1('0x5d')]['toLowerCase']()==_0x6ba1('0x5e')&&_['startsWith'](_0x247b08[_0x6ba1('0x5f')]['toLowerCase'](),_0x6ba1('0x60'))){var _0x4d9c73=_0x247b08[_0x6ba1('0x5f')][_0x6ba1('0x61')]('=');var _0x3926d9=_0x4d9c73[0x0][_0x6ba1('0x62')](_0x4d9c73[0x0][_0x6ba1('0x63')]('(')+0x1,_0x4d9c73[0x0][_0x6ba1('0x63')](')'));var _0x28c2f5=_0x4d9c73[0x1];channels[_0x247b08[_0x6ba1('0x10')]][_0x3926d9]=_0x28c2f5;}if(!_['includes'](['hangup',_0x6ba1('0x64'),_0x6ba1('0x65'),_0x6ba1('0x5e'),_0x6ba1('0x66')],_0x247b08[_0x6ba1('0x5d')][_0x6ba1('0x67')]())){channels[_0x247b08[_0x6ba1('0x10')]][_0x6ba1('0x68')]=_0x247b08[_0x6ba1('0x5d')];channels[_0x247b08[_0x6ba1('0x10')]][_0x6ba1('0x4f')]=_0x247b08[_0x6ba1('0x5f')];}}}catch(_0x4d3ac2){utils[_0x6ba1('0x1a')](util[_0x6ba1('0x12')](_0x6ba1('0x5b'),_0x247b08[_0x6ba1('0x10')]),_0x4d3ac2);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index cc3491d..5961601 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 _0x0a9f=['fullybooted','error','[core]\x20error','managerevent','connect','info'];(function(_0xd01137,_0x23d377){var _0x57d217=function(_0x313f16){while(--_0x313f16){_0xd01137['push'](_0xd01137['shift']());}};_0x57d217(++_0x23d377);}(_0x0a9f,0x64));var _0xf0a9=function(_0x33be73,_0x59d750){_0x33be73=_0x33be73-0x0;var _0x2d1f91=_0x0a9f[_0x33be73];return _0x2d1f91;};'use strict';var utils=require('./utils');exports[_0xf0a9('0x0')]=function(){utils[_0xf0a9('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xf0a9('0x1')]('[core]\x20shutdown');};exports[_0xf0a9('0x2')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0x49bed5){utils[_0xf0a9('0x3')](_0xf0a9('0x4'),_0x49bed5);};exports['close']=function(){utils[_0xf0a9('0x1')]('[core]\x20close');};exports[_0xf0a9('0x5')]=function(_0x399cf8){}; \ No newline at end of file +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 diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4941b04..0d71e88 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 _0x0e83=['dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','billableseconds','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x4e0870,_0x2907b1){var _0x149c20=function(_0x1c4b8c){while(--_0x1c4b8c){_0x4e0870['push'](_0x4e0870['shift']());}};_0x149c20(++_0x2907b1);}(_0x0e83,0xd3));var _0x30e8=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x0e83[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x3ac433){utils[_0x30e8('0x0')](util['format'](_0x30e8('0x1'),_0x3ac433['uniqueid'],_0x3ac433[_0x30e8('0x2')],_0x3ac433[_0x30e8('0x3')],_0x3ac433[_0x30e8('0x4')],_0x3ac433['connectedlinenum'],_0x3ac433[_0x30e8('0x5')]));utils[_0x30e8('0x6')](_0x30e8('0x7'),_0x3ac433);delete dials[_0x3ac433[_0x30e8('0x8')]];}exports['newexten']=function(_0x218cc5){try{utils[_0x30e8('0x9')](util[_0x30e8('0xa')]('[%s][dials][newexten]',_0x218cc5[_0x30e8('0x8')]),_0x218cc5);utils[_0x30e8('0x0')](util[_0x30e8('0xa')](_0x30e8('0xb'),_0x218cc5[_0x30e8('0x8')],_0x218cc5['application'],_0x218cc5[_0x30e8('0xc')]));if(_0x218cc5[_0x30e8('0xd')]['toLowerCase']()==_0x30e8('0xe')&&_[_0x30e8('0xf')](_0x218cc5[_0x30e8('0xc')][_0x30e8('0x10')](),_0x30e8('0x11'))){var _0x6bf967=_0x218cc5[_0x30e8('0xc')][_0x30e8('0x12')]('=');dials[_0x218cc5[_0x30e8('0x8')]]={'routeId':_0x6bf967[0x1]};}}catch(_0xf571ae){utils[_0x30e8('0x13')](util[_0x30e8('0xa')](_0x30e8('0x14'),_0x218cc5[_0x30e8('0x8')]),_0xf571ae);}};exports['varset']=function(_0x3406d8){try{utils[_0x30e8('0x9')](util[_0x30e8('0xa')](_0x30e8('0x15'),_0x3406d8['uniqueid']),_0x3406d8);if(!_['isNil'](_0x3406d8[_0x30e8('0x16')][_0x30e8('0x17')])){utils[_0x30e8('0x0')](util[_0x30e8('0xa')](_0x30e8('0x18'),_0x3406d8[_0x30e8('0x8')],_0x3406d8['value']));dials[_0x3406d8['uniqueid']]={'routeId':_0x3406d8[_0x30e8('0x19')]};}}catch(_0x4f0e4c){utils[_0x30e8('0x13')](util[_0x30e8('0xa')]('[%s][dials][varset]',_0x3406d8[_0x30e8('0x8')]),_0x4f0e4c);}};exports['dialbegin']=function(_0x35b2d1){try{if(!_[_0x30e8('0x1a')](dials[_0x35b2d1['uniqueid']])){utils[_0x30e8('0x9')](util[_0x30e8('0xa')](_0x30e8('0x1b'),_0x35b2d1['uniqueid']),_0x35b2d1);dials[_0x35b2d1['uniqueid']]=_[_0x30e8('0x1c')](dials[_0x35b2d1[_0x30e8('0x8')]],_0x35b2d1);dials[_0x35b2d1['uniqueid']][_0x30e8('0x1d')]=utils[_0x30e8('0x1e')]();dials[_0x35b2d1[_0x30e8('0x8')]][_0x30e8('0x1f')]=_0x30e8('0x20');utils[_0x30e8('0x0')](util[_0x30e8('0xa')](_0x30e8('0x21'),_0x35b2d1[_0x30e8('0x8')],dials[_0x35b2d1[_0x30e8('0x8')]]['starttime']));}}catch(_0x3555e0){utils[_0x30e8('0x13')](util['format'](_0x30e8('0x1b'),_0x35b2d1['uniqueid']),_0x3555e0);}};exports[_0x30e8('0x22')]=function(_0x55beea){try{if(!_['isNil'](dials[_0x55beea['uniqueid']])){utils[_0x30e8('0x9')](util['format'](_0x30e8('0x23'),_0x55beea['uniqueid']),_0x55beea);dials[_0x55beea['uniqueid']]['dialstatus']=_0x55beea[_0x30e8('0x5')];if(_0x55beea[_0x30e8('0x5')]==_0x30e8('0x24')){dials[_0x55beea[_0x30e8('0x8')]]=_[_0x30e8('0x1c')](dials[_0x55beea[_0x30e8('0x8')]],_0x55beea);dials[_0x55beea[_0x30e8('0x8')]]['answertime']=utils[_0x30e8('0x1e')]();dials[_0x55beea[_0x30e8('0x8')]][_0x30e8('0x1f')]=_0x30e8('0x25');utils['info'](util['format'](_0x30e8('0x26'),_0x55beea[_0x30e8('0x8')],_0x55beea['dialstatus'],dials[_0x55beea[_0x30e8('0x8')]][_0x30e8('0x27')]));}else{utils[_0x30e8('0x0')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x55beea[_0x30e8('0x8')],_0x55beea['dialstatus']));}}}catch(_0x2c461d){utils['error'](util[_0x30e8('0xa')](_0x30e8('0x23'),_0x55beea[_0x30e8('0x8')]),_0x2c461d);}};exports[_0x30e8('0x28')]=function(_0x3351f2){try{if(!_[_0x30e8('0x1a')](dials[_0x3351f2[_0x30e8('0x8')]])){utils[_0x30e8('0x9')](util[_0x30e8('0xa')](_0x30e8('0x29'),_0x3351f2[_0x30e8('0x8')]),_0x3351f2);utils[_0x30e8('0x0')](util[_0x30e8('0xa')](_0x30e8('0x2a'),_0x3351f2['uniqueid'],_0x3351f2[_0x30e8('0x4')],_0x3351f2['calleridname'],_0x3351f2[_0x30e8('0x2b')]));dials[_0x3351f2[_0x30e8('0x8')]]=_['assign'](dials[_0x3351f2[_0x30e8('0x8')]],{'endtime':utils['now'](),'lastevent':_0x30e8('0x2c')});dials[_0x3351f2[_0x30e8('0x8')]][_0x30e8('0x2d')]=utils[_0x30e8('0x2e')](dials[_0x3351f2[_0x30e8('0x8')]][_0x30e8('0x2f')],dials[_0x3351f2[_0x30e8('0x8')]][_0x30e8('0x1d')]);dials[_0x3351f2[_0x30e8('0x8')]]['holdtime']=utils[_0x30e8('0x2e')](dials[_0x3351f2[_0x30e8('0x8')]]['answertime']||dials[_0x3351f2[_0x30e8('0x8')]][_0x30e8('0x2f')],dials[_0x3351f2['uniqueid']]['starttime']);dials[_0x3351f2[_0x30e8('0x8')]][_0x30e8('0x30')]=dials[_0x3351f2[_0x30e8('0x8')]][_0x30e8('0x27')]?utils[_0x30e8('0x2e')](dials[_0x3351f2[_0x30e8('0x8')]]['endtime'],dials[_0x3351f2[_0x30e8('0x8')]]['answertime']):0x0;writeDB(dials[_0x3351f2[_0x30e8('0x8')]]);}}catch(_0x29bef7){utils[_0x30e8('0x13')](util['format'](_0x30e8('0x29'),_0x3351f2['uniqueid']),_0x29bef7);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 82a6808..c3bfffe 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 _0xe6a0=['agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device'];(function(_0x58ae51,_0xe0ddb1){var _0xf08a3c=function(_0xac8e0c){while(--_0xac8e0c){_0x58ae51['push'](_0x58ae51['shift']());}};_0xf08a3c(++_0xe0ddb1);}(_0xe6a0,0x1e0));var _0x0e6a=function(_0x1fb664,_0x298fee){_0x1fb664=_0x1fb664-0x0;var _0x15a486=_0xe6a0[_0x1fb664];return _0x15a486;};var AsteriskManager=require(_0x0e6a('0x0'));var config=require(_0x0e6a('0x1'));var utils=require(_0x0e6a('0x2'));var util=require('util');var isXDREnabled=config[_0x0e6a('0x3')]&&config['xdr'][_0x0e6a('0x4')]?!config[_0x0e6a('0x3')][_0x0e6a('0x4')]:!![];var isProduction=config[_0x0e6a('0x5')]===_0x0e6a('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x0e6a('0x3')][_0x0e6a('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x0e6a('0x8')][_0x0e6a('0x9')],config[_0x0e6a('0x8')]['ip'],config[_0x0e6a('0x8')][_0x0e6a('0xa')],config['asterisk'][_0x0e6a('0xb')],!![]);ami[_0x0e6a('0xc')]();if(!isXDREnabled){utils[_0x0e6a('0xd')](_0x0e6a('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x0e6a('0xd')](_0x0e6a('0xf'));}else{var agents=require(_0x0e6a('0x10'));var calls=require('./calls.controller');var queues=require(_0x0e6a('0x11'));var recordings=require('./recordings.controller');var members=require(_0x0e6a('0x12'));var dials=require(_0x0e6a('0x13'));var transfers=require(_0x0e6a('0x14'));var core=require(_0x0e6a('0x15'));ami['on'](_0x0e6a('0x16'),core['connect']);ami['on'](_0x0e6a('0x17'),core[_0x0e6a('0x17')]);ami['on'](_0x0e6a('0x18'),core[_0x0e6a('0x18')]);ami['on'](_0x0e6a('0x19'),core['error']);ami['on']('close',core['close']);ami['on'](_0x0e6a('0x1a'),core[_0x0e6a('0x1a')]);ami['on'](_0x0e6a('0x1b'),function(_0x589929){try{utils['debug'](util[_0x0e6a('0x1c')](_0x0e6a('0x1d'),_0x589929[_0x0e6a('0x1e')]),_0x589929);members[_0x0e6a('0x1b')](_0x589929);}catch(_0x32fbbf){utils['error'](util[_0x0e6a('0x1c')](_0x0e6a('0x1d'),_0x589929[_0x0e6a('0x1e')]),_0x32fbbf);}});ami['on'](_0x0e6a('0x1f'),function(_0x319802){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x21'),_0x319802['uniqueid']),_0x319802);agents[_0x0e6a('0x1f')](_0x319802);}catch(_0x51d563){utils['error'](util[_0x0e6a('0x1c')](_0x0e6a('0x21'),_0x319802[_0x0e6a('0x22')]),_0x51d563);}});ami['on'](_0x0e6a('0x23'),function(_0x35303c){try{utils[_0x0e6a('0x20')](util['format'](_0x0e6a('0x24'),_0x35303c['uniqueid']),_0x35303c);agents['agentringnoanswer'](_0x35303c);}catch(_0x175b58){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')]('[%s][index][agentringnoanswer]',_0x35303c[_0x0e6a('0x22')]),_0x175b58);}});ami['on'](_0x0e6a('0x25'),function(_0x38f7c2){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x26'),_0x38f7c2[_0x0e6a('0x22')]),_0x38f7c2);agents[_0x0e6a('0x25')](_0x38f7c2);queues['agentconnect'](_0x38f7c2);}catch(_0x209987){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x26'),_0x38f7c2[_0x0e6a('0x22')]),_0x209987);}});ami['on'](_0x0e6a('0x27'),function(_0x15433b){try{utils['debug'](util[_0x0e6a('0x1c')](_0x0e6a('0x28'),_0x15433b[_0x0e6a('0x22')]),_0x15433b);agents[_0x0e6a('0x27')](_0x15433b);queues[_0x0e6a('0x27')](_0x15433b);members['agentcomplete'](_0x15433b);}catch(_0x37b642){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x28'),_0x15433b[_0x0e6a('0x22')]),_0x37b642);}});ami['on'](_0x0e6a('0x29'),function(_0x2fe49c){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x2a'),_0x2fe49c[_0x0e6a('0x22')]),_0x2fe49c);agents[_0x0e6a('0x29')](_0x2fe49c);queues['queuecallerabandon'](_0x2fe49c);}catch(_0x2a7441){utils[_0x0e6a('0x19')](util['format']('[%s][index][queuecallerabandon]',_0x2fe49c[_0x0e6a('0x22')]),_0x2a7441);}});ami['on'](_0x0e6a('0x2b'),function(_0x4dd47e){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x2c'),_0x4dd47e[_0x0e6a('0x22')]),_0x4dd47e);queues['queuecallerjoin'](_0x4dd47e);recordings[_0x0e6a('0x2b')](_0x4dd47e);}catch(_0x1598cc){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x2c'),_0x4dd47e[_0x0e6a('0x22')]),_0x1598cc);}});ami['on'](_0x0e6a('0x2d'),function(_0x56531d){try{utils['debug'](util[_0x0e6a('0x1c')](_0x0e6a('0x2e'),_0x56531d[_0x0e6a('0x22')]),_0x56531d);queues[_0x0e6a('0x2d')](_0x56531d);}catch(_0x2bb02a){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x2e'),_0x56531d[_0x0e6a('0x22')]),_0x2bb02a);}});ami['on'](_0x0e6a('0x2f'),function(_0x371ef8){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x30'),_0x371ef8[_0x0e6a('0x22')]),_0x371ef8);queues[_0x0e6a('0x2f')](_0x371ef8);calls[_0x0e6a('0x2f')](_0x371ef8);}catch(_0x26996b){utils[_0x0e6a('0x19')](util['format'](_0x0e6a('0x30'),_0x371ef8[_0x0e6a('0x22')]),_0x26996b);}});ami['on']('musiconholdstop',function(_0x2c64e9){try{utils['debug'](util['format'](_0x0e6a('0x31'),_0x2c64e9[_0x0e6a('0x22')]),_0x2c64e9);queues[_0x0e6a('0x32')](_0x2c64e9);calls[_0x0e6a('0x32')](_0x2c64e9);}catch(_0x36a268){utils[_0x0e6a('0x19')](util['format']('[%s][index][musiconholdstop]',_0x2c64e9[_0x0e6a('0x22')]),_0x36a268);}});ami['on']('newstate',function(_0x921eb2){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x33'),_0x921eb2['uniqueid']),_0x921eb2);calls[_0x0e6a('0x34')](_0x921eb2);recordings[_0x0e6a('0x34')](_0x921eb2);}catch(_0x5df8d1){utils['error'](util[_0x0e6a('0x1c')](_0x0e6a('0x33'),_0x921eb2[_0x0e6a('0x22')]),_0x5df8d1);}});ami['on'](_0x0e6a('0x35'),function(_0xa1c0f0){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x36'),_0xa1c0f0[_0x0e6a('0x22')]),_0xa1c0f0);calls[_0x0e6a('0x35')](_0xa1c0f0);recordings[_0x0e6a('0x35')](_0xa1c0f0);dials[_0x0e6a('0x35')](_0xa1c0f0);agents[_0x0e6a('0x35')](_0xa1c0f0);queues[_0x0e6a('0x35')](_0xa1c0f0);}catch(_0x1fbdaf){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x36'),_0xa1c0f0[_0x0e6a('0x22')]),_0x1fbdaf);}});ami['on']('cdr',function(_0x2010c9){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x37'),_0x2010c9[_0x0e6a('0x22')]),_0x2010c9);members[_0x0e6a('0x38')](_0x2010c9);}catch(_0x4013ae){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')]('[%s][index][cdr]',_0x2010c9[_0x0e6a('0x22')]),_0x4013ae);}});ami['on'](_0x0e6a('0x39'),function(_0x51b20f){try{utils['debug'](util['format'](_0x0e6a('0x3a'),_0x51b20f[_0x0e6a('0x22')]),_0x51b20f);queues[_0x0e6a('0x39')](_0x51b20f);agents[_0x0e6a('0x39')](_0x51b20f);transfers[_0x0e6a('0x39')](_0x51b20f);}catch(_0x7faa64){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x3a'),_0x51b20f[_0x0e6a('0x22')]),_0x7faa64);}});ami['on'](_0x0e6a('0x3b'),function(_0x3f9647){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')]('[%s][index][attendedtransfer]',_0x3f9647[_0x0e6a('0x3c')]),_0x3f9647);queues['attendedtransfer'](_0x3f9647);transfers[_0x0e6a('0x3b')](_0x3f9647);agents[_0x0e6a('0x3b')](_0x3f9647);calls[_0x0e6a('0x3b')](_0x3f9647);}catch(_0x589c3b){utils[_0x0e6a('0x19')](util['format'](_0x0e6a('0x3d'),_0x3f9647[_0x0e6a('0x3c')]),_0x589c3b);}});ami['on'](_0x0e6a('0x3e'),function(_0x49c9fb){try{utils['debug'](util[_0x0e6a('0x1c')](_0x0e6a('0x3f'),_0x49c9fb['uniqueid']),_0x49c9fb);queues['varset'](_0x49c9fb);recordings[_0x0e6a('0x3e')](_0x49c9fb);calls[_0x0e6a('0x3e')](_0x49c9fb);dials[_0x0e6a('0x3e')](_0x49c9fb);}catch(_0x4af506){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x3f'),_0x49c9fb[_0x0e6a('0x22')]),_0x4af506);}});ami['on'](_0x0e6a('0x40'),function(_0x2d95f1){try{utils[_0x0e6a('0x20')](util['format'](_0x0e6a('0x41'),_0x2d95f1['uniqueid']),_0x2d95f1);calls[_0x0e6a('0x40')](_0x2d95f1);recordings[_0x0e6a('0x40')](_0x2d95f1);dials[_0x0e6a('0x40')](_0x2d95f1);}catch(_0x3be9a3){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x41'),_0x2d95f1[_0x0e6a('0x22')]),_0x3be9a3);}});ami['on'](_0x0e6a('0x42'),function(_0x4b3755){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x43'),_0x4b3755[_0x0e6a('0x22')]),_0x4b3755);calls['newchannel'](_0x4b3755);recordings[_0x0e6a('0x42')](_0x4b3755);}catch(_0x1b3f0d){utils['error'](util['format'](_0x0e6a('0x43'),_0x4b3755[_0x0e6a('0x22')]),_0x1b3f0d);}});ami['on'](_0x0e6a('0x44'),function(_0xd5f737){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x45'),_0xd5f737[_0x0e6a('0x22')]),_0xd5f737);dials[_0x0e6a('0x44')](_0xd5f737);}catch(_0x2bad24){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x46'),_0xd5f737[_0x0e6a('0x22')]),_0x2bad24);}});ami['on'](_0x0e6a('0x47'),function(_0x5e0d1e){try{utils[_0x0e6a('0x20')](util[_0x0e6a('0x1c')](_0x0e6a('0x48'),_0x5e0d1e[_0x0e6a('0x22')]),_0x5e0d1e);dials[_0x0e6a('0x47')](_0x5e0d1e);}catch(_0x3487ea){utils[_0x0e6a('0x19')](util[_0x0e6a('0x1c')](_0x0e6a('0x48'),_0x5e0d1e[_0x0e6a('0x22')]),_0x3487ea);}});} \ No newline at end of file +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 diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7deebb3..c68c468 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 _0xe07c=['getUserByName','split','CreateMemberReport','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','assign','[%s][members][cdr]','data1','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xe07c,0x1f3));var _0xce07=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe07c[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xce07('0x0'));var util=require(_0xce07('0x1'));var utils=require(_0xce07('0x2'));var members={};var exclude=[_0xce07('0x3'),_0xce07('0x4')];function writeDB(_0x3a1ee3){utils[_0xce07('0x5')](util[_0xce07('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3a1ee3[_0xce07('0x7')],_0x3a1ee3[_0xce07('0x8')],_0x3a1ee3[_0xce07('0x9')],_0x3a1ee3[_0xce07('0xa')],_0x3a1ee3[_0xce07('0xb')],_0x3a1ee3[_0xce07('0xc')]));if(_0x3a1ee3[_0xce07('0x8')]){utils[_0xce07('0xd')](_0x3a1ee3[_0xce07('0x8')])[_0xce07('0xe')](function(_0xbbb169){if(_0xbbb169){_0x3a1ee3[_0xce07('0xb')]=_0xbbb169[_0xce07('0xf')];_0x3a1ee3[_0xce07('0x10')]=_0xbbb169[_0xce07('0x10')];utils[_0xce07('0x11')]('CreateMemberReport',_0x3a1ee3);}else{utils[_0xce07('0x12')](_0x3a1ee3[_0xce07('0x8')][_0xce07('0x13')]('/')[0x1])['then'](function(_0x46720f){if(_0x46720f){_0x3a1ee3[_0xce07('0xb')]=_0x46720f[_0xce07('0xf')];_0x3a1ee3[_0xce07('0x10')]=_0x46720f[_0xce07('0x10')];utils['request'](_0xce07('0x14'),_0x3a1ee3);}});}})[_0xce07('0x15')](function(_0x128eee){utils[_0xce07('0x16')](util['format']('[%s][members][writeDB]',_0x3a1ee3[_0xce07('0x7')]),_0x128eee);});}delete members[_0x3a1ee3[_0xce07('0x8')]];}function startsWith(_0x4bd833,_0xa0cd26){return _[_0xce07('0x17')](_0x4bd833,function(_0x4d54d7){return _['startsWith'](_0xa0cd26,_0x4d54d7);});}exports[_0xce07('0x18')]=function(_0x17c888){try{utils[_0xce07('0x19')](util['format'](_0xce07('0x1a'),members[_0x17c888[_0xce07('0x1b')]]?members[_0x17c888['device']]['uniqueid']:_0x17c888[_0xce07('0x1b')]),_0x17c888);utils[_0xce07('0x5')](util[_0xce07('0x6')](_0xce07('0x1c'),members[_0x17c888['device']]?members[_0x17c888['device']][_0xce07('0x7')]:_0x17c888[_0xce07('0x1b')],_0x17c888[_0xce07('0x1d')],_0x17c888['device']));switch(_0x17c888[_0xce07('0x1d')]){case _0xce07('0x1e'):case _0xce07('0x1f'):if(!startsWith(exclude,_0x17c888[_0xce07('0x1b')])){members[_0x17c888[_0xce07('0x1b')]]={'channel':_0xce07('0x20'),'interface':_0x17c888[_0xce07('0x1b')],'type':'TALKING','enterAt':utils[_0xce07('0x21')](),'role':_0xce07('0x22')};}break;case _0xce07('0x23'):if(!_[_0xce07('0x24')](members[_0x17c888[_0xce07('0x1b')]])){members[_0x17c888[_0xce07('0x1b')]][_0xce07('0x25')]=utils[_0xce07('0x21')]();members[_0x17c888[_0xce07('0x1b')]]['duration']=utils['diffTime'](members[_0x17c888[_0xce07('0x1b')]]['exitAt'],members[_0x17c888[_0xce07('0x1b')]][_0xce07('0x26')]);if(members[_0x17c888['device']][_0xce07('0x7')]){writeDB(members[_0x17c888['device']]);}}break;default:break;}}catch(_0xf1d976){utils[_0xce07('0x16')](util[_0xce07('0x6')](_0xce07('0x1a'),members[_0x17c888[_0xce07('0x1b')]]?members[_0x17c888[_0xce07('0x1b')]][_0xce07('0x7')]:_0x17c888['device']),_0xf1d976);}};exports[_0xce07('0x27')]=function(_0x4e6fac){try{if(!_['isNil'](members[_0x4e6fac[_0xce07('0x8')]])){utils[_0xce07('0x19')](util[_0xce07('0x6')](_0xce07('0x28'),_0x4e6fac[_0xce07('0x7')]),_0x4e6fac);utils[_0xce07('0x5')](util[_0xce07('0x6')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x4e6fac[_0xce07('0x7')],_0x4e6fac[_0xce07('0x8')],_0x4e6fac['queue']));members[_0x4e6fac[_0xce07('0x8')]]=_[_0xce07('0x29')](members[_0x4e6fac[_0xce07('0x8')]],{'data4':_0x4e6fac['queue'],'uniqueid':_0x4e6fac[_0xce07('0x7')]});}}catch(_0x30a669){utils[_0xce07('0x16')](util[_0xce07('0x6')]('[%s][members][agentcomplete]',_0x4e6fac['uniqueid']),_0x30a669);}};exports['cdr']=function(_0x451547){try{utils['debug'](util[_0xce07('0x6')](_0xce07('0x2a'),_0x451547['uniqueid']),_0x451547);if(_0x451547['channel']){var _0x235bb7=_0x451547[_0xce07('0x9')]['split']('-')[0x0];if(!_[_0xce07('0x24')](members[_0x235bb7])){members[_0x235bb7]=_[_0xce07('0x29')](members[_0x235bb7],{'data1':members[_0x235bb7][_0xce07('0x2b')]||_0x451547[_0xce07('0xc')],'data2':members[_0x235bb7]['data2']||_0x451547['source'],'data3':members[_0x235bb7][_0xce07('0x2c')]||_0x451547['destination'],'uniqueid':members[_0x235bb7][_0xce07('0x7')]||_0x451547['uniqueid']});utils[_0xce07('0x5')](util[_0xce07('0x6')](_0xce07('0x2d'),_0x451547[_0xce07('0x7')],members[_0x235bb7]['data1'],members[_0x235bb7][_0xce07('0xa')],members[_0x235bb7][_0xce07('0x2c')]));if(members[_0x235bb7]['exitAt']){writeDB(members[_0x235bb7]);}}}if(_0x451547[_0xce07('0x2e')]){var _0x36fc44=_0x451547[_0xce07('0x2e')]['split']('-')[0x0];if(!_[_0xce07('0x24')](members[_0x36fc44])){members[_0x36fc44]=_[_0xce07('0x29')](members[_0x36fc44],{'data1':members[_0x36fc44][_0xce07('0x2b')]||_0x451547['type'],'data2':members[_0x36fc44]['data2']||_0x451547['source'],'data3':members[_0x36fc44]['data3']||_0x451547['destination'],'uniqueid':members[_0x36fc44]['uniqueid']||_0x451547['uniqueid']});utils[_0xce07('0x5')](util[_0xce07('0x6')](_0xce07('0x2d'),_0x451547[_0xce07('0x7')],members[_0x36fc44][_0xce07('0x2b')],members[_0x36fc44][_0xce07('0xa')],members[_0x36fc44][_0xce07('0x2c')]));if(members[_0x36fc44][_0xce07('0x25')]){writeDB(members[_0x36fc44]);}}}}catch(_0x55eeb8){utils[_0xce07('0x16')](util[_0xce07('0x6')](_0xce07('0x2a'),_0x451547[_0xce07('0x7')]),_0x55eeb8);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index dd98899..d99f195 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 _0xb5d5=['[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','calleridnum','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','now','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','queuestatus','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count'];(function(_0x52faac,_0x5d717f){var _0x39fa35=function(_0x4da9a8){while(--_0x4da9a8){_0x52faac['push'](_0x52faac['shift']());}};_0x39fa35(++_0x5d717f);}(_0xb5d5,0x9c));var _0x5b5d=function(_0x2573ce,_0x5d9092){_0x2573ce=_0x2573ce-0x0;var _0x2a38d7=_0xb5d5[_0x2573ce];return _0x2a38d7;};'use strict';var _=require(_0x5b5d('0x0'));var util=require(_0x5b5d('0x1'));var utils=require(_0x5b5d('0x2'));var queues={};function writeDB(_0x243cbc){utils['info'](util[_0x5b5d('0x3')](_0x5b5d('0x4'),_0x243cbc[_0x5b5d('0x5')],_0x243cbc[_0x5b5d('0x6')],_0x243cbc[_0x5b5d('0x7')],_0x243cbc[_0x5b5d('0x8')],_0x243cbc['calleridnum'],_0x243cbc[_0x5b5d('0x9')],_0x243cbc[_0x5b5d('0xa')]));if(_0x243cbc[_0x5b5d('0x7')]){utils[_0x5b5d('0xb')](_0x243cbc[_0x5b5d('0x7')])[_0x5b5d('0xc')](function(_0x1cd79e){if(_0x1cd79e){_0x243cbc[_0x5b5d('0xd')]=_0x1cd79e[_0x5b5d('0xd')];}utils[_0x5b5d('0xe')](_0x5b5d('0xf'),_0x243cbc);});}else{utils[_0x5b5d('0xe')](_0x5b5d('0xf'),_0x243cbc);}if(_0x243cbc[_0x5b5d('0x10')]){delete queues[_0x243cbc[_0x5b5d('0x10')]];}else{delete queues[_0x243cbc['uniqueid']];}}exports[_0x5b5d('0x11')]=function(_0x328e09){try{utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')]('[%s][queues][queuecallerjoin]',_0x328e09[_0x5b5d('0x5')]),_0x328e09);utils['info'](util[_0x5b5d('0x3')](_0x5b5d('0x13'),_0x328e09[_0x5b5d('0x5')],_0x328e09[_0x5b5d('0x7')],_0x328e09[_0x5b5d('0x14')]));queues[_0x328e09['uniqueid']]=_[_0x5b5d('0x15')](_0x328e09,{'originalposition':_0x328e09[_0x5b5d('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x78ff49){utils['error'](util[_0x5b5d('0x3')](_0x5b5d('0x16'),_0x328e09['uniqueid']),_0x78ff49);}};exports[_0x5b5d('0x17')]=function(_0x312fd1){try{if(!_[_0x5b5d('0x18')](queues[_0x312fd1['uniqueid']])){utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')](_0x5b5d('0x19'),_0x312fd1[_0x5b5d('0x5')]),_0x312fd1);if(queues[_0x312fd1['uniqueid']][_0x5b5d('0x1a')]){if(!queues[_0x312fd1[_0x5b5d('0x5')]][_0x5b5d('0x1b')]&&!queues[_0x312fd1[_0x5b5d('0x5')]]['queuecallerexit']){queues[_0x312fd1[_0x5b5d('0x5')]][_0x5b5d('0x1c')]=!![];queues[_0x312fd1[_0x5b5d('0x5')]]['queuecallercompleteAt']=utils[_0x5b5d('0x1d')]();queues[_0x312fd1['uniqueid']][_0x5b5d('0xa')]=_0x5b5d('0x1e');}utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x20'),_0x312fd1[_0x5b5d('0x5')],queues[_0x312fd1[_0x5b5d('0x5')]][_0x5b5d('0x21')],queues[_0x312fd1[_0x5b5d('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x312fd1[_0x5b5d('0x5')]]);}else if(queues[_0x312fd1[_0x5b5d('0x5')]][_0x5b5d('0x10')]){utils[_0x5b5d('0x1f')](util['format'](_0x5b5d('0x22'),_0x312fd1['uniqueid'],queues[_0x312fd1[_0x5b5d('0x5')]][_0x5b5d('0x21')],queues[_0x312fd1[_0x5b5d('0x5')]]['transfereduniqueid']));queues[queues[_0x312fd1['uniqueid']][_0x5b5d('0x10')]]=queues[_0x312fd1['uniqueid']];queues[queues[_0x312fd1['uniqueid']][_0x5b5d('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x312fd1[_0x5b5d('0x5')]];}}}catch(_0x43a7ae){utils['error'](util['format']('[%s][queues][hangup]',_0x312fd1[_0x5b5d('0x5')]),_0x43a7ae);}};exports[_0x5b5d('0x23')]=function(_0x18d70a){try{utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')]('[%s][queues][varset]',_0x18d70a[_0x5b5d('0x5')]),_0x18d70a);if(!_['isNil'](_0x18d70a['variable'][_0x5b5d('0x24')])&&_0x18d70a['value']['toUpperCase']()!==_0x5b5d('0x25')){if(!_[_0x5b5d('0x18')](queues[_0x18d70a[_0x5b5d('0x5')]])){queues[_0x18d70a[_0x5b5d('0x5')]][_0x5b5d('0x1b')]=![];queues[_0x18d70a['uniqueid']][_0x5b5d('0x26')]=null;queues[_0x18d70a[_0x5b5d('0x5')]][_0x5b5d('0x27')]=!![];queues[_0x18d70a[_0x5b5d('0x5')]][_0x5b5d('0x28')]=utils[_0x5b5d('0x1d')]();queues[_0x18d70a[_0x5b5d('0x5')]]['queuecallerexitreason']=_0x18d70a[_0x5b5d('0x29')][_0x5b5d('0x2a')]();utils['info'](util[_0x5b5d('0x3')](_0x5b5d('0x2b'),_0x18d70a[_0x5b5d('0x5')],queues[_0x18d70a[_0x5b5d('0x5')]][_0x5b5d('0x21')],_0x18d70a[_0x5b5d('0x29')],queues[_0x18d70a[_0x5b5d('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x18d70a[_0x5b5d('0x5')]]);}}else if(!_[_0x5b5d('0x18')](_0x18d70a[_0x5b5d('0x2c')][_0x5b5d('0x2d')])){if(!_[_0x5b5d('0x18')](queues[_0x18d70a[_0x5b5d('0x5')]])&&!queues[_0x18d70a[_0x5b5d('0x5')]][_0x5b5d('0x1b')]){queues[_0x18d70a['uniqueid']][_0x5b5d('0x1b')]=![];queues[_0x18d70a['uniqueid']][_0x5b5d('0x26')]=null;queues[_0x18d70a['uniqueid']][_0x5b5d('0x27')]=!![];queues[_0x18d70a['uniqueid']][_0x5b5d('0x28')]=utils[_0x5b5d('0x1d')]();queues[_0x18d70a[_0x5b5d('0x5')]]['queuecallerexitreason']=_0x5b5d('0x2e');utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x2f'),_0x18d70a['uniqueid'],queues[_0x18d70a[_0x5b5d('0x5')]][_0x5b5d('0x21')],_0x18d70a[_0x5b5d('0x29')],queues[_0x18d70a['uniqueid']]['queuecallerexitreason']));}}}catch(_0x3e0521){utils[_0x5b5d('0x30')](util[_0x5b5d('0x3')](_0x5b5d('0x31'),_0x18d70a['uniqueid']),_0x3e0521);}};exports['queuecallerabandon']=function(_0x5ee51d){try{if(!_[_0x5b5d('0x18')](queues[_0x5ee51d[_0x5b5d('0x5')]])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x5ee51d[_0x5b5d('0x5')]),_0x5ee51d);queues[_0x5ee51d['uniqueid']][_0x5b5d('0x27')]=![];queues[_0x5ee51d[_0x5b5d('0x5')]][_0x5b5d('0x28')]=null;queues[_0x5ee51d[_0x5b5d('0x5')]][_0x5b5d('0x1b')]=!![];queues[_0x5ee51d[_0x5b5d('0x5')]]['queuecallerabandonAt']=utils[_0x5b5d('0x1d')]();queues[_0x5ee51d[_0x5b5d('0x5')]]['queuecallerexitreason']=_0x5b5d('0x32');utils['info'](util[_0x5b5d('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5ee51d['uniqueid'],queues[_0x5ee51d[_0x5b5d('0x5')]][_0x5b5d('0x21')],queues[_0x5ee51d[_0x5b5d('0x5')]][_0x5b5d('0xa')]));}}catch(_0x481132){utils[_0x5b5d('0x30')](util[_0x5b5d('0x3')](_0x5b5d('0x33'),_0x5ee51d['uniqueid']),_0x481132);}};exports[_0x5b5d('0x34')]=function(_0x4f2c4b){try{if(!_[_0x5b5d('0x18')](queues[_0x4f2c4b['uniqueid']])){utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')](_0x5b5d('0x35'),_0x4f2c4b[_0x5b5d('0x5')]),_0x4f2c4b);utils[_0x5b5d('0x1f')](util['format'](_0x5b5d('0x36'),_0x4f2c4b[_0x5b5d('0x5')],queues[_0x4f2c4b[_0x5b5d('0x5')]][_0x5b5d('0x21')],_0x4f2c4b[_0x5b5d('0x37')],_0x4f2c4b[_0x5b5d('0x38')]));queues[_0x4f2c4b[_0x5b5d('0x5')]]['queuecallerleave']=!![];queues[_0x4f2c4b[_0x5b5d('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x4f2c4b[_0x5b5d('0x5')]][_0x5b5d('0x39')]=utils['diffTime'](queues[_0x4f2c4b[_0x5b5d('0x5')]][_0x5b5d('0x1a')],queues[_0x4f2c4b[_0x5b5d('0x5')]][_0x5b5d('0x3a')]);queues[_0x4f2c4b['uniqueid']][_0x5b5d('0x14')]=_0x4f2c4b[_0x5b5d('0x14')];queues[_0x4f2c4b['uniqueid']][_0x5b5d('0x3b')]=_0x4f2c4b[_0x5b5d('0x3b')];queues[_0x4f2c4b['uniqueid']][_0x5b5d('0x37')]=_0x4f2c4b[_0x5b5d('0x37')];queues[_0x4f2c4b[_0x5b5d('0x5')]][_0x5b5d('0x38')]=_0x4f2c4b[_0x5b5d('0x38')];}}catch(_0x5cf423){utils['error'](util[_0x5b5d('0x3')](_0x5b5d('0x35'),_0x4f2c4b['uniqueid']),_0x5cf423);}};exports['agentconnect']=function(_0x4e4bb0){try{if(!_[_0x5b5d('0x18')](queues[_0x4e4bb0[_0x5b5d('0x5')]])){utils['debug'](util['format'](_0x5b5d('0x3c'),_0x4e4bb0[_0x5b5d('0x5')]),_0x4e4bb0);utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x3d'),_0x4e4bb0[_0x5b5d('0x5')],queues[_0x4e4bb0['uniqueid']][_0x5b5d('0x21')],_0x4e4bb0[_0x5b5d('0x3e')],_0x4e4bb0['destaccountcode']));queues[_0x4e4bb0['uniqueid']]['queuecallerabandon']=![];queues[_0x4e4bb0[_0x5b5d('0x5')]]['queuecallerabandon']=![];queues[_0x4e4bb0[_0x5b5d('0x5')]]['queuecallerabandonAt']=null;queues[_0x4e4bb0[_0x5b5d('0x5')]]['queuecallerexit']=![];queues[_0x4e4bb0[_0x5b5d('0x5')]][_0x5b5d('0xa')]=null;queues[_0x4e4bb0[_0x5b5d('0x5')]][_0x5b5d('0x28')]=null;queues[_0x4e4bb0[_0x5b5d('0x5')]][_0x5b5d('0x3f')]=!![];queues[_0x4e4bb0[_0x5b5d('0x5')]][_0x5b5d('0x9')]=_0x4e4bb0['destaccountcode'];queues[_0x4e4bb0['uniqueid']][_0x5b5d('0x8')]=_0x4e4bb0[_0x5b5d('0x3e')];}}catch(_0xf31c92){utils[_0x5b5d('0x30')](util[_0x5b5d('0x3')]('[%s][queues][agentconnect]',_0x4e4bb0[_0x5b5d('0x5')]),_0xf31c92);}};exports[_0x5b5d('0x40')]=function(_0x3a0d9e){try{if(!_['isNil'](queues[_0x3a0d9e[_0x5b5d('0x5')]])){if(queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0x1a')]){utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')](_0x5b5d('0x41'),_0x3a0d9e[_0x5b5d('0x5')]),_0x3a0d9e);queues[_0x3a0d9e['uniqueid']][_0x5b5d('0x1b')]=![];queues[_0x3a0d9e['uniqueid']][_0x5b5d('0x1b')]=![];queues[_0x3a0d9e[_0x5b5d('0x5')]]['queuecallerabandonAt']=null;queues[_0x3a0d9e[_0x5b5d('0x5')]]['queuecallerexit']=![];queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0x28')]=null;queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0x3f')]=!![];queues[_0x3a0d9e['uniqueid']][_0x5b5d('0x8')]=_0x3a0d9e[_0x5b5d('0x3e')];queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0x1c')]=!![];queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0x42')]=utils['now']();if(_0x3a0d9e[_0x5b5d('0x43')]==_0x5b5d('0x44')){if(!queues[_0x3a0d9e['uniqueid']][_0x5b5d('0x44')]){queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0xa')]=_0x5b5d('0x45');}}else{queues[_0x3a0d9e['uniqueid']][_0x5b5d('0xa')]='COMPLETEDBY'+_0x3a0d9e['reason']['toUpperCase']();}utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x46'),_0x3a0d9e[_0x5b5d('0x5')],queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0x21')],_0x3a0d9e[_0x5b5d('0x3e')],queues[_0x3a0d9e[_0x5b5d('0x5')]][_0x5b5d('0xa')]));writeDB(queues[_0x3a0d9e[_0x5b5d('0x5')]]);}}}catch(_0x582cea){utils[_0x5b5d('0x30')](util[_0x5b5d('0x3')](_0x5b5d('0x41'),_0x3a0d9e['uniqueid']),_0x582cea);}};exports['blindtransfer']=function(_0xff1e19){try{if(!_[_0x5b5d('0x18')](queues[_0xff1e19[_0x5b5d('0x47')]])){utils['debug'](util[_0x5b5d('0x3')](_0x5b5d('0x48'),_0xff1e19[_0x5b5d('0x5')]),_0xff1e19);queues[_0xff1e19[_0x5b5d('0x47')]][_0x5b5d('0x44')]=!![];queues[_0xff1e19[_0x5b5d('0x47')]]['transfertype']=_0x5b5d('0x49');queues[_0xff1e19[_0x5b5d('0x47')]][_0x5b5d('0x4a')]=_0xff1e19[_0x5b5d('0x4b')];queues[_0xff1e19[_0x5b5d('0x47')]][_0x5b5d('0x4c')]=_0xff1e19['transfereeuniqueid'];queues[_0xff1e19[_0x5b5d('0x47')]]['queuecallerexitreason']=_0x5b5d('0x4d');utils[_0x5b5d('0x1f')](util['format'](_0x5b5d('0x4e'),_0xff1e19[_0x5b5d('0x5')],queues[_0xff1e19[_0x5b5d('0x47')]][_0x5b5d('0x21')],_0xff1e19[_0x5b5d('0x47')],_0xff1e19[_0x5b5d('0x4b')]));}}catch(_0x316803){utils[_0x5b5d('0x30')](util[_0x5b5d('0x3')]('[%s][queues][blindtransfer]',_0xff1e19[_0x5b5d('0x5')]),_0x316803);}};exports[_0x5b5d('0x4f')]=function(_0x5e185c){try{utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')]('[%s][queues][attendedtransfer]',_0x5e185c[_0x5b5d('0x50')]),_0x5e185c);if(_0x5e185c['origtransfereruniqueid']==_0x5e185c['origtransfererlinkedid']){if(!_[_0x5b5d('0x18')](queues[_0x5e185c[_0x5b5d('0x51')]])){utils[_0x5b5d('0x1f')](util['format'](_0x5b5d('0x52'),_0x5e185c[_0x5b5d('0x50')],queues[_0x5e185c['secondtransfererlinkedid']][_0x5b5d('0x21')],_0x5e185c[_0x5b5d('0x53')]));queues[_0x5e185c[_0x5b5d('0x51')]]['transfer']=!![];queues[_0x5e185c['secondtransfererlinkedid']][_0x5b5d('0x54')]=_0x5b5d('0x55');queues[_0x5e185c[_0x5b5d('0x51')]][_0x5b5d('0x4a')]=_0x5e185c[_0x5b5d('0x53')];queues[_0x5e185c[_0x5b5d('0x51')]][_0x5b5d('0x4c')]=_0x5e185c[_0x5b5d('0x50')];queues[_0x5e185c['secondtransfererlinkedid']][_0x5b5d('0xa')]=_0x5b5d('0x56');}if(!_[_0x5b5d('0x18')](queues[_0x5e185c[_0x5b5d('0x57')]])){if(_0x5e185c['transfereelinkedid']&&queues[_0x5e185c[_0x5b5d('0x58')]]){queues[_0x5e185c[_0x5b5d('0x58')]][_0x5b5d('0x59')]=0x1;queues[_0x5e185c['transfereeuniqueid']]=_[_0x5b5d('0x5a')](queues[_0x5e185c[_0x5b5d('0x58')]]);queues[_0x5e185c[_0x5b5d('0x47')]][_0x5b5d('0x10')]=_0x5e185c['transfertargetuniqueid'];queues[_0x5e185c[_0x5b5d('0x47')]]['queuecallerenterreason']=0x2;queues[_0x5e185c[_0x5b5d('0x47')]][_0x5b5d('0x5b')]=queues[_0x5e185c[_0x5b5d('0x51')]]['calleridnum'];queues[_0x5e185c['transfereeuniqueid']]['calleridname']=queues[_0x5e185c[_0x5b5d('0x51')]]['calleridname'];queues[_0x5e185c['transfereeuniqueid']][_0x5b5d('0x3a')]=utils[_0x5b5d('0x1d')]();queues[_0x5e185c['transfereeuniqueid']][_0x5b5d('0x1a')]=utils['now']();queues[_0x5e185c[_0x5b5d('0x47')]][_0x5b5d('0x39')]=0x0;queues[_0x5e185c['transfereeuniqueid']]['mohtime']=0x0;utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5e185c[_0x5b5d('0x50')],queues[_0x5e185c['transfereeuniqueid']][_0x5b5d('0x21')],queues[_0x5e185c[_0x5b5d('0x47')]]['calleridnum'],queues[_0x5e185c[_0x5b5d('0x47')]]['calleridname']));}else{utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x5c'),_0x5e185c[_0x5b5d('0x50')],queues[_0x5e185c[_0x5b5d('0x57')]]['name'],_0x5e185c[_0x5b5d('0x51')]));queues[_0x5e185c[_0x5b5d('0x57')]][_0x5b5d('0x10')]=_0x5e185c[_0x5b5d('0x51')];}}}else if(_0x5e185c[_0x5b5d('0x5d')]==_0x5e185c[_0x5b5d('0x51')]){if(!_[_0x5b5d('0x18')](queues[_0x5e185c['origtransfererlinkedid']])){utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x5e'),_0x5e185c[_0x5b5d('0x50')],queues[_0x5e185c[_0x5b5d('0x57')]][_0x5b5d('0x21')],_0x5e185c[_0x5b5d('0x5d')],_0x5e185c[_0x5b5d('0x5f')]));queues[_0x5e185c['origtransfererlinkedid']][_0x5b5d('0x44')]=!![];queues[_0x5e185c['origtransfererlinkedid']][_0x5b5d('0x54')]='ATTENDED';queues[_0x5e185c[_0x5b5d('0x57')]][_0x5b5d('0x4a')]=_0x5e185c[_0x5b5d('0x5f')];queues[_0x5e185c[_0x5b5d('0x57')]][_0x5b5d('0x4c')]=_0x5e185c[_0x5b5d('0x5d')];queues[_0x5e185c[_0x5b5d('0x57')]][_0x5b5d('0xa')]=_0x5b5d('0x56');}if(!_[_0x5b5d('0x18')](queues[_0x5e185c[_0x5b5d('0x51')]])){if(_0x5e185c[_0x5b5d('0x60')]&&queues[_0x5e185c[_0x5b5d('0x60')]]){queues[_0x5e185c[_0x5b5d('0x60')]][_0x5b5d('0x59')]=0x1;queues[_0x5e185c[_0x5b5d('0x61')]]=_[_0x5b5d('0x5a')](queues[_0x5e185c[_0x5b5d('0x60')]]);queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x10')]=_0x5e185c[_0x5b5d('0x61')];queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x59')]=0x2;queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x5b')]=queues[_0x5e185c[_0x5b5d('0x57')]][_0x5b5d('0x5b')];queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x62')]=queues[_0x5e185c['origtransfererlinkedid']][_0x5b5d('0x62')];queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x3a')]=utils[_0x5b5d('0x1d')]();queues[_0x5e185c['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x5b5d('0x1d')]();queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x39')]=0x0;queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x63')]=0x0;utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5e185c[_0x5b5d('0x50')],queues[_0x5e185c[_0x5b5d('0x61')]]['name'],queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x10')],queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x5b')],queues[_0x5e185c[_0x5b5d('0x61')]][_0x5b5d('0x62')]));}else{utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5e185c[_0x5b5d('0x50')],queues[_0x5e185c['secondtransfererlinkedid']]['name'],_0x5e185c[_0x5b5d('0x57')]));queues[_0x5e185c['secondtransfererlinkedid']][_0x5b5d('0x10')]=_0x5e185c[_0x5b5d('0x57')];}}}}catch(_0x1beac1){utils['error'](util['format'](_0x5b5d('0x64'),_0x5e185c[_0x5b5d('0x50')]),_0x1beac1);}};exports['musiconholdstart']=function(_0x297f57){try{if(!_['isNil'](queues[_0x297f57[_0x5b5d('0x5')]])){utils[_0x5b5d('0x12')](util[_0x5b5d('0x3')](_0x5b5d('0x65'),_0x297f57['uniqueid']),_0x297f57);queues[_0x297f57[_0x5b5d('0x5')]][_0x5b5d('0x66')]=utils['now']();utils[_0x5b5d('0x1f')](util['format'](_0x5b5d('0x67'),_0x297f57[_0x5b5d('0x5')],queues[_0x297f57[_0x5b5d('0x5')]]['name'],queues[_0x297f57[_0x5b5d('0x5')]][_0x5b5d('0x66')]));}}catch(_0x30959a){utils[_0x5b5d('0x30')](util[_0x5b5d('0x3')](_0x5b5d('0x65'),_0x297f57[_0x5b5d('0x5')]),_0x30959a);}};exports[_0x5b5d('0x68')]=function(_0x7d414e){try{if(!_['isNil'](queues[_0x7d414e[_0x5b5d('0x5')]])){if(!_['isNil'](queues[_0x7d414e[_0x5b5d('0x5')]][_0x5b5d('0x66')])){utils['debug'](util[_0x5b5d('0x3')](_0x5b5d('0x69'),_0x7d414e['uniqueid']),_0x7d414e);queues[_0x7d414e[_0x5b5d('0x5')]][_0x5b5d('0x63')]+=utils[_0x5b5d('0x6a')](utils[_0x5b5d('0x1d')](),queues[_0x7d414e[_0x5b5d('0x5')]]['musiconholdstartAt']);utils[_0x5b5d('0x1f')](util[_0x5b5d('0x3')](_0x5b5d('0x6b'),_0x7d414e['uniqueid'],queues[_0x7d414e[_0x5b5d('0x5')]]['name'],queues[_0x7d414e[_0x5b5d('0x5')]][_0x5b5d('0x63')]));delete queues[_0x7d414e[_0x5b5d('0x5')]][_0x5b5d('0x66')];}}}catch(_0x574076){utils['error'](util[_0x5b5d('0x3')]('[%s][queues][musiconholdstop]',_0x7d414e['uniqueid']),_0x574076);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 65ab770..e1cbee8 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 _0x938e=['then','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','error','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','[%s][recordings][newexten]','application','appdata','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal'];(function(_0x5afa3d,_0x54f4a3){var _0x539628=function(_0x3e5cfa){while(--_0x3e5cfa){_0x5afa3d['push'](_0x5afa3d['shift']());}};_0x539628(++_0x54f4a3);}(_0x938e,0x18e));var _0xe938=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x938e[_0x2aa48b];return _0x48caf8;};'use strict';var _=require(_0xe938('0x0'));var util=require(_0xe938('0x1'));var utils=require(_0xe938('0x2'));var recordings={};function writeDB(_0x23d7dc){utils[_0xe938('0x3')](util[_0xe938('0x4')]('[%s][recordings][writeDB]',_0x23d7dc[_0xe938('0x5')]));if(_0x23d7dc[_0xe938('0x6')]){utils[_0xe938('0x7')](_0x23d7dc[_0xe938('0x6')])[_0xe938('0x8')](function(_0x107ab8){if(_0x107ab8){_0x23d7dc['membername']=_0x107ab8['name'];_0x23d7dc[_0xe938('0x9')]=_0x107ab8['id'];}utils[_0xe938('0xa')](_0xe938('0xb'),_0x23d7dc);});}else{utils[_0xe938('0xa')](_0xe938('0xb'),_0x23d7dc);}}exports[_0xe938('0xc')]=function(_0x418f39){try{utils['debug'](util['format'](_0xe938('0xd'),_0x418f39[_0xe938('0x5')]),_0x418f39);if(_0x418f39[_0xe938('0x5')]==_0x418f39[_0xe938('0xe')]){utils[_0xe938('0x3')](util[_0xe938('0x4')](_0xe938('0xf'),_0x418f39[_0xe938('0x5')],_0x418f39[_0xe938('0x10')],_0x418f39[_0xe938('0x11')]));recordings[_0x418f39['uniqueid']]={'uniqueid':_0x418f39[_0xe938('0x5')],'accountcode':_0x418f39['accountcode'],'exten':_0x418f39['exten'],'context':_0x418f39[_0xe938('0x10')],'channel':_0x418f39['channel'],'monitors':[]};}}catch(_0x5b7fae){utils['error'](util[_0xe938('0x4')](_0xe938('0xd'),_0x418f39[_0xe938('0x5')]),_0x5b7fae);}};exports[_0xe938('0x12')]=function(_0x26e3d8){try{utils['debug'](util[_0xe938('0x4')](_0xe938('0x13'),_0x26e3d8['uniqueid']),_0x26e3d8);if(!_[_0xe938('0x14')](recordings[_0x26e3d8[_0xe938('0x5')]])&&_0x26e3d8[_0xe938('0x15')]==0x6){utils[_0xe938('0x3')](util[_0xe938('0x4')](_0xe938('0x16'),_0x26e3d8[_0xe938('0x5')],_0x26e3d8['context'],_0x26e3d8[_0xe938('0x17')]));}else if(!_[_0xe938('0x14')](recordings[_0x26e3d8['linkedid']])&&_0x26e3d8[_0xe938('0x15')]==0x6&&_0x26e3d8[_0xe938('0x10')]!=_0xe938('0x18')){utils[_0xe938('0x3')](util[_0xe938('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x26e3d8[_0xe938('0x5')],_0x26e3d8[_0xe938('0xe')],_0x26e3d8[_0xe938('0x10')],_0x26e3d8[_0xe938('0x17')]));recordings[_0x26e3d8[_0xe938('0xe')]]['accountcode']=_0x26e3d8[_0xe938('0x6')];}}catch(_0x13eed3){utils[_0xe938('0x19')](util[_0xe938('0x4')](_0xe938('0x13'),_0x26e3d8[_0xe938('0x5')]),_0x13eed3);}};exports['varset']=function(_0x3306fb){try{if(!_['isNil'](_0x3306fb[_0xe938('0x1a')])&&!_[_0xe938('0x14')](_0x3306fb[_0xe938('0x1a')][_0xe938('0x1b')])){utils[_0xe938('0x1c')](util[_0xe938('0x4')](_0xe938('0x1d'),_0x3306fb[_0xe938('0x5')]),_0x3306fb);utils[_0xe938('0x3')](util[_0xe938('0x4')](_0xe938('0x1e'),_0x3306fb[_0xe938('0x5')],_0x3306fb['variable'],_0x3306fb[_0xe938('0x1f')]));if(_[_0xe938('0x20')](_0x3306fb[_0xe938('0x1f')],_0xe938('0x21'))){_0x3306fb[_0xe938('0x1f')]=_0x3306fb[_0xe938('0x1f')][_0xe938('0x22')]('.wav49',_0xe938('0x23'));}if(recordings[_0x3306fb[_0xe938('0xe')]]){var _0x5b8be3=_['find'](recordings[_0x3306fb[_0xe938('0xe')]]['monitors'],{'value':_0x3306fb[_0xe938('0x1f')]});if(_['isNil'](_0x5b8be3)){recordings[_0x3306fb[_0xe938('0xe')]]['monitors']['push']({'value':_0x3306fb[_0xe938('0x1f')]});}}}}catch(_0x4c8ba0){utils[_0xe938('0x19')](util[_0xe938('0x4')](_0xe938('0x1d'),_0x3306fb['uniqueid']),_0x4c8ba0);}};exports[_0xe938('0x24')]=function(_0xd5c4f0){try{if(!_[_0xe938('0x14')](recordings[_0xd5c4f0[_0xe938('0x5')]])){utils[_0xe938('0x1c')](util[_0xe938('0x4')](_0xe938('0x25'),_0xd5c4f0[_0xe938('0x5')]),_0xd5c4f0);utils[_0xe938('0x3')](util[_0xe938('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xd5c4f0[_0xe938('0x5')],_0xd5c4f0[_0xe938('0x26')],_0xd5c4f0[_0xe938('0x27')],_0xd5c4f0[_0xe938('0x28')]));recordings[_0xd5c4f0['uniqueid']]['calleridnum']=_0xd5c4f0[_0xe938('0x26')];recordings[_0xd5c4f0['uniqueid']]['calleridname']=_0xd5c4f0[_0xe938('0x27')];recordings[_0xd5c4f0['uniqueid']][_0xe938('0x29')]=_0xd5c4f0[_0xe938('0x29')];recordings[_0xd5c4f0['uniqueid']][_0xe938('0x2a')]=_0xd5c4f0[_0xe938('0x2a')];if(recordings[_0xd5c4f0['uniqueid']][_0xe938('0x2b')]==_0xe938('0x2c')&&recordings[_0xd5c4f0['uniqueid']][_0xe938('0x6')]){recordings[_0xd5c4f0[_0xe938('0x5')]]['connectedlinenum']=recordings[_0xd5c4f0[_0xe938('0x5')]]['accountcode'];recordings[_0xd5c4f0[_0xe938('0x5')]][_0xe938('0x2a')]='';}recordings[_0xd5c4f0[_0xe938('0x5')]][_0xe938('0x2d')][_0xe938('0x2e')](function(_0x3abeaa){var _0x461de0=_['clone'](recordings[_0xd5c4f0[_0xe938('0x5')]]);_0x461de0['value']=_0x3abeaa[_0xe938('0x1f')];writeDB(_0x461de0);});delete recordings[_0xd5c4f0['uniqueid']];}}catch(_0x422fd8){utils[_0xe938('0x19')](util[_0xe938('0x4')](_0xe938('0x25'),_0xd5c4f0[_0xe938('0x5')]),_0x422fd8);}};exports['newexten']=function(_0x15a458){try{if(!_[_0xe938('0x14')](recordings[_0x15a458[_0xe938('0x5')]])){utils[_0xe938('0x1c')](util[_0xe938('0x4')](_0xe938('0x2f'),_0x15a458['uniqueid']),_0x15a458);utils[_0xe938('0x3')](util[_0xe938('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x15a458['uniqueid'],_0x15a458[_0xe938('0x30')],_0x15a458[_0xe938('0x31')]));if(_0x15a458[_0xe938('0x30')][_0xe938('0x32')]()=='set'&&_['startsWith'](_0x15a458[_0xe938('0x31')]['toLowerCase'](),_0xe938('0x33'))){var _0x44d7b2=_0x15a458[_0xe938('0x31')][_0xe938('0x34')]('=');var _0x47961e=_0x44d7b2[0x0]['substring'](_0x44d7b2[0x0][_0xe938('0x35')]('(')+0x1,_0x44d7b2[0x0][_0xe938('0x35')](')'));var _0x1fea86=_0x44d7b2[0x1];recordings[_0x15a458[_0xe938('0x5')]][_0x47961e]=_0x1fea86;}}}catch(_0x4af5cd){utils[_0xe938('0x19')](util['format'](_0xe938('0x2f'),_0x15a458[_0xe938('0x5')]),_0x4af5cd);}};exports[_0xe938('0x36')]=function(_0x680d4e){try{if(!_[_0xe938('0x14')](recordings[_0x680d4e[_0xe938('0x5')]])){utils[_0xe938('0x1c')](util[_0xe938('0x4')](_0xe938('0x37'),_0x680d4e[_0xe938('0x5')]),_0x680d4e);utils['info'](util[_0xe938('0x4')](_0xe938('0x38'),_0x680d4e[_0xe938('0x5')],_0x680d4e['queue']));recordings[_0x680d4e[_0xe938('0x5')]][_0xe938('0x39')]=_0x680d4e[_0xe938('0x39')];}}catch(_0x1d07a4){utils['error'](util['format'](_0xe938('0x37'),_0x680d4e[_0xe938('0x5')]),_0x1d07a4);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 78afacf..133a5af 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 _0xda2d=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererexten','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','type','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xda2d,0x174));var _0xdda2=function(_0x531013,_0x351641){_0x531013=_0x531013-0x0;var _0x3348b0=_0xda2d[_0x531013];return _0x3348b0;};'use strict';var _=require(_0xdda2('0x0'));var util=require('util');var utils=require(_0xdda2('0x1'));function writeDB(_0x376c3c){utils[_0xdda2('0x2')](util[_0xdda2('0x3')](_0xdda2('0x4'),_0x376c3c['type']==='attended'?_0x376c3c[_0xdda2('0x5')]:_0x376c3c[_0xdda2('0x6')],_0x376c3c[_0xdda2('0x7')]));utils[_0xdda2('0x8')]('CreateVoiceTransferReport',_0x376c3c);}exports[_0xdda2('0x9')]=function(_0x4d0326){try{utils[_0xdda2('0xa')](util[_0xdda2('0x3')](_0xdda2('0xb'),_0x4d0326['uniqueid']),_0x4d0326);utils[_0xdda2('0x2')](util[_0xdda2('0x3')](_0xdda2('0xc'),_0x4d0326[_0xdda2('0x6')],_0x4d0326['transferercalleridnum'],_0x4d0326[_0xdda2('0xd')],_0x4d0326[_0xdda2('0xe')],_0x4d0326[_0xdda2('0xf')]));_0x4d0326[_0xdda2('0x7')]=_0xdda2('0x10');writeDB(_0x4d0326);}catch(_0x23993d){utils['error'](util[_0xdda2('0x3')](_0xdda2('0xb'),_0x4d0326[_0xdda2('0x6')]),_0x23993d);}};exports[_0xdda2('0x11')]=function(_0x52abcb){try{utils[_0xdda2('0xa')](util['format'](_0xdda2('0x12'),_0x52abcb['origtransfereruniqueid']),_0x52abcb);utils['info'](util[_0xdda2('0x3')](_0xdda2('0x13'),_0x52abcb['origtransfereruniqueid'],_0x52abcb[_0xdda2('0x14')],_0x52abcb[_0xdda2('0x15')],_0x52abcb[_0xdda2('0x16')],_0x52abcb[_0xdda2('0x17')]));_0x52abcb=_['assign'](_0x52abcb,{'transfererchannel':_0x52abcb[_0xdda2('0x18')],'transferercalleridnum':_0x52abcb[_0xdda2('0x14')],'transferercalleridname':_0x52abcb[_0xdda2('0x15')],'transfererconnectedlinenum':_0x52abcb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x52abcb[_0xdda2('0x19')],'transfereraccountcode':_0x52abcb[_0xdda2('0x1a')],'transferercontext':_0x52abcb[_0xdda2('0x1b')],'transfererexten':_0x52abcb[_0xdda2('0x1c')],'transfererlinkedid':_0x52abcb['origtransfererlinkedid'],'context':_0x52abcb['origtransferercontext'],'extension':_0x52abcb[_0xdda2('0x1d')],'type':_0xdda2('0x1e')});if(_[_0xdda2('0x1f')](_0x52abcb[_0xdda2('0x20')])){_0x52abcb=_[_0xdda2('0x21')](_0x52abcb,{'transfereechannel':_0x52abcb[_0xdda2('0x22')],'transfereecalleridnum':_0x52abcb[_0xdda2('0x16')],'transfereecalleridname':_0x52abcb[_0xdda2('0x17')],'transfereeconnectedlinenum':_0x52abcb['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x52abcb[_0xdda2('0x23')],'transfereeaccountcode':_0x52abcb[_0xdda2('0x24')],'transfereecontext':_0x52abcb[_0xdda2('0x25')],'transfereeexten':_0x52abcb['transfertargetexten'],'transfereelinkedid':_0x52abcb['transfertargetlinkedid']});}writeDB(_0x52abcb);}catch(_0xaba282){utils[_0xdda2('0x26')](util['format'](_0xdda2('0x12'),_0x52abcb['origtransfereruniqueid']),_0xaba282);}}; \ No newline at end of file +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 diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d84adbf..85dcfa0 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 _0x2293=['getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','found','notfound','[utils][getUserByInternal]'];(function(_0x4e56aa,_0xce3a70){var _0xbeb100=function(_0x37eeb6){while(--_0x37eeb6){_0x4e56aa['push'](_0x4e56aa['shift']());}};_0xbeb100(++_0xce3a70);}(_0x2293,0x6d));var _0x3229=function(_0x1d36f3,_0x59ccf7){_0x1d36f3=_0x1d36f3-0x0;var _0xf3c3e=_0x2293[_0x1d36f3];return _0xf3c3e;};'use strict';var BPromise=require(_0x3229('0x0'));var jayson=require(_0x3229('0x1'));var moment=require(_0x3229('0x2'));var util=require(_0x3229('0x3'));var client=jayson['client'][_0x3229('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x3229('0x5'));exports[_0x3229('0x6')]=function(_0x477146,_0x3ec7e5){logger['info'](_0x477146,_0x3ec7e5?util['inspect'](_0x3ec7e5,{'showHidden':![],'depth':null}):'');};exports[_0x3229('0x7')]=function(_0x554b3b,_0x2536aa){logger['debug'](_0x554b3b,_0x2536aa?util[_0x3229('0x8')](_0x2536aa,{'showHidden':![],'depth':null}):'');};exports[_0x3229('0x9')]=function(_0x17e9a6,_0xaf2c03){logger[_0x3229('0x9')](_0x17e9a6,_0xaf2c03?util[_0x3229('0x8')](_0xaf2c03,{'showHidden':![],'depth':null}):'');};exports[_0x3229('0xa')]=function(_0x81be5f,_0x113ee4){return client[_0x3229('0xa')](_0x81be5f,{'body':_0x113ee4})['then'](function(_0x1eb5da){logger['debug'](_0x3229('0xb'),_0x81be5f,_0x1eb5da?util['inspect'](_0x1eb5da,{'showHidden':![],'depth':null}):'');})[_0x3229('0xc')](function(_0x2abf8c){logger[_0x3229('0x9')]('[utils][request]\x20name:%s',_0x81be5f,_0x2abf8c?util[_0x3229('0x8')](_0x2abf8c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x20bec0){return client['request'](_0x3229('0xd'),{'options':{'raw':!![],'attributes':['id',_0x3229('0xe'),'name',_0x3229('0xf')],'where':_0x20bec0,'limit':0x1}})[_0x3229('0x10')](function(_0x490e18){logger['debug'](_0x3229('0x11'),JSON[_0x3229('0x12')](_0x20bec0),_0x490e18?util[_0x3229('0x8')](_0x490e18,{'showHidden':![],'depth':null}):'');return _0x490e18[_0x3229('0x13')]['length']?_0x490e18['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x2ffe6c){return new BPromise(function(_0x1e67bb,_0x3e9342){if(_0x2ffe6c){return getUser({'internal':_0x2ffe6c})[_0x3229('0x10')](function(_0x993f9c){logger[_0x3229('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2ffe6c,_0x993f9c?_0x3229('0x14'):_0x3229('0x15'));return _0x1e67bb(_0x993f9c);})[_0x3229('0xc')](function(_0x3f211a){logger[_0x3229('0x9')](_0x3229('0x16'),_0x3f211a?util['inspect'](_0x3f211a,{'showHidden':![],'depth':null}):'');return _0x1e67bb(null);});}return _0x1e67bb(null);});};exports[_0x3229('0x17')]=function(_0x3d9970){return new BPromise(function(_0x1af139,_0x460b9d){if(_0x3d9970){return getUser({'interface':_0x3d9970})['then'](function(_0x122b93){logger[_0x3229('0x6')](_0x3229('0x18'),_0x3d9970,_0x122b93?'found':_0x3229('0x15'));return _0x1af139(_0x122b93);})[_0x3229('0xc')](function(_0xb3271c){logger[_0x3229('0x9')](_0x3229('0x19'),_0xb3271c?util[_0x3229('0x8')](_0xb3271c,{'showHidden':![],'depth':null}):'');return _0x1af139(null);});}return _0x1af139(null);});};exports[_0x3229('0x1a')]=function(_0x4fe1ce){return new BPromise(function(_0x3c79aa,_0x1908b2){if(_0x4fe1ce){return getUser({'name':_0x4fe1ce})['then'](function(_0x2152be){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x4fe1ce,_0x2152be?_0x3229('0x14'):'notfound');return _0x3c79aa(_0x2152be);})[_0x3229('0xc')](function(_0xa6e40b){logger[_0x3229('0x9')](_0x3229('0x1b'),_0xa6e40b?util[_0x3229('0x8')](_0xa6e40b,{'showHidden':![],'depth':null}):'');return _0x3c79aa(null);});}return _0x3c79aa(null);});};exports[_0x3229('0x1c')]=function(_0x422b9c){return new BPromise(function(_0x19b9c3,_0x18360c){if(_0x422b9c){return client[_0x3229('0xa')](_0x3229('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x3229('0x1e'),'type',_0x3229('0x1f'),'acwTimeout'],'where':{'name':_0x422b9c},'limit':0x1}})['then'](function(_0x8def11){logger[_0x3229('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x422b9c,_0x8def11?util[_0x3229('0x8')](_0x8def11,{'showHidden':![],'depth':null}):'');logger[_0x3229('0x6')](_0x3229('0x20'),_0x422b9c,_0x8def11?_0x3229('0x14'):_0x3229('0x15'));return _0x19b9c3(_0x8def11[_0x3229('0x13')][_0x3229('0x21')]?_0x8def11['result'][0x0]:null);})[_0x3229('0xc')](function(_0x21bafb){logger[_0x3229('0x9')]('[utils][getVoiceQueueByName]',_0x21bafb?util[_0x3229('0x8')](_0x21bafb,{'showHidden':![],'depth':null}):'');return _0x19b9c3(null);});}return _0x19b9c3(null);});};exports[_0x3229('0x22')]=function(_0x38cf2e,_0x569c95){return moment(_0x38cf2e)[_0x3229('0x23')](_0x569c95,_0x3229('0x24'))['format'](_0x3229('0x25'));};exports[_0x3229('0x26')]=function(_0x137b83,_0x2b6812){return moment(_0x137b83)['subtract'](_0x2b6812,_0x3229('0x24'))[_0x3229('0x27')](_0x3229('0x25'));};exports[_0x3229('0x28')]=function(_0x2cd9db,_0x590c91){return moment(_0x2cd9db)['diff'](moment(_0x590c91),_0x3229('0x24'));};exports[_0x3229('0x29')]=function(_0x237e6d,_0x5f2708){return parseInt(_0x237e6d,0xa)+parseInt(_0x5f2708,0xa);};exports['now']=function(){return moment()['format'](_0x3229('0x25'));};exports[_0x3229('0x2a')]=function(_0x5f3670,_0xb9476e){if(_0xb9476e){return moment(_0x5f3670)[_0x3229('0x2a')](_0xb9476e);}return!![];};exports[_0x3229('0x2b')]=function(_0x136319,_0x274c14){if(_0x274c14){return moment(_0x136319)[_0x3229('0x2b')](_0x274c14);}else if(_0x136319){return!![];}return![];}; \ No newline at end of file +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 diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index ffc795e..d1ca659 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 _0x3fe2=['util','./loggers','./safe-template','./mask-sensitive-data','join','/var','log','xcally','client','role','name','user','then','no-user','data','timestamp','catch','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','agent_name','url','setupLoggers','lodash','express-winston','path'];(function(_0x3fa2c2,_0x56fa39){var _0x500bd3=function(_0x587801){while(--_0x587801){_0x3fa2c2['push'](_0x3fa2c2['shift']());}};_0x500bd3(++_0x56fa39);}(_0x3fe2,0xca));var _0x23fe=function(_0x4ffad9,_0x5504b8){_0x4ffad9=_0x4ffad9-0x0;var _0x37276f=_0x3fe2[_0x4ffad9];return _0x37276f;};var fs=require('fs-extra');var _=require(_0x23fe('0x0'));var ewinston=require(_0x23fe('0x1'));var path=require(_0x23fe('0x2'));var util=require(_0x23fe('0x3'));var fileLogger=require(_0x23fe('0x4'))['fileLogger'];var safeTemplate=require(_0x23fe('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x23fe('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x3425a8(_0x5bb195){var _0x1ec1ce=path[_0x23fe('0x7')](_0x23fe('0x8'),_0x23fe('0x9'),_0x23fe('0xa'));var _0x2715f9=path['join'](_0x23fe('0xb'),_0x5bb195[_0x23fe('0xc')]+'-'+_0x5bb195[_0x23fe('0xd')]);return fs['ensureDir'](path['join'](_0x1ec1ce,_0x2715f9))['then'](function(){var _0x2f8a68=fileLogger(_0x23fe('0xb'),path[_0x23fe('0x7')](_0x1ec1ce,_0x2715f9));return _0x2f8a68;})['catch'](function(_0x4d07f1){throw _0x4d07f1;});}this[_0x23fe('0x9')]=function(_0x5c9e6a,_0x4d16c1,_0xfc74de,_0x138749){return _0x3425a8(_0x5c9e6a[_0x23fe('0xe')])['then'](function(_0x47c234){var _0x248fce=_0x47c234[_0x4d16c1];return _0x248fce;})[_0x23fe('0xf')](function(_0x505af5){var _0x2e74bd=_0x5c9e6a['user']?_0x5c9e6a[_0x23fe('0xe')]['id']:_0x23fe('0x10');var _0xd6f5bc=_0x138749[_0x23fe('0x11')];var _0x181848=_0x138749[_0x23fe('0x12')];var _0x2a296c=new Date(Number(_0x181848));return _0x505af5(_0x2e74bd,_0x2a296c,_0xfc74de,_0xd6f5bc);})[_0x23fe('0x13')](function(_0x54f760){fileLogger(_0x23fe('0xb'))['error'](_0x54f760);});};}function setupLoggers(_0x4e82eb){return new Promise(function(_0x292e8a){var _0x6914bd=new ClientSideLogger();var _0x55d49b=fileLogger(_0x23fe('0x14'));var _0x4a76ef=fileLogger(_0x23fe('0x15'));_0x4e82eb['set']('client-side-logger',_0x6914bd);_0x4e82eb[_0x23fe('0x16')](ewinston[_0x23fe('0x17')]({'winstonInstance':_0x55d49b,'meta':![],'statusLevels':!![],'msg':function(_0x345048,_0x3861cc){var _0x4a35cf=_0x23fe('0x18');if(!_[_0x23fe('0x19')](_0x345048[_0x23fe('0x1a')])){_0x4a35cf+=_0x23fe('0x1b');var _0x48f833=_0x345048[_0x23fe('0x1a')];maskSensitiveData(_0x48f833);}return safeTemplate(util[_0x23fe('0x1c')](_0x4a35cf,_0x345048[_0x23fe('0x1d')],_0x345048[_0x23fe('0x1e')][_0x23fe('0x1f')]?_0x345048[_0x23fe('0x1e')][_0x23fe('0x1f')]:_0x345048['connection'][_0x23fe('0x20')]||_0x345048['ip'],_0x345048['url'],_0x3861cc['statusCode'],_0x3861cc[_0x23fe('0x21')],_0x345048[_0x23fe('0xe')]?_0x345048[_0x23fe('0xe')]['id']:null,_0x345048[_0x23fe('0xe')]?_0x345048[_0x23fe('0xe')][_0x23fe('0xd')]:null,_0x345048[_0x23fe('0xe')]?_0x345048['user'][_0x23fe('0xc')]:null,_0x48f833?util[_0x23fe('0x22')](_0x48f833,![],null):''));}}));_0x4e82eb[_0x23fe('0x16')](ewinston['logger']({'winstonInstance':_0x4a76ef,'meta':![],'statusLevels':!![],'msg':function(_0x424ca7,_0x1779a3){var _0x404ae8=_0x23fe('0x23');if(_0x424ca7[_0x23fe('0x1a')]&&_0x424ca7[_0x23fe('0x1a')][_0x23fe('0x24')]&&_0x424ca7[_0x23fe('0x1a')][_0x23fe('0x25')]){_0x404ae8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x404ae8,_0x424ca7[_0x23fe('0x1d')],_0x424ca7[_0x23fe('0x1e')][_0x23fe('0x1f')]?_0x424ca7[_0x23fe('0x1e')][_0x23fe('0x1f')]:_0x424ca7['connection'][_0x23fe('0x20')]||_0x424ca7['ip'],_0x424ca7['url'],_0x1779a3['statusCode'],_0x1779a3[_0x23fe('0x21')],_0x424ca7[_0x23fe('0xe')]?_0x424ca7[_0x23fe('0xe')]['id']:null,_0x424ca7[_0x23fe('0xe')]?_0x424ca7[_0x23fe('0xe')]['name']:null,_0x424ca7[_0x23fe('0xe')]?_0x424ca7[_0x23fe('0xe')]['role']:null,_0x424ca7[_0x23fe('0x1a')]&&_0x424ca7['body'][_0x23fe('0x24')]?_0x424ca7[_0x23fe('0x1a')][_0x23fe('0x24')]:'other',_0x424ca7[_0x23fe('0x1a')]&&_0x424ca7[_0x23fe('0x1a')][_0x23fe('0x25')]?_0x424ca7[_0x23fe('0x1a')][_0x23fe('0x25')]:'',_0x424ca7['body']&&_0x424ca7[_0x23fe('0x1a')][_0x23fe('0x26')]?_0x424ca7[_0x23fe('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x1ed774){var _0x24b0bb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24b0bb['test'](_0x1ed774[_0x23fe('0x27')]);}}));return _0x292e8a();});}exports[_0x23fe('0x28')]=setupLoggers; \ No newline at end of file +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 diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 5a81f7c..c3d0233 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd84f=['day','isBetween','timeCompare','format','includes','date','daysInMonth','max','min','MMM','monthCompare','guess','test','isMoment','split','padStart','length','iftime','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','endOf'];(function(_0x3eaeb3,_0x3aef2f){var _0x1d629d=function(_0x554de9){while(--_0x554de9){_0x3eaeb3['push'](_0x3eaeb3['shift']());}};_0x1d629d(++_0x3aef2f);}(_0xd84f,0x84));var _0xfd84=function(_0x50569e,_0x49328c){_0x50569e=_0x50569e-0x0;var _0x88c1cb=_0xd84f[_0x50569e];return _0x88c1cb;};var _=require('lodash');var moment=require(_0xfd84('0x0'));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][_0xfd84('0x1')](function(_0x1c40d8){return _0x1c40d8[_0xfd84('0x2')];})[_0xfd84('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xfd84('0x4');var EINVALID_DATE=_0xfd84('0x5');function throwIfDateNotValid(_0x2ce532){if(!_0x2ce532[_0xfd84('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x80b3e){var _0x23745b=_0x80b3e['split'](':')[_0xfd84('0x1')](function(_0x3eab87){return parseInt(_0x3eab87,0xa);});var _0x3bbc5a=_0x23745b[0x0];var _0xd6629e=_0x23745b[0x1];if(_0x3bbc5a<0x0||_0x3bbc5a>0x17||_0xd6629e<0x0||_0xd6629e>0x3b){throw new Error(EINVALID_DATE);}return[_0x3bbc5a,_0xd6629e];}function circularDoWInterval(_0x4ff7dc,_0x5c4f2d){if(_0x4ff7dc===_0x5c4f2d){return[_0x4ff7dc];}else{var _0x24bb70=moment[_0xfd84('0x7')]();moment[_0xfd84('0x7')]('en');var _0x3f3175=moment['weekdaysShort']()[_0xfd84('0x1')](function(_0x313ceb){return _0x313ceb[_0xfd84('0x8')]();});moment[_0xfd84('0x7')](_0x24bb70);var _0xa82604=_0x3f3175[_0xfd84('0x9')](_0x4ff7dc);var _0x2f1e1f=_0x3f3175[_0xfd84('0x9')](_0x5c4f2d);if(_0x2f1e1f>_0xa82604){return _0x3f3175[_0xfd84('0xa')](_0xa82604,_0x2f1e1f+0x1);}else{var _0xec78e0=_0x3f3175['slice'](0x0,_0x2f1e1f+0x1);var _0x348d0a=_0x3f3175[_0xfd84('0xa')](_0xa82604);return _0x348d0a[_0xfd84('0xb')](_0xec78e0);}}}module[_0xfd84('0xc')][_0xfd84('0xd')]=circularDoWInterval;function circularMonthInterval(_0x40972f,_0x5167a9){if(_0x40972f===_0x5167a9){return[_0x40972f];}else{var _0x826a0a=moment[_0xfd84('0x7')]();moment[_0xfd84('0x7')]('en');var _0x5815bc=moment['monthsShort']()[_0xfd84('0x1')](function(_0x32eb75){return _0x32eb75[_0xfd84('0x8')]();});moment['locale'](_0x826a0a);var _0x50d969=_0x5815bc[_0xfd84('0x9')](_0x40972f);var _0x587ba6=_0x5815bc[_0xfd84('0x9')](_0x5167a9);if(_0x587ba6>_0x50d969){return _0x5815bc['slice'](_0x50d969,_0x587ba6+0x1);}else{var _0x2a232a=_0x5815bc['slice'](0x0,_0x587ba6+0x1);var _0x18658f=_0x5815bc[_0xfd84('0xa')](_0x50d969);return _0x18658f[_0xfd84('0xb')](_0x2a232a);}}}module[_0xfd84('0xc')][_0xfd84('0xe')]=circularMonthInterval;function parseDom(_0x1ea69a){var _0x55b346=parseInt(_0x1ea69a,0xa);if(_0x55b346<0x1||_0x55b346>0x1f){throw new Error(EINVALID_DATE);}return _0x55b346;}function timeCompare(_0x37f81e,_0x211ce2,_0x4d9803){var _0x248676=_0x37f81e[_0xfd84('0xf')]();var _0x57bf58=extractTime(_0x211ce2);var _0x59af78=_0x57bf58[0x0];var _0x3e44dd=_0x57bf58[0x1];var _0x32e673=_0x37f81e['clone']()[_0xfd84('0x10')](_0x59af78)[_0xfd84('0x11')](_0x3e44dd);throwIfDateNotValid(_0x32e673);var _0xc7b4e=extractTime(_0x4d9803);var _0x52e059=_0xc7b4e[0x0];var _0x5d911e=_0xc7b4e[0x1];var _0x20272c=_0x37f81e[_0xfd84('0xf')]()[_0xfd84('0x10')](_0x52e059)[_0xfd84('0x11')](_0x5d911e);throwIfDateNotValid(_0x20272c);if(_0x20272c[_0xfd84('0x12')](_0x32e673)){var _0x1d66e1=_0x248676[_0xfd84('0xf')]()['startOf']('day');var _0x122223=_0x248676['clone']()[_0xfd84('0x13')](_0xfd84('0x14'));return _0x248676['isBetween'](_0x32e673,_0x122223,undefined,'[]')||_0x248676[_0xfd84('0x15')](_0x1d66e1,_0x20272c,undefined,'[]');}else{return _0x248676['isBetween'](_0x32e673,_0x20272c,undefined,'[]');}}module['exports'][_0xfd84('0x16')]=timeCompare;function dowCompare(_0x476ccf,_0x3b3a32,_0x1e5f79){var _0x18b7b3=_0x476ccf['locale']('en')[_0xfd84('0x17')]('ddd')['toLowerCase']();return circularDoWInterval(_0x3b3a32,_0x1e5f79)[_0xfd84('0x18')](_0x18b7b3);}module[_0xfd84('0xc')]['dowCompare']=dowCompare;function domCompare(_0x386644,_0x97d9dd,_0x43477f){var _0xee114d=_0x386644[_0xfd84('0x19')]();if(_0x97d9dd===_0x43477f){return _0xee114d===_0x97d9dd;}else{var _0x28a15f=_0x386644[_0xfd84('0x1a')]();var _0x3f0086=_0x97d9dd<_0x43477f;let _0x3154d6=![];var _0x398e5c=0x0;var _0x403746=0x0;if(_0x3f0086){_0x398e5c=Math[_0xfd84('0x1b')](0x1,_0x97d9dd);_0x403746=Math[_0xfd84('0x1c')](_0x43477f,_0x28a15f);_0x3154d6=_0xee114d>=_0x398e5c&&_0xee114d<=_0x403746;}else{_0x398e5c=Math[_0xfd84('0x1c')](_0x97d9dd,_0x28a15f);_0x403746=Math[_0xfd84('0x1b')](0x1,_0x43477f);_0x3154d6=_0xee114d>=_0x398e5c||_0xee114d<=_0x403746;}return _0x3154d6;}}module[_0xfd84('0xc')]['domCompare']=domCompare;function monthCompare(_0x22d7be,_0x481585,_0x409bb6){var _0x5e905f=_0x22d7be[_0xfd84('0x7')]('en')[_0xfd84('0x17')](_0xfd84('0x1d'))[_0xfd84('0x8')]();return circularMonthInterval(_0x481585,_0x409bb6)[_0xfd84('0x18')](_0x5e905f);}module['exports'][_0xfd84('0x1e')]=monthCompare;function iftime(_0x48965f,_0x27c674=moment['tz'][_0xfd84('0x1f')](),_0x5cd234=moment()){if(!validateRx[_0xfd84('0x20')](_0x48965f)){throw new Error(EINVALID_STRING);}else{var _0x200f07=(moment[_0xfd84('0x21')](_0x5cd234)?_0x5cd234[_0xfd84('0xf')]():moment(_0x5cd234))['tz'](_0x27c674)[_0xfd84('0x7')]('en');throwIfDateNotValid(_0x200f07);var _0x31b3cd=_0x48965f['split'](',');var _0x2ebbf2=_0x31b3cd[0x0];var _0x295c7a=_0x31b3cd[0x1];var _0x29f1fa=_0x31b3cd[0x2];var _0x166b42=_0x31b3cd[0x3];let _0x4b4e2b=!![];if(_0x2ebbf2!=='*'){var _0x55f784=_0x2ebbf2[_0xfd84('0x22')]('-');var _0x3e61e9=_[_0xfd84('0x23')](_0x55f784[0x0],0x5,'0');var _0x516a0b=_0x55f784[_0xfd84('0x24')]===0x2?_[_0xfd84('0x23')](_0x55f784[0x1],0x5,'0'):_0x3e61e9;_0x4b4e2b=timeCompare(_0x200f07,_0x3e61e9,_0x516a0b);}let _0xa4fa49=!![];if(_0x295c7a!=='*'){var _0x4aee91=_0x295c7a[_0xfd84('0x22')]('-');var _0x44f2ea=_0x4aee91[0x0];var _0x148cf7=_0x4aee91[_0xfd84('0x24')]===0x2?_0x4aee91[0x1]:_0x44f2ea;_0xa4fa49=dowCompare(_0x200f07,_0x44f2ea,_0x148cf7);}let _0x110fec=!![];if(_0x29f1fa!=='*'){var _0x5eedaf=_0x29f1fa[_0xfd84('0x22')]('-');var _0x9ba64d=parseDom(_0x5eedaf[0x0]);var _0x3b1b0c=_0x5eedaf[_0xfd84('0x24')]===0x2?parseDom(_0x5eedaf[0x1]):_0x9ba64d;_0x110fec=domCompare(_0x200f07,_0x9ba64d,_0x3b1b0c);}let _0x17aed1=!![];if(_0x166b42!=='*'){var _0x24f2fa=_0x166b42['split']('-');var _0x3f1bab=_0x24f2fa[0x0];var _0x3e7977=_0x24f2fa[_0xfd84('0x24')]===0x2?_0x24f2fa[0x1]:_0x24f2fa[0x0];_0x17aed1=monthCompare(_0x200f07,_0x3f1bab,_0x3e7977);}return _0x4b4e2b&&_0xa4fa49&&_0x110fec&&_0x17aed1;}}module[_0xfd84('0xc')][_0xfd84('0x25')]=iftime; \ No newline at end of file +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 diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 81c5219..a9c70d3 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85c1=['warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','File','%s-%s','error'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x85c1,0x10d));var _0x185c=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x85c1[_0x2cf2e9];return _0xd3670d;};'use strict';var path=require(_0x185c('0x0'));var util=require(_0x185c('0x1'));var moment=require(_0x185c('0x2'));var winston=require(_0x185c('0x3'));var config=require(_0x185c('0x4'));var debugLevel=config[_0x185c('0x5')]?config[_0x185c('0x5')]['toLowerCase']():_0x185c('0x6');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':_0x185c('0x7'),'error':_0x185c('0x8'),'warn':_0x185c('0x9'),'info':_0x185c('0xa'),'print':'bold\x20white','success':_0x185c('0xb'),'http':_0x185c('0xc'),'verbose':'bold\x20magenta','debug':_0x185c('0xd'),'silly':_0x185c('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4a417f,_0x42723f,_0x573b7f){var _0x292c83=_0x4a417f||_0x185c('0xf');return path[_0x185c('0x10')](_0x292c83,util['format'](_0x185c('0x11'),_0x42723f,_0x573b7f));}function formatter(_0x3c7130,_0x5c97ed){_0x5c97ed['message']=_0x5c97ed[_0x185c('0x12')][_0x185c('0x13')](/@@{/g,_0x185c('0x14'))['replace'](/}@@/g,_0x185c('0x15'))[_0x185c('0x13')](/@{/g,'{{')[_0x185c('0x13')](/}@/g,'}}');return util[_0x185c('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x185c('0x16')](_0x185c('0x17')),_0x5c97ed[_0x185c('0x18')]['toUpperCase'](),_0x3c7130,_0x5c97ed[_0x185c('0x12')]);}function fileFormat(_0x3f4188,_0x3f642c){_0x3f642c[_0x185c('0x12')]=_0x3f642c[_0x185c('0x12')]['replace'](/@@{/g,_0x185c('0x14'))[_0x185c('0x13')](/}@@/g,_0x185c('0x15'))[_0x185c('0x13')](/@{/g,'{{')[_0x185c('0x13')](/}@/g,'}}');var _0x558c18=_0x3f642c[_0x185c('0x19')]&&Object[_0x185c('0x1a')](_0x3f642c[_0x185c('0x19')])['length']?'\x0a\x09'+JSON['stringify'](_0x3f642c[_0x185c('0x19')]):'';return util[_0x185c('0x16')](_0x185c('0x1b'),moment()[_0x185c('0x16')](_0x185c('0x17')),_0x3f642c[_0x185c('0x18')][_0x185c('0x1c')](),_0x3f4188,_0x3f642c[_0x185c('0x12')],_0x558c18);}function consoleLogger(){var _0x1cbe3a=new winston[(_0x185c('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x185c('0x1e'))][(_0x185c('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x27acde){return formatter('',_0x27acde);}})]});return _0x1cbe3a;}function fileLogger(_0x46c453,_0x3cb596){var _0x28f7a4=new winston[(_0x185c('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x185c('0x1e'))][(_0x185c('0x20'))]({'name':util[_0x185c('0x16')](_0x185c('0x21'),_0x46c453,_0x185c('0x22')),'filename':getLogFileName(_0x3cb596,_0x46c453,_0x185c('0x22')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x29bb3b){return fileFormat(_0x46c453,_0x29bb3b);}}),new winston[(_0x185c('0x1e'))][(_0x185c('0x20'))]({'name':util['format'](_0x185c('0x21'),_0x46c453,debugLevel),'filename':getLogFileName(_0x3cb596,_0x46c453,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x269ce4){return fileFormat(_0x46c453,_0x269ce4);}}),new winston['transports']['Console']({'level':_0x185c('0x23'),'json':![],'formatter':function(_0x23eb41){return fileFormat(_0x46c453,_0x23eb41);}})]});return _0x28f7a4;}exports[_0x185c('0x24')]=consoleLogger;exports[_0x185c('0x25')]=fileLogger; \ No newline at end of file +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 diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 6f82e35..4c9a0c1 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 _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x1d6409,_0x5946b7){var _0x587b23=function(_0x5c045d){while(--_0x5c045d){_0x1d6409['push'](_0x1d6409['shift']());}};_0x587b23(++_0x5946b7);}(_0x1261,0x144));var _0x1126=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x1261[_0x30f07a];return _0xb38461;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +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 diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index f38aed6..cd1b9cb 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 _0x9354=['map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x566ef9,_0x4a011f){var _0x523363=function(_0x5b3b9c){while(--_0x5b3b9c){_0x566ef9['push'](_0x566ef9['shift']());}};_0x523363(++_0x4a011f);}(_0x9354,0x96));var _0x4935=function(_0x298b53,_0x3f830d){_0x298b53=_0x298b53-0x0;var _0x370c14=_0x9354[_0x298b53];return _0x370c14;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42d9d9){return _0x42d9d9==='{{'?_0x4935('0x0'):'\x20}\x20}';}function safeTemplate(_0x263dd5){var _0x2a4993=_0x263dd5;if(typeof _0x263dd5===_0x4935('0x1')){_0x2a4993=_0x263dd5[_0x4935('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x263dd5)){_0x2a4993=_0x263dd5[_0x4935('0x3')](function(_0x2d509b){return safeTemplate(_0x2d509b);});}else if(_[_0x4935('0x4')](_0x263dd5)){_0x2a4993=Object[_0x4935('0x5')](_0x263dd5)[_0x4935('0x6')](function(_0x2e47bd,_0x118d36){_0x2e47bd[_0x118d36]=safeTemplate(_0x263dd5[_0x118d36]);return _0x2e47bd;},{});}return _0x2a4993;}module[_0x4935('0x7')][_0x4935('0x8')]=safeTemplate; \ No newline at end of file +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 diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 1c543df..223bddc 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 _0xa60e=['NODE_PATH','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env'];(function(_0x3ff8e5,_0xda34ad){var _0x15f491=function(_0x59e679){while(--_0x59e679){_0x3ff8e5['push'](_0x3ff8e5['shift']());}};_0x15f491(++_0xda34ad);}(_0xa60e,0xb0));var _0xea60=function(_0x3f580f,_0x42b922){_0x3f580f=_0x3f580f-0x0;var _0x1c4c3c=_0xa60e[_0x3f580f];return _0x1c4c3c;};var fs=require(_0xea60('0x0'));var path=require(_0xea60('0x1'));var config=require(_0xea60('0x2'));var root=config[_0xea60('0x3')];var APP_JSON_PATH=path[_0xea60('0x4')](root,_0xea60('0x5'));var NODEPATH=path[_0xea60('0x4')](root,_0xea60('0x6'));function setLegacyLibsNodeEnvPath(_0x53042a){let _0x18ed51=![];if(Array[_0xea60('0x7')](_0x53042a[_0xea60('0x8')])){var _0x161b39=_0x53042a[_0xea60('0x8')][_0xea60('0x9')](function(_0xfc6e5f){return _0xfc6e5f[_0xea60('0xa')]===_0xea60('0xb');});if(_0x161b39>-0x1){var _0x40147a=_0x53042a[_0xea60('0x8')][_0x161b39];if(typeof _0x40147a[_0xea60('0xc')][_0xea60('0xd')]!=='string'){_0x40147a[_0xea60('0xc')]['NODE_PATH']=NODEPATH;_0x18ed51=!![];}}return{'appConfig':_0x53042a,'updated':_0x18ed51};}}function updateAppConfig(_0x4f1961){return fs['pathExists'](APP_JSON_PATH)[_0xea60('0xe')](function(_0x270630){if(_0x270630){return fs[_0xea60('0xf')](APP_JSON_PATH)[_0xea60('0xe')](function(_0x140326){var _0x40bca5=setLegacyLibsNodeEnvPath(_0x140326);if(_0x40bca5[_0xea60('0x10')]){_0x4f1961[_0xea60('0x11')](_0xea60('0x12'));return fs[_0xea60('0x13')](APP_JSON_PATH,_0x140326,{'spaces':0x2});}else{return Promise[_0xea60('0x4')]();}});}else{return Promise[_0xea60('0x4')]();}});}module[_0xea60('0x14')]=updateAppConfig; \ No newline at end of file +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 diff --git a/snippet/3.5.0/index.html b/snippet/3.5.0/index.html index 6ef5076..f4db76c 100644 --- a/snippet/3.5.0/index.html +++ b/snippet/3.5.0/index.html @@ -1,17 +1,85 @@ -xCally Motion Chat
") + + + + + + + + +
+
+ + +
+
+
{{ actualTitle }} +
+ + + {{ actualTitle }} + + + + +
+ + +
+ +
+
\ No newline at end of file + " + ng-click="vm.close(); $event.stopPropagation();" + > + + +
+ +
+ +
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + diff --git a/snippet/3.5.0/scripts/app.js b/snippet/3.5.0/scripts/app.js index 210848b..7c3a8af 100644 --- a/snippet/3.5.0/scripts/app.js +++ b/snippet/3.5.0/scripts/app.js @@ -1,2 +1,42 @@ -/*! 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 +/*! + * ************************************************************************* + * * * + * * 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 diff --git a/snippet/3.5.0/scripts/app.js.LICENSE.txt b/snippet/3.5.0/scripts/app.js.LICENSE.txt deleted file mode 100644 index 15c6a44..0000000 --- a/snippet/3.5.0/scripts/app.js.LICENSE.txt +++ /dev/null @@ -1,19 +0,0 @@ -/*! - * ************************************************************************* - * * * - * * xCALLY Motion - The Omnichannel Contact Center * - * * Copyright (c) Xenialab s.r.l. All Rights Reserved * - * * * - * ************************************************************************* - * * * - * * Email: info@xcally.com * - * * Website: https://www.xcally.com * - * * * - * ************************************************************************* - * * * - * * The SOFTWARE PRODUCT is protected by copyright laws and international * - * * copyright treaties, as well as other intellectual property laws and * - * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * - * * * - * ************************************************************************* - */ diff --git a/snippet/3.5.0/scripts/app.js.map b/snippet/3.5.0/scripts/app.js.map new file mode 100644 index 0000000..9b8ff55 --- /dev/null +++ b/snippet/3.5.0/scripts/app.js.map @@ -0,0 +1 @@ +{"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 49ad0c7..399816b 100644 --- a/snippet/3.5.0/scripts/chat.js +++ b/snippet/3.5.0/scripts/chat.js @@ -1,3 +1,149331 @@ -/*! For license information please see chat.js.LICENSE.txt */ -(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["chat"],{"./node_modules/@flowjs/ng-flow/dist/ng-flow.js":(e,t,n)=>{var o=n("./node_modules/@flowjs/flow.js/src/flow.js");angular.module("flow.provider",[]).provider("flowFactory",(function(){"use strict";this.defaults={},this.factory=function(e){return new o(e)},this.events=[],this.on=function(e,t){this.events.push([e,t])},this.$get=function(){var e=this.factory,t=this.defaults,n=this.events;return{create:function(o){var r=e(angular.extend({},t,o));return angular.forEach(n,(function(e){r.on(e[0],e[1])})),r}}}})),angular.module("flow.init",["flow.provider"]).controller("flowCtrl",["$scope","$attrs","$parse","flowFactory",function(e,t,n,o){var r=angular.extend({},e.$eval(t.flowInit)),s=e.$eval(t.flowObject)||o.create(r),a=function(t){var n=Array.prototype.slice.call(arguments);n.shift();var o=e.$broadcast.apply(e,["flow::"+t,s].concat(n));if({progress:1,filesSubmitted:1,fileSuccess:1,fileError:1,complete:1}[t]&&e.$applyAsync(),o.defaultPrevented)return!1};s.on("catchAll",a),e.$on("$destroy",(function(){s.off("catchAll",a)})),e.$flow=s,t.hasOwnProperty("flowName")&&(n(t.flowName).assign(e,s),e.$on("$destroy",(function(){n(t.flowName).assign(e)})))}]).directive("flowInit",[function(){return{scope:!0,controller:"flowCtrl"}}]),angular.module("flow.btn",["flow.init"]).directive("flowBtn",[function(){return{restrict:"EA",scope:!1,require:"^flowInit",link:function(e,t,n){var o=n.hasOwnProperty("flowDirectory"),r=n.hasOwnProperty("flowSingleFile"),s=n.hasOwnProperty("flowAttrs")&&e.$eval(n.flowAttrs);e.$flow.assignBrowse(t,o,r,s)}}}]),angular.module("flow.dragEvents",["flow.init"]).directive("flowPreventDrop",(function(){return{scope:!1,link:function(e,t,n){t.bind("drop dragover",(function(e){e.preventDefault()}))}}})).directive("flowDragEnter",["$timeout",function(e){return{scope:!1,link:function(t,n,o){var r,s=!1;n.bind("dragover",(function(n){var a,i,d;i=!1,d=(a=n).dataTransfer||a.originalEvent.dataTransfer,angular.forEach(d&&d.types,(function(e){"Files"===e&&(i=!0)})),i&&(s||(t.$apply(o.flowDragEnter),s=!0),e.cancel(r),n.preventDefault())})),n.bind("dragleave drop",(function(n){e.cancel(r),r=e((function(){t.$eval(o.flowDragLeave),r=null,s=!1}),100)}))}}}]),angular.module("flow.drop",["flow.init"]).directive("flowDrop",(function(){return{scope:!1,require:"^flowInit",link:function(e,t,n){function o(){e.$flow.assignDrop(t)}n.flowDropEnabled?e.$watch(n.flowDropEnabled,(function(n){n?o():e.$flow.unAssignDrop(t)})):o()}}})),function(e){"use strict";var t=e.module("flow.events",["flow.init"]);e.forEach({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"]},(function(n,o){var r,s="flow"+((r=o).charAt(0).toUpperCase()+r.slice(1));"flowUploadStart"==s&&(s="flowUploadStarted"),t.directive(s,[function(){return{require:"^flowInit",controller:["$scope","$attrs",function(t,r){t.$on("flow::"+o,(function(){var o=Array.prototype.slice.call(arguments),a=o.shift();if(t.$flow===o.shift()){var i={};e.forEach(n,(function(e,t){i[e]=o[t]})),!1===t.$eval(r[s],i)&&a.preventDefault()}}))}]}}])}))}(angular),angular.module("flow.img",["flow.init"]).directive("flowImg",[function(){return{scope:!1,require:"^flowInit",link:function(e,t,n){var o=n.flowImg;e.$watch(o,(function(t){if(t){var o=new FileReader;o.readAsDataURL(t.file),o.onload=function(t){e.$apply((function(){n.$set("src",t.target.result)}))}}}))}}}]),angular.module("flow.transfers",["flow.init"]).directive("flowTransfers",[function(){return{scope:!0,require:"^flowInit",link:function(e){e.transfers=e.$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/directives/viewDirective.js":(e,t,n)=>{"use strict";var o,r=n("./node_modules/@uirouter/core/lib-esm/index.js"),s=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js"),a=n("./node_modules/@uirouter/angularjs/lib-esm/services.js"),i=n("./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js");function d(e,t,n,o,i){var d=(0,r.parse)("viewDecl.controllerAs"),u=(0,r.parse)("viewDecl.resolveAs");return{restrict:"ECA",priority:-400,compile:function(o){var m=o.html();return o.empty(),function(o,_){var c=_.data("$uiView");if(!c)return _.html(m),void e(_.contents())(o);var h=c.$cfg||{viewDecl:{},getTemplate:r.noop},f=h.path&&new r.ResolveContext(h.path);_.html(h.getTemplate(_,f)||m),r.trace.traceUIViewFill(c.$uiView,_.html());var p=e(_.contents()),M=h.controller,y=d(h),L=u(h),g=f&&(0,a.D)(f);if(o[L]=g,M){var Y=t(M,(0,r.extend)({},g,{$scope:o,$element:_}));y&&(o[y]=Y,o[y][L]=g),_.data("$ngControllerController",Y),_.children().data("$ngControllerController",Y),l(i,n,Y,o,h)}if((0,r.isString)(h.component))var v=(0,r.kebobString)(h.component),k=new RegExp("^(x-|data-)?"+v+"$","i"),j=o.$watch((function(){var e=[].slice.call(_[0].children).filter((function(e){return e&&e.tagName&&k.exec(e.tagName)}));return e&&s.ng.element(e).data("$"+h.component+"Controller")}),(function(e){e&&(l(i,n,e,o,h),j())}));p(o)}}}}o=["$view","$animate","$uiViewScroll","$interpolate","$q",function(e,t,n,o,a){var d={$cfg:{viewDecl:{$context:e._pluginapi._rootViewContext()}},$uiView:{}},u={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(m,l,_){return function(m,l,c){var h,f,p,M,y=c.onload||"",L=c.autoscroll,g=function(e,n,o){s.ng.version.minor>2?t.enter(e,null,n).then(o):t.enter(e,null,n,o)},Y=function(e,n){s.ng.version.minor>2?t.leave(e).then(n):t.leave(e,n)},v=l.inheritedData("$uiView")||d,k=o(c.uiView||c.name||"")(m)||"$default",j={$type:"ng1",id:u.count++,name:k,fqn:v.$uiView.fqn?v.$uiView.fqn+"."+k:k,config:null,configUpdated:function(e){(!e||e instanceof i.qO)&&(M!==e&&(r.trace.traceUIViewConfigUpdated(j,e&&e.viewDecl&&e.viewDecl.$context),M=e,b(e)))},get creationContext(){var e=(0,r.parse)("$cfg.viewDecl.$context")(v),t=(0,r.parse)("$uiView.creationContext")(v);return e||t}};r.trace.traceUIViewEvent("Linking",j),l.data("$uiView",{$uiView:j}),b();var w=e.registerUIView(j);function b(e){var t=m.$new(),o=a.defer(),s=a.defer(),i={$cfg:e,$uiView:j},d={$animEnter:o.promise,$animLeave:s.promise,$$animLeave:s};t.$emit("$viewContentLoading",k);var u=_(t,(function(e){e.data("$uiViewAnim",d),e.data("$uiView",i),g(e,l,(function(){o.resolve(),p&&p.$emit("$viewContentAnimationEnded"),((0,r.isDefined)(L)&&!L||m.$eval(L))&&n(e)})),function(){if(h&&(r.trace.traceUIViewEvent("Removing (previous) el",h.data("$uiView")),h.remove(),h=null),p&&(r.trace.traceUIViewEvent("Destroying scope",j),p.$destroy(),p=null),f){var e=f.data("$uiViewAnim");r.trace.traceUIViewEvent("Animate out",e),Y(f,(function(){e.$$animLeave.resolve(),h=null})),h=f,f=null}}()}));f=u,(p=t).$emit("$viewContentLoaded",e||M),p.$eval(y)}m.$on("$destroy",(function(){r.trace.traceUIViewEvent("Destroying/Unregistering",j),w()}))}}};return u}],d.$inject=["$compile","$controller","$transitions","$view","$q"];var u="function"==typeof s.ng.module("ui.router").component,m=0;function l(e,t,n,o,s){!(0,r.isFunction)(n.$onInit)||(s.viewDecl.component||s.viewDecl.componentProvider)&&u||n.$onInit();var a=(0,r.tail)(s.path).state.self,i={bind:n};if((0,r.isFunction)(n.uiOnParamsChanged)){var d=new r.ResolveContext(s.path).getResolvable("$transition$").data;o.$on("$destroy",t.onSuccess({},(function(e){if(e!==d&&-1===e.exiting().indexOf(a)){var t=e.params("to"),o=e.params("from"),s=function(e){return e.paramSchema},i=e.treeChanges("to").map(s).reduce(r.unnestR,[]),u=e.treeChanges("from").map(s).reduce(r.unnestR,[]),m=i.filter((function(e){var n=u.indexOf(e);return-1===n||!u[n].type.equals(t[e.id],o[e.id])}));if(m.length){var l=m.map((function(e){return e.id})),_=(0,r.filter)(t,(function(e,t){return-1!==l.indexOf(t)}));n.uiOnParamsChanged(_,e)}}}),i))}if((0,r.isFunction)(n.uiCanExit)){var l=m++,_="_uiCanExitIds",c=function(e){return!!e&&(e[_]&&!0===e[_][l]||c(e.redirectedFrom()))},h={exiting:a.name};o.$on("$destroy",t.onBefore(h,(function(t){var o,r=t[_]=t[_]||{};return c(t)||(o=e.when(n.uiCanExit(t))).then((function(e){return r[l]=!1!==e})),o}),i))}}s.ng.module("ui.router.state").directive("uiView",o),s.ng.module("ui.router.state").directive("uiView",d)},"./node_modules/@uirouter/angularjs/lib-esm/interface.js":()=>{},"./node_modules/@uirouter/angularjs/lib-esm/services.js":(e,t,n)=>{"use strict";n.d(t,{D:()=>k});var o=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js"),r=n("./node_modules/@uirouter/core/lib-esm/index.js"),s=n("./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"),a=function(){function e(){var e=this;this._useHttp=o.ng.version.minor<3,this.$get=["$http","$templateCache","$injector",function(t,n,o){return e.$templateRequest=o.has&&o.has("$templateRequest")&&o.get("$templateRequest"),e.$http=t,e.$templateCache=n,e}]}return e.prototype.useHttpService=function(e){this._useHttp=e},e.prototype.fromConfig=function(e,t,n){var o=function(e){return r.services.$q.when(e).then((function(e){return{template:e}}))},s=function(e){return r.services.$q.when(e).then((function(e){return{component:e}}))};return(0,r.isDefined)(e.template)?o(this.fromString(e.template,t)):(0,r.isDefined)(e.templateUrl)?o(this.fromUrl(e.templateUrl,t)):(0,r.isDefined)(e.templateProvider)?o(this.fromProvider(e.templateProvider,t,n)):(0,r.isDefined)(e.component)?s(e.component):(0,r.isDefined)(e.componentProvider)?s(this.fromComponentProvider(e.componentProvider,t,n)):o("")},e.prototype.fromString=function(e,t){return(0,r.isFunction)(e)?e(t):e},e.prototype.fromUrl=function(e,t){return(0,r.isFunction)(e)&&(e=e(t)),null==e?null:this._useHttp?this.$http.get(e,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then((function(e){return e.data})):this.$templateRequest(e)},e.prototype.fromProvider=function(e,t,n){var o=r.services.$injector.annotate(e),s=(0,r.isArray)(e)?(0,r.tail)(e):e;return new r.Resolvable("",s,o).get(n)},e.prototype.fromComponentProvider=function(e,t,n){var o=r.services.$injector.annotate(e),s=(0,r.isArray)(e)?(0,r.tail)(e):e;return new r.Resolvable("",s,o).get(n)},e.prototype.makeComponentTemplate=function(e,t,n,s){s=s||{};var a=o.ng.version.minor>=3?"::":"",d=function(e){var t=(0,r.kebobString)(e);return/^(x|data)-/.exec(t)?"x-"+t:t},u=function(e){var t=r.services.$injector.get(e+"Directive");if(!t||!t.length)throw new Error("Unable to find component named '"+e+"'");return t.map(i).reduce(r.unnestR,[])}(n).map((function(n){var o=n.name,i=n.type,u=d(o);if(e.attr(u)&&!s[o])return u+"='"+e.attr(u)+"'";var m=s[o]||o;if("@"===i)return u+"='{{"+a+"$resolve."+m+"}}'";if("&"===i){var l=t.getResolvable(m),_=l&&l.data,c=_&&r.services.$injector.annotate(_)||[];return u+"='$resolve."+m+((0,r.isArray)(_)?"["+(_.length-1)+"]":"")+"("+c.join(",")+")'"}return u+"='"+a+"$resolve."+m+"'"})).join(" "),m=d(n);return"<"+m+" "+u+">"},e}(),i=function(e){return(0,r.isObject)(e.bindToController)?d(e.bindToController):d(e.scope)},d=function(e){return Object.keys(e||{}).map((function(t){return[t,/^([=<@&])[?]?(.*)/.exec(e[t])]})).filter((function(e){return(0,r.isDefined)(e)&&(0,r.isArray)(e[1])})).map((function(e){return{name:e[1][2]||e[0],type:e[1][1]}}))},u=n("./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"),m=function(e){return function(t){var n=t[e],o="onExit"===e?"from":"to";return n?function(e,t){var s=new r.ResolveContext(e.treeChanges(o)).subContext(t.$$state()),a=(0,r.extend)(k(s),{$state$:t,$transition$:e});return r.services.$injector.invoke(n,this,a)}:void 0}},l=function(){function e(e){this._urlListeners=[],this.$locationProvider=e;var t=(0,r.val)(e);(0,r.createProxyFunctions)(t,this,t,["hashPrefix"])}return e.monkeyPatchPathParameterType=function(e){var t=e.urlMatcherFactory.type("path");t.encode=function(e){return null!=e?e.toString().replace(/(~|\/)/g,(function(e){return{"~":"~~","/":"~2F"}[e]})):e},t.decode=function(e){return null!=e?e.toString().replace(/(~~|~2F)/g,(function(e){return{"~~":"~","~2F":"/"}[e]})):e}},e.prototype.dispose=function(){},e.prototype.onChange=function(e){var t=this;return this._urlListeners.push(e),function(){return(0,r.removeFrom)(t._urlListeners)(e)}},e.prototype.html5Mode=function(){var e=this.$locationProvider.html5Mode();return(e=(0,r.isObject)(e)?e.enabled:e)&&this.$sniffer.history},e.prototype.baseHref=function(){return this._baseHref||(this._baseHref=this.$browser.baseHref()||this.$window.location.pathname)},e.prototype.url=function(e,t,n){return void 0===t&&(t=!1),(0,r.isDefined)(e)&&this.$location.url(e),t&&this.$location.replace(),n&&this.$location.state(n),this.$location.url()},e.prototype._runtimeServices=function(e,t,n,o,s){var a=this;this.$location=t,this.$sniffer=n,this.$browser=o,this.$window=s,e.$on("$locationChangeSuccess",(function(e){return a._urlListeners.forEach((function(t){return t(e)}))}));var i=(0,r.val)(t);(0,r.createProxyFunctions)(i,this,i,["replace","path","search","hash"]),(0,r.createProxyFunctions)(i,this,i,["port","protocol","host"])},e}(),_=n("./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js");o.ng.module("ui.router.angular1",[]);var c=o.ng.module("ui.router.init",["ng"]),h=o.ng.module("ui.router.util",["ui.router.init"]),f=o.ng.module("ui.router.router",["ui.router.util"]),p=o.ng.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),M=o.ng.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),y=(o.ng.module("ui.router.compat",["ui.router"]),null);function L(e){(y=this.router=new r.UIRouter).stateProvider=new u.X(y.stateRegistry,y.stateService),y.stateRegistry.decorator("views",s.LB),y.stateRegistry.decorator("onExit",m("onExit")),y.stateRegistry.decorator("onRetain",m("onRetain")),y.stateRegistry.decorator("onEnter",m("onEnter")),y.viewService._pluginapi._viewConfigFactory("ng1",(0,s.OB)()),y.urlService.config._decodeParams=!1;var t=y.locationService=y.locationConfig=new l(e);function n(e,n,o,r,s,a,i){return t._runtimeServices(s,e,r,n,o),delete y.router,delete y.$get,y}return l.monkeyPatchPathParameterType(y),y.router=y,y.$get=n,n.$inject=["$location","$browser","$window","$sniffer","$rootScope","$http","$templateCache"],y}L.$inject=["$locationProvider"];var g=function(e){return["$uiRouterProvider",function(t){var n=t.router[e];return n.$get=function(){return n},n}]};function Y(e,t,n){if(r.services.$injector=e,r.services.$q=t,!Object.prototype.hasOwnProperty.call(e,"strictDi"))try{e.invoke((function(e){}))}catch(t){e.strictDi=!!/strict mode/.exec(t&&t.toString())}n.stateRegistry.get().map((function(e){return e.$$state().resolvables})).reduce(r.unnestR,[]).filter((function(e){return"deferred"===e.deps})).forEach((function(t){return t.deps=e.annotate(t.resolveFn,e.strictDi)}))}function v(e){e.$watch((function(){r.trace.approximateDigests++}))}Y.$inject=["$injector","$q","$uiRouter"],v.$inject=["$rootScope"],c.provider("$uiRouter",L),f.provider("$urlRouter",["$uiRouterProvider",function(e){return e.urlRouterProvider=new _.L(e)}]),h.provider("$urlService",g("urlService")),h.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return y.urlMatcherFactory}]),h.provider("$templateFactory",(function(){return new a})),p.provider("$stateRegistry",g("stateRegistry")),p.provider("$uiRouterGlobals",g("globals")),p.provider("$transitions",g("transitionService")),p.provider("$state",["$uiRouterProvider",function(){return(0,r.extend)(y.stateProvider,{$get:function(){return y.stateService}})}]),p.factory("$stateParams",["$uiRouter",function(e){return e.globals.params}]),M.factory("$view",(function(){return y.viewService})),M.service("$trace",(function(){return r.trace})),M.run(v),h.run(["$urlMatcherFactory",function(e){}]),p.run(["$state",function(e){}]),f.run(["$urlRouter",function(e){}]),c.run(Y);var k=function(e){return e.getTokens().filter(r.isString).map((function(t){var n=e.getResolvable(t);return[t,"NOWAIT"===e.getPolicy(n).async?n.promise:n.data]})).reduce(r.applyPairs,{})}},"./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js":(e,t,n)=>{"use strict";var o=n("./node_modules/@uirouter/angularjs/lib-esm/angular.js");function r(e){var t=function(t,n,o){return e.is(t,n,o)};return t.$stateful=!0,t}function s(e){var t=function(t,n,o){return e.includes(t,n,o)};return t.$stateful=!0,t}r.$inject=["$state"],s.$inject=["$state"],o.ng.module("ui.router.state").filter("isState",r).filter("includedByState",s)},"./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js":(e,t,n)=>{"use strict";n.d(t,{X:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/index.js"),r=function(){function e(t,n){this.stateRegistry=t,this.stateService=n,(0,o.createProxyFunctions)((0,o.val)(e.prototype),this,(0,o.val)(this))}return e.prototype.decorator=function(e,t){return this.stateRegistry.decorator(e,t)||this},e.prototype.state=function(e,t){return(0,o.isObject)(e)?t=e:t.name=e,this.stateRegistry.register(t),this},e.prototype.onInvalid=function(e){return this.stateService.onInvalid(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js":(e,t,n)=>{"use strict";n.d(t,{OB:()=>r,LB:()=>a,qO:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/index.js");function r(){var e=null;return function(t,n){return e=e||o.services.$injector.get("$templateFactory"),[new d(t,n,e)]}}var s=function(e,t){return e.reduce((function(e,n){return e||(0,o.isDefined)(t[n])}),!1)};function a(e){if(!e.parent)return{};var t=["component","bindings","componentProvider"],n=["templateProvider","templateUrl","template","notify","async"].concat(["controller","controllerProvider","controllerAs","resolveAs"]),r=t.concat(n);if((0,o.isDefined)(e.views)&&s(r,e))throw new Error("State '"+e.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): "+r.filter((function(t){return(0,o.isDefined)(e[t])})).join(", "));var a={},i=e.views||{$default:(0,o.pick)(e,r)};return(0,o.forEach)(i,(function(r,i){if(i=i||"$default",(0,o.isString)(r)&&(r={component:r}),r=(0,o.extend)({},r),s(t,r)&&s(n,r))throw new Error("Cannot combine: "+t.join("|")+" with: "+n.join("|")+" in stateview: '"+i+"@"+e.name+"'");r.resolveAs=r.resolveAs||"$resolve",r.$type="ng1",r.$context=e,r.$name=i;var d=o.ViewService.normalizeUIViewTarget(r.$context,r.$name);r.$uiViewName=d.uiViewName,r.$uiViewContextAnchor=d.uiViewContextAnchor,a[i]=r})),a}var i=0,d=function(){function e(e,t,n){var o=this;this.path=e,this.viewDecl=t,this.factory=n,this.$id=i++,this.loaded=!1,this.getTemplate=function(e,t){return o.component?o.factory.makeComponentTemplate(e,t,o.component,o.viewDecl.bindings):o.template}}return e.prototype.load=function(){var e=this,t=o.services.$q,n=new o.ResolveContext(this.path),r=this.path.reduce((function(e,t){return(0,o.extend)(e,t.paramValues)}),{}),s={template:t.when(this.factory.fromConfig(this.viewDecl,r,n)),controller:t.when(this.getController(n))};return t.all(s).then((function(t){return o.trace.traceViewServiceEvent("Loaded",e),e.controller=t.controller,(0,o.extend)(e,t.template),e}))},e.prototype.getController=function(e){var t=this.viewDecl.controllerProvider;if(!(0,o.isInjectable)(t))return this.viewDecl.controller;var n=o.services.$injector.annotate(t),r=(0,o.isArray)(t)?(0,o.tail)(t):t;return new o.Resolvable("",r,n).get(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/index.js"),r=function(){function e(e){this.router=e}return e.injectableHandler=function(e,t){return function(n){return o.services.$injector.invoke(t,null,{$match:n,$stateParams:e.globals.params})}},e.prototype.$get=function(){var e=this.router.urlService;return this.router.urlRouter.update(!0),e.interceptDeferred||e.listen(),this.router.urlRouter},e.prototype.rule=function(e){var t=this;if(!(0,o.isFunction)(e))throw new Error("'rule' must be a function");var n=new o.BaseUrlRule((function(){return e(o.services.$injector,t.router.locationService)}),o.identity);return this.router.urlService.rules.rule(n),this},e.prototype.otherwise=function(e){var t=this,n=this.router.urlService.rules;if((0,o.isString)(e))n.otherwise(e);else{if(!(0,o.isFunction)(e))throw new Error("'rule' must be a string or function");n.otherwise((function(){return e(o.services.$injector,t.router.locationService)}))}return this},e.prototype.when=function(t,n){return((0,o.isArray)(n)||(0,o.isFunction)(n))&&(n=e.injectableHandler(this.router,n)),this.router.urlService.rules.when(t,n),this},e.prototype.deferIntercept=function(e){this.router.urlService.deferIntercept(e)},e}()},"./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/angularjs/lib-esm/angular.js").ng.module("ui.router.state").provider("$uiViewScroll",(function(){var e=!1;this.useAnchorScroll=function(){e=!0},this.$get=["$anchorScroll","$timeout",function(t,n){return e?t:function(e){return n((function(){e[0].scrollIntoView()}),0,!1)}}]}))},"./node_modules/@uirouter/core/lib-esm/common/common.js":(e,t,n)=>{"use strict";n.d(t,{Jz:()=>i,xZ:()=>u,Qs:()=>m,Ed:()=>l,l7:()=>_,fS:()=>c,yR:()=>h,ZT:()=>f,WR:()=>p,ED:()=>M,d3:()=>y,nA:()=>L,LH:()=>g,Wk:()=>Y,ce:()=>v,LQ:()=>k,mX:()=>j,ei:()=>w,CE:()=>b,hX:()=>D,sE:()=>T,js:()=>S,UI:()=>H,VO:()=>x,XC:()=>E,o8:()=>P,M7:()=>O,FN:()=>$,Ez:()=>A,v_:()=>R,UW:()=>F,sp:()=>W,ym:()=>C,bb:()=>I,Gb:()=>z,JG:()=>J,HX:()=>V,jv:()=>N});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),a=function(){for(var e=0,t=0,n=arguments.length;t=0&&e.splice(n,1),e})),g=(0,r.WA)((function(e,t){return e.push(t),t})),Y=function(e){return e.slice().forEach((function(t){"function"==typeof t&&t(),L(e,t)}))};function v(e){for(var t=[],n=1;n{"use strict";n.d(t,{H:()=>o,u:()=>r});var o=function(e,t){return t.reduce((function(t,n){return t[n]=(o=e+"."+n+"()",function(){throw new Error("No implementation for "+o+". The framework specific code did not implement this method.")}),t;var o}),{})},r={$q:void 0,$injector:void 0}},"./node_modules/@uirouter/core/lib-esm/common/glob.js":(e,t,n)=>{"use strict";n.d(t,{r:()=>o});var o=function(){function e(e){this.text=e,this.glob=e.split(".");var t=this.text.split(".").map((function(e){return"**"===e?"(?:|(?:\\.[^.]*)*)":"*"===e?"\\.[^.]*":"\\."+e})).join("");this.regexp=new RegExp("^"+t+"$")}return e.is=function(e){return!!/[!,*]+/.exec(e)},e.fromString=function(t){return e.is(t)?new e(t):null},e.prototype.matches=function(e){return this.regexp.test("."+e)},e}()},"./node_modules/@uirouter/core/lib-esm/common/hof.js":(e,t,n)=>{"use strict";n.d(t,{WA:()=>r,zG:()=>a,vg:()=>i,OH:()=>d,Qc:()=>u,ff:()=>m,xD:()=>l,or:()=>_,$6:()=>c,Yj:()=>h,is:()=>f,P0:()=>p,uj:()=>M});var o=function(){for(var e=0,t=0,n=arguments.length;t=e.length)return e.apply(this,arguments);var n=Array.prototype.slice.call(arguments);return t.bind.apply(t,o([this],n))}}function s(){var e=arguments,t=e.length-1;return function(){for(var n=t,o=e[t].apply(this,arguments);n--;)o=e[n].call(this,o);return o}}function a(){for(var e=[],t=0;t{"use strict";n.d(t,{o8:()=>a,$K:()=>i,Ft:()=>d,le:()=>u,mf:()=>m,hj:()=>l,HD:()=>_,Kn:()=>c,kJ:()=>h,J_:()=>f,Kj:()=>p,Qh:()=>M,tI:()=>y});var o=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),r=Object.prototype.toString,s=function(e){return function(t){return typeof t===e}},a=s("undefined"),i=(0,o.ff)(a),d=function(e){return null===e},u=(0,o.or)(d,a),m=s("function"),l=s("number"),_=s("string"),c=function(e){return null!==e&&"object"==typeof e},h=Array.isArray,f=function(e){return"[object Date]"===r.call(e)},p=function(e){return"[object RegExp]"===r.call(e)};function M(e){if(h(e)&&e.length){var t=e.slice(0,-1),n=e.slice(-1);return!(t.filter((0,o.ff)(_)).length||n.filter((0,o.ff)(m)).length)}return m(e)}var y=(0,o.xD)(c,(0,o.zG)((0,o.vg)("then"),m))},"./node_modules/@uirouter/core/lib-esm/common/queue.js":(e,t,n)=>{"use strict";n.d(t,{c:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=null),this._items=e,this._limit=t,this._evictListeners=[],this.onEvict=(0,o.LH)(this._evictListeners)}return e.prototype.enqueue=function(e){var t=this._items;return t.push(e),this._limit&&t.length>this._limit&&this.evict(),e},e.prototype.evict=function(){var e=this._items.shift();return this._evictListeners.forEach((function(t){return t(e)})),e},e.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},e.prototype.clear=function(){var e=this._items;return this._items=[],e},e.prototype.size=function(){return this._items.length},e.prototype.remove=function(e){var t=this._items.indexOf(e);return t>-1&&this._items.splice(t,1)[0]},e.prototype.peekTail=function(){return this._items[this._items.length-1]},e.prototype.peekHead=function(){if(this.size())return this._items[0]},e}()},"./node_modules/@uirouter/core/lib-esm/common/safeConsole.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r={log:o.ZT,error:o.ZT,table:o.ZT},s="undefined"!=typeof document&&document.documentMode&&9===document.documentMode?window&&window.console?function(e){var t=function(t){return Function.prototype.bind.call(t,e)};return{log:t(e.log),error:t(e.log),table:t(e.log)}}(window.console):r:console.table&&console.error?console:function(e){var t=e.log.bind(e);return{log:t,error:e.error?e.error.bind(e):t,table:e.table?e.table.bind(e):t}}(console)},"./node_modules/@uirouter/core/lib-esm/common/strings.js":(e,t,n)=>{"use strict";n.d(t,{BS:()=>i,NE:()=>d,L$:()=>u,XF:()=>m,iC:()=>l,Pz:()=>h,Lb:()=>p,cW:()=>M,C7:()=>y,Fb:()=>L,HV:()=>g,PX:()=>Y,iV:()=>v});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js");function i(e,t){return t.length<=e?t:t.substr(0,e-3)+"..."}function d(e,t){for(;t.length{"use strict";n.d(t,{g4:()=>c});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/safeConsole.js");function d(e){if(!e)return"ui-view (defunct)";var t=e.creationContext?e.creationContext.name||"(root)":"(none)";return"[ui-view#"+e.id+" "+e.$type+":"+e.fqn+" ("+e.name+"@"+t+")]"}function u(e){return(0,s.hj)(e)?o[e]:o[o[e]]}!function(e){e[e.RESOLVE=0]="RESOLVE",e[e.TRANSITION=1]="TRANSITION",e[e.HOOK=2]="HOOK",e[e.UIVIEW=3]="UIVIEW",e[e.VIEWCONFIG=4]="VIEWCONFIG"}(o||(o={}));var m=(0,r.Qc)("$id"),l=(0,r.Qc)("router.$id"),_=function(e){return"Transition #"+m(e)+"-"+l(e)},c=new(function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,t){var n=this;t.length||(t=Object.keys(o).map((function(e){return parseInt(e,10)})).filter((function(e){return!isNaN(e)})).map((function(e){return o[e]}))),t.map(u).forEach((function(t){return n._enabled[t]=e}))},e.prototype.enable=function(){for(var e=[],t=0;t "+(0,a.Pz)(e))},e.prototype.traceTransitionIgnored=function(e){this.enabled(o.TRANSITION)&&i.L.log(_(e)+": Ignored <> "+(0,a.Pz)(e))},e.prototype.traceHookInvocation=function(e,t,n){if(this.enabled(o.HOOK)){var s=(0,r.Qc)("traceData.hookType")(n)||"internal",d=(0,r.Qc)("traceData.context.state.name")(n)||(0,r.Qc)("traceData.context")(n)||"unknown",u=(0,a.XF)(e.registeredHook.callback);i.L.log(_(t)+": Hook -> "+s+" context: "+d+", "+(0,a.BS)(200,u))}},e.prototype.traceHookResult=function(e,t,n){this.enabled(o.HOOK)&&i.L.log(_(t)+": <- Hook returned: "+(0,a.BS)(200,(0,a.Pz)(e)))},e.prototype.traceResolvePath=function(e,t,n){this.enabled(o.RESOLVE)&&i.L.log(_(n)+": Resolving "+e+" ("+t+")")},e.prototype.traceResolvableResolved=function(e,t){this.enabled(o.RESOLVE)&&i.L.log(_(t)+": <- Resolved "+e+" to: "+(0,a.BS)(200,(0,a.Pz)(e.data)))},e.prototype.traceError=function(e,t){this.enabled(o.TRANSITION)&&i.L.log(_(t)+": <- Rejected "+(0,a.Pz)(t)+", reason: "+e)},e.prototype.traceSuccess=function(e,t){this.enabled(o.TRANSITION)&&i.L.log(_(t)+": <- Success "+(0,a.Pz)(t)+", final state: "+e.name)},e.prototype.traceUIViewEvent=function(e,t,n){void 0===n&&(n=""),this.enabled(o.UIVIEW)&&i.L.log("ui-view: "+(0,a.NE)(30,e)+" "+d(t)+n)},e.prototype.traceUIViewConfigUpdated=function(e,t){this.enabled(o.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='"+t+"'")},e.prototype.traceUIViewFill=function(e,t){this.enabled(o.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: "+(0,a.BS)(200,t))},e.prototype.traceViewSync=function(e){if(this.enabled(o.VIEWCONFIG)){var t="uiview component fqn",n=e.map((function(e){var n,o=e.uiView,r=e.viewConfig,s=o&&o.fqn,a=r&&r.viewDecl.$context.name+": ("+r.viewDecl.$name+")";return(n={})[t]=s,n["view config state (view name)"]=a,n})).sort((function(e,n){return(e[t]||"").localeCompare(n[t]||"")}));i.L.table(n)}},e.prototype.traceViewServiceEvent=function(e,t){this.enabled(o.VIEWCONFIG)&&i.L.log("VIEWCONFIG: "+e+" "+function(e){var t=e.viewDecl,n=t.$context.name||"(root)";return"[View#"+e.$id+" from '"+n+"' state]: target ui-view: '"+t.$uiViewName+"@"+t.$uiViewContextAnchor+"'"}(t))},e.prototype.traceViewServiceUIViewEvent=function(e,t){this.enabled(o.VIEWCONFIG)&&i.L.log("VIEWCONFIG: "+e+" "+d(t))},e}())},"./node_modules/@uirouter/core/lib-esm/globals.js":(e,t,n)=>{"use strict";n.d(t,{k:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/params/stateParams.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/queue.js"),s=function(){function e(){this.params=new o.i,this.lastStartedTransitionId=-1,this.transitionHistory=new r.c([],1),this.successfulTransitions=new r.c([],1)}return e.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},e}()},"./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js":(e,t,n)=>{"use strict";n.d(t,{v:()=>s,A:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),r=function(e){var t=e.router,n=e.entering().filter((function(e){return!!e.$$state().lazyLoad})).map((function(t){return a(e,t)}));return o.u.$q.all(n).then((function(){if("url"!==e.originalTransition().options().source){var n=e.targetState();return t.stateService.target(n.identifier(),n.params(),n.options())}var o=t.urlService,r=o.match(o.parts()),s=r&&r.rule;if(s&&"STATE"===s.type){var a=s.state,i=r.match;return t.stateService.target(a,i,e.options())}t.urlService.sync()}))},s=function(e){return e.onBefore({entering:function(e){return!!e.lazyLoad}},r)};function a(e,t){var n=t.$$state().lazyLoad,r=n._promise;return r||(r=n._promise=o.u.$q.when(n(e,t)).then((function(t){return t&&Array.isArray(t.states)&&t.states.forEach((function(t){return e.router.stateRegistry.register(t)})),t})).then((function(e){return delete t.lazyLoad,delete t.$$state().lazyLoad,delete n._promise,e}),(function(e){return delete n._promise,o.u.$q.reject(e)}))),r}},"./node_modules/@uirouter/core/lib-esm/interface.js":(e,t,n)=>{},"./node_modules/@uirouter/core/lib-esm/params/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/params/param.js":(e,t,n)=>{"use strict";n.d(t,{_:()=>o,d:()=>m});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),d=n("./node_modules/@uirouter/core/lib-esm/params/paramType.js"),u=Object.prototype.hasOwnProperty;!function(e){e[e.PATH=0]="PATH",e[e.SEARCH=1]="SEARCH",e[e.CONFIG=2]="CONFIG"}(o||(o={}));var m=function(){function e(e,t,n,i,m){var l=function(e,t,n){var s=!1===n.reloadOnSearch&&t===o.SEARCH||void 0,i=(0,r.sE)([n.dynamic,s],a.$K),d=(0,a.$K)(i)?{dynamic:i}:{},m=function(e){function t(){return e.value}e=function(e){return 0===["value","type","squash","array","dynamic"].filter(u.bind(e||{})).length}(e)?{value:e}:e,t.__cacheable=!0;var n=(0,a.Qh)(e.value)?e.value:t;return(0,r.l7)(e,{$$fn:n})}(n&&n.params&&n.params[e]);return(0,r.l7)(d,m)}(e,n,m);t=function(e,t,n,r,s){if(e.type&&t&&"string"!==t.name)throw new Error("Param '"+r+"' has two type configurations.");if(e.type&&t&&"string"===t.name&&s.type(e.type))return s.type(e.type);if(t)return t;if(!e.type){var a=n===o.CONFIG?"any":n===o.PATH?"path":n===o.SEARCH?"query":"string";return s.type(a)}return e.type instanceof d._?e.type:s.type(e.type)}(l,t,n,e,i.paramTypes);var _,c,h=(_={array:n===o.SEARCH&&"auto"},c=e.match(/\[\]$/)?{array:!0}:{},(0,r.l7)(_,c,l).array);t=h?t.$asArray(h,n===o.SEARCH):t;var f=void 0!==l.value||n===o.SEARCH,p=(0,a.$K)(l.dynamic)?!!l.dynamic:!!t.dynamic,M=(0,a.$K)(l.raw)?!!l.raw:!!t.raw,y=function(e,t,n){var o=e.squash;if(!t||!1===o)return!1;if(!(0,a.$K)(o)||null==o)return n;if(!0===o||(0,a.HD)(o))return o;throw new Error("Invalid squash policy: '"+o+"'. Valid policies: false, true, or arbitrary string")}(l,f,i.defaultSquashPolicy()),L=function(e,t,n,o){var i=[{from:"",to:n||t?void 0:""},{from:null,to:n||t?void 0:""}],d=(0,a.kJ)(e.replace)?e.replace:[];(0,a.HD)(o)&&d.push({from:o,to:void 0});var u=(0,r.UI)(d,(0,s.vg)("from"));return(0,r.hX)(i,(function(e){return-1===u.indexOf(e.from)})).concat(d)}(l,h,f,y),g=(0,a.$K)(l.inherit)?!!l.inherit:!!t.inherit;(0,r.l7)(this,{id:e,type:t,location:n,isOptional:f,dynamic:p,raw:M,squash:y,replace:L,inherit:g,array:h,config:l})}return e.values=function(e,t){void 0===t&&(t={});for(var n={},o=0,r=e;o{"use strict";n.d(t,{_:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=function(){function e(e){this.pattern=/.*/,this.inherit=!0,(0,o.l7)(this,e)}return e.prototype.is=function(e,t){return!0},e.prototype.encode=function(e,t){return e},e.prototype.decode=function(e,t){return e},e.prototype.equals=function(e,t){return e==t},e.prototype.$subPattern=function(){var e=this.pattern.toString();return e.substr(1,e.length-2)},e.prototype.toString=function(){return"{ParamType:"+this.name+"}"},e.prototype.$normalize=function(e){return this.is(e)?e:this.decode(e)},e.prototype.$asArray=function(e,t){if(!e)return this;if("auto"===e&&!t)throw new Error("'auto' array mode is for query parameters only");return new a(this,e)},e}();function a(e,t){var n=this;function s(e){return(0,r.kJ)(e)?e:(0,r.$K)(e)?[e]:[]}function a(e,n){return function(a){if((0,r.kJ)(a)&&0===a.length)return a;var i=s(a),d=(0,o.UI)(i,e);return!0===n?0===(0,o.hX)(d,(function(e){return!e})).length:function(e){switch(e.length){case 0:return;case 1:return"auto"===t?e[0]:e;default:return e}}(d)}}function i(e){return function(t,n){var o=s(t),r=s(n);if(o.length!==r.length)return!1;for(var a=0;a{"use strict";n.d(t,{p:()=>u});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),d=n("./node_modules/@uirouter/core/lib-esm/params/paramType.js"),u=function(){function e(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=(0,r.ei)(e.prototype,["hash","string","query","path","int","bool","date","json","any"]),this.types=(0,r.ED)((0,r.UI)(this.defaultTypes,(function(e,t){return new d._((0,r.l7)({name:t},e))})),{})}return e.prototype.dispose=function(){this.types={}},e.prototype.type=function(e,t,n){if(!(0,s.$K)(t))return this.types[e];if(this.types.hasOwnProperty(e))throw new Error("A type named '"+e+"' has already been defined.");return this.types[e]=new d._((0,r.l7)({name:e},t)),n&&(this.typeQueue.push({name:e,def:n}),this.enqueue||this._flushTypeQueue()),this},e.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var e=this.typeQueue.shift();if(e.pattern)throw new Error("You cannot override a type's .pattern at runtime.");(0,r.l7)(this.types[e.name],i.u.$injector.invoke(e.def))}},e}();o=function(e){var t=function(e){return null!=e?e.toString():e},n={encode:t,decode:t,is:(0,a.is)(String),pattern:/.*/,equals:function(e,t){return e==t}};return(0,r.l7)({},n,e)},(0,r.l7)(u.prototype,{string:o({}),path:o({pattern:/[^/]*/}),query:o({}),hash:o({inherit:!1}),int:o({decode:function(e){return parseInt(e,10)},is:function(e){return!(0,s.le)(e)&&this.decode(e.toString())===e},pattern:/-?\d+/}),bool:o({encode:function(e){return e?1:0},decode:function(e){return 0!==parseInt(e,10)},is:(0,a.is)(Boolean),pattern:/0|1/}),date:o({encode:function(e){return this.is(e)?[e.getFullYear(),("0"+(e.getMonth()+1)).slice(-2),("0"+e.getDate()).slice(-2)].join("-"):void 0},decode:function(e){if(this.is(e))return e;var t=this.capture.exec(e);return t?new Date(t[1],t[2]-1,t[3]):void 0},is:function(e){return e instanceof Date&&!isNaN(e.valueOf())},equals:function(e,t){return["getFullYear","getMonth","getDate"].reduce((function(n,o){return n&&e[o]()===t[o]()}),!0)},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:o({encode:r.Qs,decode:r.xZ,is:(0,a.is)(Object),equals:r.fS,pattern:/[^/]*/}),any:o({encode:r.yR,decode:r.yR,is:function(){return!0},equals:r.fS})})},"./node_modules/@uirouter/core/lib-esm/params/stateParams.js":(e,t,n)=>{"use strict";n.d(t,{i:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=function(){function e(e){void 0===e&&(e={}),(0,o.l7)(this,e)}return e.prototype.$inherit=function(e,t,n){var r,s=(0,o.mX)(t,n),a={},i=[];for(var d in s)if(s[d]&&s[d].params&&(r=Object.keys(s[d].params)).length)for(var u in r)i.indexOf(r[u])>=0||(i.push(r[u]),a[r[u]]=this[r[u]]);return(0,o.l7)({},a,e)},e}()},"./node_modules/@uirouter/core/lib-esm/path/pathNode.js":(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/params/param.js"),a=function(){function e(t){if(t instanceof e){var n=t;this.state=n.state,this.paramSchema=n.paramSchema.slice(),this.paramValues=(0,o.l7)({},n.paramValues),this.resolvables=n.resolvables.slice(),this.views=n.views&&n.views.slice()}else{var r=t;this.state=r,this.paramSchema=r.parameters({inherit:!1}),this.paramValues={},this.resolvables=r.resolvables.map((function(e){return e.clone()}))}}return e.prototype.clone=function(){return new e(this)},e.prototype.applyRawParams=function(e){return this.paramValues=this.paramSchema.reduce((function(t,n){return(0,o.bb)(t,[(r=n).id,r.value(e[r.id])]);var r}),{}),this},e.prototype.parameter=function(e){return(0,o.sE)(this.paramSchema,(0,r.OH)("id",e))},e.prototype.equals=function(e,t){var n=this.diff(e,t);return n&&0===n.length},e.prototype.diff=function(e,t){if(this.state!==e.state)return!1;var n=t?t(this):this.paramSchema;return s.d.changed(n,this.paramValues,e.paramValues)},e.clone=function(e){return e.clone()},e}()},"./node_modules/@uirouter/core/lib-esm/path/pathUtils.js":(e,t,n)=>{"use strict";n.d(t,{C:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),a=n("./node_modules/@uirouter/core/lib-esm/path/pathNode.js"),i=function(){function e(){}return e.makeTargetState=function(e,t){var n=(0,o.Gb)(t).state;return new s.F(e,n,t.map((0,r.vg)("paramValues")).reduce(o.LQ,{}),{})},e.buildPath=function(e){var t=e.params();return e.$state().path.map((function(e){return new a.V(e).applyRawParams(t)}))},e.buildToPath=function(t,n){var o=e.buildPath(n);return n.options().inherit?e.inheritParams(t,o,Object.keys(n.params())):o},e.applyViewConfigs=function(t,n,r){n.filter((function(e){return(0,o.d3)(r,e.state)})).forEach((function(r){var s=(0,o.VO)(r.state.views||{}),a=e.subPath(n,(function(e){return e===r})),i=s.map((function(e){return t.createViewConfig(a,e)}));r.views=i.reduce(o.M7,[])}))},e.inheritParams=function(e,t,n){void 0===n&&(n=[]);var s=e.map((function(e){return e.paramSchema})).reduce(o.M7,[]).filter((function(e){return!e.inherit})).map((0,r.vg)("id"));return t.map((function(t){var i=(0,o.l7)({},t&&t.paramValues),d=(0,o.ei)(i,n);i=(0,o.CE)(i,n);var u,m,l,_=(0,o.CE)((u=e,m=t.state,l=(0,o.sE)(u,(0,r.OH)("state",m)),(0,o.l7)({},l&&l.paramValues)||{}),s),c=(0,o.l7)(i,_,d);return new a.V(t.state).applyRawParams(c)}))},e.treeChanges=function(t,n,o){for(var r,s,a,i,d,u,m=Math.min(t.length,n.length),l=0;l{"use strict";n.d(t,{u:()=>o});var o={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT"}}},"./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js":(e,t,n)=>{"use strict";n.d(t,{X:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),d=function(){function e(t,n,s,a,d){if(this.resolved=!1,this.promise=void 0,t instanceof e)(0,o.l7)(this,t);else if((0,i.mf)(n)){if((0,i.le)(t))throw new Error("new Resolvable(): token argument is required");if(!(0,i.mf)(n))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=t,this.policy=a,this.resolveFn=n,this.deps=s||[],this.data=d,this.resolved=void 0!==d,this.promise=this.resolved?r.u.$q.when(this.data):void 0}else if((0,i.Kn)(t)&&t.token&&(t.hasOwnProperty("resolveFn")||t.hasOwnProperty("data"))){var u=t;return new e(u.token,u.resolveFn,u.deps,u.policy,u.data)}}return e.prototype.getPolicy=function(e){var t=this.policy||{},n=e&&e.resolvePolicy||{};return{when:t.when||n.when||"LAZY",async:t.async||n.async||"WAIT"}},e.prototype.resolve=function(e,t){var n=this,a=r.u.$q,d=e.findNode(this),u=d&&d.state,m=this.getPolicy(u).async,l=(0,i.mf)(m)?m:o.yR;return this.promise=a.when().then((function(){return a.all(e.getDependencies(n).map((function(n){return n.get(e,t)})))})).then((function(e){return n.resolveFn.apply(null,e)})).then(l).then((function(e){return n.data=e,n.resolved=!0,n.resolveFn=null,s.g4.traceResolvableResolved(n,t),n.data}))},e.prototype.get=function(e,t){return this.promise||this.resolve(e,t)},e.prototype.toString=function(){return"Resolvable(token: "+(0,a.Pz)(this.token)+", requires: ["+this.deps.map(a.Pz)+"])"},e.prototype.clone=function(){return new e(this)},e.fromData=function(t,n){return new e(t,(function(){return n}),null,null,n)},e}()},"./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js":(e,t,n)=>{"use strict";n.d(t,{l:()=>f});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/interface.js"),d=n("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),u=n("./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"),m=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),l=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),_=i.u.when,c=[_.EAGER,_.LAZY],h=[_.EAGER],f=function(){function e(e){this._path=e}return e.prototype.getTokens=function(){return this._path.reduce((function(e,t){return e.concat(t.resolvables.map((function(e){return e.token})))}),[]).reduce(o.v_,[])},e.prototype.getResolvable=function(e){var t=this._path.map((function(e){return e.resolvables})).reduce(o.M7,[]).filter((function(t){return t.token===e}));return(0,o.Gb)(t)},e.prototype.getPolicy=function(e){var t=this.findNode(e);return e.getPolicy(t.state)},e.prototype.subContext=function(t){return new e(u.C.subPath(this._path,(function(e){return e.state===t})))},e.prototype.addResolvables=function(e,t){var n=(0,o.sE)(this._path,(0,r.OH)("state",t)),s=e.map((function(e){return e.token}));n.resolvables=n.resolvables.filter((function(e){return-1===s.indexOf(e.token)})).concat(e)},e.prototype.resolvePath=function(e,t){var n=this;void 0===e&&(e="LAZY");var d=((0,o.d3)(c,e)?e:"LAZY")===i.u.when.EAGER?h:c;s.g4.traceResolvePath(this._path,e,t);var u=function(e,t){return function(r){return(0,o.d3)(e,n.getPolicy(r)[t])}},m=this._path.reduce((function(e,o){var s=o.resolvables.filter(u(d,"when")),a=s.filter(u(["NOWAIT"],"async")),i=s.filter((0,r.ff)(u(["NOWAIT"],"async"))),m=n.subContext(o.state),l=function(e){return e.get(m,t).then((function(t){return{token:e.token,value:t}}))};return a.forEach(l),e.concat(i.map(l))}),[]);return a.u.$q.all(m)},e.prototype.injector=function(){return this._injector||(this._injector=new p(this))},e.prototype.findNode=function(e){return(0,o.sE)(this._path,(function(t){return(0,o.d3)(t.resolvables,e)}))},e.prototype.getDependencies=function(e){var t=this,n=this.findNode(e),r=(u.C.subPath(this._path,(function(e){return e===n}))||this._path).reduce((function(e,t){return e.concat(t.resolvables)}),[]).filter((function(t){return t!==e}));return e.deps.map((function(e){var n=r.filter((function(t){return t.token===e}));if(n.length)return(0,o.Gb)(n);var s=t.injector().getNative(e);if((0,l.wV)(s))throw new Error("Could not find Dependency Injection token: "+(0,m.Pz)(e));return new d.X(e,(function(){return s}),[],s)}))},e}(),p=function(){function e(e){this.context=e,this.native=this.get("Native Injector")||a.u.$injector}return e.prototype.get=function(e){var t=this.context.getResolvable(e);if(t){if("NOWAIT"===this.context.getPolicy(t).async)return t.get(this.context);if(!t.resolved)throw new Error("Resolvable async .get() not complete:"+(0,m.Pz)(t.token));return t.data}return this.getNative(e)},e.prototype.getAsync=function(e){var t=this.context.getResolvable(e);return t?t.get(this.context):a.u.$q.when(this.native.get(e))},e.prototype.getNative=function(e){return this.native&&this.native.get(e)},e}()},"./node_modules/@uirouter/core/lib-esm/router.js":(e,t,n)=>{"use strict";n.d(t,{a:()=>y});var o=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"),a=n("./node_modules/@uirouter/core/lib-esm/view/view.js"),i=n("./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"),d=n("./node_modules/@uirouter/core/lib-esm/state/stateService.js"),u=n("./node_modules/@uirouter/core/lib-esm/globals.js"),m=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),l=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),_=n("./node_modules/@uirouter/core/lib-esm/url/urlService.js"),c=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),h=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),f=0,p=(0,h.HV)("LocationServices",["url","path","search","hash","onChange"]),M=(0,h.HV)("LocationConfig",["port","protocol","host","baseHref","html5Mode","hashPrefix"]),y=function(){function e(e,t){void 0===e&&(e=p),void 0===t&&(t=M),this.locationService=e,this.locationConfig=t,this.$id=f++,this._disposed=!1,this._disposables=[],this.trace=c.g4,this.viewService=new a.s(this),this.globals=new u.k,this.transitionService=new s.Z(this),this.urlMatcherFactory=new o.y(this),this.urlRouter=new r.g(this),this.urlService=new _.i(this),this.stateRegistry=new i.q(this),this.stateService=new d.b(this),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(e),this.disposable(t)}return e.prototype.disposable=function(e){this._disposables.push(e)},e.prototype.dispose=function(e){var t=this;e&&(0,l.mf)(e.dispose)?e.dispose(this):(this._disposed=!0,this._disposables.slice().forEach((function(e){try{"function"==typeof e.dispose&&e.dispose(t),(0,m.nA)(t._disposables,e)}catch(e){}})))},e.prototype.plugin=function(e,t){void 0===t&&(t={});var n=new e(this,t);if(!n.name)throw new Error("Required property `name` missing on plugin: "+n);return this._disposables.push(n),this._plugins[n.name]=n},e.prototype.getPlugin=function(e){return e?this._plugins[e]:(0,m.VO)(this._plugins)},e}()},"./node_modules/@uirouter/core/lib-esm/state/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js":(e,t,n)=>{"use strict";n.d(t,{t:()=>M});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js");function u(e){return e.name}function m(e){return e.self.$$state=function(){return e},e.self}function l(e){return e.parent&&e.parent.data&&(e.data=e.self.data=(0,o.ED)(e.parent.data,e.data)),e.data}var _=function(e,t){return function(n){var s=n.self;if(s&&s.url&&s.name&&s.name.match(/\.\*\*$/)){var a={};(0,o.JG)(s,a),a.url+="{remainder:any}",s=a}var i=n.parent,d=function(e){if(!(0,r.HD)(e))return!1;var t="^"===e.charAt(0);return{val:t?e.substring(1):e,root:t}}(s.url),u=d?e.compile(d.val,{state:s}):s.url;if(!u)return null;if(!e.isMatcher(u))throw new Error("Invalid url '"+u+"' in state '"+n+"'");return d&&d.root?u:(i&&i.navigable||t()).url.append(u)}},c=function(e){return function(t){return!e(t)&&t.url?t:t.parent?t.parent.navigable:null}};function h(e){return e.parent?e.parent.path.concat(e):[e]}function f(e){var t=e.parent?(0,o.l7)({},e.parent.includes):{};return t[e.name]=!0,t}function p(e){var t,n,u=function(e){return e.provide||e.token},m=(0,a.uj)([[(0,a.vg)("resolveFn"),function(e){return new i.X(u(e),e.resolveFn,e.deps,e.policy)}],[(0,a.vg)("useFactory"),function(e){return new i.X(u(e),e.useFactory,e.deps||e.dependencies,e.policy)}],[(0,a.vg)("useClass"),function(e){return new i.X(u(e),(function(){return new e.useClass}),[],e.policy)}],[(0,a.vg)("useValue"),function(e){return new i.X(u(e),(function(){return e.useValue}),[],e.policy,e.useValue)}],[(0,a.vg)("useExisting"),function(e){return new i.X(u(e),o.yR,[e.useExisting],e.policy)}]]),l=(0,a.uj)([[(0,a.zG)((0,a.vg)("val"),r.HD),function(e){return new i.X(e.token,o.yR,[e.val],e.policy)}],[(0,a.zG)((0,a.vg)("val"),r.kJ),function(e){return new i.X(e.token,(0,o.Gb)(e.val),e.val.slice(0,-1),e.policy)}],[(0,a.zG)((0,a.vg)("val"),r.mf),function(e){return new i.X(e.token,e.val,(t=e.val,n=d.u.$injector,t.$inject||n&&n.annotate(t,n.strictDi)||"deferred"),e.policy);var t,n}]]),_=(0,a.uj)([[(0,a.is)(i.X),function(e){return e}],[function(e){return!(!e.token||!e.resolveFn)},m],[function(e){return!(!e.provide&&!e.token||!(e.useValue||e.useFactory||e.useExisting||e.useClass))},m],[function(e){return!!(e&&e.val&&((0,r.HD)(e.val)||(0,r.kJ)(e.val)||(0,r.mf)(e.val)))},l],[(0,a.P0)(!0),function(e){throw new Error("Invalid resolve value: "+(0,s.Pz)(e))}]]),c=e.resolve;return((0,r.kJ)(c)?c:(t=c,n=e.resolvePolicy||{},Object.keys(t||{}).map((function(e){return{token:e,val:t[e],deps:void 0,policy:n[e]}})))).map(_)}var M=function(){function e(e,t){this.matcher=e;var n,r=this,s=function(){return e.find("")},i=function(e){return""===e.name};this.builders={name:[u],self:[m],parent:[function(t){return i(t)?null:e.find(r.parentName(t))||s()}],data:[l],url:[_(t,s)],navigable:[c(i)],params:[(n=t.paramFactory,function(e){var t=e.url&&e.url.parameters({inherit:!1})||[],r=(0,o.VO)((0,o.js)((0,o.CE)(e.params||{},t.map((0,a.vg)("id"))),(function(t,o){return n.fromConfig(o,null,e.self)})));return t.concat(r).map((function(e){return[e.id,e]})).reduce(o.bb,{})})],views:[],path:[h],includes:[f],resolvables:[p]}}return e.prototype.builder=function(e,t){var n=this.builders,o=n[e]||[];return(0,r.HD)(e)&&!(0,r.$K)(t)?o.length>1?o:o[0]:(0,r.HD)(e)&&(0,r.mf)(t)?(n[e]=o,n[e].push(t),function(){return n[e].splice(n[e].indexOf(t,1))&&null}):void 0},e.prototype.build=function(e){var t=this.matcher,n=this.builders,r=this.parentName(e);if(r&&!t.find(r,void 0,!1))return null;for(var s in n)if(n.hasOwnProperty(s)){var a=n[s].reduce((function(e,t){return function(n){return t(n,e)}}),o.ZT);e[s]=a(e)}return e},e.prototype.parentName=function(e){var t=e.name||"",n=t.split(".");if("**"===n.pop()&&n.pop(),n.length){if(e.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name ("+t+")");return n.join(".")}return e.parent?(0,r.HD)(e.parent)?e.parent:e.parent.name:""},e.prototype.name=function(e){var t=e.name;if(-1!==t.indexOf(".")||!e.parent)return t;var n=(0,r.HD)(e.parent)?e.parent:e.parent.name;return n?n+"."+t:t},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js":(e,t,n)=>{"use strict";n.d(t,{Q:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"),a=function(){function e(e){this._states=e}return e.prototype.isRelative=function(e){return 0===(e=e||"").indexOf(".")||0===e.indexOf("^")},e.prototype.find=function(e,t,n){if(void 0===n&&(n=!0),e||""===e){var a=(0,o.HD)(e),i=a?e:e.name;this.isRelative(i)&&(i=this.resolvePath(i,t));var d=this._states[i];if(d&&(a||!(a||d!==e&&d.self!==e)))return d;if(a&&n){var u=(0,r.VO)(this._states).filter((function(e){return e.__stateObjectCache.nameGlob&&e.__stateObjectCache.nameGlob.matches(i)}));return u.length>1&&s.L.error("stateMatcher.find: Found multiple matches for "+i+" using glob: ",u.map((function(e){return e.name}))),u[0]}}},e.prototype.resolvePath=function(e,t){if(!t)throw new Error("No reference point given for path '"+e+"'");for(var n=this.find(t),o=e.split("."),r=o.length,s=0,a=n;s{"use strict";n.d(t,{l:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/glob.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=function(){function e(t){return e.create(t||{})}return e.create=function(t){t=e.isStateClass(t)?new t:t;var n=(0,o.ED)((0,o.ED)(t,e.prototype));return t.$$state=function(){return n},n.self=t,n.__stateObjectCache={nameGlob:s.r.fromString(n.name)},n},e.prototype.is=function(e){return this===e||this.self===e||this.fqn()===e},e.prototype.fqn=function(){if(!(this.parent&&this.parent instanceof this.constructor))return this.name;var e=this.parent.fqn();return e?e+"."+this.name:this.name},e.prototype.root=function(){return this.parent&&this.parent.root()||this},e.prototype.parameters=function(e){return((e=(0,o.ce)(e,{inherit:!0,matchingKeys:null})).inherit&&this.parent&&this.parent.parameters()||[]).concat((0,o.VO)(this.params)).filter((function(t){return!e.matchingKeys||e.matchingKeys.hasOwnProperty(t.id)}))},e.prototype.parameter=function(e,t){return void 0===t&&(t={}),this.url&&this.url.parameter(e,t)||(0,o.sE)((0,o.VO)(this.params),(0,r.OH)("id",e))||t.inherit&&this.parent&&this.parent.parameter(e)},e.prototype.toString=function(){return this.fqn()},e.isStateClass=function(e){return(0,a.mf)(e)&&!0===e.__uiRouterState},e.isStateDeclaration=function(e){return(0,a.mf)(e.$$state)},e.isState=function(e){return(0,a.Kn)(e.__stateObjectCache)},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js":(e,t,n)=>{"use strict";n.d(t,{L:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/state/stateObject.js"),s=function(){function e(e,t,n,o){this.router=e,this.states=t,this.builder=n,this.listeners=o,this.queue=[]}return e.prototype.dispose=function(){this.queue=[]},e.prototype.register=function(e){var t=this.queue,n=r.l.create(e),s=n.name;if(!(0,o.HD)(s))throw new Error("State must have a valid name");if(this.states.hasOwnProperty(s)||(0,o.d3)(t.map((0,o.vg)("name")),s))throw new Error("State '"+s+"' is already defined");return t.push(n),this.flush(),n},e.prototype.flush=function(){for(var e=this,t=this,n=t.queue,o=t.states,r=t.builder,s=[],a=[],i={},d=function(t){return e.states.hasOwnProperty(t)&&e.states[t]},u=function(){s.length&&e.listeners.forEach((function(e){return e("registered",s.map((function(e){return e.self})))}))};n.length>0;){var m=n.shift(),l=m.name,_=r.build(m),c=a.indexOf(m);if(_){var h=d(l);if(h&&h.name===l)throw new Error("State '"+l+"' is already defined");var f=d(l+".**");f&&this.router.stateRegistry.deregister(f),o[l]=m,this.attachRoute(m),c>=0&&a.splice(c,1),s.push(m)}else{var p=i[l];if(i[l]=n.length,c>=0&&p===n.length)return n.push(m),u(),o;c<0&&a.push(m),n.push(m)}}return u(),o},e.prototype.attachRoute=function(e){if(!e.abstract&&e.url){var t=this.router.urlService.rules;t.rule(t.urlRuleFactory.create(e))}},e}()},"./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js":(e,t,n)=>{"use strict";n.d(t,{q:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"),r=n("./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"),s=n("./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),d=function(){function e(e){this.router=e,this.states={},this.listeners=[],this.matcher=new o.Q(this.states),this.builder=new r.t(this.matcher,e.urlMatcherFactory),this.stateQueue=new s.L(e,this.states,this.builder,this.listeners),this._registerRoot()}return e.prototype._registerRoot=function(){(this._root=this.stateQueue.register({name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0})).navigable=null},e.prototype.dispose=function(){var e=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach((function(t){return e.get(t)&&e.deregister(t)}))},e.prototype.onStatesChanged=function(e){return this.listeners.push(e),function(){(0,a.nA)(this.listeners)(e)}.bind(this)},e.prototype.root=function(){return this._root},e.prototype.register=function(e){return this.stateQueue.register(e)},e.prototype._deregisterTree=function(e){var t=this,n=this.get().map((function(e){return e.$$state()})),o=function(e){var t=n.filter((function(t){return-1!==e.indexOf(t.parent)}));return 0===t.length?t:t.concat(o(t))},r=o([e]),s=[e].concat(r).reverse();return s.forEach((function(e){var n=t.router.urlService.rules;n.rules().filter((0,i.OH)("state",e)).forEach((function(e){return n.removeRule(e)})),delete t.states[e.name]})),s},e.prototype.deregister=function(e){var t=this.get(e);if(!t)throw new Error("Can't deregister state; not found: "+e);var n=this._deregisterTree(t.$$state());return this.listeners.forEach((function(e){return e("deregistered",n.map((function(e){return e.self})))})),n},e.prototype.get=function(e,t){var n=this;if(0===arguments.length)return Object.keys(this.states).map((function(e){return n.states[e].self}));var o=this.matcher.find(e,t);return o&&o.self||null},e.prototype.decorator=function(e,t){return this.builder.builder(e,t)},e}()},"./node_modules/@uirouter/core/lib-esm/state/targetState.js":(e,t,n)=>{"use strict";n.d(t,{F:()=>a});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),a=function(){function e(e,t,n,o){this._stateRegistry=e,this._identifier=t,this._identifier=t,this._params=(0,s.l7)({},n||{}),this._options=(0,s.l7)({},o||{}),this._definition=e.matcher.find(t,this._options.relative)}return e.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},e.prototype.identifier=function(){return this._identifier},e.prototype.params=function(){return this._params},e.prototype.$state=function(){return this._definition},e.prototype.state=function(){return this._definition&&this._definition.self},e.prototype.options=function(){return this._options},e.prototype.exists=function(){return!(!this._definition||!this._definition.self)},e.prototype.valid=function(){return!this.error()},e.prototype.error=function(){var e=this.options().relative;if(!this._definition&&e){var t=e.name?e.name:e;return"Could not resolve '"+this.name()+"' from state '"+t+"'"}return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'"},e.prototype.toString=function(){return"'"+this.name()+"'"+(0,r.Pz)(this.params())},e.prototype.withState=function(t){return new e(this._stateRegistry,t,this._params,this._options)},e.prototype.withParams=function(t,n){void 0===n&&(n=!1);var o=n?t:(0,s.l7)({},this._params,t);return new e(this._stateRegistry,this._identifier,o,this._options)},e.prototype.withOptions=function(t,n){void 0===n&&(n=!1);var o=n?t:(0,s.l7)({},this._options,t);return new e(this._stateRegistry,this._identifier,this._params,o)},e.isDef=function(e){return e&&e.state&&((0,o.HD)(e.state)||(0,o.Kn)(e.state)&&(0,o.HD)(e.state.name))},e}()},"./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js":(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),a=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),i=function(){function e(e){this.transition=e}return e.prototype.buildHooksForPhase=function(e){var t=this;return this.transition.router.transitionService._pluginapi._getEvents(e).map((function(e){return t.buildHooks(e)})).reduce(o.M7,[]).filter(o.yR)},e.prototype.buildHooks=function(e){var t=this.transition,n=t.treeChanges(),r=this.getMatchingHooks(e,n,t);if(!r)return[];var i,d={transition:t,current:t.options().current};return r.map((function(r){return r.matches(n,t)[e.criteriaMatchPath.name].map((function(n){var i=(0,o.l7)({bind:r.bind,traceData:{hookType:e.name,context:n}},d),u=e.criteriaMatchPath.scope===s.c.STATE?n.state.self:null,m=new a.I(t,u,r,i);return{hook:r,node:n,transitionHook:m}}))})).reduce(o.M7,[]).sort((i=e.reverseSort,void 0===i&&(i=!1),function(e,t){var n=i?-1:1,o=(e.node.state.path.length-t.node.state.path.length)*n;return 0!==o?o:t.hook.priority-e.hook.priority})).map((function(e){return e.transitionHook}))},e.prototype.getMatchingHooks=function(e,t,n){var a=e.hookPhase===s.k.CREATE,i=this.transition.router.transitionService;return(a?[i]:[this.transition,i]).map((function(t){return t.getHooks(e.name)})).filter((0,o.sp)(r.kJ,"broken event named: "+e.name)).reduce(o.M7,[]).filter((function(e){return e.matches(t,n)}))},e}()},"./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js":(e,t,n)=>{"use strict";n.d(t,{cN:()=>s,BU:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js");function s(e,t,n){var r=(0,o.HD)(t)?[t]:t;return!!((0,o.mf)(r)?r:function(e){for(var t=r,n=0;n{"use strict";var o,r;n.d(t,{k:()=>o,c:()=>r}),function(e){e[e.CREATE=0]="CREATE",e[e.BEFORE=1]="BEFORE",e[e.RUN=2]="RUN",e[e.SUCCESS=3]="SUCCESS",e[e.ERROR=4]="ERROR"}(o||(o={})),function(e){e[e.TRANSITION=0]="TRANSITION",e[e.STATE=1]="STATE"}(r||(r={}))},"./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js":(e,t,n)=>{"use strict";n.d(t,{K:()=>o,i:()=>d});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js");!function(e){e[e.SUPERSEDED=2]="SUPERSEDED",e[e.ABORTED=3]="ABORTED",e[e.INVALID=4]="INVALID",e[e.IGNORED=5]="IGNORED",e[e.ERROR=6]="ERROR"}(o||(o={}));var i=0,d=function(){function e(e,t,n){this.$id=i++,this.type=e,this.message=t,this.detail=n}return e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&(0,a.is)(e)(t._transitionRejection)},e.superseded=function(t,n){var r=new e(o.SUPERSEDED,"The transition has been superseded by a different transition",t);return n&&n.redirected&&(r.redirected=!0),r},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(t){return new e(o.INVALID,"This transition is invalid",t)},e.ignored=function(t){return new e(o.IGNORED,"The transition was ignored",t)},e.aborted=function(t){return new e(o.ABORTED,"The transition has been aborted",t)},e.errored=function(t){return new e(o.ERROR,"The transition errored",t)},e.normalize=function(t){return(0,a.is)(e)(t)?t:e.errored(t)},e.prototype.toString=function(){var e,t=(e=this.detail)&&e.toString!==Object.prototype.toString?e.toString():(0,s.Pz)(e),n=this;return"Transition Rejection($id: "+n.$id+" type: "+n.type+", message: "+n.message+", detail: "+t+")"},e.prototype.toPromise=function(){return(0,r.l7)((0,r.jv)(this),{_transitionRejection:this})},e}()},"./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js":(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),r=function(e,t,n,r,s,a,i,d){void 0===s&&(s=!1),void 0===a&&(a=o.I.HANDLE_RESULT),void 0===i&&(i=o.I.REJECT_ERROR),void 0===d&&(d=!1),this.name=e,this.hookPhase=t,this.hookOrder=n,this.criteriaMatchPath=r,this.reverseSort=s,this.getResultHandler=a,this.getErrorHandler=i,this.synchronous=d}},"./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>c});var o=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/strings.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),i=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),u=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),m=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"),l=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),_={current:r.ZT,transition:null,traceData:{},bind:null},c=function(){function e(e,t,n,s){var a=this;this.transition=e,this.stateContext=t,this.registeredHook=n,this.options=s,this.isSuperseded=function(){return a.type.hookPhase===o.k.RUN&&!a.options.transition.isActive()},this.options=(0,r.ce)(s,_),this.type=n.eventType}return e.chain=function(e,t){return e.reduce((function(e,t){return e.then((function(){return t.invokeHook()}))}),t||u.u.$q.when())},e.invokeHooks=function(t,n){for(var o=0;o=t.invokeLimit&&t.deregister()}}},e.prototype.handleHookResult=function(e){var t=this;return this.getNotCurrentRejection()||((0,a.tI)(e)?e.then((function(e){return t.handleHookResult(e)})):(d.g4.traceHookResult(e,this.transition,this.options),!1===e?m.i.aborted("Hook aborted transition").toPromise():(0,i.is)(l.F)(e)?m.i.redirected(e).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var e=this.transition.router;return e._disposed?m.i.aborted("UIRouter instance #"+e.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?m.i.aborted().toPromise():this.isSuperseded()?m.i.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var e=this.options,t=this.registeredHook,n=(0,i.Qc)("traceData.hookType")(e)||"internal",o=(0,i.Qc)("traceData.context.state.name")(e)||(0,i.Qc)("traceData.context")(e)||"unknown",r=(0,s.iC)(t.callback);return n+" context: "+o+", "+(0,s.BS)(200,r)},e.HANDLE_RESULT=function(e){return function(t){return e.handleHookResult(t)}},e.LOG_REJECTED_RESULT=function(e){return function(t){(0,a.tI)(t)&&t.catch((function(t){return e.logError(m.i.normalize(t))}))}},e.LOG_ERROR=function(e){return function(t){return e.logError(t)}},e.REJECT_ERROR=function(e){return function(e){return(0,r.jv)(e)}},e.THROW_ERROR=function(e){return function(e){throw e}},e}()},"./node_modules/@uirouter/core/lib-esm/transition/transitionService.js":(e,t,n)=>{"use strict";n.d(t,{Z:()=>C,q:()=>W});var o=n("./node_modules/@uirouter/core/lib-esm/transition/interface.js"),r=n("./node_modules/@uirouter/core/lib-esm/transition/transition.js"),s=n("./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"),a=n("./node_modules/@uirouter/core/lib-esm/router.js"),i=n("./node_modules/@uirouter/core/lib-esm/resolve/index.js"),d=n("./node_modules/@uirouter/core/lib-esm/common/index.js");function u(e){e.addResolvable(i.XU.fromData(a.a,e.router),""),e.addResolvable(i.XU.fromData(r.u,e),""),e.addResolvable(i.XU.fromData("$transition$",e),""),e.addResolvable(i.XU.fromData("$stateParams",e.params()),""),e.entering().forEach((function(t){e.addResolvable(i.XU.fromData("$state$",t),t)}))}var m=["$transition$",r.u],l=(0,d.d3)(m),_=function(e){var t=(0,d.VO)(e.treeChanges()).reduce(d.M7,[]).reduce(d.v_,[]),n=function(e){return l(e.token)?i.XU.fromData(e.token,null):e};t.forEach((function(e){e.resolvables=e.resolvables.map(n)}))},c=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),h=n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),f=n("./node_modules/@uirouter/core/lib-esm/state/targetState.js"),p=function(e){var t=e.to().redirectTo;if(t){var n=e.router.stateService;return(0,c.mf)(t)?h.u.$q.when(t(e)).then(o):o(t)}function o(t){if(t)return t instanceof f.F?t:(0,c.HD)(t)?n.target(t,e.params(),e.options()):t.state||t.params?n.target(t.state||e.to(),t.params||e.params(),e.options()):void 0}};function M(e){return function(t,n){return(0,n.$$state()[e])(t,n)}}var y=M("onExit"),L=M("onRetain"),g=M("onEnter"),Y=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),v=n("./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"),k=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),j=1e3,w=function(e){return new v.l(e.treeChanges().to).resolvePath("EAGER",e).then(Y.ZT)},b=function(e,t){return new v.l(e.treeChanges().to).subContext(t.$$state()).resolvePath("LAZY",e).then(Y.ZT)},D=function(e){return new v.l(e.treeChanges().to).resolvePath("LAZY",e).then(Y.ZT)},T=function(e){var t=h.u.$q,n=e.views("entering");if(n.length)return t.all(n.map((function(e){return t.when(e.load())}))).then(Y.ZT)},S=function(e){var t=e.views("entering"),n=e.views("exiting");if(t.length||n.length){var o=e.router.viewService;n.forEach((function(e){return o.deactivateViewConfig(e)})),t.forEach((function(e){return o.activateViewConfig(e)})),o.sync()}},H=function(e){var t=e.router.globals,n=function(){t.transition===e&&(t.transition=null)};e.onSuccess({},(function(){t.successfulTransitions.enqueue(e),t.$current=e.$to(),t.current=t.$current.self,(0,Y.JG)(e.params(),t.params)}),{priority:1e4}),e.promise.then(n,n)},x=function(e){var t=e.options(),n=e.router.stateService,o=e.router.urlRouter;if("url"!==t.source&&t.location&&n.$current.navigable){var r={replace:"replace"===t.location};o.push(n.$current.navigable.url,n.params,r)}o.update(!0)},E=n("./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"),P=n("./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"),O=n("./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"),$=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),A=n("./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js");function R(e){var t=e._ignoredReason();if(t){$.g4.traceTransitionIgnored(e);var n=e.router.globals.transition;return"SameAsCurrent"===t&&n&&n.abort(),A.i.ignored().toPromise()}}function F(e){if(!e.valid())throw new Error(e.error().toString())}var W={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,supercede:!0,custom:{},current:function(){return null},source:"unknown"},C=function(){function e(e){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=e,this.$view=e.viewService,this._deregisterHookFns={},this._pluginapi=(0,Y.WR)((0,k.P0)(this),{},(0,k.P0)(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks(),e.globals.successfulTransitions.onEvict(_)}return e.prototype.onCreate=function(e,t,n){},e.prototype.onBefore=function(e,t,n){},e.prototype.onStart=function(e,t,n){},e.prototype.onExit=function(e,t,n){},e.prototype.onRetain=function(e,t,n){},e.prototype.onEnter=function(e,t,n){},e.prototype.onFinish=function(e,t,n){},e.prototype.onSuccess=function(e,t,n){},e.prototype.onError=function(e,t,n){},e.prototype.dispose=function(e){(0,Y.VO)(this._registeredHooks).forEach((function(e){return e.forEach((function(t){t._deregistered=!0,(0,Y.nA)(e,t)}))}))},e.prototype.create=function(e,t){return new r.u(e,t,this._router)},e.prototype._defineCoreEvents=function(){var e=o.k,t=O.I,n=this._criteriaPaths,r=!1,s=!0;this._defineEvent("onCreate",e.CREATE,0,n.to,r,t.LOG_REJECTED_RESULT,t.THROW_ERROR,s),this._defineEvent("onBefore",e.BEFORE,0,n.to),this._defineEvent("onStart",e.RUN,0,n.to),this._defineEvent("onExit",e.RUN,100,n.exiting,!0),this._defineEvent("onRetain",e.RUN,200,n.retained),this._defineEvent("onEnter",e.RUN,300,n.entering),this._defineEvent("onFinish",e.RUN,400,n.to),this._defineEvent("onSuccess",e.SUCCESS,0,n.to,r,t.LOG_REJECTED_RESULT,t.LOG_ERROR,s),this._defineEvent("onError",e.ERROR,0,n.to,r,t.LOG_REJECTED_RESULT,t.LOG_ERROR,s)},e.prototype._defineCorePaths=function(){var e=o.c.STATE,t=o.c.TRANSITION;this._definePathType("to",t),this._definePathType("from",t),this._definePathType("exiting",e),this._definePathType("retained",e),this._definePathType("entering",e)},e.prototype._defineEvent=function(e,t,n,o,r,a,i,d){void 0===r&&(r=!1),void 0===a&&(a=O.I.HANDLE_RESULT),void 0===i&&(i=O.I.REJECT_ERROR),void 0===d&&(d=!1);var u=new P.t(e,t,n,o,r,a,i,d);this._eventTypes.push(u),(0,s.BU)(this,this,u)},e.prototype._getEvents=function(e){return((0,c.$K)(e)?this._eventTypes.filter((function(t){return t.hookPhase===e})):this._eventTypes.slice()).sort((function(e,t){var n=e.hookPhase-t.hookPhase;return 0===n?e.hookOrder-t.hookOrder:n}))},e.prototype._definePathType=function(e,t){this._criteriaPaths[e]={name:e,scope:t}},e.prototype._getPathTypes=function(){return this._criteriaPaths},e.prototype.getHooks=function(e){return this._registeredHooks[e]},e.prototype._registerCoreTransitionHooks=function(){var e=this._deregisterHookFns;e.addCoreResolves=this.onCreate({},u),e.ignored=this.onBefore({},R,{priority:-9999}),e.invalid=function(e){return e.onBefore({},F,{priority:-1e4})}(this),e.redirectTo=function(e){return e.onStart({to:function(e){return!!e.redirectTo}},p)}(this),e.onExit=function(e){return e.onExit({exiting:function(e){return!!e.onExit}},y)}(this),e.onRetain=function(e){return e.onRetain({retained:function(e){return!!e.onRetain}},L)}(this),e.onEnter=function(e){return e.onEnter({entering:function(e){return!!e.onEnter}},g)}(this),e.eagerResolve=function(e){return e.onStart({},w,{priority:j})}(this),e.lazyResolve=function(e){return e.onEnter({entering:(0,k.P0)(!0)},b,{priority:j})}(this),e.resolveAll=function(e){return e.onFinish({},D,{priority:j})}(this),e.loadViews=function(e){return e.onFinish({},T)}(this),e.activateViews=function(e){return e.onSuccess({},S)}(this),e.updateGlobals=function(e){return e.onCreate({},H)}(this),e.updateUrl=function(e){return e.onSuccess({},x,{priority:9999})}(this),e.lazyLoad=(0,E.v)(this)},e}()},"./node_modules/@uirouter/core/lib-esm/url/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/url/urlConfig.js":(e,t,n)=>{"use strict";n.d(t,{F:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/params/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),s=function(){function e(e){var t=this;this.router=e,this.paramTypes=new o.ParamTypes,this._decodeParams=!0,this._isCaseInsensitive=!1,this._isStrictMode=!0,this._defaultSquashPolicy=!1,this.dispose=function(){return t.paramTypes.dispose()},this.baseHref=function(){return t.router.locationConfig.baseHref()},this.hashPrefix=function(e){return t.router.locationConfig.hashPrefix(e)},this.host=function(){return t.router.locationConfig.host()},this.html5Mode=function(){return t.router.locationConfig.html5Mode()},this.port=function(){return t.router.locationConfig.port()},this.protocol=function(){return t.router.locationConfig.protocol()}}return e.prototype.caseInsensitive=function(e){return this._isCaseInsensitive=(0,r.$K)(e)?e:this._isCaseInsensitive},e.prototype.defaultSquashPolicy=function(e){if((0,r.$K)(e)&&!0!==e&&!1!==e&&!(0,r.HD)(e))throw new Error("Invalid squash policy: "+e+". Valid policies: false, true, arbitrary-string");return this._defaultSquashPolicy=(0,r.$K)(e)?e:this._defaultSquashPolicy},e.prototype.strictMode=function(e){return this._isStrictMode=(0,r.$K)(e)?e:this._isStrictMode},e.prototype.type=function(e,t,n){var o=this.paramTypes.type(e,t,n);return(0,r.$K)(t)?this:o},e}()},"./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js":(e,t,n)=>{"use strict";n.d(t,{y:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),s=n("./node_modules/@uirouter/core/lib-esm/params/index.js"),a=function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n{"use strict";n.d(t,{g:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRule.js"),s=function(){function e(e){var t=this;this.router=e,this.sync=function(e){return t.router.urlService.sync(e)},this.listen=function(e){return t.router.urlService.listen(e)},this.deferIntercept=function(e){return t.router.urlService.deferIntercept(e)},this.match=function(e){return t.router.urlService.match(e)},this.initial=function(e){return t.router.urlService.rules.initial(e)},this.otherwise=function(e){return t.router.urlService.rules.otherwise(e)},this.removeRule=function(e){return t.router.urlService.rules.removeRule(e)},this.rule=function(e){return t.router.urlService.rules.rule(e)},this.rules=function(){return t.router.urlService.rules.rules()},this.sort=function(e){return t.router.urlService.rules.sort(e)},this.when=function(e,n,o){return t.router.urlService.rules.when(e,n,o)},this.urlRuleFactory=new r.I(e)}return e.prototype.update=function(e){var t=this.router.locationService;e?this.location=t.url():t.url()!==this.location&&t.url(this.location,!0)},e.prototype.push=function(e,t,n){var o=n&&!!n.replace;this.router.urlService.url(e.format(t||{}),o)},e.prototype.href=function(e,t,n){var r=e.format(t);if(null==r)return null;n=n||{absolute:!1};var s=this.router.urlService.config,a=s.html5Mode();if(a||null===r||(r="#"+s.hashPrefix()+r),r=function(e,t,n,r){return"/"===r?e:t?(0,o.Lb)(r)+e:n?r.slice(1)+e:e}(r,a,n.absolute,s.baseHref()),!n.absolute||!r)return r;var i=!a&&r?"/":"",d=s.port(),u=80===d||443===d?"":":"+d;return[s.protocol(),"://",s.host(),u,i,r].join("")},Object.defineProperty(e.prototype,"interceptDeferred",{get:function(){return this.router.urlService.interceptDeferred},enumerable:!1,configurable:!0}),e}()},"./node_modules/@uirouter/core/lib-esm/url/urlRule.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>d,n:()=>u});var o=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),i=n("./node_modules/@uirouter/core/lib-esm/state/stateObject.js"),d=function(){function e(e){this.router=e}return e.prototype.compile=function(e){return this.router.urlMatcherFactory.compile(e)},e.prototype.create=function(e,t){var n=this,s=i.l.isState,d=i.l.isStateDeclaration,m=(0,a.uj)([[r.HD,function(e){return m(n.compile(e))}],[(0,a.is)(o.x),function(e){return n.fromUrlMatcher(e,t)}],[(0,a.or)(s,d),function(e){return n.fromState(e,n.router)}],[(0,a.is)(RegExp),function(e){return n.fromRegExp(e,t)}],[r.mf,function(e){return new u(e,t)}]]),l=m(e);if(!l)throw new Error("invalid 'what' in when()");return l},e.prototype.fromUrlMatcher=function(e,t){var n=t;(0,r.HD)(t)&&(t=this.router.urlMatcherFactory.compile(t)),(0,a.is)(o.x)(t)&&(n=function(e){return t.format(e)});var i={urlMatcher:e,matchPriority:function(t){var n=e.parameters().filter((function(e){return e.isOptional}));return n.length?n.filter((function(e){return t[e.id]})).length/n.length:1e-6},type:"URLMATCHER"};return(0,s.l7)(new u((function(t){var n=e.exec(t.path,t.search,t.hash);return e.validates(n)&&n}),n),i)},e.prototype.fromState=function(e,t){var n=i.l.isStateDeclaration(e)?e.$$state():e,o={state:n,type:"STATE"};return(0,s.l7)(this.fromUrlMatcher(n.url,(function(e){var o=t.stateService,r=t.globals;o.href(n,e)!==o.href(r.current,r.params)&&o.transitionTo(n,e,{inherit:!0,source:"url"})})),o)},e.prototype.fromRegExp=function(e,t){if(e.global||e.sticky)throw new Error("Rule RegExp must not be global or sticky");var n=(0,r.HD)(t)?function(e){return t.replace(/\$(\$|\d{1,2})/,(function(t,n){return e["$"===n?0:Number(n)]}))}:t,o={regexp:e,type:"REGEXP"};return(0,s.l7)(new u((function(t){return e.exec(t.path)}),n),o)},e.isUrlRule=function(e){return e&&["type","match","handler"].every((function(t){return(0,r.$K)(e[t])}))},e}(),u=function(e,t){var n=this;this.match=e,this.type="RAW",this.matchPriority=function(e){return 0-n.$id},this.handler=t||s.yR}},"./node_modules/@uirouter/core/lib-esm/url/urlRules.js":(e,t,n)=>{"use strict";n.d(t,{h:()=>u});var o,r=n("./node_modules/@uirouter/core/lib-esm/state/index.js"),s=n("./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),i=n("./node_modules/@uirouter/core/lib-esm/url/urlRule.js");function d(e){if(!((0,a.mf)(e)||(0,a.HD)(e)||(0,a.is)(r.TargetState)(e)||r.TargetState.isDef(e)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return(0,a.mf)(e)?e:(0,a.P0)(e)}o=function(e,t){var n=function(e,t){return(t.priority||0)-(e.priority||0)}(e,t);return 0!==n||0!==(n=function(e,t){var n={STATE:4,URLMATCHER:4,REGEXP:3,RAW:2,OTHER:1};return(n[e.type]||0)-(n[t.type]||0)}(e,t))||0!==(n=function(e,t){return e.urlMatcher&&t.urlMatcher?s.x.compare(e.urlMatcher,t.urlMatcher):0}(e,t))?n:function(e,t){var n={STATE:!0,URLMATCHER:!0};return n[e.type]&&n[t.type]?0:(e.$id||0)-(t.$id||0)}(e,t)};var u=function(){function e(e){this.router=e,this._sortFn=o,this._rules=[],this._id=0,this.urlRuleFactory=new i.I(e)}return e.prototype.dispose=function(e){this._rules=[],delete this._otherwiseFn},e.prototype.initial=function(e){var t=d(e);this.rule(this.urlRuleFactory.create((function(e,t){return 0===t.globals.transitionHistory.size()&&!!/^\/?$/.exec(e.path)}),t))},e.prototype.otherwise=function(e){var t=d(e);this._otherwiseFn=this.urlRuleFactory.create((0,a.P0)(!0),t),this._sorted=!1},e.prototype.removeRule=function(e){(0,a.nA)(this._rules,e)},e.prototype.rule=function(e){var t=this;if(!i.I.isUrlRule(e))throw new Error("invalid rule");return e.$id=this._id++,e.priority=e.priority||0,this._rules.push(e),this._sorted=!1,function(){return t.removeRule(e)}},e.prototype.rules=function(){return this.ensureSorted(),this._rules.concat(this._otherwiseFn?[this._otherwiseFn]:[])},e.prototype.sort=function(e){for(var t=this.stableSort(this._rules,this._sortFn=e||this._sortFn),n=0,o=0;o{"use strict";n.d(t,{i:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/url/urlRules.js"),s=n("./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"),a=n("./node_modules/@uirouter/core/lib-esm/state/index.js"),i=function(){function e(e){var t=this;this.router=e,this.interceptDeferred=!1,this.rules=new r.h(this.router),this.config=new s.F(this.router),this.url=function(e,n,o){return t.router.locationService.url(e,n,o)},this.path=function(){return t.router.locationService.path()},this.search=function(){return t.router.locationService.search()},this.hash=function(){return t.router.locationService.hash()},this.onChange=function(e){return t.router.locationService.onChange(e)}}return e.prototype.dispose=function(){this.listen(!1),this.rules.dispose()},e.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},e.prototype.sync=function(e){if(!e||!e.defaultPrevented){var t=this.router,n=t.urlService,r=t.stateService,s={path:n.path(),search:n.search(),hash:n.hash()},i=this.match(s);(0,o.uj)([[o.HD,function(e){return n.url(e,!0)}],[a.TargetState.isDef,function(e){return r.go(e.state,e.params,e.options)}],[(0,o.is)(a.TargetState),function(e){return r.go(e.state(),e.params(),e.options())}]])(i&&i.rule.handler(i.match,s,this.router))}},e.prototype.listen=function(e){var t=this;if(!1!==e)return this._stopListeningFn=this._stopListeningFn||this.router.urlService.onChange((function(e){return t.sync(e)}));this._stopListeningFn&&this._stopListeningFn(),delete this._stopListeningFn},e.prototype.deferIntercept=function(e){void 0===e&&(e=!0),this.interceptDeferred=e},e.prototype.match=function(e){e=(0,o.l7)({path:"",search:{},hash:""},e);for(var t,n,r,s=this.rules.rules(),a=0;at.weight?i:t}return t},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla.js":(e,t,n)=>{"use strict";n.d(t,{$q:()=>o.$q});var o=n("./node_modules/@uirouter/core/lib-esm/vanilla/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js":(e,t,n)=>{"use strict";n.d(t,{U:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=n("./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"),s=function(){function e(e,t){var n=this;this.fireAfterUpdate=t,this._listeners=[],this._listener=function(e){return n._listeners.forEach((function(t){return t(e)}))},this.hash=function(){return(0,r.en)(n._get()).hash},this.path=function(){return(0,r.en)(n._get()).path},this.search=function(){return(0,r.Qf)((0,r.en)(n._get()).search)},this._location=o.Jz.location,this._history=o.Jz.history}return e.prototype.url=function(e,t){return void 0===t&&(t=!0),(0,o.$K)(e)&&e!==this._get()&&(this._set(null,null,e,t),this.fireAfterUpdate&&this._listeners.forEach((function(t){return t({url:e})}))),(0,r.Q2)(this)},e.prototype.onChange=function(e){var t=this;return this._listeners.push(e),function(){return(0,o.nA)(t._listeners,e)}},e.prototype.dispose=function(e){(0,o.Wk)(this._listeners)},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js":(e,t,n)=>{"use strict";n.d(t,{u:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=function(){function e(e,t){void 0===t&&(t=!1),this._isHtml5=t,this._baseHref=void 0,this._hashPrefix=""}return e.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},e.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},e.prototype.host=function(){return location.hostname},e.prototype.html5Mode=function(){return this._isHtml5},e.prototype.hashPrefix=function(e){return(0,o.$K)(e)?this._hashPrefix=e:this._hashPrefix},e.prototype.baseHref=function(e){return(0,o.$K)(e)&&(this._baseHref=e),(0,o.o8)(this._baseHref)&&(this._baseHref=this.getBaseHref()),this._baseHref},e.prototype.getBaseHref=function(){var e=document.getElementsByTagName("base")[0];return e&&e.href?e.href.replace(/^([^/:]*:)?\/\/[^/]*/,""):this._isHtml5?"/":location.pathname||"/"},e.prototype.dispose=function(){},e}()},"./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js":(e,t,n)=>{"use strict";n.d(t,{R:()=>i});var o,r=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),s=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),a=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t){var n=e.call(this,t,!1)||this;return r.Jz.addEventListener("hashchange",n._listener,!1),n}return a(t,e),t.prototype._get=function(){return(0,r.Ld)(this._location.hash)},t.prototype._set=function(e,t,n,o){this._location.hash=n},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),r.Jz.removeEventListener("hashchange",this._listener)},t}(s.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/injector.js":(e,t,n)=>{"use strict";n("./node_modules/@uirouter/core/lib-esm/common/index.js")},"./node_modules/@uirouter/core/lib-esm/vanilla/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js":(e,t,n)=>{"use strict";n.d(t,{W:()=>s});var o=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),s=function(){var e=this;this.dispose=r.ZT,this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return e._port},this.protocol=function(){return e._protocol},this.host=function(){return e._host},this.baseHref=function(){return e._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(t){return(0,o.$K)(t)?e._hashPrefix=t:e._hashPrefix}}},"./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js":(e,t,n)=>{"use strict";n.d(t,{I:()=>a});var o,r=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),s=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(e){function t(t){return e.call(this,t,!0)||this}return s(t,e),t.prototype._get=function(){return this._url},t.prototype._set=function(e,t,n,o){this._url=n},t}(r.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js":(e,t,n)=>{"use strict";var o=n("./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"),r=n("./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"),s=n("./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"),a=n("./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"),i=n("./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"),d=n("./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js");n("./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"),n("./node_modules/@uirouter/core/lib-esm/vanilla/q.js"),n("./node_modules/@uirouter/core/lib-esm/common/coreservices.js"),(0,s._D)("vanilla.hashBangLocation",!1,r.R,o.u),(0,s._D)("vanilla.pushStateLocation",!0,a.h,o.u),(0,s._D)("vanilla.memoryLocation",!1,i.I,d.W)},"./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js":(e,t,n)=>{"use strict";n.d(t,{h:()=>i});var o,r=n("./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),a=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t){var n=e.call(this,t,!0)||this;return n._config=t.urlService.config,s.Jz.addEventListener("popstate",n._listener,!1),n}return a(t,e),t.prototype._getBasePrefix=function(){return(0,s.Lb)(this._config.baseHref())},t.prototype._get=function(){var e=this._location,t=e.pathname,n=e.hash,o=e.search;o=(0,s.C7)(o)[1],n=(0,s.cW)(n)[1];var r=this._getBasePrefix(),a=t===this._config.baseHref(),i=t.substr(0,r.length)===r;return(t=a?"/":i?t.substring(r.length):t)+(o?"?"+o:"")+(n?"#"+n:"")},t.prototype._set=function(e,t,n,o){var r=this._getBasePrefix(),s=n&&"/"!==n[0]?"/":"",a=""===n||"/"===n?this._config.baseHref():r+s+n;o?this._history.replaceState(e,t,a):this._history.pushState(e,t,a)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),s.Jz.removeEventListener("popstate",this._listener)},t}(r.U)},"./node_modules/@uirouter/core/lib-esm/vanilla/q.js":(e,t,n)=>{"use strict";n.d(t,{$q:()=>r});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r={when:function(e){return new Promise((function(t,n){return t(e)}))},reject:function(e){return new Promise((function(t,n){n(e)}))},defer:function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},all:function(e){if((0,o.kJ)(e))return Promise.all(e);if((0,o.Kn)(e)){var t=Object.keys(e).map((function(t){return e[t].then((function(e){return{key:t,val:e}}))}));return r.all(t).then((function(e){return e.reduce((function(e,t){return e[t.key]=t.val,e}),{})}))}}}},"./node_modules/@uirouter/core/lib-esm/vanilla/utils.js":(e,t,n)=>{"use strict";n.d(t,{Qf:()=>s,en:()=>a,Q2:()=>i,_D:()=>d});var o=n("./node_modules/@uirouter/core/lib-esm/common/index.js"),r=function(e,t){var n=t[0],r=t[1];return e.hasOwnProperty(n)?(0,o.kJ)(e[n])?e[n].push(r):e[n]=[e[n],r]:e[n]=r,e},s=function(e){return e.split("&").filter(o.yR).map(o.Fb).reduce(r,{})};function a(e){var t=function(e){return e||""},n=(0,o.cW)(e).map(t),r=n[0],s=n[1],a=(0,o.C7)(r).map(t);return{path:a[0],search:a[1],hash:s,url:e}}var i=function(e){var t=e.path(),n=e.search(),r=e.hash(),s=Object.keys(n).map((function(e){var t=n[e];return((0,o.kJ)(t)?t:[t]).map((function(t){return e+"="+t}))})).reduce(o.M7,[]).join("&");return t+(s?"?"+s:"")+(r?"#"+r:"")};function d(e,t,n,o){return function(r){var s=r.locationService=new n(r),a=r.locationConfig=new o(r,t);return{name:e,service:s,configuration:a,dispose:function(e){e.dispose(s),e.dispose(a)}}}}},"./node_modules/@uirouter/core/lib-esm/view/interface.js":()=>{},"./node_modules/@uirouter/core/lib-esm/view/view.js":(e,t,n)=>{"use strict";n.d(t,{s:()=>i});var o=n("./node_modules/@uirouter/core/lib-esm/common/common.js"),r=n("./node_modules/@uirouter/core/lib-esm/common/hof.js"),s=n("./node_modules/@uirouter/core/lib-esm/common/predicates.js"),a=n("./node_modules/@uirouter/core/lib-esm/common/trace.js"),i=function(){function e(e){var t=this;this.router=e,this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIView:function(e){return(0,o.sE)(t._uiViews,(function(n){return t.router.$id+"."+n.id===e}))},_registeredUIViews:function(){return t._uiViews},_activeViewConfigs:function(){return t._viewConfigs},_onSync:function(e){return t._listeners.push(e),function(){return(0,o.nA)(t._listeners,e)}}}}return e.normalizeUIViewTarget=function(e,t){void 0===t&&(t="");var n=t.split("@"),o=n[0]||"$default",r=(0,s.HD)(n[1])?n[1]:"^",a=/^(\^(?:\.\^)*)\.(.*$)/.exec(o);if(a&&(r=a[1],o=a[2]),"!"===o.charAt(0)&&(o=o.substr(1),r=""),/^(\^(?:\.\^)*)$/.exec(r)){var i=r.split(".").reduce((function(e,t){return e.parent}),e);r=i.name}else"."===r&&(r=e.name);return{uiViewName:o,uiViewContextAnchor:r}},e.prototype._rootViewContext=function(e){return this._rootContext=e||this._rootContext},e.prototype._viewConfigFactory=function(e,t){this._viewConfigFactories[e]=t},e.prototype.createViewConfig=function(e,t){var n=this._viewConfigFactories[t.$type];if(!n)throw new Error("ViewService: No view config factory registered for type "+t.$type);var o=n(e,t);return(0,s.kJ)(o)?o:[o]},e.prototype.deactivateViewConfig=function(e){a.g4.traceViewServiceEvent("<- Removing",e),(0,o.nA)(this._viewConfigs,e)},e.prototype.activateViewConfig=function(e){a.g4.traceViewServiceEvent("-> Registering",e),this._viewConfigs.push(e)},e.prototype.sync=function(){var t=this,n=this._uiViews.map((function(e){return[e.fqn,e]})).reduce(o.bb,{});function s(e){for(var t=e.viewDecl.$context,n=0;++n&&t.parent;)t=t.parent;return n}var i=(0,r.WA)((function(e,t,n,o){return t*(e(n)-e(o))})),d=this._uiViews.sort(i((function(e){var t=function(e){return e&&e.parent?t(e.parent)+1:1};return 1e4*e.fqn.split(".").length+t(e.creationContext)}),1)).map((function(o){var r=t._viewConfigs.filter(e.matches(n,o));return r.length>1&&r.sort(i(s,-1)),{uiView:o,viewConfig:r[0]}})),u=d.map((function(e){return e.viewConfig})),m=this._viewConfigs.filter((function(e){return!(0,o.d3)(u,e)})).map((function(e){return{uiView:void 0,viewConfig:e}}));d.forEach((function(e){-1!==t._uiViews.indexOf(e.uiView)&&e.uiView.configUpdated(e.viewConfig)}));var l=d.concat(m);this._listeners.forEach((function(e){return e(l)})),a.g4.traceViewSync(l)},e.prototype.registerUIView=function(e){a.g4.traceViewServiceUIViewEvent("-> Registering",e);var t=this._uiViews;return t.filter((function(t){return t.fqn===e.fqn&&t.$type===e.$type})).length&&a.g4.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",e),t.push(e),this.sync(),function(){-1!==t.indexOf(e)?(a.g4.traceViewServiceUIViewEvent("<- Deregistering",e),(0,o.nA)(t)(e)):a.g4.traceViewServiceUIViewEvent("Tried removing non-registered uiView",e)}},e.prototype.available=function(){return this._uiViews.map((0,r.vg)("fqn"))},e.prototype.active=function(){return this._uiViews.filter((0,r.vg)("$config")).map((0,r.vg)("name"))},e.matches=function(e,t){return function(n){if(t.$type!==n.viewDecl.$type)return!1;var r=n.viewDecl,s=r.$uiViewName.split("."),a=t.fqn.split(".");if(!(0,o.fS)(s,a.slice(0-s.length)))return!1;var i=1-s.length||void 0,d=a.slice(0,i).join("."),u=e[d].creationContext;return r.$uiViewContextAnchor===(u&&u.name)}},e}()},"./node_modules/angular-aria/angular-aria.js":()=>{!function(e,t){"use strict";var n="ngAriaDisable",o=t.module("ngAria",["ng"]).info({angularVersion:"1.8.2"}).provider("$aria",(function(){var e={ariaHidden:!0,ariaChecked:!0,ariaReadonly:!0,ariaDisabled:!0,ariaRequired:!0,ariaInvalid:!0,ariaValue:!0,tabindex:!0,bindKeydown:!0,bindRoleForClick:!0};function o(t,o,r,a){return function(i,d,u){if(!u.hasOwnProperty(n)){var m=u.$normalize(o);!e[m]||s(d,r)||u[m]||i.$watch(u[t],(function(e){e=a?!e:!!e,d.attr(o,e)}))}}}this.config=function(n){e=t.extend(e,n)},this.$get=function(){return{config:function(t){return e[t]},$$watchExpr:o}}})),r=["BUTTON","A","INPUT","TEXTAREA","SELECT","DETAILS","SUMMARY"],s=function(e,t){if(-1!==t.indexOf(e[0].nodeName))return!0};o.directive("ngShow",["$aria",function(e){return e.$$watchExpr("ngShow","aria-hidden",[],!0)}]).directive("ngHide",["$aria",function(e){return e.$$watchExpr("ngHide","aria-hidden",[],!1)}]).directive("ngValue",["$aria",function(e){return e.$$watchExpr("ngValue","aria-checked",r,!1)}]).directive("ngChecked",["$aria",function(e){return e.$$watchExpr("ngChecked","aria-checked",r,!1)}]).directive("ngReadonly",["$aria",function(e){return e.$$watchExpr("ngReadonly","aria-readonly",r,!1)}]).directive("ngRequired",["$aria",function(e){return e.$$watchExpr("ngRequired","aria-required",r,!1)}]).directive("ngModel",["$aria",function(e){function t(t,n,o,a){return e.config(n)&&!o.attr(t)&&(a||!s(o,r))&&("hidden"!==o.attr("type")||"INPUT"!==o[0].nodeName)}function o(e,t){return!t.attr("role")&&t.attr("type")===e&&!s(t,r)}return{restrict:"A",require:"ngModel",priority:200,compile:function(r,s){if(!s.hasOwnProperty(n)){var a=function(e,t){var n=e.type,o=e.role;return"checkbox"===(n||o)||"menuitemcheckbox"===o?"checkbox":"radio"===(n||o)||"menuitemradio"===o?"radio":"range"===n||"progressbar"===o||"slider"===o?"range":""}(s);return{post:function(n,r,s,i){var d=t("tabindex","tabindex",r,!1);function u(){return i.$modelValue}switch(a){case"radio":case"checkbox":o(a,r)&&r.attr("role",a),t("aria-checked","ariaChecked",r,!1)&&n.$watch(u,"radio"===a?function(e){var t=s.value==i.$viewValue;r.attr("aria-checked",t)}:function(){r.attr("aria-checked",!i.$isEmpty(i.$viewValue))}),d&&r.attr("tabindex",0);break;case"range":if(o(a,r)&&r.attr("role","slider"),e.config("ariaValue")){var m=!r.attr("aria-valuemin")&&(s.hasOwnProperty("min")||s.hasOwnProperty("ngMin")),l=!r.attr("aria-valuemax")&&(s.hasOwnProperty("max")||s.hasOwnProperty("ngMax")),_=!r.attr("aria-valuenow");m&&s.$observe("min",(function(e){r.attr("aria-valuemin",e)})),l&&s.$observe("max",(function(e){r.attr("aria-valuemax",e)})),_&&n.$watch(u,(function(e){r.attr("aria-valuenow",e)}))}d&&r.attr("tabindex",0)}!s.hasOwnProperty("ngRequired")&&i.$validators.required&&t("aria-required","ariaRequired",r,!1)&&s.$observe("required",(function(){r.attr("aria-required",!!s.required)})),t("aria-invalid","ariaInvalid",r,!0)&&n.$watch((function(){return i.$invalid}),(function(e){r.attr("aria-invalid",!!e)}))}}}}}}]).directive("ngDisabled",["$aria",function(e){return e.$$watchExpr("ngDisabled","aria-disabled",r,!1)}]).directive("ngMessages",(function(){return{restrict:"A",require:"?ngMessages",link:function(e,t,o,r){o.hasOwnProperty(n)||t.attr("aria-live")||t.attr("aria-live","assertive")}}})).directive("ngClick",["$aria","$parse",function(e,t){return{restrict:"A",compile:function(o,a){if(!a.hasOwnProperty(n)){var i=t(a.ngClick);return function(t,n,o){s(n,r)||(e.config("bindRoleForClick")&&!n.attr("role")&&n.attr("role","button"),e.config("tabindex")&&!n.attr("tabindex")&&n.attr("tabindex",0),!e.config("bindKeydown")||o.ngKeydown||o.ngKeypress||o.ngKeyup||n.on("keydown",(function(e){var n=e.which||e.keyCode;13!==n&&32!==n||(-1!==r.indexOf(e.target.nodeName)||e.target.isContentEditable||e.preventDefault(),t.$apply((function(){i(t,{$event:e})})))})))}}}}}]).directive("ngDblclick",["$aria",function(e){return function(t,o,a){a.hasOwnProperty(n)||!e.config("tabindex")||o.attr("tabindex")||s(o,r)||o.attr("tabindex",0)}}])}(window,window.angular)},"./node_modules/angular-rateit/dist/ng-rateit.js":()=>{angular.module("ngRateIt",["ng"]).directive("ngRateIt",["$q",function(e){"use strict";return{scope:{ngModel:"=",min:"=?min",max:"=?max",step:"=?step",readOnly:"&?readOnly",pristine:"=?pristine",resetable:"&?resetable",starWidth:"=?starWidth",starHeight:"=?starHeight",canelWidth:"=?canelWidth",cancelHeight:"=?cancelHeight",rated:"&?rated",reset:"&?reset",beforeRated:"&?beforeRated",beforeReset:"&?beforeReset"},templateUrl:"ngRateIt/ng-rate-it.html",require:"ngModel",replace:!0,link:function(t,n,o){o.readOnly||(t.readOnly=function(){return!1}),o.resetable||(t.resetable=function(){return!0}),o.beforeRated||(t.beforeRated=function(){var t=e.defer();return t.resolve(),t.promise}),o.rated||(t.rated=function(){}),o.beforeReset||(t.beforeReset=function(){var t=e.defer();return t.resolve(),t.promise}),o.reset||(t.reset=function(){})},controller:"ngRateItController"}}]).controller("ngRateItController",["$scope","$timeout",function(e,t){"use strict";e.isTouch=!!window.hasOwnProperty("ontouchstart")||window.navigator.msMaxTouchPoints>0,e.orgValue=angular.copy(e.ngModel),e.min=e.min||0,e.max=e.max||5,e.step=e.step||.5,e.pristine=e.orgValue===e.ngModel,e.starWidth=e.starWidth||16,e.starPartWidth=e.starWidth*e.step,e.starHeight=e.starHeight||16,e.canelWidth=e.canelWidth||e.starWidth,e.cancelHeight=e.cancelHeight||e.starHeight;var n=e.max-e.min,o=n/e.step,r=e.$watch("ngModel",(function(){e.pristine=e.orgValue===e.ngModel})),s=function(e){return(e+1)/o*n};e.getStartParts=function(){return new Array(o)},e.getStarOffset=function(t){var n=1/e.step;return-e.starWidth/n*(t%n)},e.isSelected=function(t){return s(t)<=e.ngModel-e.min},e.removeRating=function(){e.resetable()&&!e.readOnly()&&e.beforeReset({rating:e.ngModel}).then((function(){e.ngModel=e.min,e.reset({rating:e.ngModel})}))},e.setValue=function(n){if(!e.readOnly()){var o=angular.copy(e.min+s(n));e.beforeRated({rating:o}).then((function(){e.ngModel=o,t((function(){e.rated({rating:e.ngModel})}))}))}},e.$on("$destroy",(function(){r()}))}]).run(["$templateCache",function(e){"use strict";e.put("ngRateIt/ng-rate-it.html",'
')}])},"./src/js/index.module.js":(e,t,n)=>{"use strict";n("./node_modules/angular-animate/index.js"),n("./node_modules/angular-aria/index.js"),n("./node_modules/angular-messages/index.js"),n("./node_modules/angular-material/index.js"),n("./node_modules/angular-resource/index.js"),n("./node_modules/angular-sanitize/index.js"),n("./node_modules/ng-csv/build/ng-csv.min.js"),n("./node_modules/ng-embed/src/ng-embed.js");var o=n("./node_modules/@uirouter/angularjs/lib-esm/index.js"),r=(n("./node_modules/angular-local-storage/index.js"),n("./node_modules/angular-rateit/dist/ng-rateit.js"),n("./node_modules/@flowjs/ng-flow/dist/ng-flow.js"),n("./node_modules/emojionearea/dist/emojionearea.js"),n("./node_modules/jquery-textcomplete/dist/jquery.textcomplete.js"),n("./node_modules/moment/moment.js")),s=n.n(r),a=n("./node_modules/lodash.map/index.js"),i=n.n(a);function d(e,t,n,o,r,a,d,u,m,l){const _=this;function c(n){a.updateStorage(u,{up:n}).then((o=>{var r;e.layout=o,r=!0===n?"show":"hide",t.parent.postMessage({cmd:r},"*"),l((()=>{e.$apply()}))})).catch(a.onStorageError)}_.$onInit=function(){console.debug("IndexController::onInit() VISITOR",e.visitor),e.status="init";const o=e.settings.color,s=e.settings.textColor,i=e.settings.textButtonColor||e.settings.textColor,d=e.settings.color_button,l=e.settings.backgroundColor,_=Math.max(document.documentElement.clientHeight,window.innerHeight||0),h=document.documentElement.clientWidth;document.documentElement.style.setProperty("--xc-ws-div-color",o),document.documentElement.style.setProperty("--xc-ws-text-color",s),document.documentElement.style.setProperty("--xc-ws-text-button-color",i),document.documentElement.style.setProperty("--xc-ws-button-color",d),document.documentElement.style.setProperty("--xc-ws-background-color",l),document.documentElement.style.setProperty("--xc-ws-client-height",_),document.documentElement.style.setProperty("--xc-ws-client-width",h);let f=!1;const p=t=>null!==t&&t[e.location]||{},M=a.getItem(m).then(p),y=a.getItem(u).then(p);r.all([M,y]).then((r=>{let[a,i]=r;e.visitor=a,e.layout=i,e.visitor.interaction&&e.layout.up?f=!0:e.layout.up=!0,"bottom_right"===e.settings.alignment&&c(f),n.go(function(){var t,n;const o=e.settings.online,r=!(null==e||null===(t=e.visitor)||void 0===t||null===(n=t.interaction)||void 0===n||!n.id),s=Number(e.settings.maxInteractions)&&Number(e.settings.openedInteractions)>=Number(e.settings.maxInteractions);return!!(r||!s&&o)}()?"app.online":"app.offline",null,{location:"replace"});let d="";d=e.settings.online||!e.settings.hideWhenOffline?"init":"offline",t.parent.postMessage({cmd:d,div_color:o,text_color:s,client_height:_,client_width:h},"*");const u=document.createElement("style");document.head.appendChild(u),u.sheet.insertRule(".mdi-send:before {color:"+e.settings.color+"!important}")})).catch(a.onStorageError)},_.close=function(){const t=e.visitor.interaction;if(t&&t.id){const r=o.confirm().parent(angular.element(document.querySelector("#chat-app"))).clickOutsideToClose(!0).title(e.settings.closingQuestion||"Do you want to close the interaction?").ok("Ok").cancel("Cancel");o.show(r).then((function(){return d.chatInteraction.customUpdate({id:t.id,closed:!0,closeReason:"contact"}).$promise})).then((function(){n.go("app.closing",null,{location:"replace"})})).catch((function(e){console.error("keep open",e)}))}},_.toggle=c,_.download=function(){const t=r.defer(),n=e.visitor.interaction;return n&&n.id&&d.chatInteraction.getMessages({intid:n.id,includeAll:!0}).$promise.then((function(n){t.resolve(i()(n.rows.slice(1),(function(t){let n;if("in"===t.direction&&(n=e.settings.customerAlias||e.visitor.from||"Visitor"+t.ContactId),"out"===t.direction)switch(e.settings.agentIdentifier){case"website_alias":n=t.UserId?e.settings.agentAlias+t.UserId:"System";break;case"agent_alias":n=t.UserId?t.User.alias||t.User.fullname:"System";break;case"agent_fullname":n=t.UserId?t.User.fullname:"System";break;default:n=t.UserId?e.settings.agentAlias+t.UserId:"System"}return{sender:n,message:t.body,createdAt:s()(t.createdAt).format("MM/DD/YYYY HH:mm:ss")}})))})).catch((function(e){console.error(e)})),t.promise},_.getHeaderShape=function(){return"rounded"===e.settings.header_shape?"15px":"0px"};const h={online:["online","chat","waiting","closing","unmanaged"],offline:["offline"]};Object.defineProperty(e,"actualTitle",{get(){let t=e.settings.defaultTitle;return h.online.includes(e.status)?t=e.settings.header_online:h.offline.includes(e.status)&&(t=e.settings.header_offline),t}}),window.addEventListener("message",(function(e){"show"===e.data.evt?c(!0):"hide"===e.data.evt&&c(!1)}),!1)}d.$inject=["$rootScope","$window","$state","$mdDialog","$q","RemoteStorageService","api","STORAGE_LAYOUT","STORAGE_VISITOR","$timeout"];var u=n("./node_modules/lodash.forin/index.js"),m=n.n(u),l=n("./node_modules/lodash.isnil/index.js"),_=n.n(l),c=n("./src/js/chat/chat.tpl.html"),h=n("./src/js/closing/closing.tpl.html"),f=n("./src/js/offline/offline.tpl.html"),p=n("./src/js/online/online.tpl.html"),M=n("./src/js/unmanaged/unmanaged.tpl.html"),y=n("./src/js/waiting/waiting.tpl.html");function L(e,t){const n=t.search();e.settings={cursor:"pointer",hide:!0},m()(n,(function(t,n){""===t||_()(t)||("true"===t&&(t=!0),"false"===t&&(t=!1),e.settings[n]=t)})),e.location=e.settings.location,e.layout={up:!1},e.visitor={}}function g(e,t,n,o,r){t.html5Mode(!0),n.defaults.headers.get||(n.defaults.headers.get={}),n.defaults.headers.get["If-Modified-Since"]="Mon, 26 Jul 1997 05:00:00 GMT",n.defaults.headers.get["Cache-Control"]="no-cache",n.defaults.headers.get.Pragma="no-cache",o.setPrefix(r),e.state("app",{abstract:!0}).state("app.waiting",{url:"/waiting",templateUrl:y,controller:"WaitingController as vm"}).state("app.online",{url:"/online",templateUrl:p,controller:"OnlineController as vm"}).state("app.offline",{url:"/offline",templateUrl:f,controller:"OfflineController as vm"}).state("app.chat",{url:"/chat",templateUrl:c,controller:"ChatController as vm"}).state("app.unmanaged",{url:"/unmanaged",templateUrl:M,controller:"UnmanagedController as vm"}).state("app.closing",{url:"/closing",templateUrl:h,controller:"ClosingController as vm"})}g.$inject=["$stateProvider","$locationProvider","$httpProvider","localStorageServiceProvider","STORAGE_PREFIX"],L.$inject=["$rootScope","$location"];var Y=n("./node_modules/lodash.merge/index.js"),v=n.n(Y);function k(e,t,n,o,r,s,a,i){const d=this;function u(t){return function(o){d.errors[t]=o.data;const r=n.simple().textContent(e.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").position("top");n.show(r)}}function m(){e.loading=!1}function l(){e.settings.online?t.go("app.online",null,{location:"replace"}):t.go("app.offline",null,{location:"replace"})}function _(){d.form={},d.upColor=null,d.downColor=null,d.userForm.$setPristine(),d.userForm.$setUntouched(),delete e.visitor.interaction,e.enableDownload=!1}d.$onInit=function(){console.debug("ClosingController::onInit() VISITOR",e.visitor),e.status="closing",r.all([s.removeItem(a).then((()=>console.debug("STORAGE_VISITOR cleared"))).catch(s.onStorageError),s.removeItem(i).then((()=>console.debug("STORAGE_LAYOUT cleared"))).catch(s.onStorageError)]).then((()=>e.loading=!1))},d.submit=function(){e.loading=!0,e.visitor.interaction&&e.visitor.interaction.id?o.chatInteraction.close(v()({id:e.visitor.interaction.id,ratingType:e.settings.ratingType,customer:e.settings.customerAlias||e.visitor.from},d.form)).$promise.then((function(){delete d.errors.submit;const t=n.simple().textContent(e.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(t)})).then(_).then(l).catch(u("submit")).finally(m):(m(),u("submit"))},d.skip=function(){_(),l()},d.form={},d.errors={}}function j(e,t){const n={id:"@id",token:e.settings.token},o={};return o.baseUrl=e.settings.remote+"/api/",o.chatWebsite=t(o.baseUrl+"chat/websites/:id",n,{notify:{method:"POST",url:o.baseUrl+"chat/websites/:id/notify"},offline:{method:"POST",url:o.baseUrl+"chat/websites/:id/offline"},getFields:{method:"GET",url:o.baseUrl+"chat/websites/:id/fields"}}),o.chatInteraction=t(o.baseUrl+"chat/interactions/:id",n,{update:{method:"PUT",url:o.baseUrl+"chat/interactions/:id"},customUpdate:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/custom_update"},close:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/close"},getMessages:{method:"GET",url:o.baseUrl+"chat/interactions/:intid/my_messages"},uploadAttachment:{method:"POST",url:o.baseUrl+"chat/interactions/:id/attachment_upload",headers:{"Content-Type":void 0},transformRequest:angular.identity},downloadAttachment:{method:"GET",url:o.baseUrl+"chat/interactions/:id/attachment_download"},abandon:{method:"PUT",url:o.baseUrl+"chat/interactions/:id/abandon"}}),o.chatMessage=t(o.baseUrl+"chat/messages/:id",n,{update:{method:"PUT",url:o.baseUrl+"chat/messages/:id"}}),o}k.$inject=["$rootScope","$state","$mdToast","api","$q","RemoteStorageService","STORAGE_VISITOR","STORAGE_LAYOUT"],j.$inject=["$rootScope","$resource"];var w=n("./node_modules/lodash.find/index.js"),b=n.n(w),D=n("./node_modules/lodash.values/index.js"),T=n.n(D),S=n("./node_modules/jquery/dist/jquery.js");function H(e,t,n,r,s,a,i,d,u,m,l,c){const h=this;let f,p,M,y;function L(){o.$q.all([m.removeItem(l).then((()=>console.debug("STORAGE_VISITOR cleared"))).catch(m.onStorageError),m.removeItem(c).then((()=>console.debug("STORAGE_LAYOUT cleared"))).catch(m.onStorageError)]).then((()=>{t.settings.online?a.go("app.online",null,{location:"replace"}):a.go("app.offline",null,{location:"replace"})}))}function g(){n((function(){const e=s[0].getElementsByClassName("chat-messages")[0];e&&(e.scrollTop=e.scrollHeight)}))}function Y(){h.errors={},t.$emit("hide");const e=d.simple().textContent("FILE TOO BIG: The max allowed size is 16MB").toastClass("md-warning-toast size "+t.settings.header_shape).parent(angular.element(document.querySelector("#chat-toolbar")));d.show(e)}function k(e){return function(t){h.errors[e]=t.data,g()}}function j(e){u.chatWebsite.notify(e).$promise.then((function(e){h.errors={};let n=!1;_()(t.visitor.interaction)&&(t.visitor.interaction={id:e.interaction.id},n=!0),t.visitor.interactionStarted||(t.visitor.interactionStarted=!0,n=!0),n&&m.updateStorage(l,t.visitor).then((e=>{t.visitor=e})).catch(m.onStorageError),f[0].emojioneArea.setText(""),g()})).catch(k("chatMessageError"))}function w(){t.visitor&&t.visitor.interaction&&t.visitor.interaction.id&&u.chatInteraction.get({id:t.visitor.interaction.id}).$promise.then((function(e){delete h.errors.getInteraction,e.closed&&(t.visitor.interaction.closed=!0,m.updateStorage(l,t.visitor).then((e=>{t.visitor=e})).catch(m.onStorageError),"unmanaged"===e.disposition?a.go("app.unmanaged",null,{location:"replace"}):a.go("app.closing",null,{location:"replace"}))})).catch((function(e){switch(e.status){case 403:a.go("app.closing",null,{location:"replace"});break;case 404:L();break;case 405:a.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}function D(e){const n=f[0].emojioneArea.getText();e&&13===e.keyCode&&e.shiftKey||e&&13!==e.keyCode||""!==n&&j(v()({body:n},t.visitor))}function H(){var e,n;null!=t&&null!==(e=t.visitor)&&void 0!==e&&null!==(n=e.interaction)&&void 0!==n&&n.id&&u.chatInteraction.getMessages({intid:t.visitor.interaction.id,includeAgent:!0,id:y||void 0}).$promise.then((function(e){if(delete h.errors.interaction,e.count){let o=!1,r=0;for(r=0,o=!1;r{t.visitor=e}))}var n})).catch((function(e){switch(e.status){case 403:a.go("app.closing",null,{location:"replace"});break;case 405:a.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}h.errors={},t.messages=[],h.emojiOptions={watchEmbedData:!1,fontSmiley:!1,emoji:!0,link:!0,linkTarget:"_blank"},h.ngFlowOptions={allowDuplicateUploads:!0},h.$onInit=function(){console.debug("ChatController::onInit() VISITOR",t.visitor),t.status="chat",t.loading=!1,t.settings.showMenu=!0,h.replyMessage="",t.visitor.interaction&&t.visitor.interaction.closed?L():(w(),p=r(H,2e3),M=r(w,3e3)),f=S("#emojionearea").emojioneArea({placeholder:t.settings.placeholderMessage||"Type a message",events:{keyup:function(e,t){D(t)},ready:function(){this.setFocus()}}})},h.reply=D,h.reply_button=function(){const e=f[0].emojioneArea.getText();""!==e&&(j(v()({body:e},t.visitor)),f[0].emojioneArea.setFocus())},h.fileAdded=function(e){if(e.size>16777216)return void Y();const n=new FormData;n.append("file",e.file),i.post(t.settings.remote+"/api/chat/interactions/"+t.visitor.interaction.id+"/attachment_upload?token="+t.settings.token,n,{transformRequest:angular.identity,headers:{"Content-Type":void 0}}).then((function(e){(e=e.data).id?(h.errors={},j(v()({body:''+e.name+"",AttachmentId:e.id},t.visitor))):k("sendAttachment")}),k("sendAttachment"))},h.handleSizeError=Y,e.$on("$destroy",(function(){r.cancel(p),r.cancel(M),p=null,M=null})),t.$on("$download",(function(e,n){n&&n(T()(t.messages))}))}H.$inject=["$scope","$rootScope","$timeout","$interval","$document","$state","$http","$mdToast","api","RemoteStorageService","STORAGE_VISITOR","STORAGE_LAYOUT"];var x=n("./node_modules/lodash.random/index.js"),E=n.n(x),P=n("./node_modules/lodash.clonedeep/index.js"),O=n.n(P),$=n("./node_modules/json-form-data/src/jsonToFormData.js"),A=n.n($);function R(e,t,n,o,r,s,a){const i=this;let d=null,u=null;t.typeField="";const m={showLeafArrayIndexes:!0,includeNullValues:!1,mapping:function(e){return"boolean"==typeof e?+e?"1":"0":e}};function l(){delete i.errors.submit,t.$emit("hide"),i.fields=O()(u),i.form={},i.userForm.$setPristine(),i.userForm.$setUntouched();const e=r.simple().textContent(t.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));r.show(e)}i.trustAsHtml=function(e){return n.trustAsHtml(e)},i.initUploadButton=function(t){const n=i.fields[t],o=s.find(".upload-item");if(o.length){const t=angular.element(o[0].querySelector(".upload-button")),r=angular.element(o[0].querySelector("input[type=file]")),s=t.find("label");s.length&&s.css("display","none"),t.on("click",(()=>{s.css("display","none"),"function"==typeof r.trigger?r.trigger("click"):r[0].click()})),r.on("change",(t=>{e.$apply((function(){"string"==typeof n.props.error&&(n.props.error=null);const e=Array.from(t.target.files),o=1048576*n.config.size;e.some((e=>e.size>=o))?(n.options=[],n.props.error=n.config.sizeErrMessage):n.options=e.map((e=>{const{name:t,size:n,type:o}=e;return{name:t,size:n,type:o,file:e}})),i.form[n.props.title]=n.options}))}))}},i.removeFileItem=function(e,t){e.options.splice(t,1),i.form[e.props.title]=e.options},i.setupFileInput=function(e){console.log("form item setup",e);const t=s.find(".upload-item"),n=angular.element(t[0].querySelector("input[type=file]")),{multipleUpload:o,accept:r}=e.config;o&&n.attr("multiple","multiple"),r&&n[0].setAttribute("accept",r)},i.makeFileOptionsVisible=function(){const e=Array.from(s.find(".filename-label")),t=e[e.length-1];t&&t.scrollIntoView&&t.scrollIntoView()},i.$onInit=function(){console.debug("OfflineController::onInit() VISITOR",t.visitor),t.status="offline",i.visitor={id:t.settings.id,mapKeyOffline:"firstName",from:"Anonymous"+E()(1,1e6)},t.settings.showMenu=!1,t.loading=!1,o.chatWebsite.getFields({id:t.settings.id,online:!1}).$promise.then((function(e){e.count&&(d=e.fromKey,u=O()(e.rows),i.fields=O()(u))})).then((function(){for(let e=0;e]+)>)/i);i.checkHTML[e]=t(n.props.helpText)}}})).catch((function(e){console.error(e)}))},i.submit=function(){t.loading=!0;const e={...i.form};for(let n=0;ne.file))))}const n=Array.isArray(i.fields)?i.fields.filter((e=>"upload"===e.type)):[],s=v()({body:e},i.visitor),u=null!=e&&n.length>0,c=null!==e&&"{}"!==JSON.stringify(e);var h,f;(u?(h=s,a({url:`${o.baseUrl}chat/websites/${h.id}/offline`,headers:{"Content-Type":void 0},data:A()(h,{...m,initialFormData:new FormData}),method:"POST"})):c?o.chatWebsite.offline(s).$promise:Promise.reject("INVALID_FORM")).then(l).catch((f="submit",function(e){const n=r.simple().textContent(t.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").parent(angular.element(document.querySelector("#chat-toolbar")));r.show(n),i.errors[f]=e.data})).finally((()=>{i.form.invalid||(i.form={}),t.loading=!1}))},i.toggle=function(e,t){i.form[e]||(i.form[e]=[]);const n=i.form[e].indexOf(t);n>-1?i.form[e].splice(n,1):i.form[e].push(t)},i.exists=function(e,t){return i.form[e]||(i.form[e]=[]),i.form[e].indexOf(t)>-1},i.checkHTML=[],i.form={},i.errors={},i.userForm={}}function F(e,t,n,o,r,s){const a=this;let i=null;function d(){return e.visitor={id:e.settings.id,mapKey:"firstName",from:"Anonymous"+E()(1,1e6)},e.settings.showMenu=!1,r.updateStorage(s,e.visitor).then((t=>(e.visitor=t,o.chatWebsite.getFields({id:e.settings.id,online:!0}).$promise.then((function(e){e.count&&(i=e.fromKey,a.fields=e.rows)})).then((function(){for(let e=0;e]+)>)/i);a.checkHTML[e]=n(t.props.helpText)}}})).catch((function(e){console.error(e)}))))).catch(r.onStorageError)}a.checkHTML=[],a.form={},a.errors={},a.userForm={},a.disableItem=!1,a.trustAsHtml=function(e){return n.trustAsHtml(e)},a.$onInit=function(){if(console.debug("OnlineController::onInit() VISITOR",e.visitor),e.status="online",e.visitor&&e.visitor.interaction)if(e.visitor.interaction.id)if(!0===e.visitor.interactionStarted)t.go("app.chat",null,{location:"replace"});else{var n,r;const t=e.visitor.interaction.id,s=null==e||null===(n=e.visitor)||void 0===n||null===(r=n.message)||void 0===r?void 0:r.id;if(s){const e={id:t,channel:"chat",interaction:{id:t},message:{id:s},disposition:"abandoned",closed:!0,closeReason:"contact"};o.chatInteraction.abandon(e).$promise.finally((()=>d()))}}else t.go("app.waiting",null,{location:"replace"});else d()},a.submit=function(){let n="New chat request \n";for(let t=0;t{e.visitor=t})).catch(r.onStorageError),a.disableItem=!1,e.settings.enableCustomerWriting?t.go("app.chat",null,{location:"replace"}):t.go("app.waiting",null,{location:"replace"})})).catch((function(e){a.disableItem=!1,console.error(e)}))},a.toggle=function(e,t){a.form[e]||(a.form[e]=[]);const n=a.form[e].indexOf(t);n>-1?a.form[e].splice(n,1):a.form[e].push(t)},a.exists=function(e,t){return a.form[e]||(a.form[e]=[]),a.form[e].indexOf(t)>-1}}function W(e,t,n,o,r,s,a,i){const d=this;function u(){e.settings.online?t.go("app.online",null,{location:"replace"}):t.go("app.offline",null,{location:"replace"})}function m(){d.form={},d.upColor=null,d.downColor=null,d.userForm.$setPristine(),d.userForm.$setUntouched(),e.visitor={},e.enableDownload=!1,e.$emit("hide")}function l(t){return function(o){d.errors[t]=o.data;const r=n.simple().textContent(e.settings.formSubmitFailureMessage||"Form submission error").toastClass("md-failure-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(r)}}function _(){e.loading=!1}d.form={},d.errors={},d.$onInit=function(){console.debug("UnmanagedController::onInit() VISITOR",e.visitor),e.status="unmanaged",r.all([s.removeItem(a).then((()=>console.debug("STORAGE_VISITOR cleared"))).catch(s.onStorageError),s.removeItem(i).then((()=>console.debug("STORAGE_LAYOUT cleared"))).catch(s.onStorageError)]).then((()=>e.loading=!1))},d.submit=function(){e.loading=!0,e.visitor.interaction&&e.visitor.interaction.id?o.chatInteraction.customUpdate({id:e.visitor.interaction.id,note:d.form.note}).$promise.then((function(){delete d.errors.submit;const t=n.simple().textContent(e.settings.formSubmitSuccessMessage||"Form properly submitted").toastClass("md-success-toast").parent(angular.element(document.querySelector("#chat-toolbar")));n.show(t)})).then(m).then(u).catch(l("submit")).finally(_):(_(),l("submit"))},d.skip=function(){m(),u()}}function C(e,t,n,o,r,s,a){let i=null;function d(){let t={},n=!1;r.chatInteraction.get({id:e.visitor.interaction.id}).$promise.then((function(n){return t=n,r.chatInteraction.getMessages({intid:e.visitor.interaction.id}).$promise})).then((function(r){n=r.rows.length>1,t.closed?(e.visitor.interaction.closed=!0,s.updateStorage(a,e.visitor).then((n=>{e.visitor=n,"unmanaged"===t.disposition&&o.go("app.unmanaged",null,{location:"replace"})})).catch(s.onStorageError)):(t.UserId||n)&&(t.UserId&&(e.visitor.interaction.UserId=t.UserId),s.updateStorage(a,{...e.visitor,interactionStarted:!0}).then((t=>{e.visitor=t,o.go("app.chat",null,{location:"replace"})})).catch(s.onStorageError))})).catch((function(e){switch(e.status){case 403:o.go("app.closing",null,{location:"replace"});break;case 405:o.go("app.unmanaged",null,{location:"replace"});break;default:console.error(e)}}))}this.$onInit=function(){console.debug("WaitingController::onInit() VISITOR",e.visitor),e.status="waiting",e.visitor&&e.visitor.interaction&&e.visitor.interaction.id&&(i=n(d,3e3))},t.$on("$destroy",(function(){n.cancel(i)}))}function I(e,t){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.add(e)}function z(e,t,n){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return n}R.$inject=["$scope","$rootScope","$sce","api","$mdToast","$element","$http"],F.$inject=["$rootScope","$state","$sce","api","RemoteStorageService","STORAGE_VISITOR"],W.$inject=["$rootScope","$state","$mdToast","api","$q","RemoteStorageService","STORAGE_VISITOR","STORAGE_LAYOUT"],C.$inject=["$rootScope","$scope","$interval","$state","api","RemoteStorageService","STORAGE_VISITOR"];var J=new WeakSet,V=new WeakSet;class N{constructor(e,t,n){I(this,V),I(this,J),this.remoteAddress=new URL(t.settings.address).origin,this.location=t.settings.location,this.$q=n,this.$window=e}setItem(e,t){const n="setItem";return this.$q((o=>{z(this,J,U).call(this,n,e,(()=>{o()})),this.$window.parent.postMessage({action:n,key:e,value:t},this.remoteAddress)}))}getItem(e){const t="getItem";return this.$q((n=>{z(this,J,U).call(this,t,e,((e,t)=>{n(t)})),this.$window.parent.postMessage({action:t,key:e},this.remoteAddress)}))}removeItem(e){const t="removeItem";return this.$q((n=>{z(this,J,U).call(this,t,e,(()=>{n()})),this.$window.parent.postMessage({action:t,key:e},this.remoteAddress)}))}updateStorage(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.getItem(e).then((o=>{const r=z(this,V,q).call(this,o)||{};return n?delete r[this.location]:r[this.location]=t,this.setItem(e,r).then((()=>r[this.location]))}))}onStorageError(e){console.error("Storage Error",e)}}function U(e,t,n){const o=r=>{const s=`${e}Result`;if(r.origin===this.remoteAddress&&t===r.data.key&&s===r.data.action){const{action:e,item:s}=r.data;switch(console.debug(`[Key = ${t}] Action "${e}" event from parent`,r),e){case"setItemResult":n(t);break;case"getItemResult":n(t,s);break;case"removeItemResult":n(t);break;default:console.debug("Unsupported action",e)}this.$window.removeEventListener("message",o,!1)}};this.$window.addEventListener("message",o,!1)}function q(e){let t=e;if("string"==typeof t)try{t=JSON.parse(e)}catch(n){console.warn(`Could not parse "${e}"`,n),t=e}return t}function G(e){return function(t){return e.trustAsHtml(t)}}N.$inject=["$window","$rootScope","$q"],G.$inject=["$sce"],angular.module("motion-chat",["ngAnimate","ngAria","ngMessages","ngMaterial","ngResource","ngSanitize","ngCsv","ngEmbed","ui.router","LocalStorageModule","ngRateIt","flow"]).filter("toTrusted",G).constant("STORAGE_PREFIX","motion_chat").constant("STORAGE_VISITOR","visitor").constant("STORAGE_LAYOUT","layout").service("RemoteStorageService",N).directive("ngEnter",(function(){return function(e,t,n){t.bind("keydown keypress",(function(t){13===t.which&&(e.$apply((function(){e.$eval(n.ngEnter)})),t.preventDefault())}))}})).directive("ngPrint",(function(){return{link:function(e,t){t.on("click",(function(){document.getElementById("chatContent1")&&function(e,t){const n=document.createElement("div"),o=t.visitor,r=t.settings;let a;for(let e=0;e"+document.title+""),i.document.write(""),i.document.write("

Website: "+r.referer+"

"),i.document.write("

Start Time: "+s()(a).format("YYYY-MM-DD HH:mm:ss")+"

"),i.document.write("

Print Time: "+s()().format("YYYY-MM-DD HH:mm:ss")+"

"),i.document.write(n.innerHTML),i.document.write(""),i.document.close(),i.focus(),i.print(),i.close()}(0,e)}))},restrict:"A"}})).controller("ChatController",H).controller("ClosingController",k).config(["$mdGestureProvider",function(e){e.skipClickHijack()}]).controller("IndexController",d).factory("api",j).config(g).run(L).controller("OfflineController",R).config(["$mdGestureProvider",function(e){e.skipClickHijack()}]).controller("OnlineController",F).controller("UnmanagedController",W).controller("WaitingController",C)},"./node_modules/expose-loader/dist/runtime/getGlobalThis.js":(e,t,n)=>{"use strict";e.exports=function(){if("object"==typeof globalThis)return globalThis;var e;try{e=this||new Function("return this")()}catch(e){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==n.g)return n.g}return e}()},"./node_modules/json-form-data/src/jsonToFormData.js":function(e,t){var n,o;(o=this)||(o={}),void 0===(n=function(){return o.jsonToFormData=function(){function e(e){return"[object Array]"==={}.toString.call(e)}function t(t){return!(e(t)||"object"!=typeof t||!t||t instanceof Blob||t instanceof Date)}function n(){return"function"==typeof FormData}function o(){if(n())return new FormData}function r(n,o,s,a){var i=0;for(var d in n){if(n.hasOwnProperty(d)){var u=a||d,m=o.mapping(n[d]);if(a&&t(n)&&(u=a+"["+d+"]"),a&&e(n)&&(u=e(m)||o.showLeafArrayIndexes?a+"["+i+"]":a+"[]"),e(m)||t(m))r(m,o,s,u);else if(m instanceof FileList)for(var l=0;l=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-dz.js":function(e,t,n){!function(e){"use strict";var t=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},n={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},o=function(e){return function(o,r,s,a){var i=t(o),d=n[e][t(o)];return 2===i&&(d=d[r?0:1]),d.replace(/%d/i,o)}},r=["جانفي","فيفري","مارس","أفريل","ماي","جوان","جويلية","أوت","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-dz",{months:r,monthsShort:r,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:o("s"),ss:o("s"),m:o("m"),mm:o("m"),h:o("h"),hh:o("h"),d:o("d"),dd:o("d"),M:o("M"),MM:o("M"),y:o("y"),yy:o("y")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:0,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-kw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-kw",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:0,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-ly.js":function(e,t,n){!function(e){"use strict";var t={1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9",0:"0"},n=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},o={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},r=function(e){return function(t,r,s,a){var i=n(t),d=o[e][n(t)];return 2===i&&(d=d[r?0:1]),d.replace(/%d/i,t)}},s=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar-ly",{months:s,monthsShort:s,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:r("s"),ss:r("s"),m:r("m"),mm:r("m"),h:r("h"),hh:r("h"),d:r("d"),dd:r("d"),M:r("M"),MM:r("M"),y:r("y"),yy:r("y")},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-ma.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-sa.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"};e.defineLocale("ar-sa",{months:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar-tn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ar-tn",{months:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),monthsShort:"جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",ss:"%d ثانية",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ar.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},o=function(e){return 0===e?0:1===e?1:2===e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},r={s:["أقل من ثانية","ثانية واحدة",["ثانيتان","ثانيتين"],"%d ثوان","%d ثانية","%d ثانية"],m:["أقل من دقيقة","دقيقة واحدة",["دقيقتان","دقيقتين"],"%d دقائق","%d دقيقة","%d دقيقة"],h:["أقل من ساعة","ساعة واحدة",["ساعتان","ساعتين"],"%d ساعات","%d ساعة","%d ساعة"],d:["أقل من يوم","يوم واحد",["يومان","يومين"],"%d أيام","%d يومًا","%d يوم"],M:["أقل من شهر","شهر واحد",["شهران","شهرين"],"%d أشهر","%d شهرا","%d شهر"],y:["أقل من عام","عام واحد",["عامان","عامين"],"%d أعوام","%d عامًا","%d عام"]},s=function(e){return function(t,n,s,a){var i=o(t),d=r[e][o(t)];return 2===i&&(d=d[n?0:1]),d.replace(/%d/i,t)}},a=["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"];e.defineLocale("ar",{months:a,monthsShort:a,weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/‏M/‏YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/ص|م/,isPM:function(e){return"م"===e},meridiem:function(e,t,n){return e<12?"ص":"م"},calendar:{sameDay:"[اليوم عند الساعة] LT",nextDay:"[غدًا عند الساعة] LT",nextWeek:"dddd [عند الساعة] LT",lastDay:"[أمس عند الساعة] LT",lastWeek:"dddd [عند الساعة] LT",sameElse:"L"},relativeTime:{future:"بعد %s",past:"منذ %s",s:s("s"),ss:s("s"),m:s("m"),mm:s("m"),h:s("h"),hh:s("h"),d:s("d"),dd:s("d"),M:s("M"),MM:s("M"),y:s("y"),yy:s("y")},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/az.js":function(e,t,n){!function(e){"use strict";var t={1:"-inci",5:"-inci",8:"-inci",70:"-inci",80:"-inci",2:"-nci",7:"-nci",20:"-nci",50:"-nci",3:"-üncü",4:"-üncü",100:"-üncü",6:"-ncı",9:"-uncu",10:"-uncu",30:"-uncu",60:"-ıncı",90:"-ıncı"};e.defineLocale("az",{months:"yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),monthsShort:"yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),weekdays:"Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),weekdaysShort:"Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),weekdaysMin:"Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[sabah saat] LT",nextWeek:"[gələn həftə] dddd [saat] LT",lastDay:"[dünən] LT",lastWeek:"[keçən həftə] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s əvvəl",s:"bir neçə saniyə",ss:"%d saniyə",m:"bir dəqiqə",mm:"%d dəqiqə",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir il",yy:"%d il"},meridiemParse:/gecə|səhər|gündüz|axşam/,isPM:function(e){return/^(gündüz|axşam)$/.test(e)},meridiem:function(e,t,n){return e<4?"gecə":e<12?"səhər":e<17?"gündüz":"axşam"},dayOfMonthOrdinalParse:/\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,ordinal:function(e){if(0===e)return e+"-ıncı";var n=e%10;return e+(t[n]||t[e%100-n]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/be.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"хвіліна":"хвіліну":"h"===n?t?"гадзіна":"гадзіну":e+" "+(o=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"хвіліна_хвіліны_хвілін":"хвіліну_хвіліны_хвілін",hh:t?"гадзіна_гадзіны_гадзін":"гадзіну_гадзіны_гадзін",dd:"дзень_дні_дзён",MM:"месяц_месяцы_месяцаў",yy:"год_гады_гадоў"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}e.defineLocale("be",{months:{format:"студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),standalone:"студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")},monthsShort:"студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),weekdays:{format:"нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),standalone:"нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),isFormat:/\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/},weekdaysShort:"нд_пн_ат_ср_чц_пт_сб".split("_"),weekdaysMin:"нд_пн_ат_ср_чц_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., HH:mm",LLLL:"dddd, D MMMM YYYY г., HH:mm"},calendar:{sameDay:"[Сёння ў] LT",nextDay:"[Заўтра ў] LT",lastDay:"[Учора ў] LT",nextWeek:function(){return"[У] dddd [ў] LT"},lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return"[У мінулую] dddd [ў] LT";case 1:case 2:case 4:return"[У мінулы] dddd [ў] LT"}},sameElse:"L"},relativeTime:{future:"праз %s",past:"%s таму",s:"некалькі секунд",m:t,mm:t,h:t,hh:t,d:"дзень",dd:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночы|раніцы|дня|вечара/,isPM:function(e){return/^(дня|вечара)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночы":e<12?"раніцы":e<17?"дня":"вечара"},dayOfMonthOrdinalParse:/\d{1,2}-(і|ы|га)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e%10!=2&&e%10!=3||e%100==12||e%100==13?e+"-ы":e+"-і";case"D":return e+"-га";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bg.js":function(e,t,n){!function(e){"use strict";e.defineLocale("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Миналата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[Миналия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",ss:"%d секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",w:"седмица",ww:"%d седмици",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bm.js":function(e,t,n){!function(e){"use strict";e.defineLocale("bm",{months:"Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo".split("_"),monthsShort:"Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des".split("_"),weekdays:"Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri".split("_"),weekdaysShort:"Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib".split("_"),weekdaysMin:"Ka_Nt_Ta_Ar_Al_Ju_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"MMMM [tile] D [san] YYYY",LLL:"MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm",LLLL:"dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm"},calendar:{sameDay:"[Bi lɛrɛ] LT",nextDay:"[Sini lɛrɛ] LT",nextWeek:"dddd [don lɛrɛ] LT",lastDay:"[Kunu lɛrɛ] LT",lastWeek:"dddd [tɛmɛnen lɛrɛ] LT",sameElse:"L"},relativeTime:{future:"%s kɔnɔ",past:"a bɛ %s bɔ",s:"sanga dama dama",ss:"sekondi %d",m:"miniti kelen",mm:"miniti %d",h:"lɛrɛ kelen",hh:"lɛrɛ %d",d:"tile kelen",dd:"tile %d",M:"kalo kelen",MM:"kalo %d",y:"san kelen",yy:"san %d"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bn-bd.js":function(e,t,n){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn-bd",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t?e<4?e:e+12:"ভোর"===t||"সকাল"===t?e:"দুপুর"===t?e>=3?e:e+12:"বিকাল"===t||"সন্ধ্যা"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"রাত":e<6?"ভোর":e<12?"সকাল":e<15?"দুপুর":e<18?"বিকাল":e<20?"সন্ধ্যা":"রাত"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bn.js":function(e,t,n){!function(e){"use strict";var t={1:"১",2:"২",3:"৩",4:"৪",5:"৫",6:"৬",7:"৭",8:"৮",9:"৯",0:"০"},n={"১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৯":"9","০":"0"};e.defineLocale("bn",{months:"জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),monthsShort:"জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),weekdays:"রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),weekdaysShort:"রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),weekdaysMin:"রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি".split("_"),longDateFormat:{LT:"A h:mm সময়",LTS:"A h:mm:ss সময়",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm সময়",LLLL:"dddd, D MMMM YYYY, A h:mm সময়"},calendar:{sameDay:"[আজ] LT",nextDay:"[আগামীকাল] LT",nextWeek:"dddd, LT",lastDay:"[গতকাল] LT",lastWeek:"[গত] dddd, LT",sameElse:"L"},relativeTime:{future:"%s পরে",past:"%s আগে",s:"কয়েক সেকেন্ড",ss:"%d সেকেন্ড",m:"এক মিনিট",mm:"%d মিনিট",h:"এক ঘন্টা",hh:"%d ঘন্টা",d:"এক দিন",dd:"%d দিন",M:"এক মাস",MM:"%d মাস",y:"এক বছর",yy:"%d বছর"},preparse:function(e){return e.replace(/[১২৩৪৫৬৭৮৯০]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/রাত|সকাল|দুপুর|বিকাল|রাত/,meridiemHour:function(e,t){return 12===e&&(e=0),"রাত"===t&&e>=4||"দুপুর"===t&&e<5||"বিকাল"===t?e+12:e},meridiem:function(e,t,n){return e<4?"রাত":e<10?"সকাল":e<17?"দুপুর":e<20?"বিকাল":"রাত"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bo.js":function(e,t,n){!function(e){"use strict";var t={1:"༡",2:"༢",3:"༣",4:"༤",5:"༥",6:"༦",7:"༧",8:"༨",9:"༩",0:"༠"},n={"༡":"1","༢":"2","༣":"3","༤":"4","༥":"5","༦":"6","༧":"7","༨":"8","༩":"9","༠":"0"};e.defineLocale("bo",{months:"ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),monthsShort:"ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12".split("_"),monthsShortRegex:/^(ཟླ་\d{1,2})/,monthsParseExact:!0,weekdays:"གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),weekdaysShort:"ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),weekdaysMin:"ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[དི་རིང] LT",nextDay:"[སང་ཉིན] LT",nextWeek:"[བདུན་ཕྲག་རྗེས་མ], LT",lastDay:"[ཁ་སང] LT",lastWeek:"[བདུན་ཕྲག་མཐའ་མ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ལ་",past:"%s སྔན་ལ",s:"ལམ་སང",ss:"%d སྐར་ཆ།",m:"སྐར་མ་གཅིག",mm:"%d སྐར་མ",h:"ཆུ་ཚོད་གཅིག",hh:"%d ཆུ་ཚོད",d:"ཉིན་གཅིག",dd:"%d ཉིན་",M:"ཟླ་བ་གཅིག",MM:"%d ཟླ་བ",y:"ལོ་གཅིག",yy:"%d ལོ"},preparse:function(e){return e.replace(/[༡༢༣༤༥༦༧༨༩༠]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,meridiemHour:function(e,t){return 12===e&&(e=0),"མཚན་མོ"===t&&e>=4||"ཉིན་གུང"===t&&e<5||"དགོང་དག"===t?e+12:e},meridiem:function(e,t,n){return e<4?"མཚན་མོ":e<10?"ཞོགས་ཀས":e<17?"ཉིན་གུང":e<20?"དགོང་དག":"མཚན་མོ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/br.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return e+" "+function(e,t){return 2===t?function(e){var t={m:"v",b:"v",d:"z"};return void 0===t[e.charAt(0)]?e:t[e.charAt(0)]+e.substring(1)}(e):e}({mm:"munutenn",MM:"miz",dd:"devezh"}[n],e)}function n(e){return e>9?n(e%10):e}var o=[/^gen/i,/^c[ʼ\']hwe/i,/^meu/i,/^ebr/i,/^mae/i,/^(mez|eve)/i,/^gou/i,/^eos/i,/^gwe/i,/^her/i,/^du/i,/^ker/i],r=/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,s=[/^Su/i,/^Lu/i,/^Me([^r]|$)/i,/^Mer/i,/^Ya/i,/^Gw/i,/^Sa/i];e.defineLocale("br",{months:"Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),weekdaysParse:s,fullWeekdaysParse:[/^sul/i,/^lun/i,/^meurzh/i,/^merc[ʼ\']her/i,/^yaou/i,/^gwener/i,/^sadorn/i],shortWeekdaysParse:[/^Sul/i,/^Lun/i,/^Meu/i,/^Mer/i,/^Yao/i,/^Gwe/i,/^Sad/i],minWeekdaysParse:s,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,monthsShortStrictRegex:/^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY HH:mm",LLLL:"dddd, D [a viz] MMMM YYYY HH:mm"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warcʼhoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Decʼh da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s ʼzo",s:"un nebeud segondennoù",ss:"%d eilenn",m:"ur vunutenn",mm:t,h:"un eur",hh:"%d eur",d:"un devezh",dd:t,M:"ur miz",MM:t,y:"ur bloaz",yy:function(e){switch(n(e)){case 1:case 3:case 4:case 5:case 9:return e+" bloaz";default:return e+" vloaz"}}},dayOfMonthOrdinalParse:/\d{1,2}(añ|vet)/,ordinal:function(e){return e+(1===e?"añ":"vet")},week:{dow:1,doy:4},meridiemParse:/a.m.|g.m./,isPM:function(e){return"g.m."===e},meridiem:function(e,t,n){return e<12?"a.m.":"g.m."}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/bs.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=e+" ";switch(n){case"ss":return o+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"m":return t?"jedna minuta":"jedne minute";case"mm":return o+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return t?"jedan sat":"jednog sata";case"hh":return o+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return o+(1===e?"dan":"dana");case"MM":return o+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return o+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("bs",{months:"januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ca",{months:{standalone:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),format:"de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),monthsParseExact:!0,weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dt_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a les] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a les] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"uns segons",ss:"%d segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(n="a"),e+n},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cs.js":function(e,t,n){!function(e){"use strict";var t="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),n="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_"),o=[/^led/i,/^úno/i,/^bře/i,/^dub/i,/^kvě/i,/^(čvn|červen$|června)/i,/^(čvc|červenec|července)/i,/^srp/i,/^zář/i,/^říj/i,/^lis/i,/^pro/i],r=/^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;function s(e){return e>1&&e<5&&1!=~~(e/10)}function a(e,t,n,o){var r=e+" ";switch(n){case"s":return t||o?"pár sekund":"pár sekundami";case"ss":return t||o?r+(s(e)?"sekundy":"sekund"):r+"sekundami";case"m":return t?"minuta":o?"minutu":"minutou";case"mm":return t||o?r+(s(e)?"minuty":"minut"):r+"minutami";case"h":return t?"hodina":o?"hodinu":"hodinou";case"hh":return t||o?r+(s(e)?"hodiny":"hodin"):r+"hodinami";case"d":return t||o?"den":"dnem";case"dd":return t||o?r+(s(e)?"dny":"dní"):r+"dny";case"M":return t||o?"měsíc":"měsícem";case"MM":return t||o?r+(s(e)?"měsíce":"měsíců"):r+"měsíci";case"y":return t||o?"rok":"rokem";case"yy":return t||o?r+(s(e)?"roky":"let"):r+"lety"}}e.defineLocale("cs",{months:t,monthsShort:n,monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,monthsShortStrictRegex:/^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm",l:"D. M. YYYY"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:a,ss:a,m:a,mm:a,h:a,hh:a,d:a,dd:a,M:a,MM:a,y:a,yy:a},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("cv",{months:"кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),monthsShort:"кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кҫ_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",LLL:"YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",LLLL:"dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ӗнер] LT [сехетре]",nextWeek:"[Ҫитес] dddd LT [сехетре]",lastWeek:"[Иртнӗ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(e){return e+(/сехет$/i.exec(e)?"рен":/ҫул$/i.exec(e)?"тан":"ран")},past:"%s каялла",s:"пӗр-ик ҫеккунт",ss:"%d ҫеккунт",m:"пӗр минут",mm:"%d минут",h:"пӗр сехет",hh:"%d сехет",d:"пӗр кун",dd:"%d кун",M:"пӗр уйӑх",MM:"%d уйӑх",y:"пӗр ҫул",yy:"%d ҫул"},dayOfMonthOrdinalParse:/\d{1,2}-мӗш/,ordinal:"%d-мӗш",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/cy.js":function(e,t,n){!function(e){"use strict";e.defineLocale("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn ôl",s:"ychydig eiliadau",ss:"%d eiliad",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},dayOfMonthOrdinalParse:/\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,ordinal:function(e){var t="";return e>20?t=40===e||50===e||60===e||80===e||100===e?"fed":"ain":e>0&&(t=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"][e]),e+t},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/da.js":function(e,t,n){!function(e){"use strict";e.defineLocale("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd [d.] D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"på dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[i] dddd[s kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",ss:"%d sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de-at.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de-at",{months:"Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de-ch.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de-ch",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/de.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[e+" Tage",e+" Tagen"],w:["eine Woche","einer Woche"],M:["ein Monat","einem Monat"],MM:[e+" Monate",e+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[e+" Jahre",e+" Jahren"]};return t?r[n][0]:r[n][1]}e.defineLocale("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm",LLLL:"dddd, D. MMMM YYYY HH:mm"},calendar:{sameDay:"[heute um] LT [Uhr]",sameElse:"L",nextDay:"[morgen um] LT [Uhr]",nextWeek:"dddd [um] LT [Uhr]",lastDay:"[gestern um] LT [Uhr]",lastWeek:"[letzten] dddd [um] LT [Uhr]"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",ss:"%d Sekunden",m:t,mm:"%d Minuten",h:t,hh:"%d Stunden",d:t,dd:t,w:t,ww:"%d Wochen",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/dv.js":function(e,t,n){!function(e){"use strict";var t=["ޖެނުއަރީ","ފެބްރުއަރީ","މާރިޗު","އޭޕްރީލު","މޭ","ޖޫން","ޖުލައި","އޯގަސްޓު","ސެޕްޓެމްބަރު","އޮކްޓޯބަރު","ނޮވެމްބަރު","ޑިސެމްބަރު"],n=["އާދިއްތަ","ހޯމަ","އަންގާރަ","ބުދަ","ބުރާސްފަތި","ހުކުރު","ހޮނިހިރު"];e.defineLocale("dv",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:"އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"D/M/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},meridiemParse:/މކ|މފ/,isPM:function(e){return"މފ"===e},meridiem:function(e,t,n){return e<12?"މކ":"މފ"},calendar:{sameDay:"[މިއަދު] LT",nextDay:"[މާދަމާ] LT",nextWeek:"dddd LT",lastDay:"[އިއްޔެ] LT",lastWeek:"[ފާއިތުވި] dddd LT",sameElse:"L"},relativeTime:{future:"ތެރޭގައި %s",past:"ކުރިން %s",s:"ސިކުންތުކޮޅެއް",ss:"d% ސިކުންތު",m:"މިނިޓެއް",mm:"މިނިޓު %d",h:"ގަޑިއިރެއް",hh:"ގަޑިއިރު %d",d:"ދުވަހެއް",dd:"ދުވަސް %d",M:"މަހެއް",MM:"މަސް %d",y:"އަހަރެއް",yy:"އަހަރު %d"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:7,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/el.js":function(e,t,n){!function(e){"use strict";e.defineLocale("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(e,t){return e?"string"==typeof t&&/D/.test(t.substring(0,t.indexOf("MMMM")))?this._monthsGenitiveEl[e.month()]:this._monthsNominativeEl[e.month()]:this._monthsNominativeEl},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(e,t,n){return e>11?n?"μμ":"ΜΜ":n?"πμ":"ΠΜ"},isPM:function(e){return"μ"===(e+"").toLowerCase()[0]},meridiemParse:/[ΠΜ]\.?Μ?\.?/i,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:function(){switch(this.day()){case 6:return"[το προηγούμενο] dddd [{}] LT";default:return"[την προηγούμενη] dddd [{}] LT"}},sameElse:"L"},calendar:function(e,t){var n,o=this._calendarEl[e],r=t&&t.hours();return n=o,("undefined"!=typeof Function&&n instanceof Function||"[object Function]"===Object.prototype.toString.call(n))&&(o=o.apply(t)),o.replace("{}",r%12==1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"λίγα δευτερόλεπτα",ss:"%d δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},dayOfMonthOrdinalParse:/\d{1,2}η/,ordinal:"%dη",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-au.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-gb.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-ie.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-ie",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-il.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-il",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-in.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-in",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-nz.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-nz",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/en-sg.js":function(e,t,n){!function(e){"use strict";e.defineLocale("en-sg",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/eo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec".split("_"),weekdays:"dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),weekdaysShort:"dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),weekdaysMin:"di_lu_ma_me_ĵa_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"[la] D[-an de] MMMM, YYYY",LLL:"[la] D[-an de] MMMM, YYYY HH:mm",LLLL:"dddd[n], [la] D[-an de] MMMM, YYYY HH:mm",llll:"ddd, [la] D[-an de] MMM, YYYY HH:mm"},meridiemParse:/[ap]\.t\.m/i,isPM:function(e){return"p"===e.charAt(0).toLowerCase()},meridiem:function(e,t,n){return e>11?n?"p.t.m.":"P.T.M.":n?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd[n je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasintan] dddd[n je] LT",sameElse:"L"},relativeTime:{future:"post %s",past:"antaŭ %s",s:"kelkaj sekundoj",ss:"%d sekundoj",m:"unu minuto",mm:"%d minutoj",h:"unu horo",hh:"%d horoj",d:"unu tago",dd:"%d tagoj",M:"unu monato",MM:"%d monatoj",y:"unu jaro",yy:"%d jaroj"},dayOfMonthOrdinalParse:/\d{1,2}a/,ordinal:"%da",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-do.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-do",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-mx.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-mx",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:4},invalidDate:"Fecha inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es-us.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es-us",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"MM/DD/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY h:mm A",LLLL:"dddd, D [de] MMMM [de] YYYY h:mm A"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/es.js":function(e,t,n){!function(e){"use strict";var t="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),n="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),o=[/^ene/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i],r=/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;e.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,monthsShortStrictRegex:/^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",w:"una semana",ww:"%d semanas",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4},invalidDate:"Fecha inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/et.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["mõne sekundi","mõni sekund","paar sekundit"],ss:[e+"sekundi",e+"sekundit"],m:["ühe minuti","üks minut"],mm:[e+" minuti",e+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[e+" tunni",e+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[e+" kuu",e+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[e+" aasta",e+" aastat"]};return t?r[n][2]?r[n][2]:r[n][1]:o?r[n][0]:r[n][1]}e.defineLocale("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:"%d päeva",M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/eu.js":function(e,t,n){!function(e){"use strict";e.defineLocale("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),monthsParseExact:!0,weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",ss:"%d segundo",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fa.js":function(e,t,n){!function(e){"use strict";var t={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},n={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};e.defineLocale("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/قبل از ظهر|بعد از ظهر/,isPM:function(e){return/بعد از ظهر/.test(e)},meridiem:function(e,t,n){return e<12?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",ss:"%d ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(e){return e.replace(/[۰-۹]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},dayOfMonthOrdinalParse:/\d{1,2}م/,ordinal:"%dم",week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fi.js":function(e,t,n){!function(e){"use strict";var t="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),n=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",t[7],t[8],t[9]];function o(e,o,r,s){var a="";switch(r){case"s":return s?"muutaman sekunnin":"muutama sekunti";case"ss":a=s?"sekunnin":"sekuntia";break;case"m":return s?"minuutin":"minuutti";case"mm":a=s?"minuutin":"minuuttia";break;case"h":return s?"tunnin":"tunti";case"hh":a=s?"tunnin":"tuntia";break;case"d":return s?"päivän":"päivä";case"dd":a=s?"päivän":"päivää";break;case"M":return s?"kuukauden":"kuukausi";case"MM":a=s?"kuukauden":"kuukautta";break;case"y":return s?"vuoden":"vuosi";case"yy":a=s?"vuoden":"vuotta"}return function(e,o){return e<10?o?n[e]:t[e]:e}(e,s)+" "+a}e.defineLocale("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] HH.mm",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] HH.mm",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] HH.mm",llll:"ddd, Do MMM YYYY, [klo] HH.mm"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:o,ss:o,m:o,mm:o,h:o,hh:o,d:o,dd:o,M:o,MM:o,y:o,yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fil.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fil",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D. MMMM, YYYY HH:mm"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",ss:"%d sekundir",m:"ein minuttur",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaður",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr-ca.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(e,t){switch(t){default:case"M":case"Q":case"D":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr-ch.js":function(e,t,n){!function(e){"use strict";e.defineLocale("fr-ch",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsParseExact:!0,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|e)/,ordinal:function(e,t){switch(t){default:case"M":case"Q":case"D":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fr.js":function(e,t,n){!function(e){"use strict";var t=/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,n=[/^janv/i,/^févr/i,/^mars/i,/^avr/i,/^mai/i,/^juin/i,/^juil/i,/^août/i,/^sept/i,/^oct/i,/^nov/i,/^déc/i];e.defineLocale("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),monthsRegex:t,monthsShortRegex:t,monthsStrictRegex:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,monthsShortStrictRegex:/(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,monthsParse:n,longMonthsParse:n,shortMonthsParse:n,weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Aujourd’hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",ss:"%d secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",w:"une semaine",ww:"%d semaines",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(er|)/,ordinal:function(e,t){switch(t){case"D":return e+(1===e?"er":"");default:case"M":case"Q":case"DDD":case"d":return e+(1===e?"er":"e");case"w":case"W":return e+(1===e?"re":"e")}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/fy.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"),n="jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");e.defineLocale("fy",{months:"jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsParseExact:!0,weekdays:"snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),weekdaysShort:"si._mo._ti._wo._to._fr._so.".split("_"),weekdaysMin:"Si_Mo_Ti_Wo_To_Fr_So".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[hjoed om] LT",nextDay:"[moarn om] LT",nextWeek:"dddd [om] LT",lastDay:"[juster om] LT",lastWeek:"[ôfrûne] dddd [om] LT",sameElse:"L"},relativeTime:{future:"oer %s",past:"%s lyn",s:"in pear sekonden",ss:"%d sekonden",m:"ien minút",mm:"%d minuten",h:"ien oere",hh:"%d oeren",d:"ien dei",dd:"%d dagen",M:"ien moanne",MM:"%d moannen",y:"ien jier",yy:"%d jierren"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ga.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ga",{months:["Eanáir","Feabhra","Márta","Aibreán","Bealtaine","Meitheamh","Iúil","Lúnasa","Meán Fómhair","Deireadh Fómhair","Samhain","Nollaig"],monthsShort:["Ean","Feabh","Márt","Aib","Beal","Meith","Iúil","Lún","M.F.","D.F.","Samh","Noll"],monthsParseExact:!0,weekdays:["Dé Domhnaigh","Dé Luain","Dé Máirt","Dé Céadaoin","Déardaoin","Dé hAoine","Dé Sathairn"],weekdaysShort:["Domh","Luan","Máirt","Céad","Déar","Aoine","Sath"],weekdaysMin:["Do","Lu","Má","Cé","Dé","A","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Inniu ag] LT",nextDay:"[Amárach ag] LT",nextWeek:"dddd [ag] LT",lastDay:"[Inné ag] LT",lastWeek:"dddd [seo caite] [ag] LT",sameElse:"L"},relativeTime:{future:"i %s",past:"%s ó shin",s:"cúpla soicind",ss:"%d soicind",m:"nóiméad",mm:"%d nóiméad",h:"uair an chloig",hh:"%d uair an chloig",d:"lá",dd:"%d lá",M:"mí",MM:"%d míonna",y:"bliain",yy:"%d bliain"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gd.js":function(e,t,n){!function(e){"use strict";e.defineLocale("gd",{months:["Am Faoilleach","An Gearran","Am Màrt","An Giblean","An Cèitean","An t-Ògmhios","An t-Iuchar","An Lùnastal","An t-Sultain","An Dàmhair","An t-Samhain","An Dùbhlachd"],monthsShort:["Faoi","Gear","Màrt","Gibl","Cèit","Ògmh","Iuch","Lùn","Sult","Dàmh","Samh","Dùbh"],monthsParseExact:!0,weekdays:["Didòmhnaich","Diluain","Dimàirt","Diciadain","Diardaoin","Dihaoine","Disathairne"],weekdaysShort:["Did","Dil","Dim","Dic","Dia","Dih","Dis"],weekdaysMin:["Dò","Lu","Mà","Ci","Ar","Ha","Sa"],longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[An-diugh aig] LT",nextDay:"[A-màireach aig] LT",nextWeek:"dddd [aig] LT",lastDay:"[An-dè aig] LT",lastWeek:"dddd [seo chaidh] [aig] LT",sameElse:"L"},relativeTime:{future:"ann an %s",past:"bho chionn %s",s:"beagan diogan",ss:"%d diogan",m:"mionaid",mm:"%d mionaidean",h:"uair",hh:"%d uairean",d:"latha",dd:"%d latha",M:"mìos",MM:"%d mìosan",y:"bliadhna",yy:"%d bliadhna"},dayOfMonthOrdinalParse:/\d{1,2}(d|na|mh)/,ordinal:function(e){return e+(1===e?"d":e%10==2?"na":"mh")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gl.js":function(e,t,n){!function(e){"use strict";e.defineLocale("gl",{months:"xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),monthsShort:"xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"domingo_luns_martes_mércores_xoves_venres_sábado".split("_"),weekdaysShort:"dom._lun._mar._mér._xov._ven._sáb.".split("_"),weekdaysMin:"do_lu_ma_mé_xo_ve_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(e){return 0===e.indexOf("un")?"n"+e:"en "+e},past:"hai %s",s:"uns segundos",ss:"%d segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gom-deva.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["थोडया सॅकंडांनी","थोडे सॅकंड"],ss:[e+" सॅकंडांनी",e+" सॅकंड"],m:["एका मिणटान","एक मिनूट"],mm:[e+" मिणटांनी",e+" मिणटां"],h:["एका वरान","एक वर"],hh:[e+" वरांनी",e+" वरां"],d:["एका दिसान","एक दीस"],dd:[e+" दिसांनी",e+" दीस"],M:["एका म्हयन्यान","एक म्हयनो"],MM:[e+" म्हयन्यानी",e+" म्हयने"],y:["एका वर्सान","एक वर्स"],yy:[e+" वर्सांनी",e+" वर्सां"]};return o?r[n][0]:r[n][1]}e.defineLocale("gom-deva",{months:{standalone:"जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),format:"जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार".split("_"),weekdaysShort:"आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.".split("_"),weekdaysMin:"आ_सो_मं_बु_ब्रे_सु_शे".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [वाजतां]",LTS:"A h:mm:ss [वाजतां]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [वाजतां]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [वाजतां]",llll:"ddd, D MMM YYYY, A h:mm [वाजतां]"},calendar:{sameDay:"[आयज] LT",nextDay:"[फाल्यां] LT",nextWeek:"[फुडलो] dddd[,] LT",lastDay:"[काल] LT",lastWeek:"[फाटलो] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s आदीं",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(वेर)/,ordinal:function(e,t){switch(t){case"D":return e+"वेर";default:case"M":case"Q":case"DDD":case"d":case"w":case"W":return e}},week:{dow:0,doy:3},meridiemParse:/राती|सकाळीं|दनपारां|सांजे/,meridiemHour:function(e,t){return 12===e&&(e=0),"राती"===t?e<4?e:e+12:"सकाळीं"===t?e:"दनपारां"===t?e>12?e:e+12:"सांजे"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"राती":e<12?"सकाळीं":e<16?"दनपारां":e<20?"सांजे":"राती"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gom-latn.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["thoddea sekondamni","thodde sekond"],ss:[e+" sekondamni",e+" sekond"],m:["eka mintan","ek minut"],mm:[e+" mintamni",e+" mintam"],h:["eka voran","ek vor"],hh:[e+" voramni",e+" voram"],d:["eka disan","ek dis"],dd:[e+" disamni",e+" dis"],M:["eka mhoinean","ek mhoino"],MM:[e+" mhoineamni",e+" mhoine"],y:["eka vorsan","ek voros"],yy:[e+" vorsamni",e+" vorsam"]};return o?r[n][0]:r[n][1]}e.defineLocale("gom-latn",{months:{standalone:"Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),format:"Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea".split("_"),isFormat:/MMMM(\s)+D[oD]?/},monthsShort:"Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split("_"),weekdaysShort:"Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),weekdaysMin:"Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"A h:mm [vazta]",LTS:"A h:mm:ss [vazta]",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY A h:mm [vazta]",LLLL:"dddd, MMMM Do, YYYY, A h:mm [vazta]",llll:"ddd, D MMM YYYY, A h:mm [vazta]"},calendar:{sameDay:"[Aiz] LT",nextDay:"[Faleam] LT",nextWeek:"[Fuddlo] dddd[,] LT",lastDay:"[Kal] LT",lastWeek:"[Fattlo] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%s",past:"%s adim",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}(er)/,ordinal:function(e,t){switch(t){case"D":return e+"er";default:case"M":case"Q":case"DDD":case"d":case"w":case"W":return e}},week:{dow:0,doy:3},meridiemParse:/rati|sokallim|donparam|sanje/,meridiemHour:function(e,t){return 12===e&&(e=0),"rati"===t?e<4?e:e+12:"sokallim"===t?e:"donparam"===t?e>12?e:e+12:"sanje"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"rati":e<12?"sokallim":e<16?"donparam":e<20?"sanje":"rati"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/gu.js":function(e,t,n){!function(e){"use strict";var t={1:"૧",2:"૨",3:"૩",4:"૪",5:"૫",6:"૬",7:"૭",8:"૮",9:"૯",0:"૦"},n={"૧":"1","૨":"2","૩":"3","૪":"4","૫":"5","૬":"6","૭":"7","૮":"8","૯":"9","૦":"0"};e.defineLocale("gu",{months:"જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર".split("_"),monthsShort:"જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.".split("_"),monthsParseExact:!0,weekdays:"રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર".split("_"),weekdaysShort:"રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ".split("_"),weekdaysMin:"ર_સો_મં_બુ_ગુ_શુ_શ".split("_"),longDateFormat:{LT:"A h:mm વાગ્યે",LTS:"A h:mm:ss વાગ્યે",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm વાગ્યે",LLLL:"dddd, D MMMM YYYY, A h:mm વાગ્યે"},calendar:{sameDay:"[આજ] LT",nextDay:"[કાલે] LT",nextWeek:"dddd, LT",lastDay:"[ગઇકાલે] LT",lastWeek:"[પાછલા] dddd, LT",sameElse:"L"},relativeTime:{future:"%s મા",past:"%s પહેલા",s:"અમુક પળો",ss:"%d સેકંડ",m:"એક મિનિટ",mm:"%d મિનિટ",h:"એક કલાક",hh:"%d કલાક",d:"એક દિવસ",dd:"%d દિવસ",M:"એક મહિનો",MM:"%d મહિનો",y:"એક વર્ષ",yy:"%d વર્ષ"},preparse:function(e){return e.replace(/[૧૨૩૪૫૬૭૮૯૦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/રાત|બપોર|સવાર|સાંજ/,meridiemHour:function(e,t){return 12===e&&(e=0),"રાત"===t?e<4?e:e+12:"સવાર"===t?e:"બપોર"===t?e>=10?e:e+12:"સાંજ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"રાત":e<10?"સવાર":e<17?"બપોર":e<20?"સાંજ":"રાત"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/he.js":function(e,t,n){!function(e){"use strict";e.defineLocale("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY HH:mm",LLLL:"dddd, D [ב]MMMM YYYY HH:mm",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",ss:"%d שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(e){return 2===e?"שעתיים":e+" שעות"},d:"יום",dd:function(e){return 2===e?"יומיים":e+" ימים"},M:"חודש",MM:function(e){return 2===e?"חודשיים":e+" חודשים"},y:"שנה",yy:function(e){return 2===e?"שנתיים":e%10==0&&10!==e?e+" שנה":e+" שנים"}},meridiemParse:/אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,isPM:function(e){return/^(אחה"צ|אחרי הצהריים|בערב)$/.test(e)},meridiem:function(e,t,n){return e<5?"לפנות בוקר":e<10?"בבוקר":e<12?n?'לפנה"צ':"לפני הצהריים":e<18?n?'אחה"צ':"אחרי הצהריים":"בערב"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hi.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"},o=[/^जन/i,/^फ़र|फर/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सितं|सित/i,/^अक्टू/i,/^नव|नवं/i,/^दिसं|दिस/i];e.defineLocale("hi",{months:{format:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),standalone:"जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर".split("_")},monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",LTS:"A h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm बजे",LLLL:"dddd, D MMMM YYYY, A h:mm बजे"},monthsParse:o,longMonthsParse:o,shortMonthsParse:[/^जन/i,/^फ़र/i,/^मार्च/i,/^अप्रै/i,/^मई/i,/^जून/i,/^जुल/i,/^अग/i,/^सित/i,/^अक्टू/i,/^नव/i,/^दिस/i],monthsRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsShortRegex:/^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,monthsStrictRegex:/^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,monthsShortStrictRegex:/^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",ss:"%d सेकंड",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/रात|सुबह|दोपहर|शाम/,meridiemHour:function(e,t){return 12===e&&(e=0),"रात"===t?e<4?e:e+12:"सुबह"===t?e:"दोपहर"===t?e>=10?e:e+12:"शाम"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"रात":e<10?"सुबह":e<17?"दोपहर":e<20?"शाम":"रात"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hr.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=e+" ";switch(n){case"ss":return o+(1===e?"sekunda":2===e||3===e||4===e?"sekunde":"sekundi");case"m":return t?"jedna minuta":"jedne minute";case"mm":return o+(1===e?"minuta":2===e||3===e||4===e?"minute":"minuta");case"h":return t?"jedan sat":"jednog sata";case"hh":return o+(1===e?"sat":2===e||3===e||4===e?"sata":"sati");case"dd":return o+(1===e?"dan":"dana");case"MM":return o+(1===e?"mjesec":2===e||3===e||4===e?"mjeseca":"mjeseci");case"yy":return o+(1===e?"godina":2===e||3===e||4===e?"godine":"godina")}}e.defineLocale("hr",{months:{format:"siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),standalone:"siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")},monthsShort:"sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"Do MMMM YYYY",LLL:"Do MMMM YYYY H:mm",LLLL:"dddd, Do MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:return"[prošlu] [nedjelju] [u] LT";case 3:return"[prošlu] [srijedu] [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",ss:t,m:t,mm:t,h:t,hh:t,d:"dan",dd:t,M:"mjesec",MM:t,y:"godinu",yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hu.js":function(e,t,n){!function(e){"use strict";var t="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");function n(e,t,n,o){var r=e;switch(n){case"s":return o||t?"néhány másodperc":"néhány másodperce";case"ss":return r+(o||t)?" másodperc":" másodperce";case"m":return"egy"+(o||t?" perc":" perce");case"mm":return r+(o||t?" perc":" perce");case"h":return"egy"+(o||t?" óra":" órája");case"hh":return r+(o||t?" óra":" órája");case"d":return"egy"+(o||t?" nap":" napja");case"dd":return r+(o||t?" nap":" napja");case"M":return"egy"+(o||t?" hónap":" hónapja");case"MM":return r+(o||t?" hónap":" hónapja");case"y":return"egy"+(o||t?" év":" éve");case"yy":return r+(o||t?" év":" éve")}return""}function o(e){return(e?"":"[múlt] ")+"["+t[this.day()]+"] LT[-kor]"}e.defineLocale("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D. H:mm",LLLL:"YYYY. MMMM D., dddd H:mm"},meridiemParse:/de|du/i,isPM:function(e){return"u"===e.charAt(1).toLowerCase()},meridiem:function(e,t,n){return e<12?!0===n?"de":"DE":!0===n?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return o.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return o.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:n,ss:n,m:n,mm:n,h:n,hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/hy-am.js":function(e,t,n){!function(e){"use strict";e.defineLocale("hy-am",{months:{format:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),standalone:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")},monthsShort:"հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),weekdays:"կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., HH:mm",LLLL:"dddd, D MMMM YYYY թ., HH:mm"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",ss:"%d վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiemParse:/գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,isPM:function(e){return/^(ցերեկվա|երեկոյան)$/.test(e)},meridiem:function(e){return e<4?"գիշերվա":e<12?"առավոտվա":e<17?"ցերեկվա":"երեկոյան"},dayOfMonthOrdinalParse:/\d{1,2}|\d{1,2}-(ին|րդ)/,ordinal:function(e,t){switch(t){case"DDD":case"w":case"W":case"DDDo":return 1===e?e+"-ին":e+"-րդ";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/id.js":function(e,t,n){!function(e){"use strict";e.defineLocale("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|siang|sore|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"siang"===t?e>=11?e:e+12:"sore"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"siang":e<19?"sore":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",ss:"%d detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/is.js":function(e,t,n){!function(e){"use strict";function t(e){return e%100==11||e%10!=1}function n(e,n,o,r){var s=e+" ";switch(o){case"s":return n||r?"nokkrar sekúndur":"nokkrum sekúndum";case"ss":return t(e)?s+(n||r?"sekúndur":"sekúndum"):s+"sekúnda";case"m":return n?"mínúta":"mínútu";case"mm":return t(e)?s+(n||r?"mínútur":"mínútum"):n?s+"mínúta":s+"mínútu";case"hh":return t(e)?s+(n||r?"klukkustundir":"klukkustundum"):s+"klukkustund";case"d":return n?"dagur":r?"dag":"degi";case"dd":return t(e)?n?s+"dagar":s+(r?"daga":"dögum"):n?s+"dagur":s+(r?"dag":"degi");case"M":return n?"mánuður":r?"mánuð":"mánuði";case"MM":return t(e)?n?s+"mánuðir":s+(r?"mánuði":"mánuðum"):n?s+"mánuður":s+(r?"mánuð":"mánuði");case"y":return n||r?"ár":"ári";case"yy":return t(e)?s+(n||r?"ár":"árum"):s+(n||r?"ár":"ári")}}e.defineLocale("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd, D. MMMM YYYY [kl.] H:mm"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:n,ss:n,m:n,mm:n,h:"klukkustund",hh:n,d:n,dd:n,M:n,MM:n,y:n,yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/it-ch.js":function(e,t,n){!function(e){"use strict";e.defineLocale("it-ch",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:function(){switch(this.day()){case 0:return"[la scorsa] dddd [alle] LT";default:return"[lo scorso] dddd [alle] LT"}},sameElse:"L"},relativeTime:{future:function(e){return(/^[0-9].+$/.test(e)?"tra":"in")+" "+e},past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/it.js":function(e,t,n){!function(e){"use strict";e.defineLocale("it",{months:"gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),monthsShort:"gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),weekdays:"domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),weekdaysShort:"dom_lun_mar_mer_gio_ven_sab".split("_"),weekdaysMin:"do_lu_ma_me_gi_ve_sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:function(){return"[Oggi a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextDay:function(){return"[Domani a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},nextWeek:function(){return"dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastDay:function(){return"[Ieri a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"},lastWeek:function(){switch(this.day()){case 0:return"[La scorsa] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT";default:return"[Lo scorso] dddd [a"+(this.hours()>1?"lle ":0===this.hours()?" ":"ll'")+"]LT"}},sameElse:"L"},relativeTime:{future:"tra %s",past:"%s fa",s:"alcuni secondi",ss:"%d secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",w:"una settimana",ww:"%d settimane",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ja.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ja",{eras:[{since:"2019-05-01",offset:1,name:"令和",narrow:"㋿",abbr:"R"},{since:"1989-01-08",until:"2019-04-30",offset:1,name:"平成",narrow:"㍻",abbr:"H"},{since:"1926-12-25",until:"1989-01-07",offset:1,name:"昭和",narrow:"㍼",abbr:"S"},{since:"1912-07-30",until:"1926-12-24",offset:1,name:"大正",narrow:"㍽",abbr:"T"},{since:"1873-01-01",until:"1912-07-29",offset:6,name:"明治",narrow:"㍾",abbr:"M"},{since:"0001-01-01",until:"1873-12-31",offset:1,name:"西暦",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"紀元前",narrow:"BC",abbr:"BC"}],eraYearOrdinalRegex:/(元|\d+)年/,eraYearOrdinalParse:function(e,t){return"元"===t[1]?1:parseInt(t[1]||e,10)},months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日 dddd HH:mm",l:"YYYY/MM/DD",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日(ddd) HH:mm"},meridiemParse:/午前|午後/i,isPM:function(e){return"午後"===e},meridiem:function(e,t,n){return e<12?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:function(e){return e.week()!==this.week()?"[来週]dddd LT":"dddd LT"},lastDay:"[昨日] LT",lastWeek:function(e){return this.week()!==e.week()?"[先週]dddd LT":"dddd LT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}日/,ordinal:function(e,t){switch(t){case"y":return 1===e?"元年":e+"年";case"d":case"D":case"DDD":return e+"日";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"数秒",ss:"%d秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/jv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("jv",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),weekdays:"Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),weekdaysShort:"Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/enjing|siyang|sonten|ndalu/,meridiemHour:function(e,t){return 12===e&&(e=0),"enjing"===t?e:"siyang"===t?e>=11?e:e+12:"sonten"===t||"ndalu"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"enjing":e<15?"siyang":e<19?"sonten":"ndalu"},calendar:{sameDay:"[Dinten puniko pukul] LT",nextDay:"[Mbenjang pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kala wingi pukul] LT",lastWeek:"dddd [kepengker pukul] LT",sameElse:"L"},relativeTime:{future:"wonten ing %s",past:"%s ingkang kepengker",s:"sawetawis detik",ss:"%d detik",m:"setunggal menit",mm:"%d menit",h:"setunggal jam",hh:"%d jam",d:"sedinten",dd:"%d dinten",M:"sewulan",MM:"%d wulan",y:"setaun",yy:"%d taun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ka.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ka",{months:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:{standalone:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),format:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),isFormat:/(წინა|შემდეგ)/},weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(e){return e.replace(/(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,(function(e,t,n){return"ი"===n?t+"ში":t+n+"ში"}))},past:function(e){return/(წამი|წუთი|საათი|დღე|თვე)/.test(e)?e.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(e)?e.replace(/წელი$/,"წლის წინ"):e},s:"რამდენიმე წამი",ss:"%d წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},dayOfMonthOrdinalParse:/0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,ordinal:function(e){return 0===e?e:1===e?e+"-ლი":e<20||e<=100&&e%20==0||e%100==0?"მე-"+e:e+"-ე"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/kk.js":function(e,t,n){!function(e){"use strict";var t={0:"-ші",1:"-ші",2:"-ші",3:"-ші",4:"-ші",5:"-ші",6:"-шы",7:"-ші",8:"-ші",9:"-шы",10:"-шы",20:"-шы",30:"-шы",40:"-шы",50:"-ші",60:"-шы",70:"-ші",80:"-ші",90:"-шы",100:"-ші"};e.defineLocale("kk",{months:"қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),monthsShort:"қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),weekdays:"жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),weekdaysShort:"жек_дүй_сей_сәр_бей_жұм_сен".split("_"),weekdaysMin:"жк_дй_сй_ср_бй_жм_сн".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгін сағат] LT",nextDay:"[Ертең сағат] LT",nextWeek:"dddd [сағат] LT",lastDay:"[Кеше сағат] LT",lastWeek:"[Өткен аптаның] dddd [сағат] LT",sameElse:"L"},relativeTime:{future:"%s ішінде",past:"%s бұрын",s:"бірнеше секунд",ss:"%d секунд",m:"бір минут",mm:"%d минут",h:"бір сағат",hh:"%d сағат",d:"бір күн",dd:"%d күн",M:"бір ай",MM:"%d ай",y:"бір жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(ші|шы)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/km.js":function(e,t,n){!function(e){"use strict";var t={1:"១",2:"២",3:"៣",4:"៤",5:"៥",6:"៦",7:"៧",8:"៨",9:"៩",0:"០"},n={"១":"1","២":"2","៣":"3","៤":"4","៥":"5","៦":"6","៧":"7","៨":"8","៩":"9","០":"0"};e.defineLocale("km",{months:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysMin:"អា_ច_អ_ព_ព្រ_សុ_ស".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ព្រឹក|ល្ងាច/,isPM:function(e){return"ល្ងាច"===e},meridiem:function(e,t,n){return e<12?"ព្រឹក":"ល្ងាច"},calendar:{sameDay:"[ថ្ងៃនេះ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",ss:"%d វិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},dayOfMonthOrdinalParse:/ទី\d{1,2}/,ordinal:"ទី%d",preparse:function(e){return e.replace(/[១២៣៤៥៦៧៨៩០]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/kn.js":function(e,t,n){!function(e){"use strict";var t={1:"೧",2:"೨",3:"೩",4:"೪",5:"೫",6:"೬",7:"೭",8:"೮",9:"೯",0:"೦"},n={"೧":"1","೨":"2","೩":"3","೪":"4","೫":"5","೬":"6","೭":"7","೮":"8","೯":"9","೦":"0"};e.defineLocale("kn",{months:"ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),monthsShort:"ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ".split("_"),monthsParseExact:!0,weekdays:"ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),weekdaysShort:"ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),weekdaysMin:"ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[ಇಂದು] LT",nextDay:"[ನಾಳೆ] LT",nextWeek:"dddd, LT",lastDay:"[ನಿನ್ನೆ] LT",lastWeek:"[ಕೊನೆಯ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ನಂತರ",past:"%s ಹಿಂದೆ",s:"ಕೆಲವು ಕ್ಷಣಗಳು",ss:"%d ಸೆಕೆಂಡುಗಳು",m:"ಒಂದು ನಿಮಿಷ",mm:"%d ನಿಮಿಷ",h:"ಒಂದು ಗಂಟೆ",hh:"%d ಗಂಟೆ",d:"ಒಂದು ದಿನ",dd:"%d ದಿನ",M:"ಒಂದು ತಿಂಗಳು",MM:"%d ತಿಂಗಳು",y:"ಒಂದು ವರ್ಷ",yy:"%d ವರ್ಷ"},preparse:function(e){return e.replace(/[೧೨೩೪೫೬೭೮೯೦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ರಾತ್ರಿ"===t?e<4?e:e+12:"ಬೆಳಿಗ್ಗೆ"===t?e:"ಮಧ್ಯಾಹ್ನ"===t?e>=10?e:e+12:"ಸಂಜೆ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"ರಾತ್ರಿ":e<10?"ಬೆಳಿಗ್ಗೆ":e<17?"ಮಧ್ಯಾಹ್ನ":e<20?"ಸಂಜೆ":"ರಾತ್ರಿ"},dayOfMonthOrdinalParse:/\d{1,2}(ನೇ)/,ordinal:function(e){return e+"ನೇ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ko.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"YYYY.MM.DD.",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 A h:mm",LLLL:"YYYY년 MMMM D일 dddd A h:mm",l:"YYYY.MM.DD.",ll:"YYYY년 MMMM D일",lll:"YYYY년 MMMM D일 A h:mm",llll:"YYYY년 MMMM D일 dddd A h:mm"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇 초",ss:"%d초",m:"1분",mm:"%d분",h:"한 시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한 달",MM:"%d달",y:"일 년",yy:"%d년"},dayOfMonthOrdinalParse:/\d{1,2}(일|월|주)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"일";case"M":return e+"월";case"w":case"W":return e+"주";default:return e}},meridiemParse:/오전|오후/,isPM:function(e){return"오후"===e},meridiem:function(e,t,n){return e<12?"오전":"오후"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ku.js":function(e,t,n){!function(e){"use strict";var t={1:"١",2:"٢",3:"٣",4:"٤",5:"٥",6:"٦",7:"٧",8:"٨",9:"٩",0:"٠"},n={"١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","٠":"0"},o=["کانونی دووەم","شوبات","ئازار","نیسان","ئایار","حوزەیران","تەمموز","ئاب","ئەیلوول","تشرینی یەكەم","تشرینی دووەم","كانونی یەکەم"];e.defineLocale("ku",{months:o,monthsShort:o,weekdays:"یه‌كشه‌ممه‌_دووشه‌ممه‌_سێشه‌ممه‌_چوارشه‌ممه‌_پێنجشه‌ممه‌_هه‌ینی_شه‌ممه‌".split("_"),weekdaysShort:"یه‌كشه‌م_دووشه‌م_سێشه‌م_چوارشه‌م_پێنجشه‌م_هه‌ینی_شه‌ممه‌".split("_"),weekdaysMin:"ی_د_س_چ_پ_ه_ش".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},meridiemParse:/ئێواره‌|به‌یانی/,isPM:function(e){return/ئێواره‌/.test(e)},meridiem:function(e,t,n){return e<12?"به‌یانی":"ئێواره‌"},calendar:{sameDay:"[ئه‌مرۆ كاتژمێر] LT",nextDay:"[به‌یانی كاتژمێر] LT",nextWeek:"dddd [كاتژمێر] LT",lastDay:"[دوێنێ كاتژمێر] LT",lastWeek:"dddd [كاتژمێر] LT",sameElse:"L"},relativeTime:{future:"له‌ %s",past:"%s",s:"چه‌ند چركه‌یه‌ك",ss:"چركه‌ %d",m:"یه‌ك خوله‌ك",mm:"%d خوله‌ك",h:"یه‌ك كاتژمێر",hh:"%d كاتژمێر",d:"یه‌ك ڕۆژ",dd:"%d ڕۆژ",M:"یه‌ك مانگ",MM:"%d مانگ",y:"یه‌ك ساڵ",yy:"%d ساڵ"},preparse:function(e){return e.replace(/[١٢٣٤٥٦٧٨٩٠]/g,(function(e){return n[e]})).replace(/،/g,",")},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]})).replace(/,/g,"،")},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ky.js":function(e,t,n){!function(e){"use strict";var t={0:"-чү",1:"-чи",2:"-чи",3:"-чү",4:"-чү",5:"-чи",6:"-чы",7:"-чи",8:"-чи",9:"-чу",10:"-чу",20:"-чы",30:"-чу",40:"-чы",50:"-чү",60:"-чы",70:"-чи",80:"-чи",90:"-чу",100:"-чү"};e.defineLocale("ky",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),weekdays:"Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),weekdaysShort:"Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),weekdaysMin:"Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Бүгүн саат] LT",nextDay:"[Эртең саат] LT",nextWeek:"dddd [саат] LT",lastDay:"[Кечээ саат] LT",lastWeek:"[Өткөн аптанын] dddd [күнү] [саат] LT",sameElse:"L"},relativeTime:{future:"%s ичинде",past:"%s мурун",s:"бирнече секунд",ss:"%d секунд",m:"бир мүнөт",mm:"%d мүнөт",h:"бир саат",hh:"%d саат",d:"бир күн",dd:"%d күн",M:"бир ай",MM:"%d ай",y:"бир жыл",yy:"%d жыл"},dayOfMonthOrdinalParse:/\d{1,2}-(чи|чы|чү|чу)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lb.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return t?r[n][0]:r[n][1]}function n(e){if(e=parseInt(e,10),isNaN(e))return!1;if(e<0)return!0;if(e<10)return 4<=e&&e<=7;if(e<100){var t=e%10;return n(0===t?e/10:t)}if(e<1e4){for(;e>=10;)e/=10;return n(e)}return n(e/=1e3)}e.defineLocale("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),monthsParseExact:!0,weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm [Auer]",LTS:"H:mm:ss [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm [Auer]",LLLL:"dddd, D. MMMM YYYY H:mm [Auer]"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:function(){switch(this.day()){case 2:case 4:return"[Leschten] dddd [um] LT";default:return"[Leschte] dddd [um] LT"}}},relativeTime:{future:function(e){return n(e.substr(0,e.indexOf(" ")))?"a "+e:"an "+e},past:function(e){return n(e.substr(0,e.indexOf(" ")))?"viru "+e:"virun "+e},s:"e puer Sekonnen",ss:"%d Sekonnen",m:t,mm:"%d Minutten",h:t,hh:"%d Stonnen",d:t,dd:"%d Deeg",M:t,MM:"%d Méint",y:t,yy:"%d Joer"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("lo",{months:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),monthsShort:"ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),weekdays:"ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysShort:"ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),weekdaysMin:"ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"ວັນdddd D MMMM YYYY HH:mm"},meridiemParse:/ຕອນເຊົ້າ|ຕອນແລງ/,isPM:function(e){return"ຕອນແລງ"===e},meridiem:function(e,t,n){return e<12?"ຕອນເຊົ້າ":"ຕອນແລງ"},calendar:{sameDay:"[ມື້ນີ້ເວລາ] LT",nextDay:"[ມື້ອື່ນເວລາ] LT",nextWeek:"[ວັນ]dddd[ໜ້າເວລາ] LT",lastDay:"[ມື້ວານນີ້ເວລາ] LT",lastWeek:"[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",sameElse:"L"},relativeTime:{future:"ອີກ %s",past:"%sຜ່ານມາ",s:"ບໍ່ເທົ່າໃດວິນາທີ",ss:"%d ວິນາທີ",m:"1 ນາທີ",mm:"%d ນາທີ",h:"1 ຊົ່ວໂມງ",hh:"%d ຊົ່ວໂມງ",d:"1 ມື້",dd:"%d ມື້",M:"1 ເດືອນ",MM:"%d ເດືອນ",y:"1 ປີ",yy:"%d ປີ"},dayOfMonthOrdinalParse:/(ທີ່)\d{1,2}/,ordinal:function(e){return"ທີ່"+e}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lt.js":function(e,t,n){!function(e){"use strict";var t={ss:"sekundė_sekundžių_sekundes",m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"};function n(e,t,n,o){return t?r(n)[0]:o?r(n)[1]:r(n)[2]}function o(e){return e%10==0||e>10&&e<20}function r(e){return t[e].split("_")}function s(e,t,s,a){var i=e+" ";return 1===e?i+n(0,t,s[0],a):t?i+(o(e)?r(s)[1]:r(s)[0]):a?i+r(s)[1]:i+(o(e)?r(s)[1]:r(s)[2])}e.defineLocale("lt",{months:{format:"sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),standalone:"sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_"),isFormat:/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/},monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:{format:"sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),standalone:"sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),isFormat:/dddd HH:mm/},weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], HH:mm [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], HH:mm [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:function(e,t,n,o){return t?"kelios sekundės":o?"kelių sekundžių":"kelias sekundes"},ss:s,m:n,mm:s,h:n,hh:s,d:n,dd:s,M:n,MM:s,y:n,yy:s},dayOfMonthOrdinalParse:/\d{1,2}-oji/,ordinal:function(e){return e+"-oji"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/lv.js":function(e,t,n){!function(e){"use strict";var t={ss:"sekundes_sekundēm_sekunde_sekundes".split("_"),m:"minūtes_minūtēm_minūte_minūtes".split("_"),mm:"minūtes_minūtēm_minūte_minūtes".split("_"),h:"stundas_stundām_stunda_stundas".split("_"),hh:"stundas_stundām_stunda_stundas".split("_"),d:"dienas_dienām_diena_dienas".split("_"),dd:"dienas_dienām_diena_dienas".split("_"),M:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),MM:"mēneša_mēnešiem_mēnesis_mēneši".split("_"),y:"gada_gadiem_gads_gadi".split("_"),yy:"gada_gadiem_gads_gadi".split("_")};function n(e,t,n){return n?t%10==1&&t%100!=11?e[2]:e[3]:t%10==1&&t%100!=11?e[0]:e[1]}function o(e,o,r){return e+" "+n(t[r],e,o)}function r(e,o,r){return n(t[r],e,o)}e.defineLocale("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY.",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, HH:mm",LLLL:"YYYY. [gada] D. MMMM, dddd, HH:mm"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"pēc %s",past:"pirms %s",s:function(e,t){return t?"dažas sekundes":"dažām sekundēm"},ss:o,m:r,mm:o,h:r,hh:o,d:r,dd:o,M:r,MM:o,y:r,yy:o},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/me.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["sekund","sekunda","sekundi"],m:["jedan minut","jednog minuta"],mm:["minut","minuta","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mjesec","mjeseca","mjeseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("me",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sjutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedjelje] [u] LT","[prošlog] [ponedjeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srijede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"nekoliko sekundi",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mjesec",MM:t.translate,y:"godinu",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mi.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mi",{months:"Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),monthsShort:"Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),monthsRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,monthsShortStrictRegex:/(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,weekdays:"Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),weekdaysShort:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),weekdaysMin:"Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [i] HH:mm",LLLL:"dddd, D MMMM YYYY [i] HH:mm"},calendar:{sameDay:"[i teie mahana, i] LT",nextDay:"[apopo i] LT",nextWeek:"dddd [i] LT",lastDay:"[inanahi i] LT",lastWeek:"dddd [whakamutunga i] LT",sameElse:"L"},relativeTime:{future:"i roto i %s",past:"%s i mua",s:"te hēkona ruarua",ss:"%d hēkona",m:"he meneti",mm:"%d meneti",h:"te haora",hh:"%d haora",d:"he ra",dd:"%d ra",M:"he marama",MM:"%d marama",y:"he tau",yy:"%d tau"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mk.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"[Во] dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"за %s",past:"пред %s",s:"неколку секунди",ss:"%d секунди",m:"една минута",mm:"%d минути",h:"еден час",hh:"%d часа",d:"еден ден",dd:"%d дена",M:"еден месец",MM:"%d месеци",y:"една година",yy:"%d години"},dayOfMonthOrdinalParse:/\d{1,2}-(ев|ен|ти|ви|ри|ми)/,ordinal:function(e){var t=e%10,n=e%100;return 0===e?e+"-ев":0===n?e+"-ен":n>10&&n<20?e+"-ти":1===t?e+"-ви":2===t?e+"-ри":7===t||8===t?e+"-ми":e+"-ти"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ml.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),monthsParseExact:!0,weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",LTS:"A h:mm:ss -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm -നു",LLLL:"dddd, D MMMM YYYY, A h:mm -നു"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",ss:"%d സെക്കൻഡ്",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiemParse:/രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,meridiemHour:function(e,t){return 12===e&&(e=0),"രാത്രി"===t&&e>=4||"ഉച്ച കഴിഞ്ഞ്"===t||"വൈകുന്നേരം"===t?e+12:e},meridiem:function(e,t,n){return e<4?"രാത്രി":e<12?"രാവിലെ":e<17?"ഉച്ച കഴിഞ്ഞ്":e<20?"വൈകുന്നേരം":"രാത്രി"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mn.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){switch(n){case"s":return t?"хэдхэн секунд":"хэдхэн секундын";case"ss":return e+(t?" секунд":" секундын");case"m":case"mm":return e+(t?" минут":" минутын");case"h":case"hh":return e+(t?" цаг":" цагийн");case"d":case"dd":return e+(t?" өдөр":" өдрийн");case"M":case"MM":return e+(t?" сар":" сарын");case"y":case"yy":return e+(t?" жил":" жилийн");default:return e}}e.defineLocale("mn",{months:"Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар".split("_"),monthsShort:"1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар".split("_"),monthsParseExact:!0,weekdays:"Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба".split("_"),weekdaysShort:"Ням_Дав_Мяг_Лха_Пүр_Баа_Бям".split("_"),weekdaysMin:"Ня_Да_Мя_Лх_Пү_Ба_Бя".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY оны MMMMын D",LLL:"YYYY оны MMMMын D HH:mm",LLLL:"dddd, YYYY оны MMMMын D HH:mm"},meridiemParse:/ҮӨ|ҮХ/i,isPM:function(e){return"ҮХ"===e},meridiem:function(e,t,n){return e<12?"ҮӨ":"ҮХ"},calendar:{sameDay:"[Өнөөдөр] LT",nextDay:"[Маргааш] LT",nextWeek:"[Ирэх] dddd LT",lastDay:"[Өчигдөр] LT",lastWeek:"[Өнгөрсөн] dddd LT",sameElse:"L"},relativeTime:{future:"%s дараа",past:"%s өмнө",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2} өдөр/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+" өдөр";default:return e}}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mr.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};function o(e,t,n,o){var r="";if(t)switch(n){case"s":r="काही सेकंद";break;case"ss":r="%d सेकंद";break;case"m":r="एक मिनिट";break;case"mm":r="%d मिनिटे";break;case"h":r="एक तास";break;case"hh":r="%d तास";break;case"d":r="एक दिवस";break;case"dd":r="%d दिवस";break;case"M":r="एक महिना";break;case"MM":r="%d महिने";break;case"y":r="एक वर्ष";break;case"yy":r="%d वर्षे"}else switch(n){case"s":r="काही सेकंदां";break;case"ss":r="%d सेकंदां";break;case"m":r="एका मिनिटा";break;case"mm":r="%d मिनिटां";break;case"h":r="एका तासा";break;case"hh":r="%d तासां";break;case"d":r="एका दिवसा";break;case"dd":r="%d दिवसां";break;case"M":r="एका महिन्या";break;case"MM":r="%d महिन्यां";break;case"y":r="एका वर्षा";break;case"yy":r="%d वर्षां"}return r.replace(/%d/i,e)}e.defineLocale("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),monthsParseExact:!0,weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%sमध्ये",past:"%sपूर्वी",s:o,ss:o,m:o,mm:o,h:o,hh:o,d:o,dd:o,M:o,MM:o,y:o,yy:o},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,meridiemHour:function(e,t){return 12===e&&(e=0),"पहाटे"===t||"सकाळी"===t?e:"दुपारी"===t||"सायंकाळी"===t||"रात्री"===t?e>=12?e:e+12:void 0},meridiem:function(e,t,n){return e>=0&&e<6?"पहाटे":e<12?"सकाळी":e<17?"दुपारी":e<20?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ms-my.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ms.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ms",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] HH.mm",LLLL:"dddd, D MMMM YYYY [pukul] HH.mm"},meridiemParse:/pagi|tengahari|petang|malam/,meridiemHour:function(e,t){return 12===e&&(e=0),"pagi"===t?e:"tengahari"===t?e>=11?e:e+12:"petang"===t||"malam"===t?e+12:void 0},meridiem:function(e,t,n){return e<11?"pagi":e<15?"tengahari":e<19?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",ss:"%d saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/mt.js":function(e,t,n){!function(e){"use strict";e.defineLocale("mt",{months:"Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru".split("_"),monthsShort:"Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ".split("_"),weekdays:"Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt".split("_"),weekdaysShort:"Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib".split("_"),weekdaysMin:"Ħa_Tn_Tl_Er_Ħa_Ġi_Si".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Illum fil-]LT",nextDay:"[Għada fil-]LT",nextWeek:"dddd [fil-]LT",lastDay:"[Il-bieraħ fil-]LT",lastWeek:"dddd [li għadda] [fil-]LT",sameElse:"L"},relativeTime:{future:"f’ %s",past:"%s ilu",s:"ftit sekondi",ss:"%d sekondi",m:"minuta",mm:"%d minuti",h:"siegħa",hh:"%d siegħat",d:"ġurnata",dd:"%d ġranet",M:"xahar",MM:"%d xhur",y:"sena",yy:"%d sni"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/my.js":function(e,t,n){!function(e){"use strict";var t={1:"၁",2:"၂",3:"၃",4:"၄",5:"၅",6:"၆",7:"၇",8:"၈",9:"၉",0:"၀"},n={"၁":"1","၂":"2","၃":"3","၄":"4","၅":"5","၆":"6","၇":"7","၈":"8","၉":"9","၀":"0"};e.defineLocale("my",{months:"ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),monthsShort:"ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),weekdays:"တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),weekdaysShort:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),weekdaysMin:"နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ယနေ.] LT [မှာ]",nextDay:"[မနက်ဖြန်] LT [မှာ]",nextWeek:"dddd LT [မှာ]",lastDay:"[မနေ.က] LT [မှာ]",lastWeek:"[ပြီးခဲ့သော] dddd LT [မှာ]",sameElse:"L"},relativeTime:{future:"လာမည့် %s မှာ",past:"လွန်ခဲ့သော %s က",s:"စက္ကန်.အနည်းငယ်",ss:"%d စက္ကန့်",m:"တစ်မိနစ်",mm:"%d မိနစ်",h:"တစ်နာရီ",hh:"%d နာရီ",d:"တစ်ရက်",dd:"%d ရက်",M:"တစ်လ",MM:"%d လ",y:"တစ်နှစ်",yy:"%d နှစ်"},preparse:function(e){return e.replace(/[၁၂၃၄၅၆၇၈၉၀]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nb.js":function(e,t,n){!function(e){"use strict";e.defineLocale("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] HH:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"noen sekunder",ss:"%d sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",w:"en uke",ww:"%d uker",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ne.js":function(e,t,n){!function(e){"use strict";var t={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},n={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};e.defineLocale("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),monthsParseExact:!0,weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आ._सो._मं._बु._बि._शु._श.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"Aको h:mm बजे",LTS:"Aको h:mm:ss बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, Aको h:mm बजे",LLLL:"dddd, D MMMM YYYY, Aको h:mm बजे"},preparse:function(e){return e.replace(/[१२३४५६७८९०]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/राति|बिहान|दिउँसो|साँझ/,meridiemHour:function(e,t){return 12===e&&(e=0),"राति"===t?e<4?e:e+12:"बिहान"===t?e:"दिउँसो"===t?e>=10?e:e+12:"साँझ"===t?e+12:void 0},meridiem:function(e,t,n){return e<3?"राति":e<12?"बिहान":e<16?"दिउँसो":e<20?"साँझ":"राति"},calendar:{sameDay:"[आज] LT",nextDay:"[भोलि] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडि",s:"केही क्षण",ss:"%d सेकेण्ड",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nl-be.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),o=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl-be",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nl.js":function(e,t,n){!function(e){"use strict";var t="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),n="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"),o=[/^jan/i,/^feb/i,/^maart|mrt.?$/i,/^apr/i,/^mei$/i,/^jun[i.]?$/i,/^jul[i.]?$/i,/^aug/i,/^sep/i,/^okt/i,/^nov/i,/^dec/i],r=/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;e.defineLocale("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(e,o){return e?/-MMM-/.test(o)?n[e.month()]:t[e.month()]:t},monthsRegex:r,monthsShortRegex:r,monthsStrictRegex:/^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,monthsShortStrictRegex:/^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"zo_ma_di_wo_do_vr_za".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",ss:"%d seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",w:"één week",ww:"%d weken",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},dayOfMonthOrdinalParse:/\d{1,2}(ste|de)/,ordinal:function(e){return e+(1===e||8===e||e>=20?"ste":"de")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/nn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.".split("_"),monthsParseExact:!0,weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"su._må._ty._on._to._fr._lau.".split("_"),weekdaysMin:"su_må_ty_on_to_fr_la".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] H:mm",LLLL:"dddd D. MMMM YYYY [kl.] HH:mm"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s sidan",s:"nokre sekund",ss:"%d sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",w:"ei veke",ww:"%d veker",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/oc-lnc.js":function(e,t,n){!function(e){"use strict";e.defineLocale("oc-lnc",{months:{standalone:"genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre".split("_"),format:"de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split("_"),isFormat:/D[oD]?(\s)+MMMM/},monthsShort:"gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dm._dc._dj._dv._ds.".split("_"),weekdaysMin:"dg_dl_dm_dc_dj_dv_ds".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [de] YYYY",ll:"D MMM YYYY",LLL:"D MMMM [de] YYYY [a] H:mm",lll:"D MMM YYYY, H:mm",LLLL:"dddd D MMMM [de] YYYY [a] H:mm",llll:"ddd D MMM YYYY, H:mm"},calendar:{sameDay:"[uèi a] LT",nextDay:"[deman a] LT",nextWeek:"dddd [a] LT",lastDay:"[ièr a] LT",lastWeek:"dddd [passat a] LT",sameElse:"L"},relativeTime:{future:"d'aquí %s",past:"fa %s",s:"unas segondas",ss:"%d segondas",m:"una minuta",mm:"%d minutas",h:"una ora",hh:"%d oras",d:"un jorn",dd:"%d jorns",M:"un mes",MM:"%d meses",y:"un an",yy:"%d ans"},dayOfMonthOrdinalParse:/\d{1,2}(r|n|t|è|a)/,ordinal:function(e,t){var n=1===e?"r":2===e?"n":3===e?"r":4===e?"t":"è";return"w"!==t&&"W"!==t||(n="a"),e+n},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pa-in.js":function(e,t,n){!function(e){"use strict";var t={1:"੧",2:"੨",3:"੩",4:"੪",5:"੫",6:"੬",7:"੭",8:"੮",9:"੯",0:"੦"},n={"੧":"1","੨":"2","੩":"3","੪":"4","੫":"5","੬":"6","੭":"7","੮":"8","੯":"9","੦":"0"};e.defineLocale("pa-in",{months:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),monthsShort:"ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),weekdays:"ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),weekdaysShort:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),weekdaysMin:"ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),longDateFormat:{LT:"A h:mm ਵਜੇ",LTS:"A h:mm:ss ਵਜੇ",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm ਵਜੇ",LLLL:"dddd, D MMMM YYYY, A h:mm ਵਜੇ"},calendar:{sameDay:"[ਅਜ] LT",nextDay:"[ਕਲ] LT",nextWeek:"[ਅਗਲਾ] dddd, LT",lastDay:"[ਕਲ] LT",lastWeek:"[ਪਿਛਲੇ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s ਵਿੱਚ",past:"%s ਪਿਛਲੇ",s:"ਕੁਝ ਸਕਿੰਟ",ss:"%d ਸਕਿੰਟ",m:"ਇਕ ਮਿੰਟ",mm:"%d ਮਿੰਟ",h:"ਇੱਕ ਘੰਟਾ",hh:"%d ਘੰਟੇ",d:"ਇੱਕ ਦਿਨ",dd:"%d ਦਿਨ",M:"ਇੱਕ ਮਹੀਨਾ",MM:"%d ਮਹੀਨੇ",y:"ਇੱਕ ਸਾਲ",yy:"%d ਸਾਲ"},preparse:function(e){return e.replace(/[੧੨੩੪੫੬੭੮੯੦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,meridiemHour:function(e,t){return 12===e&&(e=0),"ਰਾਤ"===t?e<4?e:e+12:"ਸਵੇਰ"===t?e:"ਦੁਪਹਿਰ"===t?e>=10?e:e+12:"ਸ਼ਾਮ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"ਰਾਤ":e<10?"ਸਵੇਰ":e<17?"ਦੁਪਹਿਰ":e<20?"ਸ਼ਾਮ":"ਰਾਤ"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pl.js":function(e,t,n){!function(e){"use strict";var t="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),n="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_"),o=[/^sty/i,/^lut/i,/^mar/i,/^kwi/i,/^maj/i,/^cze/i,/^lip/i,/^sie/i,/^wrz/i,/^paź/i,/^lis/i,/^gru/i];function r(e){return e%10<5&&e%10>1&&~~(e/10)%10!=1}function s(e,t,n){var o=e+" ";switch(n){case"ss":return o+(r(e)?"sekundy":"sekund");case"m":return t?"minuta":"minutę";case"mm":return o+(r(e)?"minuty":"minut");case"h":return t?"godzina":"godzinę";case"hh":return o+(r(e)?"godziny":"godzin");case"ww":return o+(r(e)?"tygodnie":"tygodni");case"MM":return o+(r(e)?"miesiące":"miesięcy");case"yy":return o+(r(e)?"lata":"lat")}}e.defineLocale("pl",{months:function(e,o){return e?/D MMMM/.test(o)?n[e.month()]:t[e.month()]:t},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),monthsParse:o,longMonthsParse:o,shortMonthsParse:o,weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"ndz_pon_wt_śr_czw_pt_sob".split("_"),weekdaysMin:"Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:function(){switch(this.day()){case 0:return"[W niedzielę o] LT";case 2:return"[We wtorek o] LT";case 3:return"[W środę o] LT";case 6:return"[W sobotę o] LT";default:return"[W] dddd [o] LT"}},lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",ss:s,m:s,mm:s,h:s,hh:s,d:"1 dzień",dd:"%d dni",w:"tydzień",ww:s,M:"miesiąc",MM:s,y:"rok",yy:s},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pt-br.js":function(e,t,n){!function(e){"use strict";e.defineLocale("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"do_2ª_3ª_4ª_5ª_6ª_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY [às] HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"poucos segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",invalidDate:"Data inválida"})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/pt.js":function(e,t,n){!function(e){"use strict";e.defineLocale("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),weekdaysShort:"Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),weekdaysMin:"Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY HH:mm",LLLL:"dddd, D [de] MMMM [de] YYYY HH:mm"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"há %s",s:"segundos",ss:"%d segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",w:"uma semana",ww:"%d semanas",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},dayOfMonthOrdinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ro.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){var o=" ";return(e%100>=20||e>=100&&e%100==0)&&(o=" de "),e+o+{ss:"secunde",mm:"minute",hh:"ore",dd:"zile",ww:"săptămâni",MM:"luni",yy:"ani"}[n]}e.defineLocale("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",ss:t,m:"un minut",mm:t,h:"o oră",hh:t,d:"o zi",dd:t,w:"o săptămână",ww:t,M:"o lună",MM:t,y:"un an",yy:t},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ru.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"минута":"минуту":e+" "+(o=+e,r={ss:t?"секунда_секунды_секунд":"секунду_секунды_секунд",mm:t?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",ww:"неделя_недели_недель",MM:"месяц_месяца_месяцев",yy:"год_года_лет"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}var n=[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[йя]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i];e.defineLocale("ru",{months:{format:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),standalone:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")},monthsShort:{format:"янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),standalone:"янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")},weekdays:{standalone:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),format:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),isFormat:/\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/},weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:n,longMonthsParse:n,shortMonthsParse:n,monthsRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsShortRegex:/^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,monthsStrictRegex:/^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,monthsShortStrictRegex:/^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., H:mm",LLLL:"dddd, D MMMM YYYY г., H:mm"},calendar:{sameDay:"[Сегодня, в] LT",nextDay:"[Завтра, в] LT",lastDay:"[Вчера, в] LT",nextWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В следующее] dddd, [в] LT";case 1:case 2:case 4:return"[В следующий] dddd, [в] LT";case 3:case 5:case 6:return"[В следующую] dddd, [в] LT"}},lastWeek:function(e){if(e.week()===this.week())return 2===this.day()?"[Во] dddd, [в] LT":"[В] dddd, [в] LT";switch(this.day()){case 0:return"[В прошлое] dddd, [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd, [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd, [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",ss:t,m:t,mm:t,h:"час",hh:t,d:"день",dd:t,w:"неделя",ww:t,M:"месяц",MM:t,y:"год",yy:t},meridiemParse:/ночи|утра|дня|вечера/i,isPM:function(e){return/^(дня|вечера)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночи":e<12?"утра":e<17?"дня":"вечера"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го|я)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":return e+"-й";case"D":return e+"-го";case"w":case"W":return e+"-я";default:return e}},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sd.js":function(e,t,n){!function(e){"use strict";var t=["جنوري","فيبروري","مارچ","اپريل","مئي","جون","جولاءِ","آگسٽ","سيپٽمبر","آڪٽوبر","نومبر","ڊسمبر"],n=["آچر","سومر","اڱارو","اربع","خميس","جمع","ڇنڇر"];e.defineLocale("sd",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[اڄ] LT",nextDay:"[سڀاڻي] LT",nextWeek:"dddd [اڳين هفتي تي] LT",lastDay:"[ڪالهه] LT",lastWeek:"[گزريل هفتي] dddd [تي] LT",sameElse:"L"},relativeTime:{future:"%s پوء",past:"%s اڳ",s:"چند سيڪنڊ",ss:"%d سيڪنڊ",m:"هڪ منٽ",mm:"%d منٽ",h:"هڪ ڪلاڪ",hh:"%d ڪلاڪ",d:"هڪ ڏينهن",dd:"%d ڏينهن",M:"هڪ مهينو",MM:"%d مهينا",y:"هڪ سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/se.js":function(e,t,n){!function(e){"use strict";e.defineLocale("se",{months:"ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),monthsShort:"ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),weekdays:"sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),weekdaysShort:"sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),weekdaysMin:"s_v_m_g_d_b_L".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"MMMM D. [b.] YYYY",LLL:"MMMM D. [b.] YYYY [ti.] HH:mm",LLLL:"dddd, MMMM D. [b.] YYYY [ti.] HH:mm"},calendar:{sameDay:"[otne ti] LT",nextDay:"[ihttin ti] LT",nextWeek:"dddd [ti] LT",lastDay:"[ikte ti] LT",lastWeek:"[ovddit] dddd [ti] LT",sameElse:"L"},relativeTime:{future:"%s geažes",past:"maŋit %s",s:"moadde sekunddat",ss:"%d sekunddat",m:"okta minuhta",mm:"%d minuhtat",h:"okta diimmu",hh:"%d diimmut",d:"okta beaivi",dd:"%d beaivvit",M:"okta mánnu",MM:"%d mánut",y:"okta jahki",yy:"%d jagit"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/si.js":function(e,t,n){!function(e){"use strict";e.defineLocale("si",{months:"ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),monthsShort:"ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),weekdays:"ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),weekdaysShort:"ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),weekdaysMin:"ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"a h:mm",LTS:"a h:mm:ss",L:"YYYY/MM/DD",LL:"YYYY MMMM D",LLL:"YYYY MMMM D, a h:mm",LLLL:"YYYY MMMM D [වැනි] dddd, a h:mm:ss"},calendar:{sameDay:"[අද] LT[ට]",nextDay:"[හෙට] LT[ට]",nextWeek:"dddd LT[ට]",lastDay:"[ඊයේ] LT[ට]",lastWeek:"[පසුගිය] dddd LT[ට]",sameElse:"L"},relativeTime:{future:"%sකින්",past:"%sකට පෙර",s:"තත්පර කිහිපය",ss:"තත්පර %d",m:"මිනිත්තුව",mm:"මිනිත්තු %d",h:"පැය",hh:"පැය %d",d:"දිනය",dd:"දින %d",M:"මාසය",MM:"මාස %d",y:"වසර",yy:"වසර %d"},dayOfMonthOrdinalParse:/\d{1,2} වැනි/,ordinal:function(e){return e+" වැනි"},meridiemParse:/පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,isPM:function(e){return"ප.ව."===e||"පස් වරු"===e},meridiem:function(e,t,n){return e>11?n?"ප.ව.":"පස් වරු":n?"පෙ.ව.":"පෙර වරු"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sk.js":function(e,t,n){!function(e){"use strict";var t="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),n="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");function o(e){return e>1&&e<5}function r(e,t,n,r){var s=e+" ";switch(n){case"s":return t||r?"pár sekúnd":"pár sekundami";case"ss":return t||r?s+(o(e)?"sekundy":"sekúnd"):s+"sekundami";case"m":return t?"minúta":r?"minútu":"minútou";case"mm":return t||r?s+(o(e)?"minúty":"minút"):s+"minútami";case"h":return t?"hodina":r?"hodinu":"hodinou";case"hh":return t||r?s+(o(e)?"hodiny":"hodín"):s+"hodinami";case"d":return t||r?"deň":"dňom";case"dd":return t||r?s+(o(e)?"dni":"dní"):s+"dňami";case"M":return t||r?"mesiac":"mesiacom";case"MM":return t||r?s+(o(e)?"mesiace":"mesiacov"):s+"mesiacmi";case"y":return t||r?"rok":"rokom";case"yy":return t||r?s+(o(e)?"roky":"rokov"):s+"rokmi"}}e.defineLocale("sk",{months:t,monthsShort:n,weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd D. MMMM YYYY H:mm"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:r,ss:r,m:r,mm:r,h:r,hh:r,d:r,dd:r,M:r,MM:r,y:r,yy:r},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sl.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r=e+" ";switch(n){case"s":return t||o?"nekaj sekund":"nekaj sekundami";case"ss":return r+(1===e?t?"sekundo":"sekundi":2===e?t||o?"sekundi":"sekundah":e<5?t||o?"sekunde":"sekundah":"sekund");case"m":return t?"ena minuta":"eno minuto";case"mm":return r+(1===e?t?"minuta":"minuto":2===e?t||o?"minuti":"minutama":e<5?t||o?"minute":"minutami":t||o?"minut":"minutami");case"h":return t?"ena ura":"eno uro";case"hh":return r+(1===e?t?"ura":"uro":2===e?t||o?"uri":"urama":e<5?t||o?"ure":"urami":t||o?"ur":"urami");case"d":return t||o?"en dan":"enim dnem";case"dd":return r+(1===e?t||o?"dan":"dnem":2===e?t||o?"dni":"dnevoma":t||o?"dni":"dnevi");case"M":return t||o?"en mesec":"enim mesecem";case"MM":return r+(1===e?t||o?"mesec":"mesecem":2===e?t||o?"meseca":"mesecema":e<5?t||o?"mesece":"meseci":t||o?"mesecev":"meseci");case"y":return t||o?"eno leto":"enim letom";case"yy":return r+(1===e?t||o?"leto":"letom":2===e?t||o?"leti":"letoma":e<5?t||o?"leta":"leti":t||o?"let":"leti")}}e.defineLocale("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY H:mm",LLLL:"dddd, D. MMMM YYYY H:mm"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:return"[prejšnjo] [nedeljo] [ob] LT";case 3:return"[prejšnjo] [sredo] [ob] LT";case 6:return"[prejšnjo] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"pred %s",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sq.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),weekdaysParseExact:!0,meridiemParse:/PD|MD/,isPM:function(e){return"M"===e.charAt(0)},meridiem:function(e,t,n){return e<12?"PD":"MD"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",ss:"%d sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sr-cyrl.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["секунда","секунде","секунди"],m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("sr-cyrl",{months:"јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),monthsShort:"јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),monthsParseExact:!0,weekdays:"недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),weekdaysShort:"нед._пон._уто._сре._чет._пет._суб.".split("_"),weekdaysMin:"не_по_ут_ср_че_пе_су".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){return["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"дан",dd:t.translate,M:"месец",MM:t.translate,y:"годину",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sr.js":function(e,t,n){!function(e){"use strict";var t={words:{ss:["sekunda","sekunde","sekundi"],m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(e,t){return 1===e?t[0]:e>=2&&e<=4?t[1]:t[2]},translate:function(e,n,o){var r=t.words[o];return 1===o.length?n?r[0]:r[1]:e+" "+t.correctGrammaticalCase(e,r)}};e.defineLocale("sr",{months:"januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),monthsParseExact:!0,weekdays:"nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sre._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"D. M. YYYY.",LL:"D. MMMM YYYY.",LLL:"D. MMMM YYYY. H:mm",LLLL:"dddd, D. MMMM YYYY. H:mm"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){return["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"][this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",ss:t.translate,m:t.translate,mm:t.translate,h:t.translate,hh:t.translate,d:"dan",dd:t.translate,M:"mesec",MM:t.translate,y:"godinu",yy:t.translate},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ss.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ss",{months:"Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),monthsShort:"Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),weekdays:"Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),weekdaysShort:"Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),weekdaysMin:"Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Namuhla nga] LT",nextDay:"[Kusasa nga] LT",nextWeek:"dddd [nga] LT",lastDay:"[Itolo nga] LT",lastWeek:"dddd [leliphelile] [nga] LT",sameElse:"L"},relativeTime:{future:"nga %s",past:"wenteka nga %s",s:"emizuzwana lomcane",ss:"%d mzuzwana",m:"umzuzu",mm:"%d emizuzu",h:"lihora",hh:"%d emahora",d:"lilanga",dd:"%d emalanga",M:"inyanga",MM:"%d tinyanga",y:"umnyaka",yy:"%d iminyaka"},meridiemParse:/ekuseni|emini|entsambama|ebusuku/,meridiem:function(e,t,n){return e<11?"ekuseni":e<15?"emini":e<19?"entsambama":"ebusuku"},meridiemHour:function(e,t){return 12===e&&(e=0),"ekuseni"===t?e:"emini"===t?e>=11?e:e+12:"entsambama"===t||"ebusuku"===t?0===e?0:e+12:void 0},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:"%d",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sv.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"[På] dddd LT",lastWeek:"[I] dddd[s] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",ss:"%d sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},dayOfMonthOrdinalParse:/\d{1,2}(\:e|\:a)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?":e":1===t||2===t?":a":":e")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/sw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("sw",{months:"Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),weekdays:"Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),weekdaysShort:"Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),weekdaysMin:"J2_J3_J4_J5_Al_Ij_J1".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"hh:mm A",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[leo saa] LT",nextDay:"[kesho saa] LT",nextWeek:"[wiki ijayo] dddd [saat] LT",lastDay:"[jana] LT",lastWeek:"[wiki iliyopita] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s baadaye",past:"tokea %s",s:"hivi punde",ss:"sekunde %d",m:"dakika moja",mm:"dakika %d",h:"saa limoja",hh:"masaa %d",d:"siku moja",dd:"siku %d",M:"mwezi mmoja",MM:"miezi %d",y:"mwaka mmoja",yy:"miaka %d"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ta.js":function(e,t,n){!function(e){"use strict";var t={1:"௧",2:"௨",3:"௩",4:"௪",5:"௫",6:"௬",7:"௭",8:"௮",9:"௯",0:"௦"},n={"௧":"1","௨":"2","௩":"3","௪":"4","௫":"5","௬":"6","௭":"7","௮":"8","௯":"9","௦":"0"};e.defineLocale("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, HH:mm",LLLL:"dddd, D MMMM YYYY, HH:mm"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",ss:"%d விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},dayOfMonthOrdinalParse:/\d{1,2}வது/,ordinal:function(e){return e+"வது"},preparse:function(e){return e.replace(/[௧௨௩௪௫௬௭௮௯௦]/g,(function(e){return n[e]}))},postformat:function(e){return e.replace(/\d/g,(function(e){return t[e]}))},meridiemParse:/யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,meridiem:function(e,t,n){return e<2?" யாமம்":e<6?" வைகறை":e<10?" காலை":e<14?" நண்பகல்":e<18?" எற்பாடு":e<22?" மாலை":" யாமம்"},meridiemHour:function(e,t){return 12===e&&(e=0),"யாமம்"===t?e<2?e:e+12:"வைகறை"===t||"காலை"===t||"நண்பகல்"===t&&e>=10?e:e+12},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/te.js":function(e,t,n){!function(e){"use strict";e.defineLocale("te",{months:"జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),monthsShort:"జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),monthsParseExact:!0,weekdays:"ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),weekdaysShort:"ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),weekdaysMin:"ఆ_సో_మం_బు_గు_శు_శ".split("_"),longDateFormat:{LT:"A h:mm",LTS:"A h:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm",LLLL:"dddd, D MMMM YYYY, A h:mm"},calendar:{sameDay:"[నేడు] LT",nextDay:"[రేపు] LT",nextWeek:"dddd, LT",lastDay:"[నిన్న] LT",lastWeek:"[గత] dddd, LT",sameElse:"L"},relativeTime:{future:"%s లో",past:"%s క్రితం",s:"కొన్ని క్షణాలు",ss:"%d సెకన్లు",m:"ఒక నిమిషం",mm:"%d నిమిషాలు",h:"ఒక గంట",hh:"%d గంటలు",d:"ఒక రోజు",dd:"%d రోజులు",M:"ఒక నెల",MM:"%d నెలలు",y:"ఒక సంవత్సరం",yy:"%d సంవత్సరాలు"},dayOfMonthOrdinalParse:/\d{1,2}వ/,ordinal:"%dవ",meridiemParse:/రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,meridiemHour:function(e,t){return 12===e&&(e=0),"రాత్రి"===t?e<4?e:e+12:"ఉదయం"===t?e:"మధ్యాహ్నం"===t?e>=10?e:e+12:"సాయంత్రం"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"రాత్రి":e<10?"ఉదయం":e<17?"మధ్యాహ్నం":e<20?"సాయంత్రం":"రాత్రి"},week:{dow:0,doy:6}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tet.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tet",{months:"Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru".split("_"),monthsShort:"Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),weekdays:"Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu".split("_"),weekdaysShort:"Dom_Seg_Ters_Kua_Kint_Sest_Sab".split("_"),weekdaysMin:"Do_Seg_Te_Ku_Ki_Ses_Sa".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Ohin iha] LT",nextDay:"[Aban iha] LT",nextWeek:"dddd [iha] LT",lastDay:"[Horiseik iha] LT",lastWeek:"dddd [semana kotuk] [iha] LT",sameElse:"L"},relativeTime:{future:"iha %s",past:"%s liuba",s:"segundu balun",ss:"segundu %d",m:"minutu ida",mm:"minutu %d",h:"oras ida",hh:"oras %d",d:"loron ida",dd:"loron %d",M:"fulan ida",MM:"fulan %d",y:"tinan ida",yy:"tinan %d"},dayOfMonthOrdinalParse:/\d{1,2}(st|nd|rd|th)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tg.js":function(e,t,n){!function(e){"use strict";var t={0:"-ум",1:"-ум",2:"-юм",3:"-юм",4:"-ум",5:"-ум",6:"-ум",7:"-ум",8:"-ум",9:"-ум",10:"-ум",12:"-ум",13:"-ум",20:"-ум",30:"-юм",40:"-ум",50:"-ум",60:"-ум",70:"-ум",80:"-ум",90:"-ум",100:"-ум"};e.defineLocale("tg",{months:{format:"январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри".split("_"),standalone:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_")},monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе".split("_"),weekdaysShort:"яшб_дшб_сшб_чшб_пшб_ҷум_шнб".split("_"),weekdaysMin:"яш_дш_сш_чш_пш_ҷм_шб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[Имрӯз соати] LT",nextDay:"[Фардо соати] LT",lastDay:"[Дирӯз соати] LT",nextWeek:"dddd[и] [ҳафтаи оянда соати] LT",lastWeek:"dddd[и] [ҳафтаи гузашта соати] LT",sameElse:"L"},relativeTime:{future:"баъди %s",past:"%s пеш",s:"якчанд сония",m:"як дақиқа",mm:"%d дақиқа",h:"як соат",hh:"%d соат",d:"як рӯз",dd:"%d рӯз",M:"як моҳ",MM:"%d моҳ",y:"як сол",yy:"%d сол"},meridiemParse:/шаб|субҳ|рӯз|бегоҳ/,meridiemHour:function(e,t){return 12===e&&(e=0),"шаб"===t?e<4?e:e+12:"субҳ"===t?e:"рӯз"===t?e>=11?e:e+12:"бегоҳ"===t?e+12:void 0},meridiem:function(e,t,n){return e<4?"шаб":e<11?"субҳ":e<16?"рӯз":e<19?"бегоҳ":"шаб"},dayOfMonthOrdinalParse:/\d{1,2}-(ум|юм)/,ordinal:function(e){return e+(t[e]||t[e%10]||t[e>=100?100:null])},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/th.js":function(e,t,n){!function(e){"use strict";e.defineLocale("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),monthsParseExact:!0,weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา H:mm",LLLL:"วันddddที่ D MMMM YYYY เวลา H:mm"},meridiemParse:/ก่อนเที่ยง|หลังเที่ยง/,isPM:function(e){return"หลังเที่ยง"===e},meridiem:function(e,t,n){return e<12?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",ss:"%d วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",w:"1 สัปดาห์",ww:"%d สัปดาห์",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tk.js":function(e,t,n){!function(e){"use strict";var t={1:"'inji",5:"'inji",8:"'inji",70:"'inji",80:"'inji",2:"'nji",7:"'nji",20:"'nji",50:"'nji",3:"'ünji",4:"'ünji",100:"'ünji",6:"'njy",9:"'unjy",10:"'unjy",30:"'unjy",60:"'ynjy",90:"'ynjy"};e.defineLocale("tk",{months:"Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr".split("_"),monthsShort:"Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek".split("_"),weekdays:"Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe".split("_"),weekdaysShort:"Ýek_Duş_Siş_Çar_Pen_Ann_Şen".split("_"),weekdaysMin:"Ýk_Dş_Sş_Çr_Pn_An_Şn".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün sagat] LT",nextDay:"[ertir sagat] LT",nextWeek:"[indiki] dddd [sagat] LT",lastDay:"[düýn] LT",lastWeek:"[geçen] dddd [sagat] LT",sameElse:"L"},relativeTime:{future:"%s soň",past:"%s öň",s:"birnäçe sekunt",m:"bir minut",mm:"%d minut",h:"bir sagat",hh:"%d sagat",d:"bir gün",dd:"%d gün",M:"bir aý",MM:"%d aý",y:"bir ýyl",yy:"%d ýyl"},ordinal:function(e,n){switch(n){case"d":case"D":case"Do":case"DD":return e;default:if(0===e)return e+"'unjy";var o=e%10;return e+(t[o]||t[e%100-o]||t[e>=100?100:null])}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tl-ph.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY HH:mm",LLLL:"dddd, MMMM DD, YYYY HH:mm"},calendar:{sameDay:"LT [ngayong araw]",nextDay:"[Bukas ng] LT",nextWeek:"LT [sa susunod na] dddd",lastDay:"LT [kahapon]",lastWeek:"LT [noong nakaraang] dddd",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",ss:"%d segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tlh.js":function(e,t,n){!function(e){"use strict";var t="pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");function n(e,n,o,r){var s=function(e){var n=Math.floor(e%1e3/100),o=Math.floor(e%100/10),r=e%10,s="";return n>0&&(s+=t[n]+"vatlh"),o>0&&(s+=(""!==s?" ":"")+t[o]+"maH"),r>0&&(s+=(""!==s?" ":"")+t[r]),""===s?"pagh":s}(e);switch(o){case"ss":return s+" lup";case"mm":return s+" tup";case"hh":return s+" rep";case"dd":return s+" jaj";case"MM":return s+" jar";case"yy":return s+" DIS"}}e.defineLocale("tlh",{months:"tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),monthsShort:"jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),monthsParseExact:!0,weekdays:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysShort:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),weekdaysMin:"lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[DaHjaj] LT",nextDay:"[wa’leS] LT",nextWeek:"LLL",lastDay:"[wa’Hu’] LT",lastWeek:"LLL",sameElse:"L"},relativeTime:{future:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"leS":-1!==e.indexOf("jar")?t.slice(0,-3)+"waQ":-1!==e.indexOf("DIS")?t.slice(0,-3)+"nem":t+" pIq"},past:function(e){var t=e;return-1!==e.indexOf("jaj")?t.slice(0,-3)+"Hu’":-1!==e.indexOf("jar")?t.slice(0,-3)+"wen":-1!==e.indexOf("DIS")?t.slice(0,-3)+"ben":t+" ret"},s:"puS lup",ss:n,m:"wa’ tup",mm:n,h:"wa’ rep",hh:n,d:"wa’ jaj",dd:n,M:"wa’ jar",MM:n,y:"wa’ DIS",yy:n},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tr.js":function(e,t,n){!function(e){"use strict";var t={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};e.defineLocale("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),meridiem:function(e,t,n){return e<12?n?"öö":"ÖÖ":n?"ös":"ÖS"},meridiemParse:/öö|ÖÖ|ös|ÖS/,isPM:function(e){return"ös"===e||"ÖS"===e},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[gelecek] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",ss:"%d saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",w:"bir hafta",ww:"%d hafta",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(e,n){switch(n){case"d":case"D":case"Do":case"DD":return e;default:if(0===e)return e+"'ıncı";var o=e%10;return e+(t[o]||t[e%100-o]||t[e>=100?100:null])}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzl.js":function(e,t,n){!function(e){"use strict";function t(e,t,n,o){var r={s:["viensas secunds","'iensas secunds"],ss:[e+" secunds",e+" secunds"],m:["'n míut","'iens míut"],mm:[e+" míuts",e+" míuts"],h:["'n þora","'iensa þora"],hh:[e+" þoras",e+" þoras"],d:["'n ziua","'iensa ziua"],dd:[e+" ziuas",e+" ziuas"],M:["'n mes","'iens mes"],MM:[e+" mesen",e+" mesen"],y:["'n ar","'iens ar"],yy:[e+" ars",e+" ars"]};return o||t?r[n][0]:r[n][1]}e.defineLocale("tzl",{months:"Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),monthsShort:"Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),weekdays:"Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),weekdaysShort:"Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),weekdaysMin:"Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),longDateFormat:{LT:"HH.mm",LTS:"HH.mm.ss",L:"DD.MM.YYYY",LL:"D. MMMM [dallas] YYYY",LLL:"D. MMMM [dallas] YYYY HH.mm",LLLL:"dddd, [li] D. MMMM [dallas] YYYY HH.mm"},meridiemParse:/d\'o|d\'a/i,isPM:function(e){return"d'o"===e.toLowerCase()},meridiem:function(e,t,n){return e>11?n?"d'o":"D'O":n?"d'a":"D'A"},calendar:{sameDay:"[oxhi à] LT",nextDay:"[demà à] LT",nextWeek:"dddd [à] LT",lastDay:"[ieiri à] LT",lastWeek:"[sür el] dddd [lasteu à] LT",sameElse:"L"},relativeTime:{future:"osprei %s",past:"ja%s",s:t,ss:t,m:t,mm:t,h:t,hh:t,d:t,dd:t,M:t,MM:t,y:t,yy:t},dayOfMonthOrdinalParse:/\d{1,2}\./,ordinal:"%d.",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzm-latn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tzm-latn",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",ss:"%d imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/tzm.js":function(e,t,n){!function(e){"use strict";e.defineLocale("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",ss:"%d ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ug-cn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("ug-cn",{months:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),monthsShort:"يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر".split("_"),weekdays:"يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە".split("_"),weekdaysShort:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),weekdaysMin:"يە_دۈ_سە_چا_پە_جۈ_شە".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY-يىلىM-ئاينىڭD-كۈنى",LLL:"YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm",LLLL:"dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm"},meridiemParse:/يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,meridiemHour:function(e,t){return 12===e&&(e=0),"يېرىم كېچە"===t||"سەھەر"===t||"چۈشتىن بۇرۇن"===t?e:"چۈشتىن كېيىن"===t||"كەچ"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var o=100*e+t;return o<600?"يېرىم كېچە":o<900?"سەھەر":o<1130?"چۈشتىن بۇرۇن":o<1230?"چۈش":o<1800?"چۈشتىن كېيىن":"كەچ"},calendar:{sameDay:"[بۈگۈن سائەت] LT",nextDay:"[ئەتە سائەت] LT",nextWeek:"[كېلەركى] dddd [سائەت] LT",lastDay:"[تۆنۈگۈن] LT",lastWeek:"[ئالدىنقى] dddd [سائەت] LT",sameElse:"L"},relativeTime:{future:"%s كېيىن",past:"%s بۇرۇن",s:"نەچچە سېكونت",ss:"%d سېكونت",m:"بىر مىنۇت",mm:"%d مىنۇت",h:"بىر سائەت",hh:"%d سائەت",d:"بىر كۈن",dd:"%d كۈن",M:"بىر ئاي",MM:"%d ئاي",y:"بىر يىل",yy:"%d يىل"},dayOfMonthOrdinalParse:/\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"-كۈنى";case"w":case"W":return e+"-ھەپتە";default:return e}},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uk.js":function(e,t,n){!function(e){"use strict";function t(e,t,n){return"m"===n?t?"хвилина":"хвилину":"h"===n?t?"година":"годину":e+" "+(o=+e,r={ss:t?"секунда_секунди_секунд":"секунду_секунди_секунд",mm:t?"хвилина_хвилини_хвилин":"хвилину_хвилини_хвилин",hh:t?"година_години_годин":"годину_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"}[n].split("_"),o%10==1&&o%100!=11?r[0]:o%10>=2&&o%10<=4&&(o%100<10||o%100>=20)?r[1]:r[2]);var o,r}function n(e){return function(){return e+"о"+(11===this.hours()?"б":"")+"] LT"}}e.defineLocale("uk",{months:{format:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),standalone:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")},monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:function(e,t){var n={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")};return!0===e?n.nominative.slice(1,7).concat(n.nominative.slice(0,1)):e?n[/(\[[ВвУу]\]) ?dddd/.test(t)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(t)?"genitive":"nominative"][e.day()]:n.nominative},weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., HH:mm",LLLL:"dddd, D MMMM YYYY р., HH:mm"},calendar:{sameDay:n("[Сьогодні "),nextDay:n("[Завтра "),lastDay:n("[Вчора "),nextWeek:n("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return n("[Минулої] dddd [").call(this);case 1:case 2:case 4:return n("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",ss:t,m:t,mm:t,h:"годину",hh:t,d:"день",dd:t,M:"місяць",MM:t,y:"рік",yy:t},meridiemParse:/ночі|ранку|дня|вечора/,isPM:function(e){return/^(дня|вечора)$/.test(e)},meridiem:function(e,t,n){return e<4?"ночі":e<12?"ранку":e<17?"дня":"вечора"},dayOfMonthOrdinalParse:/\d{1,2}-(й|го)/,ordinal:function(e,t){switch(t){case"M":case"d":case"DDD":case"w":case"W":return e+"-й";case"D":return e+"-го";default:return e}},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/ur.js":function(e,t,n){!function(e){"use strict";var t=["جنوری","فروری","مارچ","اپریل","مئی","جون","جولائی","اگست","ستمبر","اکتوبر","نومبر","دسمبر"],n=["اتوار","پیر","منگل","بدھ","جمعرات","جمعہ","ہفتہ"];e.defineLocale("ur",{months:t,monthsShort:t,weekdays:n,weekdaysShort:n,weekdaysMin:n,longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd، D MMMM YYYY HH:mm"},meridiemParse:/صبح|شام/,isPM:function(e){return"شام"===e},meridiem:function(e,t,n){return e<12?"صبح":"شام"},calendar:{sameDay:"[آج بوقت] LT",nextDay:"[کل بوقت] LT",nextWeek:"dddd [بوقت] LT",lastDay:"[گذشتہ روز بوقت] LT",lastWeek:"[گذشتہ] dddd [بوقت] LT",sameElse:"L"},relativeTime:{future:"%s بعد",past:"%s قبل",s:"چند سیکنڈ",ss:"%d سیکنڈ",m:"ایک منٹ",mm:"%d منٹ",h:"ایک گھنٹہ",hh:"%d گھنٹے",d:"ایک دن",dd:"%d دن",M:"ایک ماہ",MM:"%d ماہ",y:"ایک سال",yy:"%d سال"},preparse:function(e){return e.replace(/،/g,",")},postformat:function(e){return e.replace(/,/g,"،")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uz-latn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("uz-latn",{months:"Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),monthsShort:"Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),weekdays:"Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),weekdaysShort:"Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),weekdaysMin:"Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Bugun soat] LT [da]",nextDay:"[Ertaga] LT [da]",nextWeek:"dddd [kuni soat] LT [da]",lastDay:"[Kecha soat] LT [da]",lastWeek:"[O'tgan] dddd [kuni soat] LT [da]",sameElse:"L"},relativeTime:{future:"Yaqin %s ichida",past:"Bir necha %s oldin",s:"soniya",ss:"%d soniya",m:"bir daqiqa",mm:"%d daqiqa",h:"bir soat",hh:"%d soat",d:"bir kun",dd:"%d kun",M:"bir oy",MM:"%d oy",y:"bir yil",yy:"%d yil"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/uz.js":function(e,t,n){!function(e){"use strict";e.defineLocale("uz",{months:"январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"D MMMM YYYY, dddd HH:mm"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",ss:"%d фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/vi.js":function(e,t,n){!function(e){"use strict";e.defineLocale("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12".split("_"),monthsParseExact:!0,weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysParseExact:!0,meridiemParse:/sa|ch/i,isPM:function(e){return/^ch$/i.test(e)},meridiem:function(e,t,n){return e<12?n?"sa":"SA":n?"ch":"CH"},longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY HH:mm",LLLL:"dddd, D MMMM [năm] YYYY HH:mm",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY HH:mm",llll:"ddd, D MMM YYYY HH:mm"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần trước lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",ss:"%d giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",w:"một tuần",ww:"%d tuần",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},dayOfMonthOrdinalParse:/\d{1,2}/,ordinal:function(e){return e},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/x-pseudo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("x-pseudo",{months:"J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),monthsShort:"J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),monthsParseExact:!0,weekdays:"S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),weekdaysShort:"S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),weekdaysMin:"S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},calendar:{sameDay:"[T~ódá~ý át] LT",nextDay:"[T~ómó~rró~w át] LT",nextWeek:"dddd [át] LT",lastDay:"[Ý~ést~érdá~ý át] LT",lastWeek:"[L~ást] dddd [át] LT",sameElse:"L"},relativeTime:{future:"í~ñ %s",past:"%s á~gó",s:"á ~féw ~sécó~ñds",ss:"%d s~écóñ~ds",m:"á ~míñ~úté",mm:"%d m~íñú~tés",h:"á~ñ hó~úr",hh:"%d h~óúrs",d:"á ~dáý",dd:"%d d~áýs",M:"á ~móñ~th",MM:"%d m~óñt~hs",y:"á ~ýéár",yy:"%d ý~éárs"},dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/yo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("yo",{months:"Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),monthsShort:"Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),weekdays:"Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),weekdaysShort:"Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),weekdaysMin:"Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),longDateFormat:{LT:"h:mm A",LTS:"h:mm:ss A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY h:mm A",LLLL:"dddd, D MMMM YYYY h:mm A"},calendar:{sameDay:"[Ònì ni] LT",nextDay:"[Ọ̀la ni] LT",nextWeek:"dddd [Ọsẹ̀ tón'bọ] [ni] LT",lastDay:"[Àna ni] LT",lastWeek:"dddd [Ọsẹ̀ tólọ́] [ni] LT",sameElse:"L"},relativeTime:{future:"ní %s",past:"%s kọjá",s:"ìsẹjú aayá die",ss:"aayá %d",m:"ìsẹjú kan",mm:"ìsẹjú %d",h:"wákati kan",hh:"wákati %d",d:"ọjọ́ kan",dd:"ọjọ́ %d",M:"osù kan",MM:"osù %d",y:"ọdún kan",yy:"ọdún %d"},dayOfMonthOrdinalParse:/ọjọ́\s\d{1,2}/,ordinal:"ọjọ́ %d",week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-cn.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"下午"===t||"晚上"===t?e+12:e>=11?e:e+12},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:function(e){return e.week()!==this.week()?"[下]dddLT":"[本]dddLT"},lastDay:"[昨天]LT",lastWeek:function(e){return this.week()!==e.week()?"[上]dddLT":"[本]dddLT"},sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|周)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"周";default:return e}},relativeTime:{future:"%s后",past:"%s前",s:"几秒",ss:"%d 秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",w:"1 周",ww:"%d 周",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},week:{dow:1,doy:4}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-hk.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-hk",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1200?"上午":1200===o?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-mo.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-mo",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"D/M/YYYY",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale/zh-tw.js":function(e,t,n){!function(e){"use strict";e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"週日_週一_週二_週三_週四_週五_週六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日 HH:mm",LLLL:"YYYY年M月D日dddd HH:mm",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},meridiemParse:/凌晨|早上|上午|中午|下午|晚上/,meridiemHour:function(e,t){return 12===e&&(e=0),"凌晨"===t||"早上"===t||"上午"===t?e:"中午"===t?e>=11?e:e+12:"下午"===t||"晚上"===t?e+12:void 0},meridiem:function(e,t,n){var o=100*e+t;return o<600?"凌晨":o<900?"早上":o<1130?"上午":o<1230?"中午":o<1800?"下午":"晚上"},calendar:{sameDay:"[今天] LT",nextDay:"[明天] LT",nextWeek:"[下]dddd LT",lastDay:"[昨天] LT",lastWeek:"[上]dddd LT",sameElse:"L"},dayOfMonthOrdinalParse:/\d{1,2}(日|月|週)/,ordinal:function(e,t){switch(t){case"d":case"D":case"DDD":return e+"日";case"M":return e+"月";case"w":case"W":return e+"週";default:return e}},relativeTime:{future:"%s後",past:"%s前",s:"幾秒",ss:"%d 秒",m:"1 分鐘",mm:"%d 分鐘",h:"1 小時",hh:"%d 小時",d:"1 天",dd:"%d 天",M:"1 個月",MM:"%d 個月",y:"1 年",yy:"%d 年"}})}(n("./node_modules/moment/moment.js"))},"./node_modules/moment/locale sync recursive ^\\.\\/.*$":(e,t,n)=>{var o={"./af":"./node_modules/moment/locale/af.js","./af.js":"./node_modules/moment/locale/af.js","./ar":"./node_modules/moment/locale/ar.js","./ar-dz":"./node_modules/moment/locale/ar-dz.js","./ar-dz.js":"./node_modules/moment/locale/ar-dz.js","./ar-kw":"./node_modules/moment/locale/ar-kw.js","./ar-kw.js":"./node_modules/moment/locale/ar-kw.js","./ar-ly":"./node_modules/moment/locale/ar-ly.js","./ar-ly.js":"./node_modules/moment/locale/ar-ly.js","./ar-ma":"./node_modules/moment/locale/ar-ma.js","./ar-ma.js":"./node_modules/moment/locale/ar-ma.js","./ar-sa":"./node_modules/moment/locale/ar-sa.js","./ar-sa.js":"./node_modules/moment/locale/ar-sa.js","./ar-tn":"./node_modules/moment/locale/ar-tn.js","./ar-tn.js":"./node_modules/moment/locale/ar-tn.js","./ar.js":"./node_modules/moment/locale/ar.js","./az":"./node_modules/moment/locale/az.js","./az.js":"./node_modules/moment/locale/az.js","./be":"./node_modules/moment/locale/be.js","./be.js":"./node_modules/moment/locale/be.js","./bg":"./node_modules/moment/locale/bg.js","./bg.js":"./node_modules/moment/locale/bg.js","./bm":"./node_modules/moment/locale/bm.js","./bm.js":"./node_modules/moment/locale/bm.js","./bn":"./node_modules/moment/locale/bn.js","./bn-bd":"./node_modules/moment/locale/bn-bd.js","./bn-bd.js":"./node_modules/moment/locale/bn-bd.js","./bn.js":"./node_modules/moment/locale/bn.js","./bo":"./node_modules/moment/locale/bo.js","./bo.js":"./node_modules/moment/locale/bo.js","./br":"./node_modules/moment/locale/br.js","./br.js":"./node_modules/moment/locale/br.js","./bs":"./node_modules/moment/locale/bs.js","./bs.js":"./node_modules/moment/locale/bs.js","./ca":"./node_modules/moment/locale/ca.js","./ca.js":"./node_modules/moment/locale/ca.js","./cs":"./node_modules/moment/locale/cs.js","./cs.js":"./node_modules/moment/locale/cs.js","./cv":"./node_modules/moment/locale/cv.js","./cv.js":"./node_modules/moment/locale/cv.js","./cy":"./node_modules/moment/locale/cy.js","./cy.js":"./node_modules/moment/locale/cy.js","./da":"./node_modules/moment/locale/da.js","./da.js":"./node_modules/moment/locale/da.js","./de":"./node_modules/moment/locale/de.js","./de-at":"./node_modules/moment/locale/de-at.js","./de-at.js":"./node_modules/moment/locale/de-at.js","./de-ch":"./node_modules/moment/locale/de-ch.js","./de-ch.js":"./node_modules/moment/locale/de-ch.js","./de.js":"./node_modules/moment/locale/de.js","./dv":"./node_modules/moment/locale/dv.js","./dv.js":"./node_modules/moment/locale/dv.js","./el":"./node_modules/moment/locale/el.js","./el.js":"./node_modules/moment/locale/el.js","./en-au":"./node_modules/moment/locale/en-au.js","./en-au.js":"./node_modules/moment/locale/en-au.js","./en-ca":"./node_modules/moment/locale/en-ca.js","./en-ca.js":"./node_modules/moment/locale/en-ca.js","./en-gb":"./node_modules/moment/locale/en-gb.js","./en-gb.js":"./node_modules/moment/locale/en-gb.js","./en-ie":"./node_modules/moment/locale/en-ie.js","./en-ie.js":"./node_modules/moment/locale/en-ie.js","./en-il":"./node_modules/moment/locale/en-il.js","./en-il.js":"./node_modules/moment/locale/en-il.js","./en-in":"./node_modules/moment/locale/en-in.js","./en-in.js":"./node_modules/moment/locale/en-in.js","./en-nz":"./node_modules/moment/locale/en-nz.js","./en-nz.js":"./node_modules/moment/locale/en-nz.js","./en-sg":"./node_modules/moment/locale/en-sg.js","./en-sg.js":"./node_modules/moment/locale/en-sg.js","./eo":"./node_modules/moment/locale/eo.js","./eo.js":"./node_modules/moment/locale/eo.js","./es":"./node_modules/moment/locale/es.js","./es-do":"./node_modules/moment/locale/es-do.js","./es-do.js":"./node_modules/moment/locale/es-do.js","./es-mx":"./node_modules/moment/locale/es-mx.js","./es-mx.js":"./node_modules/moment/locale/es-mx.js","./es-us":"./node_modules/moment/locale/es-us.js","./es-us.js":"./node_modules/moment/locale/es-us.js","./es.js":"./node_modules/moment/locale/es.js","./et":"./node_modules/moment/locale/et.js","./et.js":"./node_modules/moment/locale/et.js","./eu":"./node_modules/moment/locale/eu.js","./eu.js":"./node_modules/moment/locale/eu.js","./fa":"./node_modules/moment/locale/fa.js","./fa.js":"./node_modules/moment/locale/fa.js","./fi":"./node_modules/moment/locale/fi.js","./fi.js":"./node_modules/moment/locale/fi.js","./fil":"./node_modules/moment/locale/fil.js","./fil.js":"./node_modules/moment/locale/fil.js","./fo":"./node_modules/moment/locale/fo.js","./fo.js":"./node_modules/moment/locale/fo.js","./fr":"./node_modules/moment/locale/fr.js","./fr-ca":"./node_modules/moment/locale/fr-ca.js","./fr-ca.js":"./node_modules/moment/locale/fr-ca.js","./fr-ch":"./node_modules/moment/locale/fr-ch.js","./fr-ch.js":"./node_modules/moment/locale/fr-ch.js","./fr.js":"./node_modules/moment/locale/fr.js","./fy":"./node_modules/moment/locale/fy.js","./fy.js":"./node_modules/moment/locale/fy.js","./ga":"./node_modules/moment/locale/ga.js","./ga.js":"./node_modules/moment/locale/ga.js","./gd":"./node_modules/moment/locale/gd.js","./gd.js":"./node_modules/moment/locale/gd.js","./gl":"./node_modules/moment/locale/gl.js","./gl.js":"./node_modules/moment/locale/gl.js","./gom-deva":"./node_modules/moment/locale/gom-deva.js","./gom-deva.js":"./node_modules/moment/locale/gom-deva.js","./gom-latn":"./node_modules/moment/locale/gom-latn.js","./gom-latn.js":"./node_modules/moment/locale/gom-latn.js","./gu":"./node_modules/moment/locale/gu.js","./gu.js":"./node_modules/moment/locale/gu.js","./he":"./node_modules/moment/locale/he.js","./he.js":"./node_modules/moment/locale/he.js","./hi":"./node_modules/moment/locale/hi.js","./hi.js":"./node_modules/moment/locale/hi.js","./hr":"./node_modules/moment/locale/hr.js","./hr.js":"./node_modules/moment/locale/hr.js","./hu":"./node_modules/moment/locale/hu.js","./hu.js":"./node_modules/moment/locale/hu.js","./hy-am":"./node_modules/moment/locale/hy-am.js","./hy-am.js":"./node_modules/moment/locale/hy-am.js","./id":"./node_modules/moment/locale/id.js","./id.js":"./node_modules/moment/locale/id.js","./is":"./node_modules/moment/locale/is.js","./is.js":"./node_modules/moment/locale/is.js","./it":"./node_modules/moment/locale/it.js","./it-ch":"./node_modules/moment/locale/it-ch.js","./it-ch.js":"./node_modules/moment/locale/it-ch.js","./it.js":"./node_modules/moment/locale/it.js","./ja":"./node_modules/moment/locale/ja.js","./ja.js":"./node_modules/moment/locale/ja.js","./jv":"./node_modules/moment/locale/jv.js","./jv.js":"./node_modules/moment/locale/jv.js","./ka":"./node_modules/moment/locale/ka.js","./ka.js":"./node_modules/moment/locale/ka.js","./kk":"./node_modules/moment/locale/kk.js","./kk.js":"./node_modules/moment/locale/kk.js","./km":"./node_modules/moment/locale/km.js","./km.js":"./node_modules/moment/locale/km.js","./kn":"./node_modules/moment/locale/kn.js","./kn.js":"./node_modules/moment/locale/kn.js","./ko":"./node_modules/moment/locale/ko.js","./ko.js":"./node_modules/moment/locale/ko.js","./ku":"./node_modules/moment/locale/ku.js","./ku.js":"./node_modules/moment/locale/ku.js","./ky":"./node_modules/moment/locale/ky.js","./ky.js":"./node_modules/moment/locale/ky.js","./lb":"./node_modules/moment/locale/lb.js","./lb.js":"./node_modules/moment/locale/lb.js","./lo":"./node_modules/moment/locale/lo.js","./lo.js":"./node_modules/moment/locale/lo.js","./lt":"./node_modules/moment/locale/lt.js","./lt.js":"./node_modules/moment/locale/lt.js","./lv":"./node_modules/moment/locale/lv.js","./lv.js":"./node_modules/moment/locale/lv.js","./me":"./node_modules/moment/locale/me.js","./me.js":"./node_modules/moment/locale/me.js","./mi":"./node_modules/moment/locale/mi.js","./mi.js":"./node_modules/moment/locale/mi.js","./mk":"./node_modules/moment/locale/mk.js","./mk.js":"./node_modules/moment/locale/mk.js","./ml":"./node_modules/moment/locale/ml.js","./ml.js":"./node_modules/moment/locale/ml.js","./mn":"./node_modules/moment/locale/mn.js","./mn.js":"./node_modules/moment/locale/mn.js","./mr":"./node_modules/moment/locale/mr.js","./mr.js":"./node_modules/moment/locale/mr.js","./ms":"./node_modules/moment/locale/ms.js","./ms-my":"./node_modules/moment/locale/ms-my.js","./ms-my.js":"./node_modules/moment/locale/ms-my.js","./ms.js":"./node_modules/moment/locale/ms.js","./mt":"./node_modules/moment/locale/mt.js","./mt.js":"./node_modules/moment/locale/mt.js","./my":"./node_modules/moment/locale/my.js","./my.js":"./node_modules/moment/locale/my.js","./nb":"./node_modules/moment/locale/nb.js","./nb.js":"./node_modules/moment/locale/nb.js","./ne":"./node_modules/moment/locale/ne.js","./ne.js":"./node_modules/moment/locale/ne.js","./nl":"./node_modules/moment/locale/nl.js","./nl-be":"./node_modules/moment/locale/nl-be.js","./nl-be.js":"./node_modules/moment/locale/nl-be.js","./nl.js":"./node_modules/moment/locale/nl.js","./nn":"./node_modules/moment/locale/nn.js","./nn.js":"./node_modules/moment/locale/nn.js","./oc-lnc":"./node_modules/moment/locale/oc-lnc.js","./oc-lnc.js":"./node_modules/moment/locale/oc-lnc.js","./pa-in":"./node_modules/moment/locale/pa-in.js","./pa-in.js":"./node_modules/moment/locale/pa-in.js","./pl":"./node_modules/moment/locale/pl.js","./pl.js":"./node_modules/moment/locale/pl.js","./pt":"./node_modules/moment/locale/pt.js","./pt-br":"./node_modules/moment/locale/pt-br.js","./pt-br.js":"./node_modules/moment/locale/pt-br.js","./pt.js":"./node_modules/moment/locale/pt.js","./ro":"./node_modules/moment/locale/ro.js","./ro.js":"./node_modules/moment/locale/ro.js","./ru":"./node_modules/moment/locale/ru.js","./ru.js":"./node_modules/moment/locale/ru.js","./sd":"./node_modules/moment/locale/sd.js","./sd.js":"./node_modules/moment/locale/sd.js","./se":"./node_modules/moment/locale/se.js","./se.js":"./node_modules/moment/locale/se.js","./si":"./node_modules/moment/locale/si.js","./si.js":"./node_modules/moment/locale/si.js","./sk":"./node_modules/moment/locale/sk.js","./sk.js":"./node_modules/moment/locale/sk.js","./sl":"./node_modules/moment/locale/sl.js","./sl.js":"./node_modules/moment/locale/sl.js","./sq":"./node_modules/moment/locale/sq.js","./sq.js":"./node_modules/moment/locale/sq.js","./sr":"./node_modules/moment/locale/sr.js","./sr-cyrl":"./node_modules/moment/locale/sr-cyrl.js","./sr-cyrl.js":"./node_modules/moment/locale/sr-cyrl.js","./sr.js":"./node_modules/moment/locale/sr.js","./ss":"./node_modules/moment/locale/ss.js","./ss.js":"./node_modules/moment/locale/ss.js","./sv":"./node_modules/moment/locale/sv.js","./sv.js":"./node_modules/moment/locale/sv.js","./sw":"./node_modules/moment/locale/sw.js","./sw.js":"./node_modules/moment/locale/sw.js","./ta":"./node_modules/moment/locale/ta.js","./ta.js":"./node_modules/moment/locale/ta.js","./te":"./node_modules/moment/locale/te.js","./te.js":"./node_modules/moment/locale/te.js","./tet":"./node_modules/moment/locale/tet.js","./tet.js":"./node_modules/moment/locale/tet.js","./tg":"./node_modules/moment/locale/tg.js","./tg.js":"./node_modules/moment/locale/tg.js","./th":"./node_modules/moment/locale/th.js","./th.js":"./node_modules/moment/locale/th.js","./tk":"./node_modules/moment/locale/tk.js","./tk.js":"./node_modules/moment/locale/tk.js","./tl-ph":"./node_modules/moment/locale/tl-ph.js","./tl-ph.js":"./node_modules/moment/locale/tl-ph.js","./tlh":"./node_modules/moment/locale/tlh.js","./tlh.js":"./node_modules/moment/locale/tlh.js","./tr":"./node_modules/moment/locale/tr.js","./tr.js":"./node_modules/moment/locale/tr.js","./tzl":"./node_modules/moment/locale/tzl.js","./tzl.js":"./node_modules/moment/locale/tzl.js","./tzm":"./node_modules/moment/locale/tzm.js","./tzm-latn":"./node_modules/moment/locale/tzm-latn.js","./tzm-latn.js":"./node_modules/moment/locale/tzm-latn.js","./tzm.js":"./node_modules/moment/locale/tzm.js","./ug-cn":"./node_modules/moment/locale/ug-cn.js","./ug-cn.js":"./node_modules/moment/locale/ug-cn.js","./uk":"./node_modules/moment/locale/uk.js","./uk.js":"./node_modules/moment/locale/uk.js","./ur":"./node_modules/moment/locale/ur.js","./ur.js":"./node_modules/moment/locale/ur.js","./uz":"./node_modules/moment/locale/uz.js","./uz-latn":"./node_modules/moment/locale/uz-latn.js","./uz-latn.js":"./node_modules/moment/locale/uz-latn.js","./uz.js":"./node_modules/moment/locale/uz.js","./vi":"./node_modules/moment/locale/vi.js","./vi.js":"./node_modules/moment/locale/vi.js","./x-pseudo":"./node_modules/moment/locale/x-pseudo.js","./x-pseudo.js":"./node_modules/moment/locale/x-pseudo.js","./yo":"./node_modules/moment/locale/yo.js","./yo.js":"./node_modules/moment/locale/yo.js","./zh-cn":"./node_modules/moment/locale/zh-cn.js","./zh-cn.js":"./node_modules/moment/locale/zh-cn.js","./zh-hk":"./node_modules/moment/locale/zh-hk.js","./zh-hk.js":"./node_modules/moment/locale/zh-hk.js","./zh-mo":"./node_modules/moment/locale/zh-mo.js","./zh-mo.js":"./node_modules/moment/locale/zh-mo.js","./zh-tw":"./node_modules/moment/locale/zh-tw.js","./zh-tw.js":"./node_modules/moment/locale/zh-tw.js"};function r(e){var t=s(e);return n(t)}function s(e){if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=s,e.exports=r,r.id="./node_modules/moment/locale sync recursive ^\\.\\/.*$"},"./node_modules/ng-csv/build/ng-csv.min.js":(e,t)=>{var n;n=window,document,angular.module("ngCsv.config",[]).value("ngCsv.config",{debug:!0}).config(["$compileProvider",function(e){angular.isDefined(e.urlSanitizationWhitelist)?e.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/):e.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|data):/)}]),angular.module("ngCsv.directives",["ngCsv.services"]),angular.module("ngCsv.services",[]),angular.module("ngCsv",["ngCsv.config","ngCsv.services","ngCsv.directives","ngSanitize"]),e.exports===t&&(e.exports="ngCsv"),angular.module("ngCsv.services").service("CSV",["$q",function(e){var t="\r\n",n={"\\t":"\t","\\b":"\b","\\v":"\v","\\f":"\f","\\r":"\r"};this.stringifyField=function(e,t){return"locale"===t.decimalSep&&this.isFloat(e)?e.toLocaleString():"."!==t.decimalSep&&this.isFloat(e)?e.toString().replace(".",t.decimalSep):"string"==typeof e?(e=e.replace(/"/g,'""'),(t.quoteStrings||e.indexOf(",")>-1||e.indexOf("\n")>-1||e.indexOf("\r")>-1)&&(e=t.txtDelim+e+t.txtDelim),e):"boolean"==typeof e?e?"TRUE":"FALSE":e},this.isFloat=function(e){return+e===e&&(!isFinite(e)||Boolean(e%1))},this.stringify=function(n,o){var r=e.defer(),s=this,a="",i="",d=e.when(n).then((function(e){var n,d;angular.isDefined(o.header)&&o.header&&(n=[],angular.forEach(o.header,(function(e){this.push(s.stringifyField(e,o))}),n),d=n.join(o.fieldSep?o.fieldSep:","),i+=d+t);var u,m,l=[];angular.isArray(e)?l=e:angular.isFunction(e)&&(l=e()),angular.isDefined(o.label)&&o.label&&"boolean"==typeof o.label&&(u=[],angular.forEach(l[0],(function(e,t){this.push(s.stringifyField(t,o))}),u),m=u.join(o.fieldSep?o.fieldSep:","),i+=m+t),angular.forEach(l,(function(e,n){var r,a,d=angular.copy(l[n]);a=[];var u=o.columnOrder?o.columnOrder:d;angular.forEach(u,(function(e){var t=o.columnOrder?d[e]:e;this.push(s.stringifyField(t,o))}),a),r=a.join(o.fieldSep?o.fieldSep:","),i+=n'),i=angular.element(a.children()[0]);i.attr("href",n.URL.createObjectURL(o)),i.attr("download",e.getFilename()),i.attr("target","_blank"),r.find("body").append(a),s((function(){i[0].click(),i.remove()}),null)}}()})),e.$apply()}))}}}])},"./src/js/chat/chat.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/dc49a9ba939f8c099868.html"},"./src/js/closing/closing.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/00860aee362cdeeb1080.html"},"./src/js/offline/offline.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/9962474df74f9405ac72.html"},"./src/js/online/online.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/caf0e553108b226443aa.html"},"./src/js/unmanaged/unmanaged.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/3f18dac5f545add792db.html"},"./src/js/waiting/waiting.tpl.html":(e,t,n)=>{"use strict";e.exports=n.p+"templates/6043a16afdb829ba5934.html"}},e=>{var t=t=>e(e.s=t);e.O(0,["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"],(()=>(t("./node_modules/jquery/dist/jquery.js"),t("./node_modules/angular/index-exposed.js"),t("./node_modules/moment/moment.js"),t("./node_modules/@flowjs/flow.js/src/flow.js"),t("./node_modules/emojione/lib/js/emojione.js"),t("./src/js/index.module.js")))),e.O()}]); +(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 `